From 998d59d4c40ee96a485d56cef25cd227deab325a Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Wed, 28 Aug 2019 12:31:28 -0400 Subject: [PATCH 01/13] Creating compiled lambda expression math class for future use --- UnitsNet/MathFunctions.cs | 58 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 UnitsNet/MathFunctions.cs diff --git a/UnitsNet/MathFunctions.cs b/UnitsNet/MathFunctions.cs new file mode 100644 index 0000000000..fb72beb909 --- /dev/null +++ b/UnitsNet/MathFunctions.cs @@ -0,0 +1,58 @@ +using System; +using System.Linq.Expressions; + +namespace UnitsNet +{ + /// + /// Compiled lambda math functions. + /// + /// The type of the left hand side of the binary expression. + /// The type of the right hand side of the binary expression. + /// The type of the result of the binary expression. + internal static class MathFunctions + { + static MathFunctions() + { + Multiply = CreateBinaryFunction(Expression.Multiply); + Divide = CreateBinaryFunction(Expression.Divide); + Add = CreateBinaryFunction(Expression.Add); + Subtract = CreateBinaryFunction(Expression.Subtract); + } + + /// + /// A function to multiply two numbers. + /// + internal static Func Multiply { get; } + + /// + /// A function to divide two numbers. + /// + internal static Func Divide { get; } + + /// + /// A function to add two numbers. + /// + internal static Func Add { get; } + + /// + /// A function to subtract two numbers. + /// + internal static Func Subtract { get; } + + /// + /// Creates a binary function using the given creator. + /// + /// The binary expression creation function. + /// The binary function. + private static Func CreateBinaryFunction(Func expressionCreationFunction) + { + var leftParameter = Expression.Parameter(typeof(TLeft), "left"); + var rightParameter = Expression.Parameter(typeof(TRight), "right"); + + var binaryExpression = expressionCreationFunction(leftParameter, rightParameter); + var lambda = Expression.Lambda>(binaryExpression, leftParameter, rightParameter); + + return lambda.Compile(); + } + } +} From 3cfb83ad8767f33afb91bac77f9c532ff0c99f31 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 3 Sep 2019 10:12:54 -0400 Subject: [PATCH 02/13] Updating compiled lambdas. Add a couple tests --- UnitsNet.Tests/CompiledLambdasTests.cs | 36 +++ UnitsNet/CompiledLambdas.cs | 347 +++++++++++++++++++++++++ UnitsNet/MathFunctions.cs | 58 ----- 3 files changed, 383 insertions(+), 58 deletions(-) create mode 100644 UnitsNet.Tests/CompiledLambdasTests.cs create mode 100644 UnitsNet/CompiledLambdas.cs delete mode 100644 UnitsNet/MathFunctions.cs diff --git a/UnitsNet.Tests/CompiledLambdasTests.cs b/UnitsNet.Tests/CompiledLambdasTests.cs new file mode 100644 index 0000000000..831f038722 --- /dev/null +++ b/UnitsNet.Tests/CompiledLambdasTests.cs @@ -0,0 +1,36 @@ +using System; +using Xunit; + +namespace UnitsNet.Tests +{ + public class CompiledLambdasTests + { + [Theory] + [InlineData( 3.0, 2.0, 6.0 )] + public void MultiplyReturnsExpectedValues( TLeft left, TRight right, TResult result ) + { + Assert.Equal( result, CompiledLambdas.Multiply( left, right ) ); + } + + [Theory] + [InlineData( 6.0, 2.0, 3.0 )] + public void DivideReturnsExpectedValues( TLeft left, TRight right, TResult result ) + { + Assert.Equal( result, CompiledLambdas.Divide( left, right ) ); + } + + [Theory] + [InlineData( 3.0, 2.0, 5.0 )] + public void AddReturnsExpectedValues( TLeft left, TRight right, TResult result ) + { + Assert.Equal( result, CompiledLambdas.Add( left, right ) ); + } + + [Theory] + [InlineData( 3.0, 2.0, 1.0 )] + public void SubtractReturnsExpectedValues( TLeft left, TRight right, TResult result ) + { + Assert.Equal( result, CompiledLambdas.Subtract( left, right ) ); + } + } +} diff --git a/UnitsNet/CompiledLambdas.cs b/UnitsNet/CompiledLambdas.cs new file mode 100644 index 0000000000..8d46f9f338 --- /dev/null +++ b/UnitsNet/CompiledLambdas.cs @@ -0,0 +1,347 @@ +using System; +using System.Linq.Expressions; + +namespace UnitsNet +{ + /// + /// Compiled lambda expressions that can be invoked with generic run-time parameters. + /// + internal static class CompiledLambdas + { + /// + /// Multiplies the given values. + /// + /// The type of the operation (left hand side, right hand side, and result). + /// The left hand side parameter. + /// The right hand side parameter. + /// The multiplied result. + internal static T Multiply( T left, T right ) => Multiply( left, right ); + + /// + /// Multiplies the given values. + /// + /// The type of the left hand side. + /// The type of the right hand side. + /// The result type. + /// The left hand side parameter. + /// The right hand side parameter. + /// The multiplied result. + internal static TResult Multiply( TLeft left, TRight right ) => + MultiplyImplementation.Invoke( left, right ); + + /// + /// Divides the given values. + /// + /// The type of the operation (left hand side, right hand side, and result). + /// The left hand side parameter. + /// The right hand side parameter. + /// The divided result. + internal static T Divide( T left, T right ) => Divide( left, right ); + + /// + /// Divides the given values. + /// + /// The type of the left hand side. + /// The type of the right hand side. + /// The result type. + /// The left hand side parameter. + /// The right hand side parameter. + /// The divided result. + internal static TResult Divide( TLeft left, TRight right ) => + DivideImplementation.Invoke( left, right ); + + /// + /// Adds the given values. + /// + /// The type of the operation (left hand side, right hand side, and result). + /// The left hand side parameter. + /// The right hand side parameter. + /// The added result. + internal static T Add( T left, T right ) => Add( left, right ); + + /// + /// Adds the given values. + /// + /// The type of the left hand side. + /// The type of the right hand side. + /// The result type. + /// The left hand side parameter. + /// The right hand side parameter. + /// The added result. + internal static TResult Add( TLeft left, TRight right ) => + AddImplementation.Invoke( left, right ); + + /// + /// Subtracts the given values. + /// + /// The type of the operation (left hand side, right hand side, and result). + /// The left hand side parameter. + /// The right hand side parameter. + /// The subtracted result. + internal static T Subtract( T left, T right ) => Subtract( left, right ); + + /// + /// Subtracts the given values. + /// + /// The type of the left hand side. + /// The type of the right hand side. + /// The result type. + /// The left hand side parameter. + /// The right hand side parameter. + /// The subtracted result. + internal static TResult Subtract( TLeft left, TRight right ) => + SubtractImplementation.Invoke( left, right ); + + /// + /// Gets the modulus of the given values. + /// + /// The type of the operation (left hand side, right hand side, and result). + /// The left hand side parameter. + /// The right hand side parameter. + /// The modulus. + internal static T Modulo( T left, T right ) => Modulo( left, right ); + + /// + /// Gets the modulus of the given values. + /// + /// The type of the left hand side. + /// The type of the right hand side. + /// The result type. + /// The left hand side parameter. + /// The right hand side parameter. + /// The modulus. + internal static TResult Modulo( TLeft left, TRight right ) => + ModuloImplementation.Invoke( left, right ); + + /// + /// Checks if the left and right hand side are equal. + /// + /// The type of both the left and right hand side. + /// The left hand side parameter. + /// The right hand side parameter. + /// True if equal, otherwise false. + internal static bool Equal( T left, T right ) => Equal( left, right ); + + /// + /// Checks if the left and right hand side are equal. + /// + /// The type of the left hand side. + /// The type of the right hand side. + /// The left hand side parameter. + /// The right hand side parameter. + /// True if equal, otherwise false. + internal static bool Equal( TLeft left, TRight right ) => + EqualImplementation.Invoke( left, right ); + + /// + /// Checks if the left and right hand side are not equal. + /// + /// The type of both the left and right hand side. + /// The left hand side parameter. + /// The right hand side parameter. + /// True if not equal, otherwise false. + internal static bool NotEqual( T left, T right ) => NotEqual( left, right ); + + /// + /// Checks if the left and right hand side are not equal. + /// + /// The type of the left hand side. + /// The type of the right hand side. + /// The left hand side parameter. + /// The right hand side parameter. + /// True if not equal, otherwise false. + internal static bool NotEqual( TLeft left, TRight right ) => + NotEqualImplementation.Invoke( left, right ); + + /// + /// Checks if the left hand side is less than the right hand side. + /// + /// The type of both the left and right hand side. + /// The left hand side parameter. + /// The right hand side parameter. + /// True if the left hand side is less than the right hand side, otherwise false. + internal static bool LessThan( T left, T right ) => LessThan( left, right ); + + /// + /// Checks if the left hand side is less than the right hand side. + /// + /// The type of the left hand side. + /// The type of the right hand side. + /// The left hand side parameter. + /// The right hand side parameter. + /// True if the left hand side is less than the right hand side, otherwise false. + internal static bool LessThan( TLeft left, TRight right ) => + LessThanImplementation.Invoke( left, right ); + + /// + /// Checks if the left hand side is greater than the right hand side. + /// + /// The type of both the left and right hand side. + /// The left hand side parameter. + /// The right hand side parameter. + /// True if the left hand side is greater than the right hand side, otherwise false. + internal static bool GreaterThan( T left, T right ) => GreaterThan( left, right ); + + /// + /// Checks if the left hand side is greater than the right hand side. + /// + /// The type of the left hand side. + /// The type of the right hand side. + /// The left hand side parameter. + /// The right hand side parameter. + /// True if the left hand side is greater than the right hand side, otherwise false. + internal static bool GreaterThan( TLeft left, TRight right ) => + GreaterThanImplementation.Invoke( left, right ); + + /// + /// Checks if the left hand side is greater than or equal to the right hand side. + /// + /// The type of both the left and right hand side. + /// The left hand side parameter. + /// The right hand side parameter. + /// True if the left hand side is greater than or equal to the right hand side, otherwise false. + internal static bool GreaterThanOrEqual( T left, T right ) => GreaterThanOrEqual( left, right ); + + /// + /// Checks if the left hand side is greater than or equal to the right hand side. + /// + /// The type of the left hand side. + /// The type of the right hand side. + /// The left hand side parameter. + /// The right hand side parameter. + /// True if the left hand side is greater than or equal to the right hand side, otherwise false. + internal static bool GreaterThanOrEqual( TLeft left, TRight right ) => + GreaterThanOrEqualImplementation.Invoke( left, right ); + + /// + /// Checks if the left hand side is less than or equal to the right hand side. + /// + /// The type of both the left and right hand side. + /// The left hand side parameter. + /// The right hand side parameter. + /// True if the left hand side is less than or equal to the right hand side, otherwise false. + internal static bool LessThanOrEqual( T left, T right ) => LessThanOrEqual( left, right ); + + /// + /// Checks if the left hand side is less than or equal to the right hand side. + /// + /// The type of the left hand side. + /// The type of the right hand side. + /// The left hand side parameter. + /// The right hand side parameter. + /// True if the left hand side is less than or equal to the right hand side, otherwise false. + internal static bool LessThanOrEqual( TLeft left, TRight right ) => + LessThanOrEqualImplementation.Invoke( left, right ); + + #region Implementation Classes + + private static class MultiplyImplementation + { + private readonly static Func Function = + CreateBinaryFunction( Expression.Multiply ); + + internal static TResult Invoke( TLeft left, TRight right) => Function( left, right ); + } + + private static class DivideImplementation + { + private readonly static Func Function = + CreateBinaryFunction( Expression.Divide ); + + internal static TResult Invoke( TLeft left, TRight right ) => Function( left, right ); + } + + private static class AddImplementation + { + private readonly static Func Function = + CreateBinaryFunction( Expression.Add ); + + internal static TResult Invoke( TLeft left, TRight right ) => Function( left, right ); + } + + private static class SubtractImplementation + { + private readonly static Func Function = + CreateBinaryFunction( Expression.Subtract ); + + internal static TResult Invoke( TLeft left, TRight right ) => Function( left, right ); + } + + private static class ModuloImplementation + { + private readonly static Func Function = + CreateBinaryFunction( Expression.Modulo ); + + internal static TResult Invoke( TLeft left, TRight right ) => Function( left, right ); + } + + private static class EqualImplementation + { + private readonly static Func Function = + CreateBinaryFunction( Expression.Equal ); + + internal static bool Invoke( TLeft left, TRight right ) => Function( left, right ); + } + + private static class NotEqualImplementation + { + private readonly static Func Function = + CreateBinaryFunction( Expression.NotEqual ); + + internal static bool Invoke( TLeft left, TRight right ) => Function( left, right ); + } + + private static class LessThanImplementation + { + private readonly static Func Function = + CreateBinaryFunction( Expression.LessThan ); + + internal static bool Invoke( TLeft left, TRight right ) => Function( left, right ); + } + + private static class GreaterThanImplementation + { + private readonly static Func Function = + CreateBinaryFunction( Expression.GreaterThan ); + + internal static bool Invoke( TLeft left, TRight right ) => Function( left, right ); + } + + private static class GreaterThanOrEqualImplementation + { + private readonly static Func Function = + CreateBinaryFunction( Expression.GreaterThanOrEqual ); + + internal static bool Invoke( TLeft left, TRight right ) => Function( left, right ); + } + + private static class LessThanOrEqualImplementation + { + private readonly static Func Function = + CreateBinaryFunction( Expression.LessThanOrEqual ); + + internal static bool Invoke( TLeft left, TRight right ) => Function( left, right ); + } + + #endregion + + /// + /// Creates a compiled lambda for the given . + /// + /// The type of the left hand side of the binary operation. + /// The type of the right hand side of the binary operation. + /// The type of the result of the binary operation. + /// The function that creates a binary expression to compile. + /// The compiled binary expression. + private static Func CreateBinaryFunction( Func expressionCreationFunction ) + { + var leftParameter = Expression.Parameter( typeof( TLeft ), "left" ); + var rightParameter = Expression.Parameter( typeof( TRight ), "right" ); + + var binaryExpression = expressionCreationFunction( leftParameter, rightParameter ); + var lambda = Expression.Lambda>( binaryExpression, leftParameter, rightParameter ); + + return lambda.Compile(); + } + } +} diff --git a/UnitsNet/MathFunctions.cs b/UnitsNet/MathFunctions.cs deleted file mode 100644 index fb72beb909..0000000000 --- a/UnitsNet/MathFunctions.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Linq.Expressions; - -namespace UnitsNet -{ - /// - /// Compiled lambda math functions. - /// - /// The type of the left hand side of the binary expression. - /// The type of the right hand side of the binary expression. - /// The type of the result of the binary expression. - internal static class MathFunctions - { - static MathFunctions() - { - Multiply = CreateBinaryFunction(Expression.Multiply); - Divide = CreateBinaryFunction(Expression.Divide); - Add = CreateBinaryFunction(Expression.Add); - Subtract = CreateBinaryFunction(Expression.Subtract); - } - - /// - /// A function to multiply two numbers. - /// - internal static Func Multiply { get; } - - /// - /// A function to divide two numbers. - /// - internal static Func Divide { get; } - - /// - /// A function to add two numbers. - /// - internal static Func Add { get; } - - /// - /// A function to subtract two numbers. - /// - internal static Func Subtract { get; } - - /// - /// Creates a binary function using the given creator. - /// - /// The binary expression creation function. - /// The binary function. - private static Func CreateBinaryFunction(Func expressionCreationFunction) - { - var leftParameter = Expression.Parameter(typeof(TLeft), "left"); - var rightParameter = Expression.Parameter(typeof(TRight), "right"); - - var binaryExpression = expressionCreationFunction(leftParameter, rightParameter); - var lambda = Expression.Lambda>(binaryExpression, leftParameter, rightParameter); - - return lambda.Compile(); - } - } -} From cc31358142c99fe211428b12856128e2567364d0 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 3 Sep 2019 10:21:10 -0400 Subject: [PATCH 03/13] Cover all methods --- UnitsNet.Tests/CompiledLambdasTests.cs | 75 +++++++++++++++++++++++--- UnitsNet/CompiledLambdas.cs | 52 +++++++++--------- 2 files changed, 93 insertions(+), 34 deletions(-) diff --git a/UnitsNet.Tests/CompiledLambdasTests.cs b/UnitsNet.Tests/CompiledLambdasTests.cs index 831f038722..55de9f358a 100644 --- a/UnitsNet.Tests/CompiledLambdasTests.cs +++ b/UnitsNet.Tests/CompiledLambdasTests.cs @@ -7,30 +7,89 @@ public class CompiledLambdasTests { [Theory] [InlineData( 3.0, 2.0, 6.0 )] - public void MultiplyReturnsExpectedValues( TLeft left, TRight right, TResult result ) + public void MultiplyReturnsExpectedValues( TLeft left, TRight right, TResult expected ) { - Assert.Equal( result, CompiledLambdas.Multiply( left, right ) ); + Assert.Equal( expected, CompiledLambdas.Multiply( left, right ) ); } [Theory] [InlineData( 6.0, 2.0, 3.0 )] - public void DivideReturnsExpectedValues( TLeft left, TRight right, TResult result ) + public void DivideReturnsExpectedValues( TLeft left, TRight right, TResult expected ) { - Assert.Equal( result, CompiledLambdas.Divide( left, right ) ); + Assert.Equal( expected, CompiledLambdas.Divide( left, right ) ); } [Theory] [InlineData( 3.0, 2.0, 5.0 )] - public void AddReturnsExpectedValues( TLeft left, TRight right, TResult result ) + public void AddReturnsExpectedValues( TLeft left, TRight right, TResult expected ) { - Assert.Equal( result, CompiledLambdas.Add( left, right ) ); + Assert.Equal( expected, CompiledLambdas.Add( left, right ) ); } [Theory] [InlineData( 3.0, 2.0, 1.0 )] - public void SubtractReturnsExpectedValues( TLeft left, TRight right, TResult result ) + public void SubtractReturnsExpectedValues( TLeft left, TRight right, TResult expected ) { - Assert.Equal( result, CompiledLambdas.Subtract( left, right ) ); + Assert.Equal( expected, CompiledLambdas.Subtract( left, right ) ); + } + + [Theory] + [InlineData( 3.0, 2.0, 1.0 )] + public void ModuloReturnsExpectedValues( TLeft left, TRight right, TResult expected ) + { + Assert.Equal( expected, CompiledLambdas.Modulo( left, right ) ); + } + + [Theory] + [InlineData( 3.0, 3.0, true )] + [InlineData( 3.0, 2.0, false )] + public void EqualReturnsExpectedValues( TLeft left, TRight right, bool expected ) + { + Assert.Equal( expected, CompiledLambdas.Equal( left, right ) ); + } + + [Theory] + [InlineData( 3.0, 3.0, false )] + [InlineData( 3.0, 2.0, true )] + public void NotEqualReturnsExpectedValues( TLeft left, TRight right, bool expected ) + { + Assert.Equal( expected, CompiledLambdas.NotEqual( left, right ) ); + } + + [Theory] + [InlineData( 2.0, 3.0, true )] + [InlineData( 2.0, 2.0, false )] + [InlineData( 3.0, 2.0, false )] + public void LessThanReturnsExpectedValues( TLeft left, TRight right, bool expected ) + { + Assert.Equal( expected, CompiledLambdas.LessThan( left, right ) ); + } + + [Theory] + [InlineData( 2.0, 3.0, true )] + [InlineData( 2.0, 2.0, true )] + [InlineData( 3.0, 2.0, false )] + public void LessThanOrEqualReturnsExpectedValues( TLeft left, TRight right, bool expected ) + { + Assert.Equal( expected, CompiledLambdas.LessThanOrEqual( left, right ) ); + } + + [Theory] + [InlineData( 3.0, 2.0, true )] + [InlineData( 3.0, 3.0, false )] + [InlineData( 3.0, 4.0, false )] + public void GreaterThanReturnsExpectedValues( TLeft left, TRight right, bool expected ) + { + Assert.Equal( expected, CompiledLambdas.GreaterThan( left, right ) ); + } + + [Theory] + [InlineData( 3.0, 2.0, true )] + [InlineData( 3.0, 3.0, true )] + [InlineData( 3.0, 4.0, false )] + public void GreaterThanOrEqualReturnsExpectedValues( TLeft left, TRight right, bool expected ) + { + Assert.Equal( expected, CompiledLambdas.GreaterThanOrEqual( left, right ) ); } } } diff --git a/UnitsNet/CompiledLambdas.cs b/UnitsNet/CompiledLambdas.cs index 8d46f9f338..9a48f03a94 100644 --- a/UnitsNet/CompiledLambdas.cs +++ b/UnitsNet/CompiledLambdas.cs @@ -173,6 +173,26 @@ internal static bool NotEqual( TLeft left, TRight right ) => internal static bool LessThan( TLeft left, TRight right ) => LessThanImplementation.Invoke( left, right ); + /// + /// Checks if the left hand side is less than or equal to the right hand side. + /// + /// The type of both the left and right hand side. + /// The left hand side parameter. + /// The right hand side parameter. + /// True if the left hand side is less than or equal to the right hand side, otherwise false. + internal static bool LessThanOrEqual( T left, T right ) => LessThanOrEqual( left, right ); + + /// + /// Checks if the left hand side is less than or equal to the right hand side. + /// + /// The type of the left hand side. + /// The type of the right hand side. + /// The left hand side parameter. + /// The right hand side parameter. + /// True if the left hand side is less than or equal to the right hand side, otherwise false. + internal static bool LessThanOrEqual( TLeft left, TRight right ) => + LessThanOrEqualImplementation.Invoke( left, right ); + /// /// Checks if the left hand side is greater than the right hand side. /// @@ -213,26 +233,6 @@ internal static bool GreaterThan( TLeft left, TRight right ) => internal static bool GreaterThanOrEqual( TLeft left, TRight right ) => GreaterThanOrEqualImplementation.Invoke( left, right ); - /// - /// Checks if the left hand side is less than or equal to the right hand side. - /// - /// The type of both the left and right hand side. - /// The left hand side parameter. - /// The right hand side parameter. - /// True if the left hand side is less than or equal to the right hand side, otherwise false. - internal static bool LessThanOrEqual( T left, T right ) => LessThanOrEqual( left, right ); - - /// - /// Checks if the left hand side is less than or equal to the right hand side. - /// - /// The type of the left hand side. - /// The type of the right hand side. - /// The left hand side parameter. - /// The right hand side parameter. - /// True if the left hand side is less than or equal to the right hand side, otherwise false. - internal static bool LessThanOrEqual( TLeft left, TRight right ) => - LessThanOrEqualImplementation.Invoke( left, right ); - #region Implementation Classes private static class MultiplyImplementation @@ -299,26 +299,26 @@ private static class LessThanImplementation internal static bool Invoke( TLeft left, TRight right ) => Function( left, right ); } - private static class GreaterThanImplementation + private static class LessThanOrEqualImplementation { private readonly static Func Function = - CreateBinaryFunction( Expression.GreaterThan ); + CreateBinaryFunction( Expression.LessThanOrEqual ); internal static bool Invoke( TLeft left, TRight right ) => Function( left, right ); } - private static class GreaterThanOrEqualImplementation + private static class GreaterThanImplementation { private readonly static Func Function = - CreateBinaryFunction( Expression.GreaterThanOrEqual ); + CreateBinaryFunction( Expression.GreaterThan ); internal static bool Invoke( TLeft left, TRight right ) => Function( left, right ); } - private static class LessThanOrEqualImplementation + private static class GreaterThanOrEqualImplementation { private readonly static Func Function = - CreateBinaryFunction( Expression.LessThanOrEqual ); + CreateBinaryFunction( Expression.GreaterThanOrEqual ); internal static bool Invoke( TLeft left, TRight right ) => Function( left, right ); } From c8b2bf1fe0df75a7a43f3479460975995696857b Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 3 Sep 2019 10:38:38 -0400 Subject: [PATCH 04/13] Consistency for spacing --- UnitsNet.Tests/CompiledLambdasTests.cs | 86 +++++++++--------- UnitsNet/CompiledLambdas.cs | 120 ++++++++++++------------- 2 files changed, 103 insertions(+), 103 deletions(-) diff --git a/UnitsNet.Tests/CompiledLambdasTests.cs b/UnitsNet.Tests/CompiledLambdasTests.cs index 55de9f358a..5ef295d2b6 100644 --- a/UnitsNet.Tests/CompiledLambdasTests.cs +++ b/UnitsNet.Tests/CompiledLambdasTests.cs @@ -6,90 +6,90 @@ namespace UnitsNet.Tests public class CompiledLambdasTests { [Theory] - [InlineData( 3.0, 2.0, 6.0 )] - public void MultiplyReturnsExpectedValues( TLeft left, TRight right, TResult expected ) + [InlineData(3.0, 2.0, 6.0)] + public void MultiplyReturnsExpectedValues(TLeft left, TRight right, TResult expected) { - Assert.Equal( expected, CompiledLambdas.Multiply( left, right ) ); + Assert.Equal(expected, CompiledLambdas.Multiply(left, right)); } [Theory] - [InlineData( 6.0, 2.0, 3.0 )] - public void DivideReturnsExpectedValues( TLeft left, TRight right, TResult expected ) + [InlineData(6.0, 2.0, 3.0)] + public void DivideReturnsExpectedValues(TLeft left, TRight right, TResult expected) { - Assert.Equal( expected, CompiledLambdas.Divide( left, right ) ); + Assert.Equal(expected, CompiledLambdas.Divide(left, right)); } [Theory] - [InlineData( 3.0, 2.0, 5.0 )] - public void AddReturnsExpectedValues( TLeft left, TRight right, TResult expected ) + [InlineData(3.0, 2.0, 5.0)] + public void AddReturnsExpectedValues(TLeft left, TRight right, TResult expected) { - Assert.Equal( expected, CompiledLambdas.Add( left, right ) ); + Assert.Equal(expected, CompiledLambdas.Add(left, right)); } [Theory] - [InlineData( 3.0, 2.0, 1.0 )] - public void SubtractReturnsExpectedValues( TLeft left, TRight right, TResult expected ) + [InlineData(3.0, 2.0, 1.0)] + public void SubtractReturnsExpectedValues(TLeft left, TRight right, TResult expected) { - Assert.Equal( expected, CompiledLambdas.Subtract( left, right ) ); + Assert.Equal(expected, CompiledLambdas.Subtract(left, right)); } [Theory] - [InlineData( 3.0, 2.0, 1.0 )] - public void ModuloReturnsExpectedValues( TLeft left, TRight right, TResult expected ) + [InlineData(3.0, 2.0, 1.0)] + public void ModuloReturnsExpectedValues(TLeft left, TRight right, TResult expected) { - Assert.Equal( expected, CompiledLambdas.Modulo( left, right ) ); + Assert.Equal(expected, CompiledLambdas.Modulo(left, right)); } [Theory] - [InlineData( 3.0, 3.0, true )] - [InlineData( 3.0, 2.0, false )] - public void EqualReturnsExpectedValues( TLeft left, TRight right, bool expected ) + [InlineData(3.0, 3.0, true)] + [InlineData(3.0, 2.0, false)] + public void EqualReturnsExpectedValues(TLeft left, TRight right, bool expected) { - Assert.Equal( expected, CompiledLambdas.Equal( left, right ) ); + Assert.Equal(expected, CompiledLambdas.Equal(left, right)); } [Theory] - [InlineData( 3.0, 3.0, false )] - [InlineData( 3.0, 2.0, true )] - public void NotEqualReturnsExpectedValues( TLeft left, TRight right, bool expected ) + [InlineData(3.0, 3.0, false)] + [InlineData(3.0, 2.0, true)] + public void NotEqualReturnsExpectedValues(TLeft left, TRight right, bool expected) { - Assert.Equal( expected, CompiledLambdas.NotEqual( left, right ) ); + Assert.Equal(expected, CompiledLambdas.NotEqual(left, right)); } [Theory] - [InlineData( 2.0, 3.0, true )] - [InlineData( 2.0, 2.0, false )] - [InlineData( 3.0, 2.0, false )] - public void LessThanReturnsExpectedValues( TLeft left, TRight right, bool expected ) + [InlineData(2.0, 3.0, true)] + [InlineData(2.0, 2.0, false)] + [InlineData(3.0, 2.0, false)] + public void LessThanReturnsExpectedValues(TLeft left, TRight right, bool expected) { - Assert.Equal( expected, CompiledLambdas.LessThan( left, right ) ); + Assert.Equal(expected, CompiledLambdas.LessThan(left, right)); } [Theory] - [InlineData( 2.0, 3.0, true )] - [InlineData( 2.0, 2.0, true )] - [InlineData( 3.0, 2.0, false )] - public void LessThanOrEqualReturnsExpectedValues( TLeft left, TRight right, bool expected ) + [InlineData(2.0, 3.0, true)] + [InlineData(2.0, 2.0, true)] + [InlineData(3.0, 2.0, false)] + public void LessThanOrEqualReturnsExpectedValues(TLeft left, TRight right, bool expected) { - Assert.Equal( expected, CompiledLambdas.LessThanOrEqual( left, right ) ); + Assert.Equal(expected, CompiledLambdas.LessThanOrEqual(left, right)); } [Theory] - [InlineData( 3.0, 2.0, true )] - [InlineData( 3.0, 3.0, false )] - [InlineData( 3.0, 4.0, false )] - public void GreaterThanReturnsExpectedValues( TLeft left, TRight right, bool expected ) + [InlineData(3.0, 2.0, true)] + [InlineData(3.0, 3.0, false)] + [InlineData(3.0, 4.0, false)] + public void GreaterThanReturnsExpectedValues(TLeft left, TRight right, bool expected) { - Assert.Equal( expected, CompiledLambdas.GreaterThan( left, right ) ); + Assert.Equal(expected, CompiledLambdas.GreaterThan(left, right)); } [Theory] - [InlineData( 3.0, 2.0, true )] - [InlineData( 3.0, 3.0, true )] - [InlineData( 3.0, 4.0, false )] - public void GreaterThanOrEqualReturnsExpectedValues( TLeft left, TRight right, bool expected ) + [InlineData(3.0, 2.0, true)] + [InlineData(3.0, 3.0, true)] + [InlineData(3.0, 4.0, false)] + public void GreaterThanOrEqualReturnsExpectedValues(TLeft left, TRight right, bool expected) { - Assert.Equal( expected, CompiledLambdas.GreaterThanOrEqual( left, right ) ); + Assert.Equal(expected, CompiledLambdas.GreaterThanOrEqual(left, right)); } } } diff --git a/UnitsNet/CompiledLambdas.cs b/UnitsNet/CompiledLambdas.cs index 9a48f03a94..dff7afe68f 100644 --- a/UnitsNet/CompiledLambdas.cs +++ b/UnitsNet/CompiledLambdas.cs @@ -15,7 +15,7 @@ internal static class CompiledLambdas /// The left hand side parameter. /// The right hand side parameter. /// The multiplied result. - internal static T Multiply( T left, T right ) => Multiply( left, right ); + internal static T Multiply(T left, T right) => Multiply(left, right); /// /// Multiplies the given values. @@ -26,8 +26,8 @@ internal static class CompiledLambdas /// The left hand side parameter. /// The right hand side parameter. /// The multiplied result. - internal static TResult Multiply( TLeft left, TRight right ) => - MultiplyImplementation.Invoke( left, right ); + internal static TResult Multiply(TLeft left, TRight right) => + MultiplyImplementation.Invoke(left, right); /// /// Divides the given values. @@ -36,7 +36,7 @@ internal static TResult Multiply( TLeft left, TRight rig /// The left hand side parameter. /// The right hand side parameter. /// The divided result. - internal static T Divide( T left, T right ) => Divide( left, right ); + internal static T Divide(T left, T right) => Divide(left, right); /// /// Divides the given values. @@ -47,8 +47,8 @@ internal static TResult Multiply( TLeft left, TRight rig /// The left hand side parameter. /// The right hand side parameter. /// The divided result. - internal static TResult Divide( TLeft left, TRight right ) => - DivideImplementation.Invoke( left, right ); + internal static TResult Divide(TLeft left, TRight right) => + DivideImplementation.Invoke(left, right); /// /// Adds the given values. @@ -57,7 +57,7 @@ internal static TResult Divide( TLeft left, TRight right /// The left hand side parameter. /// The right hand side parameter. /// The added result. - internal static T Add( T left, T right ) => Add( left, right ); + internal static T Add(T left, T right) => Add(left, right); /// /// Adds the given values. @@ -68,8 +68,8 @@ internal static TResult Divide( TLeft left, TRight right /// The left hand side parameter. /// The right hand side parameter. /// The added result. - internal static TResult Add( TLeft left, TRight right ) => - AddImplementation.Invoke( left, right ); + internal static TResult Add(TLeft left, TRight right) => + AddImplementation.Invoke(left, right); /// /// Subtracts the given values. @@ -78,7 +78,7 @@ internal static TResult Add( TLeft left, TRight right ) /// The left hand side parameter. /// The right hand side parameter. /// The subtracted result. - internal static T Subtract( T left, T right ) => Subtract( left, right ); + internal static T Subtract(T left, T right) => Subtract(left, right); /// /// Subtracts the given values. @@ -89,8 +89,8 @@ internal static TResult Add( TLeft left, TRight right ) /// The left hand side parameter. /// The right hand side parameter. /// The subtracted result. - internal static TResult Subtract( TLeft left, TRight right ) => - SubtractImplementation.Invoke( left, right ); + internal static TResult Subtract(TLeft left, TRight right) => + SubtractImplementation.Invoke(left, right); /// /// Gets the modulus of the given values. @@ -99,7 +99,7 @@ internal static TResult Subtract( TLeft left, TRight rig /// The left hand side parameter. /// The right hand side parameter. /// The modulus. - internal static T Modulo( T left, T right ) => Modulo( left, right ); + internal static T Modulo(T left, T right) => Modulo(left, right); /// /// Gets the modulus of the given values. @@ -110,8 +110,8 @@ internal static TResult Subtract( TLeft left, TRight rig /// The left hand side parameter. /// The right hand side parameter. /// The modulus. - internal static TResult Modulo( TLeft left, TRight right ) => - ModuloImplementation.Invoke( left, right ); + internal static TResult Modulo(TLeft left, TRight right) => + ModuloImplementation.Invoke(left, right); /// /// Checks if the left and right hand side are equal. @@ -120,7 +120,7 @@ internal static TResult Modulo( TLeft left, TRight right /// The left hand side parameter. /// The right hand side parameter. /// True if equal, otherwise false. - internal static bool Equal( T left, T right ) => Equal( left, right ); + internal static bool Equal(T left, T right) => Equal(left, right); /// /// Checks if the left and right hand side are equal. @@ -130,8 +130,8 @@ internal static TResult Modulo( TLeft left, TRight right /// The left hand side parameter. /// The right hand side parameter. /// True if equal, otherwise false. - internal static bool Equal( TLeft left, TRight right ) => - EqualImplementation.Invoke( left, right ); + internal static bool Equal(TLeft left, TRight right) => + EqualImplementation.Invoke(left, right); /// /// Checks if the left and right hand side are not equal. @@ -140,7 +140,7 @@ internal static bool Equal( TLeft left, TRight right ) => /// The left hand side parameter. /// The right hand side parameter. /// True if not equal, otherwise false. - internal static bool NotEqual( T left, T right ) => NotEqual( left, right ); + internal static bool NotEqual(T left, T right) => NotEqual(left, right); /// /// Checks if the left and right hand side are not equal. @@ -150,8 +150,8 @@ internal static bool Equal( TLeft left, TRight right ) => /// The left hand side parameter. /// The right hand side parameter. /// True if not equal, otherwise false. - internal static bool NotEqual( TLeft left, TRight right ) => - NotEqualImplementation.Invoke( left, right ); + internal static bool NotEqual(TLeft left, TRight right) => + NotEqualImplementation.Invoke(left, right); /// /// Checks if the left hand side is less than the right hand side. @@ -160,7 +160,7 @@ internal static bool NotEqual( TLeft left, TRight right ) => /// The left hand side parameter. /// The right hand side parameter. /// True if the left hand side is less than the right hand side, otherwise false. - internal static bool LessThan( T left, T right ) => LessThan( left, right ); + internal static bool LessThan(T left, T right) => LessThan(left, right); /// /// Checks if the left hand side is less than the right hand side. @@ -170,8 +170,8 @@ internal static bool NotEqual( TLeft left, TRight right ) => /// The left hand side parameter. /// The right hand side parameter. /// True if the left hand side is less than the right hand side, otherwise false. - internal static bool LessThan( TLeft left, TRight right ) => - LessThanImplementation.Invoke( left, right ); + internal static bool LessThan(TLeft left, TRight right) => + LessThanImplementation.Invoke(left, right); /// /// Checks if the left hand side is less than or equal to the right hand side. @@ -180,7 +180,7 @@ internal static bool LessThan( TLeft left, TRight right ) => /// The left hand side parameter. /// The right hand side parameter. /// True if the left hand side is less than or equal to the right hand side, otherwise false. - internal static bool LessThanOrEqual( T left, T right ) => LessThanOrEqual( left, right ); + internal static bool LessThanOrEqual(T left, T right) => LessThanOrEqual(left, right); /// /// Checks if the left hand side is less than or equal to the right hand side. @@ -190,8 +190,8 @@ internal static bool LessThan( TLeft left, TRight right ) => /// The left hand side parameter. /// The right hand side parameter. /// True if the left hand side is less than or equal to the right hand side, otherwise false. - internal static bool LessThanOrEqual( TLeft left, TRight right ) => - LessThanOrEqualImplementation.Invoke( left, right ); + internal static bool LessThanOrEqual(TLeft left, TRight right) => + LessThanOrEqualImplementation.Invoke(left, right); /// /// Checks if the left hand side is greater than the right hand side. @@ -200,7 +200,7 @@ internal static bool LessThanOrEqual( TLeft left, TRight right ) /// The left hand side parameter. /// The right hand side parameter. /// True if the left hand side is greater than the right hand side, otherwise false. - internal static bool GreaterThan( T left, T right ) => GreaterThan( left, right ); + internal static bool GreaterThan(T left, T right) => GreaterThan(left, right); /// /// Checks if the left hand side is greater than the right hand side. @@ -210,8 +210,8 @@ internal static bool LessThanOrEqual( TLeft left, TRight right ) /// The left hand side parameter. /// The right hand side parameter. /// True if the left hand side is greater than the right hand side, otherwise false. - internal static bool GreaterThan( TLeft left, TRight right ) => - GreaterThanImplementation.Invoke( left, right ); + internal static bool GreaterThan(TLeft left, TRight right) => + GreaterThanImplementation.Invoke(left, right); /// /// Checks if the left hand side is greater than or equal to the right hand side. @@ -220,7 +220,7 @@ internal static bool GreaterThan( TLeft left, TRight right ) => /// The left hand side parameter. /// The right hand side parameter. /// True if the left hand side is greater than or equal to the right hand side, otherwise false. - internal static bool GreaterThanOrEqual( T left, T right ) => GreaterThanOrEqual( left, right ); + internal static bool GreaterThanOrEqual(T left, T right) => GreaterThanOrEqual(left, right); /// /// Checks if the left hand side is greater than or equal to the right hand side. @@ -230,97 +230,97 @@ internal static bool GreaterThan( TLeft left, TRight right ) => /// The left hand side parameter. /// The right hand side parameter. /// True if the left hand side is greater than or equal to the right hand side, otherwise false. - internal static bool GreaterThanOrEqual( TLeft left, TRight right ) => - GreaterThanOrEqualImplementation.Invoke( left, right ); + internal static bool GreaterThanOrEqual(TLeft left, TRight right) => + GreaterThanOrEqualImplementation.Invoke(left, right); #region Implementation Classes private static class MultiplyImplementation { private readonly static Func Function = - CreateBinaryFunction( Expression.Multiply ); + CreateBinaryFunction(Expression.Multiply); - internal static TResult Invoke( TLeft left, TRight right) => Function( left, right ); + internal static TResult Invoke(TLeft left, TRight right) => Function(left, right); } private static class DivideImplementation { private readonly static Func Function = - CreateBinaryFunction( Expression.Divide ); + CreateBinaryFunction(Expression.Divide); - internal static TResult Invoke( TLeft left, TRight right ) => Function( left, right ); + internal static TResult Invoke(TLeft left, TRight right) => Function(left, right); } private static class AddImplementation { private readonly static Func Function = - CreateBinaryFunction( Expression.Add ); + CreateBinaryFunction(Expression.Add); - internal static TResult Invoke( TLeft left, TRight right ) => Function( left, right ); + internal static TResult Invoke(TLeft left, TRight right) => Function(left, right); } private static class SubtractImplementation { private readonly static Func Function = - CreateBinaryFunction( Expression.Subtract ); + CreateBinaryFunction(Expression.Subtract); - internal static TResult Invoke( TLeft left, TRight right ) => Function( left, right ); + internal static TResult Invoke(TLeft left, TRight right) => Function(left, right); } private static class ModuloImplementation { private readonly static Func Function = - CreateBinaryFunction( Expression.Modulo ); + CreateBinaryFunction(Expression.Modulo); - internal static TResult Invoke( TLeft left, TRight right ) => Function( left, right ); + internal static TResult Invoke(TLeft left, TRight right) => Function(left, right); } private static class EqualImplementation { private readonly static Func Function = - CreateBinaryFunction( Expression.Equal ); + CreateBinaryFunction(Expression.Equal); - internal static bool Invoke( TLeft left, TRight right ) => Function( left, right ); + internal static bool Invoke(TLeft left, TRight right) => Function(left, right); } private static class NotEqualImplementation { private readonly static Func Function = - CreateBinaryFunction( Expression.NotEqual ); + CreateBinaryFunction(Expression.NotEqual); - internal static bool Invoke( TLeft left, TRight right ) => Function( left, right ); + internal static bool Invoke(TLeft left, TRight right) => Function(left, right); } private static class LessThanImplementation { private readonly static Func Function = - CreateBinaryFunction( Expression.LessThan ); + CreateBinaryFunction(Expression.LessThan); - internal static bool Invoke( TLeft left, TRight right ) => Function( left, right ); + internal static bool Invoke(TLeft left, TRight right) => Function(left, right); } private static class LessThanOrEqualImplementation { private readonly static Func Function = - CreateBinaryFunction( Expression.LessThanOrEqual ); + CreateBinaryFunction(Expression.LessThanOrEqual); - internal static bool Invoke( TLeft left, TRight right ) => Function( left, right ); + internal static bool Invoke(TLeft left, TRight right) => Function(left, right); } private static class GreaterThanImplementation { private readonly static Func Function = - CreateBinaryFunction( Expression.GreaterThan ); + CreateBinaryFunction(Expression.GreaterThan); - internal static bool Invoke( TLeft left, TRight right ) => Function( left, right ); + internal static bool Invoke(TLeft left, TRight right) => Function(left, right); } private static class GreaterThanOrEqualImplementation { private readonly static Func Function = - CreateBinaryFunction( Expression.GreaterThanOrEqual ); + CreateBinaryFunction(Expression.GreaterThanOrEqual); - internal static bool Invoke( TLeft left, TRight right ) => Function( left, right ); + internal static bool Invoke(TLeft left, TRight right) => Function(left, right); } #endregion @@ -333,13 +333,13 @@ private static class GreaterThanOrEqualImplementation /// The type of the result of the binary operation. /// The function that creates a binary expression to compile. /// The compiled binary expression. - private static Func CreateBinaryFunction( Func expressionCreationFunction ) + private static Func CreateBinaryFunction(Func expressionCreationFunction) { - var leftParameter = Expression.Parameter( typeof( TLeft ), "left" ); - var rightParameter = Expression.Parameter( typeof( TRight ), "right" ); + var leftParameter = Expression.Parameter(typeof(TLeft), "left"); + var rightParameter = Expression.Parameter(typeof(TRight), "right"); - var binaryExpression = expressionCreationFunction( leftParameter, rightParameter ); - var lambda = Expression.Lambda>( binaryExpression, leftParameter, rightParameter ); + var binaryExpression = expressionCreationFunction(leftParameter, rightParameter); + var lambda = Expression.Lambda>(binaryExpression, leftParameter, rightParameter); return lambda.Compile(); } From 3799d6463bf8bb608901a226ba90b96d3767c5ae Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Thu, 5 Sep 2019 11:09:50 -0400 Subject: [PATCH 05/13] Removing ambiguous calls --- UnitsNet/CompiledLambdas.cs | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/UnitsNet/CompiledLambdas.cs b/UnitsNet/CompiledLambdas.cs index dff7afe68f..47c5f0d67e 100644 --- a/UnitsNet/CompiledLambdas.cs +++ b/UnitsNet/CompiledLambdas.cs @@ -153,15 +153,6 @@ internal static bool Equal(TLeft left, TRight right) => internal static bool NotEqual(TLeft left, TRight right) => NotEqualImplementation.Invoke(left, right); - /// - /// Checks if the left hand side is less than the right hand side. - /// - /// The type of both the left and right hand side. - /// The left hand side parameter. - /// The right hand side parameter. - /// True if the left hand side is less than the right hand side, otherwise false. - internal static bool LessThan(T left, T right) => LessThan(left, right); - /// /// Checks if the left hand side is less than the right hand side. /// @@ -173,15 +164,6 @@ internal static bool NotEqual(TLeft left, TRight right) => internal static bool LessThan(TLeft left, TRight right) => LessThanImplementation.Invoke(left, right); - /// - /// Checks if the left hand side is less than or equal to the right hand side. - /// - /// The type of both the left and right hand side. - /// The left hand side parameter. - /// The right hand side parameter. - /// True if the left hand side is less than or equal to the right hand side, otherwise false. - internal static bool LessThanOrEqual(T left, T right) => LessThanOrEqual(left, right); - /// /// Checks if the left hand side is less than or equal to the right hand side. /// @@ -193,15 +175,6 @@ internal static bool LessThan(TLeft left, TRight right) => internal static bool LessThanOrEqual(TLeft left, TRight right) => LessThanOrEqualImplementation.Invoke(left, right); - /// - /// Checks if the left hand side is greater than the right hand side. - /// - /// The type of both the left and right hand side. - /// The left hand side parameter. - /// The right hand side parameter. - /// True if the left hand side is greater than the right hand side, otherwise false. - internal static bool GreaterThan(T left, T right) => GreaterThan(left, right); - /// /// Checks if the left hand side is greater than the right hand side. /// @@ -213,15 +186,6 @@ internal static bool LessThanOrEqual(TLeft left, TRight right) => internal static bool GreaterThan(TLeft left, TRight right) => GreaterThanImplementation.Invoke(left, right); - /// - /// Checks if the left hand side is greater than or equal to the right hand side. - /// - /// The type of both the left and right hand side. - /// The left hand side parameter. - /// The right hand side parameter. - /// True if the left hand side is greater than or equal to the right hand side, otherwise false. - internal static bool GreaterThanOrEqual(T left, T right) => GreaterThanOrEqual(left, right); - /// /// Checks if the left hand side is greater than or equal to the right hand side. /// From 4086e4db0ebdb0f674895ae6be40e1e11de2e94c Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 22 Oct 2019 10:30:50 -0400 Subject: [PATCH 06/13] Generic struct generation --- .../UnitsNetGen/QuantityGenerator.cs | 190 +++---- .../Quantities/Acceleration.extra.cs | 8 +- .../Quantities/Acceleration.g.cs | 244 ++++---- .../Quantities/AmountOfSubstance.g.cs | 260 ++++----- .../Quantities/AmplitudeRatio.g.cs | 172 +++--- UnitsNet/GeneratedCode/Quantities/Angle.g.cs | 252 ++++----- .../Quantities/ApparentEnergy.g.cs | 164 +++--- .../Quantities/ApparentPower.g.cs | 172 +++--- UnitsNet/GeneratedCode/Quantities/Area.g.cs | 252 ++++----- .../GeneratedCode/Quantities/AreaDensity.g.cs | 148 ++--- .../Quantities/AreaMomentOfInertia.g.cs | 188 +++---- .../GeneratedCode/Quantities/BitRate.g.cs | 348 ++++++------ .../BrakeSpecificFuelConsumption.g.cs | 164 +++--- .../GeneratedCode/Quantities/Capacitance.g.cs | 196 +++---- .../CoefficientOfThermalExpansion.g.cs | 164 +++--- .../GeneratedCode/Quantities/Density.g.cs | 460 +++++++-------- .../GeneratedCode/Quantities/Duration.g.cs | 220 ++++---- .../Quantities/DynamicViscosity.g.cs | 212 +++---- .../Quantities/ElectricAdmittance.g.cs | 172 +++--- .../Quantities/ElectricCharge.g.cs | 180 +++--- .../Quantities/ElectricChargeDensity.g.cs | 148 ++--- .../Quantities/ElectricConductance.g.cs | 164 +++--- .../Quantities/ElectricConductivity.g.cs | 164 +++--- .../Quantities/ElectricCurrent.g.cs | 204 +++---- .../Quantities/ElectricCurrentDensity.g.cs | 164 +++--- .../Quantities/ElectricCurrentGradient.g.cs | 148 ++--- .../Quantities/ElectricField.g.cs | 148 ++--- .../Quantities/ElectricInductance.g.cs | 172 +++--- .../Quantities/ElectricPotential.g.cs | 180 +++--- .../Quantities/ElectricPotentialAc.g.cs | 180 +++--- .../Quantities/ElectricPotentialDc.g.cs | 180 +++--- .../Quantities/ElectricResistance.g.cs | 180 +++--- .../Quantities/ElectricResistivity.g.cs | 252 ++++----- .../ElectricSurfaceChargeDensity.g.cs | 164 +++--- UnitsNet/GeneratedCode/Quantities/Energy.g.cs | 332 +++++------ .../GeneratedCode/Quantities/Entropy.g.cs | 196 +++---- UnitsNet/GeneratedCode/Quantities/Force.g.cs | 244 ++++---- .../Quantities/ForceChangeRate.g.cs | 228 ++++---- .../Quantities/ForcePerLength.g.cs | 236 ++++---- .../GeneratedCode/Quantities/Frequency.g.cs | 212 +++---- .../Quantities/FuelEfficiency.g.cs | 172 +++--- .../GeneratedCode/Quantities/HeatFlux.g.cs | 284 +++++----- .../Quantities/HeatTransferCoefficient.g.cs | 164 +++--- .../GeneratedCode/Quantities/Illuminance.g.cs | 172 +++--- .../GeneratedCode/Quantities/Information.g.cs | 348 ++++++------ .../GeneratedCode/Quantities/Irradiance.g.cs | 252 ++++----- .../GeneratedCode/Quantities/Irradiation.g.cs | 196 +++---- .../Quantities/KinematicViscosity.g.cs | 204 +++---- .../GeneratedCode/Quantities/LapseRate.g.cs | 148 ++--- UnitsNet/GeneratedCode/Quantities/Length.g.cs | 396 ++++++------- UnitsNet/GeneratedCode/Quantities/Level.g.cs | 156 ++--- .../Quantities/LinearDensity.g.cs | 164 +++--- .../GeneratedCode/Quantities/Luminosity.g.cs | 252 ++++----- .../Quantities/LuminousFlux.g.cs | 148 ++--- .../Quantities/LuminousIntensity.g.cs | 148 ++--- .../Quantities/MagneticField.g.cs | 172 +++--- .../Quantities/MagneticFlux.g.cs | 148 ++--- .../Quantities/Magnetization.g.cs | 148 ++--- UnitsNet/GeneratedCode/Quantities/Mass.g.cs | 340 +++++------ .../Quantities/MassConcentration.g.cs | 460 +++++++-------- .../GeneratedCode/Quantities/MassFlow.g.cs | 404 ++++++------- .../GeneratedCode/Quantities/MassFlux.g.cs | 156 ++--- .../Quantities/MassFraction.g.cs | 332 +++++------ .../Quantities/MassMomentOfInertia.g.cs | 364 ++++++------ .../GeneratedCode/Quantities/MolarEnergy.g.cs | 164 +++--- .../Quantities/MolarEntropy.g.cs | 164 +++--- .../GeneratedCode/Quantities/MolarMass.g.cs | 236 ++++---- .../GeneratedCode/Quantities/Molarity.g.cs | 204 +++---- .../Quantities/Permeability.g.cs | 148 ++--- .../Quantities/Permittivity.g.cs | 148 ++--- UnitsNet/GeneratedCode/Quantities/Power.g.cs | 300 +++++----- .../Quantities/PowerDensity.g.cs | 492 ++++++++-------- .../GeneratedCode/Quantities/PowerRatio.g.cs | 156 ++--- .../GeneratedCode/Quantities/Pressure.g.cs | 476 ++++++++-------- .../Quantities/PressureChangeRate.g.cs | 196 +++---- UnitsNet/GeneratedCode/Quantities/Ratio.g.cs | 188 +++---- .../Quantities/RatioChangeRate.g.cs | 156 ++--- .../Quantities/ReactiveEnergy.g.cs | 164 +++--- .../Quantities/ReactivePower.g.cs | 172 +++--- .../Quantities/RotationalAcceleration.g.cs | 172 +++--- .../Quantities/RotationalSpeed.g.cs | 244 ++++---- .../Quantities/RotationalStiffness.g.cs | 164 +++--- .../RotationalStiffnessPerLength.g.cs | 164 +++--- .../GeneratedCode/Quantities/SolidAngle.g.cs | 148 ++--- .../Quantities/SpecificEnergy.g.cs | 212 +++---- .../Quantities/SpecificEntropy.g.cs | 212 +++---- .../Quantities/SpecificVolume.g.cs | 164 +++--- .../Quantities/SpecificWeight.g.cs | 276 ++++----- UnitsNet/GeneratedCode/Quantities/Speed.g.cs | 396 ++++++------- .../GeneratedCode/Quantities/Temperature.g.cs | 174 +++--- .../Quantities/TemperatureChangeRate.g.cs | 220 ++++---- .../Quantities/TemperatureDelta.g.cs | 204 +++---- .../Quantities/ThermalConductivity.g.cs | 156 ++--- .../Quantities/ThermalResistance.g.cs | 180 +++--- UnitsNet/GeneratedCode/Quantities/Torque.g.cs | 308 +++++----- .../GeneratedCode/Quantities/VitaminA.g.cs | 148 ++--- UnitsNet/GeneratedCode/Quantities/Volume.g.cs | 516 ++++++++--------- .../Quantities/VolumeConcentration.g.cs | 300 +++++----- .../GeneratedCode/Quantities/VolumeFlow.g.cs | 532 +++++++++--------- .../Quantities/VolumePerLength.g.cs | 164 +++--- 100 files changed, 11104 insertions(+), 11104 deletions(-) diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs index caff760f4a..9300ba6d71 100644 --- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs @@ -68,7 +68,7 @@ namespace UnitsNet /// "); Writer.WL($@" - public partial struct {_quantity.Name} : IQuantity<{_unitEnumName}>, IEquatable<{_quantity.Name}>, IComparable, IComparable<{_quantity.Name}>, IConvertible, IFormattable + public partial struct {_quantity.Name} : IQuantity<{_unitEnumName}>, IEquatable<{_quantity.Name}>, IComparable, IComparable<{_quantity.Name}>, IConvertible, IFormattable {{ /// /// The numeric value this quantity was constructed with. @@ -217,19 +217,19 @@ private void GenerateStaticProperties() public static BaseDimensions BaseDimensions {{ get; }} /// - /// The base unit of {_quantity.Name}, which is {_quantity.BaseUnit}. All conversions go via this value. + /// The base unit of , which is {_quantity.BaseUnit}. All conversions go via this value. /// public static {_unitEnumName} BaseUnit {{ get; }} = {_unitEnumName}.{_quantity.BaseUnit}; /// - /// Represents the largest possible value of {_quantity.Name} + /// Represents the largest possible value of /// - public static {_quantity.Name} MaxValue {{ get; }} = new {_quantity.Name}({_valueType}.MaxValue, BaseUnit); + public static {_quantity.Name} MaxValue {{ get; }} = new {_quantity.Name}({_valueType}.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of {_quantity.Name} + /// Represents the smallest possible value of /// - public static {_quantity.Name} MinValue {{ get; }} = new {_quantity.Name}({_valueType}.MinValue, BaseUnit); + public static {_quantity.Name} MinValue {{ get; }} = new {_quantity.Name}({_valueType}.MinValue, BaseUnit); /// /// The of this quantity. @@ -237,14 +237,14 @@ private void GenerateStaticProperties() public static QuantityType QuantityType {{ get; }} = QuantityType.{_quantity.Name}; /// - /// All units of measurement for the {_quantity.Name} quantity. + /// All units of measurement for the quantity. /// public static {_unitEnumName}[] Units {{ get; }} = Enum.GetValues(typeof({_unitEnumName})).Cast<{_unitEnumName}>().Except(new {_unitEnumName}[]{{ {_unitEnumName}.Undefined }}).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit {_quantity.BaseUnit}. /// - public static {_quantity.Name} Zero {{ get; }} = new {_quantity.Name}(0, BaseUnit); + public static {_quantity.Name} Zero {{ get; }} = new {_quantity.Name}(0, BaseUnit); #endregion "); @@ -282,15 +282,15 @@ private void GenerateProperties() /// /// The of this quantity. /// - public QuantityType Type => {_quantity.Name}.QuantityType; + public QuantityType Type => {_quantity.Name}.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => {_quantity.Name}.BaseDimensions; + public BaseDimensions Dimensions => {_quantity.Name}.BaseDimensions; #endregion -"); +" ); } private void GenerateConversionProperties() @@ -302,7 +302,7 @@ private void GenerateConversionProperties() { Writer.WL($@" /// - /// Get {_quantity.Name} in {unit.PluralName}. + /// Get in {unit.PluralName}. /// "); Writer.WLIfText(2, GetObsoleteAttributeOrNull(unit)); Writer.WL($@" @@ -357,29 +357,29 @@ private void GenerateStaticFactoryMethods() var valueParamName = unit.PluralName.ToLowerInvariant(); Writer.WL($@" /// - /// Get {_quantity.Name} from {unit.PluralName}. + /// Get from {unit.PluralName}. /// /// If value is NaN or Infinity."); Writer.WLIfText(2, GetObsoleteAttributeOrNull(unit)); Writer.WL($@" - public static {_quantity.Name} From{unit.PluralName}(QuantityValue {valueParamName}) + public static {_quantity.Name} From{unit.PluralName}(QuantityValue {valueParamName}) {{ {_valueType} value = ({_valueType}) {valueParamName}; - return new {_quantity.Name}(value, {_unitEnumName}.{unit.SingularName}); + return new {_quantity.Name}(value, {_unitEnumName}.{unit.SingularName}); }}"); } Writer.WL(); Writer.WL($@" /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// {_quantity.Name} unit value. - public static {_quantity.Name} From(QuantityValue value, {_unitEnumName} fromUnit) + /// unit value. + public static {_quantity.Name} From(QuantityValue value, {_unitEnumName} fromUnit) {{ - return new {_quantity.Name}(({_valueType})value, fromUnit); + return new {_quantity.Name}(({_valueType})value, fromUnit); }} #endregion @@ -413,7 +413,7 @@ private void GenerateStaticParseMethods() /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static {_quantity.Name} Parse(string str) + public static {_quantity.Name} Parse(string str) {{ return Parse(str, null); }} @@ -441,9 +441,9 @@ private void GenerateStaticParseMethods() /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static {_quantity.Name} Parse(string str, [CanBeNull] IFormatProvider provider) + public static {_quantity.Name} Parse(string str, [CanBeNull] IFormatProvider provider) {{ - return QuantityParser.Default.Parse<{_quantity.Name}, {_unitEnumName}>( + return QuantityParser.Default.Parse<{_quantity.Name}, {_unitEnumName}>( str, provider, From); @@ -457,7 +457,7 @@ private void GenerateStaticParseMethods() /// /// Length.Parse(""5.5 m"", new CultureInfo(""en-US"")); /// - public static bool TryParse([CanBeNull] string str, out {_quantity.Name} result) + public static bool TryParse([CanBeNull] string str, out {_quantity.Name} result) {{ return TryParse(str, null, out result); }} @@ -472,9 +472,9 @@ public static bool TryParse([CanBeNull] string str, out {_quantity.Name} result) /// Length.Parse(""5.5 m"", new CultureInfo(""en-US"")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out {_quantity.Name} result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out {_quantity.Name} result) {{ - return QuantityParser.Default.TryParse<{_quantity.Name}, {_unitEnumName}>( + return QuantityParser.Default.TryParse<{_quantity.Name}, {_unitEnumName}>( str, provider, From, @@ -551,43 +551,43 @@ private void GenerateArithmeticOperators() #region Arithmetic Operators /// Negate the value. - public static {_quantity.Name} operator -({_quantity.Name} right) + public static {_quantity.Name} operator -({_quantity.Name} right) {{ - return new {_quantity.Name}(-right.Value, right.Unit); + return new {_quantity.Name}(-right.Value, right.Unit); }} - /// Get from adding two . - public static {_quantity.Name} operator +({_quantity.Name} left, {_quantity.Name} right) + /// Get from adding two . + public static {_quantity.Name} operator +({_quantity.Name} left, {_quantity.Name} right) {{ - return new {_quantity.Name}(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new {_quantity.Name}(left.Value + right.GetValueAs(left.Unit), left.Unit); }} - /// Get from subtracting two . - public static {_quantity.Name} operator -({_quantity.Name} left, {_quantity.Name} right) + /// Get from subtracting two . + public static {_quantity.Name} operator -({_quantity.Name} left, {_quantity.Name} right) {{ - return new {_quantity.Name}(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new {_quantity.Name}(left.Value - right.GetValueAs(left.Unit), left.Unit); }} - /// Get from multiplying value and . - public static {_quantity.Name} operator *({_valueType} left, {_quantity.Name} right) + /// Get from multiplying value and . + public static {_quantity.Name} operator *({_valueType} left, {_quantity.Name} right) {{ - return new {_quantity.Name}(left * right.Value, right.Unit); + return new {_quantity.Name}(left * right.Value, right.Unit); }} - /// Get from multiplying value and . - public static {_quantity.Name} operator *({_quantity.Name} left, {_valueType} right) + /// Get from multiplying value and . + public static {_quantity.Name} operator *({_quantity.Name} left, {_valueType} right) {{ - return new {_quantity.Name}(left.Value * right, left.Unit); + return new {_quantity.Name}(left.Value * right, left.Unit); }} - /// Get from dividing by value. - public static {_quantity.Name} operator /({_quantity.Name} left, {_valueType} right) + /// Get from dividing by value. + public static {_quantity.Name} operator /({_quantity.Name} left, {_valueType} right) {{ - return new {_quantity.Name}(left.Value / right, left.Unit); + return new {_quantity.Name}(left.Value / right, left.Unit); }} - /// Get ratio value from dividing by . - public static double operator /({_quantity.Name} left, {_quantity.Name} right) + /// Get ratio value from dividing by . + public static double operator /({_quantity.Name} left, {_quantity.Name} right) {{ return left.{_baseUnit.PluralName} / right.{_baseUnit.PluralName}; }} @@ -605,50 +605,50 @@ private void GenerateLogarithmicArithmeticOperators() #region Logarithmic Arithmetic Operators /// Negate the value. - public static {_quantity.Name} operator -({_quantity.Name} right) + public static {_quantity.Name} operator -({_quantity.Name} right) {{ - return new {_quantity.Name}(-right.Value, right.Unit); + return new {_quantity.Name}(-right.Value, right.Unit); }} - /// Get from logarithmic addition of two . - public static {_quantity.Name} operator +({_quantity.Name} left, {_quantity.Name} right) + /// Get from logarithmic addition of two . + public static {_quantity.Name} operator +({_quantity.Name} left, {_quantity.Name} right) {{ // Logarithmic addition // Formula: {x}*log10(10^(x/{x}) + 10^(y/{x})) - return new {_quantity.Name}({x}*Math.Log10(Math.Pow(10, left.Value/{x}) + Math.Pow(10, right.GetValueAs(left.Unit)/{x})), left.Unit); + return new {_quantity.Name}({x}*Math.Log10(Math.Pow(10, left.Value/{x}) + Math.Pow(10, right.GetValueAs(left.Unit)/{x})), left.Unit); }} - /// Get from logarithmic subtraction of two . - public static {_quantity.Name} operator -({_quantity.Name} left, {_quantity.Name} right) + /// Get from logarithmic subtraction of two . + public static {_quantity.Name} operator -({_quantity.Name} left, {_quantity.Name} right) {{ // Logarithmic subtraction // Formula: {x}*log10(10^(x/{x}) - 10^(y/{x})) - return new {_quantity.Name}({x}*Math.Log10(Math.Pow(10, left.Value/{x}) - Math.Pow(10, right.GetValueAs(left.Unit)/{x})), left.Unit); + return new {_quantity.Name}({x}*Math.Log10(Math.Pow(10, left.Value/{x}) - Math.Pow(10, right.GetValueAs(left.Unit)/{x})), left.Unit); }} - /// Get from logarithmic multiplication of value and . - public static {_quantity.Name} operator *({_valueType} left, {_quantity.Name} right) + /// Get from logarithmic multiplication of value and . + public static {_quantity.Name} operator *({_valueType} left, {_quantity.Name} right) {{ // Logarithmic multiplication = addition - return new {_quantity.Name}(left + right.Value, right.Unit); + return new {_quantity.Name}(left + right.Value, right.Unit); }} - /// Get from logarithmic multiplication of value and . - public static {_quantity.Name} operator *({_quantity.Name} left, double right) + /// Get from logarithmic multiplication of value and . + public static {_quantity.Name} operator *({_quantity.Name} left, double right) {{ // Logarithmic multiplication = addition - return new {_quantity.Name}(left.Value + ({_valueType})right, left.Unit); + return new {_quantity.Name}(left.Value + ({_valueType})right, left.Unit); }} - /// Get from logarithmic division of by value. - public static {_quantity.Name} operator /({_quantity.Name} left, double right) + /// Get from logarithmic division of by value. + public static {_quantity.Name} operator /({_quantity.Name} left, double right) {{ // Logarithmic division = subtraction - return new {_quantity.Name}(left.Value - ({_valueType})right, left.Unit); + return new {_quantity.Name}(left.Value - ({_valueType})right, left.Unit); }} - /// Get ratio value from logarithmic division of by . - public static double operator /({_quantity.Name} left, {_quantity.Name} right) + /// Get ratio value from logarithmic division of by . + public static double operator /({_quantity.Name} left, {_quantity.Name} right) {{ // Logarithmic division = subtraction return Convert.ToDouble(left.Value - right.GetValueAs(left.Unit)); @@ -664,39 +664,39 @@ private void GenerateEqualityAndComparison() #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=({_quantity.Name} left, {_quantity.Name} right) + public static bool operator <=({_quantity.Name} left, {_quantity.Name} right) {{ return left.Value <= right.GetValueAs(left.Unit); }} /// Returns true if greater than or equal to. - public static bool operator >=({_quantity.Name} left, {_quantity.Name} right) + public static bool operator >=({_quantity.Name} left, {_quantity.Name} right) {{ return left.Value >= right.GetValueAs(left.Unit); }} /// Returns true if less than. - public static bool operator <({_quantity.Name} left, {_quantity.Name} right) + public static bool operator <({_quantity.Name} left, {_quantity.Name} right) {{ return left.Value < right.GetValueAs(left.Unit); }} /// Returns true if greater than. - public static bool operator >({_quantity.Name} left, {_quantity.Name} right) + public static bool operator >({_quantity.Name} left, {_quantity.Name} right) {{ return left.Value > right.GetValueAs(left.Unit); }} /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==({_quantity.Name} left, {_quantity.Name} right) + /// Consider using for safely comparing floating point values. + public static bool operator ==({_quantity.Name} left, {_quantity.Name} right) {{ return left.Equals(right); }} /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=({_quantity.Name} left, {_quantity.Name} right) + /// Consider using for safely comparing floating point values. + public static bool operator !=({_quantity.Name} left, {_quantity.Name} right) {{ return !(left == right); }} @@ -705,37 +705,37 @@ private void GenerateEqualityAndComparison() public int CompareTo(object obj) {{ if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is {_quantity.Name} obj{_quantity.Name})) throw new ArgumentException(""Expected type {_quantity.Name}."", nameof(obj)); + if(!(obj is {_quantity.Name} obj{_quantity.Name})) throw new ArgumentException(""Expected type {_quantity.Name}."", nameof(obj)); return CompareTo(obj{_quantity.Name}); }} /// - public int CompareTo({_quantity.Name} other) + public int CompareTo({_quantity.Name} other) {{ return _value.CompareTo(other.GetValueAs(this.Unit)); }} /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) {{ - if(obj is null || !(obj is {_quantity.Name} obj{_quantity.Name})) + if(obj is null || !(obj is {_quantity.Name} obj{_quantity.Name})) return false; return Equals(obj{_quantity.Name}); }} /// - /// Consider using for safely comparing floating point values. - public bool Equals({_quantity.Name} other) + /// Consider using for safely comparing floating point values. + public bool Equals({_quantity.Name} other) {{ return _value.Equals(other.GetValueAs(this.Unit)); }} /// /// - /// Compare equality to another {_quantity.Name} within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -773,7 +773,7 @@ public bool Equals({_quantity.Name} other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals({_quantity.Name} other, double tolerance, ComparisonType comparisonType) + public bool Equals({_quantity.Name} other, double tolerance, ComparisonType comparisonType) {{ if(tolerance < 0) throw new ArgumentOutOfRangeException(""tolerance"", ""Tolerance must be greater than or equal to 0.""); @@ -787,7 +787,7 @@ public bool Equals({_quantity.Name} other, double tolerance, ComparisonType comp /// /// Returns the hash code for this instance. /// - /// A hash code for the current {_quantity.Name}. + /// A hash code for the current . public override int GetHashCode() {{ return new {{ QuantityType, Value, Unit }}.GetHashCode(); @@ -840,13 +840,13 @@ double IQuantity.As(Enum unit) }} /// - /// Converts this {_quantity.Name} to another {_quantity.Name} with the unit representation . + /// Converts this to another with the unit representation . /// - /// A {_quantity.Name} with the specified unit. - public {_quantity.Name} ToUnit({_unitEnumName} unit) + /// A with the specified unit. + public {_quantity.Name} ToUnit({_unitEnumName} unit) {{ var convertedValue = GetValueAs(unit); - return new {_quantity.Name}(convertedValue, unit); + return new {_quantity.Name}(convertedValue, unit); }} /// @@ -859,7 +859,7 @@ IQuantity IQuantity.ToUnit(Enum unit) }} /// - public {_quantity.Name} ToUnit(UnitSystem unitSystem) + public {_quantity.Name} ToUnit(UnitSystem unitSystem) {{ if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -909,10 +909,10 @@ IQuantity IQuantity.ToUnit(Enum unit) /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal {_quantity.Name} ToBaseUnit() + internal {_quantity.Name} ToBaseUnit() {{ var baseUnitValue = GetValueInBaseUnit(); - return new {_quantity.Name}(baseUnitValue, BaseUnit); + return new {_quantity.Name}(baseUnitValue, BaseUnit); }} private {_valueType} GetValueAs({_unitEnumName} unit) @@ -1038,7 +1038,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) {{ - throw new InvalidCastException($""Converting {{typeof({_quantity.Name})}} to bool is not supported.""); + throw new InvalidCastException($""Converting {{typeof({_quantity.Name})}} to bool is not supported.""); }} byte IConvertible.ToByte(IFormatProvider provider) @@ -1048,12 +1048,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) {{ - throw new InvalidCastException($""Converting {{typeof({_quantity.Name})}} to char is not supported.""); + throw new InvalidCastException($""Converting {{typeof({_quantity.Name})}} to char is not supported.""); }} DateTime IConvertible.ToDateTime(IFormatProvider provider) {{ - throw new InvalidCastException($""Converting {{typeof({_quantity.Name})}} to DateTime is not supported.""); + throw new InvalidCastException($""Converting {{typeof({_quantity.Name})}} to DateTime is not supported.""); }} decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1098,16 +1098,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) {{ - if(conversionType == typeof({_quantity.Name})) + if(conversionType == typeof({_quantity.Name})) return this; else if(conversionType == typeof({_unitEnumName})) return Unit; else if(conversionType == typeof(QuantityType)) - return {_quantity.Name}.QuantityType; + return {_quantity.Name}.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return {_quantity.Name}.BaseDimensions; + return {_quantity.Name}.BaseDimensions; else - throw new InvalidCastException($""Converting {{typeof({_quantity.Name})}} to {{conversionType}} is not supported.""); + throw new InvalidCastException($""Converting {{typeof({_quantity.Name})}} to {{conversionType}} is not supported.""); }} ushort IConvertible.ToUInt16(IFormatProvider provider) @@ -1125,7 +1125,7 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); }} - #endregion"); + #endregion" ); } /// diff --git a/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs b/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs index 75a2eba9cf..40b736be56 100644 --- a/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs @@ -3,14 +3,14 @@ namespace UnitsNet { - public partial struct Acceleration + public partial struct Acceleration { /// - /// Multiply and to get . + /// Multiply and to get . /// - public static SpecificWeight operator *(Acceleration acceleration, Density density) + public static SpecificWeight operator *(Acceleration acceleration, Density density) { - return new SpecificWeight(acceleration.MetersPerSecondSquared * density.KilogramsPerCubicMeter, UnitsNet.Units.SpecificWeightUnit.NewtonPerCubicMeter); + return new SpecificWeight(acceleration.MetersPerSecondSquared * density.KilogramsPerCubicMeter, UnitsNet.Units.SpecificWeightUnit.NewtonPerCubicMeter); } } } diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs index 39e69008d1..6ed75806bb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Acceleration, in physics, is the rate at which the velocity of an object changes over time. An object's acceleration is the net result of any and all forces acting on the object, as described by Newton's Second Law. The SI unit for acceleration is the Meter per second squared (m/s²). Accelerations are vector quantities (they have magnitude and direction) and add according to the parallelogram law. As a vector, the calculated net force is equal to the product of the object's mass (a scalar quantity) and the acceleration. /// - public partial struct Acceleration : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Acceleration : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -112,19 +112,19 @@ public Acceleration(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Acceleration, which is MeterPerSecondSquared. All conversions go via this value. + /// The base unit of , which is MeterPerSecondSquared. All conversions go via this value. /// public static AccelerationUnit BaseUnit { get; } = AccelerationUnit.MeterPerSecondSquared; /// - /// Represents the largest possible value of Acceleration + /// Represents the largest possible value of /// - public static Acceleration MaxValue { get; } = new Acceleration(double.MaxValue, BaseUnit); + public static Acceleration MaxValue { get; } = new Acceleration(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Acceleration + /// Represents the smallest possible value of /// - public static Acceleration MinValue { get; } = new Acceleration(double.MinValue, BaseUnit); + public static Acceleration MinValue { get; } = new Acceleration(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -132,14 +132,14 @@ public Acceleration(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Acceleration; /// - /// All units of measurement for the Acceleration quantity. + /// All units of measurement for the quantity. /// public static AccelerationUnit[] Units { get; } = Enum.GetValues(typeof(AccelerationUnit)).Cast().Except(new AccelerationUnit[]{ AccelerationUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit MeterPerSecondSquared. /// - public static Acceleration Zero { get; } = new Acceleration(0, BaseUnit); + public static Acceleration Zero { get; } = new Acceleration(0, BaseUnit); #endregion @@ -164,79 +164,79 @@ public Acceleration(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Acceleration.QuantityType; + public QuantityType Type => Acceleration.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Acceleration.BaseDimensions; + public BaseDimensions Dimensions => Acceleration.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Acceleration in CentimetersPerSecondSquared. + /// Get in CentimetersPerSecondSquared. /// public double CentimetersPerSecondSquared => As(AccelerationUnit.CentimeterPerSecondSquared); /// - /// Get Acceleration in DecimetersPerSecondSquared. + /// Get in DecimetersPerSecondSquared. /// public double DecimetersPerSecondSquared => As(AccelerationUnit.DecimeterPerSecondSquared); /// - /// Get Acceleration in FeetPerSecondSquared. + /// Get in FeetPerSecondSquared. /// public double FeetPerSecondSquared => As(AccelerationUnit.FootPerSecondSquared); /// - /// Get Acceleration in InchesPerSecondSquared. + /// Get in InchesPerSecondSquared. /// public double InchesPerSecondSquared => As(AccelerationUnit.InchPerSecondSquared); /// - /// Get Acceleration in KilometersPerSecondSquared. + /// Get in KilometersPerSecondSquared. /// public double KilometersPerSecondSquared => As(AccelerationUnit.KilometerPerSecondSquared); /// - /// Get Acceleration in KnotsPerHour. + /// Get in KnotsPerHour. /// public double KnotsPerHour => As(AccelerationUnit.KnotPerHour); /// - /// Get Acceleration in KnotsPerMinute. + /// Get in KnotsPerMinute. /// public double KnotsPerMinute => As(AccelerationUnit.KnotPerMinute); /// - /// Get Acceleration in KnotsPerSecond. + /// Get in KnotsPerSecond. /// public double KnotsPerSecond => As(AccelerationUnit.KnotPerSecond); /// - /// Get Acceleration in MetersPerSecondSquared. + /// Get in MetersPerSecondSquared. /// public double MetersPerSecondSquared => As(AccelerationUnit.MeterPerSecondSquared); /// - /// Get Acceleration in MicrometersPerSecondSquared. + /// Get in MicrometersPerSecondSquared. /// public double MicrometersPerSecondSquared => As(AccelerationUnit.MicrometerPerSecondSquared); /// - /// Get Acceleration in MillimetersPerSecondSquared. + /// Get in MillimetersPerSecondSquared. /// public double MillimetersPerSecondSquared => As(AccelerationUnit.MillimeterPerSecondSquared); /// - /// Get Acceleration in NanometersPerSecondSquared. + /// Get in NanometersPerSecondSquared. /// public double NanometersPerSecondSquared => As(AccelerationUnit.NanometerPerSecondSquared); /// - /// Get Acceleration in StandardGravity. + /// Get in StandardGravity. /// public double StandardGravity => As(AccelerationUnit.StandardGravity); @@ -270,132 +270,132 @@ public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] IFormatP #region Static Factory Methods /// - /// Get Acceleration from CentimetersPerSecondSquared. + /// Get from CentimetersPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromCentimetersPerSecondSquared(QuantityValue centimeterspersecondsquared) + public static Acceleration FromCentimetersPerSecondSquared(QuantityValue centimeterspersecondsquared) { double value = (double) centimeterspersecondsquared; - return new Acceleration(value, AccelerationUnit.CentimeterPerSecondSquared); + return new Acceleration(value, AccelerationUnit.CentimeterPerSecondSquared); } /// - /// Get Acceleration from DecimetersPerSecondSquared. + /// Get from DecimetersPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromDecimetersPerSecondSquared(QuantityValue decimeterspersecondsquared) + public static Acceleration FromDecimetersPerSecondSquared(QuantityValue decimeterspersecondsquared) { double value = (double) decimeterspersecondsquared; - return new Acceleration(value, AccelerationUnit.DecimeterPerSecondSquared); + return new Acceleration(value, AccelerationUnit.DecimeterPerSecondSquared); } /// - /// Get Acceleration from FeetPerSecondSquared. + /// Get from FeetPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromFeetPerSecondSquared(QuantityValue feetpersecondsquared) + public static Acceleration FromFeetPerSecondSquared(QuantityValue feetpersecondsquared) { double value = (double) feetpersecondsquared; - return new Acceleration(value, AccelerationUnit.FootPerSecondSquared); + return new Acceleration(value, AccelerationUnit.FootPerSecondSquared); } /// - /// Get Acceleration from InchesPerSecondSquared. + /// Get from InchesPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromInchesPerSecondSquared(QuantityValue inchespersecondsquared) + public static Acceleration FromInchesPerSecondSquared(QuantityValue inchespersecondsquared) { double value = (double) inchespersecondsquared; - return new Acceleration(value, AccelerationUnit.InchPerSecondSquared); + return new Acceleration(value, AccelerationUnit.InchPerSecondSquared); } /// - /// Get Acceleration from KilometersPerSecondSquared. + /// Get from KilometersPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromKilometersPerSecondSquared(QuantityValue kilometerspersecondsquared) + public static Acceleration FromKilometersPerSecondSquared(QuantityValue kilometerspersecondsquared) { double value = (double) kilometerspersecondsquared; - return new Acceleration(value, AccelerationUnit.KilometerPerSecondSquared); + return new Acceleration(value, AccelerationUnit.KilometerPerSecondSquared); } /// - /// Get Acceleration from KnotsPerHour. + /// Get from KnotsPerHour. /// /// If value is NaN or Infinity. - public static Acceleration FromKnotsPerHour(QuantityValue knotsperhour) + public static Acceleration FromKnotsPerHour(QuantityValue knotsperhour) { double value = (double) knotsperhour; - return new Acceleration(value, AccelerationUnit.KnotPerHour); + return new Acceleration(value, AccelerationUnit.KnotPerHour); } /// - /// Get Acceleration from KnotsPerMinute. + /// Get from KnotsPerMinute. /// /// If value is NaN or Infinity. - public static Acceleration FromKnotsPerMinute(QuantityValue knotsperminute) + public static Acceleration FromKnotsPerMinute(QuantityValue knotsperminute) { double value = (double) knotsperminute; - return new Acceleration(value, AccelerationUnit.KnotPerMinute); + return new Acceleration(value, AccelerationUnit.KnotPerMinute); } /// - /// Get Acceleration from KnotsPerSecond. + /// Get from KnotsPerSecond. /// /// If value is NaN or Infinity. - public static Acceleration FromKnotsPerSecond(QuantityValue knotspersecond) + public static Acceleration FromKnotsPerSecond(QuantityValue knotspersecond) { double value = (double) knotspersecond; - return new Acceleration(value, AccelerationUnit.KnotPerSecond); + return new Acceleration(value, AccelerationUnit.KnotPerSecond); } /// - /// Get Acceleration from MetersPerSecondSquared. + /// Get from MetersPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromMetersPerSecondSquared(QuantityValue meterspersecondsquared) + public static Acceleration FromMetersPerSecondSquared(QuantityValue meterspersecondsquared) { double value = (double) meterspersecondsquared; - return new Acceleration(value, AccelerationUnit.MeterPerSecondSquared); + return new Acceleration(value, AccelerationUnit.MeterPerSecondSquared); } /// - /// Get Acceleration from MicrometersPerSecondSquared. + /// Get from MicrometersPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromMicrometersPerSecondSquared(QuantityValue micrometerspersecondsquared) + public static Acceleration FromMicrometersPerSecondSquared(QuantityValue micrometerspersecondsquared) { double value = (double) micrometerspersecondsquared; - return new Acceleration(value, AccelerationUnit.MicrometerPerSecondSquared); + return new Acceleration(value, AccelerationUnit.MicrometerPerSecondSquared); } /// - /// Get Acceleration from MillimetersPerSecondSquared. + /// Get from MillimetersPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromMillimetersPerSecondSquared(QuantityValue millimeterspersecondsquared) + public static Acceleration FromMillimetersPerSecondSquared(QuantityValue millimeterspersecondsquared) { double value = (double) millimeterspersecondsquared; - return new Acceleration(value, AccelerationUnit.MillimeterPerSecondSquared); + return new Acceleration(value, AccelerationUnit.MillimeterPerSecondSquared); } /// - /// Get Acceleration from NanometersPerSecondSquared. + /// Get from NanometersPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromNanometersPerSecondSquared(QuantityValue nanometerspersecondsquared) + public static Acceleration FromNanometersPerSecondSquared(QuantityValue nanometerspersecondsquared) { double value = (double) nanometerspersecondsquared; - return new Acceleration(value, AccelerationUnit.NanometerPerSecondSquared); + return new Acceleration(value, AccelerationUnit.NanometerPerSecondSquared); } /// - /// Get Acceleration from StandardGravity. + /// Get from StandardGravity. /// /// If value is NaN or Infinity. - public static Acceleration FromStandardGravity(QuantityValue standardgravity) + public static Acceleration FromStandardGravity(QuantityValue standardgravity) { double value = (double) standardgravity; - return new Acceleration(value, AccelerationUnit.StandardGravity); + return new Acceleration(value, AccelerationUnit.StandardGravity); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Acceleration unit value. - public static Acceleration From(QuantityValue value, AccelerationUnit fromUnit) + /// unit value. + public static Acceleration From(QuantityValue value, AccelerationUnit fromUnit) { - return new Acceleration((double)value, fromUnit); + return new Acceleration((double)value, fromUnit); } #endregion @@ -424,7 +424,7 @@ public static Acceleration From(QuantityValue value, AccelerationUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Acceleration Parse(string str) + public static Acceleration Parse(string str) { return Parse(str, null); } @@ -452,9 +452,9 @@ public static Acceleration Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Acceleration Parse(string str, [CanBeNull] IFormatProvider provider) + public static Acceleration Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, AccelerationUnit>( str, provider, From); @@ -468,7 +468,7 @@ public static Acceleration Parse(string str, [CanBeNull] IFormatProvider provide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Acceleration result) + public static bool TryParse([CanBeNull] string str, out Acceleration result) { return TryParse(str, null, out result); } @@ -483,9 +483,9 @@ public static bool TryParse([CanBeNull] string str, out Acceleration result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Acceleration result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Acceleration result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, AccelerationUnit>( str, provider, From, @@ -547,43 +547,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Accele #region Arithmetic Operators /// Negate the value. - public static Acceleration operator -(Acceleration right) + public static Acceleration operator -(Acceleration right) { - return new Acceleration(-right.Value, right.Unit); + return new Acceleration(-right.Value, right.Unit); } - /// Get from adding two . - public static Acceleration operator +(Acceleration left, Acceleration right) + /// Get from adding two . + public static Acceleration operator +(Acceleration left, Acceleration right) { - return new Acceleration(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Acceleration(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Acceleration operator -(Acceleration left, Acceleration right) + /// Get from subtracting two . + public static Acceleration operator -(Acceleration left, Acceleration right) { - return new Acceleration(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Acceleration(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Acceleration operator *(double left, Acceleration right) + /// Get from multiplying value and . + public static Acceleration operator *(double left, Acceleration right) { - return new Acceleration(left * right.Value, right.Unit); + return new Acceleration(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Acceleration operator *(Acceleration left, double right) + /// Get from multiplying value and . + public static Acceleration operator *(Acceleration left, double right) { - return new Acceleration(left.Value * right, left.Unit); + return new Acceleration(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Acceleration operator /(Acceleration left, double right) + /// Get from dividing by value. + public static Acceleration operator /(Acceleration left, double right) { - return new Acceleration(left.Value / right, left.Unit); + return new Acceleration(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Acceleration left, Acceleration right) + /// Get ratio value from dividing by . + public static double operator /(Acceleration left, Acceleration right) { return left.MetersPerSecondSquared / right.MetersPerSecondSquared; } @@ -593,39 +593,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Accele #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Acceleration left, Acceleration right) + public static bool operator <=(Acceleration left, Acceleration right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Acceleration left, Acceleration right) + public static bool operator >=(Acceleration left, Acceleration right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Acceleration left, Acceleration right) + public static bool operator <(Acceleration left, Acceleration right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Acceleration left, Acceleration right) + public static bool operator >(Acceleration left, Acceleration right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Acceleration left, Acceleration right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Acceleration left, Acceleration right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Acceleration left, Acceleration right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Acceleration left, Acceleration right) { return !(left == right); } @@ -634,37 +634,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Accele public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Acceleration objAcceleration)) throw new ArgumentException("Expected type Acceleration.", nameof(obj)); + if(!(obj is Acceleration objAcceleration)) throw new ArgumentException("Expected type Acceleration.", nameof(obj)); return CompareTo(objAcceleration); } /// - public int CompareTo(Acceleration other) + public int CompareTo(Acceleration other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Acceleration objAcceleration)) + if(obj is null || !(obj is Acceleration objAcceleration)) return false; return Equals(objAcceleration); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Acceleration other) + /// Consider using for safely comparing floating point values. + public bool Equals(Acceleration other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Acceleration within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -702,7 +702,7 @@ public bool Equals(Acceleration other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Acceleration other, double tolerance, ComparisonType comparisonType) + public bool Equals(Acceleration other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -716,7 +716,7 @@ public bool Equals(Acceleration other, double tolerance, ComparisonType comparis /// /// Returns the hash code for this instance. /// - /// A hash code for the current Acceleration. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -764,13 +764,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Acceleration to another Acceleration with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Acceleration with the specified unit. - public Acceleration ToUnit(AccelerationUnit unit) + /// A with the specified unit. + public Acceleration ToUnit(AccelerationUnit unit) { var convertedValue = GetValueAs(unit); - return new Acceleration(convertedValue, unit); + return new Acceleration(convertedValue, unit); } /// @@ -783,7 +783,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Acceleration ToUnit(UnitSystem unitSystem) + public Acceleration ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -838,10 +838,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Acceleration ToBaseUnit() + internal Acceleration ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Acceleration(baseUnitValue, BaseUnit); + return new Acceleration(baseUnitValue, BaseUnit); } private double GetValueAs(AccelerationUnit unit) @@ -962,7 +962,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Acceleration)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Acceleration)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -972,12 +972,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Acceleration)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Acceleration)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Acceleration)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Acceleration)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1022,16 +1022,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Acceleration)) + if(conversionType == typeof(Acceleration)) return this; else if(conversionType == typeof(AccelerationUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Acceleration.QuantityType; + return Acceleration.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Acceleration.BaseDimensions; + return Acceleration.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Acceleration)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Acceleration)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs index 18abeba8bd..8045e0a565 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Mole is the amount of substance containing Avagadro's Number (6.02 x 10 ^ 23) of real particles such as molecules,atoms, ions or radicals. /// - public partial struct AmountOfSubstance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct AmountOfSubstance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -114,19 +114,19 @@ public AmountOfSubstance(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of AmountOfSubstance, which is Mole. All conversions go via this value. + /// The base unit of , which is Mole. All conversions go via this value. /// public static AmountOfSubstanceUnit BaseUnit { get; } = AmountOfSubstanceUnit.Mole; /// - /// Represents the largest possible value of AmountOfSubstance + /// Represents the largest possible value of /// - public static AmountOfSubstance MaxValue { get; } = new AmountOfSubstance(double.MaxValue, BaseUnit); + public static AmountOfSubstance MaxValue { get; } = new AmountOfSubstance(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of AmountOfSubstance + /// Represents the smallest possible value of /// - public static AmountOfSubstance MinValue { get; } = new AmountOfSubstance(double.MinValue, BaseUnit); + public static AmountOfSubstance MinValue { get; } = new AmountOfSubstance(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -134,14 +134,14 @@ public AmountOfSubstance(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.AmountOfSubstance; /// - /// All units of measurement for the AmountOfSubstance quantity. + /// All units of measurement for the quantity. /// public static AmountOfSubstanceUnit[] Units { get; } = Enum.GetValues(typeof(AmountOfSubstanceUnit)).Cast().Except(new AmountOfSubstanceUnit[]{ AmountOfSubstanceUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Mole. /// - public static AmountOfSubstance Zero { get; } = new AmountOfSubstance(0, BaseUnit); + public static AmountOfSubstance Zero { get; } = new AmountOfSubstance(0, BaseUnit); #endregion @@ -166,89 +166,89 @@ public AmountOfSubstance(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => AmountOfSubstance.QuantityType; + public QuantityType Type => AmountOfSubstance.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => AmountOfSubstance.BaseDimensions; + public BaseDimensions Dimensions => AmountOfSubstance.BaseDimensions; #endregion #region Conversion Properties /// - /// Get AmountOfSubstance in Centimoles. + /// Get in Centimoles. /// public double Centimoles => As(AmountOfSubstanceUnit.Centimole); /// - /// Get AmountOfSubstance in CentipoundMoles. + /// Get in CentipoundMoles. /// public double CentipoundMoles => As(AmountOfSubstanceUnit.CentipoundMole); /// - /// Get AmountOfSubstance in Decimoles. + /// Get in Decimoles. /// public double Decimoles => As(AmountOfSubstanceUnit.Decimole); /// - /// Get AmountOfSubstance in DecipoundMoles. + /// Get in DecipoundMoles. /// public double DecipoundMoles => As(AmountOfSubstanceUnit.DecipoundMole); /// - /// Get AmountOfSubstance in Kilomoles. + /// Get in Kilomoles. /// public double Kilomoles => As(AmountOfSubstanceUnit.Kilomole); /// - /// Get AmountOfSubstance in KilopoundMoles. + /// Get in KilopoundMoles. /// public double KilopoundMoles => As(AmountOfSubstanceUnit.KilopoundMole); /// - /// Get AmountOfSubstance in Megamoles. + /// Get in Megamoles. /// public double Megamoles => As(AmountOfSubstanceUnit.Megamole); /// - /// Get AmountOfSubstance in Micromoles. + /// Get in Micromoles. /// public double Micromoles => As(AmountOfSubstanceUnit.Micromole); /// - /// Get AmountOfSubstance in MicropoundMoles. + /// Get in MicropoundMoles. /// public double MicropoundMoles => As(AmountOfSubstanceUnit.MicropoundMole); /// - /// Get AmountOfSubstance in Millimoles. + /// Get in Millimoles. /// public double Millimoles => As(AmountOfSubstanceUnit.Millimole); /// - /// Get AmountOfSubstance in MillipoundMoles. + /// Get in MillipoundMoles. /// public double MillipoundMoles => As(AmountOfSubstanceUnit.MillipoundMole); /// - /// Get AmountOfSubstance in Moles. + /// Get in Moles. /// public double Moles => As(AmountOfSubstanceUnit.Mole); /// - /// Get AmountOfSubstance in Nanomoles. + /// Get in Nanomoles. /// public double Nanomoles => As(AmountOfSubstanceUnit.Nanomole); /// - /// Get AmountOfSubstance in NanopoundMoles. + /// Get in NanopoundMoles. /// public double NanopoundMoles => As(AmountOfSubstanceUnit.NanopoundMole); /// - /// Get AmountOfSubstance in PoundMoles. + /// Get in PoundMoles. /// public double PoundMoles => As(AmountOfSubstanceUnit.PoundMole); @@ -282,150 +282,150 @@ public static string GetAbbreviation(AmountOfSubstanceUnit unit, [CanBeNull] IFo #region Static Factory Methods /// - /// Get AmountOfSubstance from Centimoles. + /// Get from Centimoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromCentimoles(QuantityValue centimoles) + public static AmountOfSubstance FromCentimoles(QuantityValue centimoles) { double value = (double) centimoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Centimole); + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Centimole); } /// - /// Get AmountOfSubstance from CentipoundMoles. + /// Get from CentipoundMoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromCentipoundMoles(QuantityValue centipoundmoles) + public static AmountOfSubstance FromCentipoundMoles(QuantityValue centipoundmoles) { double value = (double) centipoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.CentipoundMole); + return new AmountOfSubstance(value, AmountOfSubstanceUnit.CentipoundMole); } /// - /// Get AmountOfSubstance from Decimoles. + /// Get from Decimoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromDecimoles(QuantityValue decimoles) + public static AmountOfSubstance FromDecimoles(QuantityValue decimoles) { double value = (double) decimoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Decimole); + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Decimole); } /// - /// Get AmountOfSubstance from DecipoundMoles. + /// Get from DecipoundMoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromDecipoundMoles(QuantityValue decipoundmoles) + public static AmountOfSubstance FromDecipoundMoles(QuantityValue decipoundmoles) { double value = (double) decipoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.DecipoundMole); + return new AmountOfSubstance(value, AmountOfSubstanceUnit.DecipoundMole); } /// - /// Get AmountOfSubstance from Kilomoles. + /// Get from Kilomoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromKilomoles(QuantityValue kilomoles) + public static AmountOfSubstance FromKilomoles(QuantityValue kilomoles) { double value = (double) kilomoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Kilomole); + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Kilomole); } /// - /// Get AmountOfSubstance from KilopoundMoles. + /// Get from KilopoundMoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromKilopoundMoles(QuantityValue kilopoundmoles) + public static AmountOfSubstance FromKilopoundMoles(QuantityValue kilopoundmoles) { double value = (double) kilopoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.KilopoundMole); + return new AmountOfSubstance(value, AmountOfSubstanceUnit.KilopoundMole); } /// - /// Get AmountOfSubstance from Megamoles. + /// Get from Megamoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromMegamoles(QuantityValue megamoles) + public static AmountOfSubstance FromMegamoles(QuantityValue megamoles) { double value = (double) megamoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Megamole); + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Megamole); } /// - /// Get AmountOfSubstance from Micromoles. + /// Get from Micromoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromMicromoles(QuantityValue micromoles) + public static AmountOfSubstance FromMicromoles(QuantityValue micromoles) { double value = (double) micromoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Micromole); + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Micromole); } /// - /// Get AmountOfSubstance from MicropoundMoles. + /// Get from MicropoundMoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromMicropoundMoles(QuantityValue micropoundmoles) + public static AmountOfSubstance FromMicropoundMoles(QuantityValue micropoundmoles) { double value = (double) micropoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.MicropoundMole); + return new AmountOfSubstance(value, AmountOfSubstanceUnit.MicropoundMole); } /// - /// Get AmountOfSubstance from Millimoles. + /// Get from Millimoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromMillimoles(QuantityValue millimoles) + public static AmountOfSubstance FromMillimoles(QuantityValue millimoles) { double value = (double) millimoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Millimole); + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Millimole); } /// - /// Get AmountOfSubstance from MillipoundMoles. + /// Get from MillipoundMoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromMillipoundMoles(QuantityValue millipoundmoles) + public static AmountOfSubstance FromMillipoundMoles(QuantityValue millipoundmoles) { double value = (double) millipoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.MillipoundMole); + return new AmountOfSubstance(value, AmountOfSubstanceUnit.MillipoundMole); } /// - /// Get AmountOfSubstance from Moles. + /// Get from Moles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromMoles(QuantityValue moles) + public static AmountOfSubstance FromMoles(QuantityValue moles) { double value = (double) moles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Mole); + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Mole); } /// - /// Get AmountOfSubstance from Nanomoles. + /// Get from Nanomoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromNanomoles(QuantityValue nanomoles) + public static AmountOfSubstance FromNanomoles(QuantityValue nanomoles) { double value = (double) nanomoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Nanomole); + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Nanomole); } /// - /// Get AmountOfSubstance from NanopoundMoles. + /// Get from NanopoundMoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromNanopoundMoles(QuantityValue nanopoundmoles) + public static AmountOfSubstance FromNanopoundMoles(QuantityValue nanopoundmoles) { double value = (double) nanopoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.NanopoundMole); + return new AmountOfSubstance(value, AmountOfSubstanceUnit.NanopoundMole); } /// - /// Get AmountOfSubstance from PoundMoles. + /// Get from PoundMoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromPoundMoles(QuantityValue poundmoles) + public static AmountOfSubstance FromPoundMoles(QuantityValue poundmoles) { double value = (double) poundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.PoundMole); + return new AmountOfSubstance(value, AmountOfSubstanceUnit.PoundMole); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// AmountOfSubstance unit value. - public static AmountOfSubstance From(QuantityValue value, AmountOfSubstanceUnit fromUnit) + /// unit value. + public static AmountOfSubstance From(QuantityValue value, AmountOfSubstanceUnit fromUnit) { - return new AmountOfSubstance((double)value, fromUnit); + return new AmountOfSubstance((double)value, fromUnit); } #endregion @@ -454,7 +454,7 @@ public static AmountOfSubstance From(QuantityValue value, AmountOfSubstanceUnit /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static AmountOfSubstance Parse(string str) + public static AmountOfSubstance Parse(string str) { return Parse(str, null); } @@ -482,9 +482,9 @@ public static AmountOfSubstance Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static AmountOfSubstance Parse(string str, [CanBeNull] IFormatProvider provider) + public static AmountOfSubstance Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, AmountOfSubstanceUnit>( str, provider, From); @@ -498,7 +498,7 @@ public static AmountOfSubstance Parse(string str, [CanBeNull] IFormatProvider pr /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out AmountOfSubstance result) + public static bool TryParse([CanBeNull] string str, out AmountOfSubstance result) { return TryParse(str, null, out result); } @@ -513,9 +513,9 @@ public static bool TryParse([CanBeNull] string str, out AmountOfSubstance result /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmountOfSubstance result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmountOfSubstance result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, AmountOfSubstanceUnit>( str, provider, From, @@ -577,43 +577,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amount #region Arithmetic Operators /// Negate the value. - public static AmountOfSubstance operator -(AmountOfSubstance right) + public static AmountOfSubstance operator -(AmountOfSubstance right) { - return new AmountOfSubstance(-right.Value, right.Unit); + return new AmountOfSubstance(-right.Value, right.Unit); } - /// Get from adding two . - public static AmountOfSubstance operator +(AmountOfSubstance left, AmountOfSubstance right) + /// Get from adding two . + public static AmountOfSubstance operator +(AmountOfSubstance left, AmountOfSubstance right) { - return new AmountOfSubstance(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new AmountOfSubstance(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static AmountOfSubstance operator -(AmountOfSubstance left, AmountOfSubstance right) + /// Get from subtracting two . + public static AmountOfSubstance operator -(AmountOfSubstance left, AmountOfSubstance right) { - return new AmountOfSubstance(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new AmountOfSubstance(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static AmountOfSubstance operator *(double left, AmountOfSubstance right) + /// Get from multiplying value and . + public static AmountOfSubstance operator *(double left, AmountOfSubstance right) { - return new AmountOfSubstance(left * right.Value, right.Unit); + return new AmountOfSubstance(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static AmountOfSubstance operator *(AmountOfSubstance left, double right) + /// Get from multiplying value and . + public static AmountOfSubstance operator *(AmountOfSubstance left, double right) { - return new AmountOfSubstance(left.Value * right, left.Unit); + return new AmountOfSubstance(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static AmountOfSubstance operator /(AmountOfSubstance left, double right) + /// Get from dividing by value. + public static AmountOfSubstance operator /(AmountOfSubstance left, double right) { - return new AmountOfSubstance(left.Value / right, left.Unit); + return new AmountOfSubstance(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(AmountOfSubstance left, AmountOfSubstance right) + /// Get ratio value from dividing by . + public static double operator /(AmountOfSubstance left, AmountOfSubstance right) { return left.Moles / right.Moles; } @@ -623,39 +623,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amount #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(AmountOfSubstance left, AmountOfSubstance right) + public static bool operator <=(AmountOfSubstance left, AmountOfSubstance right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(AmountOfSubstance left, AmountOfSubstance right) + public static bool operator >=(AmountOfSubstance left, AmountOfSubstance right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(AmountOfSubstance left, AmountOfSubstance right) + public static bool operator <(AmountOfSubstance left, AmountOfSubstance right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(AmountOfSubstance left, AmountOfSubstance right) + public static bool operator >(AmountOfSubstance left, AmountOfSubstance right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(AmountOfSubstance left, AmountOfSubstance right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(AmountOfSubstance left, AmountOfSubstance right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(AmountOfSubstance left, AmountOfSubstance right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(AmountOfSubstance left, AmountOfSubstance right) { return !(left == right); } @@ -664,37 +664,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amount public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AmountOfSubstance objAmountOfSubstance)) throw new ArgumentException("Expected type AmountOfSubstance.", nameof(obj)); + if(!(obj is AmountOfSubstance objAmountOfSubstance)) throw new ArgumentException("Expected type AmountOfSubstance.", nameof(obj)); return CompareTo(objAmountOfSubstance); } /// - public int CompareTo(AmountOfSubstance other) + public int CompareTo(AmountOfSubstance other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is AmountOfSubstance objAmountOfSubstance)) + if(obj is null || !(obj is AmountOfSubstance objAmountOfSubstance)) return false; return Equals(objAmountOfSubstance); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(AmountOfSubstance other) + /// Consider using for safely comparing floating point values. + public bool Equals(AmountOfSubstance other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another AmountOfSubstance within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -732,7 +732,7 @@ public bool Equals(AmountOfSubstance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(AmountOfSubstance other, double tolerance, ComparisonType comparisonType) + public bool Equals(AmountOfSubstance other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -746,7 +746,7 @@ public bool Equals(AmountOfSubstance other, double tolerance, ComparisonType com /// /// Returns the hash code for this instance. /// - /// A hash code for the current AmountOfSubstance. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -794,13 +794,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this AmountOfSubstance to another AmountOfSubstance with the unit representation . + /// Converts this to another with the unit representation . /// - /// A AmountOfSubstance with the specified unit. - public AmountOfSubstance ToUnit(AmountOfSubstanceUnit unit) + /// A with the specified unit. + public AmountOfSubstance ToUnit(AmountOfSubstanceUnit unit) { var convertedValue = GetValueAs(unit); - return new AmountOfSubstance(convertedValue, unit); + return new AmountOfSubstance(convertedValue, unit); } /// @@ -813,7 +813,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public AmountOfSubstance ToUnit(UnitSystem unitSystem) + public AmountOfSubstance ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -870,10 +870,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal AmountOfSubstance ToBaseUnit() + internal AmountOfSubstance ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new AmountOfSubstance(baseUnitValue, BaseUnit); + return new AmountOfSubstance(baseUnitValue, BaseUnit); } private double GetValueAs(AmountOfSubstanceUnit unit) @@ -996,7 +996,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1006,12 +1006,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1056,16 +1056,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(AmountOfSubstance)) + if(conversionType == typeof(AmountOfSubstance)) return this; else if(conversionType == typeof(AmountOfSubstanceUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return AmountOfSubstance.QuantityType; + return AmountOfSubstance.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return AmountOfSubstance.BaseDimensions; + return AmountOfSubstance.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs index f0a38498f0..b10dddde83 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// The strength of a signal expressed in decibels (dB) relative to one volt RMS. /// - public partial struct AmplitudeRatio : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct AmplitudeRatio : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -103,19 +103,19 @@ public AmplitudeRatio(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of AmplitudeRatio, which is DecibelVolt. All conversions go via this value. + /// The base unit of , which is DecibelVolt. All conversions go via this value. /// public static AmplitudeRatioUnit BaseUnit { get; } = AmplitudeRatioUnit.DecibelVolt; /// - /// Represents the largest possible value of AmplitudeRatio + /// Represents the largest possible value of /// - public static AmplitudeRatio MaxValue { get; } = new AmplitudeRatio(double.MaxValue, BaseUnit); + public static AmplitudeRatio MaxValue { get; } = new AmplitudeRatio(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of AmplitudeRatio + /// Represents the smallest possible value of /// - public static AmplitudeRatio MinValue { get; } = new AmplitudeRatio(double.MinValue, BaseUnit); + public static AmplitudeRatio MinValue { get; } = new AmplitudeRatio(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -123,14 +123,14 @@ public AmplitudeRatio(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.AmplitudeRatio; /// - /// All units of measurement for the AmplitudeRatio quantity. + /// All units of measurement for the quantity. /// public static AmplitudeRatioUnit[] Units { get; } = Enum.GetValues(typeof(AmplitudeRatioUnit)).Cast().Except(new AmplitudeRatioUnit[]{ AmplitudeRatioUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit DecibelVolt. /// - public static AmplitudeRatio Zero { get; } = new AmplitudeRatio(0, BaseUnit); + public static AmplitudeRatio Zero { get; } = new AmplitudeRatio(0, BaseUnit); #endregion @@ -155,34 +155,34 @@ public AmplitudeRatio(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => AmplitudeRatio.QuantityType; + public QuantityType Type => AmplitudeRatio.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => AmplitudeRatio.BaseDimensions; + public BaseDimensions Dimensions => AmplitudeRatio.BaseDimensions; #endregion #region Conversion Properties /// - /// Get AmplitudeRatio in DecibelMicrovolts. + /// Get in DecibelMicrovolts. /// public double DecibelMicrovolts => As(AmplitudeRatioUnit.DecibelMicrovolt); /// - /// Get AmplitudeRatio in DecibelMillivolts. + /// Get in DecibelMillivolts. /// public double DecibelMillivolts => As(AmplitudeRatioUnit.DecibelMillivolt); /// - /// Get AmplitudeRatio in DecibelsUnloaded. + /// Get in DecibelsUnloaded. /// public double DecibelsUnloaded => As(AmplitudeRatioUnit.DecibelUnloaded); /// - /// Get AmplitudeRatio in DecibelVolts. + /// Get in DecibelVolts. /// public double DecibelVolts => As(AmplitudeRatioUnit.DecibelVolt); @@ -216,51 +216,51 @@ public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] IForma #region Static Factory Methods /// - /// Get AmplitudeRatio from DecibelMicrovolts. + /// Get from DecibelMicrovolts. /// /// If value is NaN or Infinity. - public static AmplitudeRatio FromDecibelMicrovolts(QuantityValue decibelmicrovolts) + public static AmplitudeRatio FromDecibelMicrovolts(QuantityValue decibelmicrovolts) { double value = (double) decibelmicrovolts; - return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelMicrovolt); + return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelMicrovolt); } /// - /// Get AmplitudeRatio from DecibelMillivolts. + /// Get from DecibelMillivolts. /// /// If value is NaN or Infinity. - public static AmplitudeRatio FromDecibelMillivolts(QuantityValue decibelmillivolts) + public static AmplitudeRatio FromDecibelMillivolts(QuantityValue decibelmillivolts) { double value = (double) decibelmillivolts; - return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelMillivolt); + return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelMillivolt); } /// - /// Get AmplitudeRatio from DecibelsUnloaded. + /// Get from DecibelsUnloaded. /// /// If value is NaN or Infinity. - public static AmplitudeRatio FromDecibelsUnloaded(QuantityValue decibelsunloaded) + public static AmplitudeRatio FromDecibelsUnloaded(QuantityValue decibelsunloaded) { double value = (double) decibelsunloaded; - return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelUnloaded); + return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelUnloaded); } /// - /// Get AmplitudeRatio from DecibelVolts. + /// Get from DecibelVolts. /// /// If value is NaN or Infinity. - public static AmplitudeRatio FromDecibelVolts(QuantityValue decibelvolts) + public static AmplitudeRatio FromDecibelVolts(QuantityValue decibelvolts) { double value = (double) decibelvolts; - return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelVolt); + return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelVolt); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// AmplitudeRatio unit value. - public static AmplitudeRatio From(QuantityValue value, AmplitudeRatioUnit fromUnit) + /// unit value. + public static AmplitudeRatio From(QuantityValue value, AmplitudeRatioUnit fromUnit) { - return new AmplitudeRatio((double)value, fromUnit); + return new AmplitudeRatio((double)value, fromUnit); } #endregion @@ -289,7 +289,7 @@ public static AmplitudeRatio From(QuantityValue value, AmplitudeRatioUnit fromUn /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static AmplitudeRatio Parse(string str) + public static AmplitudeRatio Parse(string str) { return Parse(str, null); } @@ -317,9 +317,9 @@ public static AmplitudeRatio Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static AmplitudeRatio Parse(string str, [CanBeNull] IFormatProvider provider) + public static AmplitudeRatio Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, AmplitudeRatioUnit>( str, provider, From); @@ -333,7 +333,7 @@ public static AmplitudeRatio Parse(string str, [CanBeNull] IFormatProvider provi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out AmplitudeRatio result) + public static bool TryParse([CanBeNull] string str, out AmplitudeRatio result) { return TryParse(str, null, out result); } @@ -348,9 +348,9 @@ public static bool TryParse([CanBeNull] string str, out AmplitudeRatio result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmplitudeRatio result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmplitudeRatio result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, AmplitudeRatioUnit>( str, provider, From, @@ -412,50 +412,50 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amplit #region Logarithmic Arithmetic Operators /// Negate the value. - public static AmplitudeRatio operator -(AmplitudeRatio right) + public static AmplitudeRatio operator -(AmplitudeRatio right) { - return new AmplitudeRatio(-right.Value, right.Unit); + return new AmplitudeRatio(-right.Value, right.Unit); } - /// Get from logarithmic addition of two . - public static AmplitudeRatio operator +(AmplitudeRatio left, AmplitudeRatio right) + /// Get from logarithmic addition of two . + public static AmplitudeRatio operator +(AmplitudeRatio left, AmplitudeRatio right) { // Logarithmic addition // Formula: 20*log10(10^(x/20) + 10^(y/20)) - return new AmplitudeRatio(20*Math.Log10(Math.Pow(10, left.Value/20) + Math.Pow(10, right.GetValueAs(left.Unit)/20)), left.Unit); + return new AmplitudeRatio(20*Math.Log10(Math.Pow(10, left.Value/20) + Math.Pow(10, right.GetValueAs(left.Unit)/20)), left.Unit); } - /// Get from logarithmic subtraction of two . - public static AmplitudeRatio operator -(AmplitudeRatio left, AmplitudeRatio right) + /// Get from logarithmic subtraction of two . + public static AmplitudeRatio operator -(AmplitudeRatio left, AmplitudeRatio right) { // Logarithmic subtraction // Formula: 20*log10(10^(x/20) - 10^(y/20)) - return new AmplitudeRatio(20*Math.Log10(Math.Pow(10, left.Value/20) - Math.Pow(10, right.GetValueAs(left.Unit)/20)), left.Unit); + return new AmplitudeRatio(20*Math.Log10(Math.Pow(10, left.Value/20) - Math.Pow(10, right.GetValueAs(left.Unit)/20)), left.Unit); } - /// Get from logarithmic multiplication of value and . - public static AmplitudeRatio operator *(double left, AmplitudeRatio right) + /// Get from logarithmic multiplication of value and . + public static AmplitudeRatio operator *(double left, AmplitudeRatio right) { // Logarithmic multiplication = addition - return new AmplitudeRatio(left + right.Value, right.Unit); + return new AmplitudeRatio(left + right.Value, right.Unit); } - /// Get from logarithmic multiplication of value and . - public static AmplitudeRatio operator *(AmplitudeRatio left, double right) + /// Get from logarithmic multiplication of value and . + public static AmplitudeRatio operator *(AmplitudeRatio left, double right) { // Logarithmic multiplication = addition - return new AmplitudeRatio(left.Value + (double)right, left.Unit); + return new AmplitudeRatio(left.Value + (double)right, left.Unit); } - /// Get from logarithmic division of by value. - public static AmplitudeRatio operator /(AmplitudeRatio left, double right) + /// Get from logarithmic division of by value. + public static AmplitudeRatio operator /(AmplitudeRatio left, double right) { // Logarithmic division = subtraction - return new AmplitudeRatio(left.Value - (double)right, left.Unit); + return new AmplitudeRatio(left.Value - (double)right, left.Unit); } - /// Get ratio value from logarithmic division of by . - public static double operator /(AmplitudeRatio left, AmplitudeRatio right) + /// Get ratio value from logarithmic division of by . + public static double operator /(AmplitudeRatio left, AmplitudeRatio right) { // Logarithmic division = subtraction return Convert.ToDouble(left.Value - right.GetValueAs(left.Unit)); @@ -466,39 +466,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amplit #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(AmplitudeRatio left, AmplitudeRatio right) + public static bool operator <=(AmplitudeRatio left, AmplitudeRatio right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(AmplitudeRatio left, AmplitudeRatio right) + public static bool operator >=(AmplitudeRatio left, AmplitudeRatio right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(AmplitudeRatio left, AmplitudeRatio right) + public static bool operator <(AmplitudeRatio left, AmplitudeRatio right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(AmplitudeRatio left, AmplitudeRatio right) + public static bool operator >(AmplitudeRatio left, AmplitudeRatio right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(AmplitudeRatio left, AmplitudeRatio right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(AmplitudeRatio left, AmplitudeRatio right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(AmplitudeRatio left, AmplitudeRatio right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(AmplitudeRatio left, AmplitudeRatio right) { return !(left == right); } @@ -507,37 +507,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amplit public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AmplitudeRatio objAmplitudeRatio)) throw new ArgumentException("Expected type AmplitudeRatio.", nameof(obj)); + if(!(obj is AmplitudeRatio objAmplitudeRatio)) throw new ArgumentException("Expected type AmplitudeRatio.", nameof(obj)); return CompareTo(objAmplitudeRatio); } /// - public int CompareTo(AmplitudeRatio other) + public int CompareTo(AmplitudeRatio other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is AmplitudeRatio objAmplitudeRatio)) + if(obj is null || !(obj is AmplitudeRatio objAmplitudeRatio)) return false; return Equals(objAmplitudeRatio); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(AmplitudeRatio other) + /// Consider using for safely comparing floating point values. + public bool Equals(AmplitudeRatio other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another AmplitudeRatio within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -575,7 +575,7 @@ public bool Equals(AmplitudeRatio other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(AmplitudeRatio other, double tolerance, ComparisonType comparisonType) + public bool Equals(AmplitudeRatio other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -589,7 +589,7 @@ public bool Equals(AmplitudeRatio other, double tolerance, ComparisonType compar /// /// Returns the hash code for this instance. /// - /// A hash code for the current AmplitudeRatio. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -637,13 +637,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this AmplitudeRatio to another AmplitudeRatio with the unit representation . + /// Converts this to another with the unit representation . /// - /// A AmplitudeRatio with the specified unit. - public AmplitudeRatio ToUnit(AmplitudeRatioUnit unit) + /// A with the specified unit. + public AmplitudeRatio ToUnit(AmplitudeRatioUnit unit) { var convertedValue = GetValueAs(unit); - return new AmplitudeRatio(convertedValue, unit); + return new AmplitudeRatio(convertedValue, unit); } /// @@ -656,7 +656,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public AmplitudeRatio ToUnit(UnitSystem unitSystem) + public AmplitudeRatio ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -702,10 +702,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal AmplitudeRatio ToBaseUnit() + internal AmplitudeRatio ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new AmplitudeRatio(baseUnitValue, BaseUnit); + return new AmplitudeRatio(baseUnitValue, BaseUnit); } private double GetValueAs(AmplitudeRatioUnit unit) @@ -817,7 +817,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -827,12 +827,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -877,16 +877,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(AmplitudeRatio)) + if(conversionType == typeof(AmplitudeRatio)) return this; else if(conversionType == typeof(AmplitudeRatioUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return AmplitudeRatio.QuantityType; + return AmplitudeRatio.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return AmplitudeRatio.BaseDimensions; + return AmplitudeRatio.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs index 64efe5550d..17cf7aecfa 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// In geometry, an angle is the figure formed by two rays, called the sides of the angle, sharing a common endpoint, called the vertex of the angle. /// - public partial struct Angle : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Angle : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -113,19 +113,19 @@ public Angle(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Angle, which is Degree. All conversions go via this value. + /// The base unit of , which is Degree. All conversions go via this value. /// public static AngleUnit BaseUnit { get; } = AngleUnit.Degree; /// - /// Represents the largest possible value of Angle + /// Represents the largest possible value of /// - public static Angle MaxValue { get; } = new Angle(double.MaxValue, BaseUnit); + public static Angle MaxValue { get; } = new Angle(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Angle + /// Represents the smallest possible value of /// - public static Angle MinValue { get; } = new Angle(double.MinValue, BaseUnit); + public static Angle MinValue { get; } = new Angle(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -133,14 +133,14 @@ public Angle(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Angle; /// - /// All units of measurement for the Angle quantity. + /// All units of measurement for the quantity. /// public static AngleUnit[] Units { get; } = Enum.GetValues(typeof(AngleUnit)).Cast().Except(new AngleUnit[]{ AngleUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Degree. /// - public static Angle Zero { get; } = new Angle(0, BaseUnit); + public static Angle Zero { get; } = new Angle(0, BaseUnit); #endregion @@ -165,84 +165,84 @@ public Angle(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Angle.QuantityType; + public QuantityType Type => Angle.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Angle.BaseDimensions; + public BaseDimensions Dimensions => Angle.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Angle in Arcminutes. + /// Get in Arcminutes. /// public double Arcminutes => As(AngleUnit.Arcminute); /// - /// Get Angle in Arcseconds. + /// Get in Arcseconds. /// public double Arcseconds => As(AngleUnit.Arcsecond); /// - /// Get Angle in Centiradians. + /// Get in Centiradians. /// public double Centiradians => As(AngleUnit.Centiradian); /// - /// Get Angle in Deciradians. + /// Get in Deciradians. /// public double Deciradians => As(AngleUnit.Deciradian); /// - /// Get Angle in Degrees. + /// Get in Degrees. /// public double Degrees => As(AngleUnit.Degree); /// - /// Get Angle in Gradians. + /// Get in Gradians. /// public double Gradians => As(AngleUnit.Gradian); /// - /// Get Angle in Microdegrees. + /// Get in Microdegrees. /// public double Microdegrees => As(AngleUnit.Microdegree); /// - /// Get Angle in Microradians. + /// Get in Microradians. /// public double Microradians => As(AngleUnit.Microradian); /// - /// Get Angle in Millidegrees. + /// Get in Millidegrees. /// public double Millidegrees => As(AngleUnit.Millidegree); /// - /// Get Angle in Milliradians. + /// Get in Milliradians. /// public double Milliradians => As(AngleUnit.Milliradian); /// - /// Get Angle in Nanodegrees. + /// Get in Nanodegrees. /// public double Nanodegrees => As(AngleUnit.Nanodegree); /// - /// Get Angle in Nanoradians. + /// Get in Nanoradians. /// public double Nanoradians => As(AngleUnit.Nanoradian); /// - /// Get Angle in Radians. + /// Get in Radians. /// public double Radians => As(AngleUnit.Radian); /// - /// Get Angle in Revolutions. + /// Get in Revolutions. /// public double Revolutions => As(AngleUnit.Revolution); @@ -276,141 +276,141 @@ public static string GetAbbreviation(AngleUnit unit, [CanBeNull] IFormatProvider #region Static Factory Methods /// - /// Get Angle from Arcminutes. + /// Get from Arcminutes. /// /// If value is NaN or Infinity. - public static Angle FromArcminutes(QuantityValue arcminutes) + public static Angle FromArcminutes(QuantityValue arcminutes) { double value = (double) arcminutes; - return new Angle(value, AngleUnit.Arcminute); + return new Angle(value, AngleUnit.Arcminute); } /// - /// Get Angle from Arcseconds. + /// Get from Arcseconds. /// /// If value is NaN or Infinity. - public static Angle FromArcseconds(QuantityValue arcseconds) + public static Angle FromArcseconds(QuantityValue arcseconds) { double value = (double) arcseconds; - return new Angle(value, AngleUnit.Arcsecond); + return new Angle(value, AngleUnit.Arcsecond); } /// - /// Get Angle from Centiradians. + /// Get from Centiradians. /// /// If value is NaN or Infinity. - public static Angle FromCentiradians(QuantityValue centiradians) + public static Angle FromCentiradians(QuantityValue centiradians) { double value = (double) centiradians; - return new Angle(value, AngleUnit.Centiradian); + return new Angle(value, AngleUnit.Centiradian); } /// - /// Get Angle from Deciradians. + /// Get from Deciradians. /// /// If value is NaN or Infinity. - public static Angle FromDeciradians(QuantityValue deciradians) + public static Angle FromDeciradians(QuantityValue deciradians) { double value = (double) deciradians; - return new Angle(value, AngleUnit.Deciradian); + return new Angle(value, AngleUnit.Deciradian); } /// - /// Get Angle from Degrees. + /// Get from Degrees. /// /// If value is NaN or Infinity. - public static Angle FromDegrees(QuantityValue degrees) + public static Angle FromDegrees(QuantityValue degrees) { double value = (double) degrees; - return new Angle(value, AngleUnit.Degree); + return new Angle(value, AngleUnit.Degree); } /// - /// Get Angle from Gradians. + /// Get from Gradians. /// /// If value is NaN or Infinity. - public static Angle FromGradians(QuantityValue gradians) + public static Angle FromGradians(QuantityValue gradians) { double value = (double) gradians; - return new Angle(value, AngleUnit.Gradian); + return new Angle(value, AngleUnit.Gradian); } /// - /// Get Angle from Microdegrees. + /// Get from Microdegrees. /// /// If value is NaN or Infinity. - public static Angle FromMicrodegrees(QuantityValue microdegrees) + public static Angle FromMicrodegrees(QuantityValue microdegrees) { double value = (double) microdegrees; - return new Angle(value, AngleUnit.Microdegree); + return new Angle(value, AngleUnit.Microdegree); } /// - /// Get Angle from Microradians. + /// Get from Microradians. /// /// If value is NaN or Infinity. - public static Angle FromMicroradians(QuantityValue microradians) + public static Angle FromMicroradians(QuantityValue microradians) { double value = (double) microradians; - return new Angle(value, AngleUnit.Microradian); + return new Angle(value, AngleUnit.Microradian); } /// - /// Get Angle from Millidegrees. + /// Get from Millidegrees. /// /// If value is NaN or Infinity. - public static Angle FromMillidegrees(QuantityValue millidegrees) + public static Angle FromMillidegrees(QuantityValue millidegrees) { double value = (double) millidegrees; - return new Angle(value, AngleUnit.Millidegree); + return new Angle(value, AngleUnit.Millidegree); } /// - /// Get Angle from Milliradians. + /// Get from Milliradians. /// /// If value is NaN or Infinity. - public static Angle FromMilliradians(QuantityValue milliradians) + public static Angle FromMilliradians(QuantityValue milliradians) { double value = (double) milliradians; - return new Angle(value, AngleUnit.Milliradian); + return new Angle(value, AngleUnit.Milliradian); } /// - /// Get Angle from Nanodegrees. + /// Get from Nanodegrees. /// /// If value is NaN or Infinity. - public static Angle FromNanodegrees(QuantityValue nanodegrees) + public static Angle FromNanodegrees(QuantityValue nanodegrees) { double value = (double) nanodegrees; - return new Angle(value, AngleUnit.Nanodegree); + return new Angle(value, AngleUnit.Nanodegree); } /// - /// Get Angle from Nanoradians. + /// Get from Nanoradians. /// /// If value is NaN or Infinity. - public static Angle FromNanoradians(QuantityValue nanoradians) + public static Angle FromNanoradians(QuantityValue nanoradians) { double value = (double) nanoradians; - return new Angle(value, AngleUnit.Nanoradian); + return new Angle(value, AngleUnit.Nanoradian); } /// - /// Get Angle from Radians. + /// Get from Radians. /// /// If value is NaN or Infinity. - public static Angle FromRadians(QuantityValue radians) + public static Angle FromRadians(QuantityValue radians) { double value = (double) radians; - return new Angle(value, AngleUnit.Radian); + return new Angle(value, AngleUnit.Radian); } /// - /// Get Angle from Revolutions. + /// Get from Revolutions. /// /// If value is NaN or Infinity. - public static Angle FromRevolutions(QuantityValue revolutions) + public static Angle FromRevolutions(QuantityValue revolutions) { double value = (double) revolutions; - return new Angle(value, AngleUnit.Revolution); + return new Angle(value, AngleUnit.Revolution); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Angle unit value. - public static Angle From(QuantityValue value, AngleUnit fromUnit) + /// unit value. + public static Angle From(QuantityValue value, AngleUnit fromUnit) { - return new Angle((double)value, fromUnit); + return new Angle((double)value, fromUnit); } #endregion @@ -439,7 +439,7 @@ public static Angle From(QuantityValue value, AngleUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Angle Parse(string str) + public static Angle Parse(string str) { return Parse(str, null); } @@ -467,9 +467,9 @@ public static Angle Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Angle Parse(string str, [CanBeNull] IFormatProvider provider) + public static Angle Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, AngleUnit>( str, provider, From); @@ -483,7 +483,7 @@ public static Angle Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Angle result) + public static bool TryParse([CanBeNull] string str, out Angle result) { return TryParse(str, null, out result); } @@ -498,9 +498,9 @@ public static bool TryParse([CanBeNull] string str, out Angle result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Angle result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Angle result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, AngleUnit>( str, provider, From, @@ -562,43 +562,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AngleU #region Arithmetic Operators /// Negate the value. - public static Angle operator -(Angle right) + public static Angle operator -(Angle right) { - return new Angle(-right.Value, right.Unit); + return new Angle(-right.Value, right.Unit); } - /// Get from adding two . - public static Angle operator +(Angle left, Angle right) + /// Get from adding two . + public static Angle operator +(Angle left, Angle right) { - return new Angle(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Angle(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Angle operator -(Angle left, Angle right) + /// Get from subtracting two . + public static Angle operator -(Angle left, Angle right) { - return new Angle(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Angle(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Angle operator *(double left, Angle right) + /// Get from multiplying value and . + public static Angle operator *(double left, Angle right) { - return new Angle(left * right.Value, right.Unit); + return new Angle(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Angle operator *(Angle left, double right) + /// Get from multiplying value and . + public static Angle operator *(Angle left, double right) { - return new Angle(left.Value * right, left.Unit); + return new Angle(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Angle operator /(Angle left, double right) + /// Get from dividing by value. + public static Angle operator /(Angle left, double right) { - return new Angle(left.Value / right, left.Unit); + return new Angle(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Angle left, Angle right) + /// Get ratio value from dividing by . + public static double operator /(Angle left, Angle right) { return left.Degrees / right.Degrees; } @@ -608,39 +608,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AngleU #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Angle left, Angle right) + public static bool operator <=(Angle left, Angle right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Angle left, Angle right) + public static bool operator >=(Angle left, Angle right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Angle left, Angle right) + public static bool operator <(Angle left, Angle right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Angle left, Angle right) + public static bool operator >(Angle left, Angle right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Angle left, Angle right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Angle left, Angle right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Angle left, Angle right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Angle left, Angle right) { return !(left == right); } @@ -649,37 +649,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AngleU public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Angle objAngle)) throw new ArgumentException("Expected type Angle.", nameof(obj)); + if(!(obj is Angle objAngle)) throw new ArgumentException("Expected type Angle.", nameof(obj)); return CompareTo(objAngle); } /// - public int CompareTo(Angle other) + public int CompareTo(Angle other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Angle objAngle)) + if(obj is null || !(obj is Angle objAngle)) return false; return Equals(objAngle); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Angle other) + /// Consider using for safely comparing floating point values. + public bool Equals(Angle other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Angle within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -717,7 +717,7 @@ public bool Equals(Angle other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Angle other, double tolerance, ComparisonType comparisonType) + public bool Equals(Angle other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -731,7 +731,7 @@ public bool Equals(Angle other, double tolerance, ComparisonType comparisonType) /// /// Returns the hash code for this instance. /// - /// A hash code for the current Angle. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -779,13 +779,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Angle to another Angle with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Angle with the specified unit. - public Angle ToUnit(AngleUnit unit) + /// A with the specified unit. + public Angle ToUnit(AngleUnit unit) { var convertedValue = GetValueAs(unit); - return new Angle(convertedValue, unit); + return new Angle(convertedValue, unit); } /// @@ -798,7 +798,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Angle ToUnit(UnitSystem unitSystem) + public Angle ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -854,10 +854,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Angle ToBaseUnit() + internal Angle ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Angle(baseUnitValue, BaseUnit); + return new Angle(baseUnitValue, BaseUnit); } private double GetValueAs(AngleUnit unit) @@ -979,7 +979,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Angle)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Angle)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -989,12 +989,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Angle)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Angle)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Angle)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Angle)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1039,16 +1039,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Angle)) + if(conversionType == typeof(Angle)) return this; else if(conversionType == typeof(AngleUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Angle.QuantityType; + return Angle.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Angle.BaseDimensions; + return Angle.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Angle)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Angle)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs index 9cee071934..4a3cca559b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// A unit for expressing the integral of apparent power over time, equal to the product of 1 volt-ampere and 1 hour, or to 3600 joules. /// - public partial struct ApparentEnergy : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ApparentEnergy : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -102,19 +102,19 @@ public ApparentEnergy(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ApparentEnergy, which is VoltampereHour. All conversions go via this value. + /// The base unit of , which is VoltampereHour. All conversions go via this value. /// public static ApparentEnergyUnit BaseUnit { get; } = ApparentEnergyUnit.VoltampereHour; /// - /// Represents the largest possible value of ApparentEnergy + /// Represents the largest possible value of /// - public static ApparentEnergy MaxValue { get; } = new ApparentEnergy(double.MaxValue, BaseUnit); + public static ApparentEnergy MaxValue { get; } = new ApparentEnergy(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ApparentEnergy + /// Represents the smallest possible value of /// - public static ApparentEnergy MinValue { get; } = new ApparentEnergy(double.MinValue, BaseUnit); + public static ApparentEnergy MinValue { get; } = new ApparentEnergy(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -122,14 +122,14 @@ public ApparentEnergy(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ApparentEnergy; /// - /// All units of measurement for the ApparentEnergy quantity. + /// All units of measurement for the quantity. /// public static ApparentEnergyUnit[] Units { get; } = Enum.GetValues(typeof(ApparentEnergyUnit)).Cast().Except(new ApparentEnergyUnit[]{ ApparentEnergyUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereHour. /// - public static ApparentEnergy Zero { get; } = new ApparentEnergy(0, BaseUnit); + public static ApparentEnergy Zero { get; } = new ApparentEnergy(0, BaseUnit); #endregion @@ -154,29 +154,29 @@ public ApparentEnergy(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ApparentEnergy.QuantityType; + public QuantityType Type => ApparentEnergy.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ApparentEnergy.BaseDimensions; + public BaseDimensions Dimensions => ApparentEnergy.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ApparentEnergy in KilovoltampereHours. + /// Get in KilovoltampereHours. /// public double KilovoltampereHours => As(ApparentEnergyUnit.KilovoltampereHour); /// - /// Get ApparentEnergy in MegavoltampereHours. + /// Get in MegavoltampereHours. /// public double MegavoltampereHours => As(ApparentEnergyUnit.MegavoltampereHour); /// - /// Get ApparentEnergy in VoltampereHours. + /// Get in VoltampereHours. /// public double VoltampereHours => As(ApparentEnergyUnit.VoltampereHour); @@ -210,42 +210,42 @@ public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] IForma #region Static Factory Methods /// - /// Get ApparentEnergy from KilovoltampereHours. + /// Get from KilovoltampereHours. /// /// If value is NaN or Infinity. - public static ApparentEnergy FromKilovoltampereHours(QuantityValue kilovoltamperehours) + public static ApparentEnergy FromKilovoltampereHours(QuantityValue kilovoltamperehours) { double value = (double) kilovoltamperehours; - return new ApparentEnergy(value, ApparentEnergyUnit.KilovoltampereHour); + return new ApparentEnergy(value, ApparentEnergyUnit.KilovoltampereHour); } /// - /// Get ApparentEnergy from MegavoltampereHours. + /// Get from MegavoltampereHours. /// /// If value is NaN or Infinity. - public static ApparentEnergy FromMegavoltampereHours(QuantityValue megavoltamperehours) + public static ApparentEnergy FromMegavoltampereHours(QuantityValue megavoltamperehours) { double value = (double) megavoltamperehours; - return new ApparentEnergy(value, ApparentEnergyUnit.MegavoltampereHour); + return new ApparentEnergy(value, ApparentEnergyUnit.MegavoltampereHour); } /// - /// Get ApparentEnergy from VoltampereHours. + /// Get from VoltampereHours. /// /// If value is NaN or Infinity. - public static ApparentEnergy FromVoltampereHours(QuantityValue voltamperehours) + public static ApparentEnergy FromVoltampereHours(QuantityValue voltamperehours) { double value = (double) voltamperehours; - return new ApparentEnergy(value, ApparentEnergyUnit.VoltampereHour); + return new ApparentEnergy(value, ApparentEnergyUnit.VoltampereHour); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ApparentEnergy unit value. - public static ApparentEnergy From(QuantityValue value, ApparentEnergyUnit fromUnit) + /// unit value. + public static ApparentEnergy From(QuantityValue value, ApparentEnergyUnit fromUnit) { - return new ApparentEnergy((double)value, fromUnit); + return new ApparentEnergy((double)value, fromUnit); } #endregion @@ -274,7 +274,7 @@ public static ApparentEnergy From(QuantityValue value, ApparentEnergyUnit fromUn /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ApparentEnergy Parse(string str) + public static ApparentEnergy Parse(string str) { return Parse(str, null); } @@ -302,9 +302,9 @@ public static ApparentEnergy Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ApparentEnergy Parse(string str, [CanBeNull] IFormatProvider provider) + public static ApparentEnergy Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ApparentEnergyUnit>( str, provider, From); @@ -318,7 +318,7 @@ public static ApparentEnergy Parse(string str, [CanBeNull] IFormatProvider provi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ApparentEnergy result) + public static bool TryParse([CanBeNull] string str, out ApparentEnergy result) { return TryParse(str, null, out result); } @@ -333,9 +333,9 @@ public static bool TryParse([CanBeNull] string str, out ApparentEnergy result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentEnergy result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentEnergy result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ApparentEnergyUnit>( str, provider, From, @@ -397,43 +397,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare #region Arithmetic Operators /// Negate the value. - public static ApparentEnergy operator -(ApparentEnergy right) + public static ApparentEnergy operator -(ApparentEnergy right) { - return new ApparentEnergy(-right.Value, right.Unit); + return new ApparentEnergy(-right.Value, right.Unit); } - /// Get from adding two . - public static ApparentEnergy operator +(ApparentEnergy left, ApparentEnergy right) + /// Get from adding two . + public static ApparentEnergy operator +(ApparentEnergy left, ApparentEnergy right) { - return new ApparentEnergy(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ApparentEnergy(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ApparentEnergy operator -(ApparentEnergy left, ApparentEnergy right) + /// Get from subtracting two . + public static ApparentEnergy operator -(ApparentEnergy left, ApparentEnergy right) { - return new ApparentEnergy(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ApparentEnergy(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ApparentEnergy operator *(double left, ApparentEnergy right) + /// Get from multiplying value and . + public static ApparentEnergy operator *(double left, ApparentEnergy right) { - return new ApparentEnergy(left * right.Value, right.Unit); + return new ApparentEnergy(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ApparentEnergy operator *(ApparentEnergy left, double right) + /// Get from multiplying value and . + public static ApparentEnergy operator *(ApparentEnergy left, double right) { - return new ApparentEnergy(left.Value * right, left.Unit); + return new ApparentEnergy(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ApparentEnergy operator /(ApparentEnergy left, double right) + /// Get from dividing by value. + public static ApparentEnergy operator /(ApparentEnergy left, double right) { - return new ApparentEnergy(left.Value / right, left.Unit); + return new ApparentEnergy(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ApparentEnergy left, ApparentEnergy right) + /// Get ratio value from dividing by . + public static double operator /(ApparentEnergy left, ApparentEnergy right) { return left.VoltampereHours / right.VoltampereHours; } @@ -443,39 +443,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ApparentEnergy left, ApparentEnergy right) + public static bool operator <=(ApparentEnergy left, ApparentEnergy right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ApparentEnergy left, ApparentEnergy right) + public static bool operator >=(ApparentEnergy left, ApparentEnergy right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ApparentEnergy left, ApparentEnergy right) + public static bool operator <(ApparentEnergy left, ApparentEnergy right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ApparentEnergy left, ApparentEnergy right) + public static bool operator >(ApparentEnergy left, ApparentEnergy right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ApparentEnergy left, ApparentEnergy right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ApparentEnergy left, ApparentEnergy right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ApparentEnergy left, ApparentEnergy right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ApparentEnergy left, ApparentEnergy right) { return !(left == right); } @@ -484,37 +484,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ApparentEnergy objApparentEnergy)) throw new ArgumentException("Expected type ApparentEnergy.", nameof(obj)); + if(!(obj is ApparentEnergy objApparentEnergy)) throw new ArgumentException("Expected type ApparentEnergy.", nameof(obj)); return CompareTo(objApparentEnergy); } /// - public int CompareTo(ApparentEnergy other) + public int CompareTo(ApparentEnergy other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ApparentEnergy objApparentEnergy)) + if(obj is null || !(obj is ApparentEnergy objApparentEnergy)) return false; return Equals(objApparentEnergy); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ApparentEnergy other) + /// Consider using for safely comparing floating point values. + public bool Equals(ApparentEnergy other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ApparentEnergy within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -552,7 +552,7 @@ public bool Equals(ApparentEnergy other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ApparentEnergy other, double tolerance, ComparisonType comparisonType) + public bool Equals(ApparentEnergy other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -566,7 +566,7 @@ public bool Equals(ApparentEnergy other, double tolerance, ComparisonType compar /// /// Returns the hash code for this instance. /// - /// A hash code for the current ApparentEnergy. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -614,13 +614,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ApparentEnergy to another ApparentEnergy with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ApparentEnergy with the specified unit. - public ApparentEnergy ToUnit(ApparentEnergyUnit unit) + /// A with the specified unit. + public ApparentEnergy ToUnit(ApparentEnergyUnit unit) { var convertedValue = GetValueAs(unit); - return new ApparentEnergy(convertedValue, unit); + return new ApparentEnergy(convertedValue, unit); } /// @@ -633,7 +633,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ApparentEnergy ToUnit(UnitSystem unitSystem) + public ApparentEnergy ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -678,10 +678,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ApparentEnergy ToBaseUnit() + internal ApparentEnergy ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ApparentEnergy(baseUnitValue, BaseUnit); + return new ApparentEnergy(baseUnitValue, BaseUnit); } private double GetValueAs(ApparentEnergyUnit unit) @@ -792,7 +792,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -802,12 +802,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -852,16 +852,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ApparentEnergy)) + if(conversionType == typeof(ApparentEnergy)) return this; else if(conversionType == typeof(ApparentEnergyUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ApparentEnergy.QuantityType; + return ApparentEnergy.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ApparentEnergy.BaseDimensions; + return ApparentEnergy.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs index 951f5b4370..0ebb0ec462 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Power engineers measure apparent power as the magnitude of the vector sum of active and reactive power. Apparent power is the product of the root-mean-square of voltage and current. /// - public partial struct ApparentPower : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ApparentPower : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -103,19 +103,19 @@ public ApparentPower(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ApparentPower, which is Voltampere. All conversions go via this value. + /// The base unit of , which is Voltampere. All conversions go via this value. /// public static ApparentPowerUnit BaseUnit { get; } = ApparentPowerUnit.Voltampere; /// - /// Represents the largest possible value of ApparentPower + /// Represents the largest possible value of /// - public static ApparentPower MaxValue { get; } = new ApparentPower(double.MaxValue, BaseUnit); + public static ApparentPower MaxValue { get; } = new ApparentPower(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ApparentPower + /// Represents the smallest possible value of /// - public static ApparentPower MinValue { get; } = new ApparentPower(double.MinValue, BaseUnit); + public static ApparentPower MinValue { get; } = new ApparentPower(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -123,14 +123,14 @@ public ApparentPower(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ApparentPower; /// - /// All units of measurement for the ApparentPower quantity. + /// All units of measurement for the quantity. /// public static ApparentPowerUnit[] Units { get; } = Enum.GetValues(typeof(ApparentPowerUnit)).Cast().Except(new ApparentPowerUnit[]{ ApparentPowerUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Voltampere. /// - public static ApparentPower Zero { get; } = new ApparentPower(0, BaseUnit); + public static ApparentPower Zero { get; } = new ApparentPower(0, BaseUnit); #endregion @@ -155,34 +155,34 @@ public ApparentPower(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ApparentPower.QuantityType; + public QuantityType Type => ApparentPower.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ApparentPower.BaseDimensions; + public BaseDimensions Dimensions => ApparentPower.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ApparentPower in Gigavoltamperes. + /// Get in Gigavoltamperes. /// public double Gigavoltamperes => As(ApparentPowerUnit.Gigavoltampere); /// - /// Get ApparentPower in Kilovoltamperes. + /// Get in Kilovoltamperes. /// public double Kilovoltamperes => As(ApparentPowerUnit.Kilovoltampere); /// - /// Get ApparentPower in Megavoltamperes. + /// Get in Megavoltamperes. /// public double Megavoltamperes => As(ApparentPowerUnit.Megavoltampere); /// - /// Get ApparentPower in Voltamperes. + /// Get in Voltamperes. /// public double Voltamperes => As(ApparentPowerUnit.Voltampere); @@ -216,51 +216,51 @@ public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] IFormat #region Static Factory Methods /// - /// Get ApparentPower from Gigavoltamperes. + /// Get from Gigavoltamperes. /// /// If value is NaN or Infinity. - public static ApparentPower FromGigavoltamperes(QuantityValue gigavoltamperes) + public static ApparentPower FromGigavoltamperes(QuantityValue gigavoltamperes) { double value = (double) gigavoltamperes; - return new ApparentPower(value, ApparentPowerUnit.Gigavoltampere); + return new ApparentPower(value, ApparentPowerUnit.Gigavoltampere); } /// - /// Get ApparentPower from Kilovoltamperes. + /// Get from Kilovoltamperes. /// /// If value is NaN or Infinity. - public static ApparentPower FromKilovoltamperes(QuantityValue kilovoltamperes) + public static ApparentPower FromKilovoltamperes(QuantityValue kilovoltamperes) { double value = (double) kilovoltamperes; - return new ApparentPower(value, ApparentPowerUnit.Kilovoltampere); + return new ApparentPower(value, ApparentPowerUnit.Kilovoltampere); } /// - /// Get ApparentPower from Megavoltamperes. + /// Get from Megavoltamperes. /// /// If value is NaN or Infinity. - public static ApparentPower FromMegavoltamperes(QuantityValue megavoltamperes) + public static ApparentPower FromMegavoltamperes(QuantityValue megavoltamperes) { double value = (double) megavoltamperes; - return new ApparentPower(value, ApparentPowerUnit.Megavoltampere); + return new ApparentPower(value, ApparentPowerUnit.Megavoltampere); } /// - /// Get ApparentPower from Voltamperes. + /// Get from Voltamperes. /// /// If value is NaN or Infinity. - public static ApparentPower FromVoltamperes(QuantityValue voltamperes) + public static ApparentPower FromVoltamperes(QuantityValue voltamperes) { double value = (double) voltamperes; - return new ApparentPower(value, ApparentPowerUnit.Voltampere); + return new ApparentPower(value, ApparentPowerUnit.Voltampere); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ApparentPower unit value. - public static ApparentPower From(QuantityValue value, ApparentPowerUnit fromUnit) + /// unit value. + public static ApparentPower From(QuantityValue value, ApparentPowerUnit fromUnit) { - return new ApparentPower((double)value, fromUnit); + return new ApparentPower((double)value, fromUnit); } #endregion @@ -289,7 +289,7 @@ public static ApparentPower From(QuantityValue value, ApparentPowerUnit fromUnit /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ApparentPower Parse(string str) + public static ApparentPower Parse(string str) { return Parse(str, null); } @@ -317,9 +317,9 @@ public static ApparentPower Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ApparentPower Parse(string str, [CanBeNull] IFormatProvider provider) + public static ApparentPower Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ApparentPowerUnit>( str, provider, From); @@ -333,7 +333,7 @@ public static ApparentPower Parse(string str, [CanBeNull] IFormatProvider provid /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ApparentPower result) + public static bool TryParse([CanBeNull] string str, out ApparentPower result) { return TryParse(str, null, out result); } @@ -348,9 +348,9 @@ public static bool TryParse([CanBeNull] string str, out ApparentPower result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentPower result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentPower result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ApparentPowerUnit>( str, provider, From, @@ -412,43 +412,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare #region Arithmetic Operators /// Negate the value. - public static ApparentPower operator -(ApparentPower right) + public static ApparentPower operator -(ApparentPower right) { - return new ApparentPower(-right.Value, right.Unit); + return new ApparentPower(-right.Value, right.Unit); } - /// Get from adding two . - public static ApparentPower operator +(ApparentPower left, ApparentPower right) + /// Get from adding two . + public static ApparentPower operator +(ApparentPower left, ApparentPower right) { - return new ApparentPower(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ApparentPower(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ApparentPower operator -(ApparentPower left, ApparentPower right) + /// Get from subtracting two . + public static ApparentPower operator -(ApparentPower left, ApparentPower right) { - return new ApparentPower(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ApparentPower(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ApparentPower operator *(double left, ApparentPower right) + /// Get from multiplying value and . + public static ApparentPower operator *(double left, ApparentPower right) { - return new ApparentPower(left * right.Value, right.Unit); + return new ApparentPower(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ApparentPower operator *(ApparentPower left, double right) + /// Get from multiplying value and . + public static ApparentPower operator *(ApparentPower left, double right) { - return new ApparentPower(left.Value * right, left.Unit); + return new ApparentPower(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ApparentPower operator /(ApparentPower left, double right) + /// Get from dividing by value. + public static ApparentPower operator /(ApparentPower left, double right) { - return new ApparentPower(left.Value / right, left.Unit); + return new ApparentPower(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ApparentPower left, ApparentPower right) + /// Get ratio value from dividing by . + public static double operator /(ApparentPower left, ApparentPower right) { return left.Voltamperes / right.Voltamperes; } @@ -458,39 +458,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ApparentPower left, ApparentPower right) + public static bool operator <=(ApparentPower left, ApparentPower right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ApparentPower left, ApparentPower right) + public static bool operator >=(ApparentPower left, ApparentPower right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ApparentPower left, ApparentPower right) + public static bool operator <(ApparentPower left, ApparentPower right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ApparentPower left, ApparentPower right) + public static bool operator >(ApparentPower left, ApparentPower right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ApparentPower left, ApparentPower right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ApparentPower left, ApparentPower right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ApparentPower left, ApparentPower right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ApparentPower left, ApparentPower right) { return !(left == right); } @@ -499,37 +499,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ApparentPower objApparentPower)) throw new ArgumentException("Expected type ApparentPower.", nameof(obj)); + if(!(obj is ApparentPower objApparentPower)) throw new ArgumentException("Expected type ApparentPower.", nameof(obj)); return CompareTo(objApparentPower); } /// - public int CompareTo(ApparentPower other) + public int CompareTo(ApparentPower other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ApparentPower objApparentPower)) + if(obj is null || !(obj is ApparentPower objApparentPower)) return false; return Equals(objApparentPower); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ApparentPower other) + /// Consider using for safely comparing floating point values. + public bool Equals(ApparentPower other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ApparentPower within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -567,7 +567,7 @@ public bool Equals(ApparentPower other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ApparentPower other, double tolerance, ComparisonType comparisonType) + public bool Equals(ApparentPower other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -581,7 +581,7 @@ public bool Equals(ApparentPower other, double tolerance, ComparisonType compari /// /// Returns the hash code for this instance. /// - /// A hash code for the current ApparentPower. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -629,13 +629,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ApparentPower to another ApparentPower with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ApparentPower with the specified unit. - public ApparentPower ToUnit(ApparentPowerUnit unit) + /// A with the specified unit. + public ApparentPower ToUnit(ApparentPowerUnit unit) { var convertedValue = GetValueAs(unit); - return new ApparentPower(convertedValue, unit); + return new ApparentPower(convertedValue, unit); } /// @@ -648,7 +648,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ApparentPower ToUnit(UnitSystem unitSystem) + public ApparentPower ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -694,10 +694,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ApparentPower ToBaseUnit() + internal ApparentPower ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ApparentPower(baseUnitValue, BaseUnit); + return new ApparentPower(baseUnitValue, BaseUnit); } private double GetValueAs(ApparentPowerUnit unit) @@ -809,7 +809,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ApparentPower)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ApparentPower)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -819,12 +819,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ApparentPower)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ApparentPower)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ApparentPower)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ApparentPower)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -869,16 +869,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ApparentPower)) + if(conversionType == typeof(ApparentPower)) return this; else if(conversionType == typeof(ApparentPowerUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ApparentPower.QuantityType; + return ApparentPower.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ApparentPower.BaseDimensions; + return ApparentPower.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ApparentPower)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ApparentPower)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs index 07241d5540..7d58afb6be 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Area is a quantity that expresses the extent of a two-dimensional surface or shape, or planar lamina, in the plane. Area can be understood as the amount of material with a given thickness that would be necessary to fashion a model of the shape, or the amount of paint necessary to cover the surface with a single coat.[1] It is the two-dimensional analog of the length of a curve (a one-dimensional concept) or the volume of a solid (a three-dimensional concept). /// - public partial struct Area : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Area : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -113,19 +113,19 @@ public Area(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Area, which is SquareMeter. All conversions go via this value. + /// The base unit of , which is SquareMeter. All conversions go via this value. /// public static AreaUnit BaseUnit { get; } = AreaUnit.SquareMeter; /// - /// Represents the largest possible value of Area + /// Represents the largest possible value of /// - public static Area MaxValue { get; } = new Area(double.MaxValue, BaseUnit); + public static Area MaxValue { get; } = new Area(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Area + /// Represents the smallest possible value of /// - public static Area MinValue { get; } = new Area(double.MinValue, BaseUnit); + public static Area MinValue { get; } = new Area(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -133,14 +133,14 @@ public Area(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Area; /// - /// All units of measurement for the Area quantity. + /// All units of measurement for the quantity. /// public static AreaUnit[] Units { get; } = Enum.GetValues(typeof(AreaUnit)).Cast().Except(new AreaUnit[]{ AreaUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeter. /// - public static Area Zero { get; } = new Area(0, BaseUnit); + public static Area Zero { get; } = new Area(0, BaseUnit); #endregion @@ -165,84 +165,84 @@ public Area(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Area.QuantityType; + public QuantityType Type => Area.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Area.BaseDimensions; + public BaseDimensions Dimensions => Area.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Area in Acres. + /// Get in Acres. /// public double Acres => As(AreaUnit.Acre); /// - /// Get Area in Hectares. + /// Get in Hectares. /// public double Hectares => As(AreaUnit.Hectare); /// - /// Get Area in SquareCentimeters. + /// Get in SquareCentimeters. /// public double SquareCentimeters => As(AreaUnit.SquareCentimeter); /// - /// Get Area in SquareDecimeters. + /// Get in SquareDecimeters. /// public double SquareDecimeters => As(AreaUnit.SquareDecimeter); /// - /// Get Area in SquareFeet. + /// Get in SquareFeet. /// public double SquareFeet => As(AreaUnit.SquareFoot); /// - /// Get Area in SquareInches. + /// Get in SquareInches. /// public double SquareInches => As(AreaUnit.SquareInch); /// - /// Get Area in SquareKilometers. + /// Get in SquareKilometers. /// public double SquareKilometers => As(AreaUnit.SquareKilometer); /// - /// Get Area in SquareMeters. + /// Get in SquareMeters. /// public double SquareMeters => As(AreaUnit.SquareMeter); /// - /// Get Area in SquareMicrometers. + /// Get in SquareMicrometers. /// public double SquareMicrometers => As(AreaUnit.SquareMicrometer); /// - /// Get Area in SquareMiles. + /// Get in SquareMiles. /// public double SquareMiles => As(AreaUnit.SquareMile); /// - /// Get Area in SquareMillimeters. + /// Get in SquareMillimeters. /// public double SquareMillimeters => As(AreaUnit.SquareMillimeter); /// - /// Get Area in SquareNauticalMiles. + /// Get in SquareNauticalMiles. /// public double SquareNauticalMiles => As(AreaUnit.SquareNauticalMile); /// - /// Get Area in SquareYards. + /// Get in SquareYards. /// public double SquareYards => As(AreaUnit.SquareYard); /// - /// Get Area in UsSurveySquareFeet. + /// Get in UsSurveySquareFeet. /// public double UsSurveySquareFeet => As(AreaUnit.UsSurveySquareFoot); @@ -276,141 +276,141 @@ public static string GetAbbreviation(AreaUnit unit, [CanBeNull] IFormatProvider #region Static Factory Methods /// - /// Get Area from Acres. + /// Get from Acres. /// /// If value is NaN or Infinity. - public static Area FromAcres(QuantityValue acres) + public static Area FromAcres(QuantityValue acres) { double value = (double) acres; - return new Area(value, AreaUnit.Acre); + return new Area(value, AreaUnit.Acre); } /// - /// Get Area from Hectares. + /// Get from Hectares. /// /// If value is NaN or Infinity. - public static Area FromHectares(QuantityValue hectares) + public static Area FromHectares(QuantityValue hectares) { double value = (double) hectares; - return new Area(value, AreaUnit.Hectare); + return new Area(value, AreaUnit.Hectare); } /// - /// Get Area from SquareCentimeters. + /// Get from SquareCentimeters. /// /// If value is NaN or Infinity. - public static Area FromSquareCentimeters(QuantityValue squarecentimeters) + public static Area FromSquareCentimeters(QuantityValue squarecentimeters) { double value = (double) squarecentimeters; - return new Area(value, AreaUnit.SquareCentimeter); + return new Area(value, AreaUnit.SquareCentimeter); } /// - /// Get Area from SquareDecimeters. + /// Get from SquareDecimeters. /// /// If value is NaN or Infinity. - public static Area FromSquareDecimeters(QuantityValue squaredecimeters) + public static Area FromSquareDecimeters(QuantityValue squaredecimeters) { double value = (double) squaredecimeters; - return new Area(value, AreaUnit.SquareDecimeter); + return new Area(value, AreaUnit.SquareDecimeter); } /// - /// Get Area from SquareFeet. + /// Get from SquareFeet. /// /// If value is NaN or Infinity. - public static Area FromSquareFeet(QuantityValue squarefeet) + public static Area FromSquareFeet(QuantityValue squarefeet) { double value = (double) squarefeet; - return new Area(value, AreaUnit.SquareFoot); + return new Area(value, AreaUnit.SquareFoot); } /// - /// Get Area from SquareInches. + /// Get from SquareInches. /// /// If value is NaN or Infinity. - public static Area FromSquareInches(QuantityValue squareinches) + public static Area FromSquareInches(QuantityValue squareinches) { double value = (double) squareinches; - return new Area(value, AreaUnit.SquareInch); + return new Area(value, AreaUnit.SquareInch); } /// - /// Get Area from SquareKilometers. + /// Get from SquareKilometers. /// /// If value is NaN or Infinity. - public static Area FromSquareKilometers(QuantityValue squarekilometers) + public static Area FromSquareKilometers(QuantityValue squarekilometers) { double value = (double) squarekilometers; - return new Area(value, AreaUnit.SquareKilometer); + return new Area(value, AreaUnit.SquareKilometer); } /// - /// Get Area from SquareMeters. + /// Get from SquareMeters. /// /// If value is NaN or Infinity. - public static Area FromSquareMeters(QuantityValue squaremeters) + public static Area FromSquareMeters(QuantityValue squaremeters) { double value = (double) squaremeters; - return new Area(value, AreaUnit.SquareMeter); + return new Area(value, AreaUnit.SquareMeter); } /// - /// Get Area from SquareMicrometers. + /// Get from SquareMicrometers. /// /// If value is NaN or Infinity. - public static Area FromSquareMicrometers(QuantityValue squaremicrometers) + public static Area FromSquareMicrometers(QuantityValue squaremicrometers) { double value = (double) squaremicrometers; - return new Area(value, AreaUnit.SquareMicrometer); + return new Area(value, AreaUnit.SquareMicrometer); } /// - /// Get Area from SquareMiles. + /// Get from SquareMiles. /// /// If value is NaN or Infinity. - public static Area FromSquareMiles(QuantityValue squaremiles) + public static Area FromSquareMiles(QuantityValue squaremiles) { double value = (double) squaremiles; - return new Area(value, AreaUnit.SquareMile); + return new Area(value, AreaUnit.SquareMile); } /// - /// Get Area from SquareMillimeters. + /// Get from SquareMillimeters. /// /// If value is NaN or Infinity. - public static Area FromSquareMillimeters(QuantityValue squaremillimeters) + public static Area FromSquareMillimeters(QuantityValue squaremillimeters) { double value = (double) squaremillimeters; - return new Area(value, AreaUnit.SquareMillimeter); + return new Area(value, AreaUnit.SquareMillimeter); } /// - /// Get Area from SquareNauticalMiles. + /// Get from SquareNauticalMiles. /// /// If value is NaN or Infinity. - public static Area FromSquareNauticalMiles(QuantityValue squarenauticalmiles) + public static Area FromSquareNauticalMiles(QuantityValue squarenauticalmiles) { double value = (double) squarenauticalmiles; - return new Area(value, AreaUnit.SquareNauticalMile); + return new Area(value, AreaUnit.SquareNauticalMile); } /// - /// Get Area from SquareYards. + /// Get from SquareYards. /// /// If value is NaN or Infinity. - public static Area FromSquareYards(QuantityValue squareyards) + public static Area FromSquareYards(QuantityValue squareyards) { double value = (double) squareyards; - return new Area(value, AreaUnit.SquareYard); + return new Area(value, AreaUnit.SquareYard); } /// - /// Get Area from UsSurveySquareFeet. + /// Get from UsSurveySquareFeet. /// /// If value is NaN or Infinity. - public static Area FromUsSurveySquareFeet(QuantityValue ussurveysquarefeet) + public static Area FromUsSurveySquareFeet(QuantityValue ussurveysquarefeet) { double value = (double) ussurveysquarefeet; - return new Area(value, AreaUnit.UsSurveySquareFoot); + return new Area(value, AreaUnit.UsSurveySquareFoot); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Area unit value. - public static Area From(QuantityValue value, AreaUnit fromUnit) + /// unit value. + public static Area From(QuantityValue value, AreaUnit fromUnit) { - return new Area((double)value, fromUnit); + return new Area((double)value, fromUnit); } #endregion @@ -439,7 +439,7 @@ public static Area From(QuantityValue value, AreaUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Area Parse(string str) + public static Area Parse(string str) { return Parse(str, null); } @@ -467,9 +467,9 @@ public static Area Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Area Parse(string str, [CanBeNull] IFormatProvider provider) + public static Area Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, AreaUnit>( str, provider, From); @@ -483,7 +483,7 @@ public static Area Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Area result) + public static bool TryParse([CanBeNull] string str, out Area result) { return TryParse(str, null, out result); } @@ -498,9 +498,9 @@ public static bool TryParse([CanBeNull] string str, out Area result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Area result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Area result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, AreaUnit>( str, provider, From, @@ -562,43 +562,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaUn #region Arithmetic Operators /// Negate the value. - public static Area operator -(Area right) + public static Area operator -(Area right) { - return new Area(-right.Value, right.Unit); + return new Area(-right.Value, right.Unit); } - /// Get from adding two . - public static Area operator +(Area left, Area right) + /// Get from adding two . + public static Area operator +(Area left, Area right) { - return new Area(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Area(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Area operator -(Area left, Area right) + /// Get from subtracting two . + public static Area operator -(Area left, Area right) { - return new Area(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Area(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Area operator *(double left, Area right) + /// Get from multiplying value and . + public static Area operator *(double left, Area right) { - return new Area(left * right.Value, right.Unit); + return new Area(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Area operator *(Area left, double right) + /// Get from multiplying value and . + public static Area operator *(Area left, double right) { - return new Area(left.Value * right, left.Unit); + return new Area(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Area operator /(Area left, double right) + /// Get from dividing by value. + public static Area operator /(Area left, double right) { - return new Area(left.Value / right, left.Unit); + return new Area(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Area left, Area right) + /// Get ratio value from dividing by . + public static double operator /(Area left, Area right) { return left.SquareMeters / right.SquareMeters; } @@ -608,39 +608,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaUn #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Area left, Area right) + public static bool operator <=(Area left, Area right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Area left, Area right) + public static bool operator >=(Area left, Area right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Area left, Area right) + public static bool operator <(Area left, Area right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Area left, Area right) + public static bool operator >(Area left, Area right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Area left, Area right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Area left, Area right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Area left, Area right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Area left, Area right) { return !(left == right); } @@ -649,37 +649,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaUn public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Area objArea)) throw new ArgumentException("Expected type Area.", nameof(obj)); + if(!(obj is Area objArea)) throw new ArgumentException("Expected type Area.", nameof(obj)); return CompareTo(objArea); } /// - public int CompareTo(Area other) + public int CompareTo(Area other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Area objArea)) + if(obj is null || !(obj is Area objArea)) return false; return Equals(objArea); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Area other) + /// Consider using for safely comparing floating point values. + public bool Equals(Area other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Area within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -717,7 +717,7 @@ public bool Equals(Area other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Area other, double tolerance, ComparisonType comparisonType) + public bool Equals(Area other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -731,7 +731,7 @@ public bool Equals(Area other, double tolerance, ComparisonType comparisonType) /// /// Returns the hash code for this instance. /// - /// A hash code for the current Area. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -779,13 +779,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Area to another Area with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Area with the specified unit. - public Area ToUnit(AreaUnit unit) + /// A with the specified unit. + public Area ToUnit(AreaUnit unit) { var convertedValue = GetValueAs(unit); - return new Area(convertedValue, unit); + return new Area(convertedValue, unit); } /// @@ -798,7 +798,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Area ToUnit(UnitSystem unitSystem) + public Area ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -854,10 +854,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Area ToBaseUnit() + internal Area ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Area(baseUnitValue, BaseUnit); + return new Area(baseUnitValue, BaseUnit); } private double GetValueAs(AreaUnit unit) @@ -979,7 +979,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Area)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Area)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -989,12 +989,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Area)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Area)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Area)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Area)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1039,16 +1039,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Area)) + if(conversionType == typeof(Area)) return this; else if(conversionType == typeof(AreaUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Area.QuantityType; + return Area.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Area.BaseDimensions; + return Area.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Area)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Area)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs index b4e3655c0d..9632f883bc 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// The area density of a two-dimensional object is calculated as the mass per unit area. /// - public partial struct AreaDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct AreaDensity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -100,19 +100,19 @@ public AreaDensity(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of AreaDensity, which is KilogramPerSquareMeter. All conversions go via this value. + /// The base unit of , which is KilogramPerSquareMeter. All conversions go via this value. /// public static AreaDensityUnit BaseUnit { get; } = AreaDensityUnit.KilogramPerSquareMeter; /// - /// Represents the largest possible value of AreaDensity + /// Represents the largest possible value of /// - public static AreaDensity MaxValue { get; } = new AreaDensity(double.MaxValue, BaseUnit); + public static AreaDensity MaxValue { get; } = new AreaDensity(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of AreaDensity + /// Represents the smallest possible value of /// - public static AreaDensity MinValue { get; } = new AreaDensity(double.MinValue, BaseUnit); + public static AreaDensity MinValue { get; } = new AreaDensity(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -120,14 +120,14 @@ public AreaDensity(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.AreaDensity; /// - /// All units of measurement for the AreaDensity quantity. + /// All units of measurement for the quantity. /// public static AreaDensityUnit[] Units { get; } = Enum.GetValues(typeof(AreaDensityUnit)).Cast().Except(new AreaDensityUnit[]{ AreaDensityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerSquareMeter. /// - public static AreaDensity Zero { get; } = new AreaDensity(0, BaseUnit); + public static AreaDensity Zero { get; } = new AreaDensity(0, BaseUnit); #endregion @@ -152,19 +152,19 @@ public AreaDensity(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => AreaDensity.QuantityType; + public QuantityType Type => AreaDensity.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => AreaDensity.BaseDimensions; + public BaseDimensions Dimensions => AreaDensity.BaseDimensions; #endregion #region Conversion Properties /// - /// Get AreaDensity in KilogramsPerSquareMeter. + /// Get in KilogramsPerSquareMeter. /// public double KilogramsPerSquareMeter => As(AreaDensityUnit.KilogramPerSquareMeter); @@ -198,24 +198,24 @@ public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] IFormatPr #region Static Factory Methods /// - /// Get AreaDensity from KilogramsPerSquareMeter. + /// Get from KilogramsPerSquareMeter. /// /// If value is NaN or Infinity. - public static AreaDensity FromKilogramsPerSquareMeter(QuantityValue kilogramspersquaremeter) + public static AreaDensity FromKilogramsPerSquareMeter(QuantityValue kilogramspersquaremeter) { double value = (double) kilogramspersquaremeter; - return new AreaDensity(value, AreaDensityUnit.KilogramPerSquareMeter); + return new AreaDensity(value, AreaDensityUnit.KilogramPerSquareMeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// AreaDensity unit value. - public static AreaDensity From(QuantityValue value, AreaDensityUnit fromUnit) + /// unit value. + public static AreaDensity From(QuantityValue value, AreaDensityUnit fromUnit) { - return new AreaDensity((double)value, fromUnit); + return new AreaDensity((double)value, fromUnit); } #endregion @@ -244,7 +244,7 @@ public static AreaDensity From(QuantityValue value, AreaDensityUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static AreaDensity Parse(string str) + public static AreaDensity Parse(string str) { return Parse(str, null); } @@ -272,9 +272,9 @@ public static AreaDensity Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static AreaDensity Parse(string str, [CanBeNull] IFormatProvider provider) + public static AreaDensity Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, AreaDensityUnit>( str, provider, From); @@ -288,7 +288,7 @@ public static AreaDensity Parse(string str, [CanBeNull] IFormatProvider provider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out AreaDensity result) + public static bool TryParse([CanBeNull] string str, out AreaDensity result) { return TryParse(str, null, out result); } @@ -303,9 +303,9 @@ public static bool TryParse([CanBeNull] string str, out AreaDensity result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaDensity result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaDensity result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, AreaDensityUnit>( str, provider, From, @@ -367,43 +367,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaDe #region Arithmetic Operators /// Negate the value. - public static AreaDensity operator -(AreaDensity right) + public static AreaDensity operator -(AreaDensity right) { - return new AreaDensity(-right.Value, right.Unit); + return new AreaDensity(-right.Value, right.Unit); } - /// Get from adding two . - public static AreaDensity operator +(AreaDensity left, AreaDensity right) + /// Get from adding two . + public static AreaDensity operator +(AreaDensity left, AreaDensity right) { - return new AreaDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new AreaDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static AreaDensity operator -(AreaDensity left, AreaDensity right) + /// Get from subtracting two . + public static AreaDensity operator -(AreaDensity left, AreaDensity right) { - return new AreaDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new AreaDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static AreaDensity operator *(double left, AreaDensity right) + /// Get from multiplying value and . + public static AreaDensity operator *(double left, AreaDensity right) { - return new AreaDensity(left * right.Value, right.Unit); + return new AreaDensity(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static AreaDensity operator *(AreaDensity left, double right) + /// Get from multiplying value and . + public static AreaDensity operator *(AreaDensity left, double right) { - return new AreaDensity(left.Value * right, left.Unit); + return new AreaDensity(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static AreaDensity operator /(AreaDensity left, double right) + /// Get from dividing by value. + public static AreaDensity operator /(AreaDensity left, double right) { - return new AreaDensity(left.Value / right, left.Unit); + return new AreaDensity(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(AreaDensity left, AreaDensity right) + /// Get ratio value from dividing by . + public static double operator /(AreaDensity left, AreaDensity right) { return left.KilogramsPerSquareMeter / right.KilogramsPerSquareMeter; } @@ -413,39 +413,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaDe #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(AreaDensity left, AreaDensity right) + public static bool operator <=(AreaDensity left, AreaDensity right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(AreaDensity left, AreaDensity right) + public static bool operator >=(AreaDensity left, AreaDensity right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(AreaDensity left, AreaDensity right) + public static bool operator <(AreaDensity left, AreaDensity right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(AreaDensity left, AreaDensity right) + public static bool operator >(AreaDensity left, AreaDensity right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(AreaDensity left, AreaDensity right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(AreaDensity left, AreaDensity right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(AreaDensity left, AreaDensity right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(AreaDensity left, AreaDensity right) { return !(left == right); } @@ -454,37 +454,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaDe public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AreaDensity objAreaDensity)) throw new ArgumentException("Expected type AreaDensity.", nameof(obj)); + if(!(obj is AreaDensity objAreaDensity)) throw new ArgumentException("Expected type AreaDensity.", nameof(obj)); return CompareTo(objAreaDensity); } /// - public int CompareTo(AreaDensity other) + public int CompareTo(AreaDensity other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is AreaDensity objAreaDensity)) + if(obj is null || !(obj is AreaDensity objAreaDensity)) return false; return Equals(objAreaDensity); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(AreaDensity other) + /// Consider using for safely comparing floating point values. + public bool Equals(AreaDensity other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another AreaDensity within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -522,7 +522,7 @@ public bool Equals(AreaDensity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(AreaDensity other, double tolerance, ComparisonType comparisonType) + public bool Equals(AreaDensity other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -536,7 +536,7 @@ public bool Equals(AreaDensity other, double tolerance, ComparisonType compariso /// /// Returns the hash code for this instance. /// - /// A hash code for the current AreaDensity. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -584,13 +584,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this AreaDensity to another AreaDensity with the unit representation . + /// Converts this to another with the unit representation . /// - /// A AreaDensity with the specified unit. - public AreaDensity ToUnit(AreaDensityUnit unit) + /// A with the specified unit. + public AreaDensity ToUnit(AreaDensityUnit unit) { var convertedValue = GetValueAs(unit); - return new AreaDensity(convertedValue, unit); + return new AreaDensity(convertedValue, unit); } /// @@ -603,7 +603,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public AreaDensity ToUnit(UnitSystem unitSystem) + public AreaDensity ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -646,10 +646,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal AreaDensity ToBaseUnit() + internal AreaDensity ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new AreaDensity(baseUnitValue, BaseUnit); + return new AreaDensity(baseUnitValue, BaseUnit); } private double GetValueAs(AreaDensityUnit unit) @@ -758,7 +758,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(AreaDensity)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(AreaDensity)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -768,12 +768,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(AreaDensity)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(AreaDensity)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(AreaDensity)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(AreaDensity)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -818,16 +818,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(AreaDensity)) + if(conversionType == typeof(AreaDensity)) return this; else if(conversionType == typeof(AreaDensityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return AreaDensity.QuantityType; + return AreaDensity.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return AreaDensity.BaseDimensions; + return AreaDensity.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(AreaDensity)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(AreaDensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs index 1d4d806463..71ad804b79 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// A geometric property of an area that reflects how its points are distributed with regard to an axis. /// - public partial struct AreaMomentOfInertia : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct AreaMomentOfInertia : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -105,19 +105,19 @@ public AreaMomentOfInertia(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of AreaMomentOfInertia, which is MeterToTheFourth. All conversions go via this value. + /// The base unit of , which is MeterToTheFourth. All conversions go via this value. /// public static AreaMomentOfInertiaUnit BaseUnit { get; } = AreaMomentOfInertiaUnit.MeterToTheFourth; /// - /// Represents the largest possible value of AreaMomentOfInertia + /// Represents the largest possible value of /// - public static AreaMomentOfInertia MaxValue { get; } = new AreaMomentOfInertia(double.MaxValue, BaseUnit); + public static AreaMomentOfInertia MaxValue { get; } = new AreaMomentOfInertia(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of AreaMomentOfInertia + /// Represents the smallest possible value of /// - public static AreaMomentOfInertia MinValue { get; } = new AreaMomentOfInertia(double.MinValue, BaseUnit); + public static AreaMomentOfInertia MinValue { get; } = new AreaMomentOfInertia(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -125,14 +125,14 @@ public AreaMomentOfInertia(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.AreaMomentOfInertia; /// - /// All units of measurement for the AreaMomentOfInertia quantity. + /// All units of measurement for the quantity. /// public static AreaMomentOfInertiaUnit[] Units { get; } = Enum.GetValues(typeof(AreaMomentOfInertiaUnit)).Cast().Except(new AreaMomentOfInertiaUnit[]{ AreaMomentOfInertiaUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit MeterToTheFourth. /// - public static AreaMomentOfInertia Zero { get; } = new AreaMomentOfInertia(0, BaseUnit); + public static AreaMomentOfInertia Zero { get; } = new AreaMomentOfInertia(0, BaseUnit); #endregion @@ -157,44 +157,44 @@ public AreaMomentOfInertia(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => AreaMomentOfInertia.QuantityType; + public QuantityType Type => AreaMomentOfInertia.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => AreaMomentOfInertia.BaseDimensions; + public BaseDimensions Dimensions => AreaMomentOfInertia.BaseDimensions; #endregion #region Conversion Properties /// - /// Get AreaMomentOfInertia in CentimetersToTheFourth. + /// Get in CentimetersToTheFourth. /// public double CentimetersToTheFourth => As(AreaMomentOfInertiaUnit.CentimeterToTheFourth); /// - /// Get AreaMomentOfInertia in DecimetersToTheFourth. + /// Get in DecimetersToTheFourth. /// public double DecimetersToTheFourth => As(AreaMomentOfInertiaUnit.DecimeterToTheFourth); /// - /// Get AreaMomentOfInertia in FeetToTheFourth. + /// Get in FeetToTheFourth. /// public double FeetToTheFourth => As(AreaMomentOfInertiaUnit.FootToTheFourth); /// - /// Get AreaMomentOfInertia in InchesToTheFourth. + /// Get in InchesToTheFourth. /// public double InchesToTheFourth => As(AreaMomentOfInertiaUnit.InchToTheFourth); /// - /// Get AreaMomentOfInertia in MetersToTheFourth. + /// Get in MetersToTheFourth. /// public double MetersToTheFourth => As(AreaMomentOfInertiaUnit.MeterToTheFourth); /// - /// Get AreaMomentOfInertia in MillimetersToTheFourth. + /// Get in MillimetersToTheFourth. /// public double MillimetersToTheFourth => As(AreaMomentOfInertiaUnit.MillimeterToTheFourth); @@ -228,69 +228,69 @@ public static string GetAbbreviation(AreaMomentOfInertiaUnit unit, [CanBeNull] I #region Static Factory Methods /// - /// Get AreaMomentOfInertia from CentimetersToTheFourth. + /// Get from CentimetersToTheFourth. /// /// If value is NaN or Infinity. - public static AreaMomentOfInertia FromCentimetersToTheFourth(QuantityValue centimeterstothefourth) + public static AreaMomentOfInertia FromCentimetersToTheFourth(QuantityValue centimeterstothefourth) { double value = (double) centimeterstothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.CentimeterToTheFourth); + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.CentimeterToTheFourth); } /// - /// Get AreaMomentOfInertia from DecimetersToTheFourth. + /// Get from DecimetersToTheFourth. /// /// If value is NaN or Infinity. - public static AreaMomentOfInertia FromDecimetersToTheFourth(QuantityValue decimeterstothefourth) + public static AreaMomentOfInertia FromDecimetersToTheFourth(QuantityValue decimeterstothefourth) { double value = (double) decimeterstothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.DecimeterToTheFourth); + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.DecimeterToTheFourth); } /// - /// Get AreaMomentOfInertia from FeetToTheFourth. + /// Get from FeetToTheFourth. /// /// If value is NaN or Infinity. - public static AreaMomentOfInertia FromFeetToTheFourth(QuantityValue feettothefourth) + public static AreaMomentOfInertia FromFeetToTheFourth(QuantityValue feettothefourth) { double value = (double) feettothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.FootToTheFourth); + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.FootToTheFourth); } /// - /// Get AreaMomentOfInertia from InchesToTheFourth. + /// Get from InchesToTheFourth. /// /// If value is NaN or Infinity. - public static AreaMomentOfInertia FromInchesToTheFourth(QuantityValue inchestothefourth) + public static AreaMomentOfInertia FromInchesToTheFourth(QuantityValue inchestothefourth) { double value = (double) inchestothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.InchToTheFourth); + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.InchToTheFourth); } /// - /// Get AreaMomentOfInertia from MetersToTheFourth. + /// Get from MetersToTheFourth. /// /// If value is NaN or Infinity. - public static AreaMomentOfInertia FromMetersToTheFourth(QuantityValue meterstothefourth) + public static AreaMomentOfInertia FromMetersToTheFourth(QuantityValue meterstothefourth) { double value = (double) meterstothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.MeterToTheFourth); + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.MeterToTheFourth); } /// - /// Get AreaMomentOfInertia from MillimetersToTheFourth. + /// Get from MillimetersToTheFourth. /// /// If value is NaN or Infinity. - public static AreaMomentOfInertia FromMillimetersToTheFourth(QuantityValue millimeterstothefourth) + public static AreaMomentOfInertia FromMillimetersToTheFourth(QuantityValue millimeterstothefourth) { double value = (double) millimeterstothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.MillimeterToTheFourth); + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.MillimeterToTheFourth); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// AreaMomentOfInertia unit value. - public static AreaMomentOfInertia From(QuantityValue value, AreaMomentOfInertiaUnit fromUnit) + /// unit value. + public static AreaMomentOfInertia From(QuantityValue value, AreaMomentOfInertiaUnit fromUnit) { - return new AreaMomentOfInertia((double)value, fromUnit); + return new AreaMomentOfInertia((double)value, fromUnit); } #endregion @@ -319,7 +319,7 @@ public static AreaMomentOfInertia From(QuantityValue value, AreaMomentOfInertiaU /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static AreaMomentOfInertia Parse(string str) + public static AreaMomentOfInertia Parse(string str) { return Parse(str, null); } @@ -347,9 +347,9 @@ public static AreaMomentOfInertia Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static AreaMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider provider) + public static AreaMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, AreaMomentOfInertiaUnit>( str, provider, From); @@ -363,7 +363,7 @@ public static AreaMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out AreaMomentOfInertia result) + public static bool TryParse([CanBeNull] string str, out AreaMomentOfInertia result) { return TryParse(str, null, out result); } @@ -378,9 +378,9 @@ public static bool TryParse([CanBeNull] string str, out AreaMomentOfInertia resu /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaMomentOfInertia result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaMomentOfInertia result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, AreaMomentOfInertiaUnit>( str, provider, From, @@ -442,43 +442,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaMo #region Arithmetic Operators /// Negate the value. - public static AreaMomentOfInertia operator -(AreaMomentOfInertia right) + public static AreaMomentOfInertia operator -(AreaMomentOfInertia right) { - return new AreaMomentOfInertia(-right.Value, right.Unit); + return new AreaMomentOfInertia(-right.Value, right.Unit); } - /// Get from adding two . - public static AreaMomentOfInertia operator +(AreaMomentOfInertia left, AreaMomentOfInertia right) + /// Get from adding two . + public static AreaMomentOfInertia operator +(AreaMomentOfInertia left, AreaMomentOfInertia right) { - return new AreaMomentOfInertia(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new AreaMomentOfInertia(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static AreaMomentOfInertia operator -(AreaMomentOfInertia left, AreaMomentOfInertia right) + /// Get from subtracting two . + public static AreaMomentOfInertia operator -(AreaMomentOfInertia left, AreaMomentOfInertia right) { - return new AreaMomentOfInertia(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new AreaMomentOfInertia(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static AreaMomentOfInertia operator *(double left, AreaMomentOfInertia right) + /// Get from multiplying value and . + public static AreaMomentOfInertia operator *(double left, AreaMomentOfInertia right) { - return new AreaMomentOfInertia(left * right.Value, right.Unit); + return new AreaMomentOfInertia(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static AreaMomentOfInertia operator *(AreaMomentOfInertia left, double right) + /// Get from multiplying value and . + public static AreaMomentOfInertia operator *(AreaMomentOfInertia left, double right) { - return new AreaMomentOfInertia(left.Value * right, left.Unit); + return new AreaMomentOfInertia(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static AreaMomentOfInertia operator /(AreaMomentOfInertia left, double right) + /// Get from dividing by value. + public static AreaMomentOfInertia operator /(AreaMomentOfInertia left, double right) { - return new AreaMomentOfInertia(left.Value / right, left.Unit); + return new AreaMomentOfInertia(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(AreaMomentOfInertia left, AreaMomentOfInertia right) + /// Get ratio value from dividing by . + public static double operator /(AreaMomentOfInertia left, AreaMomentOfInertia right) { return left.MetersToTheFourth / right.MetersToTheFourth; } @@ -488,39 +488,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaMo #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(AreaMomentOfInertia left, AreaMomentOfInertia right) + public static bool operator <=(AreaMomentOfInertia left, AreaMomentOfInertia right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(AreaMomentOfInertia left, AreaMomentOfInertia right) + public static bool operator >=(AreaMomentOfInertia left, AreaMomentOfInertia right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(AreaMomentOfInertia left, AreaMomentOfInertia right) + public static bool operator <(AreaMomentOfInertia left, AreaMomentOfInertia right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(AreaMomentOfInertia left, AreaMomentOfInertia right) + public static bool operator >(AreaMomentOfInertia left, AreaMomentOfInertia right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(AreaMomentOfInertia left, AreaMomentOfInertia right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(AreaMomentOfInertia left, AreaMomentOfInertia right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(AreaMomentOfInertia left, AreaMomentOfInertia right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(AreaMomentOfInertia left, AreaMomentOfInertia right) { return !(left == right); } @@ -529,37 +529,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaMo public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AreaMomentOfInertia objAreaMomentOfInertia)) throw new ArgumentException("Expected type AreaMomentOfInertia.", nameof(obj)); + if(!(obj is AreaMomentOfInertia objAreaMomentOfInertia)) throw new ArgumentException("Expected type AreaMomentOfInertia.", nameof(obj)); return CompareTo(objAreaMomentOfInertia); } /// - public int CompareTo(AreaMomentOfInertia other) + public int CompareTo(AreaMomentOfInertia other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is AreaMomentOfInertia objAreaMomentOfInertia)) + if(obj is null || !(obj is AreaMomentOfInertia objAreaMomentOfInertia)) return false; return Equals(objAreaMomentOfInertia); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(AreaMomentOfInertia other) + /// Consider using for safely comparing floating point values. + public bool Equals(AreaMomentOfInertia other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another AreaMomentOfInertia within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -597,7 +597,7 @@ public bool Equals(AreaMomentOfInertia other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(AreaMomentOfInertia other, double tolerance, ComparisonType comparisonType) + public bool Equals(AreaMomentOfInertia other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -611,7 +611,7 @@ public bool Equals(AreaMomentOfInertia other, double tolerance, ComparisonType c /// /// Returns the hash code for this instance. /// - /// A hash code for the current AreaMomentOfInertia. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -659,13 +659,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this AreaMomentOfInertia to another AreaMomentOfInertia with the unit representation . + /// Converts this to another with the unit representation . /// - /// A AreaMomentOfInertia with the specified unit. - public AreaMomentOfInertia ToUnit(AreaMomentOfInertiaUnit unit) + /// A with the specified unit. + public AreaMomentOfInertia ToUnit(AreaMomentOfInertiaUnit unit) { var convertedValue = GetValueAs(unit); - return new AreaMomentOfInertia(convertedValue, unit); + return new AreaMomentOfInertia(convertedValue, unit); } /// @@ -678,7 +678,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public AreaMomentOfInertia ToUnit(UnitSystem unitSystem) + public AreaMomentOfInertia ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -726,10 +726,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal AreaMomentOfInertia ToBaseUnit() + internal AreaMomentOfInertia ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new AreaMomentOfInertia(baseUnitValue, BaseUnit); + return new AreaMomentOfInertia(baseUnitValue, BaseUnit); } private double GetValueAs(AreaMomentOfInertiaUnit unit) @@ -843,7 +843,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -853,12 +853,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -903,16 +903,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(AreaMomentOfInertia)) + if(conversionType == typeof(AreaMomentOfInertia)) return this; else if(conversionType == typeof(AreaMomentOfInertiaUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return AreaMomentOfInertia.QuantityType; + return AreaMomentOfInertia.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return AreaMomentOfInertia.BaseDimensions; + return AreaMomentOfInertia.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs index c3539d1999..cc6016680d 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Bit_rate /// - public partial struct BitRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct BitRate : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -128,19 +128,19 @@ public BitRate(decimal value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of BitRate, which is BitPerSecond. All conversions go via this value. + /// The base unit of , which is BitPerSecond. All conversions go via this value. /// public static BitRateUnit BaseUnit { get; } = BitRateUnit.BitPerSecond; /// - /// Represents the largest possible value of BitRate + /// Represents the largest possible value of /// - public static BitRate MaxValue { get; } = new BitRate(decimal.MaxValue, BaseUnit); + public static BitRate MaxValue { get; } = new BitRate(decimal.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of BitRate + /// Represents the smallest possible value of /// - public static BitRate MinValue { get; } = new BitRate(decimal.MinValue, BaseUnit); + public static BitRate MinValue { get; } = new BitRate(decimal.MinValue, BaseUnit); /// /// The of this quantity. @@ -148,14 +148,14 @@ public BitRate(decimal value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.BitRate; /// - /// All units of measurement for the BitRate quantity. + /// All units of measurement for the quantity. /// public static BitRateUnit[] Units { get; } = Enum.GetValues(typeof(BitRateUnit)).Cast().Except(new BitRateUnit[]{ BitRateUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit BitPerSecond. /// - public static BitRate Zero { get; } = new BitRate(0, BaseUnit); + public static BitRate Zero { get; } = new BitRate(0, BaseUnit); #endregion @@ -182,144 +182,144 @@ public BitRate(decimal value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => BitRate.QuantityType; + public QuantityType Type => BitRate.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => BitRate.BaseDimensions; + public BaseDimensions Dimensions => BitRate.BaseDimensions; #endregion #region Conversion Properties /// - /// Get BitRate in BitsPerSecond. + /// Get in BitsPerSecond. /// public double BitsPerSecond => As(BitRateUnit.BitPerSecond); /// - /// Get BitRate in BytesPerSecond. + /// Get in BytesPerSecond. /// public double BytesPerSecond => As(BitRateUnit.BytePerSecond); /// - /// Get BitRate in ExabitsPerSecond. + /// Get in ExabitsPerSecond. /// public double ExabitsPerSecond => As(BitRateUnit.ExabitPerSecond); /// - /// Get BitRate in ExabytesPerSecond. + /// Get in ExabytesPerSecond. /// public double ExabytesPerSecond => As(BitRateUnit.ExabytePerSecond); /// - /// Get BitRate in ExbibitsPerSecond. + /// Get in ExbibitsPerSecond. /// public double ExbibitsPerSecond => As(BitRateUnit.ExbibitPerSecond); /// - /// Get BitRate in ExbibytesPerSecond. + /// Get in ExbibytesPerSecond. /// public double ExbibytesPerSecond => As(BitRateUnit.ExbibytePerSecond); /// - /// Get BitRate in GibibitsPerSecond. + /// Get in GibibitsPerSecond. /// public double GibibitsPerSecond => As(BitRateUnit.GibibitPerSecond); /// - /// Get BitRate in GibibytesPerSecond. + /// Get in GibibytesPerSecond. /// public double GibibytesPerSecond => As(BitRateUnit.GibibytePerSecond); /// - /// Get BitRate in GigabitsPerSecond. + /// Get in GigabitsPerSecond. /// public double GigabitsPerSecond => As(BitRateUnit.GigabitPerSecond); /// - /// Get BitRate in GigabytesPerSecond. + /// Get in GigabytesPerSecond. /// public double GigabytesPerSecond => As(BitRateUnit.GigabytePerSecond); /// - /// Get BitRate in KibibitsPerSecond. + /// Get in KibibitsPerSecond. /// public double KibibitsPerSecond => As(BitRateUnit.KibibitPerSecond); /// - /// Get BitRate in KibibytesPerSecond. + /// Get in KibibytesPerSecond. /// public double KibibytesPerSecond => As(BitRateUnit.KibibytePerSecond); /// - /// Get BitRate in KilobitsPerSecond. + /// Get in KilobitsPerSecond. /// public double KilobitsPerSecond => As(BitRateUnit.KilobitPerSecond); /// - /// Get BitRate in KilobytesPerSecond. + /// Get in KilobytesPerSecond. /// public double KilobytesPerSecond => As(BitRateUnit.KilobytePerSecond); /// - /// Get BitRate in MebibitsPerSecond. + /// Get in MebibitsPerSecond. /// public double MebibitsPerSecond => As(BitRateUnit.MebibitPerSecond); /// - /// Get BitRate in MebibytesPerSecond. + /// Get in MebibytesPerSecond. /// public double MebibytesPerSecond => As(BitRateUnit.MebibytePerSecond); /// - /// Get BitRate in MegabitsPerSecond. + /// Get in MegabitsPerSecond. /// public double MegabitsPerSecond => As(BitRateUnit.MegabitPerSecond); /// - /// Get BitRate in MegabytesPerSecond. + /// Get in MegabytesPerSecond. /// public double MegabytesPerSecond => As(BitRateUnit.MegabytePerSecond); /// - /// Get BitRate in PebibitsPerSecond. + /// Get in PebibitsPerSecond. /// public double PebibitsPerSecond => As(BitRateUnit.PebibitPerSecond); /// - /// Get BitRate in PebibytesPerSecond. + /// Get in PebibytesPerSecond. /// public double PebibytesPerSecond => As(BitRateUnit.PebibytePerSecond); /// - /// Get BitRate in PetabitsPerSecond. + /// Get in PetabitsPerSecond. /// public double PetabitsPerSecond => As(BitRateUnit.PetabitPerSecond); /// - /// Get BitRate in PetabytesPerSecond. + /// Get in PetabytesPerSecond. /// public double PetabytesPerSecond => As(BitRateUnit.PetabytePerSecond); /// - /// Get BitRate in TebibitsPerSecond. + /// Get in TebibitsPerSecond. /// public double TebibitsPerSecond => As(BitRateUnit.TebibitPerSecond); /// - /// Get BitRate in TebibytesPerSecond. + /// Get in TebibytesPerSecond. /// public double TebibytesPerSecond => As(BitRateUnit.TebibytePerSecond); /// - /// Get BitRate in TerabitsPerSecond. + /// Get in TerabitsPerSecond. /// public double TerabitsPerSecond => As(BitRateUnit.TerabitPerSecond); /// - /// Get BitRate in TerabytesPerSecond. + /// Get in TerabytesPerSecond. /// public double TerabytesPerSecond => As(BitRateUnit.TerabytePerSecond); @@ -353,249 +353,249 @@ public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] IFormatProvid #region Static Factory Methods /// - /// Get BitRate from BitsPerSecond. + /// Get from BitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromBitsPerSecond(QuantityValue bitspersecond) + public static BitRate FromBitsPerSecond(QuantityValue bitspersecond) { decimal value = (decimal) bitspersecond; - return new BitRate(value, BitRateUnit.BitPerSecond); + return new BitRate(value, BitRateUnit.BitPerSecond); } /// - /// Get BitRate from BytesPerSecond. + /// Get from BytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromBytesPerSecond(QuantityValue bytespersecond) + public static BitRate FromBytesPerSecond(QuantityValue bytespersecond) { decimal value = (decimal) bytespersecond; - return new BitRate(value, BitRateUnit.BytePerSecond); + return new BitRate(value, BitRateUnit.BytePerSecond); } /// - /// Get BitRate from ExabitsPerSecond. + /// Get from ExabitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromExabitsPerSecond(QuantityValue exabitspersecond) + public static BitRate FromExabitsPerSecond(QuantityValue exabitspersecond) { decimal value = (decimal) exabitspersecond; - return new BitRate(value, BitRateUnit.ExabitPerSecond); + return new BitRate(value, BitRateUnit.ExabitPerSecond); } /// - /// Get BitRate from ExabytesPerSecond. + /// Get from ExabytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromExabytesPerSecond(QuantityValue exabytespersecond) + public static BitRate FromExabytesPerSecond(QuantityValue exabytespersecond) { decimal value = (decimal) exabytespersecond; - return new BitRate(value, BitRateUnit.ExabytePerSecond); + return new BitRate(value, BitRateUnit.ExabytePerSecond); } /// - /// Get BitRate from ExbibitsPerSecond. + /// Get from ExbibitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromExbibitsPerSecond(QuantityValue exbibitspersecond) + public static BitRate FromExbibitsPerSecond(QuantityValue exbibitspersecond) { decimal value = (decimal) exbibitspersecond; - return new BitRate(value, BitRateUnit.ExbibitPerSecond); + return new BitRate(value, BitRateUnit.ExbibitPerSecond); } /// - /// Get BitRate from ExbibytesPerSecond. + /// Get from ExbibytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromExbibytesPerSecond(QuantityValue exbibytespersecond) + public static BitRate FromExbibytesPerSecond(QuantityValue exbibytespersecond) { decimal value = (decimal) exbibytespersecond; - return new BitRate(value, BitRateUnit.ExbibytePerSecond); + return new BitRate(value, BitRateUnit.ExbibytePerSecond); } /// - /// Get BitRate from GibibitsPerSecond. + /// Get from GibibitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromGibibitsPerSecond(QuantityValue gibibitspersecond) + public static BitRate FromGibibitsPerSecond(QuantityValue gibibitspersecond) { decimal value = (decimal) gibibitspersecond; - return new BitRate(value, BitRateUnit.GibibitPerSecond); + return new BitRate(value, BitRateUnit.GibibitPerSecond); } /// - /// Get BitRate from GibibytesPerSecond. + /// Get from GibibytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromGibibytesPerSecond(QuantityValue gibibytespersecond) + public static BitRate FromGibibytesPerSecond(QuantityValue gibibytespersecond) { decimal value = (decimal) gibibytespersecond; - return new BitRate(value, BitRateUnit.GibibytePerSecond); + return new BitRate(value, BitRateUnit.GibibytePerSecond); } /// - /// Get BitRate from GigabitsPerSecond. + /// Get from GigabitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromGigabitsPerSecond(QuantityValue gigabitspersecond) + public static BitRate FromGigabitsPerSecond(QuantityValue gigabitspersecond) { decimal value = (decimal) gigabitspersecond; - return new BitRate(value, BitRateUnit.GigabitPerSecond); + return new BitRate(value, BitRateUnit.GigabitPerSecond); } /// - /// Get BitRate from GigabytesPerSecond. + /// Get from GigabytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromGigabytesPerSecond(QuantityValue gigabytespersecond) + public static BitRate FromGigabytesPerSecond(QuantityValue gigabytespersecond) { decimal value = (decimal) gigabytespersecond; - return new BitRate(value, BitRateUnit.GigabytePerSecond); + return new BitRate(value, BitRateUnit.GigabytePerSecond); } /// - /// Get BitRate from KibibitsPerSecond. + /// Get from KibibitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromKibibitsPerSecond(QuantityValue kibibitspersecond) + public static BitRate FromKibibitsPerSecond(QuantityValue kibibitspersecond) { decimal value = (decimal) kibibitspersecond; - return new BitRate(value, BitRateUnit.KibibitPerSecond); + return new BitRate(value, BitRateUnit.KibibitPerSecond); } /// - /// Get BitRate from KibibytesPerSecond. + /// Get from KibibytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromKibibytesPerSecond(QuantityValue kibibytespersecond) + public static BitRate FromKibibytesPerSecond(QuantityValue kibibytespersecond) { decimal value = (decimal) kibibytespersecond; - return new BitRate(value, BitRateUnit.KibibytePerSecond); + return new BitRate(value, BitRateUnit.KibibytePerSecond); } /// - /// Get BitRate from KilobitsPerSecond. + /// Get from KilobitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromKilobitsPerSecond(QuantityValue kilobitspersecond) + public static BitRate FromKilobitsPerSecond(QuantityValue kilobitspersecond) { decimal value = (decimal) kilobitspersecond; - return new BitRate(value, BitRateUnit.KilobitPerSecond); + return new BitRate(value, BitRateUnit.KilobitPerSecond); } /// - /// Get BitRate from KilobytesPerSecond. + /// Get from KilobytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromKilobytesPerSecond(QuantityValue kilobytespersecond) + public static BitRate FromKilobytesPerSecond(QuantityValue kilobytespersecond) { decimal value = (decimal) kilobytespersecond; - return new BitRate(value, BitRateUnit.KilobytePerSecond); + return new BitRate(value, BitRateUnit.KilobytePerSecond); } /// - /// Get BitRate from MebibitsPerSecond. + /// Get from MebibitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromMebibitsPerSecond(QuantityValue mebibitspersecond) + public static BitRate FromMebibitsPerSecond(QuantityValue mebibitspersecond) { decimal value = (decimal) mebibitspersecond; - return new BitRate(value, BitRateUnit.MebibitPerSecond); + return new BitRate(value, BitRateUnit.MebibitPerSecond); } /// - /// Get BitRate from MebibytesPerSecond. + /// Get from MebibytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromMebibytesPerSecond(QuantityValue mebibytespersecond) + public static BitRate FromMebibytesPerSecond(QuantityValue mebibytespersecond) { decimal value = (decimal) mebibytespersecond; - return new BitRate(value, BitRateUnit.MebibytePerSecond); + return new BitRate(value, BitRateUnit.MebibytePerSecond); } /// - /// Get BitRate from MegabitsPerSecond. + /// Get from MegabitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromMegabitsPerSecond(QuantityValue megabitspersecond) + public static BitRate FromMegabitsPerSecond(QuantityValue megabitspersecond) { decimal value = (decimal) megabitspersecond; - return new BitRate(value, BitRateUnit.MegabitPerSecond); + return new BitRate(value, BitRateUnit.MegabitPerSecond); } /// - /// Get BitRate from MegabytesPerSecond. + /// Get from MegabytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromMegabytesPerSecond(QuantityValue megabytespersecond) + public static BitRate FromMegabytesPerSecond(QuantityValue megabytespersecond) { decimal value = (decimal) megabytespersecond; - return new BitRate(value, BitRateUnit.MegabytePerSecond); + return new BitRate(value, BitRateUnit.MegabytePerSecond); } /// - /// Get BitRate from PebibitsPerSecond. + /// Get from PebibitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromPebibitsPerSecond(QuantityValue pebibitspersecond) + public static BitRate FromPebibitsPerSecond(QuantityValue pebibitspersecond) { decimal value = (decimal) pebibitspersecond; - return new BitRate(value, BitRateUnit.PebibitPerSecond); + return new BitRate(value, BitRateUnit.PebibitPerSecond); } /// - /// Get BitRate from PebibytesPerSecond. + /// Get from PebibytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromPebibytesPerSecond(QuantityValue pebibytespersecond) + public static BitRate FromPebibytesPerSecond(QuantityValue pebibytespersecond) { decimal value = (decimal) pebibytespersecond; - return new BitRate(value, BitRateUnit.PebibytePerSecond); + return new BitRate(value, BitRateUnit.PebibytePerSecond); } /// - /// Get BitRate from PetabitsPerSecond. + /// Get from PetabitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromPetabitsPerSecond(QuantityValue petabitspersecond) + public static BitRate FromPetabitsPerSecond(QuantityValue petabitspersecond) { decimal value = (decimal) petabitspersecond; - return new BitRate(value, BitRateUnit.PetabitPerSecond); + return new BitRate(value, BitRateUnit.PetabitPerSecond); } /// - /// Get BitRate from PetabytesPerSecond. + /// Get from PetabytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromPetabytesPerSecond(QuantityValue petabytespersecond) + public static BitRate FromPetabytesPerSecond(QuantityValue petabytespersecond) { decimal value = (decimal) petabytespersecond; - return new BitRate(value, BitRateUnit.PetabytePerSecond); + return new BitRate(value, BitRateUnit.PetabytePerSecond); } /// - /// Get BitRate from TebibitsPerSecond. + /// Get from TebibitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromTebibitsPerSecond(QuantityValue tebibitspersecond) + public static BitRate FromTebibitsPerSecond(QuantityValue tebibitspersecond) { decimal value = (decimal) tebibitspersecond; - return new BitRate(value, BitRateUnit.TebibitPerSecond); + return new BitRate(value, BitRateUnit.TebibitPerSecond); } /// - /// Get BitRate from TebibytesPerSecond. + /// Get from TebibytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromTebibytesPerSecond(QuantityValue tebibytespersecond) + public static BitRate FromTebibytesPerSecond(QuantityValue tebibytespersecond) { decimal value = (decimal) tebibytespersecond; - return new BitRate(value, BitRateUnit.TebibytePerSecond); + return new BitRate(value, BitRateUnit.TebibytePerSecond); } /// - /// Get BitRate from TerabitsPerSecond. + /// Get from TerabitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromTerabitsPerSecond(QuantityValue terabitspersecond) + public static BitRate FromTerabitsPerSecond(QuantityValue terabitspersecond) { decimal value = (decimal) terabitspersecond; - return new BitRate(value, BitRateUnit.TerabitPerSecond); + return new BitRate(value, BitRateUnit.TerabitPerSecond); } /// - /// Get BitRate from TerabytesPerSecond. + /// Get from TerabytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromTerabytesPerSecond(QuantityValue terabytespersecond) + public static BitRate FromTerabytesPerSecond(QuantityValue terabytespersecond) { decimal value = (decimal) terabytespersecond; - return new BitRate(value, BitRateUnit.TerabytePerSecond); + return new BitRate(value, BitRateUnit.TerabytePerSecond); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// BitRate unit value. - public static BitRate From(QuantityValue value, BitRateUnit fromUnit) + /// unit value. + public static BitRate From(QuantityValue value, BitRateUnit fromUnit) { - return new BitRate((decimal)value, fromUnit); + return new BitRate((decimal)value, fromUnit); } #endregion @@ -624,7 +624,7 @@ public static BitRate From(QuantityValue value, BitRateUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static BitRate Parse(string str) + public static BitRate Parse(string str) { return Parse(str, null); } @@ -652,9 +652,9 @@ public static BitRate Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static BitRate Parse(string str, [CanBeNull] IFormatProvider provider) + public static BitRate Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, BitRateUnit>( str, provider, From); @@ -668,7 +668,7 @@ public static BitRate Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out BitRate result) + public static bool TryParse([CanBeNull] string str, out BitRate result) { return TryParse(str, null, out result); } @@ -683,9 +683,9 @@ public static bool TryParse([CanBeNull] string str, out BitRate result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BitRate result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BitRate result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, BitRateUnit>( str, provider, From, @@ -747,43 +747,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BitRat #region Arithmetic Operators /// Negate the value. - public static BitRate operator -(BitRate right) + public static BitRate operator -(BitRate right) { - return new BitRate(-right.Value, right.Unit); + return new BitRate(-right.Value, right.Unit); } - /// Get from adding two . - public static BitRate operator +(BitRate left, BitRate right) + /// Get from adding two . + public static BitRate operator +(BitRate left, BitRate right) { - return new BitRate(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new BitRate(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static BitRate operator -(BitRate left, BitRate right) + /// Get from subtracting two . + public static BitRate operator -(BitRate left, BitRate right) { - return new BitRate(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new BitRate(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static BitRate operator *(decimal left, BitRate right) + /// Get from multiplying value and . + public static BitRate operator *(decimal left, BitRate right) { - return new BitRate(left * right.Value, right.Unit); + return new BitRate(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static BitRate operator *(BitRate left, decimal right) + /// Get from multiplying value and . + public static BitRate operator *(BitRate left, decimal right) { - return new BitRate(left.Value * right, left.Unit); + return new BitRate(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static BitRate operator /(BitRate left, decimal right) + /// Get from dividing by value. + public static BitRate operator /(BitRate left, decimal right) { - return new BitRate(left.Value / right, left.Unit); + return new BitRate(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(BitRate left, BitRate right) + /// Get ratio value from dividing by . + public static double operator /(BitRate left, BitRate right) { return left.BitsPerSecond / right.BitsPerSecond; } @@ -793,39 +793,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BitRat #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(BitRate left, BitRate right) + public static bool operator <=(BitRate left, BitRate right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(BitRate left, BitRate right) + public static bool operator >=(BitRate left, BitRate right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(BitRate left, BitRate right) + public static bool operator <(BitRate left, BitRate right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(BitRate left, BitRate right) + public static bool operator >(BitRate left, BitRate right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(BitRate left, BitRate right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(BitRate left, BitRate right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(BitRate left, BitRate right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(BitRate left, BitRate right) { return !(left == right); } @@ -834,37 +834,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BitRat public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is BitRate objBitRate)) throw new ArgumentException("Expected type BitRate.", nameof(obj)); + if(!(obj is BitRate objBitRate)) throw new ArgumentException("Expected type BitRate.", nameof(obj)); return CompareTo(objBitRate); } /// - public int CompareTo(BitRate other) + public int CompareTo(BitRate other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is BitRate objBitRate)) + if(obj is null || !(obj is BitRate objBitRate)) return false; return Equals(objBitRate); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(BitRate other) + /// Consider using for safely comparing floating point values. + public bool Equals(BitRate other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another BitRate within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -902,7 +902,7 @@ public bool Equals(BitRate other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(BitRate other, double tolerance, ComparisonType comparisonType) + public bool Equals(BitRate other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -916,7 +916,7 @@ public bool Equals(BitRate other, double tolerance, ComparisonType comparisonTyp /// /// Returns the hash code for this instance. /// - /// A hash code for the current BitRate. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -964,13 +964,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this BitRate to another BitRate with the unit representation . + /// Converts this to another with the unit representation . /// - /// A BitRate with the specified unit. - public BitRate ToUnit(BitRateUnit unit) + /// A with the specified unit. + public BitRate ToUnit(BitRateUnit unit) { var convertedValue = GetValueAs(unit); - return new BitRate(convertedValue, unit); + return new BitRate(convertedValue, unit); } /// @@ -983,7 +983,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public BitRate ToUnit(UnitSystem unitSystem) + public BitRate ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1051,10 +1051,10 @@ private decimal GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal BitRate ToBaseUnit() + internal BitRate ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new BitRate(baseUnitValue, BaseUnit); + return new BitRate(baseUnitValue, BaseUnit); } private decimal GetValueAs(BitRateUnit unit) @@ -1188,7 +1188,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(BitRate)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(BitRate)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1198,12 +1198,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(BitRate)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(BitRate)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(BitRate)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(BitRate)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1248,16 +1248,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(BitRate)) + if(conversionType == typeof(BitRate)) return this; else if(conversionType == typeof(BitRateUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return BitRate.QuantityType; + return BitRate.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return BitRate.BaseDimensions; + return BitRate.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(BitRate)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(BitRate)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs index 13c1919e53..d0e02a9c69 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Brake specific fuel consumption (BSFC) is a measure of the fuel efficiency of any prime mover that burns fuel and produces rotational, or shaft, power. It is typically used for comparing the efficiency of internal combustion engines with a shaft output. /// - public partial struct BrakeSpecificFuelConsumption : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct BrakeSpecificFuelConsumption : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -102,19 +102,19 @@ public BrakeSpecificFuelConsumption(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of BrakeSpecificFuelConsumption, which is KilogramPerJoule. All conversions go via this value. + /// The base unit of , which is KilogramPerJoule. All conversions go via this value. /// public static BrakeSpecificFuelConsumptionUnit BaseUnit { get; } = BrakeSpecificFuelConsumptionUnit.KilogramPerJoule; /// - /// Represents the largest possible value of BrakeSpecificFuelConsumption + /// Represents the largest possible value of /// - public static BrakeSpecificFuelConsumption MaxValue { get; } = new BrakeSpecificFuelConsumption(double.MaxValue, BaseUnit); + public static BrakeSpecificFuelConsumption MaxValue { get; } = new BrakeSpecificFuelConsumption(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of BrakeSpecificFuelConsumption + /// Represents the smallest possible value of /// - public static BrakeSpecificFuelConsumption MinValue { get; } = new BrakeSpecificFuelConsumption(double.MinValue, BaseUnit); + public static BrakeSpecificFuelConsumption MinValue { get; } = new BrakeSpecificFuelConsumption(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -122,14 +122,14 @@ public BrakeSpecificFuelConsumption(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.BrakeSpecificFuelConsumption; /// - /// All units of measurement for the BrakeSpecificFuelConsumption quantity. + /// All units of measurement for the quantity. /// public static BrakeSpecificFuelConsumptionUnit[] Units { get; } = Enum.GetValues(typeof(BrakeSpecificFuelConsumptionUnit)).Cast().Except(new BrakeSpecificFuelConsumptionUnit[]{ BrakeSpecificFuelConsumptionUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerJoule. /// - public static BrakeSpecificFuelConsumption Zero { get; } = new BrakeSpecificFuelConsumption(0, BaseUnit); + public static BrakeSpecificFuelConsumption Zero { get; } = new BrakeSpecificFuelConsumption(0, BaseUnit); #endregion @@ -154,29 +154,29 @@ public BrakeSpecificFuelConsumption(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => BrakeSpecificFuelConsumption.QuantityType; + public QuantityType Type => BrakeSpecificFuelConsumption.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => BrakeSpecificFuelConsumption.BaseDimensions; + public BaseDimensions Dimensions => BrakeSpecificFuelConsumption.BaseDimensions; #endregion #region Conversion Properties /// - /// Get BrakeSpecificFuelConsumption in GramsPerKiloWattHour. + /// Get in GramsPerKiloWattHour. /// public double GramsPerKiloWattHour => As(BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour); /// - /// Get BrakeSpecificFuelConsumption in KilogramsPerJoule. + /// Get in KilogramsPerJoule. /// public double KilogramsPerJoule => As(BrakeSpecificFuelConsumptionUnit.KilogramPerJoule); /// - /// Get BrakeSpecificFuelConsumption in PoundsPerMechanicalHorsepowerHour. + /// Get in PoundsPerMechanicalHorsepowerHour. /// public double PoundsPerMechanicalHorsepowerHour => As(BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour); @@ -210,42 +210,42 @@ public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit, [Can #region Static Factory Methods /// - /// Get BrakeSpecificFuelConsumption from GramsPerKiloWattHour. + /// Get from GramsPerKiloWattHour. /// /// If value is NaN or Infinity. - public static BrakeSpecificFuelConsumption FromGramsPerKiloWattHour(QuantityValue gramsperkilowatthour) + public static BrakeSpecificFuelConsumption FromGramsPerKiloWattHour(QuantityValue gramsperkilowatthour) { double value = (double) gramsperkilowatthour; - return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour); + return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour); } /// - /// Get BrakeSpecificFuelConsumption from KilogramsPerJoule. + /// Get from KilogramsPerJoule. /// /// If value is NaN or Infinity. - public static BrakeSpecificFuelConsumption FromKilogramsPerJoule(QuantityValue kilogramsperjoule) + public static BrakeSpecificFuelConsumption FromKilogramsPerJoule(QuantityValue kilogramsperjoule) { double value = (double) kilogramsperjoule; - return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule); + return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule); } /// - /// Get BrakeSpecificFuelConsumption from PoundsPerMechanicalHorsepowerHour. + /// Get from PoundsPerMechanicalHorsepowerHour. /// /// If value is NaN or Infinity. - public static BrakeSpecificFuelConsumption FromPoundsPerMechanicalHorsepowerHour(QuantityValue poundspermechanicalhorsepowerhour) + public static BrakeSpecificFuelConsumption FromPoundsPerMechanicalHorsepowerHour(QuantityValue poundspermechanicalhorsepowerhour) { double value = (double) poundspermechanicalhorsepowerhour; - return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour); + return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// BrakeSpecificFuelConsumption unit value. - public static BrakeSpecificFuelConsumption From(QuantityValue value, BrakeSpecificFuelConsumptionUnit fromUnit) + /// unit value. + public static BrakeSpecificFuelConsumption From(QuantityValue value, BrakeSpecificFuelConsumptionUnit fromUnit) { - return new BrakeSpecificFuelConsumption((double)value, fromUnit); + return new BrakeSpecificFuelConsumption((double)value, fromUnit); } #endregion @@ -274,7 +274,7 @@ public static BrakeSpecificFuelConsumption From(QuantityValue value, BrakeSpecif /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static BrakeSpecificFuelConsumption Parse(string str) + public static BrakeSpecificFuelConsumption Parse(string str) { return Parse(str, null); } @@ -302,9 +302,9 @@ public static BrakeSpecificFuelConsumption Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static BrakeSpecificFuelConsumption Parse(string str, [CanBeNull] IFormatProvider provider) + public static BrakeSpecificFuelConsumption Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, BrakeSpecificFuelConsumptionUnit>( str, provider, From); @@ -318,7 +318,7 @@ public static BrakeSpecificFuelConsumption Parse(string str, [CanBeNull] IFormat /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out BrakeSpecificFuelConsumption result) + public static bool TryParse([CanBeNull] string str, out BrakeSpecificFuelConsumption result) { return TryParse(str, null, out result); } @@ -333,9 +333,9 @@ public static bool TryParse([CanBeNull] string str, out BrakeSpecificFuelConsump /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BrakeSpecificFuelConsumption result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BrakeSpecificFuelConsumption result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, BrakeSpecificFuelConsumptionUnit>( str, provider, From, @@ -397,43 +397,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BrakeS #region Arithmetic Operators /// Negate the value. - public static BrakeSpecificFuelConsumption operator -(BrakeSpecificFuelConsumption right) + public static BrakeSpecificFuelConsumption operator -(BrakeSpecificFuelConsumption right) { - return new BrakeSpecificFuelConsumption(-right.Value, right.Unit); + return new BrakeSpecificFuelConsumption(-right.Value, right.Unit); } - /// Get from adding two . - public static BrakeSpecificFuelConsumption operator +(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + /// Get from adding two . + public static BrakeSpecificFuelConsumption operator +(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { - return new BrakeSpecificFuelConsumption(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new BrakeSpecificFuelConsumption(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static BrakeSpecificFuelConsumption operator -(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + /// Get from subtracting two . + public static BrakeSpecificFuelConsumption operator -(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { - return new BrakeSpecificFuelConsumption(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new BrakeSpecificFuelConsumption(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static BrakeSpecificFuelConsumption operator *(double left, BrakeSpecificFuelConsumption right) + /// Get from multiplying value and . + public static BrakeSpecificFuelConsumption operator *(double left, BrakeSpecificFuelConsumption right) { - return new BrakeSpecificFuelConsumption(left * right.Value, right.Unit); + return new BrakeSpecificFuelConsumption(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static BrakeSpecificFuelConsumption operator *(BrakeSpecificFuelConsumption left, double right) + /// Get from multiplying value and . + public static BrakeSpecificFuelConsumption operator *(BrakeSpecificFuelConsumption left, double right) { - return new BrakeSpecificFuelConsumption(left.Value * right, left.Unit); + return new BrakeSpecificFuelConsumption(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static BrakeSpecificFuelConsumption operator /(BrakeSpecificFuelConsumption left, double right) + /// Get from dividing by value. + public static BrakeSpecificFuelConsumption operator /(BrakeSpecificFuelConsumption left, double right) { - return new BrakeSpecificFuelConsumption(left.Value / right, left.Unit); + return new BrakeSpecificFuelConsumption(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + /// Get ratio value from dividing by . + public static double operator /(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { return left.KilogramsPerJoule / right.KilogramsPerJoule; } @@ -443,39 +443,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BrakeS #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + public static bool operator <=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + public static bool operator >=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + public static bool operator <(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + public static bool operator >(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { return !(left == right); } @@ -484,37 +484,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BrakeS public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is BrakeSpecificFuelConsumption objBrakeSpecificFuelConsumption)) throw new ArgumentException("Expected type BrakeSpecificFuelConsumption.", nameof(obj)); + if(!(obj is BrakeSpecificFuelConsumption objBrakeSpecificFuelConsumption)) throw new ArgumentException("Expected type BrakeSpecificFuelConsumption.", nameof(obj)); return CompareTo(objBrakeSpecificFuelConsumption); } /// - public int CompareTo(BrakeSpecificFuelConsumption other) + public int CompareTo(BrakeSpecificFuelConsumption other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is BrakeSpecificFuelConsumption objBrakeSpecificFuelConsumption)) + if(obj is null || !(obj is BrakeSpecificFuelConsumption objBrakeSpecificFuelConsumption)) return false; return Equals(objBrakeSpecificFuelConsumption); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(BrakeSpecificFuelConsumption other) + /// Consider using for safely comparing floating point values. + public bool Equals(BrakeSpecificFuelConsumption other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another BrakeSpecificFuelConsumption within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -552,7 +552,7 @@ public bool Equals(BrakeSpecificFuelConsumption other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(BrakeSpecificFuelConsumption other, double tolerance, ComparisonType comparisonType) + public bool Equals(BrakeSpecificFuelConsumption other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -566,7 +566,7 @@ public bool Equals(BrakeSpecificFuelConsumption other, double tolerance, Compari /// /// Returns the hash code for this instance. /// - /// A hash code for the current BrakeSpecificFuelConsumption. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -614,13 +614,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this BrakeSpecificFuelConsumption to another BrakeSpecificFuelConsumption with the unit representation . + /// Converts this to another with the unit representation . /// - /// A BrakeSpecificFuelConsumption with the specified unit. - public BrakeSpecificFuelConsumption ToUnit(BrakeSpecificFuelConsumptionUnit unit) + /// A with the specified unit. + public BrakeSpecificFuelConsumption ToUnit(BrakeSpecificFuelConsumptionUnit unit) { var convertedValue = GetValueAs(unit); - return new BrakeSpecificFuelConsumption(convertedValue, unit); + return new BrakeSpecificFuelConsumption(convertedValue, unit); } /// @@ -633,7 +633,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public BrakeSpecificFuelConsumption ToUnit(UnitSystem unitSystem) + public BrakeSpecificFuelConsumption ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -678,10 +678,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal BrakeSpecificFuelConsumption ToBaseUnit() + internal BrakeSpecificFuelConsumption ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new BrakeSpecificFuelConsumption(baseUnitValue, BaseUnit); + return new BrakeSpecificFuelConsumption(baseUnitValue, BaseUnit); } private double GetValueAs(BrakeSpecificFuelConsumptionUnit unit) @@ -792,7 +792,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -802,12 +802,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -852,16 +852,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(BrakeSpecificFuelConsumption)) + if(conversionType == typeof(BrakeSpecificFuelConsumption)) return this; else if(conversionType == typeof(BrakeSpecificFuelConsumptionUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return BrakeSpecificFuelConsumption.QuantityType; + return BrakeSpecificFuelConsumption.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return BrakeSpecificFuelConsumption.BaseDimensions; + return BrakeSpecificFuelConsumption.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs index d3f61dfd10..16f9d455e0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Capacitance /// - public partial struct Capacitance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Capacitance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -109,19 +109,19 @@ public Capacitance(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Capacitance, which is Farad. All conversions go via this value. + /// The base unit of , which is Farad. All conversions go via this value. /// public static CapacitanceUnit BaseUnit { get; } = CapacitanceUnit.Farad; /// - /// Represents the largest possible value of Capacitance + /// Represents the largest possible value of /// - public static Capacitance MaxValue { get; } = new Capacitance(double.MaxValue, BaseUnit); + public static Capacitance MaxValue { get; } = new Capacitance(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Capacitance + /// Represents the smallest possible value of /// - public static Capacitance MinValue { get; } = new Capacitance(double.MinValue, BaseUnit); + public static Capacitance MinValue { get; } = new Capacitance(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -129,14 +129,14 @@ public Capacitance(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Capacitance; /// - /// All units of measurement for the Capacitance quantity. + /// All units of measurement for the quantity. /// public static CapacitanceUnit[] Units { get; } = Enum.GetValues(typeof(CapacitanceUnit)).Cast().Except(new CapacitanceUnit[]{ CapacitanceUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Farad. /// - public static Capacitance Zero { get; } = new Capacitance(0, BaseUnit); + public static Capacitance Zero { get; } = new Capacitance(0, BaseUnit); #endregion @@ -161,49 +161,49 @@ public Capacitance(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Capacitance.QuantityType; + public QuantityType Type => Capacitance.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Capacitance.BaseDimensions; + public BaseDimensions Dimensions => Capacitance.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Capacitance in Farads. + /// Get in Farads. /// public double Farads => As(CapacitanceUnit.Farad); /// - /// Get Capacitance in Kilofarads. + /// Get in Kilofarads. /// public double Kilofarads => As(CapacitanceUnit.Kilofarad); /// - /// Get Capacitance in Megafarads. + /// Get in Megafarads. /// public double Megafarads => As(CapacitanceUnit.Megafarad); /// - /// Get Capacitance in Microfarads. + /// Get in Microfarads. /// public double Microfarads => As(CapacitanceUnit.Microfarad); /// - /// Get Capacitance in Millifarads. + /// Get in Millifarads. /// public double Millifarads => As(CapacitanceUnit.Millifarad); /// - /// Get Capacitance in Nanofarads. + /// Get in Nanofarads. /// public double Nanofarads => As(CapacitanceUnit.Nanofarad); /// - /// Get Capacitance in Picofarads. + /// Get in Picofarads. /// public double Picofarads => As(CapacitanceUnit.Picofarad); @@ -237,78 +237,78 @@ public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] IFormatPr #region Static Factory Methods /// - /// Get Capacitance from Farads. + /// Get from Farads. /// /// If value is NaN or Infinity. - public static Capacitance FromFarads(QuantityValue farads) + public static Capacitance FromFarads(QuantityValue farads) { double value = (double) farads; - return new Capacitance(value, CapacitanceUnit.Farad); + return new Capacitance(value, CapacitanceUnit.Farad); } /// - /// Get Capacitance from Kilofarads. + /// Get from Kilofarads. /// /// If value is NaN or Infinity. - public static Capacitance FromKilofarads(QuantityValue kilofarads) + public static Capacitance FromKilofarads(QuantityValue kilofarads) { double value = (double) kilofarads; - return new Capacitance(value, CapacitanceUnit.Kilofarad); + return new Capacitance(value, CapacitanceUnit.Kilofarad); } /// - /// Get Capacitance from Megafarads. + /// Get from Megafarads. /// /// If value is NaN or Infinity. - public static Capacitance FromMegafarads(QuantityValue megafarads) + public static Capacitance FromMegafarads(QuantityValue megafarads) { double value = (double) megafarads; - return new Capacitance(value, CapacitanceUnit.Megafarad); + return new Capacitance(value, CapacitanceUnit.Megafarad); } /// - /// Get Capacitance from Microfarads. + /// Get from Microfarads. /// /// If value is NaN or Infinity. - public static Capacitance FromMicrofarads(QuantityValue microfarads) + public static Capacitance FromMicrofarads(QuantityValue microfarads) { double value = (double) microfarads; - return new Capacitance(value, CapacitanceUnit.Microfarad); + return new Capacitance(value, CapacitanceUnit.Microfarad); } /// - /// Get Capacitance from Millifarads. + /// Get from Millifarads. /// /// If value is NaN or Infinity. - public static Capacitance FromMillifarads(QuantityValue millifarads) + public static Capacitance FromMillifarads(QuantityValue millifarads) { double value = (double) millifarads; - return new Capacitance(value, CapacitanceUnit.Millifarad); + return new Capacitance(value, CapacitanceUnit.Millifarad); } /// - /// Get Capacitance from Nanofarads. + /// Get from Nanofarads. /// /// If value is NaN or Infinity. - public static Capacitance FromNanofarads(QuantityValue nanofarads) + public static Capacitance FromNanofarads(QuantityValue nanofarads) { double value = (double) nanofarads; - return new Capacitance(value, CapacitanceUnit.Nanofarad); + return new Capacitance(value, CapacitanceUnit.Nanofarad); } /// - /// Get Capacitance from Picofarads. + /// Get from Picofarads. /// /// If value is NaN or Infinity. - public static Capacitance FromPicofarads(QuantityValue picofarads) + public static Capacitance FromPicofarads(QuantityValue picofarads) { double value = (double) picofarads; - return new Capacitance(value, CapacitanceUnit.Picofarad); + return new Capacitance(value, CapacitanceUnit.Picofarad); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Capacitance unit value. - public static Capacitance From(QuantityValue value, CapacitanceUnit fromUnit) + /// unit value. + public static Capacitance From(QuantityValue value, CapacitanceUnit fromUnit) { - return new Capacitance((double)value, fromUnit); + return new Capacitance((double)value, fromUnit); } #endregion @@ -337,7 +337,7 @@ public static Capacitance From(QuantityValue value, CapacitanceUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Capacitance Parse(string str) + public static Capacitance Parse(string str) { return Parse(str, null); } @@ -365,9 +365,9 @@ public static Capacitance Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Capacitance Parse(string str, [CanBeNull] IFormatProvider provider) + public static Capacitance Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, CapacitanceUnit>( str, provider, From); @@ -381,7 +381,7 @@ public static Capacitance Parse(string str, [CanBeNull] IFormatProvider provider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Capacitance result) + public static bool TryParse([CanBeNull] string str, out Capacitance result) { return TryParse(str, null, out result); } @@ -396,9 +396,9 @@ public static bool TryParse([CanBeNull] string str, out Capacitance result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Capacitance result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Capacitance result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, CapacitanceUnit>( str, provider, From, @@ -460,43 +460,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Capaci #region Arithmetic Operators /// Negate the value. - public static Capacitance operator -(Capacitance right) + public static Capacitance operator -(Capacitance right) { - return new Capacitance(-right.Value, right.Unit); + return new Capacitance(-right.Value, right.Unit); } - /// Get from adding two . - public static Capacitance operator +(Capacitance left, Capacitance right) + /// Get from adding two . + public static Capacitance operator +(Capacitance left, Capacitance right) { - return new Capacitance(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Capacitance(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Capacitance operator -(Capacitance left, Capacitance right) + /// Get from subtracting two . + public static Capacitance operator -(Capacitance left, Capacitance right) { - return new Capacitance(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Capacitance(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Capacitance operator *(double left, Capacitance right) + /// Get from multiplying value and . + public static Capacitance operator *(double left, Capacitance right) { - return new Capacitance(left * right.Value, right.Unit); + return new Capacitance(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Capacitance operator *(Capacitance left, double right) + /// Get from multiplying value and . + public static Capacitance operator *(Capacitance left, double right) { - return new Capacitance(left.Value * right, left.Unit); + return new Capacitance(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Capacitance operator /(Capacitance left, double right) + /// Get from dividing by value. + public static Capacitance operator /(Capacitance left, double right) { - return new Capacitance(left.Value / right, left.Unit); + return new Capacitance(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Capacitance left, Capacitance right) + /// Get ratio value from dividing by . + public static double operator /(Capacitance left, Capacitance right) { return left.Farads / right.Farads; } @@ -506,39 +506,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Capaci #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Capacitance left, Capacitance right) + public static bool operator <=(Capacitance left, Capacitance right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Capacitance left, Capacitance right) + public static bool operator >=(Capacitance left, Capacitance right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Capacitance left, Capacitance right) + public static bool operator <(Capacitance left, Capacitance right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Capacitance left, Capacitance right) + public static bool operator >(Capacitance left, Capacitance right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Capacitance left, Capacitance right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Capacitance left, Capacitance right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Capacitance left, Capacitance right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Capacitance left, Capacitance right) { return !(left == right); } @@ -547,37 +547,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Capaci public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Capacitance objCapacitance)) throw new ArgumentException("Expected type Capacitance.", nameof(obj)); + if(!(obj is Capacitance objCapacitance)) throw new ArgumentException("Expected type Capacitance.", nameof(obj)); return CompareTo(objCapacitance); } /// - public int CompareTo(Capacitance other) + public int CompareTo(Capacitance other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Capacitance objCapacitance)) + if(obj is null || !(obj is Capacitance objCapacitance)) return false; return Equals(objCapacitance); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Capacitance other) + /// Consider using for safely comparing floating point values. + public bool Equals(Capacitance other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Capacitance within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -615,7 +615,7 @@ public bool Equals(Capacitance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Capacitance other, double tolerance, ComparisonType comparisonType) + public bool Equals(Capacitance other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -629,7 +629,7 @@ public bool Equals(Capacitance other, double tolerance, ComparisonType compariso /// /// Returns the hash code for this instance. /// - /// A hash code for the current Capacitance. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -677,13 +677,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Capacitance to another Capacitance with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Capacitance with the specified unit. - public Capacitance ToUnit(CapacitanceUnit unit) + /// A with the specified unit. + public Capacitance ToUnit(CapacitanceUnit unit) { var convertedValue = GetValueAs(unit); - return new Capacitance(convertedValue, unit); + return new Capacitance(convertedValue, unit); } /// @@ -696,7 +696,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Capacitance ToUnit(UnitSystem unitSystem) + public Capacitance ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -745,10 +745,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Capacitance ToBaseUnit() + internal Capacitance ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Capacitance(baseUnitValue, BaseUnit); + return new Capacitance(baseUnitValue, BaseUnit); } private double GetValueAs(CapacitanceUnit unit) @@ -863,7 +863,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Capacitance)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Capacitance)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -873,12 +873,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Capacitance)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Capacitance)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Capacitance)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Capacitance)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -923,16 +923,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Capacitance)) + if(conversionType == typeof(Capacitance)) return this; else if(conversionType == typeof(CapacitanceUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Capacitance.QuantityType; + return Capacitance.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Capacitance.BaseDimensions; + return Capacitance.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Capacitance)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Capacitance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs index 46a7fac2af..a26b38f1fe 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// A unit that represents a fractional change in size in response to a change in temperature. /// - public partial struct CoefficientOfThermalExpansion : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct CoefficientOfThermalExpansion : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -102,19 +102,19 @@ public CoefficientOfThermalExpansion(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of CoefficientOfThermalExpansion, which is InverseKelvin. All conversions go via this value. + /// The base unit of , which is InverseKelvin. All conversions go via this value. /// public static CoefficientOfThermalExpansionUnit BaseUnit { get; } = CoefficientOfThermalExpansionUnit.InverseKelvin; /// - /// Represents the largest possible value of CoefficientOfThermalExpansion + /// Represents the largest possible value of /// - public static CoefficientOfThermalExpansion MaxValue { get; } = new CoefficientOfThermalExpansion(double.MaxValue, BaseUnit); + public static CoefficientOfThermalExpansion MaxValue { get; } = new CoefficientOfThermalExpansion(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of CoefficientOfThermalExpansion + /// Represents the smallest possible value of /// - public static CoefficientOfThermalExpansion MinValue { get; } = new CoefficientOfThermalExpansion(double.MinValue, BaseUnit); + public static CoefficientOfThermalExpansion MinValue { get; } = new CoefficientOfThermalExpansion(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -122,14 +122,14 @@ public CoefficientOfThermalExpansion(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.CoefficientOfThermalExpansion; /// - /// All units of measurement for the CoefficientOfThermalExpansion quantity. + /// All units of measurement for the quantity. /// public static CoefficientOfThermalExpansionUnit[] Units { get; } = Enum.GetValues(typeof(CoefficientOfThermalExpansionUnit)).Cast().Except(new CoefficientOfThermalExpansionUnit[]{ CoefficientOfThermalExpansionUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit InverseKelvin. /// - public static CoefficientOfThermalExpansion Zero { get; } = new CoefficientOfThermalExpansion(0, BaseUnit); + public static CoefficientOfThermalExpansion Zero { get; } = new CoefficientOfThermalExpansion(0, BaseUnit); #endregion @@ -154,29 +154,29 @@ public CoefficientOfThermalExpansion(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => CoefficientOfThermalExpansion.QuantityType; + public QuantityType Type => CoefficientOfThermalExpansion.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => CoefficientOfThermalExpansion.BaseDimensions; + public BaseDimensions Dimensions => CoefficientOfThermalExpansion.BaseDimensions; #endregion #region Conversion Properties /// - /// Get CoefficientOfThermalExpansion in InverseDegreeCelsius. + /// Get in InverseDegreeCelsius. /// public double InverseDegreeCelsius => As(CoefficientOfThermalExpansionUnit.InverseDegreeCelsius); /// - /// Get CoefficientOfThermalExpansion in InverseDegreeFahrenheit. + /// Get in InverseDegreeFahrenheit. /// public double InverseDegreeFahrenheit => As(CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit); /// - /// Get CoefficientOfThermalExpansion in InverseKelvin. + /// Get in InverseKelvin. /// public double InverseKelvin => As(CoefficientOfThermalExpansionUnit.InverseKelvin); @@ -210,42 +210,42 @@ public static string GetAbbreviation(CoefficientOfThermalExpansionUnit unit, [Ca #region Static Factory Methods /// - /// Get CoefficientOfThermalExpansion from InverseDegreeCelsius. + /// Get from InverseDegreeCelsius. /// /// If value is NaN or Infinity. - public static CoefficientOfThermalExpansion FromInverseDegreeCelsius(QuantityValue inversedegreecelsius) + public static CoefficientOfThermalExpansion FromInverseDegreeCelsius(QuantityValue inversedegreecelsius) { double value = (double) inversedegreecelsius; - return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseDegreeCelsius); + return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseDegreeCelsius); } /// - /// Get CoefficientOfThermalExpansion from InverseDegreeFahrenheit. + /// Get from InverseDegreeFahrenheit. /// /// If value is NaN or Infinity. - public static CoefficientOfThermalExpansion FromInverseDegreeFahrenheit(QuantityValue inversedegreefahrenheit) + public static CoefficientOfThermalExpansion FromInverseDegreeFahrenheit(QuantityValue inversedegreefahrenheit) { double value = (double) inversedegreefahrenheit; - return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit); + return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit); } /// - /// Get CoefficientOfThermalExpansion from InverseKelvin. + /// Get from InverseKelvin. /// /// If value is NaN or Infinity. - public static CoefficientOfThermalExpansion FromInverseKelvin(QuantityValue inversekelvin) + public static CoefficientOfThermalExpansion FromInverseKelvin(QuantityValue inversekelvin) { double value = (double) inversekelvin; - return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseKelvin); + return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseKelvin); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// CoefficientOfThermalExpansion unit value. - public static CoefficientOfThermalExpansion From(QuantityValue value, CoefficientOfThermalExpansionUnit fromUnit) + /// unit value. + public static CoefficientOfThermalExpansion From(QuantityValue value, CoefficientOfThermalExpansionUnit fromUnit) { - return new CoefficientOfThermalExpansion((double)value, fromUnit); + return new CoefficientOfThermalExpansion((double)value, fromUnit); } #endregion @@ -274,7 +274,7 @@ public static CoefficientOfThermalExpansion From(QuantityValue value, Coefficien /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static CoefficientOfThermalExpansion Parse(string str) + public static CoefficientOfThermalExpansion Parse(string str) { return Parse(str, null); } @@ -302,9 +302,9 @@ public static CoefficientOfThermalExpansion Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static CoefficientOfThermalExpansion Parse(string str, [CanBeNull] IFormatProvider provider) + public static CoefficientOfThermalExpansion Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, CoefficientOfThermalExpansionUnit>( str, provider, From); @@ -318,7 +318,7 @@ public static CoefficientOfThermalExpansion Parse(string str, [CanBeNull] IForma /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out CoefficientOfThermalExpansion result) + public static bool TryParse([CanBeNull] string str, out CoefficientOfThermalExpansion result) { return TryParse(str, null, out result); } @@ -333,9 +333,9 @@ public static bool TryParse([CanBeNull] string str, out CoefficientOfThermalExpa /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out CoefficientOfThermalExpansion result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out CoefficientOfThermalExpansion result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, CoefficientOfThermalExpansionUnit>( str, provider, From, @@ -397,43 +397,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Coeffi #region Arithmetic Operators /// Negate the value. - public static CoefficientOfThermalExpansion operator -(CoefficientOfThermalExpansion right) + public static CoefficientOfThermalExpansion operator -(CoefficientOfThermalExpansion right) { - return new CoefficientOfThermalExpansion(-right.Value, right.Unit); + return new CoefficientOfThermalExpansion(-right.Value, right.Unit); } - /// Get from adding two . - public static CoefficientOfThermalExpansion operator +(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + /// Get from adding two . + public static CoefficientOfThermalExpansion operator +(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { - return new CoefficientOfThermalExpansion(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new CoefficientOfThermalExpansion(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static CoefficientOfThermalExpansion operator -(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + /// Get from subtracting two . + public static CoefficientOfThermalExpansion operator -(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { - return new CoefficientOfThermalExpansion(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new CoefficientOfThermalExpansion(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static CoefficientOfThermalExpansion operator *(double left, CoefficientOfThermalExpansion right) + /// Get from multiplying value and . + public static CoefficientOfThermalExpansion operator *(double left, CoefficientOfThermalExpansion right) { - return new CoefficientOfThermalExpansion(left * right.Value, right.Unit); + return new CoefficientOfThermalExpansion(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static CoefficientOfThermalExpansion operator *(CoefficientOfThermalExpansion left, double right) + /// Get from multiplying value and . + public static CoefficientOfThermalExpansion operator *(CoefficientOfThermalExpansion left, double right) { - return new CoefficientOfThermalExpansion(left.Value * right, left.Unit); + return new CoefficientOfThermalExpansion(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static CoefficientOfThermalExpansion operator /(CoefficientOfThermalExpansion left, double right) + /// Get from dividing by value. + public static CoefficientOfThermalExpansion operator /(CoefficientOfThermalExpansion left, double right) { - return new CoefficientOfThermalExpansion(left.Value / right, left.Unit); + return new CoefficientOfThermalExpansion(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + /// Get ratio value from dividing by . + public static double operator /(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { return left.InverseKelvin / right.InverseKelvin; } @@ -443,39 +443,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Coeffi #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + public static bool operator <=(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + public static bool operator >=(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + public static bool operator <(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + public static bool operator >(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { return !(left == right); } @@ -484,37 +484,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Coeffi public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) throw new ArgumentException("Expected type CoefficientOfThermalExpansion.", nameof(obj)); + if(!(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) throw new ArgumentException("Expected type CoefficientOfThermalExpansion.", nameof(obj)); return CompareTo(objCoefficientOfThermalExpansion); } /// - public int CompareTo(CoefficientOfThermalExpansion other) + public int CompareTo(CoefficientOfThermalExpansion other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) + if(obj is null || !(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) return false; return Equals(objCoefficientOfThermalExpansion); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(CoefficientOfThermalExpansion other) + /// Consider using for safely comparing floating point values. + public bool Equals(CoefficientOfThermalExpansion other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another CoefficientOfThermalExpansion within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -552,7 +552,7 @@ public bool Equals(CoefficientOfThermalExpansion other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(CoefficientOfThermalExpansion other, double tolerance, ComparisonType comparisonType) + public bool Equals(CoefficientOfThermalExpansion other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -566,7 +566,7 @@ public bool Equals(CoefficientOfThermalExpansion other, double tolerance, Compar /// /// Returns the hash code for this instance. /// - /// A hash code for the current CoefficientOfThermalExpansion. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -614,13 +614,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this CoefficientOfThermalExpansion to another CoefficientOfThermalExpansion with the unit representation . + /// Converts this to another with the unit representation . /// - /// A CoefficientOfThermalExpansion with the specified unit. - public CoefficientOfThermalExpansion ToUnit(CoefficientOfThermalExpansionUnit unit) + /// A with the specified unit. + public CoefficientOfThermalExpansion ToUnit(CoefficientOfThermalExpansionUnit unit) { var convertedValue = GetValueAs(unit); - return new CoefficientOfThermalExpansion(convertedValue, unit); + return new CoefficientOfThermalExpansion(convertedValue, unit); } /// @@ -633,7 +633,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public CoefficientOfThermalExpansion ToUnit(UnitSystem unitSystem) + public CoefficientOfThermalExpansion ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -678,10 +678,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal CoefficientOfThermalExpansion ToBaseUnit() + internal CoefficientOfThermalExpansion ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new CoefficientOfThermalExpansion(baseUnitValue, BaseUnit); + return new CoefficientOfThermalExpansion(baseUnitValue, BaseUnit); } private double GetValueAs(CoefficientOfThermalExpansionUnit unit) @@ -792,7 +792,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -802,12 +802,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -852,16 +852,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(CoefficientOfThermalExpansion)) + if(conversionType == typeof(CoefficientOfThermalExpansion)) return this; else if(conversionType == typeof(CoefficientOfThermalExpansionUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return CoefficientOfThermalExpansion.QuantityType; + return CoefficientOfThermalExpansion.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return CoefficientOfThermalExpansion.BaseDimensions; + return CoefficientOfThermalExpansion.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs index c22b5734eb..e45edc3283 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// http://en.wikipedia.org/wiki/Density /// - public partial struct Density : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Density : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -142,19 +142,19 @@ public Density(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Density, which is KilogramPerCubicMeter. All conversions go via this value. + /// The base unit of , which is KilogramPerCubicMeter. All conversions go via this value. /// public static DensityUnit BaseUnit { get; } = DensityUnit.KilogramPerCubicMeter; /// - /// Represents the largest possible value of Density + /// Represents the largest possible value of /// - public static Density MaxValue { get; } = new Density(double.MaxValue, BaseUnit); + public static Density MaxValue { get; } = new Density(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Density + /// Represents the smallest possible value of /// - public static Density MinValue { get; } = new Density(double.MinValue, BaseUnit); + public static Density MinValue { get; } = new Density(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -162,14 +162,14 @@ public Density(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Density; /// - /// All units of measurement for the Density quantity. + /// All units of measurement for the quantity. /// public static DensityUnit[] Units { get; } = Enum.GetValues(typeof(DensityUnit)).Cast().Except(new DensityUnit[]{ DensityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerCubicMeter. /// - public static Density Zero { get; } = new Density(0, BaseUnit); + public static Density Zero { get; } = new Density(0, BaseUnit); #endregion @@ -194,214 +194,214 @@ public Density(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Density.QuantityType; + public QuantityType Type => Density.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Density.BaseDimensions; + public BaseDimensions Dimensions => Density.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Density in CentigramsPerDeciLiter. + /// Get in CentigramsPerDeciLiter. /// public double CentigramsPerDeciLiter => As(DensityUnit.CentigramPerDeciliter); /// - /// Get Density in CentigramsPerLiter. + /// Get in CentigramsPerLiter. /// public double CentigramsPerLiter => As(DensityUnit.CentigramPerLiter); /// - /// Get Density in CentigramsPerMilliliter. + /// Get in CentigramsPerMilliliter. /// public double CentigramsPerMilliliter => As(DensityUnit.CentigramPerMilliliter); /// - /// Get Density in DecigramsPerDeciLiter. + /// Get in DecigramsPerDeciLiter. /// public double DecigramsPerDeciLiter => As(DensityUnit.DecigramPerDeciliter); /// - /// Get Density in DecigramsPerLiter. + /// Get in DecigramsPerLiter. /// public double DecigramsPerLiter => As(DensityUnit.DecigramPerLiter); /// - /// Get Density in DecigramsPerMilliliter. + /// Get in DecigramsPerMilliliter. /// public double DecigramsPerMilliliter => As(DensityUnit.DecigramPerMilliliter); /// - /// Get Density in GramsPerCubicCentimeter. + /// Get in GramsPerCubicCentimeter. /// public double GramsPerCubicCentimeter => As(DensityUnit.GramPerCubicCentimeter); /// - /// Get Density in GramsPerCubicMeter. + /// Get in GramsPerCubicMeter. /// public double GramsPerCubicMeter => As(DensityUnit.GramPerCubicMeter); /// - /// Get Density in GramsPerCubicMillimeter. + /// Get in GramsPerCubicMillimeter. /// public double GramsPerCubicMillimeter => As(DensityUnit.GramPerCubicMillimeter); /// - /// Get Density in GramsPerDeciLiter. + /// Get in GramsPerDeciLiter. /// public double GramsPerDeciLiter => As(DensityUnit.GramPerDeciliter); /// - /// Get Density in GramsPerLiter. + /// Get in GramsPerLiter. /// public double GramsPerLiter => As(DensityUnit.GramPerLiter); /// - /// Get Density in GramsPerMilliliter. + /// Get in GramsPerMilliliter. /// public double GramsPerMilliliter => As(DensityUnit.GramPerMilliliter); /// - /// Get Density in KilogramsPerCubicCentimeter. + /// Get in KilogramsPerCubicCentimeter. /// public double KilogramsPerCubicCentimeter => As(DensityUnit.KilogramPerCubicCentimeter); /// - /// Get Density in KilogramsPerCubicMeter. + /// Get in KilogramsPerCubicMeter. /// public double KilogramsPerCubicMeter => As(DensityUnit.KilogramPerCubicMeter); /// - /// Get Density in KilogramsPerCubicMillimeter. + /// Get in KilogramsPerCubicMillimeter. /// public double KilogramsPerCubicMillimeter => As(DensityUnit.KilogramPerCubicMillimeter); /// - /// Get Density in KilogramsPerLiter. + /// Get in KilogramsPerLiter. /// public double KilogramsPerLiter => As(DensityUnit.KilogramPerLiter); /// - /// Get Density in KilopoundsPerCubicFoot. + /// Get in KilopoundsPerCubicFoot. /// public double KilopoundsPerCubicFoot => As(DensityUnit.KilopoundPerCubicFoot); /// - /// Get Density in KilopoundsPerCubicInch. + /// Get in KilopoundsPerCubicInch. /// public double KilopoundsPerCubicInch => As(DensityUnit.KilopoundPerCubicInch); /// - /// Get Density in MicrogramsPerCubicMeter. + /// Get in MicrogramsPerCubicMeter. /// public double MicrogramsPerCubicMeter => As(DensityUnit.MicrogramPerCubicMeter); /// - /// Get Density in MicrogramsPerDeciLiter. + /// Get in MicrogramsPerDeciLiter. /// public double MicrogramsPerDeciLiter => As(DensityUnit.MicrogramPerDeciliter); /// - /// Get Density in MicrogramsPerLiter. + /// Get in MicrogramsPerLiter. /// public double MicrogramsPerLiter => As(DensityUnit.MicrogramPerLiter); /// - /// Get Density in MicrogramsPerMilliliter. + /// Get in MicrogramsPerMilliliter. /// public double MicrogramsPerMilliliter => As(DensityUnit.MicrogramPerMilliliter); /// - /// Get Density in MilligramsPerCubicMeter. + /// Get in MilligramsPerCubicMeter. /// public double MilligramsPerCubicMeter => As(DensityUnit.MilligramPerCubicMeter); /// - /// Get Density in MilligramsPerDeciLiter. + /// Get in MilligramsPerDeciLiter. /// public double MilligramsPerDeciLiter => As(DensityUnit.MilligramPerDeciliter); /// - /// Get Density in MilligramsPerLiter. + /// Get in MilligramsPerLiter. /// public double MilligramsPerLiter => As(DensityUnit.MilligramPerLiter); /// - /// Get Density in MilligramsPerMilliliter. + /// Get in MilligramsPerMilliliter. /// public double MilligramsPerMilliliter => As(DensityUnit.MilligramPerMilliliter); /// - /// Get Density in NanogramsPerDeciLiter. + /// Get in NanogramsPerDeciLiter. /// public double NanogramsPerDeciLiter => As(DensityUnit.NanogramPerDeciliter); /// - /// Get Density in NanogramsPerLiter. + /// Get in NanogramsPerLiter. /// public double NanogramsPerLiter => As(DensityUnit.NanogramPerLiter); /// - /// Get Density in NanogramsPerMilliliter. + /// Get in NanogramsPerMilliliter. /// public double NanogramsPerMilliliter => As(DensityUnit.NanogramPerMilliliter); /// - /// Get Density in PicogramsPerDeciLiter. + /// Get in PicogramsPerDeciLiter. /// public double PicogramsPerDeciLiter => As(DensityUnit.PicogramPerDeciliter); /// - /// Get Density in PicogramsPerLiter. + /// Get in PicogramsPerLiter. /// public double PicogramsPerLiter => As(DensityUnit.PicogramPerLiter); /// - /// Get Density in PicogramsPerMilliliter. + /// Get in PicogramsPerMilliliter. /// public double PicogramsPerMilliliter => As(DensityUnit.PicogramPerMilliliter); /// - /// Get Density in PoundsPerCubicFoot. + /// Get in PoundsPerCubicFoot. /// public double PoundsPerCubicFoot => As(DensityUnit.PoundPerCubicFoot); /// - /// Get Density in PoundsPerCubicInch. + /// Get in PoundsPerCubicInch. /// public double PoundsPerCubicInch => As(DensityUnit.PoundPerCubicInch); /// - /// Get Density in PoundsPerImperialGallon. + /// Get in PoundsPerImperialGallon. /// public double PoundsPerImperialGallon => As(DensityUnit.PoundPerImperialGallon); /// - /// Get Density in PoundsPerUSGallon. + /// Get in PoundsPerUSGallon. /// public double PoundsPerUSGallon => As(DensityUnit.PoundPerUSGallon); /// - /// Get Density in SlugsPerCubicFoot. + /// Get in SlugsPerCubicFoot. /// public double SlugsPerCubicFoot => As(DensityUnit.SlugPerCubicFoot); /// - /// Get Density in TonnesPerCubicCentimeter. + /// Get in TonnesPerCubicCentimeter. /// public double TonnesPerCubicCentimeter => As(DensityUnit.TonnePerCubicCentimeter); /// - /// Get Density in TonnesPerCubicMeter. + /// Get in TonnesPerCubicMeter. /// public double TonnesPerCubicMeter => As(DensityUnit.TonnePerCubicMeter); /// - /// Get Density in TonnesPerCubicMillimeter. + /// Get in TonnesPerCubicMillimeter. /// public double TonnesPerCubicMillimeter => As(DensityUnit.TonnePerCubicMillimeter); @@ -435,375 +435,375 @@ public static string GetAbbreviation(DensityUnit unit, [CanBeNull] IFormatProvid #region Static Factory Methods /// - /// Get Density from CentigramsPerDeciLiter. + /// Get from CentigramsPerDeciLiter. /// /// If value is NaN or Infinity. - public static Density FromCentigramsPerDeciLiter(QuantityValue centigramsperdeciliter) + public static Density FromCentigramsPerDeciLiter(QuantityValue centigramsperdeciliter) { double value = (double) centigramsperdeciliter; - return new Density(value, DensityUnit.CentigramPerDeciliter); + return new Density(value, DensityUnit.CentigramPerDeciliter); } /// - /// Get Density from CentigramsPerLiter. + /// Get from CentigramsPerLiter. /// /// If value is NaN or Infinity. - public static Density FromCentigramsPerLiter(QuantityValue centigramsperliter) + public static Density FromCentigramsPerLiter(QuantityValue centigramsperliter) { double value = (double) centigramsperliter; - return new Density(value, DensityUnit.CentigramPerLiter); + return new Density(value, DensityUnit.CentigramPerLiter); } /// - /// Get Density from CentigramsPerMilliliter. + /// Get from CentigramsPerMilliliter. /// /// If value is NaN or Infinity. - public static Density FromCentigramsPerMilliliter(QuantityValue centigramspermilliliter) + public static Density FromCentigramsPerMilliliter(QuantityValue centigramspermilliliter) { double value = (double) centigramspermilliliter; - return new Density(value, DensityUnit.CentigramPerMilliliter); + return new Density(value, DensityUnit.CentigramPerMilliliter); } /// - /// Get Density from DecigramsPerDeciLiter. + /// Get from DecigramsPerDeciLiter. /// /// If value is NaN or Infinity. - public static Density FromDecigramsPerDeciLiter(QuantityValue decigramsperdeciliter) + public static Density FromDecigramsPerDeciLiter(QuantityValue decigramsperdeciliter) { double value = (double) decigramsperdeciliter; - return new Density(value, DensityUnit.DecigramPerDeciliter); + return new Density(value, DensityUnit.DecigramPerDeciliter); } /// - /// Get Density from DecigramsPerLiter. + /// Get from DecigramsPerLiter. /// /// If value is NaN or Infinity. - public static Density FromDecigramsPerLiter(QuantityValue decigramsperliter) + public static Density FromDecigramsPerLiter(QuantityValue decigramsperliter) { double value = (double) decigramsperliter; - return new Density(value, DensityUnit.DecigramPerLiter); + return new Density(value, DensityUnit.DecigramPerLiter); } /// - /// Get Density from DecigramsPerMilliliter. + /// Get from DecigramsPerMilliliter. /// /// If value is NaN or Infinity. - public static Density FromDecigramsPerMilliliter(QuantityValue decigramspermilliliter) + public static Density FromDecigramsPerMilliliter(QuantityValue decigramspermilliliter) { double value = (double) decigramspermilliliter; - return new Density(value, DensityUnit.DecigramPerMilliliter); + return new Density(value, DensityUnit.DecigramPerMilliliter); } /// - /// Get Density from GramsPerCubicCentimeter. + /// Get from GramsPerCubicCentimeter. /// /// If value is NaN or Infinity. - public static Density FromGramsPerCubicCentimeter(QuantityValue gramspercubiccentimeter) + public static Density FromGramsPerCubicCentimeter(QuantityValue gramspercubiccentimeter) { double value = (double) gramspercubiccentimeter; - return new Density(value, DensityUnit.GramPerCubicCentimeter); + return new Density(value, DensityUnit.GramPerCubicCentimeter); } /// - /// Get Density from GramsPerCubicMeter. + /// Get from GramsPerCubicMeter. /// /// If value is NaN or Infinity. - public static Density FromGramsPerCubicMeter(QuantityValue gramspercubicmeter) + public static Density FromGramsPerCubicMeter(QuantityValue gramspercubicmeter) { double value = (double) gramspercubicmeter; - return new Density(value, DensityUnit.GramPerCubicMeter); + return new Density(value, DensityUnit.GramPerCubicMeter); } /// - /// Get Density from GramsPerCubicMillimeter. + /// Get from GramsPerCubicMillimeter. /// /// If value is NaN or Infinity. - public static Density FromGramsPerCubicMillimeter(QuantityValue gramspercubicmillimeter) + public static Density FromGramsPerCubicMillimeter(QuantityValue gramspercubicmillimeter) { double value = (double) gramspercubicmillimeter; - return new Density(value, DensityUnit.GramPerCubicMillimeter); + return new Density(value, DensityUnit.GramPerCubicMillimeter); } /// - /// Get Density from GramsPerDeciLiter. + /// Get from GramsPerDeciLiter. /// /// If value is NaN or Infinity. - public static Density FromGramsPerDeciLiter(QuantityValue gramsperdeciliter) + public static Density FromGramsPerDeciLiter(QuantityValue gramsperdeciliter) { double value = (double) gramsperdeciliter; - return new Density(value, DensityUnit.GramPerDeciliter); + return new Density(value, DensityUnit.GramPerDeciliter); } /// - /// Get Density from GramsPerLiter. + /// Get from GramsPerLiter. /// /// If value is NaN or Infinity. - public static Density FromGramsPerLiter(QuantityValue gramsperliter) + public static Density FromGramsPerLiter(QuantityValue gramsperliter) { double value = (double) gramsperliter; - return new Density(value, DensityUnit.GramPerLiter); + return new Density(value, DensityUnit.GramPerLiter); } /// - /// Get Density from GramsPerMilliliter. + /// Get from GramsPerMilliliter. /// /// If value is NaN or Infinity. - public static Density FromGramsPerMilliliter(QuantityValue gramspermilliliter) + public static Density FromGramsPerMilliliter(QuantityValue gramspermilliliter) { double value = (double) gramspermilliliter; - return new Density(value, DensityUnit.GramPerMilliliter); + return new Density(value, DensityUnit.GramPerMilliliter); } /// - /// Get Density from KilogramsPerCubicCentimeter. + /// Get from KilogramsPerCubicCentimeter. /// /// If value is NaN or Infinity. - public static Density FromKilogramsPerCubicCentimeter(QuantityValue kilogramspercubiccentimeter) + public static Density FromKilogramsPerCubicCentimeter(QuantityValue kilogramspercubiccentimeter) { double value = (double) kilogramspercubiccentimeter; - return new Density(value, DensityUnit.KilogramPerCubicCentimeter); + return new Density(value, DensityUnit.KilogramPerCubicCentimeter); } /// - /// Get Density from KilogramsPerCubicMeter. + /// Get from KilogramsPerCubicMeter. /// /// If value is NaN or Infinity. - public static Density FromKilogramsPerCubicMeter(QuantityValue kilogramspercubicmeter) + public static Density FromKilogramsPerCubicMeter(QuantityValue kilogramspercubicmeter) { double value = (double) kilogramspercubicmeter; - return new Density(value, DensityUnit.KilogramPerCubicMeter); + return new Density(value, DensityUnit.KilogramPerCubicMeter); } /// - /// Get Density from KilogramsPerCubicMillimeter. + /// Get from KilogramsPerCubicMillimeter. /// /// If value is NaN or Infinity. - public static Density FromKilogramsPerCubicMillimeter(QuantityValue kilogramspercubicmillimeter) + public static Density FromKilogramsPerCubicMillimeter(QuantityValue kilogramspercubicmillimeter) { double value = (double) kilogramspercubicmillimeter; - return new Density(value, DensityUnit.KilogramPerCubicMillimeter); + return new Density(value, DensityUnit.KilogramPerCubicMillimeter); } /// - /// Get Density from KilogramsPerLiter. + /// Get from KilogramsPerLiter. /// /// If value is NaN or Infinity. - public static Density FromKilogramsPerLiter(QuantityValue kilogramsperliter) + public static Density FromKilogramsPerLiter(QuantityValue kilogramsperliter) { double value = (double) kilogramsperliter; - return new Density(value, DensityUnit.KilogramPerLiter); + return new Density(value, DensityUnit.KilogramPerLiter); } /// - /// Get Density from KilopoundsPerCubicFoot. + /// Get from KilopoundsPerCubicFoot. /// /// If value is NaN or Infinity. - public static Density FromKilopoundsPerCubicFoot(QuantityValue kilopoundspercubicfoot) + public static Density FromKilopoundsPerCubicFoot(QuantityValue kilopoundspercubicfoot) { double value = (double) kilopoundspercubicfoot; - return new Density(value, DensityUnit.KilopoundPerCubicFoot); + return new Density(value, DensityUnit.KilopoundPerCubicFoot); } /// - /// Get Density from KilopoundsPerCubicInch. + /// Get from KilopoundsPerCubicInch. /// /// If value is NaN or Infinity. - public static Density FromKilopoundsPerCubicInch(QuantityValue kilopoundspercubicinch) + public static Density FromKilopoundsPerCubicInch(QuantityValue kilopoundspercubicinch) { double value = (double) kilopoundspercubicinch; - return new Density(value, DensityUnit.KilopoundPerCubicInch); + return new Density(value, DensityUnit.KilopoundPerCubicInch); } /// - /// Get Density from MicrogramsPerCubicMeter. + /// Get from MicrogramsPerCubicMeter. /// /// If value is NaN or Infinity. - public static Density FromMicrogramsPerCubicMeter(QuantityValue microgramspercubicmeter) + public static Density FromMicrogramsPerCubicMeter(QuantityValue microgramspercubicmeter) { double value = (double) microgramspercubicmeter; - return new Density(value, DensityUnit.MicrogramPerCubicMeter); + return new Density(value, DensityUnit.MicrogramPerCubicMeter); } /// - /// Get Density from MicrogramsPerDeciLiter. + /// Get from MicrogramsPerDeciLiter. /// /// If value is NaN or Infinity. - public static Density FromMicrogramsPerDeciLiter(QuantityValue microgramsperdeciliter) + public static Density FromMicrogramsPerDeciLiter(QuantityValue microgramsperdeciliter) { double value = (double) microgramsperdeciliter; - return new Density(value, DensityUnit.MicrogramPerDeciliter); + return new Density(value, DensityUnit.MicrogramPerDeciliter); } /// - /// Get Density from MicrogramsPerLiter. + /// Get from MicrogramsPerLiter. /// /// If value is NaN or Infinity. - public static Density FromMicrogramsPerLiter(QuantityValue microgramsperliter) + public static Density FromMicrogramsPerLiter(QuantityValue microgramsperliter) { double value = (double) microgramsperliter; - return new Density(value, DensityUnit.MicrogramPerLiter); + return new Density(value, DensityUnit.MicrogramPerLiter); } /// - /// Get Density from MicrogramsPerMilliliter. + /// Get from MicrogramsPerMilliliter. /// /// If value is NaN or Infinity. - public static Density FromMicrogramsPerMilliliter(QuantityValue microgramspermilliliter) + public static Density FromMicrogramsPerMilliliter(QuantityValue microgramspermilliliter) { double value = (double) microgramspermilliliter; - return new Density(value, DensityUnit.MicrogramPerMilliliter); + return new Density(value, DensityUnit.MicrogramPerMilliliter); } /// - /// Get Density from MilligramsPerCubicMeter. + /// Get from MilligramsPerCubicMeter. /// /// If value is NaN or Infinity. - public static Density FromMilligramsPerCubicMeter(QuantityValue milligramspercubicmeter) + public static Density FromMilligramsPerCubicMeter(QuantityValue milligramspercubicmeter) { double value = (double) milligramspercubicmeter; - return new Density(value, DensityUnit.MilligramPerCubicMeter); + return new Density(value, DensityUnit.MilligramPerCubicMeter); } /// - /// Get Density from MilligramsPerDeciLiter. + /// Get from MilligramsPerDeciLiter. /// /// If value is NaN or Infinity. - public static Density FromMilligramsPerDeciLiter(QuantityValue milligramsperdeciliter) + public static Density FromMilligramsPerDeciLiter(QuantityValue milligramsperdeciliter) { double value = (double) milligramsperdeciliter; - return new Density(value, DensityUnit.MilligramPerDeciliter); + return new Density(value, DensityUnit.MilligramPerDeciliter); } /// - /// Get Density from MilligramsPerLiter. + /// Get from MilligramsPerLiter. /// /// If value is NaN or Infinity. - public static Density FromMilligramsPerLiter(QuantityValue milligramsperliter) + public static Density FromMilligramsPerLiter(QuantityValue milligramsperliter) { double value = (double) milligramsperliter; - return new Density(value, DensityUnit.MilligramPerLiter); + return new Density(value, DensityUnit.MilligramPerLiter); } /// - /// Get Density from MilligramsPerMilliliter. + /// Get from MilligramsPerMilliliter. /// /// If value is NaN or Infinity. - public static Density FromMilligramsPerMilliliter(QuantityValue milligramspermilliliter) + public static Density FromMilligramsPerMilliliter(QuantityValue milligramspermilliliter) { double value = (double) milligramspermilliliter; - return new Density(value, DensityUnit.MilligramPerMilliliter); + return new Density(value, DensityUnit.MilligramPerMilliliter); } /// - /// Get Density from NanogramsPerDeciLiter. + /// Get from NanogramsPerDeciLiter. /// /// If value is NaN or Infinity. - public static Density FromNanogramsPerDeciLiter(QuantityValue nanogramsperdeciliter) + public static Density FromNanogramsPerDeciLiter(QuantityValue nanogramsperdeciliter) { double value = (double) nanogramsperdeciliter; - return new Density(value, DensityUnit.NanogramPerDeciliter); + return new Density(value, DensityUnit.NanogramPerDeciliter); } /// - /// Get Density from NanogramsPerLiter. + /// Get from NanogramsPerLiter. /// /// If value is NaN or Infinity. - public static Density FromNanogramsPerLiter(QuantityValue nanogramsperliter) + public static Density FromNanogramsPerLiter(QuantityValue nanogramsperliter) { double value = (double) nanogramsperliter; - return new Density(value, DensityUnit.NanogramPerLiter); + return new Density(value, DensityUnit.NanogramPerLiter); } /// - /// Get Density from NanogramsPerMilliliter. + /// Get from NanogramsPerMilliliter. /// /// If value is NaN or Infinity. - public static Density FromNanogramsPerMilliliter(QuantityValue nanogramspermilliliter) + public static Density FromNanogramsPerMilliliter(QuantityValue nanogramspermilliliter) { double value = (double) nanogramspermilliliter; - return new Density(value, DensityUnit.NanogramPerMilliliter); + return new Density(value, DensityUnit.NanogramPerMilliliter); } /// - /// Get Density from PicogramsPerDeciLiter. + /// Get from PicogramsPerDeciLiter. /// /// If value is NaN or Infinity. - public static Density FromPicogramsPerDeciLiter(QuantityValue picogramsperdeciliter) + public static Density FromPicogramsPerDeciLiter(QuantityValue picogramsperdeciliter) { double value = (double) picogramsperdeciliter; - return new Density(value, DensityUnit.PicogramPerDeciliter); + return new Density(value, DensityUnit.PicogramPerDeciliter); } /// - /// Get Density from PicogramsPerLiter. + /// Get from PicogramsPerLiter. /// /// If value is NaN or Infinity. - public static Density FromPicogramsPerLiter(QuantityValue picogramsperliter) + public static Density FromPicogramsPerLiter(QuantityValue picogramsperliter) { double value = (double) picogramsperliter; - return new Density(value, DensityUnit.PicogramPerLiter); + return new Density(value, DensityUnit.PicogramPerLiter); } /// - /// Get Density from PicogramsPerMilliliter. + /// Get from PicogramsPerMilliliter. /// /// If value is NaN or Infinity. - public static Density FromPicogramsPerMilliliter(QuantityValue picogramspermilliliter) + public static Density FromPicogramsPerMilliliter(QuantityValue picogramspermilliliter) { double value = (double) picogramspermilliliter; - return new Density(value, DensityUnit.PicogramPerMilliliter); + return new Density(value, DensityUnit.PicogramPerMilliliter); } /// - /// Get Density from PoundsPerCubicFoot. + /// Get from PoundsPerCubicFoot. /// /// If value is NaN or Infinity. - public static Density FromPoundsPerCubicFoot(QuantityValue poundspercubicfoot) + public static Density FromPoundsPerCubicFoot(QuantityValue poundspercubicfoot) { double value = (double) poundspercubicfoot; - return new Density(value, DensityUnit.PoundPerCubicFoot); + return new Density(value, DensityUnit.PoundPerCubicFoot); } /// - /// Get Density from PoundsPerCubicInch. + /// Get from PoundsPerCubicInch. /// /// If value is NaN or Infinity. - public static Density FromPoundsPerCubicInch(QuantityValue poundspercubicinch) + public static Density FromPoundsPerCubicInch(QuantityValue poundspercubicinch) { double value = (double) poundspercubicinch; - return new Density(value, DensityUnit.PoundPerCubicInch); + return new Density(value, DensityUnit.PoundPerCubicInch); } /// - /// Get Density from PoundsPerImperialGallon. + /// Get from PoundsPerImperialGallon. /// /// If value is NaN or Infinity. - public static Density FromPoundsPerImperialGallon(QuantityValue poundsperimperialgallon) + public static Density FromPoundsPerImperialGallon(QuantityValue poundsperimperialgallon) { double value = (double) poundsperimperialgallon; - return new Density(value, DensityUnit.PoundPerImperialGallon); + return new Density(value, DensityUnit.PoundPerImperialGallon); } /// - /// Get Density from PoundsPerUSGallon. + /// Get from PoundsPerUSGallon. /// /// If value is NaN or Infinity. - public static Density FromPoundsPerUSGallon(QuantityValue poundsperusgallon) + public static Density FromPoundsPerUSGallon(QuantityValue poundsperusgallon) { double value = (double) poundsperusgallon; - return new Density(value, DensityUnit.PoundPerUSGallon); + return new Density(value, DensityUnit.PoundPerUSGallon); } /// - /// Get Density from SlugsPerCubicFoot. + /// Get from SlugsPerCubicFoot. /// /// If value is NaN or Infinity. - public static Density FromSlugsPerCubicFoot(QuantityValue slugspercubicfoot) + public static Density FromSlugsPerCubicFoot(QuantityValue slugspercubicfoot) { double value = (double) slugspercubicfoot; - return new Density(value, DensityUnit.SlugPerCubicFoot); + return new Density(value, DensityUnit.SlugPerCubicFoot); } /// - /// Get Density from TonnesPerCubicCentimeter. + /// Get from TonnesPerCubicCentimeter. /// /// If value is NaN or Infinity. - public static Density FromTonnesPerCubicCentimeter(QuantityValue tonnespercubiccentimeter) + public static Density FromTonnesPerCubicCentimeter(QuantityValue tonnespercubiccentimeter) { double value = (double) tonnespercubiccentimeter; - return new Density(value, DensityUnit.TonnePerCubicCentimeter); + return new Density(value, DensityUnit.TonnePerCubicCentimeter); } /// - /// Get Density from TonnesPerCubicMeter. + /// Get from TonnesPerCubicMeter. /// /// If value is NaN or Infinity. - public static Density FromTonnesPerCubicMeter(QuantityValue tonnespercubicmeter) + public static Density FromTonnesPerCubicMeter(QuantityValue tonnespercubicmeter) { double value = (double) tonnespercubicmeter; - return new Density(value, DensityUnit.TonnePerCubicMeter); + return new Density(value, DensityUnit.TonnePerCubicMeter); } /// - /// Get Density from TonnesPerCubicMillimeter. + /// Get from TonnesPerCubicMillimeter. /// /// If value is NaN or Infinity. - public static Density FromTonnesPerCubicMillimeter(QuantityValue tonnespercubicmillimeter) + public static Density FromTonnesPerCubicMillimeter(QuantityValue tonnespercubicmillimeter) { double value = (double) tonnespercubicmillimeter; - return new Density(value, DensityUnit.TonnePerCubicMillimeter); + return new Density(value, DensityUnit.TonnePerCubicMillimeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Density unit value. - public static Density From(QuantityValue value, DensityUnit fromUnit) + /// unit value. + public static Density From(QuantityValue value, DensityUnit fromUnit) { - return new Density((double)value, fromUnit); + return new Density((double)value, fromUnit); } #endregion @@ -832,7 +832,7 @@ public static Density From(QuantityValue value, DensityUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Density Parse(string str) + public static Density Parse(string str) { return Parse(str, null); } @@ -860,9 +860,9 @@ public static Density Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Density Parse(string str, [CanBeNull] IFormatProvider provider) + public static Density Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, DensityUnit>( str, provider, From); @@ -876,7 +876,7 @@ public static Density Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Density result) + public static bool TryParse([CanBeNull] string str, out Density result) { return TryParse(str, null, out result); } @@ -891,9 +891,9 @@ public static bool TryParse([CanBeNull] string str, out Density result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Density result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Density result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, DensityUnit>( str, provider, From, @@ -955,43 +955,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Densit #region Arithmetic Operators /// Negate the value. - public static Density operator -(Density right) + public static Density operator -(Density right) { - return new Density(-right.Value, right.Unit); + return new Density(-right.Value, right.Unit); } - /// Get from adding two . - public static Density operator +(Density left, Density right) + /// Get from adding two . + public static Density operator +(Density left, Density right) { - return new Density(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Density(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Density operator -(Density left, Density right) + /// Get from subtracting two . + public static Density operator -(Density left, Density right) { - return new Density(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Density(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Density operator *(double left, Density right) + /// Get from multiplying value and . + public static Density operator *(double left, Density right) { - return new Density(left * right.Value, right.Unit); + return new Density(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Density operator *(Density left, double right) + /// Get from multiplying value and . + public static Density operator *(Density left, double right) { - return new Density(left.Value * right, left.Unit); + return new Density(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Density operator /(Density left, double right) + /// Get from dividing by value. + public static Density operator /(Density left, double right) { - return new Density(left.Value / right, left.Unit); + return new Density(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Density left, Density right) + /// Get ratio value from dividing by . + public static double operator /(Density left, Density right) { return left.KilogramsPerCubicMeter / right.KilogramsPerCubicMeter; } @@ -1001,39 +1001,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Densit #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Density left, Density right) + public static bool operator <=(Density left, Density right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Density left, Density right) + public static bool operator >=(Density left, Density right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Density left, Density right) + public static bool operator <(Density left, Density right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Density left, Density right) + public static bool operator >(Density left, Density right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Density left, Density right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Density left, Density right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Density left, Density right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Density left, Density right) { return !(left == right); } @@ -1042,37 +1042,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Densit public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Density objDensity)) throw new ArgumentException("Expected type Density.", nameof(obj)); + if(!(obj is Density objDensity)) throw new ArgumentException("Expected type Density.", nameof(obj)); return CompareTo(objDensity); } /// - public int CompareTo(Density other) + public int CompareTo(Density other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Density objDensity)) + if(obj is null || !(obj is Density objDensity)) return false; return Equals(objDensity); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Density other) + /// Consider using for safely comparing floating point values. + public bool Equals(Density other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Density within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -1110,7 +1110,7 @@ public bool Equals(Density other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Density other, double tolerance, ComparisonType comparisonType) + public bool Equals(Density other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -1124,7 +1124,7 @@ public bool Equals(Density other, double tolerance, ComparisonType comparisonTyp /// /// Returns the hash code for this instance. /// - /// A hash code for the current Density. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -1172,13 +1172,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Density to another Density with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Density with the specified unit. - public Density ToUnit(DensityUnit unit) + /// A with the specified unit. + public Density ToUnit(DensityUnit unit) { var convertedValue = GetValueAs(unit); - return new Density(convertedValue, unit); + return new Density(convertedValue, unit); } /// @@ -1191,7 +1191,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Density ToUnit(UnitSystem unitSystem) + public Density ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1273,10 +1273,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Density ToBaseUnit() + internal Density ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Density(baseUnitValue, BaseUnit); + return new Density(baseUnitValue, BaseUnit); } private double GetValueAs(DensityUnit unit) @@ -1424,7 +1424,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Density)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Density)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1434,12 +1434,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Density)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Density)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Density)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Density)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1484,16 +1484,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Density)) + if(conversionType == typeof(Density)) return this; else if(conversionType == typeof(DensityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Density.QuantityType; + return Density.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Density.BaseDimensions; + return Density.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Density)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Density)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs index 334f988875..1e10964efc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Time is a dimension in which events can be ordered from the past through the present into the future, and also the measure of durations of events and the intervals between them. /// - public partial struct Duration : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Duration : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -109,19 +109,19 @@ public Duration(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Duration, which is Second. All conversions go via this value. + /// The base unit of , which is Second. All conversions go via this value. /// public static DurationUnit BaseUnit { get; } = DurationUnit.Second; /// - /// Represents the largest possible value of Duration + /// Represents the largest possible value of /// - public static Duration MaxValue { get; } = new Duration(double.MaxValue, BaseUnit); + public static Duration MaxValue { get; } = new Duration(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Duration + /// Represents the smallest possible value of /// - public static Duration MinValue { get; } = new Duration(double.MinValue, BaseUnit); + public static Duration MinValue { get; } = new Duration(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -129,14 +129,14 @@ public Duration(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Duration; /// - /// All units of measurement for the Duration quantity. + /// All units of measurement for the quantity. /// public static DurationUnit[] Units { get; } = Enum.GetValues(typeof(DurationUnit)).Cast().Except(new DurationUnit[]{ DurationUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Second. /// - public static Duration Zero { get; } = new Duration(0, BaseUnit); + public static Duration Zero { get; } = new Duration(0, BaseUnit); #endregion @@ -161,64 +161,64 @@ public Duration(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Duration.QuantityType; + public QuantityType Type => Duration.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Duration.BaseDimensions; + public BaseDimensions Dimensions => Duration.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Duration in Days. + /// Get in Days. /// public double Days => As(DurationUnit.Day); /// - /// Get Duration in Hours. + /// Get in Hours. /// public double Hours => As(DurationUnit.Hour); /// - /// Get Duration in Microseconds. + /// Get in Microseconds. /// public double Microseconds => As(DurationUnit.Microsecond); /// - /// Get Duration in Milliseconds. + /// Get in Milliseconds. /// public double Milliseconds => As(DurationUnit.Millisecond); /// - /// Get Duration in Minutes. + /// Get in Minutes. /// public double Minutes => As(DurationUnit.Minute); /// - /// Get Duration in Months30. + /// Get in Months30. /// public double Months30 => As(DurationUnit.Month30); /// - /// Get Duration in Nanoseconds. + /// Get in Nanoseconds. /// public double Nanoseconds => As(DurationUnit.Nanosecond); /// - /// Get Duration in Seconds. + /// Get in Seconds. /// public double Seconds => As(DurationUnit.Second); /// - /// Get Duration in Weeks. + /// Get in Weeks. /// public double Weeks => As(DurationUnit.Week); /// - /// Get Duration in Years365. + /// Get in Years365. /// public double Years365 => As(DurationUnit.Year365); @@ -252,105 +252,105 @@ public static string GetAbbreviation(DurationUnit unit, [CanBeNull] IFormatProvi #region Static Factory Methods /// - /// Get Duration from Days. + /// Get from Days. /// /// If value is NaN or Infinity. - public static Duration FromDays(QuantityValue days) + public static Duration FromDays(QuantityValue days) { double value = (double) days; - return new Duration(value, DurationUnit.Day); + return new Duration(value, DurationUnit.Day); } /// - /// Get Duration from Hours. + /// Get from Hours. /// /// If value is NaN or Infinity. - public static Duration FromHours(QuantityValue hours) + public static Duration FromHours(QuantityValue hours) { double value = (double) hours; - return new Duration(value, DurationUnit.Hour); + return new Duration(value, DurationUnit.Hour); } /// - /// Get Duration from Microseconds. + /// Get from Microseconds. /// /// If value is NaN or Infinity. - public static Duration FromMicroseconds(QuantityValue microseconds) + public static Duration FromMicroseconds(QuantityValue microseconds) { double value = (double) microseconds; - return new Duration(value, DurationUnit.Microsecond); + return new Duration(value, DurationUnit.Microsecond); } /// - /// Get Duration from Milliseconds. + /// Get from Milliseconds. /// /// If value is NaN or Infinity. - public static Duration FromMilliseconds(QuantityValue milliseconds) + public static Duration FromMilliseconds(QuantityValue milliseconds) { double value = (double) milliseconds; - return new Duration(value, DurationUnit.Millisecond); + return new Duration(value, DurationUnit.Millisecond); } /// - /// Get Duration from Minutes. + /// Get from Minutes. /// /// If value is NaN or Infinity. - public static Duration FromMinutes(QuantityValue minutes) + public static Duration FromMinutes(QuantityValue minutes) { double value = (double) minutes; - return new Duration(value, DurationUnit.Minute); + return new Duration(value, DurationUnit.Minute); } /// - /// Get Duration from Months30. + /// Get from Months30. /// /// If value is NaN or Infinity. - public static Duration FromMonths30(QuantityValue months30) + public static Duration FromMonths30(QuantityValue months30) { double value = (double) months30; - return new Duration(value, DurationUnit.Month30); + return new Duration(value, DurationUnit.Month30); } /// - /// Get Duration from Nanoseconds. + /// Get from Nanoseconds. /// /// If value is NaN or Infinity. - public static Duration FromNanoseconds(QuantityValue nanoseconds) + public static Duration FromNanoseconds(QuantityValue nanoseconds) { double value = (double) nanoseconds; - return new Duration(value, DurationUnit.Nanosecond); + return new Duration(value, DurationUnit.Nanosecond); } /// - /// Get Duration from Seconds. + /// Get from Seconds. /// /// If value is NaN or Infinity. - public static Duration FromSeconds(QuantityValue seconds) + public static Duration FromSeconds(QuantityValue seconds) { double value = (double) seconds; - return new Duration(value, DurationUnit.Second); + return new Duration(value, DurationUnit.Second); } /// - /// Get Duration from Weeks. + /// Get from Weeks. /// /// If value is NaN or Infinity. - public static Duration FromWeeks(QuantityValue weeks) + public static Duration FromWeeks(QuantityValue weeks) { double value = (double) weeks; - return new Duration(value, DurationUnit.Week); + return new Duration(value, DurationUnit.Week); } /// - /// Get Duration from Years365. + /// Get from Years365. /// /// If value is NaN or Infinity. - public static Duration FromYears365(QuantityValue years365) + public static Duration FromYears365(QuantityValue years365) { double value = (double) years365; - return new Duration(value, DurationUnit.Year365); + return new Duration(value, DurationUnit.Year365); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Duration unit value. - public static Duration From(QuantityValue value, DurationUnit fromUnit) + /// unit value. + public static Duration From(QuantityValue value, DurationUnit fromUnit) { - return new Duration((double)value, fromUnit); + return new Duration((double)value, fromUnit); } #endregion @@ -379,7 +379,7 @@ public static Duration From(QuantityValue value, DurationUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Duration Parse(string str) + public static Duration Parse(string str) { return Parse(str, null); } @@ -407,9 +407,9 @@ public static Duration Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Duration Parse(string str, [CanBeNull] IFormatProvider provider) + public static Duration Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, DurationUnit>( str, provider, From); @@ -423,7 +423,7 @@ public static Duration Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Duration result) + public static bool TryParse([CanBeNull] string str, out Duration result) { return TryParse(str, null, out result); } @@ -438,9 +438,9 @@ public static bool TryParse([CanBeNull] string str, out Duration result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Duration result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Duration result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, DurationUnit>( str, provider, From, @@ -502,43 +502,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Durati #region Arithmetic Operators /// Negate the value. - public static Duration operator -(Duration right) + public static Duration operator -(Duration right) { - return new Duration(-right.Value, right.Unit); + return new Duration(-right.Value, right.Unit); } - /// Get from adding two . - public static Duration operator +(Duration left, Duration right) + /// Get from adding two . + public static Duration operator +(Duration left, Duration right) { - return new Duration(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Duration(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Duration operator -(Duration left, Duration right) + /// Get from subtracting two . + public static Duration operator -(Duration left, Duration right) { - return new Duration(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Duration(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Duration operator *(double left, Duration right) + /// Get from multiplying value and . + public static Duration operator *(double left, Duration right) { - return new Duration(left * right.Value, right.Unit); + return new Duration(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Duration operator *(Duration left, double right) + /// Get from multiplying value and . + public static Duration operator *(Duration left, double right) { - return new Duration(left.Value * right, left.Unit); + return new Duration(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Duration operator /(Duration left, double right) + /// Get from dividing by value. + public static Duration operator /(Duration left, double right) { - return new Duration(left.Value / right, left.Unit); + return new Duration(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Duration left, Duration right) + /// Get ratio value from dividing by . + public static double operator /(Duration left, Duration right) { return left.Seconds / right.Seconds; } @@ -548,39 +548,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Durati #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Duration left, Duration right) + public static bool operator <=(Duration left, Duration right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Duration left, Duration right) + public static bool operator >=(Duration left, Duration right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Duration left, Duration right) + public static bool operator <(Duration left, Duration right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Duration left, Duration right) + public static bool operator >(Duration left, Duration right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Duration left, Duration right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Duration left, Duration right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Duration left, Duration right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Duration left, Duration right) { return !(left == right); } @@ -589,37 +589,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Durati public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Duration objDuration)) throw new ArgumentException("Expected type Duration.", nameof(obj)); + if(!(obj is Duration objDuration)) throw new ArgumentException("Expected type Duration.", nameof(obj)); return CompareTo(objDuration); } /// - public int CompareTo(Duration other) + public int CompareTo(Duration other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Duration objDuration)) + if(obj is null || !(obj is Duration objDuration)) return false; return Equals(objDuration); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Duration other) + /// Consider using for safely comparing floating point values. + public bool Equals(Duration other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Duration within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -657,7 +657,7 @@ public bool Equals(Duration other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Duration other, double tolerance, ComparisonType comparisonType) + public bool Equals(Duration other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -671,7 +671,7 @@ public bool Equals(Duration other, double tolerance, ComparisonType comparisonTy /// /// Returns the hash code for this instance. /// - /// A hash code for the current Duration. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -719,13 +719,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Duration to another Duration with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Duration with the specified unit. - public Duration ToUnit(DurationUnit unit) + /// A with the specified unit. + public Duration ToUnit(DurationUnit unit) { var convertedValue = GetValueAs(unit); - return new Duration(convertedValue, unit); + return new Duration(convertedValue, unit); } /// @@ -738,7 +738,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Duration ToUnit(UnitSystem unitSystem) + public Duration ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -790,10 +790,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Duration ToBaseUnit() + internal Duration ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Duration(baseUnitValue, BaseUnit); + return new Duration(baseUnitValue, BaseUnit); } private double GetValueAs(DurationUnit unit) @@ -911,7 +911,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Duration)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Duration)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -921,12 +921,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Duration)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Duration)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Duration)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Duration)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -971,16 +971,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Duration)) + if(conversionType == typeof(Duration)) return this; else if(conversionType == typeof(DurationUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Duration.QuantityType; + return Duration.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Duration.BaseDimensions; + return Duration.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Duration)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Duration)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs index 4c734b5014..08094192af 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Viscosity#Dynamic_.28shear.29_viscosity /// - public partial struct DynamicViscosity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct DynamicViscosity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -111,19 +111,19 @@ public DynamicViscosity(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of DynamicViscosity, which is NewtonSecondPerMeterSquared. All conversions go via this value. + /// The base unit of , which is NewtonSecondPerMeterSquared. All conversions go via this value. /// public static DynamicViscosityUnit BaseUnit { get; } = DynamicViscosityUnit.NewtonSecondPerMeterSquared; /// - /// Represents the largest possible value of DynamicViscosity + /// Represents the largest possible value of /// - public static DynamicViscosity MaxValue { get; } = new DynamicViscosity(double.MaxValue, BaseUnit); + public static DynamicViscosity MaxValue { get; } = new DynamicViscosity(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of DynamicViscosity + /// Represents the smallest possible value of /// - public static DynamicViscosity MinValue { get; } = new DynamicViscosity(double.MinValue, BaseUnit); + public static DynamicViscosity MinValue { get; } = new DynamicViscosity(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -131,14 +131,14 @@ public DynamicViscosity(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.DynamicViscosity; /// - /// All units of measurement for the DynamicViscosity quantity. + /// All units of measurement for the quantity. /// public static DynamicViscosityUnit[] Units { get; } = Enum.GetValues(typeof(DynamicViscosityUnit)).Cast().Except(new DynamicViscosityUnit[]{ DynamicViscosityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonSecondPerMeterSquared. /// - public static DynamicViscosity Zero { get; } = new DynamicViscosity(0, BaseUnit); + public static DynamicViscosity Zero { get; } = new DynamicViscosity(0, BaseUnit); #endregion @@ -163,59 +163,59 @@ public DynamicViscosity(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => DynamicViscosity.QuantityType; + public QuantityType Type => DynamicViscosity.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => DynamicViscosity.BaseDimensions; + public BaseDimensions Dimensions => DynamicViscosity.BaseDimensions; #endregion #region Conversion Properties /// - /// Get DynamicViscosity in Centipoise. + /// Get in Centipoise. /// public double Centipoise => As(DynamicViscosityUnit.Centipoise); /// - /// Get DynamicViscosity in MicropascalSeconds. + /// Get in MicropascalSeconds. /// public double MicropascalSeconds => As(DynamicViscosityUnit.MicropascalSecond); /// - /// Get DynamicViscosity in MillipascalSeconds. + /// Get in MillipascalSeconds. /// public double MillipascalSeconds => As(DynamicViscosityUnit.MillipascalSecond); /// - /// Get DynamicViscosity in NewtonSecondsPerMeterSquared. + /// Get in NewtonSecondsPerMeterSquared. /// public double NewtonSecondsPerMeterSquared => As(DynamicViscosityUnit.NewtonSecondPerMeterSquared); /// - /// Get DynamicViscosity in PascalSeconds. + /// Get in PascalSeconds. /// public double PascalSeconds => As(DynamicViscosityUnit.PascalSecond); /// - /// Get DynamicViscosity in Poise. + /// Get in Poise. /// public double Poise => As(DynamicViscosityUnit.Poise); /// - /// Get DynamicViscosity in PoundsForceSecondPerSquareFoot. + /// Get in PoundsForceSecondPerSquareFoot. /// public double PoundsForceSecondPerSquareFoot => As(DynamicViscosityUnit.PoundForceSecondPerSquareFoot); /// - /// Get DynamicViscosity in PoundsForceSecondPerSquareInch. + /// Get in PoundsForceSecondPerSquareInch. /// public double PoundsForceSecondPerSquareInch => As(DynamicViscosityUnit.PoundForceSecondPerSquareInch); /// - /// Get DynamicViscosity in Reyns. + /// Get in Reyns. /// public double Reyns => As(DynamicViscosityUnit.Reyn); @@ -249,96 +249,96 @@ public static string GetAbbreviation(DynamicViscosityUnit unit, [CanBeNull] IFor #region Static Factory Methods /// - /// Get DynamicViscosity from Centipoise. + /// Get from Centipoise. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromCentipoise(QuantityValue centipoise) + public static DynamicViscosity FromCentipoise(QuantityValue centipoise) { double value = (double) centipoise; - return new DynamicViscosity(value, DynamicViscosityUnit.Centipoise); + return new DynamicViscosity(value, DynamicViscosityUnit.Centipoise); } /// - /// Get DynamicViscosity from MicropascalSeconds. + /// Get from MicropascalSeconds. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromMicropascalSeconds(QuantityValue micropascalseconds) + public static DynamicViscosity FromMicropascalSeconds(QuantityValue micropascalseconds) { double value = (double) micropascalseconds; - return new DynamicViscosity(value, DynamicViscosityUnit.MicropascalSecond); + return new DynamicViscosity(value, DynamicViscosityUnit.MicropascalSecond); } /// - /// Get DynamicViscosity from MillipascalSeconds. + /// Get from MillipascalSeconds. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromMillipascalSeconds(QuantityValue millipascalseconds) + public static DynamicViscosity FromMillipascalSeconds(QuantityValue millipascalseconds) { double value = (double) millipascalseconds; - return new DynamicViscosity(value, DynamicViscosityUnit.MillipascalSecond); + return new DynamicViscosity(value, DynamicViscosityUnit.MillipascalSecond); } /// - /// Get DynamicViscosity from NewtonSecondsPerMeterSquared. + /// Get from NewtonSecondsPerMeterSquared. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromNewtonSecondsPerMeterSquared(QuantityValue newtonsecondspermetersquared) + public static DynamicViscosity FromNewtonSecondsPerMeterSquared(QuantityValue newtonsecondspermetersquared) { double value = (double) newtonsecondspermetersquared; - return new DynamicViscosity(value, DynamicViscosityUnit.NewtonSecondPerMeterSquared); + return new DynamicViscosity(value, DynamicViscosityUnit.NewtonSecondPerMeterSquared); } /// - /// Get DynamicViscosity from PascalSeconds. + /// Get from PascalSeconds. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromPascalSeconds(QuantityValue pascalseconds) + public static DynamicViscosity FromPascalSeconds(QuantityValue pascalseconds) { double value = (double) pascalseconds; - return new DynamicViscosity(value, DynamicViscosityUnit.PascalSecond); + return new DynamicViscosity(value, DynamicViscosityUnit.PascalSecond); } /// - /// Get DynamicViscosity from Poise. + /// Get from Poise. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromPoise(QuantityValue poise) + public static DynamicViscosity FromPoise(QuantityValue poise) { double value = (double) poise; - return new DynamicViscosity(value, DynamicViscosityUnit.Poise); + return new DynamicViscosity(value, DynamicViscosityUnit.Poise); } /// - /// Get DynamicViscosity from PoundsForceSecondPerSquareFoot. + /// Get from PoundsForceSecondPerSquareFoot. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromPoundsForceSecondPerSquareFoot(QuantityValue poundsforcesecondpersquarefoot) + public static DynamicViscosity FromPoundsForceSecondPerSquareFoot(QuantityValue poundsforcesecondpersquarefoot) { double value = (double) poundsforcesecondpersquarefoot; - return new DynamicViscosity(value, DynamicViscosityUnit.PoundForceSecondPerSquareFoot); + return new DynamicViscosity(value, DynamicViscosityUnit.PoundForceSecondPerSquareFoot); } /// - /// Get DynamicViscosity from PoundsForceSecondPerSquareInch. + /// Get from PoundsForceSecondPerSquareInch. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromPoundsForceSecondPerSquareInch(QuantityValue poundsforcesecondpersquareinch) + public static DynamicViscosity FromPoundsForceSecondPerSquareInch(QuantityValue poundsforcesecondpersquareinch) { double value = (double) poundsforcesecondpersquareinch; - return new DynamicViscosity(value, DynamicViscosityUnit.PoundForceSecondPerSquareInch); + return new DynamicViscosity(value, DynamicViscosityUnit.PoundForceSecondPerSquareInch); } /// - /// Get DynamicViscosity from Reyns. + /// Get from Reyns. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromReyns(QuantityValue reyns) + public static DynamicViscosity FromReyns(QuantityValue reyns) { double value = (double) reyns; - return new DynamicViscosity(value, DynamicViscosityUnit.Reyn); + return new DynamicViscosity(value, DynamicViscosityUnit.Reyn); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// DynamicViscosity unit value. - public static DynamicViscosity From(QuantityValue value, DynamicViscosityUnit fromUnit) + /// unit value. + public static DynamicViscosity From(QuantityValue value, DynamicViscosityUnit fromUnit) { - return new DynamicViscosity((double)value, fromUnit); + return new DynamicViscosity((double)value, fromUnit); } #endregion @@ -367,7 +367,7 @@ public static DynamicViscosity From(QuantityValue value, DynamicViscosityUnit fr /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static DynamicViscosity Parse(string str) + public static DynamicViscosity Parse(string str) { return Parse(str, null); } @@ -395,9 +395,9 @@ public static DynamicViscosity Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static DynamicViscosity Parse(string str, [CanBeNull] IFormatProvider provider) + public static DynamicViscosity Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, DynamicViscosityUnit>( str, provider, From); @@ -411,7 +411,7 @@ public static DynamicViscosity Parse(string str, [CanBeNull] IFormatProvider pro /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out DynamicViscosity result) + public static bool TryParse([CanBeNull] string str, out DynamicViscosity result) { return TryParse(str, null, out result); } @@ -426,9 +426,9 @@ public static bool TryParse([CanBeNull] string str, out DynamicViscosity result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out DynamicViscosity result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out DynamicViscosity result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, DynamicViscosityUnit>( str, provider, From, @@ -490,43 +490,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Dynami #region Arithmetic Operators /// Negate the value. - public static DynamicViscosity operator -(DynamicViscosity right) + public static DynamicViscosity operator -(DynamicViscosity right) { - return new DynamicViscosity(-right.Value, right.Unit); + return new DynamicViscosity(-right.Value, right.Unit); } - /// Get from adding two . - public static DynamicViscosity operator +(DynamicViscosity left, DynamicViscosity right) + /// Get from adding two . + public static DynamicViscosity operator +(DynamicViscosity left, DynamicViscosity right) { - return new DynamicViscosity(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new DynamicViscosity(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static DynamicViscosity operator -(DynamicViscosity left, DynamicViscosity right) + /// Get from subtracting two . + public static DynamicViscosity operator -(DynamicViscosity left, DynamicViscosity right) { - return new DynamicViscosity(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new DynamicViscosity(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static DynamicViscosity operator *(double left, DynamicViscosity right) + /// Get from multiplying value and . + public static DynamicViscosity operator *(double left, DynamicViscosity right) { - return new DynamicViscosity(left * right.Value, right.Unit); + return new DynamicViscosity(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static DynamicViscosity operator *(DynamicViscosity left, double right) + /// Get from multiplying value and . + public static DynamicViscosity operator *(DynamicViscosity left, double right) { - return new DynamicViscosity(left.Value * right, left.Unit); + return new DynamicViscosity(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static DynamicViscosity operator /(DynamicViscosity left, double right) + /// Get from dividing by value. + public static DynamicViscosity operator /(DynamicViscosity left, double right) { - return new DynamicViscosity(left.Value / right, left.Unit); + return new DynamicViscosity(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(DynamicViscosity left, DynamicViscosity right) + /// Get ratio value from dividing by . + public static double operator /(DynamicViscosity left, DynamicViscosity right) { return left.NewtonSecondsPerMeterSquared / right.NewtonSecondsPerMeterSquared; } @@ -536,39 +536,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Dynami #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(DynamicViscosity left, DynamicViscosity right) + public static bool operator <=(DynamicViscosity left, DynamicViscosity right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(DynamicViscosity left, DynamicViscosity right) + public static bool operator >=(DynamicViscosity left, DynamicViscosity right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(DynamicViscosity left, DynamicViscosity right) + public static bool operator <(DynamicViscosity left, DynamicViscosity right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(DynamicViscosity left, DynamicViscosity right) + public static bool operator >(DynamicViscosity left, DynamicViscosity right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(DynamicViscosity left, DynamicViscosity right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(DynamicViscosity left, DynamicViscosity right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(DynamicViscosity left, DynamicViscosity right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(DynamicViscosity left, DynamicViscosity right) { return !(left == right); } @@ -577,37 +577,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Dynami public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is DynamicViscosity objDynamicViscosity)) throw new ArgumentException("Expected type DynamicViscosity.", nameof(obj)); + if(!(obj is DynamicViscosity objDynamicViscosity)) throw new ArgumentException("Expected type DynamicViscosity.", nameof(obj)); return CompareTo(objDynamicViscosity); } /// - public int CompareTo(DynamicViscosity other) + public int CompareTo(DynamicViscosity other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is DynamicViscosity objDynamicViscosity)) + if(obj is null || !(obj is DynamicViscosity objDynamicViscosity)) return false; return Equals(objDynamicViscosity); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(DynamicViscosity other) + /// Consider using for safely comparing floating point values. + public bool Equals(DynamicViscosity other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another DynamicViscosity within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -645,7 +645,7 @@ public bool Equals(DynamicViscosity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(DynamicViscosity other, double tolerance, ComparisonType comparisonType) + public bool Equals(DynamicViscosity other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -659,7 +659,7 @@ public bool Equals(DynamicViscosity other, double tolerance, ComparisonType comp /// /// Returns the hash code for this instance. /// - /// A hash code for the current DynamicViscosity. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -707,13 +707,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this DynamicViscosity to another DynamicViscosity with the unit representation . + /// Converts this to another with the unit representation . /// - /// A DynamicViscosity with the specified unit. - public DynamicViscosity ToUnit(DynamicViscosityUnit unit) + /// A with the specified unit. + public DynamicViscosity ToUnit(DynamicViscosityUnit unit) { var convertedValue = GetValueAs(unit); - return new DynamicViscosity(convertedValue, unit); + return new DynamicViscosity(convertedValue, unit); } /// @@ -726,7 +726,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public DynamicViscosity ToUnit(UnitSystem unitSystem) + public DynamicViscosity ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -777,10 +777,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal DynamicViscosity ToBaseUnit() + internal DynamicViscosity ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new DynamicViscosity(baseUnitValue, BaseUnit); + return new DynamicViscosity(baseUnitValue, BaseUnit); } private double GetValueAs(DynamicViscosityUnit unit) @@ -897,7 +897,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -907,12 +907,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -957,16 +957,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(DynamicViscosity)) + if(conversionType == typeof(DynamicViscosity)) return this; else if(conversionType == typeof(DynamicViscosityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return DynamicViscosity.QuantityType; + return DynamicViscosity.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return DynamicViscosity.BaseDimensions; + return DynamicViscosity.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs index 7fea23f989..ed0322de95 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Electric admittance is a measure of how easily a circuit or device will allow a current to flow. It is defined as the inverse of impedance. The SI unit of admittance is the siemens (symbol S). /// - public partial struct ElectricAdmittance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ElectricAdmittance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -103,19 +103,19 @@ public ElectricAdmittance(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ElectricAdmittance, which is Siemens. All conversions go via this value. + /// The base unit of , which is Siemens. All conversions go via this value. /// public static ElectricAdmittanceUnit BaseUnit { get; } = ElectricAdmittanceUnit.Siemens; /// - /// Represents the largest possible value of ElectricAdmittance + /// Represents the largest possible value of /// - public static ElectricAdmittance MaxValue { get; } = new ElectricAdmittance(double.MaxValue, BaseUnit); + public static ElectricAdmittance MaxValue { get; } = new ElectricAdmittance(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ElectricAdmittance + /// Represents the smallest possible value of /// - public static ElectricAdmittance MinValue { get; } = new ElectricAdmittance(double.MinValue, BaseUnit); + public static ElectricAdmittance MinValue { get; } = new ElectricAdmittance(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -123,14 +123,14 @@ public ElectricAdmittance(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ElectricAdmittance; /// - /// All units of measurement for the ElectricAdmittance quantity. + /// All units of measurement for the quantity. /// public static ElectricAdmittanceUnit[] Units { get; } = Enum.GetValues(typeof(ElectricAdmittanceUnit)).Cast().Except(new ElectricAdmittanceUnit[]{ ElectricAdmittanceUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Siemens. /// - public static ElectricAdmittance Zero { get; } = new ElectricAdmittance(0, BaseUnit); + public static ElectricAdmittance Zero { get; } = new ElectricAdmittance(0, BaseUnit); #endregion @@ -155,34 +155,34 @@ public ElectricAdmittance(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ElectricAdmittance.QuantityType; + public QuantityType Type => ElectricAdmittance.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ElectricAdmittance.BaseDimensions; + public BaseDimensions Dimensions => ElectricAdmittance.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ElectricAdmittance in Microsiemens. + /// Get in Microsiemens. /// public double Microsiemens => As(ElectricAdmittanceUnit.Microsiemens); /// - /// Get ElectricAdmittance in Millisiemens. + /// Get in Millisiemens. /// public double Millisiemens => As(ElectricAdmittanceUnit.Millisiemens); /// - /// Get ElectricAdmittance in Nanosiemens. + /// Get in Nanosiemens. /// public double Nanosiemens => As(ElectricAdmittanceUnit.Nanosiemens); /// - /// Get ElectricAdmittance in Siemens. + /// Get in Siemens. /// public double Siemens => As(ElectricAdmittanceUnit.Siemens); @@ -216,51 +216,51 @@ public static string GetAbbreviation(ElectricAdmittanceUnit unit, [CanBeNull] IF #region Static Factory Methods /// - /// Get ElectricAdmittance from Microsiemens. + /// Get from Microsiemens. /// /// If value is NaN or Infinity. - public static ElectricAdmittance FromMicrosiemens(QuantityValue microsiemens) + public static ElectricAdmittance FromMicrosiemens(QuantityValue microsiemens) { double value = (double) microsiemens; - return new ElectricAdmittance(value, ElectricAdmittanceUnit.Microsiemens); + return new ElectricAdmittance(value, ElectricAdmittanceUnit.Microsiemens); } /// - /// Get ElectricAdmittance from Millisiemens. + /// Get from Millisiemens. /// /// If value is NaN or Infinity. - public static ElectricAdmittance FromMillisiemens(QuantityValue millisiemens) + public static ElectricAdmittance FromMillisiemens(QuantityValue millisiemens) { double value = (double) millisiemens; - return new ElectricAdmittance(value, ElectricAdmittanceUnit.Millisiemens); + return new ElectricAdmittance(value, ElectricAdmittanceUnit.Millisiemens); } /// - /// Get ElectricAdmittance from Nanosiemens. + /// Get from Nanosiemens. /// /// If value is NaN or Infinity. - public static ElectricAdmittance FromNanosiemens(QuantityValue nanosiemens) + public static ElectricAdmittance FromNanosiemens(QuantityValue nanosiemens) { double value = (double) nanosiemens; - return new ElectricAdmittance(value, ElectricAdmittanceUnit.Nanosiemens); + return new ElectricAdmittance(value, ElectricAdmittanceUnit.Nanosiemens); } /// - /// Get ElectricAdmittance from Siemens. + /// Get from Siemens. /// /// If value is NaN or Infinity. - public static ElectricAdmittance FromSiemens(QuantityValue siemens) + public static ElectricAdmittance FromSiemens(QuantityValue siemens) { double value = (double) siemens; - return new ElectricAdmittance(value, ElectricAdmittanceUnit.Siemens); + return new ElectricAdmittance(value, ElectricAdmittanceUnit.Siemens); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ElectricAdmittance unit value. - public static ElectricAdmittance From(QuantityValue value, ElectricAdmittanceUnit fromUnit) + /// unit value. + public static ElectricAdmittance From(QuantityValue value, ElectricAdmittanceUnit fromUnit) { - return new ElectricAdmittance((double)value, fromUnit); + return new ElectricAdmittance((double)value, fromUnit); } #endregion @@ -289,7 +289,7 @@ public static ElectricAdmittance From(QuantityValue value, ElectricAdmittanceUni /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ElectricAdmittance Parse(string str) + public static ElectricAdmittance Parse(string str) { return Parse(str, null); } @@ -317,9 +317,9 @@ public static ElectricAdmittance Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ElectricAdmittance Parse(string str, [CanBeNull] IFormatProvider provider) + public static ElectricAdmittance Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ElectricAdmittanceUnit>( str, provider, From); @@ -333,7 +333,7 @@ public static ElectricAdmittance Parse(string str, [CanBeNull] IFormatProvider p /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ElectricAdmittance result) + public static bool TryParse([CanBeNull] string str, out ElectricAdmittance result) { return TryParse(str, null, out result); } @@ -348,9 +348,9 @@ public static bool TryParse([CanBeNull] string str, out ElectricAdmittance resul /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricAdmittance result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricAdmittance result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ElectricAdmittanceUnit>( str, provider, From, @@ -412,43 +412,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Arithmetic Operators /// Negate the value. - public static ElectricAdmittance operator -(ElectricAdmittance right) + public static ElectricAdmittance operator -(ElectricAdmittance right) { - return new ElectricAdmittance(-right.Value, right.Unit); + return new ElectricAdmittance(-right.Value, right.Unit); } - /// Get from adding two . - public static ElectricAdmittance operator +(ElectricAdmittance left, ElectricAdmittance right) + /// Get from adding two . + public static ElectricAdmittance operator +(ElectricAdmittance left, ElectricAdmittance right) { - return new ElectricAdmittance(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ElectricAdmittance(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ElectricAdmittance operator -(ElectricAdmittance left, ElectricAdmittance right) + /// Get from subtracting two . + public static ElectricAdmittance operator -(ElectricAdmittance left, ElectricAdmittance right) { - return new ElectricAdmittance(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ElectricAdmittance(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ElectricAdmittance operator *(double left, ElectricAdmittance right) + /// Get from multiplying value and . + public static ElectricAdmittance operator *(double left, ElectricAdmittance right) { - return new ElectricAdmittance(left * right.Value, right.Unit); + return new ElectricAdmittance(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ElectricAdmittance operator *(ElectricAdmittance left, double right) + /// Get from multiplying value and . + public static ElectricAdmittance operator *(ElectricAdmittance left, double right) { - return new ElectricAdmittance(left.Value * right, left.Unit); + return new ElectricAdmittance(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ElectricAdmittance operator /(ElectricAdmittance left, double right) + /// Get from dividing by value. + public static ElectricAdmittance operator /(ElectricAdmittance left, double right) { - return new ElectricAdmittance(left.Value / right, left.Unit); + return new ElectricAdmittance(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ElectricAdmittance left, ElectricAdmittance right) + /// Get ratio value from dividing by . + public static double operator /(ElectricAdmittance left, ElectricAdmittance right) { return left.Siemens / right.Siemens; } @@ -458,39 +458,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ElectricAdmittance left, ElectricAdmittance right) + public static bool operator <=(ElectricAdmittance left, ElectricAdmittance right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ElectricAdmittance left, ElectricAdmittance right) + public static bool operator >=(ElectricAdmittance left, ElectricAdmittance right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ElectricAdmittance left, ElectricAdmittance right) + public static bool operator <(ElectricAdmittance left, ElectricAdmittance right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ElectricAdmittance left, ElectricAdmittance right) + public static bool operator >(ElectricAdmittance left, ElectricAdmittance right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ElectricAdmittance left, ElectricAdmittance right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ElectricAdmittance left, ElectricAdmittance right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ElectricAdmittance left, ElectricAdmittance right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ElectricAdmittance left, ElectricAdmittance right) { return !(left == right); } @@ -499,37 +499,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricAdmittance objElectricAdmittance)) throw new ArgumentException("Expected type ElectricAdmittance.", nameof(obj)); + if(!(obj is ElectricAdmittance objElectricAdmittance)) throw new ArgumentException("Expected type ElectricAdmittance.", nameof(obj)); return CompareTo(objElectricAdmittance); } /// - public int CompareTo(ElectricAdmittance other) + public int CompareTo(ElectricAdmittance other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricAdmittance objElectricAdmittance)) + if(obj is null || !(obj is ElectricAdmittance objElectricAdmittance)) return false; return Equals(objElectricAdmittance); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ElectricAdmittance other) + /// Consider using for safely comparing floating point values. + public bool Equals(ElectricAdmittance other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ElectricAdmittance within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -567,7 +567,7 @@ public bool Equals(ElectricAdmittance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricAdmittance other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricAdmittance other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -581,7 +581,7 @@ public bool Equals(ElectricAdmittance other, double tolerance, ComparisonType co /// /// Returns the hash code for this instance. /// - /// A hash code for the current ElectricAdmittance. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -629,13 +629,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ElectricAdmittance to another ElectricAdmittance with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ElectricAdmittance with the specified unit. - public ElectricAdmittance ToUnit(ElectricAdmittanceUnit unit) + /// A with the specified unit. + public ElectricAdmittance ToUnit(ElectricAdmittanceUnit unit) { var convertedValue = GetValueAs(unit); - return new ElectricAdmittance(convertedValue, unit); + return new ElectricAdmittance(convertedValue, unit); } /// @@ -648,7 +648,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ElectricAdmittance ToUnit(UnitSystem unitSystem) + public ElectricAdmittance ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -694,10 +694,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ElectricAdmittance ToBaseUnit() + internal ElectricAdmittance ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ElectricAdmittance(baseUnitValue, BaseUnit); + return new ElectricAdmittance(baseUnitValue, BaseUnit); } private double GetValueAs(ElectricAdmittanceUnit unit) @@ -809,7 +809,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -819,12 +819,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -869,16 +869,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricAdmittance)) + if(conversionType == typeof(ElectricAdmittance)) return this; else if(conversionType == typeof(ElectricAdmittanceUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ElectricAdmittance.QuantityType; + return ElectricAdmittance.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ElectricAdmittance.BaseDimensions; + return ElectricAdmittance.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs index 9d06a5e7f1..9fdba3f32b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electric_charge /// - public partial struct ElectricCharge : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ElectricCharge : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -107,19 +107,19 @@ public ElectricCharge(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ElectricCharge, which is Coulomb. All conversions go via this value. + /// The base unit of , which is Coulomb. All conversions go via this value. /// public static ElectricChargeUnit BaseUnit { get; } = ElectricChargeUnit.Coulomb; /// - /// Represents the largest possible value of ElectricCharge + /// Represents the largest possible value of /// - public static ElectricCharge MaxValue { get; } = new ElectricCharge(double.MaxValue, BaseUnit); + public static ElectricCharge MaxValue { get; } = new ElectricCharge(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ElectricCharge + /// Represents the smallest possible value of /// - public static ElectricCharge MinValue { get; } = new ElectricCharge(double.MinValue, BaseUnit); + public static ElectricCharge MinValue { get; } = new ElectricCharge(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -127,14 +127,14 @@ public ElectricCharge(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ElectricCharge; /// - /// All units of measurement for the ElectricCharge quantity. + /// All units of measurement for the quantity. /// public static ElectricChargeUnit[] Units { get; } = Enum.GetValues(typeof(ElectricChargeUnit)).Cast().Except(new ElectricChargeUnit[]{ ElectricChargeUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Coulomb. /// - public static ElectricCharge Zero { get; } = new ElectricCharge(0, BaseUnit); + public static ElectricCharge Zero { get; } = new ElectricCharge(0, BaseUnit); #endregion @@ -159,39 +159,39 @@ public ElectricCharge(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ElectricCharge.QuantityType; + public QuantityType Type => ElectricCharge.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ElectricCharge.BaseDimensions; + public BaseDimensions Dimensions => ElectricCharge.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ElectricCharge in AmpereHours. + /// Get in AmpereHours. /// public double AmpereHours => As(ElectricChargeUnit.AmpereHour); /// - /// Get ElectricCharge in Coulombs. + /// Get in Coulombs. /// public double Coulombs => As(ElectricChargeUnit.Coulomb); /// - /// Get ElectricCharge in KiloampereHours. + /// Get in KiloampereHours. /// public double KiloampereHours => As(ElectricChargeUnit.KiloampereHour); /// - /// Get ElectricCharge in MegaampereHours. + /// Get in MegaampereHours. /// public double MegaampereHours => As(ElectricChargeUnit.MegaampereHour); /// - /// Get ElectricCharge in MilliampereHours. + /// Get in MilliampereHours. /// public double MilliampereHours => As(ElectricChargeUnit.MilliampereHour); @@ -225,60 +225,60 @@ public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] IForma #region Static Factory Methods /// - /// Get ElectricCharge from AmpereHours. + /// Get from AmpereHours. /// /// If value is NaN or Infinity. - public static ElectricCharge FromAmpereHours(QuantityValue amperehours) + public static ElectricCharge FromAmpereHours(QuantityValue amperehours) { double value = (double) amperehours; - return new ElectricCharge(value, ElectricChargeUnit.AmpereHour); + return new ElectricCharge(value, ElectricChargeUnit.AmpereHour); } /// - /// Get ElectricCharge from Coulombs. + /// Get from Coulombs. /// /// If value is NaN or Infinity. - public static ElectricCharge FromCoulombs(QuantityValue coulombs) + public static ElectricCharge FromCoulombs(QuantityValue coulombs) { double value = (double) coulombs; - return new ElectricCharge(value, ElectricChargeUnit.Coulomb); + return new ElectricCharge(value, ElectricChargeUnit.Coulomb); } /// - /// Get ElectricCharge from KiloampereHours. + /// Get from KiloampereHours. /// /// If value is NaN or Infinity. - public static ElectricCharge FromKiloampereHours(QuantityValue kiloamperehours) + public static ElectricCharge FromKiloampereHours(QuantityValue kiloamperehours) { double value = (double) kiloamperehours; - return new ElectricCharge(value, ElectricChargeUnit.KiloampereHour); + return new ElectricCharge(value, ElectricChargeUnit.KiloampereHour); } /// - /// Get ElectricCharge from MegaampereHours. + /// Get from MegaampereHours. /// /// If value is NaN or Infinity. - public static ElectricCharge FromMegaampereHours(QuantityValue megaamperehours) + public static ElectricCharge FromMegaampereHours(QuantityValue megaamperehours) { double value = (double) megaamperehours; - return new ElectricCharge(value, ElectricChargeUnit.MegaampereHour); + return new ElectricCharge(value, ElectricChargeUnit.MegaampereHour); } /// - /// Get ElectricCharge from MilliampereHours. + /// Get from MilliampereHours. /// /// If value is NaN or Infinity. - public static ElectricCharge FromMilliampereHours(QuantityValue milliamperehours) + public static ElectricCharge FromMilliampereHours(QuantityValue milliamperehours) { double value = (double) milliamperehours; - return new ElectricCharge(value, ElectricChargeUnit.MilliampereHour); + return new ElectricCharge(value, ElectricChargeUnit.MilliampereHour); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ElectricCharge unit value. - public static ElectricCharge From(QuantityValue value, ElectricChargeUnit fromUnit) + /// unit value. + public static ElectricCharge From(QuantityValue value, ElectricChargeUnit fromUnit) { - return new ElectricCharge((double)value, fromUnit); + return new ElectricCharge((double)value, fromUnit); } #endregion @@ -307,7 +307,7 @@ public static ElectricCharge From(QuantityValue value, ElectricChargeUnit fromUn /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ElectricCharge Parse(string str) + public static ElectricCharge Parse(string str) { return Parse(str, null); } @@ -335,9 +335,9 @@ public static ElectricCharge Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ElectricCharge Parse(string str, [CanBeNull] IFormatProvider provider) + public static ElectricCharge Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ElectricChargeUnit>( str, provider, From); @@ -351,7 +351,7 @@ public static ElectricCharge Parse(string str, [CanBeNull] IFormatProvider provi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ElectricCharge result) + public static bool TryParse([CanBeNull] string str, out ElectricCharge result) { return TryParse(str, null, out result); } @@ -366,9 +366,9 @@ public static bool TryParse([CanBeNull] string str, out ElectricCharge result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCharge result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCharge result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ElectricChargeUnit>( str, provider, From, @@ -430,43 +430,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Arithmetic Operators /// Negate the value. - public static ElectricCharge operator -(ElectricCharge right) + public static ElectricCharge operator -(ElectricCharge right) { - return new ElectricCharge(-right.Value, right.Unit); + return new ElectricCharge(-right.Value, right.Unit); } - /// Get from adding two . - public static ElectricCharge operator +(ElectricCharge left, ElectricCharge right) + /// Get from adding two . + public static ElectricCharge operator +(ElectricCharge left, ElectricCharge right) { - return new ElectricCharge(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ElectricCharge(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ElectricCharge operator -(ElectricCharge left, ElectricCharge right) + /// Get from subtracting two . + public static ElectricCharge operator -(ElectricCharge left, ElectricCharge right) { - return new ElectricCharge(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ElectricCharge(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ElectricCharge operator *(double left, ElectricCharge right) + /// Get from multiplying value and . + public static ElectricCharge operator *(double left, ElectricCharge right) { - return new ElectricCharge(left * right.Value, right.Unit); + return new ElectricCharge(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ElectricCharge operator *(ElectricCharge left, double right) + /// Get from multiplying value and . + public static ElectricCharge operator *(ElectricCharge left, double right) { - return new ElectricCharge(left.Value * right, left.Unit); + return new ElectricCharge(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ElectricCharge operator /(ElectricCharge left, double right) + /// Get from dividing by value. + public static ElectricCharge operator /(ElectricCharge left, double right) { - return new ElectricCharge(left.Value / right, left.Unit); + return new ElectricCharge(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ElectricCharge left, ElectricCharge right) + /// Get ratio value from dividing by . + public static double operator /(ElectricCharge left, ElectricCharge right) { return left.Coulombs / right.Coulombs; } @@ -476,39 +476,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ElectricCharge left, ElectricCharge right) + public static bool operator <=(ElectricCharge left, ElectricCharge right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ElectricCharge left, ElectricCharge right) + public static bool operator >=(ElectricCharge left, ElectricCharge right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ElectricCharge left, ElectricCharge right) + public static bool operator <(ElectricCharge left, ElectricCharge right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ElectricCharge left, ElectricCharge right) + public static bool operator >(ElectricCharge left, ElectricCharge right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ElectricCharge left, ElectricCharge right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ElectricCharge left, ElectricCharge right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ElectricCharge left, ElectricCharge right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ElectricCharge left, ElectricCharge right) { return !(left == right); } @@ -517,37 +517,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCharge objElectricCharge)) throw new ArgumentException("Expected type ElectricCharge.", nameof(obj)); + if(!(obj is ElectricCharge objElectricCharge)) throw new ArgumentException("Expected type ElectricCharge.", nameof(obj)); return CompareTo(objElectricCharge); } /// - public int CompareTo(ElectricCharge other) + public int CompareTo(ElectricCharge other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricCharge objElectricCharge)) + if(obj is null || !(obj is ElectricCharge objElectricCharge)) return false; return Equals(objElectricCharge); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ElectricCharge other) + /// Consider using for safely comparing floating point values. + public bool Equals(ElectricCharge other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ElectricCharge within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -585,7 +585,7 @@ public bool Equals(ElectricCharge other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricCharge other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricCharge other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -599,7 +599,7 @@ public bool Equals(ElectricCharge other, double tolerance, ComparisonType compar /// /// Returns the hash code for this instance. /// - /// A hash code for the current ElectricCharge. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -647,13 +647,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ElectricCharge to another ElectricCharge with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ElectricCharge with the specified unit. - public ElectricCharge ToUnit(ElectricChargeUnit unit) + /// A with the specified unit. + public ElectricCharge ToUnit(ElectricChargeUnit unit) { var convertedValue = GetValueAs(unit); - return new ElectricCharge(convertedValue, unit); + return new ElectricCharge(convertedValue, unit); } /// @@ -666,7 +666,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ElectricCharge ToUnit(UnitSystem unitSystem) + public ElectricCharge ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -713,10 +713,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ElectricCharge ToBaseUnit() + internal ElectricCharge ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ElectricCharge(baseUnitValue, BaseUnit); + return new ElectricCharge(baseUnitValue, BaseUnit); } private double GetValueAs(ElectricChargeUnit unit) @@ -829,7 +829,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -839,12 +839,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -889,16 +889,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricCharge)) + if(conversionType == typeof(ElectricCharge)) return this; else if(conversionType == typeof(ElectricChargeUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ElectricCharge.QuantityType; + return ElectricCharge.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ElectricCharge.BaseDimensions; + return ElectricCharge.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs index 84babf87b7..e8f372bedc 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Charge_density /// - public partial struct ElectricChargeDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ElectricChargeDensity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -103,19 +103,19 @@ public ElectricChargeDensity(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ElectricChargeDensity, which is CoulombPerCubicMeter. All conversions go via this value. + /// The base unit of , which is CoulombPerCubicMeter. All conversions go via this value. /// public static ElectricChargeDensityUnit BaseUnit { get; } = ElectricChargeDensityUnit.CoulombPerCubicMeter; /// - /// Represents the largest possible value of ElectricChargeDensity + /// Represents the largest possible value of /// - public static ElectricChargeDensity MaxValue { get; } = new ElectricChargeDensity(double.MaxValue, BaseUnit); + public static ElectricChargeDensity MaxValue { get; } = new ElectricChargeDensity(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ElectricChargeDensity + /// Represents the smallest possible value of /// - public static ElectricChargeDensity MinValue { get; } = new ElectricChargeDensity(double.MinValue, BaseUnit); + public static ElectricChargeDensity MinValue { get; } = new ElectricChargeDensity(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -123,14 +123,14 @@ public ElectricChargeDensity(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ElectricChargeDensity; /// - /// All units of measurement for the ElectricChargeDensity quantity. + /// All units of measurement for the quantity. /// public static ElectricChargeDensityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricChargeDensityUnit)).Cast().Except(new ElectricChargeDensityUnit[]{ ElectricChargeDensityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit CoulombPerCubicMeter. /// - public static ElectricChargeDensity Zero { get; } = new ElectricChargeDensity(0, BaseUnit); + public static ElectricChargeDensity Zero { get; } = new ElectricChargeDensity(0, BaseUnit); #endregion @@ -155,19 +155,19 @@ public ElectricChargeDensity(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ElectricChargeDensity.QuantityType; + public QuantityType Type => ElectricChargeDensity.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ElectricChargeDensity.BaseDimensions; + public BaseDimensions Dimensions => ElectricChargeDensity.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ElectricChargeDensity in CoulombsPerCubicMeter. + /// Get in CoulombsPerCubicMeter. /// public double CoulombsPerCubicMeter => As(ElectricChargeDensityUnit.CoulombPerCubicMeter); @@ -201,24 +201,24 @@ public static string GetAbbreviation(ElectricChargeDensityUnit unit, [CanBeNull] #region Static Factory Methods /// - /// Get ElectricChargeDensity from CoulombsPerCubicMeter. + /// Get from CoulombsPerCubicMeter. /// /// If value is NaN or Infinity. - public static ElectricChargeDensity FromCoulombsPerCubicMeter(QuantityValue coulombspercubicmeter) + public static ElectricChargeDensity FromCoulombsPerCubicMeter(QuantityValue coulombspercubicmeter) { double value = (double) coulombspercubicmeter; - return new ElectricChargeDensity(value, ElectricChargeDensityUnit.CoulombPerCubicMeter); + return new ElectricChargeDensity(value, ElectricChargeDensityUnit.CoulombPerCubicMeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ElectricChargeDensity unit value. - public static ElectricChargeDensity From(QuantityValue value, ElectricChargeDensityUnit fromUnit) + /// unit value. + public static ElectricChargeDensity From(QuantityValue value, ElectricChargeDensityUnit fromUnit) { - return new ElectricChargeDensity((double)value, fromUnit); + return new ElectricChargeDensity((double)value, fromUnit); } #endregion @@ -247,7 +247,7 @@ public static ElectricChargeDensity From(QuantityValue value, ElectricChargeDens /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ElectricChargeDensity Parse(string str) + public static ElectricChargeDensity Parse(string str) { return Parse(str, null); } @@ -275,9 +275,9 @@ public static ElectricChargeDensity Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ElectricChargeDensity Parse(string str, [CanBeNull] IFormatProvider provider) + public static ElectricChargeDensity Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ElectricChargeDensityUnit>( str, provider, From); @@ -291,7 +291,7 @@ public static ElectricChargeDensity Parse(string str, [CanBeNull] IFormatProvide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ElectricChargeDensity result) + public static bool TryParse([CanBeNull] string str, out ElectricChargeDensity result) { return TryParse(str, null, out result); } @@ -306,9 +306,9 @@ public static bool TryParse([CanBeNull] string str, out ElectricChargeDensity re /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricChargeDensity result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricChargeDensity result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ElectricChargeDensityUnit>( str, provider, From, @@ -370,43 +370,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Arithmetic Operators /// Negate the value. - public static ElectricChargeDensity operator -(ElectricChargeDensity right) + public static ElectricChargeDensity operator -(ElectricChargeDensity right) { - return new ElectricChargeDensity(-right.Value, right.Unit); + return new ElectricChargeDensity(-right.Value, right.Unit); } - /// Get from adding two . - public static ElectricChargeDensity operator +(ElectricChargeDensity left, ElectricChargeDensity right) + /// Get from adding two . + public static ElectricChargeDensity operator +(ElectricChargeDensity left, ElectricChargeDensity right) { - return new ElectricChargeDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ElectricChargeDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ElectricChargeDensity operator -(ElectricChargeDensity left, ElectricChargeDensity right) + /// Get from subtracting two . + public static ElectricChargeDensity operator -(ElectricChargeDensity left, ElectricChargeDensity right) { - return new ElectricChargeDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ElectricChargeDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ElectricChargeDensity operator *(double left, ElectricChargeDensity right) + /// Get from multiplying value and . + public static ElectricChargeDensity operator *(double left, ElectricChargeDensity right) { - return new ElectricChargeDensity(left * right.Value, right.Unit); + return new ElectricChargeDensity(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ElectricChargeDensity operator *(ElectricChargeDensity left, double right) + /// Get from multiplying value and . + public static ElectricChargeDensity operator *(ElectricChargeDensity left, double right) { - return new ElectricChargeDensity(left.Value * right, left.Unit); + return new ElectricChargeDensity(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ElectricChargeDensity operator /(ElectricChargeDensity left, double right) + /// Get from dividing by value. + public static ElectricChargeDensity operator /(ElectricChargeDensity left, double right) { - return new ElectricChargeDensity(left.Value / right, left.Unit); + return new ElectricChargeDensity(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ElectricChargeDensity left, ElectricChargeDensity right) + /// Get ratio value from dividing by . + public static double operator /(ElectricChargeDensity left, ElectricChargeDensity right) { return left.CoulombsPerCubicMeter / right.CoulombsPerCubicMeter; } @@ -416,39 +416,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ElectricChargeDensity left, ElectricChargeDensity right) + public static bool operator <=(ElectricChargeDensity left, ElectricChargeDensity right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ElectricChargeDensity left, ElectricChargeDensity right) + public static bool operator >=(ElectricChargeDensity left, ElectricChargeDensity right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ElectricChargeDensity left, ElectricChargeDensity right) + public static bool operator <(ElectricChargeDensity left, ElectricChargeDensity right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ElectricChargeDensity left, ElectricChargeDensity right) + public static bool operator >(ElectricChargeDensity left, ElectricChargeDensity right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ElectricChargeDensity left, ElectricChargeDensity right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ElectricChargeDensity left, ElectricChargeDensity right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ElectricChargeDensity left, ElectricChargeDensity right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ElectricChargeDensity left, ElectricChargeDensity right) { return !(left == right); } @@ -457,37 +457,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricChargeDensity objElectricChargeDensity)) throw new ArgumentException("Expected type ElectricChargeDensity.", nameof(obj)); + if(!(obj is ElectricChargeDensity objElectricChargeDensity)) throw new ArgumentException("Expected type ElectricChargeDensity.", nameof(obj)); return CompareTo(objElectricChargeDensity); } /// - public int CompareTo(ElectricChargeDensity other) + public int CompareTo(ElectricChargeDensity other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricChargeDensity objElectricChargeDensity)) + if(obj is null || !(obj is ElectricChargeDensity objElectricChargeDensity)) return false; return Equals(objElectricChargeDensity); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ElectricChargeDensity other) + /// Consider using for safely comparing floating point values. + public bool Equals(ElectricChargeDensity other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ElectricChargeDensity within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -525,7 +525,7 @@ public bool Equals(ElectricChargeDensity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricChargeDensity other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricChargeDensity other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -539,7 +539,7 @@ public bool Equals(ElectricChargeDensity other, double tolerance, ComparisonType /// /// Returns the hash code for this instance. /// - /// A hash code for the current ElectricChargeDensity. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -587,13 +587,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ElectricChargeDensity to another ElectricChargeDensity with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ElectricChargeDensity with the specified unit. - public ElectricChargeDensity ToUnit(ElectricChargeDensityUnit unit) + /// A with the specified unit. + public ElectricChargeDensity ToUnit(ElectricChargeDensityUnit unit) { var convertedValue = GetValueAs(unit); - return new ElectricChargeDensity(convertedValue, unit); + return new ElectricChargeDensity(convertedValue, unit); } /// @@ -606,7 +606,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ElectricChargeDensity ToUnit(UnitSystem unitSystem) + public ElectricChargeDensity ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -649,10 +649,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ElectricChargeDensity ToBaseUnit() + internal ElectricChargeDensity ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ElectricChargeDensity(baseUnitValue, BaseUnit); + return new ElectricChargeDensity(baseUnitValue, BaseUnit); } private double GetValueAs(ElectricChargeDensityUnit unit) @@ -761,7 +761,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -771,12 +771,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -821,16 +821,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricChargeDensity)) + if(conversionType == typeof(ElectricChargeDensity)) return this; else if(conversionType == typeof(ElectricChargeDensityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ElectricChargeDensity.QuantityType; + return ElectricChargeDensity.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ElectricChargeDensity.BaseDimensions; + return ElectricChargeDensity.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs index 0dffcbc32b..02e7e4ea42 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electrical_resistance_and_conductance /// - public partial struct ElectricConductance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ElectricConductance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -105,19 +105,19 @@ public ElectricConductance(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ElectricConductance, which is Siemens. All conversions go via this value. + /// The base unit of , which is Siemens. All conversions go via this value. /// public static ElectricConductanceUnit BaseUnit { get; } = ElectricConductanceUnit.Siemens; /// - /// Represents the largest possible value of ElectricConductance + /// Represents the largest possible value of /// - public static ElectricConductance MaxValue { get; } = new ElectricConductance(double.MaxValue, BaseUnit); + public static ElectricConductance MaxValue { get; } = new ElectricConductance(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ElectricConductance + /// Represents the smallest possible value of /// - public static ElectricConductance MinValue { get; } = new ElectricConductance(double.MinValue, BaseUnit); + public static ElectricConductance MinValue { get; } = new ElectricConductance(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -125,14 +125,14 @@ public ElectricConductance(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ElectricConductance; /// - /// All units of measurement for the ElectricConductance quantity. + /// All units of measurement for the quantity. /// public static ElectricConductanceUnit[] Units { get; } = Enum.GetValues(typeof(ElectricConductanceUnit)).Cast().Except(new ElectricConductanceUnit[]{ ElectricConductanceUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Siemens. /// - public static ElectricConductance Zero { get; } = new ElectricConductance(0, BaseUnit); + public static ElectricConductance Zero { get; } = new ElectricConductance(0, BaseUnit); #endregion @@ -157,29 +157,29 @@ public ElectricConductance(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ElectricConductance.QuantityType; + public QuantityType Type => ElectricConductance.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ElectricConductance.BaseDimensions; + public BaseDimensions Dimensions => ElectricConductance.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ElectricConductance in Microsiemens. + /// Get in Microsiemens. /// public double Microsiemens => As(ElectricConductanceUnit.Microsiemens); /// - /// Get ElectricConductance in Millisiemens. + /// Get in Millisiemens. /// public double Millisiemens => As(ElectricConductanceUnit.Millisiemens); /// - /// Get ElectricConductance in Siemens. + /// Get in Siemens. /// public double Siemens => As(ElectricConductanceUnit.Siemens); @@ -213,42 +213,42 @@ public static string GetAbbreviation(ElectricConductanceUnit unit, [CanBeNull] I #region Static Factory Methods /// - /// Get ElectricConductance from Microsiemens. + /// Get from Microsiemens. /// /// If value is NaN or Infinity. - public static ElectricConductance FromMicrosiemens(QuantityValue microsiemens) + public static ElectricConductance FromMicrosiemens(QuantityValue microsiemens) { double value = (double) microsiemens; - return new ElectricConductance(value, ElectricConductanceUnit.Microsiemens); + return new ElectricConductance(value, ElectricConductanceUnit.Microsiemens); } /// - /// Get ElectricConductance from Millisiemens. + /// Get from Millisiemens. /// /// If value is NaN or Infinity. - public static ElectricConductance FromMillisiemens(QuantityValue millisiemens) + public static ElectricConductance FromMillisiemens(QuantityValue millisiemens) { double value = (double) millisiemens; - return new ElectricConductance(value, ElectricConductanceUnit.Millisiemens); + return new ElectricConductance(value, ElectricConductanceUnit.Millisiemens); } /// - /// Get ElectricConductance from Siemens. + /// Get from Siemens. /// /// If value is NaN or Infinity. - public static ElectricConductance FromSiemens(QuantityValue siemens) + public static ElectricConductance FromSiemens(QuantityValue siemens) { double value = (double) siemens; - return new ElectricConductance(value, ElectricConductanceUnit.Siemens); + return new ElectricConductance(value, ElectricConductanceUnit.Siemens); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ElectricConductance unit value. - public static ElectricConductance From(QuantityValue value, ElectricConductanceUnit fromUnit) + /// unit value. + public static ElectricConductance From(QuantityValue value, ElectricConductanceUnit fromUnit) { - return new ElectricConductance((double)value, fromUnit); + return new ElectricConductance((double)value, fromUnit); } #endregion @@ -277,7 +277,7 @@ public static ElectricConductance From(QuantityValue value, ElectricConductanceU /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ElectricConductance Parse(string str) + public static ElectricConductance Parse(string str) { return Parse(str, null); } @@ -305,9 +305,9 @@ public static ElectricConductance Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ElectricConductance Parse(string str, [CanBeNull] IFormatProvider provider) + public static ElectricConductance Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ElectricConductanceUnit>( str, provider, From); @@ -321,7 +321,7 @@ public static ElectricConductance Parse(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ElectricConductance result) + public static bool TryParse([CanBeNull] string str, out ElectricConductance result) { return TryParse(str, null, out result); } @@ -336,9 +336,9 @@ public static bool TryParse([CanBeNull] string str, out ElectricConductance resu /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductance result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductance result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ElectricConductanceUnit>( str, provider, From, @@ -400,43 +400,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Arithmetic Operators /// Negate the value. - public static ElectricConductance operator -(ElectricConductance right) + public static ElectricConductance operator -(ElectricConductance right) { - return new ElectricConductance(-right.Value, right.Unit); + return new ElectricConductance(-right.Value, right.Unit); } - /// Get from adding two . - public static ElectricConductance operator +(ElectricConductance left, ElectricConductance right) + /// Get from adding two . + public static ElectricConductance operator +(ElectricConductance left, ElectricConductance right) { - return new ElectricConductance(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ElectricConductance(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ElectricConductance operator -(ElectricConductance left, ElectricConductance right) + /// Get from subtracting two . + public static ElectricConductance operator -(ElectricConductance left, ElectricConductance right) { - return new ElectricConductance(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ElectricConductance(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ElectricConductance operator *(double left, ElectricConductance right) + /// Get from multiplying value and . + public static ElectricConductance operator *(double left, ElectricConductance right) { - return new ElectricConductance(left * right.Value, right.Unit); + return new ElectricConductance(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ElectricConductance operator *(ElectricConductance left, double right) + /// Get from multiplying value and . + public static ElectricConductance operator *(ElectricConductance left, double right) { - return new ElectricConductance(left.Value * right, left.Unit); + return new ElectricConductance(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ElectricConductance operator /(ElectricConductance left, double right) + /// Get from dividing by value. + public static ElectricConductance operator /(ElectricConductance left, double right) { - return new ElectricConductance(left.Value / right, left.Unit); + return new ElectricConductance(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ElectricConductance left, ElectricConductance right) + /// Get ratio value from dividing by . + public static double operator /(ElectricConductance left, ElectricConductance right) { return left.Siemens / right.Siemens; } @@ -446,39 +446,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ElectricConductance left, ElectricConductance right) + public static bool operator <=(ElectricConductance left, ElectricConductance right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ElectricConductance left, ElectricConductance right) + public static bool operator >=(ElectricConductance left, ElectricConductance right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ElectricConductance left, ElectricConductance right) + public static bool operator <(ElectricConductance left, ElectricConductance right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ElectricConductance left, ElectricConductance right) + public static bool operator >(ElectricConductance left, ElectricConductance right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ElectricConductance left, ElectricConductance right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ElectricConductance left, ElectricConductance right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ElectricConductance left, ElectricConductance right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ElectricConductance left, ElectricConductance right) { return !(left == right); } @@ -487,37 +487,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricConductance objElectricConductance)) throw new ArgumentException("Expected type ElectricConductance.", nameof(obj)); + if(!(obj is ElectricConductance objElectricConductance)) throw new ArgumentException("Expected type ElectricConductance.", nameof(obj)); return CompareTo(objElectricConductance); } /// - public int CompareTo(ElectricConductance other) + public int CompareTo(ElectricConductance other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricConductance objElectricConductance)) + if(obj is null || !(obj is ElectricConductance objElectricConductance)) return false; return Equals(objElectricConductance); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ElectricConductance other) + /// Consider using for safely comparing floating point values. + public bool Equals(ElectricConductance other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ElectricConductance within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -555,7 +555,7 @@ public bool Equals(ElectricConductance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricConductance other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricConductance other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -569,7 +569,7 @@ public bool Equals(ElectricConductance other, double tolerance, ComparisonType c /// /// Returns the hash code for this instance. /// - /// A hash code for the current ElectricConductance. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -617,13 +617,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ElectricConductance to another ElectricConductance with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ElectricConductance with the specified unit. - public ElectricConductance ToUnit(ElectricConductanceUnit unit) + /// A with the specified unit. + public ElectricConductance ToUnit(ElectricConductanceUnit unit) { var convertedValue = GetValueAs(unit); - return new ElectricConductance(convertedValue, unit); + return new ElectricConductance(convertedValue, unit); } /// @@ -636,7 +636,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ElectricConductance ToUnit(UnitSystem unitSystem) + public ElectricConductance ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -681,10 +681,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ElectricConductance ToBaseUnit() + internal ElectricConductance ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ElectricConductance(baseUnitValue, BaseUnit); + return new ElectricConductance(baseUnitValue, BaseUnit); } private double GetValueAs(ElectricConductanceUnit unit) @@ -795,7 +795,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -805,12 +805,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -855,16 +855,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricConductance)) + if(conversionType == typeof(ElectricConductance)) return this; else if(conversionType == typeof(ElectricConductanceUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ElectricConductance.QuantityType; + return ElectricConductance.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ElectricConductance.BaseDimensions; + return ElectricConductance.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs index c3ed929ce6..e6d82bb005 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity /// - public partial struct ElectricConductivity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ElectricConductivity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -105,19 +105,19 @@ public ElectricConductivity(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ElectricConductivity, which is SiemensPerMeter. All conversions go via this value. + /// The base unit of , which is SiemensPerMeter. All conversions go via this value. /// public static ElectricConductivityUnit BaseUnit { get; } = ElectricConductivityUnit.SiemensPerMeter; /// - /// Represents the largest possible value of ElectricConductivity + /// Represents the largest possible value of /// - public static ElectricConductivity MaxValue { get; } = new ElectricConductivity(double.MaxValue, BaseUnit); + public static ElectricConductivity MaxValue { get; } = new ElectricConductivity(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ElectricConductivity + /// Represents the smallest possible value of /// - public static ElectricConductivity MinValue { get; } = new ElectricConductivity(double.MinValue, BaseUnit); + public static ElectricConductivity MinValue { get; } = new ElectricConductivity(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -125,14 +125,14 @@ public ElectricConductivity(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ElectricConductivity; /// - /// All units of measurement for the ElectricConductivity quantity. + /// All units of measurement for the quantity. /// public static ElectricConductivityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricConductivityUnit)).Cast().Except(new ElectricConductivityUnit[]{ ElectricConductivityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit SiemensPerMeter. /// - public static ElectricConductivity Zero { get; } = new ElectricConductivity(0, BaseUnit); + public static ElectricConductivity Zero { get; } = new ElectricConductivity(0, BaseUnit); #endregion @@ -157,29 +157,29 @@ public ElectricConductivity(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ElectricConductivity.QuantityType; + public QuantityType Type => ElectricConductivity.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ElectricConductivity.BaseDimensions; + public BaseDimensions Dimensions => ElectricConductivity.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ElectricConductivity in SiemensPerFoot. + /// Get in SiemensPerFoot. /// public double SiemensPerFoot => As(ElectricConductivityUnit.SiemensPerFoot); /// - /// Get ElectricConductivity in SiemensPerInch. + /// Get in SiemensPerInch. /// public double SiemensPerInch => As(ElectricConductivityUnit.SiemensPerInch); /// - /// Get ElectricConductivity in SiemensPerMeter. + /// Get in SiemensPerMeter. /// public double SiemensPerMeter => As(ElectricConductivityUnit.SiemensPerMeter); @@ -213,42 +213,42 @@ public static string GetAbbreviation(ElectricConductivityUnit unit, [CanBeNull] #region Static Factory Methods /// - /// Get ElectricConductivity from SiemensPerFoot. + /// Get from SiemensPerFoot. /// /// If value is NaN or Infinity. - public static ElectricConductivity FromSiemensPerFoot(QuantityValue siemensperfoot) + public static ElectricConductivity FromSiemensPerFoot(QuantityValue siemensperfoot) { double value = (double) siemensperfoot; - return new ElectricConductivity(value, ElectricConductivityUnit.SiemensPerFoot); + return new ElectricConductivity(value, ElectricConductivityUnit.SiemensPerFoot); } /// - /// Get ElectricConductivity from SiemensPerInch. + /// Get from SiemensPerInch. /// /// If value is NaN or Infinity. - public static ElectricConductivity FromSiemensPerInch(QuantityValue siemensperinch) + public static ElectricConductivity FromSiemensPerInch(QuantityValue siemensperinch) { double value = (double) siemensperinch; - return new ElectricConductivity(value, ElectricConductivityUnit.SiemensPerInch); + return new ElectricConductivity(value, ElectricConductivityUnit.SiemensPerInch); } /// - /// Get ElectricConductivity from SiemensPerMeter. + /// Get from SiemensPerMeter. /// /// If value is NaN or Infinity. - public static ElectricConductivity FromSiemensPerMeter(QuantityValue siemenspermeter) + public static ElectricConductivity FromSiemensPerMeter(QuantityValue siemenspermeter) { double value = (double) siemenspermeter; - return new ElectricConductivity(value, ElectricConductivityUnit.SiemensPerMeter); + return new ElectricConductivity(value, ElectricConductivityUnit.SiemensPerMeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ElectricConductivity unit value. - public static ElectricConductivity From(QuantityValue value, ElectricConductivityUnit fromUnit) + /// unit value. + public static ElectricConductivity From(QuantityValue value, ElectricConductivityUnit fromUnit) { - return new ElectricConductivity((double)value, fromUnit); + return new ElectricConductivity((double)value, fromUnit); } #endregion @@ -277,7 +277,7 @@ public static ElectricConductivity From(QuantityValue value, ElectricConductivit /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ElectricConductivity Parse(string str) + public static ElectricConductivity Parse(string str) { return Parse(str, null); } @@ -305,9 +305,9 @@ public static ElectricConductivity Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ElectricConductivity Parse(string str, [CanBeNull] IFormatProvider provider) + public static ElectricConductivity Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ElectricConductivityUnit>( str, provider, From); @@ -321,7 +321,7 @@ public static ElectricConductivity Parse(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ElectricConductivity result) + public static bool TryParse([CanBeNull] string str, out ElectricConductivity result) { return TryParse(str, null, out result); } @@ -336,9 +336,9 @@ public static bool TryParse([CanBeNull] string str, out ElectricConductivity res /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductivity result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductivity result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ElectricConductivityUnit>( str, provider, From, @@ -400,43 +400,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Arithmetic Operators /// Negate the value. - public static ElectricConductivity operator -(ElectricConductivity right) + public static ElectricConductivity operator -(ElectricConductivity right) { - return new ElectricConductivity(-right.Value, right.Unit); + return new ElectricConductivity(-right.Value, right.Unit); } - /// Get from adding two . - public static ElectricConductivity operator +(ElectricConductivity left, ElectricConductivity right) + /// Get from adding two . + public static ElectricConductivity operator +(ElectricConductivity left, ElectricConductivity right) { - return new ElectricConductivity(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ElectricConductivity(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ElectricConductivity operator -(ElectricConductivity left, ElectricConductivity right) + /// Get from subtracting two . + public static ElectricConductivity operator -(ElectricConductivity left, ElectricConductivity right) { - return new ElectricConductivity(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ElectricConductivity(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ElectricConductivity operator *(double left, ElectricConductivity right) + /// Get from multiplying value and . + public static ElectricConductivity operator *(double left, ElectricConductivity right) { - return new ElectricConductivity(left * right.Value, right.Unit); + return new ElectricConductivity(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ElectricConductivity operator *(ElectricConductivity left, double right) + /// Get from multiplying value and . + public static ElectricConductivity operator *(ElectricConductivity left, double right) { - return new ElectricConductivity(left.Value * right, left.Unit); + return new ElectricConductivity(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ElectricConductivity operator /(ElectricConductivity left, double right) + /// Get from dividing by value. + public static ElectricConductivity operator /(ElectricConductivity left, double right) { - return new ElectricConductivity(left.Value / right, left.Unit); + return new ElectricConductivity(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ElectricConductivity left, ElectricConductivity right) + /// Get ratio value from dividing by . + public static double operator /(ElectricConductivity left, ElectricConductivity right) { return left.SiemensPerMeter / right.SiemensPerMeter; } @@ -446,39 +446,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ElectricConductivity left, ElectricConductivity right) + public static bool operator <=(ElectricConductivity left, ElectricConductivity right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ElectricConductivity left, ElectricConductivity right) + public static bool operator >=(ElectricConductivity left, ElectricConductivity right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ElectricConductivity left, ElectricConductivity right) + public static bool operator <(ElectricConductivity left, ElectricConductivity right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ElectricConductivity left, ElectricConductivity right) + public static bool operator >(ElectricConductivity left, ElectricConductivity right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ElectricConductivity left, ElectricConductivity right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ElectricConductivity left, ElectricConductivity right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ElectricConductivity left, ElectricConductivity right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ElectricConductivity left, ElectricConductivity right) { return !(left == right); } @@ -487,37 +487,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricConductivity objElectricConductivity)) throw new ArgumentException("Expected type ElectricConductivity.", nameof(obj)); + if(!(obj is ElectricConductivity objElectricConductivity)) throw new ArgumentException("Expected type ElectricConductivity.", nameof(obj)); return CompareTo(objElectricConductivity); } /// - public int CompareTo(ElectricConductivity other) + public int CompareTo(ElectricConductivity other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricConductivity objElectricConductivity)) + if(obj is null || !(obj is ElectricConductivity objElectricConductivity)) return false; return Equals(objElectricConductivity); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ElectricConductivity other) + /// Consider using for safely comparing floating point values. + public bool Equals(ElectricConductivity other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ElectricConductivity within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -555,7 +555,7 @@ public bool Equals(ElectricConductivity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricConductivity other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricConductivity other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -569,7 +569,7 @@ public bool Equals(ElectricConductivity other, double tolerance, ComparisonType /// /// Returns the hash code for this instance. /// - /// A hash code for the current ElectricConductivity. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -617,13 +617,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ElectricConductivity to another ElectricConductivity with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ElectricConductivity with the specified unit. - public ElectricConductivity ToUnit(ElectricConductivityUnit unit) + /// A with the specified unit. + public ElectricConductivity ToUnit(ElectricConductivityUnit unit) { var convertedValue = GetValueAs(unit); - return new ElectricConductivity(convertedValue, unit); + return new ElectricConductivity(convertedValue, unit); } /// @@ -636,7 +636,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ElectricConductivity ToUnit(UnitSystem unitSystem) + public ElectricConductivity ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -681,10 +681,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ElectricConductivity ToBaseUnit() + internal ElectricConductivity ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ElectricConductivity(baseUnitValue, BaseUnit); + return new ElectricConductivity(baseUnitValue, BaseUnit); } private double GetValueAs(ElectricConductivityUnit unit) @@ -795,7 +795,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -805,12 +805,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -855,16 +855,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricConductivity)) + if(conversionType == typeof(ElectricConductivity)) return this; else if(conversionType == typeof(ElectricConductivityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ElectricConductivity.QuantityType; + return ElectricConductivity.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ElectricConductivity.BaseDimensions; + return ElectricConductivity.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs index 13726a1360..067a497ca5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// An electric current is a flow of electric charge. In electric circuits this charge is often carried by moving electrons in a wire. It can also be carried by ions in an electrolyte, or by both ions and electrons such as in a plasma. /// - public partial struct ElectricCurrent : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ElectricCurrent : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -107,19 +107,19 @@ public ElectricCurrent(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ElectricCurrent, which is Ampere. All conversions go via this value. + /// The base unit of , which is Ampere. All conversions go via this value. /// public static ElectricCurrentUnit BaseUnit { get; } = ElectricCurrentUnit.Ampere; /// - /// Represents the largest possible value of ElectricCurrent + /// Represents the largest possible value of /// - public static ElectricCurrent MaxValue { get; } = new ElectricCurrent(double.MaxValue, BaseUnit); + public static ElectricCurrent MaxValue { get; } = new ElectricCurrent(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ElectricCurrent + /// Represents the smallest possible value of /// - public static ElectricCurrent MinValue { get; } = new ElectricCurrent(double.MinValue, BaseUnit); + public static ElectricCurrent MinValue { get; } = new ElectricCurrent(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -127,14 +127,14 @@ public ElectricCurrent(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ElectricCurrent; /// - /// All units of measurement for the ElectricCurrent quantity. + /// All units of measurement for the quantity. /// public static ElectricCurrentUnit[] Units { get; } = Enum.GetValues(typeof(ElectricCurrentUnit)).Cast().Except(new ElectricCurrentUnit[]{ ElectricCurrentUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Ampere. /// - public static ElectricCurrent Zero { get; } = new ElectricCurrent(0, BaseUnit); + public static ElectricCurrent Zero { get; } = new ElectricCurrent(0, BaseUnit); #endregion @@ -159,54 +159,54 @@ public ElectricCurrent(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ElectricCurrent.QuantityType; + public QuantityType Type => ElectricCurrent.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ElectricCurrent.BaseDimensions; + public BaseDimensions Dimensions => ElectricCurrent.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ElectricCurrent in Amperes. + /// Get in Amperes. /// public double Amperes => As(ElectricCurrentUnit.Ampere); /// - /// Get ElectricCurrent in Centiamperes. + /// Get in Centiamperes. /// public double Centiamperes => As(ElectricCurrentUnit.Centiampere); /// - /// Get ElectricCurrent in Kiloamperes. + /// Get in Kiloamperes. /// public double Kiloamperes => As(ElectricCurrentUnit.Kiloampere); /// - /// Get ElectricCurrent in Megaamperes. + /// Get in Megaamperes. /// public double Megaamperes => As(ElectricCurrentUnit.Megaampere); /// - /// Get ElectricCurrent in Microamperes. + /// Get in Microamperes. /// public double Microamperes => As(ElectricCurrentUnit.Microampere); /// - /// Get ElectricCurrent in Milliamperes. + /// Get in Milliamperes. /// public double Milliamperes => As(ElectricCurrentUnit.Milliampere); /// - /// Get ElectricCurrent in Nanoamperes. + /// Get in Nanoamperes. /// public double Nanoamperes => As(ElectricCurrentUnit.Nanoampere); /// - /// Get ElectricCurrent in Picoamperes. + /// Get in Picoamperes. /// public double Picoamperes => As(ElectricCurrentUnit.Picoampere); @@ -240,87 +240,87 @@ public static string GetAbbreviation(ElectricCurrentUnit unit, [CanBeNull] IForm #region Static Factory Methods /// - /// Get ElectricCurrent from Amperes. + /// Get from Amperes. /// /// If value is NaN or Infinity. - public static ElectricCurrent FromAmperes(QuantityValue amperes) + public static ElectricCurrent FromAmperes(QuantityValue amperes) { double value = (double) amperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Ampere); + return new ElectricCurrent(value, ElectricCurrentUnit.Ampere); } /// - /// Get ElectricCurrent from Centiamperes. + /// Get from Centiamperes. /// /// If value is NaN or Infinity. - public static ElectricCurrent FromCentiamperes(QuantityValue centiamperes) + public static ElectricCurrent FromCentiamperes(QuantityValue centiamperes) { double value = (double) centiamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Centiampere); + return new ElectricCurrent(value, ElectricCurrentUnit.Centiampere); } /// - /// Get ElectricCurrent from Kiloamperes. + /// Get from Kiloamperes. /// /// If value is NaN or Infinity. - public static ElectricCurrent FromKiloamperes(QuantityValue kiloamperes) + public static ElectricCurrent FromKiloamperes(QuantityValue kiloamperes) { double value = (double) kiloamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Kiloampere); + return new ElectricCurrent(value, ElectricCurrentUnit.Kiloampere); } /// - /// Get ElectricCurrent from Megaamperes. + /// Get from Megaamperes. /// /// If value is NaN or Infinity. - public static ElectricCurrent FromMegaamperes(QuantityValue megaamperes) + public static ElectricCurrent FromMegaamperes(QuantityValue megaamperes) { double value = (double) megaamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Megaampere); + return new ElectricCurrent(value, ElectricCurrentUnit.Megaampere); } /// - /// Get ElectricCurrent from Microamperes. + /// Get from Microamperes. /// /// If value is NaN or Infinity. - public static ElectricCurrent FromMicroamperes(QuantityValue microamperes) + public static ElectricCurrent FromMicroamperes(QuantityValue microamperes) { double value = (double) microamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Microampere); + return new ElectricCurrent(value, ElectricCurrentUnit.Microampere); } /// - /// Get ElectricCurrent from Milliamperes. + /// Get from Milliamperes. /// /// If value is NaN or Infinity. - public static ElectricCurrent FromMilliamperes(QuantityValue milliamperes) + public static ElectricCurrent FromMilliamperes(QuantityValue milliamperes) { double value = (double) milliamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Milliampere); + return new ElectricCurrent(value, ElectricCurrentUnit.Milliampere); } /// - /// Get ElectricCurrent from Nanoamperes. + /// Get from Nanoamperes. /// /// If value is NaN or Infinity. - public static ElectricCurrent FromNanoamperes(QuantityValue nanoamperes) + public static ElectricCurrent FromNanoamperes(QuantityValue nanoamperes) { double value = (double) nanoamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Nanoampere); + return new ElectricCurrent(value, ElectricCurrentUnit.Nanoampere); } /// - /// Get ElectricCurrent from Picoamperes. + /// Get from Picoamperes. /// /// If value is NaN or Infinity. - public static ElectricCurrent FromPicoamperes(QuantityValue picoamperes) + public static ElectricCurrent FromPicoamperes(QuantityValue picoamperes) { double value = (double) picoamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Picoampere); + return new ElectricCurrent(value, ElectricCurrentUnit.Picoampere); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ElectricCurrent unit value. - public static ElectricCurrent From(QuantityValue value, ElectricCurrentUnit fromUnit) + /// unit value. + public static ElectricCurrent From(QuantityValue value, ElectricCurrentUnit fromUnit) { - return new ElectricCurrent((double)value, fromUnit); + return new ElectricCurrent((double)value, fromUnit); } #endregion @@ -349,7 +349,7 @@ public static ElectricCurrent From(QuantityValue value, ElectricCurrentUnit from /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ElectricCurrent Parse(string str) + public static ElectricCurrent Parse(string str) { return Parse(str, null); } @@ -377,9 +377,9 @@ public static ElectricCurrent Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ElectricCurrent Parse(string str, [CanBeNull] IFormatProvider provider) + public static ElectricCurrent Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ElectricCurrentUnit>( str, provider, From); @@ -393,7 +393,7 @@ public static ElectricCurrent Parse(string str, [CanBeNull] IFormatProvider prov /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ElectricCurrent result) + public static bool TryParse([CanBeNull] string str, out ElectricCurrent result) { return TryParse(str, null, out result); } @@ -408,9 +408,9 @@ public static bool TryParse([CanBeNull] string str, out ElectricCurrent result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrent result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrent result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ElectricCurrentUnit>( str, provider, From, @@ -472,43 +472,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Arithmetic Operators /// Negate the value. - public static ElectricCurrent operator -(ElectricCurrent right) + public static ElectricCurrent operator -(ElectricCurrent right) { - return new ElectricCurrent(-right.Value, right.Unit); + return new ElectricCurrent(-right.Value, right.Unit); } - /// Get from adding two . - public static ElectricCurrent operator +(ElectricCurrent left, ElectricCurrent right) + /// Get from adding two . + public static ElectricCurrent operator +(ElectricCurrent left, ElectricCurrent right) { - return new ElectricCurrent(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ElectricCurrent(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ElectricCurrent operator -(ElectricCurrent left, ElectricCurrent right) + /// Get from subtracting two . + public static ElectricCurrent operator -(ElectricCurrent left, ElectricCurrent right) { - return new ElectricCurrent(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ElectricCurrent(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ElectricCurrent operator *(double left, ElectricCurrent right) + /// Get from multiplying value and . + public static ElectricCurrent operator *(double left, ElectricCurrent right) { - return new ElectricCurrent(left * right.Value, right.Unit); + return new ElectricCurrent(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ElectricCurrent operator *(ElectricCurrent left, double right) + /// Get from multiplying value and . + public static ElectricCurrent operator *(ElectricCurrent left, double right) { - return new ElectricCurrent(left.Value * right, left.Unit); + return new ElectricCurrent(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ElectricCurrent operator /(ElectricCurrent left, double right) + /// Get from dividing by value. + public static ElectricCurrent operator /(ElectricCurrent left, double right) { - return new ElectricCurrent(left.Value / right, left.Unit); + return new ElectricCurrent(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ElectricCurrent left, ElectricCurrent right) + /// Get ratio value from dividing by . + public static double operator /(ElectricCurrent left, ElectricCurrent right) { return left.Amperes / right.Amperes; } @@ -518,39 +518,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ElectricCurrent left, ElectricCurrent right) + public static bool operator <=(ElectricCurrent left, ElectricCurrent right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ElectricCurrent left, ElectricCurrent right) + public static bool operator >=(ElectricCurrent left, ElectricCurrent right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ElectricCurrent left, ElectricCurrent right) + public static bool operator <(ElectricCurrent left, ElectricCurrent right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ElectricCurrent left, ElectricCurrent right) + public static bool operator >(ElectricCurrent left, ElectricCurrent right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ElectricCurrent left, ElectricCurrent right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ElectricCurrent left, ElectricCurrent right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ElectricCurrent left, ElectricCurrent right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ElectricCurrent left, ElectricCurrent right) { return !(left == right); } @@ -559,37 +559,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrent objElectricCurrent)) throw new ArgumentException("Expected type ElectricCurrent.", nameof(obj)); + if(!(obj is ElectricCurrent objElectricCurrent)) throw new ArgumentException("Expected type ElectricCurrent.", nameof(obj)); return CompareTo(objElectricCurrent); } /// - public int CompareTo(ElectricCurrent other) + public int CompareTo(ElectricCurrent other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricCurrent objElectricCurrent)) + if(obj is null || !(obj is ElectricCurrent objElectricCurrent)) return false; return Equals(objElectricCurrent); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ElectricCurrent other) + /// Consider using for safely comparing floating point values. + public bool Equals(ElectricCurrent other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ElectricCurrent within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -627,7 +627,7 @@ public bool Equals(ElectricCurrent other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricCurrent other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricCurrent other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -641,7 +641,7 @@ public bool Equals(ElectricCurrent other, double tolerance, ComparisonType compa /// /// Returns the hash code for this instance. /// - /// A hash code for the current ElectricCurrent. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -689,13 +689,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ElectricCurrent to another ElectricCurrent with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ElectricCurrent with the specified unit. - public ElectricCurrent ToUnit(ElectricCurrentUnit unit) + /// A with the specified unit. + public ElectricCurrent ToUnit(ElectricCurrentUnit unit) { var convertedValue = GetValueAs(unit); - return new ElectricCurrent(convertedValue, unit); + return new ElectricCurrent(convertedValue, unit); } /// @@ -708,7 +708,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ElectricCurrent ToUnit(UnitSystem unitSystem) + public ElectricCurrent ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -758,10 +758,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ElectricCurrent ToBaseUnit() + internal ElectricCurrent ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ElectricCurrent(baseUnitValue, BaseUnit); + return new ElectricCurrent(baseUnitValue, BaseUnit); } private double GetValueAs(ElectricCurrentUnit unit) @@ -877,7 +877,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -887,12 +887,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -937,16 +937,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricCurrent)) + if(conversionType == typeof(ElectricCurrent)) return this; else if(conversionType == typeof(ElectricCurrentUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ElectricCurrent.QuantityType; + return ElectricCurrent.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ElectricCurrent.BaseDimensions; + return ElectricCurrent.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs index 40b235fe08..bc9213f80a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Current_density /// - public partial struct ElectricCurrentDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ElectricCurrentDensity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -105,19 +105,19 @@ public ElectricCurrentDensity(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ElectricCurrentDensity, which is AmperePerSquareMeter. All conversions go via this value. + /// The base unit of , which is AmperePerSquareMeter. All conversions go via this value. /// public static ElectricCurrentDensityUnit BaseUnit { get; } = ElectricCurrentDensityUnit.AmperePerSquareMeter; /// - /// Represents the largest possible value of ElectricCurrentDensity + /// Represents the largest possible value of /// - public static ElectricCurrentDensity MaxValue { get; } = new ElectricCurrentDensity(double.MaxValue, BaseUnit); + public static ElectricCurrentDensity MaxValue { get; } = new ElectricCurrentDensity(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ElectricCurrentDensity + /// Represents the smallest possible value of /// - public static ElectricCurrentDensity MinValue { get; } = new ElectricCurrentDensity(double.MinValue, BaseUnit); + public static ElectricCurrentDensity MinValue { get; } = new ElectricCurrentDensity(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -125,14 +125,14 @@ public ElectricCurrentDensity(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ElectricCurrentDensity; /// - /// All units of measurement for the ElectricCurrentDensity quantity. + /// All units of measurement for the quantity. /// public static ElectricCurrentDensityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricCurrentDensityUnit)).Cast().Except(new ElectricCurrentDensityUnit[]{ ElectricCurrentDensityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerSquareMeter. /// - public static ElectricCurrentDensity Zero { get; } = new ElectricCurrentDensity(0, BaseUnit); + public static ElectricCurrentDensity Zero { get; } = new ElectricCurrentDensity(0, BaseUnit); #endregion @@ -157,29 +157,29 @@ public ElectricCurrentDensity(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ElectricCurrentDensity.QuantityType; + public QuantityType Type => ElectricCurrentDensity.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ElectricCurrentDensity.BaseDimensions; + public BaseDimensions Dimensions => ElectricCurrentDensity.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ElectricCurrentDensity in AmperesPerSquareFoot. + /// Get in AmperesPerSquareFoot. /// public double AmperesPerSquareFoot => As(ElectricCurrentDensityUnit.AmperePerSquareFoot); /// - /// Get ElectricCurrentDensity in AmperesPerSquareInch. + /// Get in AmperesPerSquareInch. /// public double AmperesPerSquareInch => As(ElectricCurrentDensityUnit.AmperePerSquareInch); /// - /// Get ElectricCurrentDensity in AmperesPerSquareMeter. + /// Get in AmperesPerSquareMeter. /// public double AmperesPerSquareMeter => As(ElectricCurrentDensityUnit.AmperePerSquareMeter); @@ -213,42 +213,42 @@ public static string GetAbbreviation(ElectricCurrentDensityUnit unit, [CanBeNull #region Static Factory Methods /// - /// Get ElectricCurrentDensity from AmperesPerSquareFoot. + /// Get from AmperesPerSquareFoot. /// /// If value is NaN or Infinity. - public static ElectricCurrentDensity FromAmperesPerSquareFoot(QuantityValue amperespersquarefoot) + public static ElectricCurrentDensity FromAmperesPerSquareFoot(QuantityValue amperespersquarefoot) { double value = (double) amperespersquarefoot; - return new ElectricCurrentDensity(value, ElectricCurrentDensityUnit.AmperePerSquareFoot); + return new ElectricCurrentDensity(value, ElectricCurrentDensityUnit.AmperePerSquareFoot); } /// - /// Get ElectricCurrentDensity from AmperesPerSquareInch. + /// Get from AmperesPerSquareInch. /// /// If value is NaN or Infinity. - public static ElectricCurrentDensity FromAmperesPerSquareInch(QuantityValue amperespersquareinch) + public static ElectricCurrentDensity FromAmperesPerSquareInch(QuantityValue amperespersquareinch) { double value = (double) amperespersquareinch; - return new ElectricCurrentDensity(value, ElectricCurrentDensityUnit.AmperePerSquareInch); + return new ElectricCurrentDensity(value, ElectricCurrentDensityUnit.AmperePerSquareInch); } /// - /// Get ElectricCurrentDensity from AmperesPerSquareMeter. + /// Get from AmperesPerSquareMeter. /// /// If value is NaN or Infinity. - public static ElectricCurrentDensity FromAmperesPerSquareMeter(QuantityValue amperespersquaremeter) + public static ElectricCurrentDensity FromAmperesPerSquareMeter(QuantityValue amperespersquaremeter) { double value = (double) amperespersquaremeter; - return new ElectricCurrentDensity(value, ElectricCurrentDensityUnit.AmperePerSquareMeter); + return new ElectricCurrentDensity(value, ElectricCurrentDensityUnit.AmperePerSquareMeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ElectricCurrentDensity unit value. - public static ElectricCurrentDensity From(QuantityValue value, ElectricCurrentDensityUnit fromUnit) + /// unit value. + public static ElectricCurrentDensity From(QuantityValue value, ElectricCurrentDensityUnit fromUnit) { - return new ElectricCurrentDensity((double)value, fromUnit); + return new ElectricCurrentDensity((double)value, fromUnit); } #endregion @@ -277,7 +277,7 @@ public static ElectricCurrentDensity From(QuantityValue value, ElectricCurrentDe /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ElectricCurrentDensity Parse(string str) + public static ElectricCurrentDensity Parse(string str) { return Parse(str, null); } @@ -305,9 +305,9 @@ public static ElectricCurrentDensity Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ElectricCurrentDensity Parse(string str, [CanBeNull] IFormatProvider provider) + public static ElectricCurrentDensity Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ElectricCurrentDensityUnit>( str, provider, From); @@ -321,7 +321,7 @@ public static ElectricCurrentDensity Parse(string str, [CanBeNull] IFormatProvid /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ElectricCurrentDensity result) + public static bool TryParse([CanBeNull] string str, out ElectricCurrentDensity result) { return TryParse(str, null, out result); } @@ -336,9 +336,9 @@ public static bool TryParse([CanBeNull] string str, out ElectricCurrentDensity r /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentDensity result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentDensity result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ElectricCurrentDensityUnit>( str, provider, From, @@ -400,43 +400,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Arithmetic Operators /// Negate the value. - public static ElectricCurrentDensity operator -(ElectricCurrentDensity right) + public static ElectricCurrentDensity operator -(ElectricCurrentDensity right) { - return new ElectricCurrentDensity(-right.Value, right.Unit); + return new ElectricCurrentDensity(-right.Value, right.Unit); } - /// Get from adding two . - public static ElectricCurrentDensity operator +(ElectricCurrentDensity left, ElectricCurrentDensity right) + /// Get from adding two . + public static ElectricCurrentDensity operator +(ElectricCurrentDensity left, ElectricCurrentDensity right) { - return new ElectricCurrentDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ElectricCurrentDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ElectricCurrentDensity operator -(ElectricCurrentDensity left, ElectricCurrentDensity right) + /// Get from subtracting two . + public static ElectricCurrentDensity operator -(ElectricCurrentDensity left, ElectricCurrentDensity right) { - return new ElectricCurrentDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ElectricCurrentDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ElectricCurrentDensity operator *(double left, ElectricCurrentDensity right) + /// Get from multiplying value and . + public static ElectricCurrentDensity operator *(double left, ElectricCurrentDensity right) { - return new ElectricCurrentDensity(left * right.Value, right.Unit); + return new ElectricCurrentDensity(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ElectricCurrentDensity operator *(ElectricCurrentDensity left, double right) + /// Get from multiplying value and . + public static ElectricCurrentDensity operator *(ElectricCurrentDensity left, double right) { - return new ElectricCurrentDensity(left.Value * right, left.Unit); + return new ElectricCurrentDensity(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ElectricCurrentDensity operator /(ElectricCurrentDensity left, double right) + /// Get from dividing by value. + public static ElectricCurrentDensity operator /(ElectricCurrentDensity left, double right) { - return new ElectricCurrentDensity(left.Value / right, left.Unit); + return new ElectricCurrentDensity(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ElectricCurrentDensity left, ElectricCurrentDensity right) + /// Get ratio value from dividing by . + public static double operator /(ElectricCurrentDensity left, ElectricCurrentDensity right) { return left.AmperesPerSquareMeter / right.AmperesPerSquareMeter; } @@ -446,39 +446,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ElectricCurrentDensity left, ElectricCurrentDensity right) + public static bool operator <=(ElectricCurrentDensity left, ElectricCurrentDensity right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ElectricCurrentDensity left, ElectricCurrentDensity right) + public static bool operator >=(ElectricCurrentDensity left, ElectricCurrentDensity right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ElectricCurrentDensity left, ElectricCurrentDensity right) + public static bool operator <(ElectricCurrentDensity left, ElectricCurrentDensity right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ElectricCurrentDensity left, ElectricCurrentDensity right) + public static bool operator >(ElectricCurrentDensity left, ElectricCurrentDensity right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ElectricCurrentDensity left, ElectricCurrentDensity right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ElectricCurrentDensity left, ElectricCurrentDensity right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ElectricCurrentDensity left, ElectricCurrentDensity right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ElectricCurrentDensity left, ElectricCurrentDensity right) { return !(left == right); } @@ -487,37 +487,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrentDensity objElectricCurrentDensity)) throw new ArgumentException("Expected type ElectricCurrentDensity.", nameof(obj)); + if(!(obj is ElectricCurrentDensity objElectricCurrentDensity)) throw new ArgumentException("Expected type ElectricCurrentDensity.", nameof(obj)); return CompareTo(objElectricCurrentDensity); } /// - public int CompareTo(ElectricCurrentDensity other) + public int CompareTo(ElectricCurrentDensity other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricCurrentDensity objElectricCurrentDensity)) + if(obj is null || !(obj is ElectricCurrentDensity objElectricCurrentDensity)) return false; return Equals(objElectricCurrentDensity); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ElectricCurrentDensity other) + /// Consider using for safely comparing floating point values. + public bool Equals(ElectricCurrentDensity other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ElectricCurrentDensity within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -555,7 +555,7 @@ public bool Equals(ElectricCurrentDensity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricCurrentDensity other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricCurrentDensity other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -569,7 +569,7 @@ public bool Equals(ElectricCurrentDensity other, double tolerance, ComparisonTyp /// /// Returns the hash code for this instance. /// - /// A hash code for the current ElectricCurrentDensity. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -617,13 +617,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ElectricCurrentDensity to another ElectricCurrentDensity with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ElectricCurrentDensity with the specified unit. - public ElectricCurrentDensity ToUnit(ElectricCurrentDensityUnit unit) + /// A with the specified unit. + public ElectricCurrentDensity ToUnit(ElectricCurrentDensityUnit unit) { var convertedValue = GetValueAs(unit); - return new ElectricCurrentDensity(convertedValue, unit); + return new ElectricCurrentDensity(convertedValue, unit); } /// @@ -636,7 +636,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ElectricCurrentDensity ToUnit(UnitSystem unitSystem) + public ElectricCurrentDensity ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -681,10 +681,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ElectricCurrentDensity ToBaseUnit() + internal ElectricCurrentDensity ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ElectricCurrentDensity(baseUnitValue, BaseUnit); + return new ElectricCurrentDensity(baseUnitValue, BaseUnit); } private double GetValueAs(ElectricCurrentDensityUnit unit) @@ -795,7 +795,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -805,12 +805,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -855,16 +855,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricCurrentDensity)) + if(conversionType == typeof(ElectricCurrentDensity)) return this; else if(conversionType == typeof(ElectricCurrentDensityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ElectricCurrentDensity.QuantityType; + return ElectricCurrentDensity.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ElectricCurrentDensity.BaseDimensions; + return ElectricCurrentDensity.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs index c5366cb423..76dffdcb8a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// In electromagnetism, the current gradient describes how the current changes in time. /// - public partial struct ElectricCurrentGradient : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ElectricCurrentGradient : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -100,19 +100,19 @@ public ElectricCurrentGradient(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ElectricCurrentGradient, which is AmperePerSecond. All conversions go via this value. + /// The base unit of , which is AmperePerSecond. All conversions go via this value. /// public static ElectricCurrentGradientUnit BaseUnit { get; } = ElectricCurrentGradientUnit.AmperePerSecond; /// - /// Represents the largest possible value of ElectricCurrentGradient + /// Represents the largest possible value of /// - public static ElectricCurrentGradient MaxValue { get; } = new ElectricCurrentGradient(double.MaxValue, BaseUnit); + public static ElectricCurrentGradient MaxValue { get; } = new ElectricCurrentGradient(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ElectricCurrentGradient + /// Represents the smallest possible value of /// - public static ElectricCurrentGradient MinValue { get; } = new ElectricCurrentGradient(double.MinValue, BaseUnit); + public static ElectricCurrentGradient MinValue { get; } = new ElectricCurrentGradient(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -120,14 +120,14 @@ public ElectricCurrentGradient(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ElectricCurrentGradient; /// - /// All units of measurement for the ElectricCurrentGradient quantity. + /// All units of measurement for the quantity. /// public static ElectricCurrentGradientUnit[] Units { get; } = Enum.GetValues(typeof(ElectricCurrentGradientUnit)).Cast().Except(new ElectricCurrentGradientUnit[]{ ElectricCurrentGradientUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerSecond. /// - public static ElectricCurrentGradient Zero { get; } = new ElectricCurrentGradient(0, BaseUnit); + public static ElectricCurrentGradient Zero { get; } = new ElectricCurrentGradient(0, BaseUnit); #endregion @@ -152,19 +152,19 @@ public ElectricCurrentGradient(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ElectricCurrentGradient.QuantityType; + public QuantityType Type => ElectricCurrentGradient.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ElectricCurrentGradient.BaseDimensions; + public BaseDimensions Dimensions => ElectricCurrentGradient.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ElectricCurrentGradient in AmperesPerSecond. + /// Get in AmperesPerSecond. /// public double AmperesPerSecond => As(ElectricCurrentGradientUnit.AmperePerSecond); @@ -198,24 +198,24 @@ public static string GetAbbreviation(ElectricCurrentGradientUnit unit, [CanBeNul #region Static Factory Methods /// - /// Get ElectricCurrentGradient from AmperesPerSecond. + /// Get from AmperesPerSecond. /// /// If value is NaN or Infinity. - public static ElectricCurrentGradient FromAmperesPerSecond(QuantityValue amperespersecond) + public static ElectricCurrentGradient FromAmperesPerSecond(QuantityValue amperespersecond) { double value = (double) amperespersecond; - return new ElectricCurrentGradient(value, ElectricCurrentGradientUnit.AmperePerSecond); + return new ElectricCurrentGradient(value, ElectricCurrentGradientUnit.AmperePerSecond); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ElectricCurrentGradient unit value. - public static ElectricCurrentGradient From(QuantityValue value, ElectricCurrentGradientUnit fromUnit) + /// unit value. + public static ElectricCurrentGradient From(QuantityValue value, ElectricCurrentGradientUnit fromUnit) { - return new ElectricCurrentGradient((double)value, fromUnit); + return new ElectricCurrentGradient((double)value, fromUnit); } #endregion @@ -244,7 +244,7 @@ public static ElectricCurrentGradient From(QuantityValue value, ElectricCurrentG /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ElectricCurrentGradient Parse(string str) + public static ElectricCurrentGradient Parse(string str) { return Parse(str, null); } @@ -272,9 +272,9 @@ public static ElectricCurrentGradient Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ElectricCurrentGradient Parse(string str, [CanBeNull] IFormatProvider provider) + public static ElectricCurrentGradient Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ElectricCurrentGradientUnit>( str, provider, From); @@ -288,7 +288,7 @@ public static ElectricCurrentGradient Parse(string str, [CanBeNull] IFormatProvi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ElectricCurrentGradient result) + public static bool TryParse([CanBeNull] string str, out ElectricCurrentGradient result) { return TryParse(str, null, out result); } @@ -303,9 +303,9 @@ public static bool TryParse([CanBeNull] string str, out ElectricCurrentGradient /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentGradient result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentGradient result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ElectricCurrentGradientUnit>( str, provider, From, @@ -367,43 +367,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Arithmetic Operators /// Negate the value. - public static ElectricCurrentGradient operator -(ElectricCurrentGradient right) + public static ElectricCurrentGradient operator -(ElectricCurrentGradient right) { - return new ElectricCurrentGradient(-right.Value, right.Unit); + return new ElectricCurrentGradient(-right.Value, right.Unit); } - /// Get from adding two . - public static ElectricCurrentGradient operator +(ElectricCurrentGradient left, ElectricCurrentGradient right) + /// Get from adding two . + public static ElectricCurrentGradient operator +(ElectricCurrentGradient left, ElectricCurrentGradient right) { - return new ElectricCurrentGradient(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ElectricCurrentGradient(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ElectricCurrentGradient operator -(ElectricCurrentGradient left, ElectricCurrentGradient right) + /// Get from subtracting two . + public static ElectricCurrentGradient operator -(ElectricCurrentGradient left, ElectricCurrentGradient right) { - return new ElectricCurrentGradient(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ElectricCurrentGradient(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ElectricCurrentGradient operator *(double left, ElectricCurrentGradient right) + /// Get from multiplying value and . + public static ElectricCurrentGradient operator *(double left, ElectricCurrentGradient right) { - return new ElectricCurrentGradient(left * right.Value, right.Unit); + return new ElectricCurrentGradient(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ElectricCurrentGradient operator *(ElectricCurrentGradient left, double right) + /// Get from multiplying value and . + public static ElectricCurrentGradient operator *(ElectricCurrentGradient left, double right) { - return new ElectricCurrentGradient(left.Value * right, left.Unit); + return new ElectricCurrentGradient(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ElectricCurrentGradient operator /(ElectricCurrentGradient left, double right) + /// Get from dividing by value. + public static ElectricCurrentGradient operator /(ElectricCurrentGradient left, double right) { - return new ElectricCurrentGradient(left.Value / right, left.Unit); + return new ElectricCurrentGradient(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ElectricCurrentGradient left, ElectricCurrentGradient right) + /// Get ratio value from dividing by . + public static double operator /(ElectricCurrentGradient left, ElectricCurrentGradient right) { return left.AmperesPerSecond / right.AmperesPerSecond; } @@ -413,39 +413,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ElectricCurrentGradient left, ElectricCurrentGradient right) + public static bool operator <=(ElectricCurrentGradient left, ElectricCurrentGradient right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ElectricCurrentGradient left, ElectricCurrentGradient right) + public static bool operator >=(ElectricCurrentGradient left, ElectricCurrentGradient right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ElectricCurrentGradient left, ElectricCurrentGradient right) + public static bool operator <(ElectricCurrentGradient left, ElectricCurrentGradient right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ElectricCurrentGradient left, ElectricCurrentGradient right) + public static bool operator >(ElectricCurrentGradient left, ElectricCurrentGradient right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ElectricCurrentGradient left, ElectricCurrentGradient right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ElectricCurrentGradient left, ElectricCurrentGradient right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ElectricCurrentGradient left, ElectricCurrentGradient right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ElectricCurrentGradient left, ElectricCurrentGradient right) { return !(left == right); } @@ -454,37 +454,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrentGradient objElectricCurrentGradient)) throw new ArgumentException("Expected type ElectricCurrentGradient.", nameof(obj)); + if(!(obj is ElectricCurrentGradient objElectricCurrentGradient)) throw new ArgumentException("Expected type ElectricCurrentGradient.", nameof(obj)); return CompareTo(objElectricCurrentGradient); } /// - public int CompareTo(ElectricCurrentGradient other) + public int CompareTo(ElectricCurrentGradient other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricCurrentGradient objElectricCurrentGradient)) + if(obj is null || !(obj is ElectricCurrentGradient objElectricCurrentGradient)) return false; return Equals(objElectricCurrentGradient); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ElectricCurrentGradient other) + /// Consider using for safely comparing floating point values. + public bool Equals(ElectricCurrentGradient other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ElectricCurrentGradient within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -522,7 +522,7 @@ public bool Equals(ElectricCurrentGradient other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricCurrentGradient other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricCurrentGradient other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -536,7 +536,7 @@ public bool Equals(ElectricCurrentGradient other, double tolerance, ComparisonTy /// /// Returns the hash code for this instance. /// - /// A hash code for the current ElectricCurrentGradient. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -584,13 +584,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ElectricCurrentGradient to another ElectricCurrentGradient with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ElectricCurrentGradient with the specified unit. - public ElectricCurrentGradient ToUnit(ElectricCurrentGradientUnit unit) + /// A with the specified unit. + public ElectricCurrentGradient ToUnit(ElectricCurrentGradientUnit unit) { var convertedValue = GetValueAs(unit); - return new ElectricCurrentGradient(convertedValue, unit); + return new ElectricCurrentGradient(convertedValue, unit); } /// @@ -603,7 +603,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ElectricCurrentGradient ToUnit(UnitSystem unitSystem) + public ElectricCurrentGradient ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -646,10 +646,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ElectricCurrentGradient ToBaseUnit() + internal ElectricCurrentGradient ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ElectricCurrentGradient(baseUnitValue, BaseUnit); + return new ElectricCurrentGradient(baseUnitValue, BaseUnit); } private double GetValueAs(ElectricCurrentGradientUnit unit) @@ -758,7 +758,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -768,12 +768,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -818,16 +818,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricCurrentGradient)) + if(conversionType == typeof(ElectricCurrentGradient)) return this; else if(conversionType == typeof(ElectricCurrentGradientUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ElectricCurrentGradient.QuantityType; + return ElectricCurrentGradient.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ElectricCurrentGradient.BaseDimensions; + return ElectricCurrentGradient.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs index 0a388a3fbc..2b54907115 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electric_field /// - public partial struct ElectricField : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ElectricField : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -103,19 +103,19 @@ public ElectricField(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ElectricField, which is VoltPerMeter. All conversions go via this value. + /// The base unit of , which is VoltPerMeter. All conversions go via this value. /// public static ElectricFieldUnit BaseUnit { get; } = ElectricFieldUnit.VoltPerMeter; /// - /// Represents the largest possible value of ElectricField + /// Represents the largest possible value of /// - public static ElectricField MaxValue { get; } = new ElectricField(double.MaxValue, BaseUnit); + public static ElectricField MaxValue { get; } = new ElectricField(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ElectricField + /// Represents the smallest possible value of /// - public static ElectricField MinValue { get; } = new ElectricField(double.MinValue, BaseUnit); + public static ElectricField MinValue { get; } = new ElectricField(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -123,14 +123,14 @@ public ElectricField(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ElectricField; /// - /// All units of measurement for the ElectricField quantity. + /// All units of measurement for the quantity. /// public static ElectricFieldUnit[] Units { get; } = Enum.GetValues(typeof(ElectricFieldUnit)).Cast().Except(new ElectricFieldUnit[]{ ElectricFieldUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltPerMeter. /// - public static ElectricField Zero { get; } = new ElectricField(0, BaseUnit); + public static ElectricField Zero { get; } = new ElectricField(0, BaseUnit); #endregion @@ -155,19 +155,19 @@ public ElectricField(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ElectricField.QuantityType; + public QuantityType Type => ElectricField.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ElectricField.BaseDimensions; + public BaseDimensions Dimensions => ElectricField.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ElectricField in VoltsPerMeter. + /// Get in VoltsPerMeter. /// public double VoltsPerMeter => As(ElectricFieldUnit.VoltPerMeter); @@ -201,24 +201,24 @@ public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] IFormat #region Static Factory Methods /// - /// Get ElectricField from VoltsPerMeter. + /// Get from VoltsPerMeter. /// /// If value is NaN or Infinity. - public static ElectricField FromVoltsPerMeter(QuantityValue voltspermeter) + public static ElectricField FromVoltsPerMeter(QuantityValue voltspermeter) { double value = (double) voltspermeter; - return new ElectricField(value, ElectricFieldUnit.VoltPerMeter); + return new ElectricField(value, ElectricFieldUnit.VoltPerMeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ElectricField unit value. - public static ElectricField From(QuantityValue value, ElectricFieldUnit fromUnit) + /// unit value. + public static ElectricField From(QuantityValue value, ElectricFieldUnit fromUnit) { - return new ElectricField((double)value, fromUnit); + return new ElectricField((double)value, fromUnit); } #endregion @@ -247,7 +247,7 @@ public static ElectricField From(QuantityValue value, ElectricFieldUnit fromUnit /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ElectricField Parse(string str) + public static ElectricField Parse(string str) { return Parse(str, null); } @@ -275,9 +275,9 @@ public static ElectricField Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ElectricField Parse(string str, [CanBeNull] IFormatProvider provider) + public static ElectricField Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ElectricFieldUnit>( str, provider, From); @@ -291,7 +291,7 @@ public static ElectricField Parse(string str, [CanBeNull] IFormatProvider provid /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ElectricField result) + public static bool TryParse([CanBeNull] string str, out ElectricField result) { return TryParse(str, null, out result); } @@ -306,9 +306,9 @@ public static bool TryParse([CanBeNull] string str, out ElectricField result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricField result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricField result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ElectricFieldUnit>( str, provider, From, @@ -370,43 +370,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Arithmetic Operators /// Negate the value. - public static ElectricField operator -(ElectricField right) + public static ElectricField operator -(ElectricField right) { - return new ElectricField(-right.Value, right.Unit); + return new ElectricField(-right.Value, right.Unit); } - /// Get from adding two . - public static ElectricField operator +(ElectricField left, ElectricField right) + /// Get from adding two . + public static ElectricField operator +(ElectricField left, ElectricField right) { - return new ElectricField(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ElectricField(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ElectricField operator -(ElectricField left, ElectricField right) + /// Get from subtracting two . + public static ElectricField operator -(ElectricField left, ElectricField right) { - return new ElectricField(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ElectricField(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ElectricField operator *(double left, ElectricField right) + /// Get from multiplying value and . + public static ElectricField operator *(double left, ElectricField right) { - return new ElectricField(left * right.Value, right.Unit); + return new ElectricField(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ElectricField operator *(ElectricField left, double right) + /// Get from multiplying value and . + public static ElectricField operator *(ElectricField left, double right) { - return new ElectricField(left.Value * right, left.Unit); + return new ElectricField(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ElectricField operator /(ElectricField left, double right) + /// Get from dividing by value. + public static ElectricField operator /(ElectricField left, double right) { - return new ElectricField(left.Value / right, left.Unit); + return new ElectricField(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ElectricField left, ElectricField right) + /// Get ratio value from dividing by . + public static double operator /(ElectricField left, ElectricField right) { return left.VoltsPerMeter / right.VoltsPerMeter; } @@ -416,39 +416,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ElectricField left, ElectricField right) + public static bool operator <=(ElectricField left, ElectricField right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ElectricField left, ElectricField right) + public static bool operator >=(ElectricField left, ElectricField right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ElectricField left, ElectricField right) + public static bool operator <(ElectricField left, ElectricField right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ElectricField left, ElectricField right) + public static bool operator >(ElectricField left, ElectricField right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ElectricField left, ElectricField right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ElectricField left, ElectricField right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ElectricField left, ElectricField right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ElectricField left, ElectricField right) { return !(left == right); } @@ -457,37 +457,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricField objElectricField)) throw new ArgumentException("Expected type ElectricField.", nameof(obj)); + if(!(obj is ElectricField objElectricField)) throw new ArgumentException("Expected type ElectricField.", nameof(obj)); return CompareTo(objElectricField); } /// - public int CompareTo(ElectricField other) + public int CompareTo(ElectricField other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricField objElectricField)) + if(obj is null || !(obj is ElectricField objElectricField)) return false; return Equals(objElectricField); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ElectricField other) + /// Consider using for safely comparing floating point values. + public bool Equals(ElectricField other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ElectricField within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -525,7 +525,7 @@ public bool Equals(ElectricField other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricField other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricField other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -539,7 +539,7 @@ public bool Equals(ElectricField other, double tolerance, ComparisonType compari /// /// Returns the hash code for this instance. /// - /// A hash code for the current ElectricField. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -587,13 +587,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ElectricField to another ElectricField with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ElectricField with the specified unit. - public ElectricField ToUnit(ElectricFieldUnit unit) + /// A with the specified unit. + public ElectricField ToUnit(ElectricFieldUnit unit) { var convertedValue = GetValueAs(unit); - return new ElectricField(convertedValue, unit); + return new ElectricField(convertedValue, unit); } /// @@ -606,7 +606,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ElectricField ToUnit(UnitSystem unitSystem) + public ElectricField ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -649,10 +649,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ElectricField ToBaseUnit() + internal ElectricField ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ElectricField(baseUnitValue, BaseUnit); + return new ElectricField(baseUnitValue, BaseUnit); } private double GetValueAs(ElectricFieldUnit unit) @@ -761,7 +761,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricField)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricField)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -771,12 +771,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricField)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricField)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricField)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricField)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -821,16 +821,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricField)) + if(conversionType == typeof(ElectricField)) return this; else if(conversionType == typeof(ElectricFieldUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ElectricField.QuantityType; + return ElectricField.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ElectricField.BaseDimensions; + return ElectricField.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ElectricField)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricField)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs index 47282ca714..6cf5da815e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Inductance /// - public partial struct ElectricInductance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ElectricInductance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -106,19 +106,19 @@ public ElectricInductance(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ElectricInductance, which is Henry. All conversions go via this value. + /// The base unit of , which is Henry. All conversions go via this value. /// public static ElectricInductanceUnit BaseUnit { get; } = ElectricInductanceUnit.Henry; /// - /// Represents the largest possible value of ElectricInductance + /// Represents the largest possible value of /// - public static ElectricInductance MaxValue { get; } = new ElectricInductance(double.MaxValue, BaseUnit); + public static ElectricInductance MaxValue { get; } = new ElectricInductance(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ElectricInductance + /// Represents the smallest possible value of /// - public static ElectricInductance MinValue { get; } = new ElectricInductance(double.MinValue, BaseUnit); + public static ElectricInductance MinValue { get; } = new ElectricInductance(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -126,14 +126,14 @@ public ElectricInductance(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ElectricInductance; /// - /// All units of measurement for the ElectricInductance quantity. + /// All units of measurement for the quantity. /// public static ElectricInductanceUnit[] Units { get; } = Enum.GetValues(typeof(ElectricInductanceUnit)).Cast().Except(new ElectricInductanceUnit[]{ ElectricInductanceUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Henry. /// - public static ElectricInductance Zero { get; } = new ElectricInductance(0, BaseUnit); + public static ElectricInductance Zero { get; } = new ElectricInductance(0, BaseUnit); #endregion @@ -158,34 +158,34 @@ public ElectricInductance(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ElectricInductance.QuantityType; + public QuantityType Type => ElectricInductance.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ElectricInductance.BaseDimensions; + public BaseDimensions Dimensions => ElectricInductance.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ElectricInductance in Henries. + /// Get in Henries. /// public double Henries => As(ElectricInductanceUnit.Henry); /// - /// Get ElectricInductance in Microhenries. + /// Get in Microhenries. /// public double Microhenries => As(ElectricInductanceUnit.Microhenry); /// - /// Get ElectricInductance in Millihenries. + /// Get in Millihenries. /// public double Millihenries => As(ElectricInductanceUnit.Millihenry); /// - /// Get ElectricInductance in Nanohenries. + /// Get in Nanohenries. /// public double Nanohenries => As(ElectricInductanceUnit.Nanohenry); @@ -219,51 +219,51 @@ public static string GetAbbreviation(ElectricInductanceUnit unit, [CanBeNull] IF #region Static Factory Methods /// - /// Get ElectricInductance from Henries. + /// Get from Henries. /// /// If value is NaN or Infinity. - public static ElectricInductance FromHenries(QuantityValue henries) + public static ElectricInductance FromHenries(QuantityValue henries) { double value = (double) henries; - return new ElectricInductance(value, ElectricInductanceUnit.Henry); + return new ElectricInductance(value, ElectricInductanceUnit.Henry); } /// - /// Get ElectricInductance from Microhenries. + /// Get from Microhenries. /// /// If value is NaN or Infinity. - public static ElectricInductance FromMicrohenries(QuantityValue microhenries) + public static ElectricInductance FromMicrohenries(QuantityValue microhenries) { double value = (double) microhenries; - return new ElectricInductance(value, ElectricInductanceUnit.Microhenry); + return new ElectricInductance(value, ElectricInductanceUnit.Microhenry); } /// - /// Get ElectricInductance from Millihenries. + /// Get from Millihenries. /// /// If value is NaN or Infinity. - public static ElectricInductance FromMillihenries(QuantityValue millihenries) + public static ElectricInductance FromMillihenries(QuantityValue millihenries) { double value = (double) millihenries; - return new ElectricInductance(value, ElectricInductanceUnit.Millihenry); + return new ElectricInductance(value, ElectricInductanceUnit.Millihenry); } /// - /// Get ElectricInductance from Nanohenries. + /// Get from Nanohenries. /// /// If value is NaN or Infinity. - public static ElectricInductance FromNanohenries(QuantityValue nanohenries) + public static ElectricInductance FromNanohenries(QuantityValue nanohenries) { double value = (double) nanohenries; - return new ElectricInductance(value, ElectricInductanceUnit.Nanohenry); + return new ElectricInductance(value, ElectricInductanceUnit.Nanohenry); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ElectricInductance unit value. - public static ElectricInductance From(QuantityValue value, ElectricInductanceUnit fromUnit) + /// unit value. + public static ElectricInductance From(QuantityValue value, ElectricInductanceUnit fromUnit) { - return new ElectricInductance((double)value, fromUnit); + return new ElectricInductance((double)value, fromUnit); } #endregion @@ -292,7 +292,7 @@ public static ElectricInductance From(QuantityValue value, ElectricInductanceUni /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ElectricInductance Parse(string str) + public static ElectricInductance Parse(string str) { return Parse(str, null); } @@ -320,9 +320,9 @@ public static ElectricInductance Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ElectricInductance Parse(string str, [CanBeNull] IFormatProvider provider) + public static ElectricInductance Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ElectricInductanceUnit>( str, provider, From); @@ -336,7 +336,7 @@ public static ElectricInductance Parse(string str, [CanBeNull] IFormatProvider p /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ElectricInductance result) + public static bool TryParse([CanBeNull] string str, out ElectricInductance result) { return TryParse(str, null, out result); } @@ -351,9 +351,9 @@ public static bool TryParse([CanBeNull] string str, out ElectricInductance resul /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricInductance result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricInductance result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ElectricInductanceUnit>( str, provider, From, @@ -415,43 +415,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Arithmetic Operators /// Negate the value. - public static ElectricInductance operator -(ElectricInductance right) + public static ElectricInductance operator -(ElectricInductance right) { - return new ElectricInductance(-right.Value, right.Unit); + return new ElectricInductance(-right.Value, right.Unit); } - /// Get from adding two . - public static ElectricInductance operator +(ElectricInductance left, ElectricInductance right) + /// Get from adding two . + public static ElectricInductance operator +(ElectricInductance left, ElectricInductance right) { - return new ElectricInductance(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ElectricInductance(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ElectricInductance operator -(ElectricInductance left, ElectricInductance right) + /// Get from subtracting two . + public static ElectricInductance operator -(ElectricInductance left, ElectricInductance right) { - return new ElectricInductance(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ElectricInductance(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ElectricInductance operator *(double left, ElectricInductance right) + /// Get from multiplying value and . + public static ElectricInductance operator *(double left, ElectricInductance right) { - return new ElectricInductance(left * right.Value, right.Unit); + return new ElectricInductance(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ElectricInductance operator *(ElectricInductance left, double right) + /// Get from multiplying value and . + public static ElectricInductance operator *(ElectricInductance left, double right) { - return new ElectricInductance(left.Value * right, left.Unit); + return new ElectricInductance(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ElectricInductance operator /(ElectricInductance left, double right) + /// Get from dividing by value. + public static ElectricInductance operator /(ElectricInductance left, double right) { - return new ElectricInductance(left.Value / right, left.Unit); + return new ElectricInductance(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ElectricInductance left, ElectricInductance right) + /// Get ratio value from dividing by . + public static double operator /(ElectricInductance left, ElectricInductance right) { return left.Henries / right.Henries; } @@ -461,39 +461,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ElectricInductance left, ElectricInductance right) + public static bool operator <=(ElectricInductance left, ElectricInductance right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ElectricInductance left, ElectricInductance right) + public static bool operator >=(ElectricInductance left, ElectricInductance right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ElectricInductance left, ElectricInductance right) + public static bool operator <(ElectricInductance left, ElectricInductance right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ElectricInductance left, ElectricInductance right) + public static bool operator >(ElectricInductance left, ElectricInductance right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ElectricInductance left, ElectricInductance right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ElectricInductance left, ElectricInductance right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ElectricInductance left, ElectricInductance right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ElectricInductance left, ElectricInductance right) { return !(left == right); } @@ -502,37 +502,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricInductance objElectricInductance)) throw new ArgumentException("Expected type ElectricInductance.", nameof(obj)); + if(!(obj is ElectricInductance objElectricInductance)) throw new ArgumentException("Expected type ElectricInductance.", nameof(obj)); return CompareTo(objElectricInductance); } /// - public int CompareTo(ElectricInductance other) + public int CompareTo(ElectricInductance other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricInductance objElectricInductance)) + if(obj is null || !(obj is ElectricInductance objElectricInductance)) return false; return Equals(objElectricInductance); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ElectricInductance other) + /// Consider using for safely comparing floating point values. + public bool Equals(ElectricInductance other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ElectricInductance within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -570,7 +570,7 @@ public bool Equals(ElectricInductance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricInductance other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricInductance other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -584,7 +584,7 @@ public bool Equals(ElectricInductance other, double tolerance, ComparisonType co /// /// Returns the hash code for this instance. /// - /// A hash code for the current ElectricInductance. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -632,13 +632,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ElectricInductance to another ElectricInductance with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ElectricInductance with the specified unit. - public ElectricInductance ToUnit(ElectricInductanceUnit unit) + /// A with the specified unit. + public ElectricInductance ToUnit(ElectricInductanceUnit unit) { var convertedValue = GetValueAs(unit); - return new ElectricInductance(convertedValue, unit); + return new ElectricInductance(convertedValue, unit); } /// @@ -651,7 +651,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ElectricInductance ToUnit(UnitSystem unitSystem) + public ElectricInductance ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -697,10 +697,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ElectricInductance ToBaseUnit() + internal ElectricInductance ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ElectricInductance(baseUnitValue, BaseUnit); + return new ElectricInductance(baseUnitValue, BaseUnit); } private double GetValueAs(ElectricInductanceUnit unit) @@ -812,7 +812,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -822,12 +822,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -872,16 +872,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricInductance)) + if(conversionType == typeof(ElectricInductance)) return this; else if(conversionType == typeof(ElectricInductanceUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ElectricInductance.QuantityType; + return ElectricInductance.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ElectricInductance.BaseDimensions; + return ElectricInductance.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs index e1a6cccc54..aaad50c91e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// In classical electromagnetism, the electric potential (a scalar quantity denoted by Φ, ΦE or V and also called the electric field potential or the electrostatic potential) at a point is the amount of electric potential energy that a unitary point charge would have when located at that point. /// - public partial struct ElectricPotential : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ElectricPotential : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -104,19 +104,19 @@ public ElectricPotential(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ElectricPotential, which is Volt. All conversions go via this value. + /// The base unit of , which is Volt. All conversions go via this value. /// public static ElectricPotentialUnit BaseUnit { get; } = ElectricPotentialUnit.Volt; /// - /// Represents the largest possible value of ElectricPotential + /// Represents the largest possible value of /// - public static ElectricPotential MaxValue { get; } = new ElectricPotential(double.MaxValue, BaseUnit); + public static ElectricPotential MaxValue { get; } = new ElectricPotential(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ElectricPotential + /// Represents the smallest possible value of /// - public static ElectricPotential MinValue { get; } = new ElectricPotential(double.MinValue, BaseUnit); + public static ElectricPotential MinValue { get; } = new ElectricPotential(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -124,14 +124,14 @@ public ElectricPotential(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ElectricPotential; /// - /// All units of measurement for the ElectricPotential quantity. + /// All units of measurement for the quantity. /// public static ElectricPotentialUnit[] Units { get; } = Enum.GetValues(typeof(ElectricPotentialUnit)).Cast().Except(new ElectricPotentialUnit[]{ ElectricPotentialUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Volt. /// - public static ElectricPotential Zero { get; } = new ElectricPotential(0, BaseUnit); + public static ElectricPotential Zero { get; } = new ElectricPotential(0, BaseUnit); #endregion @@ -156,39 +156,39 @@ public ElectricPotential(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ElectricPotential.QuantityType; + public QuantityType Type => ElectricPotential.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ElectricPotential.BaseDimensions; + public BaseDimensions Dimensions => ElectricPotential.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ElectricPotential in Kilovolts. + /// Get in Kilovolts. /// public double Kilovolts => As(ElectricPotentialUnit.Kilovolt); /// - /// Get ElectricPotential in Megavolts. + /// Get in Megavolts. /// public double Megavolts => As(ElectricPotentialUnit.Megavolt); /// - /// Get ElectricPotential in Microvolts. + /// Get in Microvolts. /// public double Microvolts => As(ElectricPotentialUnit.Microvolt); /// - /// Get ElectricPotential in Millivolts. + /// Get in Millivolts. /// public double Millivolts => As(ElectricPotentialUnit.Millivolt); /// - /// Get ElectricPotential in Volts. + /// Get in Volts. /// public double Volts => As(ElectricPotentialUnit.Volt); @@ -222,60 +222,60 @@ public static string GetAbbreviation(ElectricPotentialUnit unit, [CanBeNull] IFo #region Static Factory Methods /// - /// Get ElectricPotential from Kilovolts. + /// Get from Kilovolts. /// /// If value is NaN or Infinity. - public static ElectricPotential FromKilovolts(QuantityValue kilovolts) + public static ElectricPotential FromKilovolts(QuantityValue kilovolts) { double value = (double) kilovolts; - return new ElectricPotential(value, ElectricPotentialUnit.Kilovolt); + return new ElectricPotential(value, ElectricPotentialUnit.Kilovolt); } /// - /// Get ElectricPotential from Megavolts. + /// Get from Megavolts. /// /// If value is NaN or Infinity. - public static ElectricPotential FromMegavolts(QuantityValue megavolts) + public static ElectricPotential FromMegavolts(QuantityValue megavolts) { double value = (double) megavolts; - return new ElectricPotential(value, ElectricPotentialUnit.Megavolt); + return new ElectricPotential(value, ElectricPotentialUnit.Megavolt); } /// - /// Get ElectricPotential from Microvolts. + /// Get from Microvolts. /// /// If value is NaN or Infinity. - public static ElectricPotential FromMicrovolts(QuantityValue microvolts) + public static ElectricPotential FromMicrovolts(QuantityValue microvolts) { double value = (double) microvolts; - return new ElectricPotential(value, ElectricPotentialUnit.Microvolt); + return new ElectricPotential(value, ElectricPotentialUnit.Microvolt); } /// - /// Get ElectricPotential from Millivolts. + /// Get from Millivolts. /// /// If value is NaN or Infinity. - public static ElectricPotential FromMillivolts(QuantityValue millivolts) + public static ElectricPotential FromMillivolts(QuantityValue millivolts) { double value = (double) millivolts; - return new ElectricPotential(value, ElectricPotentialUnit.Millivolt); + return new ElectricPotential(value, ElectricPotentialUnit.Millivolt); } /// - /// Get ElectricPotential from Volts. + /// Get from Volts. /// /// If value is NaN or Infinity. - public static ElectricPotential FromVolts(QuantityValue volts) + public static ElectricPotential FromVolts(QuantityValue volts) { double value = (double) volts; - return new ElectricPotential(value, ElectricPotentialUnit.Volt); + return new ElectricPotential(value, ElectricPotentialUnit.Volt); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ElectricPotential unit value. - public static ElectricPotential From(QuantityValue value, ElectricPotentialUnit fromUnit) + /// unit value. + public static ElectricPotential From(QuantityValue value, ElectricPotentialUnit fromUnit) { - return new ElectricPotential((double)value, fromUnit); + return new ElectricPotential((double)value, fromUnit); } #endregion @@ -304,7 +304,7 @@ public static ElectricPotential From(QuantityValue value, ElectricPotentialUnit /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ElectricPotential Parse(string str) + public static ElectricPotential Parse(string str) { return Parse(str, null); } @@ -332,9 +332,9 @@ public static ElectricPotential Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ElectricPotential Parse(string str, [CanBeNull] IFormatProvider provider) + public static ElectricPotential Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ElectricPotentialUnit>( str, provider, From); @@ -348,7 +348,7 @@ public static ElectricPotential Parse(string str, [CanBeNull] IFormatProvider pr /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ElectricPotential result) + public static bool TryParse([CanBeNull] string str, out ElectricPotential result) { return TryParse(str, null, out result); } @@ -363,9 +363,9 @@ public static bool TryParse([CanBeNull] string str, out ElectricPotential result /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotential result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotential result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ElectricPotentialUnit>( str, provider, From, @@ -427,43 +427,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Arithmetic Operators /// Negate the value. - public static ElectricPotential operator -(ElectricPotential right) + public static ElectricPotential operator -(ElectricPotential right) { - return new ElectricPotential(-right.Value, right.Unit); + return new ElectricPotential(-right.Value, right.Unit); } - /// Get from adding two . - public static ElectricPotential operator +(ElectricPotential left, ElectricPotential right) + /// Get from adding two . + public static ElectricPotential operator +(ElectricPotential left, ElectricPotential right) { - return new ElectricPotential(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ElectricPotential(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ElectricPotential operator -(ElectricPotential left, ElectricPotential right) + /// Get from subtracting two . + public static ElectricPotential operator -(ElectricPotential left, ElectricPotential right) { - return new ElectricPotential(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ElectricPotential(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ElectricPotential operator *(double left, ElectricPotential right) + /// Get from multiplying value and . + public static ElectricPotential operator *(double left, ElectricPotential right) { - return new ElectricPotential(left * right.Value, right.Unit); + return new ElectricPotential(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ElectricPotential operator *(ElectricPotential left, double right) + /// Get from multiplying value and . + public static ElectricPotential operator *(ElectricPotential left, double right) { - return new ElectricPotential(left.Value * right, left.Unit); + return new ElectricPotential(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ElectricPotential operator /(ElectricPotential left, double right) + /// Get from dividing by value. + public static ElectricPotential operator /(ElectricPotential left, double right) { - return new ElectricPotential(left.Value / right, left.Unit); + return new ElectricPotential(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ElectricPotential left, ElectricPotential right) + /// Get ratio value from dividing by . + public static double operator /(ElectricPotential left, ElectricPotential right) { return left.Volts / right.Volts; } @@ -473,39 +473,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ElectricPotential left, ElectricPotential right) + public static bool operator <=(ElectricPotential left, ElectricPotential right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ElectricPotential left, ElectricPotential right) + public static bool operator >=(ElectricPotential left, ElectricPotential right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ElectricPotential left, ElectricPotential right) + public static bool operator <(ElectricPotential left, ElectricPotential right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ElectricPotential left, ElectricPotential right) + public static bool operator >(ElectricPotential left, ElectricPotential right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ElectricPotential left, ElectricPotential right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ElectricPotential left, ElectricPotential right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ElectricPotential left, ElectricPotential right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ElectricPotential left, ElectricPotential right) { return !(left == right); } @@ -514,37 +514,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotential objElectricPotential)) throw new ArgumentException("Expected type ElectricPotential.", nameof(obj)); + if(!(obj is ElectricPotential objElectricPotential)) throw new ArgumentException("Expected type ElectricPotential.", nameof(obj)); return CompareTo(objElectricPotential); } /// - public int CompareTo(ElectricPotential other) + public int CompareTo(ElectricPotential other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricPotential objElectricPotential)) + if(obj is null || !(obj is ElectricPotential objElectricPotential)) return false; return Equals(objElectricPotential); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ElectricPotential other) + /// Consider using for safely comparing floating point values. + public bool Equals(ElectricPotential other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ElectricPotential within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -582,7 +582,7 @@ public bool Equals(ElectricPotential other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricPotential other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricPotential other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -596,7 +596,7 @@ public bool Equals(ElectricPotential other, double tolerance, ComparisonType com /// /// Returns the hash code for this instance. /// - /// A hash code for the current ElectricPotential. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -644,13 +644,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ElectricPotential to another ElectricPotential with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ElectricPotential with the specified unit. - public ElectricPotential ToUnit(ElectricPotentialUnit unit) + /// A with the specified unit. + public ElectricPotential ToUnit(ElectricPotentialUnit unit) { var convertedValue = GetValueAs(unit); - return new ElectricPotential(convertedValue, unit); + return new ElectricPotential(convertedValue, unit); } /// @@ -663,7 +663,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ElectricPotential ToUnit(UnitSystem unitSystem) + public ElectricPotential ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -710,10 +710,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ElectricPotential ToBaseUnit() + internal ElectricPotential ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ElectricPotential(baseUnitValue, BaseUnit); + return new ElectricPotential(baseUnitValue, BaseUnit); } private double GetValueAs(ElectricPotentialUnit unit) @@ -826,7 +826,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -836,12 +836,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -886,16 +886,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricPotential)) + if(conversionType == typeof(ElectricPotential)) return this; else if(conversionType == typeof(ElectricPotentialUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ElectricPotential.QuantityType; + return ElectricPotential.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ElectricPotential.BaseDimensions; + return ElectricPotential.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs index 37892c41ef..45d84611c7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// The Electric Potential of a system known to use Alternating Current. /// - public partial struct ElectricPotentialAc : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ElectricPotentialAc : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -104,19 +104,19 @@ public ElectricPotentialAc(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ElectricPotentialAc, which is VoltAc. All conversions go via this value. + /// The base unit of , which is VoltAc. All conversions go via this value. /// public static ElectricPotentialAcUnit BaseUnit { get; } = ElectricPotentialAcUnit.VoltAc; /// - /// Represents the largest possible value of ElectricPotentialAc + /// Represents the largest possible value of /// - public static ElectricPotentialAc MaxValue { get; } = new ElectricPotentialAc(double.MaxValue, BaseUnit); + public static ElectricPotentialAc MaxValue { get; } = new ElectricPotentialAc(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ElectricPotentialAc + /// Represents the smallest possible value of /// - public static ElectricPotentialAc MinValue { get; } = new ElectricPotentialAc(double.MinValue, BaseUnit); + public static ElectricPotentialAc MinValue { get; } = new ElectricPotentialAc(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -124,14 +124,14 @@ public ElectricPotentialAc(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ElectricPotentialAc; /// - /// All units of measurement for the ElectricPotentialAc quantity. + /// All units of measurement for the quantity. /// public static ElectricPotentialAcUnit[] Units { get; } = Enum.GetValues(typeof(ElectricPotentialAcUnit)).Cast().Except(new ElectricPotentialAcUnit[]{ ElectricPotentialAcUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltAc. /// - public static ElectricPotentialAc Zero { get; } = new ElectricPotentialAc(0, BaseUnit); + public static ElectricPotentialAc Zero { get; } = new ElectricPotentialAc(0, BaseUnit); #endregion @@ -156,39 +156,39 @@ public ElectricPotentialAc(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ElectricPotentialAc.QuantityType; + public QuantityType Type => ElectricPotentialAc.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ElectricPotentialAc.BaseDimensions; + public BaseDimensions Dimensions => ElectricPotentialAc.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ElectricPotentialAc in KilovoltsAc. + /// Get in KilovoltsAc. /// public double KilovoltsAc => As(ElectricPotentialAcUnit.KilovoltAc); /// - /// Get ElectricPotentialAc in MegavoltsAc. + /// Get in MegavoltsAc. /// public double MegavoltsAc => As(ElectricPotentialAcUnit.MegavoltAc); /// - /// Get ElectricPotentialAc in MicrovoltsAc. + /// Get in MicrovoltsAc. /// public double MicrovoltsAc => As(ElectricPotentialAcUnit.MicrovoltAc); /// - /// Get ElectricPotentialAc in MillivoltsAc. + /// Get in MillivoltsAc. /// public double MillivoltsAc => As(ElectricPotentialAcUnit.MillivoltAc); /// - /// Get ElectricPotentialAc in VoltsAc. + /// Get in VoltsAc. /// public double VoltsAc => As(ElectricPotentialAcUnit.VoltAc); @@ -222,60 +222,60 @@ public static string GetAbbreviation(ElectricPotentialAcUnit unit, [CanBeNull] I #region Static Factory Methods /// - /// Get ElectricPotentialAc from KilovoltsAc. + /// Get from KilovoltsAc. /// /// If value is NaN or Infinity. - public static ElectricPotentialAc FromKilovoltsAc(QuantityValue kilovoltsac) + public static ElectricPotentialAc FromKilovoltsAc(QuantityValue kilovoltsac) { double value = (double) kilovoltsac; - return new ElectricPotentialAc(value, ElectricPotentialAcUnit.KilovoltAc); + return new ElectricPotentialAc(value, ElectricPotentialAcUnit.KilovoltAc); } /// - /// Get ElectricPotentialAc from MegavoltsAc. + /// Get from MegavoltsAc. /// /// If value is NaN or Infinity. - public static ElectricPotentialAc FromMegavoltsAc(QuantityValue megavoltsac) + public static ElectricPotentialAc FromMegavoltsAc(QuantityValue megavoltsac) { double value = (double) megavoltsac; - return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MegavoltAc); + return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MegavoltAc); } /// - /// Get ElectricPotentialAc from MicrovoltsAc. + /// Get from MicrovoltsAc. /// /// If value is NaN or Infinity. - public static ElectricPotentialAc FromMicrovoltsAc(QuantityValue microvoltsac) + public static ElectricPotentialAc FromMicrovoltsAc(QuantityValue microvoltsac) { double value = (double) microvoltsac; - return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MicrovoltAc); + return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MicrovoltAc); } /// - /// Get ElectricPotentialAc from MillivoltsAc. + /// Get from MillivoltsAc. /// /// If value is NaN or Infinity. - public static ElectricPotentialAc FromMillivoltsAc(QuantityValue millivoltsac) + public static ElectricPotentialAc FromMillivoltsAc(QuantityValue millivoltsac) { double value = (double) millivoltsac; - return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MillivoltAc); + return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MillivoltAc); } /// - /// Get ElectricPotentialAc from VoltsAc. + /// Get from VoltsAc. /// /// If value is NaN or Infinity. - public static ElectricPotentialAc FromVoltsAc(QuantityValue voltsac) + public static ElectricPotentialAc FromVoltsAc(QuantityValue voltsac) { double value = (double) voltsac; - return new ElectricPotentialAc(value, ElectricPotentialAcUnit.VoltAc); + return new ElectricPotentialAc(value, ElectricPotentialAcUnit.VoltAc); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ElectricPotentialAc unit value. - public static ElectricPotentialAc From(QuantityValue value, ElectricPotentialAcUnit fromUnit) + /// unit value. + public static ElectricPotentialAc From(QuantityValue value, ElectricPotentialAcUnit fromUnit) { - return new ElectricPotentialAc((double)value, fromUnit); + return new ElectricPotentialAc((double)value, fromUnit); } #endregion @@ -304,7 +304,7 @@ public static ElectricPotentialAc From(QuantityValue value, ElectricPotentialAcU /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ElectricPotentialAc Parse(string str) + public static ElectricPotentialAc Parse(string str) { return Parse(str, null); } @@ -332,9 +332,9 @@ public static ElectricPotentialAc Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ElectricPotentialAc Parse(string str, [CanBeNull] IFormatProvider provider) + public static ElectricPotentialAc Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ElectricPotentialAcUnit>( str, provider, From); @@ -348,7 +348,7 @@ public static ElectricPotentialAc Parse(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ElectricPotentialAc result) + public static bool TryParse([CanBeNull] string str, out ElectricPotentialAc result) { return TryParse(str, null, out result); } @@ -363,9 +363,9 @@ public static bool TryParse([CanBeNull] string str, out ElectricPotentialAc resu /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialAc result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialAc result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ElectricPotentialAcUnit>( str, provider, From, @@ -427,43 +427,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Arithmetic Operators /// Negate the value. - public static ElectricPotentialAc operator -(ElectricPotentialAc right) + public static ElectricPotentialAc operator -(ElectricPotentialAc right) { - return new ElectricPotentialAc(-right.Value, right.Unit); + return new ElectricPotentialAc(-right.Value, right.Unit); } - /// Get from adding two . - public static ElectricPotentialAc operator +(ElectricPotentialAc left, ElectricPotentialAc right) + /// Get from adding two . + public static ElectricPotentialAc operator +(ElectricPotentialAc left, ElectricPotentialAc right) { - return new ElectricPotentialAc(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ElectricPotentialAc(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ElectricPotentialAc operator -(ElectricPotentialAc left, ElectricPotentialAc right) + /// Get from subtracting two . + public static ElectricPotentialAc operator -(ElectricPotentialAc left, ElectricPotentialAc right) { - return new ElectricPotentialAc(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ElectricPotentialAc(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ElectricPotentialAc operator *(double left, ElectricPotentialAc right) + /// Get from multiplying value and . + public static ElectricPotentialAc operator *(double left, ElectricPotentialAc right) { - return new ElectricPotentialAc(left * right.Value, right.Unit); + return new ElectricPotentialAc(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ElectricPotentialAc operator *(ElectricPotentialAc left, double right) + /// Get from multiplying value and . + public static ElectricPotentialAc operator *(ElectricPotentialAc left, double right) { - return new ElectricPotentialAc(left.Value * right, left.Unit); + return new ElectricPotentialAc(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ElectricPotentialAc operator /(ElectricPotentialAc left, double right) + /// Get from dividing by value. + public static ElectricPotentialAc operator /(ElectricPotentialAc left, double right) { - return new ElectricPotentialAc(left.Value / right, left.Unit); + return new ElectricPotentialAc(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ElectricPotentialAc left, ElectricPotentialAc right) + /// Get ratio value from dividing by . + public static double operator /(ElectricPotentialAc left, ElectricPotentialAc right) { return left.VoltsAc / right.VoltsAc; } @@ -473,39 +473,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ElectricPotentialAc left, ElectricPotentialAc right) + public static bool operator <=(ElectricPotentialAc left, ElectricPotentialAc right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ElectricPotentialAc left, ElectricPotentialAc right) + public static bool operator >=(ElectricPotentialAc left, ElectricPotentialAc right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ElectricPotentialAc left, ElectricPotentialAc right) + public static bool operator <(ElectricPotentialAc left, ElectricPotentialAc right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ElectricPotentialAc left, ElectricPotentialAc right) + public static bool operator >(ElectricPotentialAc left, ElectricPotentialAc right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ElectricPotentialAc left, ElectricPotentialAc right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ElectricPotentialAc left, ElectricPotentialAc right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ElectricPotentialAc left, ElectricPotentialAc right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ElectricPotentialAc left, ElectricPotentialAc right) { return !(left == right); } @@ -514,37 +514,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotentialAc objElectricPotentialAc)) throw new ArgumentException("Expected type ElectricPotentialAc.", nameof(obj)); + if(!(obj is ElectricPotentialAc objElectricPotentialAc)) throw new ArgumentException("Expected type ElectricPotentialAc.", nameof(obj)); return CompareTo(objElectricPotentialAc); } /// - public int CompareTo(ElectricPotentialAc other) + public int CompareTo(ElectricPotentialAc other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricPotentialAc objElectricPotentialAc)) + if(obj is null || !(obj is ElectricPotentialAc objElectricPotentialAc)) return false; return Equals(objElectricPotentialAc); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ElectricPotentialAc other) + /// Consider using for safely comparing floating point values. + public bool Equals(ElectricPotentialAc other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ElectricPotentialAc within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -582,7 +582,7 @@ public bool Equals(ElectricPotentialAc other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricPotentialAc other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricPotentialAc other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -596,7 +596,7 @@ public bool Equals(ElectricPotentialAc other, double tolerance, ComparisonType c /// /// Returns the hash code for this instance. /// - /// A hash code for the current ElectricPotentialAc. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -644,13 +644,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ElectricPotentialAc to another ElectricPotentialAc with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ElectricPotentialAc with the specified unit. - public ElectricPotentialAc ToUnit(ElectricPotentialAcUnit unit) + /// A with the specified unit. + public ElectricPotentialAc ToUnit(ElectricPotentialAcUnit unit) { var convertedValue = GetValueAs(unit); - return new ElectricPotentialAc(convertedValue, unit); + return new ElectricPotentialAc(convertedValue, unit); } /// @@ -663,7 +663,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ElectricPotentialAc ToUnit(UnitSystem unitSystem) + public ElectricPotentialAc ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -710,10 +710,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ElectricPotentialAc ToBaseUnit() + internal ElectricPotentialAc ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ElectricPotentialAc(baseUnitValue, BaseUnit); + return new ElectricPotentialAc(baseUnitValue, BaseUnit); } private double GetValueAs(ElectricPotentialAcUnit unit) @@ -826,7 +826,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -836,12 +836,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -886,16 +886,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricPotentialAc)) + if(conversionType == typeof(ElectricPotentialAc)) return this; else if(conversionType == typeof(ElectricPotentialAcUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ElectricPotentialAc.QuantityType; + return ElectricPotentialAc.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ElectricPotentialAc.BaseDimensions; + return ElectricPotentialAc.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs index dedbe936b8..77516c6992 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// The Electric Potential of a system known to use Direct Current. /// - public partial struct ElectricPotentialDc : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ElectricPotentialDc : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -104,19 +104,19 @@ public ElectricPotentialDc(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ElectricPotentialDc, which is VoltDc. All conversions go via this value. + /// The base unit of , which is VoltDc. All conversions go via this value. /// public static ElectricPotentialDcUnit BaseUnit { get; } = ElectricPotentialDcUnit.VoltDc; /// - /// Represents the largest possible value of ElectricPotentialDc + /// Represents the largest possible value of /// - public static ElectricPotentialDc MaxValue { get; } = new ElectricPotentialDc(double.MaxValue, BaseUnit); + public static ElectricPotentialDc MaxValue { get; } = new ElectricPotentialDc(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ElectricPotentialDc + /// Represents the smallest possible value of /// - public static ElectricPotentialDc MinValue { get; } = new ElectricPotentialDc(double.MinValue, BaseUnit); + public static ElectricPotentialDc MinValue { get; } = new ElectricPotentialDc(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -124,14 +124,14 @@ public ElectricPotentialDc(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ElectricPotentialDc; /// - /// All units of measurement for the ElectricPotentialDc quantity. + /// All units of measurement for the quantity. /// public static ElectricPotentialDcUnit[] Units { get; } = Enum.GetValues(typeof(ElectricPotentialDcUnit)).Cast().Except(new ElectricPotentialDcUnit[]{ ElectricPotentialDcUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltDc. /// - public static ElectricPotentialDc Zero { get; } = new ElectricPotentialDc(0, BaseUnit); + public static ElectricPotentialDc Zero { get; } = new ElectricPotentialDc(0, BaseUnit); #endregion @@ -156,39 +156,39 @@ public ElectricPotentialDc(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ElectricPotentialDc.QuantityType; + public QuantityType Type => ElectricPotentialDc.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ElectricPotentialDc.BaseDimensions; + public BaseDimensions Dimensions => ElectricPotentialDc.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ElectricPotentialDc in KilovoltsDc. + /// Get in KilovoltsDc. /// public double KilovoltsDc => As(ElectricPotentialDcUnit.KilovoltDc); /// - /// Get ElectricPotentialDc in MegavoltsDc. + /// Get in MegavoltsDc. /// public double MegavoltsDc => As(ElectricPotentialDcUnit.MegavoltDc); /// - /// Get ElectricPotentialDc in MicrovoltsDc. + /// Get in MicrovoltsDc. /// public double MicrovoltsDc => As(ElectricPotentialDcUnit.MicrovoltDc); /// - /// Get ElectricPotentialDc in MillivoltsDc. + /// Get in MillivoltsDc. /// public double MillivoltsDc => As(ElectricPotentialDcUnit.MillivoltDc); /// - /// Get ElectricPotentialDc in VoltsDc. + /// Get in VoltsDc. /// public double VoltsDc => As(ElectricPotentialDcUnit.VoltDc); @@ -222,60 +222,60 @@ public static string GetAbbreviation(ElectricPotentialDcUnit unit, [CanBeNull] I #region Static Factory Methods /// - /// Get ElectricPotentialDc from KilovoltsDc. + /// Get from KilovoltsDc. /// /// If value is NaN or Infinity. - public static ElectricPotentialDc FromKilovoltsDc(QuantityValue kilovoltsdc) + public static ElectricPotentialDc FromKilovoltsDc(QuantityValue kilovoltsdc) { double value = (double) kilovoltsdc; - return new ElectricPotentialDc(value, ElectricPotentialDcUnit.KilovoltDc); + return new ElectricPotentialDc(value, ElectricPotentialDcUnit.KilovoltDc); } /// - /// Get ElectricPotentialDc from MegavoltsDc. + /// Get from MegavoltsDc. /// /// If value is NaN or Infinity. - public static ElectricPotentialDc FromMegavoltsDc(QuantityValue megavoltsdc) + public static ElectricPotentialDc FromMegavoltsDc(QuantityValue megavoltsdc) { double value = (double) megavoltsdc; - return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MegavoltDc); + return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MegavoltDc); } /// - /// Get ElectricPotentialDc from MicrovoltsDc. + /// Get from MicrovoltsDc. /// /// If value is NaN or Infinity. - public static ElectricPotentialDc FromMicrovoltsDc(QuantityValue microvoltsdc) + public static ElectricPotentialDc FromMicrovoltsDc(QuantityValue microvoltsdc) { double value = (double) microvoltsdc; - return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MicrovoltDc); + return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MicrovoltDc); } /// - /// Get ElectricPotentialDc from MillivoltsDc. + /// Get from MillivoltsDc. /// /// If value is NaN or Infinity. - public static ElectricPotentialDc FromMillivoltsDc(QuantityValue millivoltsdc) + public static ElectricPotentialDc FromMillivoltsDc(QuantityValue millivoltsdc) { double value = (double) millivoltsdc; - return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MillivoltDc); + return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MillivoltDc); } /// - /// Get ElectricPotentialDc from VoltsDc. + /// Get from VoltsDc. /// /// If value is NaN or Infinity. - public static ElectricPotentialDc FromVoltsDc(QuantityValue voltsdc) + public static ElectricPotentialDc FromVoltsDc(QuantityValue voltsdc) { double value = (double) voltsdc; - return new ElectricPotentialDc(value, ElectricPotentialDcUnit.VoltDc); + return new ElectricPotentialDc(value, ElectricPotentialDcUnit.VoltDc); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ElectricPotentialDc unit value. - public static ElectricPotentialDc From(QuantityValue value, ElectricPotentialDcUnit fromUnit) + /// unit value. + public static ElectricPotentialDc From(QuantityValue value, ElectricPotentialDcUnit fromUnit) { - return new ElectricPotentialDc((double)value, fromUnit); + return new ElectricPotentialDc((double)value, fromUnit); } #endregion @@ -304,7 +304,7 @@ public static ElectricPotentialDc From(QuantityValue value, ElectricPotentialDcU /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ElectricPotentialDc Parse(string str) + public static ElectricPotentialDc Parse(string str) { return Parse(str, null); } @@ -332,9 +332,9 @@ public static ElectricPotentialDc Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ElectricPotentialDc Parse(string str, [CanBeNull] IFormatProvider provider) + public static ElectricPotentialDc Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ElectricPotentialDcUnit>( str, provider, From); @@ -348,7 +348,7 @@ public static ElectricPotentialDc Parse(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ElectricPotentialDc result) + public static bool TryParse([CanBeNull] string str, out ElectricPotentialDc result) { return TryParse(str, null, out result); } @@ -363,9 +363,9 @@ public static bool TryParse([CanBeNull] string str, out ElectricPotentialDc resu /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialDc result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialDc result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ElectricPotentialDcUnit>( str, provider, From, @@ -427,43 +427,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Arithmetic Operators /// Negate the value. - public static ElectricPotentialDc operator -(ElectricPotentialDc right) + public static ElectricPotentialDc operator -(ElectricPotentialDc right) { - return new ElectricPotentialDc(-right.Value, right.Unit); + return new ElectricPotentialDc(-right.Value, right.Unit); } - /// Get from adding two . - public static ElectricPotentialDc operator +(ElectricPotentialDc left, ElectricPotentialDc right) + /// Get from adding two . + public static ElectricPotentialDc operator +(ElectricPotentialDc left, ElectricPotentialDc right) { - return new ElectricPotentialDc(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ElectricPotentialDc(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ElectricPotentialDc operator -(ElectricPotentialDc left, ElectricPotentialDc right) + /// Get from subtracting two . + public static ElectricPotentialDc operator -(ElectricPotentialDc left, ElectricPotentialDc right) { - return new ElectricPotentialDc(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ElectricPotentialDc(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ElectricPotentialDc operator *(double left, ElectricPotentialDc right) + /// Get from multiplying value and . + public static ElectricPotentialDc operator *(double left, ElectricPotentialDc right) { - return new ElectricPotentialDc(left * right.Value, right.Unit); + return new ElectricPotentialDc(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ElectricPotentialDc operator *(ElectricPotentialDc left, double right) + /// Get from multiplying value and . + public static ElectricPotentialDc operator *(ElectricPotentialDc left, double right) { - return new ElectricPotentialDc(left.Value * right, left.Unit); + return new ElectricPotentialDc(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ElectricPotentialDc operator /(ElectricPotentialDc left, double right) + /// Get from dividing by value. + public static ElectricPotentialDc operator /(ElectricPotentialDc left, double right) { - return new ElectricPotentialDc(left.Value / right, left.Unit); + return new ElectricPotentialDc(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ElectricPotentialDc left, ElectricPotentialDc right) + /// Get ratio value from dividing by . + public static double operator /(ElectricPotentialDc left, ElectricPotentialDc right) { return left.VoltsDc / right.VoltsDc; } @@ -473,39 +473,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ElectricPotentialDc left, ElectricPotentialDc right) + public static bool operator <=(ElectricPotentialDc left, ElectricPotentialDc right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ElectricPotentialDc left, ElectricPotentialDc right) + public static bool operator >=(ElectricPotentialDc left, ElectricPotentialDc right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ElectricPotentialDc left, ElectricPotentialDc right) + public static bool operator <(ElectricPotentialDc left, ElectricPotentialDc right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ElectricPotentialDc left, ElectricPotentialDc right) + public static bool operator >(ElectricPotentialDc left, ElectricPotentialDc right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ElectricPotentialDc left, ElectricPotentialDc right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ElectricPotentialDc left, ElectricPotentialDc right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ElectricPotentialDc left, ElectricPotentialDc right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ElectricPotentialDc left, ElectricPotentialDc right) { return !(left == right); } @@ -514,37 +514,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotentialDc objElectricPotentialDc)) throw new ArgumentException("Expected type ElectricPotentialDc.", nameof(obj)); + if(!(obj is ElectricPotentialDc objElectricPotentialDc)) throw new ArgumentException("Expected type ElectricPotentialDc.", nameof(obj)); return CompareTo(objElectricPotentialDc); } /// - public int CompareTo(ElectricPotentialDc other) + public int CompareTo(ElectricPotentialDc other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricPotentialDc objElectricPotentialDc)) + if(obj is null || !(obj is ElectricPotentialDc objElectricPotentialDc)) return false; return Equals(objElectricPotentialDc); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ElectricPotentialDc other) + /// Consider using for safely comparing floating point values. + public bool Equals(ElectricPotentialDc other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ElectricPotentialDc within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -582,7 +582,7 @@ public bool Equals(ElectricPotentialDc other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricPotentialDc other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricPotentialDc other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -596,7 +596,7 @@ public bool Equals(ElectricPotentialDc other, double tolerance, ComparisonType c /// /// Returns the hash code for this instance. /// - /// A hash code for the current ElectricPotentialDc. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -644,13 +644,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ElectricPotentialDc to another ElectricPotentialDc with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ElectricPotentialDc with the specified unit. - public ElectricPotentialDc ToUnit(ElectricPotentialDcUnit unit) + /// A with the specified unit. + public ElectricPotentialDc ToUnit(ElectricPotentialDcUnit unit) { var convertedValue = GetValueAs(unit); - return new ElectricPotentialDc(convertedValue, unit); + return new ElectricPotentialDc(convertedValue, unit); } /// @@ -663,7 +663,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ElectricPotentialDc ToUnit(UnitSystem unitSystem) + public ElectricPotentialDc ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -710,10 +710,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ElectricPotentialDc ToBaseUnit() + internal ElectricPotentialDc ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ElectricPotentialDc(baseUnitValue, BaseUnit); + return new ElectricPotentialDc(baseUnitValue, BaseUnit); } private double GetValueAs(ElectricPotentialDcUnit unit) @@ -826,7 +826,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -836,12 +836,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -886,16 +886,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricPotentialDc)) + if(conversionType == typeof(ElectricPotentialDc)) return this; else if(conversionType == typeof(ElectricPotentialDcUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ElectricPotentialDc.QuantityType; + return ElectricPotentialDc.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ElectricPotentialDc.BaseDimensions; + return ElectricPotentialDc.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs index 8c96c4745e..7e1a3603e8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// The electrical resistance of an electrical conductor is the opposition to the passage of an electric current through that conductor. /// - public partial struct ElectricResistance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ElectricResistance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -104,19 +104,19 @@ public ElectricResistance(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ElectricResistance, which is Ohm. All conversions go via this value. + /// The base unit of , which is Ohm. All conversions go via this value. /// public static ElectricResistanceUnit BaseUnit { get; } = ElectricResistanceUnit.Ohm; /// - /// Represents the largest possible value of ElectricResistance + /// Represents the largest possible value of /// - public static ElectricResistance MaxValue { get; } = new ElectricResistance(double.MaxValue, BaseUnit); + public static ElectricResistance MaxValue { get; } = new ElectricResistance(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ElectricResistance + /// Represents the smallest possible value of /// - public static ElectricResistance MinValue { get; } = new ElectricResistance(double.MinValue, BaseUnit); + public static ElectricResistance MinValue { get; } = new ElectricResistance(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -124,14 +124,14 @@ public ElectricResistance(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ElectricResistance; /// - /// All units of measurement for the ElectricResistance quantity. + /// All units of measurement for the quantity. /// public static ElectricResistanceUnit[] Units { get; } = Enum.GetValues(typeof(ElectricResistanceUnit)).Cast().Except(new ElectricResistanceUnit[]{ ElectricResistanceUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Ohm. /// - public static ElectricResistance Zero { get; } = new ElectricResistance(0, BaseUnit); + public static ElectricResistance Zero { get; } = new ElectricResistance(0, BaseUnit); #endregion @@ -156,39 +156,39 @@ public ElectricResistance(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ElectricResistance.QuantityType; + public QuantityType Type => ElectricResistance.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ElectricResistance.BaseDimensions; + public BaseDimensions Dimensions => ElectricResistance.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ElectricResistance in Gigaohms. + /// Get in Gigaohms. /// public double Gigaohms => As(ElectricResistanceUnit.Gigaohm); /// - /// Get ElectricResistance in Kiloohms. + /// Get in Kiloohms. /// public double Kiloohms => As(ElectricResistanceUnit.Kiloohm); /// - /// Get ElectricResistance in Megaohms. + /// Get in Megaohms. /// public double Megaohms => As(ElectricResistanceUnit.Megaohm); /// - /// Get ElectricResistance in Milliohms. + /// Get in Milliohms. /// public double Milliohms => As(ElectricResistanceUnit.Milliohm); /// - /// Get ElectricResistance in Ohms. + /// Get in Ohms. /// public double Ohms => As(ElectricResistanceUnit.Ohm); @@ -222,60 +222,60 @@ public static string GetAbbreviation(ElectricResistanceUnit unit, [CanBeNull] IF #region Static Factory Methods /// - /// Get ElectricResistance from Gigaohms. + /// Get from Gigaohms. /// /// If value is NaN or Infinity. - public static ElectricResistance FromGigaohms(QuantityValue gigaohms) + public static ElectricResistance FromGigaohms(QuantityValue gigaohms) { double value = (double) gigaohms; - return new ElectricResistance(value, ElectricResistanceUnit.Gigaohm); + return new ElectricResistance(value, ElectricResistanceUnit.Gigaohm); } /// - /// Get ElectricResistance from Kiloohms. + /// Get from Kiloohms. /// /// If value is NaN or Infinity. - public static ElectricResistance FromKiloohms(QuantityValue kiloohms) + public static ElectricResistance FromKiloohms(QuantityValue kiloohms) { double value = (double) kiloohms; - return new ElectricResistance(value, ElectricResistanceUnit.Kiloohm); + return new ElectricResistance(value, ElectricResistanceUnit.Kiloohm); } /// - /// Get ElectricResistance from Megaohms. + /// Get from Megaohms. /// /// If value is NaN or Infinity. - public static ElectricResistance FromMegaohms(QuantityValue megaohms) + public static ElectricResistance FromMegaohms(QuantityValue megaohms) { double value = (double) megaohms; - return new ElectricResistance(value, ElectricResistanceUnit.Megaohm); + return new ElectricResistance(value, ElectricResistanceUnit.Megaohm); } /// - /// Get ElectricResistance from Milliohms. + /// Get from Milliohms. /// /// If value is NaN or Infinity. - public static ElectricResistance FromMilliohms(QuantityValue milliohms) + public static ElectricResistance FromMilliohms(QuantityValue milliohms) { double value = (double) milliohms; - return new ElectricResistance(value, ElectricResistanceUnit.Milliohm); + return new ElectricResistance(value, ElectricResistanceUnit.Milliohm); } /// - /// Get ElectricResistance from Ohms. + /// Get from Ohms. /// /// If value is NaN or Infinity. - public static ElectricResistance FromOhms(QuantityValue ohms) + public static ElectricResistance FromOhms(QuantityValue ohms) { double value = (double) ohms; - return new ElectricResistance(value, ElectricResistanceUnit.Ohm); + return new ElectricResistance(value, ElectricResistanceUnit.Ohm); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ElectricResistance unit value. - public static ElectricResistance From(QuantityValue value, ElectricResistanceUnit fromUnit) + /// unit value. + public static ElectricResistance From(QuantityValue value, ElectricResistanceUnit fromUnit) { - return new ElectricResistance((double)value, fromUnit); + return new ElectricResistance((double)value, fromUnit); } #endregion @@ -304,7 +304,7 @@ public static ElectricResistance From(QuantityValue value, ElectricResistanceUni /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ElectricResistance Parse(string str) + public static ElectricResistance Parse(string str) { return Parse(str, null); } @@ -332,9 +332,9 @@ public static ElectricResistance Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ElectricResistance Parse(string str, [CanBeNull] IFormatProvider provider) + public static ElectricResistance Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ElectricResistanceUnit>( str, provider, From); @@ -348,7 +348,7 @@ public static ElectricResistance Parse(string str, [CanBeNull] IFormatProvider p /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ElectricResistance result) + public static bool TryParse([CanBeNull] string str, out ElectricResistance result) { return TryParse(str, null, out result); } @@ -363,9 +363,9 @@ public static bool TryParse([CanBeNull] string str, out ElectricResistance resul /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistance result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistance result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ElectricResistanceUnit>( str, provider, From, @@ -427,43 +427,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Arithmetic Operators /// Negate the value. - public static ElectricResistance operator -(ElectricResistance right) + public static ElectricResistance operator -(ElectricResistance right) { - return new ElectricResistance(-right.Value, right.Unit); + return new ElectricResistance(-right.Value, right.Unit); } - /// Get from adding two . - public static ElectricResistance operator +(ElectricResistance left, ElectricResistance right) + /// Get from adding two . + public static ElectricResistance operator +(ElectricResistance left, ElectricResistance right) { - return new ElectricResistance(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ElectricResistance(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ElectricResistance operator -(ElectricResistance left, ElectricResistance right) + /// Get from subtracting two . + public static ElectricResistance operator -(ElectricResistance left, ElectricResistance right) { - return new ElectricResistance(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ElectricResistance(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ElectricResistance operator *(double left, ElectricResistance right) + /// Get from multiplying value and . + public static ElectricResistance operator *(double left, ElectricResistance right) { - return new ElectricResistance(left * right.Value, right.Unit); + return new ElectricResistance(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ElectricResistance operator *(ElectricResistance left, double right) + /// Get from multiplying value and . + public static ElectricResistance operator *(ElectricResistance left, double right) { - return new ElectricResistance(left.Value * right, left.Unit); + return new ElectricResistance(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ElectricResistance operator /(ElectricResistance left, double right) + /// Get from dividing by value. + public static ElectricResistance operator /(ElectricResistance left, double right) { - return new ElectricResistance(left.Value / right, left.Unit); + return new ElectricResistance(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ElectricResistance left, ElectricResistance right) + /// Get ratio value from dividing by . + public static double operator /(ElectricResistance left, ElectricResistance right) { return left.Ohms / right.Ohms; } @@ -473,39 +473,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ElectricResistance left, ElectricResistance right) + public static bool operator <=(ElectricResistance left, ElectricResistance right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ElectricResistance left, ElectricResistance right) + public static bool operator >=(ElectricResistance left, ElectricResistance right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ElectricResistance left, ElectricResistance right) + public static bool operator <(ElectricResistance left, ElectricResistance right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ElectricResistance left, ElectricResistance right) + public static bool operator >(ElectricResistance left, ElectricResistance right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ElectricResistance left, ElectricResistance right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ElectricResistance left, ElectricResistance right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ElectricResistance left, ElectricResistance right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ElectricResistance left, ElectricResistance right) { return !(left == right); } @@ -514,37 +514,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricResistance objElectricResistance)) throw new ArgumentException("Expected type ElectricResistance.", nameof(obj)); + if(!(obj is ElectricResistance objElectricResistance)) throw new ArgumentException("Expected type ElectricResistance.", nameof(obj)); return CompareTo(objElectricResistance); } /// - public int CompareTo(ElectricResistance other) + public int CompareTo(ElectricResistance other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricResistance objElectricResistance)) + if(obj is null || !(obj is ElectricResistance objElectricResistance)) return false; return Equals(objElectricResistance); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ElectricResistance other) + /// Consider using for safely comparing floating point values. + public bool Equals(ElectricResistance other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ElectricResistance within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -582,7 +582,7 @@ public bool Equals(ElectricResistance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricResistance other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricResistance other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -596,7 +596,7 @@ public bool Equals(ElectricResistance other, double tolerance, ComparisonType co /// /// Returns the hash code for this instance. /// - /// A hash code for the current ElectricResistance. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -644,13 +644,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ElectricResistance to another ElectricResistance with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ElectricResistance with the specified unit. - public ElectricResistance ToUnit(ElectricResistanceUnit unit) + /// A with the specified unit. + public ElectricResistance ToUnit(ElectricResistanceUnit unit) { var convertedValue = GetValueAs(unit); - return new ElectricResistance(convertedValue, unit); + return new ElectricResistance(convertedValue, unit); } /// @@ -663,7 +663,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ElectricResistance ToUnit(UnitSystem unitSystem) + public ElectricResistance ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -710,10 +710,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ElectricResistance ToBaseUnit() + internal ElectricResistance ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ElectricResistance(baseUnitValue, BaseUnit); + return new ElectricResistance(baseUnitValue, BaseUnit); } private double GetValueAs(ElectricResistanceUnit unit) @@ -826,7 +826,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -836,12 +836,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -886,16 +886,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricResistance)) + if(conversionType == typeof(ElectricResistance)) return this; else if(conversionType == typeof(ElectricResistanceUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ElectricResistance.QuantityType; + return ElectricResistance.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ElectricResistance.BaseDimensions; + return ElectricResistance.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs index b6a6f1427f..af86c47b82 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity /// - public partial struct ElectricResistivity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ElectricResistivity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -116,19 +116,19 @@ public ElectricResistivity(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ElectricResistivity, which is OhmMeter. All conversions go via this value. + /// The base unit of , which is OhmMeter. All conversions go via this value. /// public static ElectricResistivityUnit BaseUnit { get; } = ElectricResistivityUnit.OhmMeter; /// - /// Represents the largest possible value of ElectricResistivity + /// Represents the largest possible value of /// - public static ElectricResistivity MaxValue { get; } = new ElectricResistivity(double.MaxValue, BaseUnit); + public static ElectricResistivity MaxValue { get; } = new ElectricResistivity(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ElectricResistivity + /// Represents the smallest possible value of /// - public static ElectricResistivity MinValue { get; } = new ElectricResistivity(double.MinValue, BaseUnit); + public static ElectricResistivity MinValue { get; } = new ElectricResistivity(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -136,14 +136,14 @@ public ElectricResistivity(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ElectricResistivity; /// - /// All units of measurement for the ElectricResistivity quantity. + /// All units of measurement for the quantity. /// public static ElectricResistivityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricResistivityUnit)).Cast().Except(new ElectricResistivityUnit[]{ ElectricResistivityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit OhmMeter. /// - public static ElectricResistivity Zero { get; } = new ElectricResistivity(0, BaseUnit); + public static ElectricResistivity Zero { get; } = new ElectricResistivity(0, BaseUnit); #endregion @@ -168,84 +168,84 @@ public ElectricResistivity(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ElectricResistivity.QuantityType; + public QuantityType Type => ElectricResistivity.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ElectricResistivity.BaseDimensions; + public BaseDimensions Dimensions => ElectricResistivity.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ElectricResistivity in KiloohmsCentimeter. + /// Get in KiloohmsCentimeter. /// public double KiloohmsCentimeter => As(ElectricResistivityUnit.KiloohmCentimeter); /// - /// Get ElectricResistivity in KiloohmMeters. + /// Get in KiloohmMeters. /// public double KiloohmMeters => As(ElectricResistivityUnit.KiloohmMeter); /// - /// Get ElectricResistivity in MegaohmsCentimeter. + /// Get in MegaohmsCentimeter. /// public double MegaohmsCentimeter => As(ElectricResistivityUnit.MegaohmCentimeter); /// - /// Get ElectricResistivity in MegaohmMeters. + /// Get in MegaohmMeters. /// public double MegaohmMeters => As(ElectricResistivityUnit.MegaohmMeter); /// - /// Get ElectricResistivity in MicroohmsCentimeter. + /// Get in MicroohmsCentimeter. /// public double MicroohmsCentimeter => As(ElectricResistivityUnit.MicroohmCentimeter); /// - /// Get ElectricResistivity in MicroohmMeters. + /// Get in MicroohmMeters. /// public double MicroohmMeters => As(ElectricResistivityUnit.MicroohmMeter); /// - /// Get ElectricResistivity in MilliohmsCentimeter. + /// Get in MilliohmsCentimeter. /// public double MilliohmsCentimeter => As(ElectricResistivityUnit.MilliohmCentimeter); /// - /// Get ElectricResistivity in MilliohmMeters. + /// Get in MilliohmMeters. /// public double MilliohmMeters => As(ElectricResistivityUnit.MilliohmMeter); /// - /// Get ElectricResistivity in NanoohmsCentimeter. + /// Get in NanoohmsCentimeter. /// public double NanoohmsCentimeter => As(ElectricResistivityUnit.NanoohmCentimeter); /// - /// Get ElectricResistivity in NanoohmMeters. + /// Get in NanoohmMeters. /// public double NanoohmMeters => As(ElectricResistivityUnit.NanoohmMeter); /// - /// Get ElectricResistivity in OhmsCentimeter. + /// Get in OhmsCentimeter. /// public double OhmsCentimeter => As(ElectricResistivityUnit.OhmCentimeter); /// - /// Get ElectricResistivity in OhmMeters. + /// Get in OhmMeters. /// public double OhmMeters => As(ElectricResistivityUnit.OhmMeter); /// - /// Get ElectricResistivity in PicoohmsCentimeter. + /// Get in PicoohmsCentimeter. /// public double PicoohmsCentimeter => As(ElectricResistivityUnit.PicoohmCentimeter); /// - /// Get ElectricResistivity in PicoohmMeters. + /// Get in PicoohmMeters. /// public double PicoohmMeters => As(ElectricResistivityUnit.PicoohmMeter); @@ -279,141 +279,141 @@ public static string GetAbbreviation(ElectricResistivityUnit unit, [CanBeNull] I #region Static Factory Methods /// - /// Get ElectricResistivity from KiloohmsCentimeter. + /// Get from KiloohmsCentimeter. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromKiloohmsCentimeter(QuantityValue kiloohmscentimeter) + public static ElectricResistivity FromKiloohmsCentimeter(QuantityValue kiloohmscentimeter) { double value = (double) kiloohmscentimeter; - return new ElectricResistivity(value, ElectricResistivityUnit.KiloohmCentimeter); + return new ElectricResistivity(value, ElectricResistivityUnit.KiloohmCentimeter); } /// - /// Get ElectricResistivity from KiloohmMeters. + /// Get from KiloohmMeters. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromKiloohmMeters(QuantityValue kiloohmmeters) + public static ElectricResistivity FromKiloohmMeters(QuantityValue kiloohmmeters) { double value = (double) kiloohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.KiloohmMeter); + return new ElectricResistivity(value, ElectricResistivityUnit.KiloohmMeter); } /// - /// Get ElectricResistivity from MegaohmsCentimeter. + /// Get from MegaohmsCentimeter. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromMegaohmsCentimeter(QuantityValue megaohmscentimeter) + public static ElectricResistivity FromMegaohmsCentimeter(QuantityValue megaohmscentimeter) { double value = (double) megaohmscentimeter; - return new ElectricResistivity(value, ElectricResistivityUnit.MegaohmCentimeter); + return new ElectricResistivity(value, ElectricResistivityUnit.MegaohmCentimeter); } /// - /// Get ElectricResistivity from MegaohmMeters. + /// Get from MegaohmMeters. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromMegaohmMeters(QuantityValue megaohmmeters) + public static ElectricResistivity FromMegaohmMeters(QuantityValue megaohmmeters) { double value = (double) megaohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.MegaohmMeter); + return new ElectricResistivity(value, ElectricResistivityUnit.MegaohmMeter); } /// - /// Get ElectricResistivity from MicroohmsCentimeter. + /// Get from MicroohmsCentimeter. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromMicroohmsCentimeter(QuantityValue microohmscentimeter) + public static ElectricResistivity FromMicroohmsCentimeter(QuantityValue microohmscentimeter) { double value = (double) microohmscentimeter; - return new ElectricResistivity(value, ElectricResistivityUnit.MicroohmCentimeter); + return new ElectricResistivity(value, ElectricResistivityUnit.MicroohmCentimeter); } /// - /// Get ElectricResistivity from MicroohmMeters. + /// Get from MicroohmMeters. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromMicroohmMeters(QuantityValue microohmmeters) + public static ElectricResistivity FromMicroohmMeters(QuantityValue microohmmeters) { double value = (double) microohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.MicroohmMeter); + return new ElectricResistivity(value, ElectricResistivityUnit.MicroohmMeter); } /// - /// Get ElectricResistivity from MilliohmsCentimeter. + /// Get from MilliohmsCentimeter. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromMilliohmsCentimeter(QuantityValue milliohmscentimeter) + public static ElectricResistivity FromMilliohmsCentimeter(QuantityValue milliohmscentimeter) { double value = (double) milliohmscentimeter; - return new ElectricResistivity(value, ElectricResistivityUnit.MilliohmCentimeter); + return new ElectricResistivity(value, ElectricResistivityUnit.MilliohmCentimeter); } /// - /// Get ElectricResistivity from MilliohmMeters. + /// Get from MilliohmMeters. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromMilliohmMeters(QuantityValue milliohmmeters) + public static ElectricResistivity FromMilliohmMeters(QuantityValue milliohmmeters) { double value = (double) milliohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.MilliohmMeter); + return new ElectricResistivity(value, ElectricResistivityUnit.MilliohmMeter); } /// - /// Get ElectricResistivity from NanoohmsCentimeter. + /// Get from NanoohmsCentimeter. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromNanoohmsCentimeter(QuantityValue nanoohmscentimeter) + public static ElectricResistivity FromNanoohmsCentimeter(QuantityValue nanoohmscentimeter) { double value = (double) nanoohmscentimeter; - return new ElectricResistivity(value, ElectricResistivityUnit.NanoohmCentimeter); + return new ElectricResistivity(value, ElectricResistivityUnit.NanoohmCentimeter); } /// - /// Get ElectricResistivity from NanoohmMeters. + /// Get from NanoohmMeters. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromNanoohmMeters(QuantityValue nanoohmmeters) + public static ElectricResistivity FromNanoohmMeters(QuantityValue nanoohmmeters) { double value = (double) nanoohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.NanoohmMeter); + return new ElectricResistivity(value, ElectricResistivityUnit.NanoohmMeter); } /// - /// Get ElectricResistivity from OhmsCentimeter. + /// Get from OhmsCentimeter. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromOhmsCentimeter(QuantityValue ohmscentimeter) + public static ElectricResistivity FromOhmsCentimeter(QuantityValue ohmscentimeter) { double value = (double) ohmscentimeter; - return new ElectricResistivity(value, ElectricResistivityUnit.OhmCentimeter); + return new ElectricResistivity(value, ElectricResistivityUnit.OhmCentimeter); } /// - /// Get ElectricResistivity from OhmMeters. + /// Get from OhmMeters. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromOhmMeters(QuantityValue ohmmeters) + public static ElectricResistivity FromOhmMeters(QuantityValue ohmmeters) { double value = (double) ohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.OhmMeter); + return new ElectricResistivity(value, ElectricResistivityUnit.OhmMeter); } /// - /// Get ElectricResistivity from PicoohmsCentimeter. + /// Get from PicoohmsCentimeter. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromPicoohmsCentimeter(QuantityValue picoohmscentimeter) + public static ElectricResistivity FromPicoohmsCentimeter(QuantityValue picoohmscentimeter) { double value = (double) picoohmscentimeter; - return new ElectricResistivity(value, ElectricResistivityUnit.PicoohmCentimeter); + return new ElectricResistivity(value, ElectricResistivityUnit.PicoohmCentimeter); } /// - /// Get ElectricResistivity from PicoohmMeters. + /// Get from PicoohmMeters. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromPicoohmMeters(QuantityValue picoohmmeters) + public static ElectricResistivity FromPicoohmMeters(QuantityValue picoohmmeters) { double value = (double) picoohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.PicoohmMeter); + return new ElectricResistivity(value, ElectricResistivityUnit.PicoohmMeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ElectricResistivity unit value. - public static ElectricResistivity From(QuantityValue value, ElectricResistivityUnit fromUnit) + /// unit value. + public static ElectricResistivity From(QuantityValue value, ElectricResistivityUnit fromUnit) { - return new ElectricResistivity((double)value, fromUnit); + return new ElectricResistivity((double)value, fromUnit); } #endregion @@ -442,7 +442,7 @@ public static ElectricResistivity From(QuantityValue value, ElectricResistivityU /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ElectricResistivity Parse(string str) + public static ElectricResistivity Parse(string str) { return Parse(str, null); } @@ -470,9 +470,9 @@ public static ElectricResistivity Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ElectricResistivity Parse(string str, [CanBeNull] IFormatProvider provider) + public static ElectricResistivity Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ElectricResistivityUnit>( str, provider, From); @@ -486,7 +486,7 @@ public static ElectricResistivity Parse(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ElectricResistivity result) + public static bool TryParse([CanBeNull] string str, out ElectricResistivity result) { return TryParse(str, null, out result); } @@ -501,9 +501,9 @@ public static bool TryParse([CanBeNull] string str, out ElectricResistivity resu /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistivity result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistivity result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ElectricResistivityUnit>( str, provider, From, @@ -565,43 +565,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Arithmetic Operators /// Negate the value. - public static ElectricResistivity operator -(ElectricResistivity right) + public static ElectricResistivity operator -(ElectricResistivity right) { - return new ElectricResistivity(-right.Value, right.Unit); + return new ElectricResistivity(-right.Value, right.Unit); } - /// Get from adding two . - public static ElectricResistivity operator +(ElectricResistivity left, ElectricResistivity right) + /// Get from adding two . + public static ElectricResistivity operator +(ElectricResistivity left, ElectricResistivity right) { - return new ElectricResistivity(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ElectricResistivity(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ElectricResistivity operator -(ElectricResistivity left, ElectricResistivity right) + /// Get from subtracting two . + public static ElectricResistivity operator -(ElectricResistivity left, ElectricResistivity right) { - return new ElectricResistivity(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ElectricResistivity(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ElectricResistivity operator *(double left, ElectricResistivity right) + /// Get from multiplying value and . + public static ElectricResistivity operator *(double left, ElectricResistivity right) { - return new ElectricResistivity(left * right.Value, right.Unit); + return new ElectricResistivity(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ElectricResistivity operator *(ElectricResistivity left, double right) + /// Get from multiplying value and . + public static ElectricResistivity operator *(ElectricResistivity left, double right) { - return new ElectricResistivity(left.Value * right, left.Unit); + return new ElectricResistivity(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ElectricResistivity operator /(ElectricResistivity left, double right) + /// Get from dividing by value. + public static ElectricResistivity operator /(ElectricResistivity left, double right) { - return new ElectricResistivity(left.Value / right, left.Unit); + return new ElectricResistivity(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ElectricResistivity left, ElectricResistivity right) + /// Get ratio value from dividing by . + public static double operator /(ElectricResistivity left, ElectricResistivity right) { return left.OhmMeters / right.OhmMeters; } @@ -611,39 +611,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ElectricResistivity left, ElectricResistivity right) + public static bool operator <=(ElectricResistivity left, ElectricResistivity right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ElectricResistivity left, ElectricResistivity right) + public static bool operator >=(ElectricResistivity left, ElectricResistivity right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ElectricResistivity left, ElectricResistivity right) + public static bool operator <(ElectricResistivity left, ElectricResistivity right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ElectricResistivity left, ElectricResistivity right) + public static bool operator >(ElectricResistivity left, ElectricResistivity right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ElectricResistivity left, ElectricResistivity right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ElectricResistivity left, ElectricResistivity right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ElectricResistivity left, ElectricResistivity right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ElectricResistivity left, ElectricResistivity right) { return !(left == right); } @@ -652,37 +652,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricResistivity objElectricResistivity)) throw new ArgumentException("Expected type ElectricResistivity.", nameof(obj)); + if(!(obj is ElectricResistivity objElectricResistivity)) throw new ArgumentException("Expected type ElectricResistivity.", nameof(obj)); return CompareTo(objElectricResistivity); } /// - public int CompareTo(ElectricResistivity other) + public int CompareTo(ElectricResistivity other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricResistivity objElectricResistivity)) + if(obj is null || !(obj is ElectricResistivity objElectricResistivity)) return false; return Equals(objElectricResistivity); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ElectricResistivity other) + /// Consider using for safely comparing floating point values. + public bool Equals(ElectricResistivity other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ElectricResistivity within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -720,7 +720,7 @@ public bool Equals(ElectricResistivity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricResistivity other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricResistivity other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -734,7 +734,7 @@ public bool Equals(ElectricResistivity other, double tolerance, ComparisonType c /// /// Returns the hash code for this instance. /// - /// A hash code for the current ElectricResistivity. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -782,13 +782,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ElectricResistivity to another ElectricResistivity with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ElectricResistivity with the specified unit. - public ElectricResistivity ToUnit(ElectricResistivityUnit unit) + /// A with the specified unit. + public ElectricResistivity ToUnit(ElectricResistivityUnit unit) { var convertedValue = GetValueAs(unit); - return new ElectricResistivity(convertedValue, unit); + return new ElectricResistivity(convertedValue, unit); } /// @@ -801,7 +801,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ElectricResistivity ToUnit(UnitSystem unitSystem) + public ElectricResistivity ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -857,10 +857,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ElectricResistivity ToBaseUnit() + internal ElectricResistivity ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ElectricResistivity(baseUnitValue, BaseUnit); + return new ElectricResistivity(baseUnitValue, BaseUnit); } private double GetValueAs(ElectricResistivityUnit unit) @@ -982,7 +982,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -992,12 +992,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1042,16 +1042,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricResistivity)) + if(conversionType == typeof(ElectricResistivity)) return this; else if(conversionType == typeof(ElectricResistivityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ElectricResistivity.QuantityType; + return ElectricResistivity.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ElectricResistivity.BaseDimensions; + return ElectricResistivity.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs index d8332d038a..4aac29bd16 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Charge_density /// - public partial struct ElectricSurfaceChargeDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ElectricSurfaceChargeDensity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -105,19 +105,19 @@ public ElectricSurfaceChargeDensity(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ElectricSurfaceChargeDensity, which is CoulombPerSquareMeter. All conversions go via this value. + /// The base unit of , which is CoulombPerSquareMeter. All conversions go via this value. /// public static ElectricSurfaceChargeDensityUnit BaseUnit { get; } = ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter; /// - /// Represents the largest possible value of ElectricSurfaceChargeDensity + /// Represents the largest possible value of /// - public static ElectricSurfaceChargeDensity MaxValue { get; } = new ElectricSurfaceChargeDensity(double.MaxValue, BaseUnit); + public static ElectricSurfaceChargeDensity MaxValue { get; } = new ElectricSurfaceChargeDensity(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ElectricSurfaceChargeDensity + /// Represents the smallest possible value of /// - public static ElectricSurfaceChargeDensity MinValue { get; } = new ElectricSurfaceChargeDensity(double.MinValue, BaseUnit); + public static ElectricSurfaceChargeDensity MinValue { get; } = new ElectricSurfaceChargeDensity(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -125,14 +125,14 @@ public ElectricSurfaceChargeDensity(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ElectricSurfaceChargeDensity; /// - /// All units of measurement for the ElectricSurfaceChargeDensity quantity. + /// All units of measurement for the quantity. /// public static ElectricSurfaceChargeDensityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricSurfaceChargeDensityUnit)).Cast().Except(new ElectricSurfaceChargeDensityUnit[]{ ElectricSurfaceChargeDensityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit CoulombPerSquareMeter. /// - public static ElectricSurfaceChargeDensity Zero { get; } = new ElectricSurfaceChargeDensity(0, BaseUnit); + public static ElectricSurfaceChargeDensity Zero { get; } = new ElectricSurfaceChargeDensity(0, BaseUnit); #endregion @@ -157,29 +157,29 @@ public ElectricSurfaceChargeDensity(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ElectricSurfaceChargeDensity.QuantityType; + public QuantityType Type => ElectricSurfaceChargeDensity.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ElectricSurfaceChargeDensity.BaseDimensions; + public BaseDimensions Dimensions => ElectricSurfaceChargeDensity.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ElectricSurfaceChargeDensity in CoulombsPerSquareCentimeter. + /// Get in CoulombsPerSquareCentimeter. /// public double CoulombsPerSquareCentimeter => As(ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter); /// - /// Get ElectricSurfaceChargeDensity in CoulombsPerSquareInch. + /// Get in CoulombsPerSquareInch. /// public double CoulombsPerSquareInch => As(ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch); /// - /// Get ElectricSurfaceChargeDensity in CoulombsPerSquareMeter. + /// Get in CoulombsPerSquareMeter. /// public double CoulombsPerSquareMeter => As(ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter); @@ -213,42 +213,42 @@ public static string GetAbbreviation(ElectricSurfaceChargeDensityUnit unit, [Can #region Static Factory Methods /// - /// Get ElectricSurfaceChargeDensity from CoulombsPerSquareCentimeter. + /// Get from CoulombsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static ElectricSurfaceChargeDensity FromCoulombsPerSquareCentimeter(QuantityValue coulombspersquarecentimeter) + public static ElectricSurfaceChargeDensity FromCoulombsPerSquareCentimeter(QuantityValue coulombspersquarecentimeter) { double value = (double) coulombspersquarecentimeter; - return new ElectricSurfaceChargeDensity(value, ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter); + return new ElectricSurfaceChargeDensity(value, ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter); } /// - /// Get ElectricSurfaceChargeDensity from CoulombsPerSquareInch. + /// Get from CoulombsPerSquareInch. /// /// If value is NaN or Infinity. - public static ElectricSurfaceChargeDensity FromCoulombsPerSquareInch(QuantityValue coulombspersquareinch) + public static ElectricSurfaceChargeDensity FromCoulombsPerSquareInch(QuantityValue coulombspersquareinch) { double value = (double) coulombspersquareinch; - return new ElectricSurfaceChargeDensity(value, ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch); + return new ElectricSurfaceChargeDensity(value, ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch); } /// - /// Get ElectricSurfaceChargeDensity from CoulombsPerSquareMeter. + /// Get from CoulombsPerSquareMeter. /// /// If value is NaN or Infinity. - public static ElectricSurfaceChargeDensity FromCoulombsPerSquareMeter(QuantityValue coulombspersquaremeter) + public static ElectricSurfaceChargeDensity FromCoulombsPerSquareMeter(QuantityValue coulombspersquaremeter) { double value = (double) coulombspersquaremeter; - return new ElectricSurfaceChargeDensity(value, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter); + return new ElectricSurfaceChargeDensity(value, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ElectricSurfaceChargeDensity unit value. - public static ElectricSurfaceChargeDensity From(QuantityValue value, ElectricSurfaceChargeDensityUnit fromUnit) + /// unit value. + public static ElectricSurfaceChargeDensity From(QuantityValue value, ElectricSurfaceChargeDensityUnit fromUnit) { - return new ElectricSurfaceChargeDensity((double)value, fromUnit); + return new ElectricSurfaceChargeDensity((double)value, fromUnit); } #endregion @@ -277,7 +277,7 @@ public static ElectricSurfaceChargeDensity From(QuantityValue value, ElectricSur /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ElectricSurfaceChargeDensity Parse(string str) + public static ElectricSurfaceChargeDensity Parse(string str) { return Parse(str, null); } @@ -305,9 +305,9 @@ public static ElectricSurfaceChargeDensity Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ElectricSurfaceChargeDensity Parse(string str, [CanBeNull] IFormatProvider provider) + public static ElectricSurfaceChargeDensity Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ElectricSurfaceChargeDensityUnit>( str, provider, From); @@ -321,7 +321,7 @@ public static ElectricSurfaceChargeDensity Parse(string str, [CanBeNull] IFormat /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ElectricSurfaceChargeDensity result) + public static bool TryParse([CanBeNull] string str, out ElectricSurfaceChargeDensity result) { return TryParse(str, null, out result); } @@ -336,9 +336,9 @@ public static bool TryParse([CanBeNull] string str, out ElectricSurfaceChargeDen /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricSurfaceChargeDensity result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricSurfaceChargeDensity result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ElectricSurfaceChargeDensityUnit>( str, provider, From, @@ -400,43 +400,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Arithmetic Operators /// Negate the value. - public static ElectricSurfaceChargeDensity operator -(ElectricSurfaceChargeDensity right) + public static ElectricSurfaceChargeDensity operator -(ElectricSurfaceChargeDensity right) { - return new ElectricSurfaceChargeDensity(-right.Value, right.Unit); + return new ElectricSurfaceChargeDensity(-right.Value, right.Unit); } - /// Get from adding two . - public static ElectricSurfaceChargeDensity operator +(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) + /// Get from adding two . + public static ElectricSurfaceChargeDensity operator +(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { - return new ElectricSurfaceChargeDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ElectricSurfaceChargeDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ElectricSurfaceChargeDensity operator -(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) + /// Get from subtracting two . + public static ElectricSurfaceChargeDensity operator -(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { - return new ElectricSurfaceChargeDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ElectricSurfaceChargeDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ElectricSurfaceChargeDensity operator *(double left, ElectricSurfaceChargeDensity right) + /// Get from multiplying value and . + public static ElectricSurfaceChargeDensity operator *(double left, ElectricSurfaceChargeDensity right) { - return new ElectricSurfaceChargeDensity(left * right.Value, right.Unit); + return new ElectricSurfaceChargeDensity(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ElectricSurfaceChargeDensity operator *(ElectricSurfaceChargeDensity left, double right) + /// Get from multiplying value and . + public static ElectricSurfaceChargeDensity operator *(ElectricSurfaceChargeDensity left, double right) { - return new ElectricSurfaceChargeDensity(left.Value * right, left.Unit); + return new ElectricSurfaceChargeDensity(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ElectricSurfaceChargeDensity operator /(ElectricSurfaceChargeDensity left, double right) + /// Get from dividing by value. + public static ElectricSurfaceChargeDensity operator /(ElectricSurfaceChargeDensity left, double right) { - return new ElectricSurfaceChargeDensity(left.Value / right, left.Unit); + return new ElectricSurfaceChargeDensity(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) + /// Get ratio value from dividing by . + public static double operator /(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { return left.CoulombsPerSquareMeter / right.CoulombsPerSquareMeter; } @@ -446,39 +446,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) + public static bool operator <=(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) + public static bool operator >=(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) + public static bool operator <(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) + public static bool operator >(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { return !(left == right); } @@ -487,37 +487,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricSurfaceChargeDensity objElectricSurfaceChargeDensity)) throw new ArgumentException("Expected type ElectricSurfaceChargeDensity.", nameof(obj)); + if(!(obj is ElectricSurfaceChargeDensity objElectricSurfaceChargeDensity)) throw new ArgumentException("Expected type ElectricSurfaceChargeDensity.", nameof(obj)); return CompareTo(objElectricSurfaceChargeDensity); } /// - public int CompareTo(ElectricSurfaceChargeDensity other) + public int CompareTo(ElectricSurfaceChargeDensity other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricSurfaceChargeDensity objElectricSurfaceChargeDensity)) + if(obj is null || !(obj is ElectricSurfaceChargeDensity objElectricSurfaceChargeDensity)) return false; return Equals(objElectricSurfaceChargeDensity); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ElectricSurfaceChargeDensity other) + /// Consider using for safely comparing floating point values. + public bool Equals(ElectricSurfaceChargeDensity other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ElectricSurfaceChargeDensity within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -555,7 +555,7 @@ public bool Equals(ElectricSurfaceChargeDensity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricSurfaceChargeDensity other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricSurfaceChargeDensity other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -569,7 +569,7 @@ public bool Equals(ElectricSurfaceChargeDensity other, double tolerance, Compari /// /// Returns the hash code for this instance. /// - /// A hash code for the current ElectricSurfaceChargeDensity. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -617,13 +617,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ElectricSurfaceChargeDensity to another ElectricSurfaceChargeDensity with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ElectricSurfaceChargeDensity with the specified unit. - public ElectricSurfaceChargeDensity ToUnit(ElectricSurfaceChargeDensityUnit unit) + /// A with the specified unit. + public ElectricSurfaceChargeDensity ToUnit(ElectricSurfaceChargeDensityUnit unit) { var convertedValue = GetValueAs(unit); - return new ElectricSurfaceChargeDensity(convertedValue, unit); + return new ElectricSurfaceChargeDensity(convertedValue, unit); } /// @@ -636,7 +636,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ElectricSurfaceChargeDensity ToUnit(UnitSystem unitSystem) + public ElectricSurfaceChargeDensity ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -681,10 +681,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ElectricSurfaceChargeDensity ToBaseUnit() + internal ElectricSurfaceChargeDensity ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ElectricSurfaceChargeDensity(baseUnitValue, BaseUnit); + return new ElectricSurfaceChargeDensity(baseUnitValue, BaseUnit); } private double GetValueAs(ElectricSurfaceChargeDensityUnit unit) @@ -795,7 +795,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricSurfaceChargeDensity)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricSurfaceChargeDensity)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -805,12 +805,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricSurfaceChargeDensity)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricSurfaceChargeDensity)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ElectricSurfaceChargeDensity)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricSurfaceChargeDensity)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -855,16 +855,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricSurfaceChargeDensity)) + if(conversionType == typeof(ElectricSurfaceChargeDensity)) return this; else if(conversionType == typeof(ElectricSurfaceChargeDensityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ElectricSurfaceChargeDensity.QuantityType; + return ElectricSurfaceChargeDensity.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ElectricSurfaceChargeDensity.BaseDimensions; + return ElectricSurfaceChargeDensity.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ElectricSurfaceChargeDensity)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ElectricSurfaceChargeDensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs index 01799fbfb7..213db45106 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// The joule, symbol J, is a derived unit of energy, work, or amount of heat in the International System of Units. It is equal to the energy transferred (or work done) when applying a force of one newton through a distance of one metre (1 newton metre or N·m), or in passing an electric current of one ampere through a resistance of one ohm for one second. Many other units of energy are included. Please do not confuse this definition of the calorie with the one colloquially used by the food industry, the large calorie, which is equivalent to 1 kcal. Thermochemical definition of the calorie is used. For BTU, the IT definition is used. /// - public partial struct Energy : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Energy : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -123,19 +123,19 @@ public Energy(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Energy, which is Joule. All conversions go via this value. + /// The base unit of , which is Joule. All conversions go via this value. /// public static EnergyUnit BaseUnit { get; } = EnergyUnit.Joule; /// - /// Represents the largest possible value of Energy + /// Represents the largest possible value of /// - public static Energy MaxValue { get; } = new Energy(double.MaxValue, BaseUnit); + public static Energy MaxValue { get; } = new Energy(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Energy + /// Represents the smallest possible value of /// - public static Energy MinValue { get; } = new Energy(double.MinValue, BaseUnit); + public static Energy MinValue { get; } = new Energy(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -143,14 +143,14 @@ public Energy(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Energy; /// - /// All units of measurement for the Energy quantity. + /// All units of measurement for the quantity. /// public static EnergyUnit[] Units { get; } = Enum.GetValues(typeof(EnergyUnit)).Cast().Except(new EnergyUnit[]{ EnergyUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Joule. /// - public static Energy Zero { get; } = new Energy(0, BaseUnit); + public static Energy Zero { get; } = new Energy(0, BaseUnit); #endregion @@ -175,134 +175,134 @@ public Energy(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Energy.QuantityType; + public QuantityType Type => Energy.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Energy.BaseDimensions; + public BaseDimensions Dimensions => Energy.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Energy in BritishThermalUnits. + /// Get in BritishThermalUnits. /// public double BritishThermalUnits => As(EnergyUnit.BritishThermalUnit); /// - /// Get Energy in Calories. + /// Get in Calories. /// public double Calories => As(EnergyUnit.Calorie); /// - /// Get Energy in DecathermsEc. + /// Get in DecathermsEc. /// public double DecathermsEc => As(EnergyUnit.DecathermEc); /// - /// Get Energy in DecathermsImperial. + /// Get in DecathermsImperial. /// public double DecathermsImperial => As(EnergyUnit.DecathermImperial); /// - /// Get Energy in DecathermsUs. + /// Get in DecathermsUs. /// public double DecathermsUs => As(EnergyUnit.DecathermUs); /// - /// Get Energy in ElectronVolts. + /// Get in ElectronVolts. /// public double ElectronVolts => As(EnergyUnit.ElectronVolt); /// - /// Get Energy in Ergs. + /// Get in Ergs. /// public double Ergs => As(EnergyUnit.Erg); /// - /// Get Energy in FootPounds. + /// Get in FootPounds. /// public double FootPounds => As(EnergyUnit.FootPound); /// - /// Get Energy in GigabritishThermalUnits. + /// Get in GigabritishThermalUnits. /// public double GigabritishThermalUnits => As(EnergyUnit.GigabritishThermalUnit); /// - /// Get Energy in GigawattHours. + /// Get in GigawattHours. /// public double GigawattHours => As(EnergyUnit.GigawattHour); /// - /// Get Energy in Joules. + /// Get in Joules. /// public double Joules => As(EnergyUnit.Joule); /// - /// Get Energy in KilobritishThermalUnits. + /// Get in KilobritishThermalUnits. /// public double KilobritishThermalUnits => As(EnergyUnit.KilobritishThermalUnit); /// - /// Get Energy in Kilocalories. + /// Get in Kilocalories. /// public double Kilocalories => As(EnergyUnit.Kilocalorie); /// - /// Get Energy in Kilojoules. + /// Get in Kilojoules. /// public double Kilojoules => As(EnergyUnit.Kilojoule); /// - /// Get Energy in KilowattHours. + /// Get in KilowattHours. /// public double KilowattHours => As(EnergyUnit.KilowattHour); /// - /// Get Energy in MegabritishThermalUnits. + /// Get in MegabritishThermalUnits. /// public double MegabritishThermalUnits => As(EnergyUnit.MegabritishThermalUnit); /// - /// Get Energy in Megajoules. + /// Get in Megajoules. /// public double Megajoules => As(EnergyUnit.Megajoule); /// - /// Get Energy in MegawattHours. + /// Get in MegawattHours. /// public double MegawattHours => As(EnergyUnit.MegawattHour); /// - /// Get Energy in Millijoules. + /// Get in Millijoules. /// public double Millijoules => As(EnergyUnit.Millijoule); /// - /// Get Energy in TerawattHours. + /// Get in TerawattHours. /// public double TerawattHours => As(EnergyUnit.TerawattHour); /// - /// Get Energy in ThermsEc. + /// Get in ThermsEc. /// public double ThermsEc => As(EnergyUnit.ThermEc); /// - /// Get Energy in ThermsImperial. + /// Get in ThermsImperial. /// public double ThermsImperial => As(EnergyUnit.ThermImperial); /// - /// Get Energy in ThermsUs. + /// Get in ThermsUs. /// public double ThermsUs => As(EnergyUnit.ThermUs); /// - /// Get Energy in WattHours. + /// Get in WattHours. /// public double WattHours => As(EnergyUnit.WattHour); @@ -336,231 +336,231 @@ public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] IFormatProvide #region Static Factory Methods /// - /// Get Energy from BritishThermalUnits. + /// Get from BritishThermalUnits. /// /// If value is NaN or Infinity. - public static Energy FromBritishThermalUnits(QuantityValue britishthermalunits) + public static Energy FromBritishThermalUnits(QuantityValue britishthermalunits) { double value = (double) britishthermalunits; - return new Energy(value, EnergyUnit.BritishThermalUnit); + return new Energy(value, EnergyUnit.BritishThermalUnit); } /// - /// Get Energy from Calories. + /// Get from Calories. /// /// If value is NaN or Infinity. - public static Energy FromCalories(QuantityValue calories) + public static Energy FromCalories(QuantityValue calories) { double value = (double) calories; - return new Energy(value, EnergyUnit.Calorie); + return new Energy(value, EnergyUnit.Calorie); } /// - /// Get Energy from DecathermsEc. + /// Get from DecathermsEc. /// /// If value is NaN or Infinity. - public static Energy FromDecathermsEc(QuantityValue decathermsec) + public static Energy FromDecathermsEc(QuantityValue decathermsec) { double value = (double) decathermsec; - return new Energy(value, EnergyUnit.DecathermEc); + return new Energy(value, EnergyUnit.DecathermEc); } /// - /// Get Energy from DecathermsImperial. + /// Get from DecathermsImperial. /// /// If value is NaN or Infinity. - public static Energy FromDecathermsImperial(QuantityValue decathermsimperial) + public static Energy FromDecathermsImperial(QuantityValue decathermsimperial) { double value = (double) decathermsimperial; - return new Energy(value, EnergyUnit.DecathermImperial); + return new Energy(value, EnergyUnit.DecathermImperial); } /// - /// Get Energy from DecathermsUs. + /// Get from DecathermsUs. /// /// If value is NaN or Infinity. - public static Energy FromDecathermsUs(QuantityValue decathermsus) + public static Energy FromDecathermsUs(QuantityValue decathermsus) { double value = (double) decathermsus; - return new Energy(value, EnergyUnit.DecathermUs); + return new Energy(value, EnergyUnit.DecathermUs); } /// - /// Get Energy from ElectronVolts. + /// Get from ElectronVolts. /// /// If value is NaN or Infinity. - public static Energy FromElectronVolts(QuantityValue electronvolts) + public static Energy FromElectronVolts(QuantityValue electronvolts) { double value = (double) electronvolts; - return new Energy(value, EnergyUnit.ElectronVolt); + return new Energy(value, EnergyUnit.ElectronVolt); } /// - /// Get Energy from Ergs. + /// Get from Ergs. /// /// If value is NaN or Infinity. - public static Energy FromErgs(QuantityValue ergs) + public static Energy FromErgs(QuantityValue ergs) { double value = (double) ergs; - return new Energy(value, EnergyUnit.Erg); + return new Energy(value, EnergyUnit.Erg); } /// - /// Get Energy from FootPounds. + /// Get from FootPounds. /// /// If value is NaN or Infinity. - public static Energy FromFootPounds(QuantityValue footpounds) + public static Energy FromFootPounds(QuantityValue footpounds) { double value = (double) footpounds; - return new Energy(value, EnergyUnit.FootPound); + return new Energy(value, EnergyUnit.FootPound); } /// - /// Get Energy from GigabritishThermalUnits. + /// Get from GigabritishThermalUnits. /// /// If value is NaN or Infinity. - public static Energy FromGigabritishThermalUnits(QuantityValue gigabritishthermalunits) + public static Energy FromGigabritishThermalUnits(QuantityValue gigabritishthermalunits) { double value = (double) gigabritishthermalunits; - return new Energy(value, EnergyUnit.GigabritishThermalUnit); + return new Energy(value, EnergyUnit.GigabritishThermalUnit); } /// - /// Get Energy from GigawattHours. + /// Get from GigawattHours. /// /// If value is NaN or Infinity. - public static Energy FromGigawattHours(QuantityValue gigawatthours) + public static Energy FromGigawattHours(QuantityValue gigawatthours) { double value = (double) gigawatthours; - return new Energy(value, EnergyUnit.GigawattHour); + return new Energy(value, EnergyUnit.GigawattHour); } /// - /// Get Energy from Joules. + /// Get from Joules. /// /// If value is NaN or Infinity. - public static Energy FromJoules(QuantityValue joules) + public static Energy FromJoules(QuantityValue joules) { double value = (double) joules; - return new Energy(value, EnergyUnit.Joule); + return new Energy(value, EnergyUnit.Joule); } /// - /// Get Energy from KilobritishThermalUnits. + /// Get from KilobritishThermalUnits. /// /// If value is NaN or Infinity. - public static Energy FromKilobritishThermalUnits(QuantityValue kilobritishthermalunits) + public static Energy FromKilobritishThermalUnits(QuantityValue kilobritishthermalunits) { double value = (double) kilobritishthermalunits; - return new Energy(value, EnergyUnit.KilobritishThermalUnit); + return new Energy(value, EnergyUnit.KilobritishThermalUnit); } /// - /// Get Energy from Kilocalories. + /// Get from Kilocalories. /// /// If value is NaN or Infinity. - public static Energy FromKilocalories(QuantityValue kilocalories) + public static Energy FromKilocalories(QuantityValue kilocalories) { double value = (double) kilocalories; - return new Energy(value, EnergyUnit.Kilocalorie); + return new Energy(value, EnergyUnit.Kilocalorie); } /// - /// Get Energy from Kilojoules. + /// Get from Kilojoules. /// /// If value is NaN or Infinity. - public static Energy FromKilojoules(QuantityValue kilojoules) + public static Energy FromKilojoules(QuantityValue kilojoules) { double value = (double) kilojoules; - return new Energy(value, EnergyUnit.Kilojoule); + return new Energy(value, EnergyUnit.Kilojoule); } /// - /// Get Energy from KilowattHours. + /// Get from KilowattHours. /// /// If value is NaN or Infinity. - public static Energy FromKilowattHours(QuantityValue kilowatthours) + public static Energy FromKilowattHours(QuantityValue kilowatthours) { double value = (double) kilowatthours; - return new Energy(value, EnergyUnit.KilowattHour); + return new Energy(value, EnergyUnit.KilowattHour); } /// - /// Get Energy from MegabritishThermalUnits. + /// Get from MegabritishThermalUnits. /// /// If value is NaN or Infinity. - public static Energy FromMegabritishThermalUnits(QuantityValue megabritishthermalunits) + public static Energy FromMegabritishThermalUnits(QuantityValue megabritishthermalunits) { double value = (double) megabritishthermalunits; - return new Energy(value, EnergyUnit.MegabritishThermalUnit); + return new Energy(value, EnergyUnit.MegabritishThermalUnit); } /// - /// Get Energy from Megajoules. + /// Get from Megajoules. /// /// If value is NaN or Infinity. - public static Energy FromMegajoules(QuantityValue megajoules) + public static Energy FromMegajoules(QuantityValue megajoules) { double value = (double) megajoules; - return new Energy(value, EnergyUnit.Megajoule); + return new Energy(value, EnergyUnit.Megajoule); } /// - /// Get Energy from MegawattHours. + /// Get from MegawattHours. /// /// If value is NaN or Infinity. - public static Energy FromMegawattHours(QuantityValue megawatthours) + public static Energy FromMegawattHours(QuantityValue megawatthours) { double value = (double) megawatthours; - return new Energy(value, EnergyUnit.MegawattHour); + return new Energy(value, EnergyUnit.MegawattHour); } /// - /// Get Energy from Millijoules. + /// Get from Millijoules. /// /// If value is NaN or Infinity. - public static Energy FromMillijoules(QuantityValue millijoules) + public static Energy FromMillijoules(QuantityValue millijoules) { double value = (double) millijoules; - return new Energy(value, EnergyUnit.Millijoule); + return new Energy(value, EnergyUnit.Millijoule); } /// - /// Get Energy from TerawattHours. + /// Get from TerawattHours. /// /// If value is NaN or Infinity. - public static Energy FromTerawattHours(QuantityValue terawatthours) + public static Energy FromTerawattHours(QuantityValue terawatthours) { double value = (double) terawatthours; - return new Energy(value, EnergyUnit.TerawattHour); + return new Energy(value, EnergyUnit.TerawattHour); } /// - /// Get Energy from ThermsEc. + /// Get from ThermsEc. /// /// If value is NaN or Infinity. - public static Energy FromThermsEc(QuantityValue thermsec) + public static Energy FromThermsEc(QuantityValue thermsec) { double value = (double) thermsec; - return new Energy(value, EnergyUnit.ThermEc); + return new Energy(value, EnergyUnit.ThermEc); } /// - /// Get Energy from ThermsImperial. + /// Get from ThermsImperial. /// /// If value is NaN or Infinity. - public static Energy FromThermsImperial(QuantityValue thermsimperial) + public static Energy FromThermsImperial(QuantityValue thermsimperial) { double value = (double) thermsimperial; - return new Energy(value, EnergyUnit.ThermImperial); + return new Energy(value, EnergyUnit.ThermImperial); } /// - /// Get Energy from ThermsUs. + /// Get from ThermsUs. /// /// If value is NaN or Infinity. - public static Energy FromThermsUs(QuantityValue thermsus) + public static Energy FromThermsUs(QuantityValue thermsus) { double value = (double) thermsus; - return new Energy(value, EnergyUnit.ThermUs); + return new Energy(value, EnergyUnit.ThermUs); } /// - /// Get Energy from WattHours. + /// Get from WattHours. /// /// If value is NaN or Infinity. - public static Energy FromWattHours(QuantityValue watthours) + public static Energy FromWattHours(QuantityValue watthours) { double value = (double) watthours; - return new Energy(value, EnergyUnit.WattHour); + return new Energy(value, EnergyUnit.WattHour); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Energy unit value. - public static Energy From(QuantityValue value, EnergyUnit fromUnit) + /// unit value. + public static Energy From(QuantityValue value, EnergyUnit fromUnit) { - return new Energy((double)value, fromUnit); + return new Energy((double)value, fromUnit); } #endregion @@ -589,7 +589,7 @@ public static Energy From(QuantityValue value, EnergyUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Energy Parse(string str) + public static Energy Parse(string str) { return Parse(str, null); } @@ -617,9 +617,9 @@ public static Energy Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Energy Parse(string str, [CanBeNull] IFormatProvider provider) + public static Energy Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, EnergyUnit>( str, provider, From); @@ -633,7 +633,7 @@ public static Energy Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Energy result) + public static bool TryParse([CanBeNull] string str, out Energy result) { return TryParse(str, null, out result); } @@ -648,9 +648,9 @@ public static bool TryParse([CanBeNull] string str, out Energy result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Energy result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Energy result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, EnergyUnit>( str, provider, From, @@ -712,43 +712,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Energy #region Arithmetic Operators /// Negate the value. - public static Energy operator -(Energy right) + public static Energy operator -(Energy right) { - return new Energy(-right.Value, right.Unit); + return new Energy(-right.Value, right.Unit); } - /// Get from adding two . - public static Energy operator +(Energy left, Energy right) + /// Get from adding two . + public static Energy operator +(Energy left, Energy right) { - return new Energy(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Energy(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Energy operator -(Energy left, Energy right) + /// Get from subtracting two . + public static Energy operator -(Energy left, Energy right) { - return new Energy(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Energy(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Energy operator *(double left, Energy right) + /// Get from multiplying value and . + public static Energy operator *(double left, Energy right) { - return new Energy(left * right.Value, right.Unit); + return new Energy(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Energy operator *(Energy left, double right) + /// Get from multiplying value and . + public static Energy operator *(Energy left, double right) { - return new Energy(left.Value * right, left.Unit); + return new Energy(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Energy operator /(Energy left, double right) + /// Get from dividing by value. + public static Energy operator /(Energy left, double right) { - return new Energy(left.Value / right, left.Unit); + return new Energy(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Energy left, Energy right) + /// Get ratio value from dividing by . + public static double operator /(Energy left, Energy right) { return left.Joules / right.Joules; } @@ -758,39 +758,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Energy #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Energy left, Energy right) + public static bool operator <=(Energy left, Energy right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Energy left, Energy right) + public static bool operator >=(Energy left, Energy right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Energy left, Energy right) + public static bool operator <(Energy left, Energy right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Energy left, Energy right) + public static bool operator >(Energy left, Energy right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Energy left, Energy right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Energy left, Energy right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Energy left, Energy right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Energy left, Energy right) { return !(left == right); } @@ -799,37 +799,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Energy public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Energy objEnergy)) throw new ArgumentException("Expected type Energy.", nameof(obj)); + if(!(obj is Energy objEnergy)) throw new ArgumentException("Expected type Energy.", nameof(obj)); return CompareTo(objEnergy); } /// - public int CompareTo(Energy other) + public int CompareTo(Energy other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Energy objEnergy)) + if(obj is null || !(obj is Energy objEnergy)) return false; return Equals(objEnergy); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Energy other) + /// Consider using for safely comparing floating point values. + public bool Equals(Energy other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Energy within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -867,7 +867,7 @@ public bool Equals(Energy other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Energy other, double tolerance, ComparisonType comparisonType) + public bool Equals(Energy other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -881,7 +881,7 @@ public bool Equals(Energy other, double tolerance, ComparisonType comparisonType /// /// Returns the hash code for this instance. /// - /// A hash code for the current Energy. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -929,13 +929,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Energy to another Energy with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Energy with the specified unit. - public Energy ToUnit(EnergyUnit unit) + /// A with the specified unit. + public Energy ToUnit(EnergyUnit unit) { var convertedValue = GetValueAs(unit); - return new Energy(convertedValue, unit); + return new Energy(convertedValue, unit); } /// @@ -948,7 +948,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Energy ToUnit(UnitSystem unitSystem) + public Energy ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1014,10 +1014,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Energy ToBaseUnit() + internal Energy ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Energy(baseUnitValue, BaseUnit); + return new Energy(baseUnitValue, BaseUnit); } private double GetValueAs(EnergyUnit unit) @@ -1149,7 +1149,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Energy)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Energy)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1159,12 +1159,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Energy)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Energy)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Energy)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Energy)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1209,16 +1209,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Energy)) + if(conversionType == typeof(Energy)) return this; else if(conversionType == typeof(EnergyUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Energy.QuantityType; + return Energy.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Energy.BaseDimensions; + return Energy.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Energy)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Energy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs index c787d63860..307bcd3a29 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Entropy is an important concept in the branch of science known as thermodynamics. The idea of "irreversibility" is central to the understanding of entropy. It is often said that entropy is an expression of the disorder, or randomness of a system, or of our lack of information about it. Entropy is an extensive property. It has the dimension of energy divided by temperature, which has a unit of joules per kelvin (J/K) in the International System of Units /// - public partial struct Entropy : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Entropy : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -106,19 +106,19 @@ public Entropy(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Entropy, which is JoulePerKelvin. All conversions go via this value. + /// The base unit of , which is JoulePerKelvin. All conversions go via this value. /// public static EntropyUnit BaseUnit { get; } = EntropyUnit.JoulePerKelvin; /// - /// Represents the largest possible value of Entropy + /// Represents the largest possible value of /// - public static Entropy MaxValue { get; } = new Entropy(double.MaxValue, BaseUnit); + public static Entropy MaxValue { get; } = new Entropy(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Entropy + /// Represents the smallest possible value of /// - public static Entropy MinValue { get; } = new Entropy(double.MinValue, BaseUnit); + public static Entropy MinValue { get; } = new Entropy(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -126,14 +126,14 @@ public Entropy(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Entropy; /// - /// All units of measurement for the Entropy quantity. + /// All units of measurement for the quantity. /// public static EntropyUnit[] Units { get; } = Enum.GetValues(typeof(EntropyUnit)).Cast().Except(new EntropyUnit[]{ EntropyUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKelvin. /// - public static Entropy Zero { get; } = new Entropy(0, BaseUnit); + public static Entropy Zero { get; } = new Entropy(0, BaseUnit); #endregion @@ -158,49 +158,49 @@ public Entropy(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Entropy.QuantityType; + public QuantityType Type => Entropy.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Entropy.BaseDimensions; + public BaseDimensions Dimensions => Entropy.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Entropy in CaloriesPerKelvin. + /// Get in CaloriesPerKelvin. /// public double CaloriesPerKelvin => As(EntropyUnit.CaloriePerKelvin); /// - /// Get Entropy in JoulesPerDegreeCelsius. + /// Get in JoulesPerDegreeCelsius. /// public double JoulesPerDegreeCelsius => As(EntropyUnit.JoulePerDegreeCelsius); /// - /// Get Entropy in JoulesPerKelvin. + /// Get in JoulesPerKelvin. /// public double JoulesPerKelvin => As(EntropyUnit.JoulePerKelvin); /// - /// Get Entropy in KilocaloriesPerKelvin. + /// Get in KilocaloriesPerKelvin. /// public double KilocaloriesPerKelvin => As(EntropyUnit.KilocaloriePerKelvin); /// - /// Get Entropy in KilojoulesPerDegreeCelsius. + /// Get in KilojoulesPerDegreeCelsius. /// public double KilojoulesPerDegreeCelsius => As(EntropyUnit.KilojoulePerDegreeCelsius); /// - /// Get Entropy in KilojoulesPerKelvin. + /// Get in KilojoulesPerKelvin. /// public double KilojoulesPerKelvin => As(EntropyUnit.KilojoulePerKelvin); /// - /// Get Entropy in MegajoulesPerKelvin. + /// Get in MegajoulesPerKelvin. /// public double MegajoulesPerKelvin => As(EntropyUnit.MegajoulePerKelvin); @@ -234,78 +234,78 @@ public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] IFormatProvid #region Static Factory Methods /// - /// Get Entropy from CaloriesPerKelvin. + /// Get from CaloriesPerKelvin. /// /// If value is NaN or Infinity. - public static Entropy FromCaloriesPerKelvin(QuantityValue caloriesperkelvin) + public static Entropy FromCaloriesPerKelvin(QuantityValue caloriesperkelvin) { double value = (double) caloriesperkelvin; - return new Entropy(value, EntropyUnit.CaloriePerKelvin); + return new Entropy(value, EntropyUnit.CaloriePerKelvin); } /// - /// Get Entropy from JoulesPerDegreeCelsius. + /// Get from JoulesPerDegreeCelsius. /// /// If value is NaN or Infinity. - public static Entropy FromJoulesPerDegreeCelsius(QuantityValue joulesperdegreecelsius) + public static Entropy FromJoulesPerDegreeCelsius(QuantityValue joulesperdegreecelsius) { double value = (double) joulesperdegreecelsius; - return new Entropy(value, EntropyUnit.JoulePerDegreeCelsius); + return new Entropy(value, EntropyUnit.JoulePerDegreeCelsius); } /// - /// Get Entropy from JoulesPerKelvin. + /// Get from JoulesPerKelvin. /// /// If value is NaN or Infinity. - public static Entropy FromJoulesPerKelvin(QuantityValue joulesperkelvin) + public static Entropy FromJoulesPerKelvin(QuantityValue joulesperkelvin) { double value = (double) joulesperkelvin; - return new Entropy(value, EntropyUnit.JoulePerKelvin); + return new Entropy(value, EntropyUnit.JoulePerKelvin); } /// - /// Get Entropy from KilocaloriesPerKelvin. + /// Get from KilocaloriesPerKelvin. /// /// If value is NaN or Infinity. - public static Entropy FromKilocaloriesPerKelvin(QuantityValue kilocaloriesperkelvin) + public static Entropy FromKilocaloriesPerKelvin(QuantityValue kilocaloriesperkelvin) { double value = (double) kilocaloriesperkelvin; - return new Entropy(value, EntropyUnit.KilocaloriePerKelvin); + return new Entropy(value, EntropyUnit.KilocaloriePerKelvin); } /// - /// Get Entropy from KilojoulesPerDegreeCelsius. + /// Get from KilojoulesPerDegreeCelsius. /// /// If value is NaN or Infinity. - public static Entropy FromKilojoulesPerDegreeCelsius(QuantityValue kilojoulesperdegreecelsius) + public static Entropy FromKilojoulesPerDegreeCelsius(QuantityValue kilojoulesperdegreecelsius) { double value = (double) kilojoulesperdegreecelsius; - return new Entropy(value, EntropyUnit.KilojoulePerDegreeCelsius); + return new Entropy(value, EntropyUnit.KilojoulePerDegreeCelsius); } /// - /// Get Entropy from KilojoulesPerKelvin. + /// Get from KilojoulesPerKelvin. /// /// If value is NaN or Infinity. - public static Entropy FromKilojoulesPerKelvin(QuantityValue kilojoulesperkelvin) + public static Entropy FromKilojoulesPerKelvin(QuantityValue kilojoulesperkelvin) { double value = (double) kilojoulesperkelvin; - return new Entropy(value, EntropyUnit.KilojoulePerKelvin); + return new Entropy(value, EntropyUnit.KilojoulePerKelvin); } /// - /// Get Entropy from MegajoulesPerKelvin. + /// Get from MegajoulesPerKelvin. /// /// If value is NaN or Infinity. - public static Entropy FromMegajoulesPerKelvin(QuantityValue megajoulesperkelvin) + public static Entropy FromMegajoulesPerKelvin(QuantityValue megajoulesperkelvin) { double value = (double) megajoulesperkelvin; - return new Entropy(value, EntropyUnit.MegajoulePerKelvin); + return new Entropy(value, EntropyUnit.MegajoulePerKelvin); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Entropy unit value. - public static Entropy From(QuantityValue value, EntropyUnit fromUnit) + /// unit value. + public static Entropy From(QuantityValue value, EntropyUnit fromUnit) { - return new Entropy((double)value, fromUnit); + return new Entropy((double)value, fromUnit); } #endregion @@ -334,7 +334,7 @@ public static Entropy From(QuantityValue value, EntropyUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Entropy Parse(string str) + public static Entropy Parse(string str) { return Parse(str, null); } @@ -362,9 +362,9 @@ public static Entropy Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Entropy Parse(string str, [CanBeNull] IFormatProvider provider) + public static Entropy Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, EntropyUnit>( str, provider, From); @@ -378,7 +378,7 @@ public static Entropy Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Entropy result) + public static bool TryParse([CanBeNull] string str, out Entropy result) { return TryParse(str, null, out result); } @@ -393,9 +393,9 @@ public static bool TryParse([CanBeNull] string str, out Entropy result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Entropy result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Entropy result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, EntropyUnit>( str, provider, From, @@ -457,43 +457,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Entrop #region Arithmetic Operators /// Negate the value. - public static Entropy operator -(Entropy right) + public static Entropy operator -(Entropy right) { - return new Entropy(-right.Value, right.Unit); + return new Entropy(-right.Value, right.Unit); } - /// Get from adding two . - public static Entropy operator +(Entropy left, Entropy right) + /// Get from adding two . + public static Entropy operator +(Entropy left, Entropy right) { - return new Entropy(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Entropy(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Entropy operator -(Entropy left, Entropy right) + /// Get from subtracting two . + public static Entropy operator -(Entropy left, Entropy right) { - return new Entropy(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Entropy(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Entropy operator *(double left, Entropy right) + /// Get from multiplying value and . + public static Entropy operator *(double left, Entropy right) { - return new Entropy(left * right.Value, right.Unit); + return new Entropy(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Entropy operator *(Entropy left, double right) + /// Get from multiplying value and . + public static Entropy operator *(Entropy left, double right) { - return new Entropy(left.Value * right, left.Unit); + return new Entropy(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Entropy operator /(Entropy left, double right) + /// Get from dividing by value. + public static Entropy operator /(Entropy left, double right) { - return new Entropy(left.Value / right, left.Unit); + return new Entropy(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Entropy left, Entropy right) + /// Get ratio value from dividing by . + public static double operator /(Entropy left, Entropy right) { return left.JoulesPerKelvin / right.JoulesPerKelvin; } @@ -503,39 +503,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Entrop #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Entropy left, Entropy right) + public static bool operator <=(Entropy left, Entropy right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Entropy left, Entropy right) + public static bool operator >=(Entropy left, Entropy right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Entropy left, Entropy right) + public static bool operator <(Entropy left, Entropy right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Entropy left, Entropy right) + public static bool operator >(Entropy left, Entropy right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Entropy left, Entropy right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Entropy left, Entropy right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Entropy left, Entropy right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Entropy left, Entropy right) { return !(left == right); } @@ -544,37 +544,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Entrop public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Entropy objEntropy)) throw new ArgumentException("Expected type Entropy.", nameof(obj)); + if(!(obj is Entropy objEntropy)) throw new ArgumentException("Expected type Entropy.", nameof(obj)); return CompareTo(objEntropy); } /// - public int CompareTo(Entropy other) + public int CompareTo(Entropy other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Entropy objEntropy)) + if(obj is null || !(obj is Entropy objEntropy)) return false; return Equals(objEntropy); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Entropy other) + /// Consider using for safely comparing floating point values. + public bool Equals(Entropy other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Entropy within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -612,7 +612,7 @@ public bool Equals(Entropy other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Entropy other, double tolerance, ComparisonType comparisonType) + public bool Equals(Entropy other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -626,7 +626,7 @@ public bool Equals(Entropy other, double tolerance, ComparisonType comparisonTyp /// /// Returns the hash code for this instance. /// - /// A hash code for the current Entropy. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -674,13 +674,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Entropy to another Entropy with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Entropy with the specified unit. - public Entropy ToUnit(EntropyUnit unit) + /// A with the specified unit. + public Entropy ToUnit(EntropyUnit unit) { var convertedValue = GetValueAs(unit); - return new Entropy(convertedValue, unit); + return new Entropy(convertedValue, unit); } /// @@ -693,7 +693,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Entropy ToUnit(UnitSystem unitSystem) + public Entropy ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -742,10 +742,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Entropy ToBaseUnit() + internal Entropy ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Entropy(baseUnitValue, BaseUnit); + return new Entropy(baseUnitValue, BaseUnit); } private double GetValueAs(EntropyUnit unit) @@ -860,7 +860,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Entropy)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Entropy)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -870,12 +870,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Entropy)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Entropy)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Entropy)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Entropy)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -920,16 +920,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Entropy)) + if(conversionType == typeof(Entropy)) return this; else if(conversionType == typeof(EntropyUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Entropy.QuantityType; + return Entropy.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Entropy.BaseDimensions; + return Entropy.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Entropy)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Entropy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Force.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.g.cs index b3b6a0bd3d..9f2dc7c9de 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// In physics, a force is any influence that causes an object to undergo a certain change, either concerning its movement, direction, or geometrical construction. In other words, a force can cause an object with mass to change its velocity (which includes to begin moving from a state of rest), i.e., to accelerate, or a flexible object to deform, or both. Force can also be described by intuitive concepts such as a push or a pull. A force has both magnitude and direction, making it a vector quantity. It is measured in the SI unit of newtons and represented by the symbol F. /// - public partial struct Force : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Force : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -112,19 +112,19 @@ public Force(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Force, which is Newton. All conversions go via this value. + /// The base unit of , which is Newton. All conversions go via this value. /// public static ForceUnit BaseUnit { get; } = ForceUnit.Newton; /// - /// Represents the largest possible value of Force + /// Represents the largest possible value of /// - public static Force MaxValue { get; } = new Force(double.MaxValue, BaseUnit); + public static Force MaxValue { get; } = new Force(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Force + /// Represents the smallest possible value of /// - public static Force MinValue { get; } = new Force(double.MinValue, BaseUnit); + public static Force MinValue { get; } = new Force(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -132,14 +132,14 @@ public Force(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Force; /// - /// All units of measurement for the Force quantity. + /// All units of measurement for the quantity. /// public static ForceUnit[] Units { get; } = Enum.GetValues(typeof(ForceUnit)).Cast().Except(new ForceUnit[]{ ForceUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Newton. /// - public static Force Zero { get; } = new Force(0, BaseUnit); + public static Force Zero { get; } = new Force(0, BaseUnit); #endregion @@ -164,79 +164,79 @@ public Force(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Force.QuantityType; + public QuantityType Type => Force.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Force.BaseDimensions; + public BaseDimensions Dimensions => Force.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Force in Decanewtons. + /// Get in Decanewtons. /// public double Decanewtons => As(ForceUnit.Decanewton); /// - /// Get Force in Dyne. + /// Get in Dyne. /// public double Dyne => As(ForceUnit.Dyn); /// - /// Get Force in KilogramsForce. + /// Get in KilogramsForce. /// public double KilogramsForce => As(ForceUnit.KilogramForce); /// - /// Get Force in Kilonewtons. + /// Get in Kilonewtons. /// public double Kilonewtons => As(ForceUnit.Kilonewton); /// - /// Get Force in KiloPonds. + /// Get in KiloPonds. /// public double KiloPonds => As(ForceUnit.KiloPond); /// - /// Get Force in Meganewtons. + /// Get in Meganewtons. /// public double Meganewtons => As(ForceUnit.Meganewton); /// - /// Get Force in Micronewtons. + /// Get in Micronewtons. /// public double Micronewtons => As(ForceUnit.Micronewton); /// - /// Get Force in Millinewtons. + /// Get in Millinewtons. /// public double Millinewtons => As(ForceUnit.Millinewton); /// - /// Get Force in Newtons. + /// Get in Newtons. /// public double Newtons => As(ForceUnit.Newton); /// - /// Get Force in OunceForce. + /// Get in OunceForce. /// public double OunceForce => As(ForceUnit.OunceForce); /// - /// Get Force in Poundals. + /// Get in Poundals. /// public double Poundals => As(ForceUnit.Poundal); /// - /// Get Force in PoundsForce. + /// Get in PoundsForce. /// public double PoundsForce => As(ForceUnit.PoundForce); /// - /// Get Force in TonnesForce. + /// Get in TonnesForce. /// public double TonnesForce => As(ForceUnit.TonneForce); @@ -270,132 +270,132 @@ public static string GetAbbreviation(ForceUnit unit, [CanBeNull] IFormatProvider #region Static Factory Methods /// - /// Get Force from Decanewtons. + /// Get from Decanewtons. /// /// If value is NaN or Infinity. - public static Force FromDecanewtons(QuantityValue decanewtons) + public static Force FromDecanewtons(QuantityValue decanewtons) { double value = (double) decanewtons; - return new Force(value, ForceUnit.Decanewton); + return new Force(value, ForceUnit.Decanewton); } /// - /// Get Force from Dyne. + /// Get from Dyne. /// /// If value is NaN or Infinity. - public static Force FromDyne(QuantityValue dyne) + public static Force FromDyne(QuantityValue dyne) { double value = (double) dyne; - return new Force(value, ForceUnit.Dyn); + return new Force(value, ForceUnit.Dyn); } /// - /// Get Force from KilogramsForce. + /// Get from KilogramsForce. /// /// If value is NaN or Infinity. - public static Force FromKilogramsForce(QuantityValue kilogramsforce) + public static Force FromKilogramsForce(QuantityValue kilogramsforce) { double value = (double) kilogramsforce; - return new Force(value, ForceUnit.KilogramForce); + return new Force(value, ForceUnit.KilogramForce); } /// - /// Get Force from Kilonewtons. + /// Get from Kilonewtons. /// /// If value is NaN or Infinity. - public static Force FromKilonewtons(QuantityValue kilonewtons) + public static Force FromKilonewtons(QuantityValue kilonewtons) { double value = (double) kilonewtons; - return new Force(value, ForceUnit.Kilonewton); + return new Force(value, ForceUnit.Kilonewton); } /// - /// Get Force from KiloPonds. + /// Get from KiloPonds. /// /// If value is NaN or Infinity. - public static Force FromKiloPonds(QuantityValue kiloponds) + public static Force FromKiloPonds(QuantityValue kiloponds) { double value = (double) kiloponds; - return new Force(value, ForceUnit.KiloPond); + return new Force(value, ForceUnit.KiloPond); } /// - /// Get Force from Meganewtons. + /// Get from Meganewtons. /// /// If value is NaN or Infinity. - public static Force FromMeganewtons(QuantityValue meganewtons) + public static Force FromMeganewtons(QuantityValue meganewtons) { double value = (double) meganewtons; - return new Force(value, ForceUnit.Meganewton); + return new Force(value, ForceUnit.Meganewton); } /// - /// Get Force from Micronewtons. + /// Get from Micronewtons. /// /// If value is NaN or Infinity. - public static Force FromMicronewtons(QuantityValue micronewtons) + public static Force FromMicronewtons(QuantityValue micronewtons) { double value = (double) micronewtons; - return new Force(value, ForceUnit.Micronewton); + return new Force(value, ForceUnit.Micronewton); } /// - /// Get Force from Millinewtons. + /// Get from Millinewtons. /// /// If value is NaN or Infinity. - public static Force FromMillinewtons(QuantityValue millinewtons) + public static Force FromMillinewtons(QuantityValue millinewtons) { double value = (double) millinewtons; - return new Force(value, ForceUnit.Millinewton); + return new Force(value, ForceUnit.Millinewton); } /// - /// Get Force from Newtons. + /// Get from Newtons. /// /// If value is NaN or Infinity. - public static Force FromNewtons(QuantityValue newtons) + public static Force FromNewtons(QuantityValue newtons) { double value = (double) newtons; - return new Force(value, ForceUnit.Newton); + return new Force(value, ForceUnit.Newton); } /// - /// Get Force from OunceForce. + /// Get from OunceForce. /// /// If value is NaN or Infinity. - public static Force FromOunceForce(QuantityValue ounceforce) + public static Force FromOunceForce(QuantityValue ounceforce) { double value = (double) ounceforce; - return new Force(value, ForceUnit.OunceForce); + return new Force(value, ForceUnit.OunceForce); } /// - /// Get Force from Poundals. + /// Get from Poundals. /// /// If value is NaN or Infinity. - public static Force FromPoundals(QuantityValue poundals) + public static Force FromPoundals(QuantityValue poundals) { double value = (double) poundals; - return new Force(value, ForceUnit.Poundal); + return new Force(value, ForceUnit.Poundal); } /// - /// Get Force from PoundsForce. + /// Get from PoundsForce. /// /// If value is NaN or Infinity. - public static Force FromPoundsForce(QuantityValue poundsforce) + public static Force FromPoundsForce(QuantityValue poundsforce) { double value = (double) poundsforce; - return new Force(value, ForceUnit.PoundForce); + return new Force(value, ForceUnit.PoundForce); } /// - /// Get Force from TonnesForce. + /// Get from TonnesForce. /// /// If value is NaN or Infinity. - public static Force FromTonnesForce(QuantityValue tonnesforce) + public static Force FromTonnesForce(QuantityValue tonnesforce) { double value = (double) tonnesforce; - return new Force(value, ForceUnit.TonneForce); + return new Force(value, ForceUnit.TonneForce); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Force unit value. - public static Force From(QuantityValue value, ForceUnit fromUnit) + /// unit value. + public static Force From(QuantityValue value, ForceUnit fromUnit) { - return new Force((double)value, fromUnit); + return new Force((double)value, fromUnit); } #endregion @@ -424,7 +424,7 @@ public static Force From(QuantityValue value, ForceUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Force Parse(string str) + public static Force Parse(string str) { return Parse(str, null); } @@ -452,9 +452,9 @@ public static Force Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Force Parse(string str, [CanBeNull] IFormatProvider provider) + public static Force Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ForceUnit>( str, provider, From); @@ -468,7 +468,7 @@ public static Force Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Force result) + public static bool TryParse([CanBeNull] string str, out Force result) { return TryParse(str, null, out result); } @@ -483,9 +483,9 @@ public static bool TryParse([CanBeNull] string str, out Force result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Force result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Force result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ForceUnit>( str, provider, From, @@ -547,43 +547,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceU #region Arithmetic Operators /// Negate the value. - public static Force operator -(Force right) + public static Force operator -(Force right) { - return new Force(-right.Value, right.Unit); + return new Force(-right.Value, right.Unit); } - /// Get from adding two . - public static Force operator +(Force left, Force right) + /// Get from adding two . + public static Force operator +(Force left, Force right) { - return new Force(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Force(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Force operator -(Force left, Force right) + /// Get from subtracting two . + public static Force operator -(Force left, Force right) { - return new Force(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Force(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Force operator *(double left, Force right) + /// Get from multiplying value and . + public static Force operator *(double left, Force right) { - return new Force(left * right.Value, right.Unit); + return new Force(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Force operator *(Force left, double right) + /// Get from multiplying value and . + public static Force operator *(Force left, double right) { - return new Force(left.Value * right, left.Unit); + return new Force(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Force operator /(Force left, double right) + /// Get from dividing by value. + public static Force operator /(Force left, double right) { - return new Force(left.Value / right, left.Unit); + return new Force(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Force left, Force right) + /// Get ratio value from dividing by . + public static double operator /(Force left, Force right) { return left.Newtons / right.Newtons; } @@ -593,39 +593,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceU #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Force left, Force right) + public static bool operator <=(Force left, Force right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Force left, Force right) + public static bool operator >=(Force left, Force right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Force left, Force right) + public static bool operator <(Force left, Force right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Force left, Force right) + public static bool operator >(Force left, Force right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Force left, Force right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Force left, Force right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Force left, Force right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Force left, Force right) { return !(left == right); } @@ -634,37 +634,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceU public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Force objForce)) throw new ArgumentException("Expected type Force.", nameof(obj)); + if(!(obj is Force objForce)) throw new ArgumentException("Expected type Force.", nameof(obj)); return CompareTo(objForce); } /// - public int CompareTo(Force other) + public int CompareTo(Force other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Force objForce)) + if(obj is null || !(obj is Force objForce)) return false; return Equals(objForce); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Force other) + /// Consider using for safely comparing floating point values. + public bool Equals(Force other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Force within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -702,7 +702,7 @@ public bool Equals(Force other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Force other, double tolerance, ComparisonType comparisonType) + public bool Equals(Force other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -716,7 +716,7 @@ public bool Equals(Force other, double tolerance, ComparisonType comparisonType) /// /// Returns the hash code for this instance. /// - /// A hash code for the current Force. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -764,13 +764,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Force to another Force with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Force with the specified unit. - public Force ToUnit(ForceUnit unit) + /// A with the specified unit. + public Force ToUnit(ForceUnit unit) { var convertedValue = GetValueAs(unit); - return new Force(convertedValue, unit); + return new Force(convertedValue, unit); } /// @@ -783,7 +783,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Force ToUnit(UnitSystem unitSystem) + public Force ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -838,10 +838,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Force ToBaseUnit() + internal Force ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Force(baseUnitValue, BaseUnit); + return new Force(baseUnitValue, BaseUnit); } private double GetValueAs(ForceUnit unit) @@ -962,7 +962,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Force)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Force)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -972,12 +972,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Force)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Force)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Force)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Force)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1022,16 +1022,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Force)) + if(conversionType == typeof(Force)) return this; else if(conversionType == typeof(ForceUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Force.QuantityType; + return Force.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Force.BaseDimensions; + return Force.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Force)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Force)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs index 1d5bf52173..c1d57b7949 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Force change rate is the ratio of the force change to the time during which the change occurred (value of force changes per unit time). /// - public partial struct ForceChangeRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ForceChangeRate : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -110,19 +110,19 @@ public ForceChangeRate(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ForceChangeRate, which is NewtonPerSecond. All conversions go via this value. + /// The base unit of , which is NewtonPerSecond. All conversions go via this value. /// public static ForceChangeRateUnit BaseUnit { get; } = ForceChangeRateUnit.NewtonPerSecond; /// - /// Represents the largest possible value of ForceChangeRate + /// Represents the largest possible value of /// - public static ForceChangeRate MaxValue { get; } = new ForceChangeRate(double.MaxValue, BaseUnit); + public static ForceChangeRate MaxValue { get; } = new ForceChangeRate(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ForceChangeRate + /// Represents the smallest possible value of /// - public static ForceChangeRate MinValue { get; } = new ForceChangeRate(double.MinValue, BaseUnit); + public static ForceChangeRate MinValue { get; } = new ForceChangeRate(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -130,14 +130,14 @@ public ForceChangeRate(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ForceChangeRate; /// - /// All units of measurement for the ForceChangeRate quantity. + /// All units of measurement for the quantity. /// public static ForceChangeRateUnit[] Units { get; } = Enum.GetValues(typeof(ForceChangeRateUnit)).Cast().Except(new ForceChangeRateUnit[]{ ForceChangeRateUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerSecond. /// - public static ForceChangeRate Zero { get; } = new ForceChangeRate(0, BaseUnit); + public static ForceChangeRate Zero { get; } = new ForceChangeRate(0, BaseUnit); #endregion @@ -162,69 +162,69 @@ public ForceChangeRate(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ForceChangeRate.QuantityType; + public QuantityType Type => ForceChangeRate.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ForceChangeRate.BaseDimensions; + public BaseDimensions Dimensions => ForceChangeRate.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ForceChangeRate in CentinewtonsPerSecond. + /// Get in CentinewtonsPerSecond. /// public double CentinewtonsPerSecond => As(ForceChangeRateUnit.CentinewtonPerSecond); /// - /// Get ForceChangeRate in DecanewtonsPerMinute. + /// Get in DecanewtonsPerMinute. /// public double DecanewtonsPerMinute => As(ForceChangeRateUnit.DecanewtonPerMinute); /// - /// Get ForceChangeRate in DecanewtonsPerSecond. + /// Get in DecanewtonsPerSecond. /// public double DecanewtonsPerSecond => As(ForceChangeRateUnit.DecanewtonPerSecond); /// - /// Get ForceChangeRate in DecinewtonsPerSecond. + /// Get in DecinewtonsPerSecond. /// public double DecinewtonsPerSecond => As(ForceChangeRateUnit.DecinewtonPerSecond); /// - /// Get ForceChangeRate in KilonewtonsPerMinute. + /// Get in KilonewtonsPerMinute. /// public double KilonewtonsPerMinute => As(ForceChangeRateUnit.KilonewtonPerMinute); /// - /// Get ForceChangeRate in KilonewtonsPerSecond. + /// Get in KilonewtonsPerSecond. /// public double KilonewtonsPerSecond => As(ForceChangeRateUnit.KilonewtonPerSecond); /// - /// Get ForceChangeRate in MicronewtonsPerSecond. + /// Get in MicronewtonsPerSecond. /// public double MicronewtonsPerSecond => As(ForceChangeRateUnit.MicronewtonPerSecond); /// - /// Get ForceChangeRate in MillinewtonsPerSecond. + /// Get in MillinewtonsPerSecond. /// public double MillinewtonsPerSecond => As(ForceChangeRateUnit.MillinewtonPerSecond); /// - /// Get ForceChangeRate in NanonewtonsPerSecond. + /// Get in NanonewtonsPerSecond. /// public double NanonewtonsPerSecond => As(ForceChangeRateUnit.NanonewtonPerSecond); /// - /// Get ForceChangeRate in NewtonsPerMinute. + /// Get in NewtonsPerMinute. /// public double NewtonsPerMinute => As(ForceChangeRateUnit.NewtonPerMinute); /// - /// Get ForceChangeRate in NewtonsPerSecond. + /// Get in NewtonsPerSecond. /// public double NewtonsPerSecond => As(ForceChangeRateUnit.NewtonPerSecond); @@ -258,114 +258,114 @@ public static string GetAbbreviation(ForceChangeRateUnit unit, [CanBeNull] IForm #region Static Factory Methods /// - /// Get ForceChangeRate from CentinewtonsPerSecond. + /// Get from CentinewtonsPerSecond. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromCentinewtonsPerSecond(QuantityValue centinewtonspersecond) + public static ForceChangeRate FromCentinewtonsPerSecond(QuantityValue centinewtonspersecond) { double value = (double) centinewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.CentinewtonPerSecond); + return new ForceChangeRate(value, ForceChangeRateUnit.CentinewtonPerSecond); } /// - /// Get ForceChangeRate from DecanewtonsPerMinute. + /// Get from DecanewtonsPerMinute. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromDecanewtonsPerMinute(QuantityValue decanewtonsperminute) + public static ForceChangeRate FromDecanewtonsPerMinute(QuantityValue decanewtonsperminute) { double value = (double) decanewtonsperminute; - return new ForceChangeRate(value, ForceChangeRateUnit.DecanewtonPerMinute); + return new ForceChangeRate(value, ForceChangeRateUnit.DecanewtonPerMinute); } /// - /// Get ForceChangeRate from DecanewtonsPerSecond. + /// Get from DecanewtonsPerSecond. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromDecanewtonsPerSecond(QuantityValue decanewtonspersecond) + public static ForceChangeRate FromDecanewtonsPerSecond(QuantityValue decanewtonspersecond) { double value = (double) decanewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.DecanewtonPerSecond); + return new ForceChangeRate(value, ForceChangeRateUnit.DecanewtonPerSecond); } /// - /// Get ForceChangeRate from DecinewtonsPerSecond. + /// Get from DecinewtonsPerSecond. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromDecinewtonsPerSecond(QuantityValue decinewtonspersecond) + public static ForceChangeRate FromDecinewtonsPerSecond(QuantityValue decinewtonspersecond) { double value = (double) decinewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.DecinewtonPerSecond); + return new ForceChangeRate(value, ForceChangeRateUnit.DecinewtonPerSecond); } /// - /// Get ForceChangeRate from KilonewtonsPerMinute. + /// Get from KilonewtonsPerMinute. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromKilonewtonsPerMinute(QuantityValue kilonewtonsperminute) + public static ForceChangeRate FromKilonewtonsPerMinute(QuantityValue kilonewtonsperminute) { double value = (double) kilonewtonsperminute; - return new ForceChangeRate(value, ForceChangeRateUnit.KilonewtonPerMinute); + return new ForceChangeRate(value, ForceChangeRateUnit.KilonewtonPerMinute); } /// - /// Get ForceChangeRate from KilonewtonsPerSecond. + /// Get from KilonewtonsPerSecond. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromKilonewtonsPerSecond(QuantityValue kilonewtonspersecond) + public static ForceChangeRate FromKilonewtonsPerSecond(QuantityValue kilonewtonspersecond) { double value = (double) kilonewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.KilonewtonPerSecond); + return new ForceChangeRate(value, ForceChangeRateUnit.KilonewtonPerSecond); } /// - /// Get ForceChangeRate from MicronewtonsPerSecond. + /// Get from MicronewtonsPerSecond. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromMicronewtonsPerSecond(QuantityValue micronewtonspersecond) + public static ForceChangeRate FromMicronewtonsPerSecond(QuantityValue micronewtonspersecond) { double value = (double) micronewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.MicronewtonPerSecond); + return new ForceChangeRate(value, ForceChangeRateUnit.MicronewtonPerSecond); } /// - /// Get ForceChangeRate from MillinewtonsPerSecond. + /// Get from MillinewtonsPerSecond. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromMillinewtonsPerSecond(QuantityValue millinewtonspersecond) + public static ForceChangeRate FromMillinewtonsPerSecond(QuantityValue millinewtonspersecond) { double value = (double) millinewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.MillinewtonPerSecond); + return new ForceChangeRate(value, ForceChangeRateUnit.MillinewtonPerSecond); } /// - /// Get ForceChangeRate from NanonewtonsPerSecond. + /// Get from NanonewtonsPerSecond. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromNanonewtonsPerSecond(QuantityValue nanonewtonspersecond) + public static ForceChangeRate FromNanonewtonsPerSecond(QuantityValue nanonewtonspersecond) { double value = (double) nanonewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.NanonewtonPerSecond); + return new ForceChangeRate(value, ForceChangeRateUnit.NanonewtonPerSecond); } /// - /// Get ForceChangeRate from NewtonsPerMinute. + /// Get from NewtonsPerMinute. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromNewtonsPerMinute(QuantityValue newtonsperminute) + public static ForceChangeRate FromNewtonsPerMinute(QuantityValue newtonsperminute) { double value = (double) newtonsperminute; - return new ForceChangeRate(value, ForceChangeRateUnit.NewtonPerMinute); + return new ForceChangeRate(value, ForceChangeRateUnit.NewtonPerMinute); } /// - /// Get ForceChangeRate from NewtonsPerSecond. + /// Get from NewtonsPerSecond. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromNewtonsPerSecond(QuantityValue newtonspersecond) + public static ForceChangeRate FromNewtonsPerSecond(QuantityValue newtonspersecond) { double value = (double) newtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.NewtonPerSecond); + return new ForceChangeRate(value, ForceChangeRateUnit.NewtonPerSecond); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ForceChangeRate unit value. - public static ForceChangeRate From(QuantityValue value, ForceChangeRateUnit fromUnit) + /// unit value. + public static ForceChangeRate From(QuantityValue value, ForceChangeRateUnit fromUnit) { - return new ForceChangeRate((double)value, fromUnit); + return new ForceChangeRate((double)value, fromUnit); } #endregion @@ -394,7 +394,7 @@ public static ForceChangeRate From(QuantityValue value, ForceChangeRateUnit from /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ForceChangeRate Parse(string str) + public static ForceChangeRate Parse(string str) { return Parse(str, null); } @@ -422,9 +422,9 @@ public static ForceChangeRate Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ForceChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) + public static ForceChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ForceChangeRateUnit>( str, provider, From); @@ -438,7 +438,7 @@ public static ForceChangeRate Parse(string str, [CanBeNull] IFormatProvider prov /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ForceChangeRate result) + public static bool TryParse([CanBeNull] string str, out ForceChangeRate result) { return TryParse(str, null, out result); } @@ -453,9 +453,9 @@ public static bool TryParse([CanBeNull] string str, out ForceChangeRate result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForceChangeRate result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForceChangeRate result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ForceChangeRateUnit>( str, provider, From, @@ -517,43 +517,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceC #region Arithmetic Operators /// Negate the value. - public static ForceChangeRate operator -(ForceChangeRate right) + public static ForceChangeRate operator -(ForceChangeRate right) { - return new ForceChangeRate(-right.Value, right.Unit); + return new ForceChangeRate(-right.Value, right.Unit); } - /// Get from adding two . - public static ForceChangeRate operator +(ForceChangeRate left, ForceChangeRate right) + /// Get from adding two . + public static ForceChangeRate operator +(ForceChangeRate left, ForceChangeRate right) { - return new ForceChangeRate(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ForceChangeRate(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ForceChangeRate operator -(ForceChangeRate left, ForceChangeRate right) + /// Get from subtracting two . + public static ForceChangeRate operator -(ForceChangeRate left, ForceChangeRate right) { - return new ForceChangeRate(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ForceChangeRate(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ForceChangeRate operator *(double left, ForceChangeRate right) + /// Get from multiplying value and . + public static ForceChangeRate operator *(double left, ForceChangeRate right) { - return new ForceChangeRate(left * right.Value, right.Unit); + return new ForceChangeRate(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ForceChangeRate operator *(ForceChangeRate left, double right) + /// Get from multiplying value and . + public static ForceChangeRate operator *(ForceChangeRate left, double right) { - return new ForceChangeRate(left.Value * right, left.Unit); + return new ForceChangeRate(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ForceChangeRate operator /(ForceChangeRate left, double right) + /// Get from dividing by value. + public static ForceChangeRate operator /(ForceChangeRate left, double right) { - return new ForceChangeRate(left.Value / right, left.Unit); + return new ForceChangeRate(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ForceChangeRate left, ForceChangeRate right) + /// Get ratio value from dividing by . + public static double operator /(ForceChangeRate left, ForceChangeRate right) { return left.NewtonsPerSecond / right.NewtonsPerSecond; } @@ -563,39 +563,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceC #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ForceChangeRate left, ForceChangeRate right) + public static bool operator <=(ForceChangeRate left, ForceChangeRate right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ForceChangeRate left, ForceChangeRate right) + public static bool operator >=(ForceChangeRate left, ForceChangeRate right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ForceChangeRate left, ForceChangeRate right) + public static bool operator <(ForceChangeRate left, ForceChangeRate right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ForceChangeRate left, ForceChangeRate right) + public static bool operator >(ForceChangeRate left, ForceChangeRate right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ForceChangeRate left, ForceChangeRate right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ForceChangeRate left, ForceChangeRate right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ForceChangeRate left, ForceChangeRate right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ForceChangeRate left, ForceChangeRate right) { return !(left == right); } @@ -604,37 +604,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceC public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ForceChangeRate objForceChangeRate)) throw new ArgumentException("Expected type ForceChangeRate.", nameof(obj)); + if(!(obj is ForceChangeRate objForceChangeRate)) throw new ArgumentException("Expected type ForceChangeRate.", nameof(obj)); return CompareTo(objForceChangeRate); } /// - public int CompareTo(ForceChangeRate other) + public int CompareTo(ForceChangeRate other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ForceChangeRate objForceChangeRate)) + if(obj is null || !(obj is ForceChangeRate objForceChangeRate)) return false; return Equals(objForceChangeRate); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ForceChangeRate other) + /// Consider using for safely comparing floating point values. + public bool Equals(ForceChangeRate other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ForceChangeRate within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -672,7 +672,7 @@ public bool Equals(ForceChangeRate other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ForceChangeRate other, double tolerance, ComparisonType comparisonType) + public bool Equals(ForceChangeRate other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -686,7 +686,7 @@ public bool Equals(ForceChangeRate other, double tolerance, ComparisonType compa /// /// Returns the hash code for this instance. /// - /// A hash code for the current ForceChangeRate. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -734,13 +734,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ForceChangeRate to another ForceChangeRate with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ForceChangeRate with the specified unit. - public ForceChangeRate ToUnit(ForceChangeRateUnit unit) + /// A with the specified unit. + public ForceChangeRate ToUnit(ForceChangeRateUnit unit) { var convertedValue = GetValueAs(unit); - return new ForceChangeRate(convertedValue, unit); + return new ForceChangeRate(convertedValue, unit); } /// @@ -753,7 +753,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ForceChangeRate ToUnit(UnitSystem unitSystem) + public ForceChangeRate ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -806,10 +806,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ForceChangeRate ToBaseUnit() + internal ForceChangeRate ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ForceChangeRate(baseUnitValue, BaseUnit); + return new ForceChangeRate(baseUnitValue, BaseUnit); } private double GetValueAs(ForceChangeRateUnit unit) @@ -928,7 +928,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -938,12 +938,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -988,16 +988,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ForceChangeRate)) + if(conversionType == typeof(ForceChangeRate)) return this; else if(conversionType == typeof(ForceChangeRateUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ForceChangeRate.QuantityType; + return ForceChangeRate.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ForceChangeRate.BaseDimensions; + return ForceChangeRate.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs index 56afd9cd6b..5a8953daba 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// The magnitude of force per unit length. /// - public partial struct ForcePerLength : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ForcePerLength : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -111,19 +111,19 @@ public ForcePerLength(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ForcePerLength, which is NewtonPerMeter. All conversions go via this value. + /// The base unit of , which is NewtonPerMeter. All conversions go via this value. /// public static ForcePerLengthUnit BaseUnit { get; } = ForcePerLengthUnit.NewtonPerMeter; /// - /// Represents the largest possible value of ForcePerLength + /// Represents the largest possible value of /// - public static ForcePerLength MaxValue { get; } = new ForcePerLength(double.MaxValue, BaseUnit); + public static ForcePerLength MaxValue { get; } = new ForcePerLength(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ForcePerLength + /// Represents the smallest possible value of /// - public static ForcePerLength MinValue { get; } = new ForcePerLength(double.MinValue, BaseUnit); + public static ForcePerLength MinValue { get; } = new ForcePerLength(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -131,14 +131,14 @@ public ForcePerLength(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ForcePerLength; /// - /// All units of measurement for the ForcePerLength quantity. + /// All units of measurement for the quantity. /// public static ForcePerLengthUnit[] Units { get; } = Enum.GetValues(typeof(ForcePerLengthUnit)).Cast().Except(new ForcePerLengthUnit[]{ ForcePerLengthUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerMeter. /// - public static ForcePerLength Zero { get; } = new ForcePerLength(0, BaseUnit); + public static ForcePerLength Zero { get; } = new ForcePerLength(0, BaseUnit); #endregion @@ -163,74 +163,74 @@ public ForcePerLength(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ForcePerLength.QuantityType; + public QuantityType Type => ForcePerLength.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ForcePerLength.BaseDimensions; + public BaseDimensions Dimensions => ForcePerLength.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ForcePerLength in CentinewtonsPerMeter. + /// Get in CentinewtonsPerMeter. /// public double CentinewtonsPerMeter => As(ForcePerLengthUnit.CentinewtonPerMeter); /// - /// Get ForcePerLength in DecinewtonsPerMeter. + /// Get in DecinewtonsPerMeter. /// public double DecinewtonsPerMeter => As(ForcePerLengthUnit.DecinewtonPerMeter); /// - /// Get ForcePerLength in KilogramsForcePerMeter. + /// Get in KilogramsForcePerMeter. /// public double KilogramsForcePerMeter => As(ForcePerLengthUnit.KilogramForcePerMeter); /// - /// Get ForcePerLength in KilonewtonsPerMeter. + /// Get in KilonewtonsPerMeter. /// public double KilonewtonsPerMeter => As(ForcePerLengthUnit.KilonewtonPerMeter); /// - /// Get ForcePerLength in MeganewtonsPerMeter. + /// Get in MeganewtonsPerMeter. /// public double MeganewtonsPerMeter => As(ForcePerLengthUnit.MeganewtonPerMeter); /// - /// Get ForcePerLength in MicronewtonsPerMeter. + /// Get in MicronewtonsPerMeter. /// public double MicronewtonsPerMeter => As(ForcePerLengthUnit.MicronewtonPerMeter); /// - /// Get ForcePerLength in MillinewtonsPerMeter. + /// Get in MillinewtonsPerMeter. /// public double MillinewtonsPerMeter => As(ForcePerLengthUnit.MillinewtonPerMeter); /// - /// Get ForcePerLength in NanonewtonsPerMeter. + /// Get in NanonewtonsPerMeter. /// public double NanonewtonsPerMeter => As(ForcePerLengthUnit.NanonewtonPerMeter); /// - /// Get ForcePerLength in NewtonsPerMeter. + /// Get in NewtonsPerMeter. /// public double NewtonsPerMeter => As(ForcePerLengthUnit.NewtonPerMeter); /// - /// Get ForcePerLength in PoundsForcePerFoot. + /// Get in PoundsForcePerFoot. /// public double PoundsForcePerFoot => As(ForcePerLengthUnit.PoundForcePerFoot); /// - /// Get ForcePerLength in PoundsForcePerInch. + /// Get in PoundsForcePerInch. /// public double PoundsForcePerInch => As(ForcePerLengthUnit.PoundForcePerInch); /// - /// Get ForcePerLength in PoundsForcePerYard. + /// Get in PoundsForcePerYard. /// public double PoundsForcePerYard => As(ForcePerLengthUnit.PoundForcePerYard); @@ -264,123 +264,123 @@ public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] IForma #region Static Factory Methods /// - /// Get ForcePerLength from CentinewtonsPerMeter. + /// Get from CentinewtonsPerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromCentinewtonsPerMeter(QuantityValue centinewtonspermeter) + public static ForcePerLength FromCentinewtonsPerMeter(QuantityValue centinewtonspermeter) { double value = (double) centinewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.CentinewtonPerMeter); + return new ForcePerLength(value, ForcePerLengthUnit.CentinewtonPerMeter); } /// - /// Get ForcePerLength from DecinewtonsPerMeter. + /// Get from DecinewtonsPerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromDecinewtonsPerMeter(QuantityValue decinewtonspermeter) + public static ForcePerLength FromDecinewtonsPerMeter(QuantityValue decinewtonspermeter) { double value = (double) decinewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.DecinewtonPerMeter); + return new ForcePerLength(value, ForcePerLengthUnit.DecinewtonPerMeter); } /// - /// Get ForcePerLength from KilogramsForcePerMeter. + /// Get from KilogramsForcePerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromKilogramsForcePerMeter(QuantityValue kilogramsforcepermeter) + public static ForcePerLength FromKilogramsForcePerMeter(QuantityValue kilogramsforcepermeter) { double value = (double) kilogramsforcepermeter; - return new ForcePerLength(value, ForcePerLengthUnit.KilogramForcePerMeter); + return new ForcePerLength(value, ForcePerLengthUnit.KilogramForcePerMeter); } /// - /// Get ForcePerLength from KilonewtonsPerMeter. + /// Get from KilonewtonsPerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromKilonewtonsPerMeter(QuantityValue kilonewtonspermeter) + public static ForcePerLength FromKilonewtonsPerMeter(QuantityValue kilonewtonspermeter) { double value = (double) kilonewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.KilonewtonPerMeter); + return new ForcePerLength(value, ForcePerLengthUnit.KilonewtonPerMeter); } /// - /// Get ForcePerLength from MeganewtonsPerMeter. + /// Get from MeganewtonsPerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromMeganewtonsPerMeter(QuantityValue meganewtonspermeter) + public static ForcePerLength FromMeganewtonsPerMeter(QuantityValue meganewtonspermeter) { double value = (double) meganewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.MeganewtonPerMeter); + return new ForcePerLength(value, ForcePerLengthUnit.MeganewtonPerMeter); } /// - /// Get ForcePerLength from MicronewtonsPerMeter. + /// Get from MicronewtonsPerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromMicronewtonsPerMeter(QuantityValue micronewtonspermeter) + public static ForcePerLength FromMicronewtonsPerMeter(QuantityValue micronewtonspermeter) { double value = (double) micronewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.MicronewtonPerMeter); + return new ForcePerLength(value, ForcePerLengthUnit.MicronewtonPerMeter); } /// - /// Get ForcePerLength from MillinewtonsPerMeter. + /// Get from MillinewtonsPerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromMillinewtonsPerMeter(QuantityValue millinewtonspermeter) + public static ForcePerLength FromMillinewtonsPerMeter(QuantityValue millinewtonspermeter) { double value = (double) millinewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.MillinewtonPerMeter); + return new ForcePerLength(value, ForcePerLengthUnit.MillinewtonPerMeter); } /// - /// Get ForcePerLength from NanonewtonsPerMeter. + /// Get from NanonewtonsPerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromNanonewtonsPerMeter(QuantityValue nanonewtonspermeter) + public static ForcePerLength FromNanonewtonsPerMeter(QuantityValue nanonewtonspermeter) { double value = (double) nanonewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.NanonewtonPerMeter); + return new ForcePerLength(value, ForcePerLengthUnit.NanonewtonPerMeter); } /// - /// Get ForcePerLength from NewtonsPerMeter. + /// Get from NewtonsPerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromNewtonsPerMeter(QuantityValue newtonspermeter) + public static ForcePerLength FromNewtonsPerMeter(QuantityValue newtonspermeter) { double value = (double) newtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.NewtonPerMeter); + return new ForcePerLength(value, ForcePerLengthUnit.NewtonPerMeter); } /// - /// Get ForcePerLength from PoundsForcePerFoot. + /// Get from PoundsForcePerFoot. /// /// If value is NaN or Infinity. - public static ForcePerLength FromPoundsForcePerFoot(QuantityValue poundsforceperfoot) + public static ForcePerLength FromPoundsForcePerFoot(QuantityValue poundsforceperfoot) { double value = (double) poundsforceperfoot; - return new ForcePerLength(value, ForcePerLengthUnit.PoundForcePerFoot); + return new ForcePerLength(value, ForcePerLengthUnit.PoundForcePerFoot); } /// - /// Get ForcePerLength from PoundsForcePerInch. + /// Get from PoundsForcePerInch. /// /// If value is NaN or Infinity. - public static ForcePerLength FromPoundsForcePerInch(QuantityValue poundsforceperinch) + public static ForcePerLength FromPoundsForcePerInch(QuantityValue poundsforceperinch) { double value = (double) poundsforceperinch; - return new ForcePerLength(value, ForcePerLengthUnit.PoundForcePerInch); + return new ForcePerLength(value, ForcePerLengthUnit.PoundForcePerInch); } /// - /// Get ForcePerLength from PoundsForcePerYard. + /// Get from PoundsForcePerYard. /// /// If value is NaN or Infinity. - public static ForcePerLength FromPoundsForcePerYard(QuantityValue poundsforceperyard) + public static ForcePerLength FromPoundsForcePerYard(QuantityValue poundsforceperyard) { double value = (double) poundsforceperyard; - return new ForcePerLength(value, ForcePerLengthUnit.PoundForcePerYard); + return new ForcePerLength(value, ForcePerLengthUnit.PoundForcePerYard); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ForcePerLength unit value. - public static ForcePerLength From(QuantityValue value, ForcePerLengthUnit fromUnit) + /// unit value. + public static ForcePerLength From(QuantityValue value, ForcePerLengthUnit fromUnit) { - return new ForcePerLength((double)value, fromUnit); + return new ForcePerLength((double)value, fromUnit); } #endregion @@ -409,7 +409,7 @@ public static ForcePerLength From(QuantityValue value, ForcePerLengthUnit fromUn /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ForcePerLength Parse(string str) + public static ForcePerLength Parse(string str) { return Parse(str, null); } @@ -437,9 +437,9 @@ public static ForcePerLength Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ForcePerLength Parse(string str, [CanBeNull] IFormatProvider provider) + public static ForcePerLength Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ForcePerLengthUnit>( str, provider, From); @@ -453,7 +453,7 @@ public static ForcePerLength Parse(string str, [CanBeNull] IFormatProvider provi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ForcePerLength result) + public static bool TryParse([CanBeNull] string str, out ForcePerLength result) { return TryParse(str, null, out result); } @@ -468,9 +468,9 @@ public static bool TryParse([CanBeNull] string str, out ForcePerLength result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForcePerLength result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForcePerLength result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ForcePerLengthUnit>( str, provider, From, @@ -532,43 +532,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceP #region Arithmetic Operators /// Negate the value. - public static ForcePerLength operator -(ForcePerLength right) + public static ForcePerLength operator -(ForcePerLength right) { - return new ForcePerLength(-right.Value, right.Unit); + return new ForcePerLength(-right.Value, right.Unit); } - /// Get from adding two . - public static ForcePerLength operator +(ForcePerLength left, ForcePerLength right) + /// Get from adding two . + public static ForcePerLength operator +(ForcePerLength left, ForcePerLength right) { - return new ForcePerLength(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ForcePerLength(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ForcePerLength operator -(ForcePerLength left, ForcePerLength right) + /// Get from subtracting two . + public static ForcePerLength operator -(ForcePerLength left, ForcePerLength right) { - return new ForcePerLength(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ForcePerLength(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ForcePerLength operator *(double left, ForcePerLength right) + /// Get from multiplying value and . + public static ForcePerLength operator *(double left, ForcePerLength right) { - return new ForcePerLength(left * right.Value, right.Unit); + return new ForcePerLength(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ForcePerLength operator *(ForcePerLength left, double right) + /// Get from multiplying value and . + public static ForcePerLength operator *(ForcePerLength left, double right) { - return new ForcePerLength(left.Value * right, left.Unit); + return new ForcePerLength(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ForcePerLength operator /(ForcePerLength left, double right) + /// Get from dividing by value. + public static ForcePerLength operator /(ForcePerLength left, double right) { - return new ForcePerLength(left.Value / right, left.Unit); + return new ForcePerLength(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ForcePerLength left, ForcePerLength right) + /// Get ratio value from dividing by . + public static double operator /(ForcePerLength left, ForcePerLength right) { return left.NewtonsPerMeter / right.NewtonsPerMeter; } @@ -578,39 +578,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceP #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ForcePerLength left, ForcePerLength right) + public static bool operator <=(ForcePerLength left, ForcePerLength right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ForcePerLength left, ForcePerLength right) + public static bool operator >=(ForcePerLength left, ForcePerLength right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ForcePerLength left, ForcePerLength right) + public static bool operator <(ForcePerLength left, ForcePerLength right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ForcePerLength left, ForcePerLength right) + public static bool operator >(ForcePerLength left, ForcePerLength right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ForcePerLength left, ForcePerLength right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ForcePerLength left, ForcePerLength right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ForcePerLength left, ForcePerLength right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ForcePerLength left, ForcePerLength right) { return !(left == right); } @@ -619,37 +619,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceP public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ForcePerLength objForcePerLength)) throw new ArgumentException("Expected type ForcePerLength.", nameof(obj)); + if(!(obj is ForcePerLength objForcePerLength)) throw new ArgumentException("Expected type ForcePerLength.", nameof(obj)); return CompareTo(objForcePerLength); } /// - public int CompareTo(ForcePerLength other) + public int CompareTo(ForcePerLength other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ForcePerLength objForcePerLength)) + if(obj is null || !(obj is ForcePerLength objForcePerLength)) return false; return Equals(objForcePerLength); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ForcePerLength other) + /// Consider using for safely comparing floating point values. + public bool Equals(ForcePerLength other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ForcePerLength within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -687,7 +687,7 @@ public bool Equals(ForcePerLength other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ForcePerLength other, double tolerance, ComparisonType comparisonType) + public bool Equals(ForcePerLength other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -701,7 +701,7 @@ public bool Equals(ForcePerLength other, double tolerance, ComparisonType compar /// /// Returns the hash code for this instance. /// - /// A hash code for the current ForcePerLength. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -749,13 +749,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ForcePerLength to another ForcePerLength with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ForcePerLength with the specified unit. - public ForcePerLength ToUnit(ForcePerLengthUnit unit) + /// A with the specified unit. + public ForcePerLength ToUnit(ForcePerLengthUnit unit) { var convertedValue = GetValueAs(unit); - return new ForcePerLength(convertedValue, unit); + return new ForcePerLength(convertedValue, unit); } /// @@ -768,7 +768,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ForcePerLength ToUnit(UnitSystem unitSystem) + public ForcePerLength ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -822,10 +822,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ForcePerLength ToBaseUnit() + internal ForcePerLength ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ForcePerLength(baseUnitValue, BaseUnit); + return new ForcePerLength(baseUnitValue, BaseUnit); } private double GetValueAs(ForcePerLengthUnit unit) @@ -945,7 +945,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -955,12 +955,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1005,16 +1005,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ForcePerLength)) + if(conversionType == typeof(ForcePerLength)) return this; else if(conversionType == typeof(ForcePerLengthUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ForcePerLength.QuantityType; + return ForcePerLength.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ForcePerLength.BaseDimensions; + return ForcePerLength.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs index eaba02d254..a5fe2621bf 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// The number of occurrences of a repeating event per unit time. /// - public partial struct Frequency : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Frequency : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -108,19 +108,19 @@ public Frequency(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Frequency, which is Hertz. All conversions go via this value. + /// The base unit of , which is Hertz. All conversions go via this value. /// public static FrequencyUnit BaseUnit { get; } = FrequencyUnit.Hertz; /// - /// Represents the largest possible value of Frequency + /// Represents the largest possible value of /// - public static Frequency MaxValue { get; } = new Frequency(double.MaxValue, BaseUnit); + public static Frequency MaxValue { get; } = new Frequency(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Frequency + /// Represents the smallest possible value of /// - public static Frequency MinValue { get; } = new Frequency(double.MinValue, BaseUnit); + public static Frequency MinValue { get; } = new Frequency(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,14 +128,14 @@ public Frequency(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Frequency; /// - /// All units of measurement for the Frequency quantity. + /// All units of measurement for the quantity. /// public static FrequencyUnit[] Units { get; } = Enum.GetValues(typeof(FrequencyUnit)).Cast().Except(new FrequencyUnit[]{ FrequencyUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Hertz. /// - public static Frequency Zero { get; } = new Frequency(0, BaseUnit); + public static Frequency Zero { get; } = new Frequency(0, BaseUnit); #endregion @@ -160,59 +160,59 @@ public Frequency(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Frequency.QuantityType; + public QuantityType Type => Frequency.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Frequency.BaseDimensions; + public BaseDimensions Dimensions => Frequency.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Frequency in BeatsPerMinute. + /// Get in BeatsPerMinute. /// public double BeatsPerMinute => As(FrequencyUnit.BeatPerMinute); /// - /// Get Frequency in CyclesPerHour. + /// Get in CyclesPerHour. /// public double CyclesPerHour => As(FrequencyUnit.CyclePerHour); /// - /// Get Frequency in CyclesPerMinute. + /// Get in CyclesPerMinute. /// public double CyclesPerMinute => As(FrequencyUnit.CyclePerMinute); /// - /// Get Frequency in Gigahertz. + /// Get in Gigahertz. /// public double Gigahertz => As(FrequencyUnit.Gigahertz); /// - /// Get Frequency in Hertz. + /// Get in Hertz. /// public double Hertz => As(FrequencyUnit.Hertz); /// - /// Get Frequency in Kilohertz. + /// Get in Kilohertz. /// public double Kilohertz => As(FrequencyUnit.Kilohertz); /// - /// Get Frequency in Megahertz. + /// Get in Megahertz. /// public double Megahertz => As(FrequencyUnit.Megahertz); /// - /// Get Frequency in RadiansPerSecond. + /// Get in RadiansPerSecond. /// public double RadiansPerSecond => As(FrequencyUnit.RadianPerSecond); /// - /// Get Frequency in Terahertz. + /// Get in Terahertz. /// public double Terahertz => As(FrequencyUnit.Terahertz); @@ -246,96 +246,96 @@ public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] IFormatProv #region Static Factory Methods /// - /// Get Frequency from BeatsPerMinute. + /// Get from BeatsPerMinute. /// /// If value is NaN or Infinity. - public static Frequency FromBeatsPerMinute(QuantityValue beatsperminute) + public static Frequency FromBeatsPerMinute(QuantityValue beatsperminute) { double value = (double) beatsperminute; - return new Frequency(value, FrequencyUnit.BeatPerMinute); + return new Frequency(value, FrequencyUnit.BeatPerMinute); } /// - /// Get Frequency from CyclesPerHour. + /// Get from CyclesPerHour. /// /// If value is NaN or Infinity. - public static Frequency FromCyclesPerHour(QuantityValue cyclesperhour) + public static Frequency FromCyclesPerHour(QuantityValue cyclesperhour) { double value = (double) cyclesperhour; - return new Frequency(value, FrequencyUnit.CyclePerHour); + return new Frequency(value, FrequencyUnit.CyclePerHour); } /// - /// Get Frequency from CyclesPerMinute. + /// Get from CyclesPerMinute. /// /// If value is NaN or Infinity. - public static Frequency FromCyclesPerMinute(QuantityValue cyclesperminute) + public static Frequency FromCyclesPerMinute(QuantityValue cyclesperminute) { double value = (double) cyclesperminute; - return new Frequency(value, FrequencyUnit.CyclePerMinute); + return new Frequency(value, FrequencyUnit.CyclePerMinute); } /// - /// Get Frequency from Gigahertz. + /// Get from Gigahertz. /// /// If value is NaN or Infinity. - public static Frequency FromGigahertz(QuantityValue gigahertz) + public static Frequency FromGigahertz(QuantityValue gigahertz) { double value = (double) gigahertz; - return new Frequency(value, FrequencyUnit.Gigahertz); + return new Frequency(value, FrequencyUnit.Gigahertz); } /// - /// Get Frequency from Hertz. + /// Get from Hertz. /// /// If value is NaN or Infinity. - public static Frequency FromHertz(QuantityValue hertz) + public static Frequency FromHertz(QuantityValue hertz) { double value = (double) hertz; - return new Frequency(value, FrequencyUnit.Hertz); + return new Frequency(value, FrequencyUnit.Hertz); } /// - /// Get Frequency from Kilohertz. + /// Get from Kilohertz. /// /// If value is NaN or Infinity. - public static Frequency FromKilohertz(QuantityValue kilohertz) + public static Frequency FromKilohertz(QuantityValue kilohertz) { double value = (double) kilohertz; - return new Frequency(value, FrequencyUnit.Kilohertz); + return new Frequency(value, FrequencyUnit.Kilohertz); } /// - /// Get Frequency from Megahertz. + /// Get from Megahertz. /// /// If value is NaN or Infinity. - public static Frequency FromMegahertz(QuantityValue megahertz) + public static Frequency FromMegahertz(QuantityValue megahertz) { double value = (double) megahertz; - return new Frequency(value, FrequencyUnit.Megahertz); + return new Frequency(value, FrequencyUnit.Megahertz); } /// - /// Get Frequency from RadiansPerSecond. + /// Get from RadiansPerSecond. /// /// If value is NaN or Infinity. - public static Frequency FromRadiansPerSecond(QuantityValue radianspersecond) + public static Frequency FromRadiansPerSecond(QuantityValue radianspersecond) { double value = (double) radianspersecond; - return new Frequency(value, FrequencyUnit.RadianPerSecond); + return new Frequency(value, FrequencyUnit.RadianPerSecond); } /// - /// Get Frequency from Terahertz. + /// Get from Terahertz. /// /// If value is NaN or Infinity. - public static Frequency FromTerahertz(QuantityValue terahertz) + public static Frequency FromTerahertz(QuantityValue terahertz) { double value = (double) terahertz; - return new Frequency(value, FrequencyUnit.Terahertz); + return new Frequency(value, FrequencyUnit.Terahertz); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Frequency unit value. - public static Frequency From(QuantityValue value, FrequencyUnit fromUnit) + /// unit value. + public static Frequency From(QuantityValue value, FrequencyUnit fromUnit) { - return new Frequency((double)value, fromUnit); + return new Frequency((double)value, fromUnit); } #endregion @@ -364,7 +364,7 @@ public static Frequency From(QuantityValue value, FrequencyUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Frequency Parse(string str) + public static Frequency Parse(string str) { return Parse(str, null); } @@ -392,9 +392,9 @@ public static Frequency Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Frequency Parse(string str, [CanBeNull] IFormatProvider provider) + public static Frequency Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, FrequencyUnit>( str, provider, From); @@ -408,7 +408,7 @@ public static Frequency Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Frequency result) + public static bool TryParse([CanBeNull] string str, out Frequency result) { return TryParse(str, null, out result); } @@ -423,9 +423,9 @@ public static bool TryParse([CanBeNull] string str, out Frequency result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Frequency result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Frequency result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, FrequencyUnit>( str, provider, From, @@ -487,43 +487,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Freque #region Arithmetic Operators /// Negate the value. - public static Frequency operator -(Frequency right) + public static Frequency operator -(Frequency right) { - return new Frequency(-right.Value, right.Unit); + return new Frequency(-right.Value, right.Unit); } - /// Get from adding two . - public static Frequency operator +(Frequency left, Frequency right) + /// Get from adding two . + public static Frequency operator +(Frequency left, Frequency right) { - return new Frequency(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Frequency(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Frequency operator -(Frequency left, Frequency right) + /// Get from subtracting two . + public static Frequency operator -(Frequency left, Frequency right) { - return new Frequency(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Frequency(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Frequency operator *(double left, Frequency right) + /// Get from multiplying value and . + public static Frequency operator *(double left, Frequency right) { - return new Frequency(left * right.Value, right.Unit); + return new Frequency(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Frequency operator *(Frequency left, double right) + /// Get from multiplying value and . + public static Frequency operator *(Frequency left, double right) { - return new Frequency(left.Value * right, left.Unit); + return new Frequency(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Frequency operator /(Frequency left, double right) + /// Get from dividing by value. + public static Frequency operator /(Frequency left, double right) { - return new Frequency(left.Value / right, left.Unit); + return new Frequency(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Frequency left, Frequency right) + /// Get ratio value from dividing by . + public static double operator /(Frequency left, Frequency right) { return left.Hertz / right.Hertz; } @@ -533,39 +533,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Freque #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Frequency left, Frequency right) + public static bool operator <=(Frequency left, Frequency right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Frequency left, Frequency right) + public static bool operator >=(Frequency left, Frequency right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Frequency left, Frequency right) + public static bool operator <(Frequency left, Frequency right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Frequency left, Frequency right) + public static bool operator >(Frequency left, Frequency right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Frequency left, Frequency right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Frequency left, Frequency right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Frequency left, Frequency right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Frequency left, Frequency right) { return !(left == right); } @@ -574,37 +574,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Freque public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Frequency objFrequency)) throw new ArgumentException("Expected type Frequency.", nameof(obj)); + if(!(obj is Frequency objFrequency)) throw new ArgumentException("Expected type Frequency.", nameof(obj)); return CompareTo(objFrequency); } /// - public int CompareTo(Frequency other) + public int CompareTo(Frequency other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Frequency objFrequency)) + if(obj is null || !(obj is Frequency objFrequency)) return false; return Equals(objFrequency); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Frequency other) + /// Consider using for safely comparing floating point values. + public bool Equals(Frequency other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Frequency within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -642,7 +642,7 @@ public bool Equals(Frequency other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Frequency other, double tolerance, ComparisonType comparisonType) + public bool Equals(Frequency other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -656,7 +656,7 @@ public bool Equals(Frequency other, double tolerance, ComparisonType comparisonT /// /// Returns the hash code for this instance. /// - /// A hash code for the current Frequency. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -704,13 +704,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Frequency to another Frequency with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Frequency with the specified unit. - public Frequency ToUnit(FrequencyUnit unit) + /// A with the specified unit. + public Frequency ToUnit(FrequencyUnit unit) { var convertedValue = GetValueAs(unit); - return new Frequency(convertedValue, unit); + return new Frequency(convertedValue, unit); } /// @@ -723,7 +723,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Frequency ToUnit(UnitSystem unitSystem) + public Frequency ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -774,10 +774,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Frequency ToBaseUnit() + internal Frequency ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Frequency(baseUnitValue, BaseUnit); + return new Frequency(baseUnitValue, BaseUnit); } private double GetValueAs(FrequencyUnit unit) @@ -894,7 +894,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Frequency)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Frequency)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -904,12 +904,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Frequency)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Frequency)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Frequency)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Frequency)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -954,16 +954,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Frequency)) + if(conversionType == typeof(Frequency)) return this; else if(conversionType == typeof(FrequencyUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Frequency.QuantityType; + return Frequency.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Frequency.BaseDimensions; + return Frequency.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Frequency)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Frequency)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs index 28e511767e..649d5f5db6 100644 --- a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Fuel_efficiency /// - public partial struct FuelEfficiency : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct FuelEfficiency : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -106,19 +106,19 @@ public FuelEfficiency(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of FuelEfficiency, which is LiterPer100Kilometers. All conversions go via this value. + /// The base unit of , which is LiterPer100Kilometers. All conversions go via this value. /// public static FuelEfficiencyUnit BaseUnit { get; } = FuelEfficiencyUnit.LiterPer100Kilometers; /// - /// Represents the largest possible value of FuelEfficiency + /// Represents the largest possible value of /// - public static FuelEfficiency MaxValue { get; } = new FuelEfficiency(double.MaxValue, BaseUnit); + public static FuelEfficiency MaxValue { get; } = new FuelEfficiency(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of FuelEfficiency + /// Represents the smallest possible value of /// - public static FuelEfficiency MinValue { get; } = new FuelEfficiency(double.MinValue, BaseUnit); + public static FuelEfficiency MinValue { get; } = new FuelEfficiency(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -126,14 +126,14 @@ public FuelEfficiency(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.FuelEfficiency; /// - /// All units of measurement for the FuelEfficiency quantity. + /// All units of measurement for the quantity. /// public static FuelEfficiencyUnit[] Units { get; } = Enum.GetValues(typeof(FuelEfficiencyUnit)).Cast().Except(new FuelEfficiencyUnit[]{ FuelEfficiencyUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit LiterPer100Kilometers. /// - public static FuelEfficiency Zero { get; } = new FuelEfficiency(0, BaseUnit); + public static FuelEfficiency Zero { get; } = new FuelEfficiency(0, BaseUnit); #endregion @@ -158,34 +158,34 @@ public FuelEfficiency(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => FuelEfficiency.QuantityType; + public QuantityType Type => FuelEfficiency.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => FuelEfficiency.BaseDimensions; + public BaseDimensions Dimensions => FuelEfficiency.BaseDimensions; #endregion #region Conversion Properties /// - /// Get FuelEfficiency in KilometersPerLiters. + /// Get in KilometersPerLiters. /// public double KilometersPerLiters => As(FuelEfficiencyUnit.KilometerPerLiter); /// - /// Get FuelEfficiency in LitersPer100Kilometers. + /// Get in LitersPer100Kilometers. /// public double LitersPer100Kilometers => As(FuelEfficiencyUnit.LiterPer100Kilometers); /// - /// Get FuelEfficiency in MilesPerUkGallon. + /// Get in MilesPerUkGallon. /// public double MilesPerUkGallon => As(FuelEfficiencyUnit.MilePerUkGallon); /// - /// Get FuelEfficiency in MilesPerUsGallon. + /// Get in MilesPerUsGallon. /// public double MilesPerUsGallon => As(FuelEfficiencyUnit.MilePerUsGallon); @@ -219,51 +219,51 @@ public static string GetAbbreviation(FuelEfficiencyUnit unit, [CanBeNull] IForma #region Static Factory Methods /// - /// Get FuelEfficiency from KilometersPerLiters. + /// Get from KilometersPerLiters. /// /// If value is NaN or Infinity. - public static FuelEfficiency FromKilometersPerLiters(QuantityValue kilometersperliters) + public static FuelEfficiency FromKilometersPerLiters(QuantityValue kilometersperliters) { double value = (double) kilometersperliters; - return new FuelEfficiency(value, FuelEfficiencyUnit.KilometerPerLiter); + return new FuelEfficiency(value, FuelEfficiencyUnit.KilometerPerLiter); } /// - /// Get FuelEfficiency from LitersPer100Kilometers. + /// Get from LitersPer100Kilometers. /// /// If value is NaN or Infinity. - public static FuelEfficiency FromLitersPer100Kilometers(QuantityValue litersper100kilometers) + public static FuelEfficiency FromLitersPer100Kilometers(QuantityValue litersper100kilometers) { double value = (double) litersper100kilometers; - return new FuelEfficiency(value, FuelEfficiencyUnit.LiterPer100Kilometers); + return new FuelEfficiency(value, FuelEfficiencyUnit.LiterPer100Kilometers); } /// - /// Get FuelEfficiency from MilesPerUkGallon. + /// Get from MilesPerUkGallon. /// /// If value is NaN or Infinity. - public static FuelEfficiency FromMilesPerUkGallon(QuantityValue milesperukgallon) + public static FuelEfficiency FromMilesPerUkGallon(QuantityValue milesperukgallon) { double value = (double) milesperukgallon; - return new FuelEfficiency(value, FuelEfficiencyUnit.MilePerUkGallon); + return new FuelEfficiency(value, FuelEfficiencyUnit.MilePerUkGallon); } /// - /// Get FuelEfficiency from MilesPerUsGallon. + /// Get from MilesPerUsGallon. /// /// If value is NaN or Infinity. - public static FuelEfficiency FromMilesPerUsGallon(QuantityValue milesperusgallon) + public static FuelEfficiency FromMilesPerUsGallon(QuantityValue milesperusgallon) { double value = (double) milesperusgallon; - return new FuelEfficiency(value, FuelEfficiencyUnit.MilePerUsGallon); + return new FuelEfficiency(value, FuelEfficiencyUnit.MilePerUsGallon); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// FuelEfficiency unit value. - public static FuelEfficiency From(QuantityValue value, FuelEfficiencyUnit fromUnit) + /// unit value. + public static FuelEfficiency From(QuantityValue value, FuelEfficiencyUnit fromUnit) { - return new FuelEfficiency((double)value, fromUnit); + return new FuelEfficiency((double)value, fromUnit); } #endregion @@ -292,7 +292,7 @@ public static FuelEfficiency From(QuantityValue value, FuelEfficiencyUnit fromUn /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static FuelEfficiency Parse(string str) + public static FuelEfficiency Parse(string str) { return Parse(str, null); } @@ -320,9 +320,9 @@ public static FuelEfficiency Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static FuelEfficiency Parse(string str, [CanBeNull] IFormatProvider provider) + public static FuelEfficiency Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, FuelEfficiencyUnit>( str, provider, From); @@ -336,7 +336,7 @@ public static FuelEfficiency Parse(string str, [CanBeNull] IFormatProvider provi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out FuelEfficiency result) + public static bool TryParse([CanBeNull] string str, out FuelEfficiency result) { return TryParse(str, null, out result); } @@ -351,9 +351,9 @@ public static bool TryParse([CanBeNull] string str, out FuelEfficiency result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out FuelEfficiency result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out FuelEfficiency result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, FuelEfficiencyUnit>( str, provider, From, @@ -415,43 +415,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out FuelEf #region Arithmetic Operators /// Negate the value. - public static FuelEfficiency operator -(FuelEfficiency right) + public static FuelEfficiency operator -(FuelEfficiency right) { - return new FuelEfficiency(-right.Value, right.Unit); + return new FuelEfficiency(-right.Value, right.Unit); } - /// Get from adding two . - public static FuelEfficiency operator +(FuelEfficiency left, FuelEfficiency right) + /// Get from adding two . + public static FuelEfficiency operator +(FuelEfficiency left, FuelEfficiency right) { - return new FuelEfficiency(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new FuelEfficiency(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static FuelEfficiency operator -(FuelEfficiency left, FuelEfficiency right) + /// Get from subtracting two . + public static FuelEfficiency operator -(FuelEfficiency left, FuelEfficiency right) { - return new FuelEfficiency(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new FuelEfficiency(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static FuelEfficiency operator *(double left, FuelEfficiency right) + /// Get from multiplying value and . + public static FuelEfficiency operator *(double left, FuelEfficiency right) { - return new FuelEfficiency(left * right.Value, right.Unit); + return new FuelEfficiency(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static FuelEfficiency operator *(FuelEfficiency left, double right) + /// Get from multiplying value and . + public static FuelEfficiency operator *(FuelEfficiency left, double right) { - return new FuelEfficiency(left.Value * right, left.Unit); + return new FuelEfficiency(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static FuelEfficiency operator /(FuelEfficiency left, double right) + /// Get from dividing by value. + public static FuelEfficiency operator /(FuelEfficiency left, double right) { - return new FuelEfficiency(left.Value / right, left.Unit); + return new FuelEfficiency(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(FuelEfficiency left, FuelEfficiency right) + /// Get ratio value from dividing by . + public static double operator /(FuelEfficiency left, FuelEfficiency right) { return left.LitersPer100Kilometers / right.LitersPer100Kilometers; } @@ -461,39 +461,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out FuelEf #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(FuelEfficiency left, FuelEfficiency right) + public static bool operator <=(FuelEfficiency left, FuelEfficiency right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(FuelEfficiency left, FuelEfficiency right) + public static bool operator >=(FuelEfficiency left, FuelEfficiency right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(FuelEfficiency left, FuelEfficiency right) + public static bool operator <(FuelEfficiency left, FuelEfficiency right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(FuelEfficiency left, FuelEfficiency right) + public static bool operator >(FuelEfficiency left, FuelEfficiency right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(FuelEfficiency left, FuelEfficiency right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(FuelEfficiency left, FuelEfficiency right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(FuelEfficiency left, FuelEfficiency right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(FuelEfficiency left, FuelEfficiency right) { return !(left == right); } @@ -502,37 +502,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out FuelEf public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is FuelEfficiency objFuelEfficiency)) throw new ArgumentException("Expected type FuelEfficiency.", nameof(obj)); + if(!(obj is FuelEfficiency objFuelEfficiency)) throw new ArgumentException("Expected type FuelEfficiency.", nameof(obj)); return CompareTo(objFuelEfficiency); } /// - public int CompareTo(FuelEfficiency other) + public int CompareTo(FuelEfficiency other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is FuelEfficiency objFuelEfficiency)) + if(obj is null || !(obj is FuelEfficiency objFuelEfficiency)) return false; return Equals(objFuelEfficiency); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(FuelEfficiency other) + /// Consider using for safely comparing floating point values. + public bool Equals(FuelEfficiency other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another FuelEfficiency within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -570,7 +570,7 @@ public bool Equals(FuelEfficiency other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(FuelEfficiency other, double tolerance, ComparisonType comparisonType) + public bool Equals(FuelEfficiency other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -584,7 +584,7 @@ public bool Equals(FuelEfficiency other, double tolerance, ComparisonType compar /// /// Returns the hash code for this instance. /// - /// A hash code for the current FuelEfficiency. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -632,13 +632,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this FuelEfficiency to another FuelEfficiency with the unit representation . + /// Converts this to another with the unit representation . /// - /// A FuelEfficiency with the specified unit. - public FuelEfficiency ToUnit(FuelEfficiencyUnit unit) + /// A with the specified unit. + public FuelEfficiency ToUnit(FuelEfficiencyUnit unit) { var convertedValue = GetValueAs(unit); - return new FuelEfficiency(convertedValue, unit); + return new FuelEfficiency(convertedValue, unit); } /// @@ -651,7 +651,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public FuelEfficiency ToUnit(UnitSystem unitSystem) + public FuelEfficiency ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -697,10 +697,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal FuelEfficiency ToBaseUnit() + internal FuelEfficiency ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new FuelEfficiency(baseUnitValue, BaseUnit); + return new FuelEfficiency(baseUnitValue, BaseUnit); } private double GetValueAs(FuelEfficiencyUnit unit) @@ -812,7 +812,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(FuelEfficiency)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(FuelEfficiency)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -822,12 +822,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(FuelEfficiency)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(FuelEfficiency)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(FuelEfficiency)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(FuelEfficiency)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -872,16 +872,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(FuelEfficiency)) + if(conversionType == typeof(FuelEfficiency)) return this; else if(conversionType == typeof(FuelEfficiencyUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return FuelEfficiency.QuantityType; + return FuelEfficiency.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return FuelEfficiency.BaseDimensions; + return FuelEfficiency.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(FuelEfficiency)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(FuelEfficiency)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs index 4ec5cdac79..829f84addf 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Heat flux is the flow of energy per unit of area per unit of time /// - public partial struct HeatFlux : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct HeatFlux : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -117,19 +117,19 @@ public HeatFlux(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of HeatFlux, which is WattPerSquareMeter. All conversions go via this value. + /// The base unit of , which is WattPerSquareMeter. All conversions go via this value. /// public static HeatFluxUnit BaseUnit { get; } = HeatFluxUnit.WattPerSquareMeter; /// - /// Represents the largest possible value of HeatFlux + /// Represents the largest possible value of /// - public static HeatFlux MaxValue { get; } = new HeatFlux(double.MaxValue, BaseUnit); + public static HeatFlux MaxValue { get; } = new HeatFlux(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of HeatFlux + /// Represents the smallest possible value of /// - public static HeatFlux MinValue { get; } = new HeatFlux(double.MinValue, BaseUnit); + public static HeatFlux MinValue { get; } = new HeatFlux(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -137,14 +137,14 @@ public HeatFlux(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.HeatFlux; /// - /// All units of measurement for the HeatFlux quantity. + /// All units of measurement for the quantity. /// public static HeatFluxUnit[] Units { get; } = Enum.GetValues(typeof(HeatFluxUnit)).Cast().Except(new HeatFluxUnit[]{ HeatFluxUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeter. /// - public static HeatFlux Zero { get; } = new HeatFlux(0, BaseUnit); + public static HeatFlux Zero { get; } = new HeatFlux(0, BaseUnit); #endregion @@ -169,104 +169,104 @@ public HeatFlux(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => HeatFlux.QuantityType; + public QuantityType Type => HeatFlux.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => HeatFlux.BaseDimensions; + public BaseDimensions Dimensions => HeatFlux.BaseDimensions; #endregion #region Conversion Properties /// - /// Get HeatFlux in BtusPerHourSquareFoot. + /// Get in BtusPerHourSquareFoot. /// public double BtusPerHourSquareFoot => As(HeatFluxUnit.BtuPerHourSquareFoot); /// - /// Get HeatFlux in BtusPerMinuteSquareFoot. + /// Get in BtusPerMinuteSquareFoot. /// public double BtusPerMinuteSquareFoot => As(HeatFluxUnit.BtuPerMinuteSquareFoot); /// - /// Get HeatFlux in BtusPerSecondSquareFoot. + /// Get in BtusPerSecondSquareFoot. /// public double BtusPerSecondSquareFoot => As(HeatFluxUnit.BtuPerSecondSquareFoot); /// - /// Get HeatFlux in BtusPerSecondSquareInch. + /// Get in BtusPerSecondSquareInch. /// public double BtusPerSecondSquareInch => As(HeatFluxUnit.BtuPerSecondSquareInch); /// - /// Get HeatFlux in CaloriesPerSecondSquareCentimeter. + /// Get in CaloriesPerSecondSquareCentimeter. /// public double CaloriesPerSecondSquareCentimeter => As(HeatFluxUnit.CaloriePerSecondSquareCentimeter); /// - /// Get HeatFlux in CentiwattsPerSquareMeter. + /// Get in CentiwattsPerSquareMeter. /// public double CentiwattsPerSquareMeter => As(HeatFluxUnit.CentiwattPerSquareMeter); /// - /// Get HeatFlux in DeciwattsPerSquareMeter. + /// Get in DeciwattsPerSquareMeter. /// public double DeciwattsPerSquareMeter => As(HeatFluxUnit.DeciwattPerSquareMeter); /// - /// Get HeatFlux in KilocaloriesPerHourSquareMeter. + /// Get in KilocaloriesPerHourSquareMeter. /// public double KilocaloriesPerHourSquareMeter => As(HeatFluxUnit.KilocaloriePerHourSquareMeter); /// - /// Get HeatFlux in KilocaloriesPerSecondSquareCentimeter. + /// Get in KilocaloriesPerSecondSquareCentimeter. /// public double KilocaloriesPerSecondSquareCentimeter => As(HeatFluxUnit.KilocaloriePerSecondSquareCentimeter); /// - /// Get HeatFlux in KilowattsPerSquareMeter. + /// Get in KilowattsPerSquareMeter. /// public double KilowattsPerSquareMeter => As(HeatFluxUnit.KilowattPerSquareMeter); /// - /// Get HeatFlux in MicrowattsPerSquareMeter. + /// Get in MicrowattsPerSquareMeter. /// public double MicrowattsPerSquareMeter => As(HeatFluxUnit.MicrowattPerSquareMeter); /// - /// Get HeatFlux in MilliwattsPerSquareMeter. + /// Get in MilliwattsPerSquareMeter. /// public double MilliwattsPerSquareMeter => As(HeatFluxUnit.MilliwattPerSquareMeter); /// - /// Get HeatFlux in NanowattsPerSquareMeter. + /// Get in NanowattsPerSquareMeter. /// public double NanowattsPerSquareMeter => As(HeatFluxUnit.NanowattPerSquareMeter); /// - /// Get HeatFlux in PoundsForcePerFootSecond. + /// Get in PoundsForcePerFootSecond. /// public double PoundsForcePerFootSecond => As(HeatFluxUnit.PoundForcePerFootSecond); /// - /// Get HeatFlux in PoundsPerSecondCubed. + /// Get in PoundsPerSecondCubed. /// public double PoundsPerSecondCubed => As(HeatFluxUnit.PoundPerSecondCubed); /// - /// Get HeatFlux in WattsPerSquareFoot. + /// Get in WattsPerSquareFoot. /// public double WattsPerSquareFoot => As(HeatFluxUnit.WattPerSquareFoot); /// - /// Get HeatFlux in WattsPerSquareInch. + /// Get in WattsPerSquareInch. /// public double WattsPerSquareInch => As(HeatFluxUnit.WattPerSquareInch); /// - /// Get HeatFlux in WattsPerSquareMeter. + /// Get in WattsPerSquareMeter. /// public double WattsPerSquareMeter => As(HeatFluxUnit.WattPerSquareMeter); @@ -300,177 +300,177 @@ public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] IFormatProvi #region Static Factory Methods /// - /// Get HeatFlux from BtusPerHourSquareFoot. + /// Get from BtusPerHourSquareFoot. /// /// If value is NaN or Infinity. - public static HeatFlux FromBtusPerHourSquareFoot(QuantityValue btusperhoursquarefoot) + public static HeatFlux FromBtusPerHourSquareFoot(QuantityValue btusperhoursquarefoot) { double value = (double) btusperhoursquarefoot; - return new HeatFlux(value, HeatFluxUnit.BtuPerHourSquareFoot); + return new HeatFlux(value, HeatFluxUnit.BtuPerHourSquareFoot); } /// - /// Get HeatFlux from BtusPerMinuteSquareFoot. + /// Get from BtusPerMinuteSquareFoot. /// /// If value is NaN or Infinity. - public static HeatFlux FromBtusPerMinuteSquareFoot(QuantityValue btusperminutesquarefoot) + public static HeatFlux FromBtusPerMinuteSquareFoot(QuantityValue btusperminutesquarefoot) { double value = (double) btusperminutesquarefoot; - return new HeatFlux(value, HeatFluxUnit.BtuPerMinuteSquareFoot); + return new HeatFlux(value, HeatFluxUnit.BtuPerMinuteSquareFoot); } /// - /// Get HeatFlux from BtusPerSecondSquareFoot. + /// Get from BtusPerSecondSquareFoot. /// /// If value is NaN or Infinity. - public static HeatFlux FromBtusPerSecondSquareFoot(QuantityValue btuspersecondsquarefoot) + public static HeatFlux FromBtusPerSecondSquareFoot(QuantityValue btuspersecondsquarefoot) { double value = (double) btuspersecondsquarefoot; - return new HeatFlux(value, HeatFluxUnit.BtuPerSecondSquareFoot); + return new HeatFlux(value, HeatFluxUnit.BtuPerSecondSquareFoot); } /// - /// Get HeatFlux from BtusPerSecondSquareInch. + /// Get from BtusPerSecondSquareInch. /// /// If value is NaN or Infinity. - public static HeatFlux FromBtusPerSecondSquareInch(QuantityValue btuspersecondsquareinch) + public static HeatFlux FromBtusPerSecondSquareInch(QuantityValue btuspersecondsquareinch) { double value = (double) btuspersecondsquareinch; - return new HeatFlux(value, HeatFluxUnit.BtuPerSecondSquareInch); + return new HeatFlux(value, HeatFluxUnit.BtuPerSecondSquareInch); } /// - /// Get HeatFlux from CaloriesPerSecondSquareCentimeter. + /// Get from CaloriesPerSecondSquareCentimeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromCaloriesPerSecondSquareCentimeter(QuantityValue caloriespersecondsquarecentimeter) + public static HeatFlux FromCaloriesPerSecondSquareCentimeter(QuantityValue caloriespersecondsquarecentimeter) { double value = (double) caloriespersecondsquarecentimeter; - return new HeatFlux(value, HeatFluxUnit.CaloriePerSecondSquareCentimeter); + return new HeatFlux(value, HeatFluxUnit.CaloriePerSecondSquareCentimeter); } /// - /// Get HeatFlux from CentiwattsPerSquareMeter. + /// Get from CentiwattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromCentiwattsPerSquareMeter(QuantityValue centiwattspersquaremeter) + public static HeatFlux FromCentiwattsPerSquareMeter(QuantityValue centiwattspersquaremeter) { double value = (double) centiwattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.CentiwattPerSquareMeter); + return new HeatFlux(value, HeatFluxUnit.CentiwattPerSquareMeter); } /// - /// Get HeatFlux from DeciwattsPerSquareMeter. + /// Get from DeciwattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromDeciwattsPerSquareMeter(QuantityValue deciwattspersquaremeter) + public static HeatFlux FromDeciwattsPerSquareMeter(QuantityValue deciwattspersquaremeter) { double value = (double) deciwattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.DeciwattPerSquareMeter); + return new HeatFlux(value, HeatFluxUnit.DeciwattPerSquareMeter); } /// - /// Get HeatFlux from KilocaloriesPerHourSquareMeter. + /// Get from KilocaloriesPerHourSquareMeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromKilocaloriesPerHourSquareMeter(QuantityValue kilocaloriesperhoursquaremeter) + public static HeatFlux FromKilocaloriesPerHourSquareMeter(QuantityValue kilocaloriesperhoursquaremeter) { double value = (double) kilocaloriesperhoursquaremeter; - return new HeatFlux(value, HeatFluxUnit.KilocaloriePerHourSquareMeter); + return new HeatFlux(value, HeatFluxUnit.KilocaloriePerHourSquareMeter); } /// - /// Get HeatFlux from KilocaloriesPerSecondSquareCentimeter. + /// Get from KilocaloriesPerSecondSquareCentimeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromKilocaloriesPerSecondSquareCentimeter(QuantityValue kilocaloriespersecondsquarecentimeter) + public static HeatFlux FromKilocaloriesPerSecondSquareCentimeter(QuantityValue kilocaloriespersecondsquarecentimeter) { double value = (double) kilocaloriespersecondsquarecentimeter; - return new HeatFlux(value, HeatFluxUnit.KilocaloriePerSecondSquareCentimeter); + return new HeatFlux(value, HeatFluxUnit.KilocaloriePerSecondSquareCentimeter); } /// - /// Get HeatFlux from KilowattsPerSquareMeter. + /// Get from KilowattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromKilowattsPerSquareMeter(QuantityValue kilowattspersquaremeter) + public static HeatFlux FromKilowattsPerSquareMeter(QuantityValue kilowattspersquaremeter) { double value = (double) kilowattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.KilowattPerSquareMeter); + return new HeatFlux(value, HeatFluxUnit.KilowattPerSquareMeter); } /// - /// Get HeatFlux from MicrowattsPerSquareMeter. + /// Get from MicrowattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromMicrowattsPerSquareMeter(QuantityValue microwattspersquaremeter) + public static HeatFlux FromMicrowattsPerSquareMeter(QuantityValue microwattspersquaremeter) { double value = (double) microwattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.MicrowattPerSquareMeter); + return new HeatFlux(value, HeatFluxUnit.MicrowattPerSquareMeter); } /// - /// Get HeatFlux from MilliwattsPerSquareMeter. + /// Get from MilliwattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromMilliwattsPerSquareMeter(QuantityValue milliwattspersquaremeter) + public static HeatFlux FromMilliwattsPerSquareMeter(QuantityValue milliwattspersquaremeter) { double value = (double) milliwattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.MilliwattPerSquareMeter); + return new HeatFlux(value, HeatFluxUnit.MilliwattPerSquareMeter); } /// - /// Get HeatFlux from NanowattsPerSquareMeter. + /// Get from NanowattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromNanowattsPerSquareMeter(QuantityValue nanowattspersquaremeter) + public static HeatFlux FromNanowattsPerSquareMeter(QuantityValue nanowattspersquaremeter) { double value = (double) nanowattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.NanowattPerSquareMeter); + return new HeatFlux(value, HeatFluxUnit.NanowattPerSquareMeter); } /// - /// Get HeatFlux from PoundsForcePerFootSecond. + /// Get from PoundsForcePerFootSecond. /// /// If value is NaN or Infinity. - public static HeatFlux FromPoundsForcePerFootSecond(QuantityValue poundsforceperfootsecond) + public static HeatFlux FromPoundsForcePerFootSecond(QuantityValue poundsforceperfootsecond) { double value = (double) poundsforceperfootsecond; - return new HeatFlux(value, HeatFluxUnit.PoundForcePerFootSecond); + return new HeatFlux(value, HeatFluxUnit.PoundForcePerFootSecond); } /// - /// Get HeatFlux from PoundsPerSecondCubed. + /// Get from PoundsPerSecondCubed. /// /// If value is NaN or Infinity. - public static HeatFlux FromPoundsPerSecondCubed(QuantityValue poundspersecondcubed) + public static HeatFlux FromPoundsPerSecondCubed(QuantityValue poundspersecondcubed) { double value = (double) poundspersecondcubed; - return new HeatFlux(value, HeatFluxUnit.PoundPerSecondCubed); + return new HeatFlux(value, HeatFluxUnit.PoundPerSecondCubed); } /// - /// Get HeatFlux from WattsPerSquareFoot. + /// Get from WattsPerSquareFoot. /// /// If value is NaN or Infinity. - public static HeatFlux FromWattsPerSquareFoot(QuantityValue wattspersquarefoot) + public static HeatFlux FromWattsPerSquareFoot(QuantityValue wattspersquarefoot) { double value = (double) wattspersquarefoot; - return new HeatFlux(value, HeatFluxUnit.WattPerSquareFoot); + return new HeatFlux(value, HeatFluxUnit.WattPerSquareFoot); } /// - /// Get HeatFlux from WattsPerSquareInch. + /// Get from WattsPerSquareInch. /// /// If value is NaN or Infinity. - public static HeatFlux FromWattsPerSquareInch(QuantityValue wattspersquareinch) + public static HeatFlux FromWattsPerSquareInch(QuantityValue wattspersquareinch) { double value = (double) wattspersquareinch; - return new HeatFlux(value, HeatFluxUnit.WattPerSquareInch); + return new HeatFlux(value, HeatFluxUnit.WattPerSquareInch); } /// - /// Get HeatFlux from WattsPerSquareMeter. + /// Get from WattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromWattsPerSquareMeter(QuantityValue wattspersquaremeter) + public static HeatFlux FromWattsPerSquareMeter(QuantityValue wattspersquaremeter) { double value = (double) wattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.WattPerSquareMeter); + return new HeatFlux(value, HeatFluxUnit.WattPerSquareMeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// HeatFlux unit value. - public static HeatFlux From(QuantityValue value, HeatFluxUnit fromUnit) + /// unit value. + public static HeatFlux From(QuantityValue value, HeatFluxUnit fromUnit) { - return new HeatFlux((double)value, fromUnit); + return new HeatFlux((double)value, fromUnit); } #endregion @@ -499,7 +499,7 @@ public static HeatFlux From(QuantityValue value, HeatFluxUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static HeatFlux Parse(string str) + public static HeatFlux Parse(string str) { return Parse(str, null); } @@ -527,9 +527,9 @@ public static HeatFlux Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static HeatFlux Parse(string str, [CanBeNull] IFormatProvider provider) + public static HeatFlux Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, HeatFluxUnit>( str, provider, From); @@ -543,7 +543,7 @@ public static HeatFlux Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out HeatFlux result) + public static bool TryParse([CanBeNull] string str, out HeatFlux result) { return TryParse(str, null, out result); } @@ -558,9 +558,9 @@ public static bool TryParse([CanBeNull] string str, out HeatFlux result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatFlux result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatFlux result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, HeatFluxUnit>( str, provider, From, @@ -622,43 +622,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out HeatFl #region Arithmetic Operators /// Negate the value. - public static HeatFlux operator -(HeatFlux right) + public static HeatFlux operator -(HeatFlux right) { - return new HeatFlux(-right.Value, right.Unit); + return new HeatFlux(-right.Value, right.Unit); } - /// Get from adding two . - public static HeatFlux operator +(HeatFlux left, HeatFlux right) + /// Get from adding two . + public static HeatFlux operator +(HeatFlux left, HeatFlux right) { - return new HeatFlux(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new HeatFlux(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static HeatFlux operator -(HeatFlux left, HeatFlux right) + /// Get from subtracting two . + public static HeatFlux operator -(HeatFlux left, HeatFlux right) { - return new HeatFlux(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new HeatFlux(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static HeatFlux operator *(double left, HeatFlux right) + /// Get from multiplying value and . + public static HeatFlux operator *(double left, HeatFlux right) { - return new HeatFlux(left * right.Value, right.Unit); + return new HeatFlux(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static HeatFlux operator *(HeatFlux left, double right) + /// Get from multiplying value and . + public static HeatFlux operator *(HeatFlux left, double right) { - return new HeatFlux(left.Value * right, left.Unit); + return new HeatFlux(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static HeatFlux operator /(HeatFlux left, double right) + /// Get from dividing by value. + public static HeatFlux operator /(HeatFlux left, double right) { - return new HeatFlux(left.Value / right, left.Unit); + return new HeatFlux(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(HeatFlux left, HeatFlux right) + /// Get ratio value from dividing by . + public static double operator /(HeatFlux left, HeatFlux right) { return left.WattsPerSquareMeter / right.WattsPerSquareMeter; } @@ -668,39 +668,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out HeatFl #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(HeatFlux left, HeatFlux right) + public static bool operator <=(HeatFlux left, HeatFlux right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(HeatFlux left, HeatFlux right) + public static bool operator >=(HeatFlux left, HeatFlux right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(HeatFlux left, HeatFlux right) + public static bool operator <(HeatFlux left, HeatFlux right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(HeatFlux left, HeatFlux right) + public static bool operator >(HeatFlux left, HeatFlux right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(HeatFlux left, HeatFlux right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(HeatFlux left, HeatFlux right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(HeatFlux left, HeatFlux right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(HeatFlux left, HeatFlux right) { return !(left == right); } @@ -709,37 +709,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out HeatFl public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is HeatFlux objHeatFlux)) throw new ArgumentException("Expected type HeatFlux.", nameof(obj)); + if(!(obj is HeatFlux objHeatFlux)) throw new ArgumentException("Expected type HeatFlux.", nameof(obj)); return CompareTo(objHeatFlux); } /// - public int CompareTo(HeatFlux other) + public int CompareTo(HeatFlux other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is HeatFlux objHeatFlux)) + if(obj is null || !(obj is HeatFlux objHeatFlux)) return false; return Equals(objHeatFlux); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(HeatFlux other) + /// Consider using for safely comparing floating point values. + public bool Equals(HeatFlux other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another HeatFlux within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -777,7 +777,7 @@ public bool Equals(HeatFlux other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(HeatFlux other, double tolerance, ComparisonType comparisonType) + public bool Equals(HeatFlux other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -791,7 +791,7 @@ public bool Equals(HeatFlux other, double tolerance, ComparisonType comparisonTy /// /// Returns the hash code for this instance. /// - /// A hash code for the current HeatFlux. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -839,13 +839,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this HeatFlux to another HeatFlux with the unit representation . + /// Converts this to another with the unit representation . /// - /// A HeatFlux with the specified unit. - public HeatFlux ToUnit(HeatFluxUnit unit) + /// A with the specified unit. + public HeatFlux ToUnit(HeatFluxUnit unit) { var convertedValue = GetValueAs(unit); - return new HeatFlux(convertedValue, unit); + return new HeatFlux(convertedValue, unit); } /// @@ -858,7 +858,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public HeatFlux ToUnit(UnitSystem unitSystem) + public HeatFlux ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -918,10 +918,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal HeatFlux ToBaseUnit() + internal HeatFlux ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new HeatFlux(baseUnitValue, BaseUnit); + return new HeatFlux(baseUnitValue, BaseUnit); } private double GetValueAs(HeatFluxUnit unit) @@ -1047,7 +1047,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(HeatFlux)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(HeatFlux)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1057,12 +1057,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(HeatFlux)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(HeatFlux)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(HeatFlux)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(HeatFlux)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1107,16 +1107,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(HeatFlux)) + if(conversionType == typeof(HeatFlux)) return this; else if(conversionType == typeof(HeatFluxUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return HeatFlux.QuantityType; + return HeatFlux.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return HeatFlux.BaseDimensions; + return HeatFlux.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(HeatFlux)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(HeatFlux)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs index ebd5b931f1..bd7aeefba7 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// The heat transfer coefficient or film coefficient, or film effectiveness, in thermodynamics and in mechanics is the proportionality constant between the heat flux and the thermodynamic driving force for the flow of heat (i.e., the temperature difference, ΔT) /// - public partial struct HeatTransferCoefficient : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct HeatTransferCoefficient : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -102,19 +102,19 @@ public HeatTransferCoefficient(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of HeatTransferCoefficient, which is WattPerSquareMeterKelvin. All conversions go via this value. + /// The base unit of , which is WattPerSquareMeterKelvin. All conversions go via this value. /// public static HeatTransferCoefficientUnit BaseUnit { get; } = HeatTransferCoefficientUnit.WattPerSquareMeterKelvin; /// - /// Represents the largest possible value of HeatTransferCoefficient + /// Represents the largest possible value of /// - public static HeatTransferCoefficient MaxValue { get; } = new HeatTransferCoefficient(double.MaxValue, BaseUnit); + public static HeatTransferCoefficient MaxValue { get; } = new HeatTransferCoefficient(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of HeatTransferCoefficient + /// Represents the smallest possible value of /// - public static HeatTransferCoefficient MinValue { get; } = new HeatTransferCoefficient(double.MinValue, BaseUnit); + public static HeatTransferCoefficient MinValue { get; } = new HeatTransferCoefficient(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -122,14 +122,14 @@ public HeatTransferCoefficient(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.HeatTransferCoefficient; /// - /// All units of measurement for the HeatTransferCoefficient quantity. + /// All units of measurement for the quantity. /// public static HeatTransferCoefficientUnit[] Units { get; } = Enum.GetValues(typeof(HeatTransferCoefficientUnit)).Cast().Except(new HeatTransferCoefficientUnit[]{ HeatTransferCoefficientUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeterKelvin. /// - public static HeatTransferCoefficient Zero { get; } = new HeatTransferCoefficient(0, BaseUnit); + public static HeatTransferCoefficient Zero { get; } = new HeatTransferCoefficient(0, BaseUnit); #endregion @@ -154,29 +154,29 @@ public HeatTransferCoefficient(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => HeatTransferCoefficient.QuantityType; + public QuantityType Type => HeatTransferCoefficient.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => HeatTransferCoefficient.BaseDimensions; + public BaseDimensions Dimensions => HeatTransferCoefficient.BaseDimensions; #endregion #region Conversion Properties /// - /// Get HeatTransferCoefficient in BtusPerSquareFootDegreeFahrenheit. + /// Get in BtusPerSquareFootDegreeFahrenheit. /// public double BtusPerSquareFootDegreeFahrenheit => As(HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit); /// - /// Get HeatTransferCoefficient in WattsPerSquareMeterCelsius. + /// Get in WattsPerSquareMeterCelsius. /// public double WattsPerSquareMeterCelsius => As(HeatTransferCoefficientUnit.WattPerSquareMeterCelsius); /// - /// Get HeatTransferCoefficient in WattsPerSquareMeterKelvin. + /// Get in WattsPerSquareMeterKelvin. /// public double WattsPerSquareMeterKelvin => As(HeatTransferCoefficientUnit.WattPerSquareMeterKelvin); @@ -210,42 +210,42 @@ public static string GetAbbreviation(HeatTransferCoefficientUnit unit, [CanBeNul #region Static Factory Methods /// - /// Get HeatTransferCoefficient from BtusPerSquareFootDegreeFahrenheit. + /// Get from BtusPerSquareFootDegreeFahrenheit. /// /// If value is NaN or Infinity. - public static HeatTransferCoefficient FromBtusPerSquareFootDegreeFahrenheit(QuantityValue btuspersquarefootdegreefahrenheit) + public static HeatTransferCoefficient FromBtusPerSquareFootDegreeFahrenheit(QuantityValue btuspersquarefootdegreefahrenheit) { double value = (double) btuspersquarefootdegreefahrenheit; - return new HeatTransferCoefficient(value, HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit); + return new HeatTransferCoefficient(value, HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit); } /// - /// Get HeatTransferCoefficient from WattsPerSquareMeterCelsius. + /// Get from WattsPerSquareMeterCelsius. /// /// If value is NaN or Infinity. - public static HeatTransferCoefficient FromWattsPerSquareMeterCelsius(QuantityValue wattspersquaremetercelsius) + public static HeatTransferCoefficient FromWattsPerSquareMeterCelsius(QuantityValue wattspersquaremetercelsius) { double value = (double) wattspersquaremetercelsius; - return new HeatTransferCoefficient(value, HeatTransferCoefficientUnit.WattPerSquareMeterCelsius); + return new HeatTransferCoefficient(value, HeatTransferCoefficientUnit.WattPerSquareMeterCelsius); } /// - /// Get HeatTransferCoefficient from WattsPerSquareMeterKelvin. + /// Get from WattsPerSquareMeterKelvin. /// /// If value is NaN or Infinity. - public static HeatTransferCoefficient FromWattsPerSquareMeterKelvin(QuantityValue wattspersquaremeterkelvin) + public static HeatTransferCoefficient FromWattsPerSquareMeterKelvin(QuantityValue wattspersquaremeterkelvin) { double value = (double) wattspersquaremeterkelvin; - return new HeatTransferCoefficient(value, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin); + return new HeatTransferCoefficient(value, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// HeatTransferCoefficient unit value. - public static HeatTransferCoefficient From(QuantityValue value, HeatTransferCoefficientUnit fromUnit) + /// unit value. + public static HeatTransferCoefficient From(QuantityValue value, HeatTransferCoefficientUnit fromUnit) { - return new HeatTransferCoefficient((double)value, fromUnit); + return new HeatTransferCoefficient((double)value, fromUnit); } #endregion @@ -274,7 +274,7 @@ public static HeatTransferCoefficient From(QuantityValue value, HeatTransferCoef /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static HeatTransferCoefficient Parse(string str) + public static HeatTransferCoefficient Parse(string str) { return Parse(str, null); } @@ -302,9 +302,9 @@ public static HeatTransferCoefficient Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static HeatTransferCoefficient Parse(string str, [CanBeNull] IFormatProvider provider) + public static HeatTransferCoefficient Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, HeatTransferCoefficientUnit>( str, provider, From); @@ -318,7 +318,7 @@ public static HeatTransferCoefficient Parse(string str, [CanBeNull] IFormatProvi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out HeatTransferCoefficient result) + public static bool TryParse([CanBeNull] string str, out HeatTransferCoefficient result) { return TryParse(str, null, out result); } @@ -333,9 +333,9 @@ public static bool TryParse([CanBeNull] string str, out HeatTransferCoefficient /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatTransferCoefficient result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatTransferCoefficient result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, HeatTransferCoefficientUnit>( str, provider, From, @@ -397,43 +397,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out HeatTr #region Arithmetic Operators /// Negate the value. - public static HeatTransferCoefficient operator -(HeatTransferCoefficient right) + public static HeatTransferCoefficient operator -(HeatTransferCoefficient right) { - return new HeatTransferCoefficient(-right.Value, right.Unit); + return new HeatTransferCoefficient(-right.Value, right.Unit); } - /// Get from adding two . - public static HeatTransferCoefficient operator +(HeatTransferCoefficient left, HeatTransferCoefficient right) + /// Get from adding two . + public static HeatTransferCoefficient operator +(HeatTransferCoefficient left, HeatTransferCoefficient right) { - return new HeatTransferCoefficient(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new HeatTransferCoefficient(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static HeatTransferCoefficient operator -(HeatTransferCoefficient left, HeatTransferCoefficient right) + /// Get from subtracting two . + public static HeatTransferCoefficient operator -(HeatTransferCoefficient left, HeatTransferCoefficient right) { - return new HeatTransferCoefficient(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new HeatTransferCoefficient(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static HeatTransferCoefficient operator *(double left, HeatTransferCoefficient right) + /// Get from multiplying value and . + public static HeatTransferCoefficient operator *(double left, HeatTransferCoefficient right) { - return new HeatTransferCoefficient(left * right.Value, right.Unit); + return new HeatTransferCoefficient(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static HeatTransferCoefficient operator *(HeatTransferCoefficient left, double right) + /// Get from multiplying value and . + public static HeatTransferCoefficient operator *(HeatTransferCoefficient left, double right) { - return new HeatTransferCoefficient(left.Value * right, left.Unit); + return new HeatTransferCoefficient(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static HeatTransferCoefficient operator /(HeatTransferCoefficient left, double right) + /// Get from dividing by value. + public static HeatTransferCoefficient operator /(HeatTransferCoefficient left, double right) { - return new HeatTransferCoefficient(left.Value / right, left.Unit); + return new HeatTransferCoefficient(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(HeatTransferCoefficient left, HeatTransferCoefficient right) + /// Get ratio value from dividing by . + public static double operator /(HeatTransferCoefficient left, HeatTransferCoefficient right) { return left.WattsPerSquareMeterKelvin / right.WattsPerSquareMeterKelvin; } @@ -443,39 +443,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out HeatTr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(HeatTransferCoefficient left, HeatTransferCoefficient right) + public static bool operator <=(HeatTransferCoefficient left, HeatTransferCoefficient right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(HeatTransferCoefficient left, HeatTransferCoefficient right) + public static bool operator >=(HeatTransferCoefficient left, HeatTransferCoefficient right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(HeatTransferCoefficient left, HeatTransferCoefficient right) + public static bool operator <(HeatTransferCoefficient left, HeatTransferCoefficient right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(HeatTransferCoefficient left, HeatTransferCoefficient right) + public static bool operator >(HeatTransferCoefficient left, HeatTransferCoefficient right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(HeatTransferCoefficient left, HeatTransferCoefficient right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(HeatTransferCoefficient left, HeatTransferCoefficient right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(HeatTransferCoefficient left, HeatTransferCoefficient right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(HeatTransferCoefficient left, HeatTransferCoefficient right) { return !(left == right); } @@ -484,37 +484,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out HeatTr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is HeatTransferCoefficient objHeatTransferCoefficient)) throw new ArgumentException("Expected type HeatTransferCoefficient.", nameof(obj)); + if(!(obj is HeatTransferCoefficient objHeatTransferCoefficient)) throw new ArgumentException("Expected type HeatTransferCoefficient.", nameof(obj)); return CompareTo(objHeatTransferCoefficient); } /// - public int CompareTo(HeatTransferCoefficient other) + public int CompareTo(HeatTransferCoefficient other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is HeatTransferCoefficient objHeatTransferCoefficient)) + if(obj is null || !(obj is HeatTransferCoefficient objHeatTransferCoefficient)) return false; return Equals(objHeatTransferCoefficient); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(HeatTransferCoefficient other) + /// Consider using for safely comparing floating point values. + public bool Equals(HeatTransferCoefficient other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another HeatTransferCoefficient within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -552,7 +552,7 @@ public bool Equals(HeatTransferCoefficient other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(HeatTransferCoefficient other, double tolerance, ComparisonType comparisonType) + public bool Equals(HeatTransferCoefficient other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -566,7 +566,7 @@ public bool Equals(HeatTransferCoefficient other, double tolerance, ComparisonTy /// /// Returns the hash code for this instance. /// - /// A hash code for the current HeatTransferCoefficient. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -614,13 +614,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this HeatTransferCoefficient to another HeatTransferCoefficient with the unit representation . + /// Converts this to another with the unit representation . /// - /// A HeatTransferCoefficient with the specified unit. - public HeatTransferCoefficient ToUnit(HeatTransferCoefficientUnit unit) + /// A with the specified unit. + public HeatTransferCoefficient ToUnit(HeatTransferCoefficientUnit unit) { var convertedValue = GetValueAs(unit); - return new HeatTransferCoefficient(convertedValue, unit); + return new HeatTransferCoefficient(convertedValue, unit); } /// @@ -633,7 +633,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public HeatTransferCoefficient ToUnit(UnitSystem unitSystem) + public HeatTransferCoefficient ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -678,10 +678,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal HeatTransferCoefficient ToBaseUnit() + internal HeatTransferCoefficient ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new HeatTransferCoefficient(baseUnitValue, BaseUnit); + return new HeatTransferCoefficient(baseUnitValue, BaseUnit); } private double GetValueAs(HeatTransferCoefficientUnit unit) @@ -792,7 +792,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -802,12 +802,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -852,16 +852,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(HeatTransferCoefficient)) + if(conversionType == typeof(HeatTransferCoefficient)) return this; else if(conversionType == typeof(HeatTransferCoefficientUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return HeatTransferCoefficient.QuantityType; + return HeatTransferCoefficient.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return HeatTransferCoefficient.BaseDimensions; + return HeatTransferCoefficient.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs index f07f5051ba..e05c60e5c9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Illuminance /// - public partial struct Illuminance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Illuminance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -106,19 +106,19 @@ public Illuminance(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Illuminance, which is Lux. All conversions go via this value. + /// The base unit of , which is Lux. All conversions go via this value. /// public static IlluminanceUnit BaseUnit { get; } = IlluminanceUnit.Lux; /// - /// Represents the largest possible value of Illuminance + /// Represents the largest possible value of /// - public static Illuminance MaxValue { get; } = new Illuminance(double.MaxValue, BaseUnit); + public static Illuminance MaxValue { get; } = new Illuminance(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Illuminance + /// Represents the smallest possible value of /// - public static Illuminance MinValue { get; } = new Illuminance(double.MinValue, BaseUnit); + public static Illuminance MinValue { get; } = new Illuminance(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -126,14 +126,14 @@ public Illuminance(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Illuminance; /// - /// All units of measurement for the Illuminance quantity. + /// All units of measurement for the quantity. /// public static IlluminanceUnit[] Units { get; } = Enum.GetValues(typeof(IlluminanceUnit)).Cast().Except(new IlluminanceUnit[]{ IlluminanceUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Lux. /// - public static Illuminance Zero { get; } = new Illuminance(0, BaseUnit); + public static Illuminance Zero { get; } = new Illuminance(0, BaseUnit); #endregion @@ -158,34 +158,34 @@ public Illuminance(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Illuminance.QuantityType; + public QuantityType Type => Illuminance.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Illuminance.BaseDimensions; + public BaseDimensions Dimensions => Illuminance.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Illuminance in Kilolux. + /// Get in Kilolux. /// public double Kilolux => As(IlluminanceUnit.Kilolux); /// - /// Get Illuminance in Lux. + /// Get in Lux. /// public double Lux => As(IlluminanceUnit.Lux); /// - /// Get Illuminance in Megalux. + /// Get in Megalux. /// public double Megalux => As(IlluminanceUnit.Megalux); /// - /// Get Illuminance in Millilux. + /// Get in Millilux. /// public double Millilux => As(IlluminanceUnit.Millilux); @@ -219,51 +219,51 @@ public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] IFormatPr #region Static Factory Methods /// - /// Get Illuminance from Kilolux. + /// Get from Kilolux. /// /// If value is NaN or Infinity. - public static Illuminance FromKilolux(QuantityValue kilolux) + public static Illuminance FromKilolux(QuantityValue kilolux) { double value = (double) kilolux; - return new Illuminance(value, IlluminanceUnit.Kilolux); + return new Illuminance(value, IlluminanceUnit.Kilolux); } /// - /// Get Illuminance from Lux. + /// Get from Lux. /// /// If value is NaN or Infinity. - public static Illuminance FromLux(QuantityValue lux) + public static Illuminance FromLux(QuantityValue lux) { double value = (double) lux; - return new Illuminance(value, IlluminanceUnit.Lux); + return new Illuminance(value, IlluminanceUnit.Lux); } /// - /// Get Illuminance from Megalux. + /// Get from Megalux. /// /// If value is NaN or Infinity. - public static Illuminance FromMegalux(QuantityValue megalux) + public static Illuminance FromMegalux(QuantityValue megalux) { double value = (double) megalux; - return new Illuminance(value, IlluminanceUnit.Megalux); + return new Illuminance(value, IlluminanceUnit.Megalux); } /// - /// Get Illuminance from Millilux. + /// Get from Millilux. /// /// If value is NaN or Infinity. - public static Illuminance FromMillilux(QuantityValue millilux) + public static Illuminance FromMillilux(QuantityValue millilux) { double value = (double) millilux; - return new Illuminance(value, IlluminanceUnit.Millilux); + return new Illuminance(value, IlluminanceUnit.Millilux); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Illuminance unit value. - public static Illuminance From(QuantityValue value, IlluminanceUnit fromUnit) + /// unit value. + public static Illuminance From(QuantityValue value, IlluminanceUnit fromUnit) { - return new Illuminance((double)value, fromUnit); + return new Illuminance((double)value, fromUnit); } #endregion @@ -292,7 +292,7 @@ public static Illuminance From(QuantityValue value, IlluminanceUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Illuminance Parse(string str) + public static Illuminance Parse(string str) { return Parse(str, null); } @@ -320,9 +320,9 @@ public static Illuminance Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Illuminance Parse(string str, [CanBeNull] IFormatProvider provider) + public static Illuminance Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, IlluminanceUnit>( str, provider, From); @@ -336,7 +336,7 @@ public static Illuminance Parse(string str, [CanBeNull] IFormatProvider provider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Illuminance result) + public static bool TryParse([CanBeNull] string str, out Illuminance result) { return TryParse(str, null, out result); } @@ -351,9 +351,9 @@ public static bool TryParse([CanBeNull] string str, out Illuminance result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Illuminance result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Illuminance result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, IlluminanceUnit>( str, provider, From, @@ -415,43 +415,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Illumi #region Arithmetic Operators /// Negate the value. - public static Illuminance operator -(Illuminance right) + public static Illuminance operator -(Illuminance right) { - return new Illuminance(-right.Value, right.Unit); + return new Illuminance(-right.Value, right.Unit); } - /// Get from adding two . - public static Illuminance operator +(Illuminance left, Illuminance right) + /// Get from adding two . + public static Illuminance operator +(Illuminance left, Illuminance right) { - return new Illuminance(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Illuminance(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Illuminance operator -(Illuminance left, Illuminance right) + /// Get from subtracting two . + public static Illuminance operator -(Illuminance left, Illuminance right) { - return new Illuminance(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Illuminance(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Illuminance operator *(double left, Illuminance right) + /// Get from multiplying value and . + public static Illuminance operator *(double left, Illuminance right) { - return new Illuminance(left * right.Value, right.Unit); + return new Illuminance(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Illuminance operator *(Illuminance left, double right) + /// Get from multiplying value and . + public static Illuminance operator *(Illuminance left, double right) { - return new Illuminance(left.Value * right, left.Unit); + return new Illuminance(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Illuminance operator /(Illuminance left, double right) + /// Get from dividing by value. + public static Illuminance operator /(Illuminance left, double right) { - return new Illuminance(left.Value / right, left.Unit); + return new Illuminance(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Illuminance left, Illuminance right) + /// Get ratio value from dividing by . + public static double operator /(Illuminance left, Illuminance right) { return left.Lux / right.Lux; } @@ -461,39 +461,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Illumi #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Illuminance left, Illuminance right) + public static bool operator <=(Illuminance left, Illuminance right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Illuminance left, Illuminance right) + public static bool operator >=(Illuminance left, Illuminance right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Illuminance left, Illuminance right) + public static bool operator <(Illuminance left, Illuminance right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Illuminance left, Illuminance right) + public static bool operator >(Illuminance left, Illuminance right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Illuminance left, Illuminance right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Illuminance left, Illuminance right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Illuminance left, Illuminance right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Illuminance left, Illuminance right) { return !(left == right); } @@ -502,37 +502,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Illumi public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Illuminance objIlluminance)) throw new ArgumentException("Expected type Illuminance.", nameof(obj)); + if(!(obj is Illuminance objIlluminance)) throw new ArgumentException("Expected type Illuminance.", nameof(obj)); return CompareTo(objIlluminance); } /// - public int CompareTo(Illuminance other) + public int CompareTo(Illuminance other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Illuminance objIlluminance)) + if(obj is null || !(obj is Illuminance objIlluminance)) return false; return Equals(objIlluminance); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Illuminance other) + /// Consider using for safely comparing floating point values. + public bool Equals(Illuminance other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Illuminance within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -570,7 +570,7 @@ public bool Equals(Illuminance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Illuminance other, double tolerance, ComparisonType comparisonType) + public bool Equals(Illuminance other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -584,7 +584,7 @@ public bool Equals(Illuminance other, double tolerance, ComparisonType compariso /// /// Returns the hash code for this instance. /// - /// A hash code for the current Illuminance. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -632,13 +632,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Illuminance to another Illuminance with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Illuminance with the specified unit. - public Illuminance ToUnit(IlluminanceUnit unit) + /// A with the specified unit. + public Illuminance ToUnit(IlluminanceUnit unit) { var convertedValue = GetValueAs(unit); - return new Illuminance(convertedValue, unit); + return new Illuminance(convertedValue, unit); } /// @@ -651,7 +651,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Illuminance ToUnit(UnitSystem unitSystem) + public Illuminance ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -697,10 +697,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Illuminance ToBaseUnit() + internal Illuminance ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Illuminance(baseUnitValue, BaseUnit); + return new Illuminance(baseUnitValue, BaseUnit); } private double GetValueAs(IlluminanceUnit unit) @@ -812,7 +812,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Illuminance)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Illuminance)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -822,12 +822,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Illuminance)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Illuminance)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Illuminance)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Illuminance)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -872,16 +872,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Illuminance)) + if(conversionType == typeof(Illuminance)) return this; else if(conversionType == typeof(IlluminanceUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Illuminance.QuantityType; + return Illuminance.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Illuminance.BaseDimensions; + return Illuminance.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Illuminance)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Illuminance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Information.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.g.cs index 88e5dea32a..7aaf9017ad 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// In computing and telecommunications, a unit of information is the capacity of some standard data storage system or communication channel, used to measure the capacities of other systems and channels. In information theory, units of information are also used to measure the information contents or entropy of random variables. /// - public partial struct Information : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Information : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -125,19 +125,19 @@ public Information(decimal value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Information, which is Bit. All conversions go via this value. + /// The base unit of , which is Bit. All conversions go via this value. /// public static InformationUnit BaseUnit { get; } = InformationUnit.Bit; /// - /// Represents the largest possible value of Information + /// Represents the largest possible value of /// - public static Information MaxValue { get; } = new Information(decimal.MaxValue, BaseUnit); + public static Information MaxValue { get; } = new Information(decimal.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Information + /// Represents the smallest possible value of /// - public static Information MinValue { get; } = new Information(decimal.MinValue, BaseUnit); + public static Information MinValue { get; } = new Information(decimal.MinValue, BaseUnit); /// /// The of this quantity. @@ -145,14 +145,14 @@ public Information(decimal value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Information; /// - /// All units of measurement for the Information quantity. + /// All units of measurement for the quantity. /// public static InformationUnit[] Units { get; } = Enum.GetValues(typeof(InformationUnit)).Cast().Except(new InformationUnit[]{ InformationUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Bit. /// - public static Information Zero { get; } = new Information(0, BaseUnit); + public static Information Zero { get; } = new Information(0, BaseUnit); #endregion @@ -179,144 +179,144 @@ public Information(decimal value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Information.QuantityType; + public QuantityType Type => Information.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Information.BaseDimensions; + public BaseDimensions Dimensions => Information.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Information in Bits. + /// Get in Bits. /// public double Bits => As(InformationUnit.Bit); /// - /// Get Information in Bytes. + /// Get in Bytes. /// public double Bytes => As(InformationUnit.Byte); /// - /// Get Information in Exabits. + /// Get in Exabits. /// public double Exabits => As(InformationUnit.Exabit); /// - /// Get Information in Exabytes. + /// Get in Exabytes. /// public double Exabytes => As(InformationUnit.Exabyte); /// - /// Get Information in Exbibits. + /// Get in Exbibits. /// public double Exbibits => As(InformationUnit.Exbibit); /// - /// Get Information in Exbibytes. + /// Get in Exbibytes. /// public double Exbibytes => As(InformationUnit.Exbibyte); /// - /// Get Information in Gibibits. + /// Get in Gibibits. /// public double Gibibits => As(InformationUnit.Gibibit); /// - /// Get Information in Gibibytes. + /// Get in Gibibytes. /// public double Gibibytes => As(InformationUnit.Gibibyte); /// - /// Get Information in Gigabits. + /// Get in Gigabits. /// public double Gigabits => As(InformationUnit.Gigabit); /// - /// Get Information in Gigabytes. + /// Get in Gigabytes. /// public double Gigabytes => As(InformationUnit.Gigabyte); /// - /// Get Information in Kibibits. + /// Get in Kibibits. /// public double Kibibits => As(InformationUnit.Kibibit); /// - /// Get Information in Kibibytes. + /// Get in Kibibytes. /// public double Kibibytes => As(InformationUnit.Kibibyte); /// - /// Get Information in Kilobits. + /// Get in Kilobits. /// public double Kilobits => As(InformationUnit.Kilobit); /// - /// Get Information in Kilobytes. + /// Get in Kilobytes. /// public double Kilobytes => As(InformationUnit.Kilobyte); /// - /// Get Information in Mebibits. + /// Get in Mebibits. /// public double Mebibits => As(InformationUnit.Mebibit); /// - /// Get Information in Mebibytes. + /// Get in Mebibytes. /// public double Mebibytes => As(InformationUnit.Mebibyte); /// - /// Get Information in Megabits. + /// Get in Megabits. /// public double Megabits => As(InformationUnit.Megabit); /// - /// Get Information in Megabytes. + /// Get in Megabytes. /// public double Megabytes => As(InformationUnit.Megabyte); /// - /// Get Information in Pebibits. + /// Get in Pebibits. /// public double Pebibits => As(InformationUnit.Pebibit); /// - /// Get Information in Pebibytes. + /// Get in Pebibytes. /// public double Pebibytes => As(InformationUnit.Pebibyte); /// - /// Get Information in Petabits. + /// Get in Petabits. /// public double Petabits => As(InformationUnit.Petabit); /// - /// Get Information in Petabytes. + /// Get in Petabytes. /// public double Petabytes => As(InformationUnit.Petabyte); /// - /// Get Information in Tebibits. + /// Get in Tebibits. /// public double Tebibits => As(InformationUnit.Tebibit); /// - /// Get Information in Tebibytes. + /// Get in Tebibytes. /// public double Tebibytes => As(InformationUnit.Tebibyte); /// - /// Get Information in Terabits. + /// Get in Terabits. /// public double Terabits => As(InformationUnit.Terabit); /// - /// Get Information in Terabytes. + /// Get in Terabytes. /// public double Terabytes => As(InformationUnit.Terabyte); @@ -350,249 +350,249 @@ public static string GetAbbreviation(InformationUnit unit, [CanBeNull] IFormatPr #region Static Factory Methods /// - /// Get Information from Bits. + /// Get from Bits. /// /// If value is NaN or Infinity. - public static Information FromBits(QuantityValue bits) + public static Information FromBits(QuantityValue bits) { decimal value = (decimal) bits; - return new Information(value, InformationUnit.Bit); + return new Information(value, InformationUnit.Bit); } /// - /// Get Information from Bytes. + /// Get from Bytes. /// /// If value is NaN or Infinity. - public static Information FromBytes(QuantityValue bytes) + public static Information FromBytes(QuantityValue bytes) { decimal value = (decimal) bytes; - return new Information(value, InformationUnit.Byte); + return new Information(value, InformationUnit.Byte); } /// - /// Get Information from Exabits. + /// Get from Exabits. /// /// If value is NaN or Infinity. - public static Information FromExabits(QuantityValue exabits) + public static Information FromExabits(QuantityValue exabits) { decimal value = (decimal) exabits; - return new Information(value, InformationUnit.Exabit); + return new Information(value, InformationUnit.Exabit); } /// - /// Get Information from Exabytes. + /// Get from Exabytes. /// /// If value is NaN or Infinity. - public static Information FromExabytes(QuantityValue exabytes) + public static Information FromExabytes(QuantityValue exabytes) { decimal value = (decimal) exabytes; - return new Information(value, InformationUnit.Exabyte); + return new Information(value, InformationUnit.Exabyte); } /// - /// Get Information from Exbibits. + /// Get from Exbibits. /// /// If value is NaN or Infinity. - public static Information FromExbibits(QuantityValue exbibits) + public static Information FromExbibits(QuantityValue exbibits) { decimal value = (decimal) exbibits; - return new Information(value, InformationUnit.Exbibit); + return new Information(value, InformationUnit.Exbibit); } /// - /// Get Information from Exbibytes. + /// Get from Exbibytes. /// /// If value is NaN or Infinity. - public static Information FromExbibytes(QuantityValue exbibytes) + public static Information FromExbibytes(QuantityValue exbibytes) { decimal value = (decimal) exbibytes; - return new Information(value, InformationUnit.Exbibyte); + return new Information(value, InformationUnit.Exbibyte); } /// - /// Get Information from Gibibits. + /// Get from Gibibits. /// /// If value is NaN or Infinity. - public static Information FromGibibits(QuantityValue gibibits) + public static Information FromGibibits(QuantityValue gibibits) { decimal value = (decimal) gibibits; - return new Information(value, InformationUnit.Gibibit); + return new Information(value, InformationUnit.Gibibit); } /// - /// Get Information from Gibibytes. + /// Get from Gibibytes. /// /// If value is NaN or Infinity. - public static Information FromGibibytes(QuantityValue gibibytes) + public static Information FromGibibytes(QuantityValue gibibytes) { decimal value = (decimal) gibibytes; - return new Information(value, InformationUnit.Gibibyte); + return new Information(value, InformationUnit.Gibibyte); } /// - /// Get Information from Gigabits. + /// Get from Gigabits. /// /// If value is NaN or Infinity. - public static Information FromGigabits(QuantityValue gigabits) + public static Information FromGigabits(QuantityValue gigabits) { decimal value = (decimal) gigabits; - return new Information(value, InformationUnit.Gigabit); + return new Information(value, InformationUnit.Gigabit); } /// - /// Get Information from Gigabytes. + /// Get from Gigabytes. /// /// If value is NaN or Infinity. - public static Information FromGigabytes(QuantityValue gigabytes) + public static Information FromGigabytes(QuantityValue gigabytes) { decimal value = (decimal) gigabytes; - return new Information(value, InformationUnit.Gigabyte); + return new Information(value, InformationUnit.Gigabyte); } /// - /// Get Information from Kibibits. + /// Get from Kibibits. /// /// If value is NaN or Infinity. - public static Information FromKibibits(QuantityValue kibibits) + public static Information FromKibibits(QuantityValue kibibits) { decimal value = (decimal) kibibits; - return new Information(value, InformationUnit.Kibibit); + return new Information(value, InformationUnit.Kibibit); } /// - /// Get Information from Kibibytes. + /// Get from Kibibytes. /// /// If value is NaN or Infinity. - public static Information FromKibibytes(QuantityValue kibibytes) + public static Information FromKibibytes(QuantityValue kibibytes) { decimal value = (decimal) kibibytes; - return new Information(value, InformationUnit.Kibibyte); + return new Information(value, InformationUnit.Kibibyte); } /// - /// Get Information from Kilobits. + /// Get from Kilobits. /// /// If value is NaN or Infinity. - public static Information FromKilobits(QuantityValue kilobits) + public static Information FromKilobits(QuantityValue kilobits) { decimal value = (decimal) kilobits; - return new Information(value, InformationUnit.Kilobit); + return new Information(value, InformationUnit.Kilobit); } /// - /// Get Information from Kilobytes. + /// Get from Kilobytes. /// /// If value is NaN or Infinity. - public static Information FromKilobytes(QuantityValue kilobytes) + public static Information FromKilobytes(QuantityValue kilobytes) { decimal value = (decimal) kilobytes; - return new Information(value, InformationUnit.Kilobyte); + return new Information(value, InformationUnit.Kilobyte); } /// - /// Get Information from Mebibits. + /// Get from Mebibits. /// /// If value is NaN or Infinity. - public static Information FromMebibits(QuantityValue mebibits) + public static Information FromMebibits(QuantityValue mebibits) { decimal value = (decimal) mebibits; - return new Information(value, InformationUnit.Mebibit); + return new Information(value, InformationUnit.Mebibit); } /// - /// Get Information from Mebibytes. + /// Get from Mebibytes. /// /// If value is NaN or Infinity. - public static Information FromMebibytes(QuantityValue mebibytes) + public static Information FromMebibytes(QuantityValue mebibytes) { decimal value = (decimal) mebibytes; - return new Information(value, InformationUnit.Mebibyte); + return new Information(value, InformationUnit.Mebibyte); } /// - /// Get Information from Megabits. + /// Get from Megabits. /// /// If value is NaN or Infinity. - public static Information FromMegabits(QuantityValue megabits) + public static Information FromMegabits(QuantityValue megabits) { decimal value = (decimal) megabits; - return new Information(value, InformationUnit.Megabit); + return new Information(value, InformationUnit.Megabit); } /// - /// Get Information from Megabytes. + /// Get from Megabytes. /// /// If value is NaN or Infinity. - public static Information FromMegabytes(QuantityValue megabytes) + public static Information FromMegabytes(QuantityValue megabytes) { decimal value = (decimal) megabytes; - return new Information(value, InformationUnit.Megabyte); + return new Information(value, InformationUnit.Megabyte); } /// - /// Get Information from Pebibits. + /// Get from Pebibits. /// /// If value is NaN or Infinity. - public static Information FromPebibits(QuantityValue pebibits) + public static Information FromPebibits(QuantityValue pebibits) { decimal value = (decimal) pebibits; - return new Information(value, InformationUnit.Pebibit); + return new Information(value, InformationUnit.Pebibit); } /// - /// Get Information from Pebibytes. + /// Get from Pebibytes. /// /// If value is NaN or Infinity. - public static Information FromPebibytes(QuantityValue pebibytes) + public static Information FromPebibytes(QuantityValue pebibytes) { decimal value = (decimal) pebibytes; - return new Information(value, InformationUnit.Pebibyte); + return new Information(value, InformationUnit.Pebibyte); } /// - /// Get Information from Petabits. + /// Get from Petabits. /// /// If value is NaN or Infinity. - public static Information FromPetabits(QuantityValue petabits) + public static Information FromPetabits(QuantityValue petabits) { decimal value = (decimal) petabits; - return new Information(value, InformationUnit.Petabit); + return new Information(value, InformationUnit.Petabit); } /// - /// Get Information from Petabytes. + /// Get from Petabytes. /// /// If value is NaN or Infinity. - public static Information FromPetabytes(QuantityValue petabytes) + public static Information FromPetabytes(QuantityValue petabytes) { decimal value = (decimal) petabytes; - return new Information(value, InformationUnit.Petabyte); + return new Information(value, InformationUnit.Petabyte); } /// - /// Get Information from Tebibits. + /// Get from Tebibits. /// /// If value is NaN or Infinity. - public static Information FromTebibits(QuantityValue tebibits) + public static Information FromTebibits(QuantityValue tebibits) { decimal value = (decimal) tebibits; - return new Information(value, InformationUnit.Tebibit); + return new Information(value, InformationUnit.Tebibit); } /// - /// Get Information from Tebibytes. + /// Get from Tebibytes. /// /// If value is NaN or Infinity. - public static Information FromTebibytes(QuantityValue tebibytes) + public static Information FromTebibytes(QuantityValue tebibytes) { decimal value = (decimal) tebibytes; - return new Information(value, InformationUnit.Tebibyte); + return new Information(value, InformationUnit.Tebibyte); } /// - /// Get Information from Terabits. + /// Get from Terabits. /// /// If value is NaN or Infinity. - public static Information FromTerabits(QuantityValue terabits) + public static Information FromTerabits(QuantityValue terabits) { decimal value = (decimal) terabits; - return new Information(value, InformationUnit.Terabit); + return new Information(value, InformationUnit.Terabit); } /// - /// Get Information from Terabytes. + /// Get from Terabytes. /// /// If value is NaN or Infinity. - public static Information FromTerabytes(QuantityValue terabytes) + public static Information FromTerabytes(QuantityValue terabytes) { decimal value = (decimal) terabytes; - return new Information(value, InformationUnit.Terabyte); + return new Information(value, InformationUnit.Terabyte); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Information unit value. - public static Information From(QuantityValue value, InformationUnit fromUnit) + /// unit value. + public static Information From(QuantityValue value, InformationUnit fromUnit) { - return new Information((decimal)value, fromUnit); + return new Information((decimal)value, fromUnit); } #endregion @@ -621,7 +621,7 @@ public static Information From(QuantityValue value, InformationUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Information Parse(string str) + public static Information Parse(string str) { return Parse(str, null); } @@ -649,9 +649,9 @@ public static Information Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Information Parse(string str, [CanBeNull] IFormatProvider provider) + public static Information Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, InformationUnit>( str, provider, From); @@ -665,7 +665,7 @@ public static Information Parse(string str, [CanBeNull] IFormatProvider provider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Information result) + public static bool TryParse([CanBeNull] string str, out Information result) { return TryParse(str, null, out result); } @@ -680,9 +680,9 @@ public static bool TryParse([CanBeNull] string str, out Information result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Information result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Information result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, InformationUnit>( str, provider, From, @@ -744,43 +744,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Inform #region Arithmetic Operators /// Negate the value. - public static Information operator -(Information right) + public static Information operator -(Information right) { - return new Information(-right.Value, right.Unit); + return new Information(-right.Value, right.Unit); } - /// Get from adding two . - public static Information operator +(Information left, Information right) + /// Get from adding two . + public static Information operator +(Information left, Information right) { - return new Information(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Information(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Information operator -(Information left, Information right) + /// Get from subtracting two . + public static Information operator -(Information left, Information right) { - return new Information(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Information(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Information operator *(decimal left, Information right) + /// Get from multiplying value and . + public static Information operator *(decimal left, Information right) { - return new Information(left * right.Value, right.Unit); + return new Information(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Information operator *(Information left, decimal right) + /// Get from multiplying value and . + public static Information operator *(Information left, decimal right) { - return new Information(left.Value * right, left.Unit); + return new Information(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Information operator /(Information left, decimal right) + /// Get from dividing by value. + public static Information operator /(Information left, decimal right) { - return new Information(left.Value / right, left.Unit); + return new Information(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Information left, Information right) + /// Get ratio value from dividing by . + public static double operator /(Information left, Information right) { return left.Bits / right.Bits; } @@ -790,39 +790,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Inform #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Information left, Information right) + public static bool operator <=(Information left, Information right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Information left, Information right) + public static bool operator >=(Information left, Information right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Information left, Information right) + public static bool operator <(Information left, Information right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Information left, Information right) + public static bool operator >(Information left, Information right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Information left, Information right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Information left, Information right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Information left, Information right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Information left, Information right) { return !(left == right); } @@ -831,37 +831,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Inform public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Information objInformation)) throw new ArgumentException("Expected type Information.", nameof(obj)); + if(!(obj is Information objInformation)) throw new ArgumentException("Expected type Information.", nameof(obj)); return CompareTo(objInformation); } /// - public int CompareTo(Information other) + public int CompareTo(Information other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Information objInformation)) + if(obj is null || !(obj is Information objInformation)) return false; return Equals(objInformation); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Information other) + /// Consider using for safely comparing floating point values. + public bool Equals(Information other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Information within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -899,7 +899,7 @@ public bool Equals(Information other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Information other, double tolerance, ComparisonType comparisonType) + public bool Equals(Information other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -913,7 +913,7 @@ public bool Equals(Information other, double tolerance, ComparisonType compariso /// /// Returns the hash code for this instance. /// - /// A hash code for the current Information. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -961,13 +961,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Information to another Information with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Information with the specified unit. - public Information ToUnit(InformationUnit unit) + /// A with the specified unit. + public Information ToUnit(InformationUnit unit) { var convertedValue = GetValueAs(unit); - return new Information(convertedValue, unit); + return new Information(convertedValue, unit); } /// @@ -980,7 +980,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Information ToUnit(UnitSystem unitSystem) + public Information ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1048,10 +1048,10 @@ private decimal GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Information ToBaseUnit() + internal Information ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Information(baseUnitValue, BaseUnit); + return new Information(baseUnitValue, BaseUnit); } private decimal GetValueAs(InformationUnit unit) @@ -1185,7 +1185,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Information)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Information)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1195,12 +1195,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Information)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Information)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Information)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Information)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1245,16 +1245,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Information)) + if(conversionType == typeof(Information)) return this; else if(conversionType == typeof(InformationUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Information.QuantityType; + return Information.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Information.BaseDimensions; + return Information.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Information)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Information)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs index c091096522..118b2ebfdd 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Irradiance is the intensity of ultraviolet (UV) or visible light incident on a surface. /// - public partial struct Irradiance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Irradiance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -113,19 +113,19 @@ public Irradiance(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Irradiance, which is WattPerSquareMeter. All conversions go via this value. + /// The base unit of , which is WattPerSquareMeter. All conversions go via this value. /// public static IrradianceUnit BaseUnit { get; } = IrradianceUnit.WattPerSquareMeter; /// - /// Represents the largest possible value of Irradiance + /// Represents the largest possible value of /// - public static Irradiance MaxValue { get; } = new Irradiance(double.MaxValue, BaseUnit); + public static Irradiance MaxValue { get; } = new Irradiance(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Irradiance + /// Represents the smallest possible value of /// - public static Irradiance MinValue { get; } = new Irradiance(double.MinValue, BaseUnit); + public static Irradiance MinValue { get; } = new Irradiance(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -133,14 +133,14 @@ public Irradiance(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Irradiance; /// - /// All units of measurement for the Irradiance quantity. + /// All units of measurement for the quantity. /// public static IrradianceUnit[] Units { get; } = Enum.GetValues(typeof(IrradianceUnit)).Cast().Except(new IrradianceUnit[]{ IrradianceUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeter. /// - public static Irradiance Zero { get; } = new Irradiance(0, BaseUnit); + public static Irradiance Zero { get; } = new Irradiance(0, BaseUnit); #endregion @@ -165,84 +165,84 @@ public Irradiance(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Irradiance.QuantityType; + public QuantityType Type => Irradiance.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Irradiance.BaseDimensions; + public BaseDimensions Dimensions => Irradiance.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Irradiance in KilowattsPerSquareCentimeter. + /// Get in KilowattsPerSquareCentimeter. /// public double KilowattsPerSquareCentimeter => As(IrradianceUnit.KilowattPerSquareCentimeter); /// - /// Get Irradiance in KilowattsPerSquareMeter. + /// Get in KilowattsPerSquareMeter. /// public double KilowattsPerSquareMeter => As(IrradianceUnit.KilowattPerSquareMeter); /// - /// Get Irradiance in MegawattsPerSquareCentimeter. + /// Get in MegawattsPerSquareCentimeter. /// public double MegawattsPerSquareCentimeter => As(IrradianceUnit.MegawattPerSquareCentimeter); /// - /// Get Irradiance in MegawattsPerSquareMeter. + /// Get in MegawattsPerSquareMeter. /// public double MegawattsPerSquareMeter => As(IrradianceUnit.MegawattPerSquareMeter); /// - /// Get Irradiance in MicrowattsPerSquareCentimeter. + /// Get in MicrowattsPerSquareCentimeter. /// public double MicrowattsPerSquareCentimeter => As(IrradianceUnit.MicrowattPerSquareCentimeter); /// - /// Get Irradiance in MicrowattsPerSquareMeter. + /// Get in MicrowattsPerSquareMeter. /// public double MicrowattsPerSquareMeter => As(IrradianceUnit.MicrowattPerSquareMeter); /// - /// Get Irradiance in MilliwattsPerSquareCentimeter. + /// Get in MilliwattsPerSquareCentimeter. /// public double MilliwattsPerSquareCentimeter => As(IrradianceUnit.MilliwattPerSquareCentimeter); /// - /// Get Irradiance in MilliwattsPerSquareMeter. + /// Get in MilliwattsPerSquareMeter. /// public double MilliwattsPerSquareMeter => As(IrradianceUnit.MilliwattPerSquareMeter); /// - /// Get Irradiance in NanowattsPerSquareCentimeter. + /// Get in NanowattsPerSquareCentimeter. /// public double NanowattsPerSquareCentimeter => As(IrradianceUnit.NanowattPerSquareCentimeter); /// - /// Get Irradiance in NanowattsPerSquareMeter. + /// Get in NanowattsPerSquareMeter. /// public double NanowattsPerSquareMeter => As(IrradianceUnit.NanowattPerSquareMeter); /// - /// Get Irradiance in PicowattsPerSquareCentimeter. + /// Get in PicowattsPerSquareCentimeter. /// public double PicowattsPerSquareCentimeter => As(IrradianceUnit.PicowattPerSquareCentimeter); /// - /// Get Irradiance in PicowattsPerSquareMeter. + /// Get in PicowattsPerSquareMeter. /// public double PicowattsPerSquareMeter => As(IrradianceUnit.PicowattPerSquareMeter); /// - /// Get Irradiance in WattsPerSquareCentimeter. + /// Get in WattsPerSquareCentimeter. /// public double WattsPerSquareCentimeter => As(IrradianceUnit.WattPerSquareCentimeter); /// - /// Get Irradiance in WattsPerSquareMeter. + /// Get in WattsPerSquareMeter. /// public double WattsPerSquareMeter => As(IrradianceUnit.WattPerSquareMeter); @@ -276,141 +276,141 @@ public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] IFormatPro #region Static Factory Methods /// - /// Get Irradiance from KilowattsPerSquareCentimeter. + /// Get from KilowattsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiance FromKilowattsPerSquareCentimeter(QuantityValue kilowattspersquarecentimeter) + public static Irradiance FromKilowattsPerSquareCentimeter(QuantityValue kilowattspersquarecentimeter) { double value = (double) kilowattspersquarecentimeter; - return new Irradiance(value, IrradianceUnit.KilowattPerSquareCentimeter); + return new Irradiance(value, IrradianceUnit.KilowattPerSquareCentimeter); } /// - /// Get Irradiance from KilowattsPerSquareMeter. + /// Get from KilowattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiance FromKilowattsPerSquareMeter(QuantityValue kilowattspersquaremeter) + public static Irradiance FromKilowattsPerSquareMeter(QuantityValue kilowattspersquaremeter) { double value = (double) kilowattspersquaremeter; - return new Irradiance(value, IrradianceUnit.KilowattPerSquareMeter); + return new Irradiance(value, IrradianceUnit.KilowattPerSquareMeter); } /// - /// Get Irradiance from MegawattsPerSquareCentimeter. + /// Get from MegawattsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiance FromMegawattsPerSquareCentimeter(QuantityValue megawattspersquarecentimeter) + public static Irradiance FromMegawattsPerSquareCentimeter(QuantityValue megawattspersquarecentimeter) { double value = (double) megawattspersquarecentimeter; - return new Irradiance(value, IrradianceUnit.MegawattPerSquareCentimeter); + return new Irradiance(value, IrradianceUnit.MegawattPerSquareCentimeter); } /// - /// Get Irradiance from MegawattsPerSquareMeter. + /// Get from MegawattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiance FromMegawattsPerSquareMeter(QuantityValue megawattspersquaremeter) + public static Irradiance FromMegawattsPerSquareMeter(QuantityValue megawattspersquaremeter) { double value = (double) megawattspersquaremeter; - return new Irradiance(value, IrradianceUnit.MegawattPerSquareMeter); + return new Irradiance(value, IrradianceUnit.MegawattPerSquareMeter); } /// - /// Get Irradiance from MicrowattsPerSquareCentimeter. + /// Get from MicrowattsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiance FromMicrowattsPerSquareCentimeter(QuantityValue microwattspersquarecentimeter) + public static Irradiance FromMicrowattsPerSquareCentimeter(QuantityValue microwattspersquarecentimeter) { double value = (double) microwattspersquarecentimeter; - return new Irradiance(value, IrradianceUnit.MicrowattPerSquareCentimeter); + return new Irradiance(value, IrradianceUnit.MicrowattPerSquareCentimeter); } /// - /// Get Irradiance from MicrowattsPerSquareMeter. + /// Get from MicrowattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiance FromMicrowattsPerSquareMeter(QuantityValue microwattspersquaremeter) + public static Irradiance FromMicrowattsPerSquareMeter(QuantityValue microwattspersquaremeter) { double value = (double) microwattspersquaremeter; - return new Irradiance(value, IrradianceUnit.MicrowattPerSquareMeter); + return new Irradiance(value, IrradianceUnit.MicrowattPerSquareMeter); } /// - /// Get Irradiance from MilliwattsPerSquareCentimeter. + /// Get from MilliwattsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiance FromMilliwattsPerSquareCentimeter(QuantityValue milliwattspersquarecentimeter) + public static Irradiance FromMilliwattsPerSquareCentimeter(QuantityValue milliwattspersquarecentimeter) { double value = (double) milliwattspersquarecentimeter; - return new Irradiance(value, IrradianceUnit.MilliwattPerSquareCentimeter); + return new Irradiance(value, IrradianceUnit.MilliwattPerSquareCentimeter); } /// - /// Get Irradiance from MilliwattsPerSquareMeter. + /// Get from MilliwattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiance FromMilliwattsPerSquareMeter(QuantityValue milliwattspersquaremeter) + public static Irradiance FromMilliwattsPerSquareMeter(QuantityValue milliwattspersquaremeter) { double value = (double) milliwattspersquaremeter; - return new Irradiance(value, IrradianceUnit.MilliwattPerSquareMeter); + return new Irradiance(value, IrradianceUnit.MilliwattPerSquareMeter); } /// - /// Get Irradiance from NanowattsPerSquareCentimeter. + /// Get from NanowattsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiance FromNanowattsPerSquareCentimeter(QuantityValue nanowattspersquarecentimeter) + public static Irradiance FromNanowattsPerSquareCentimeter(QuantityValue nanowattspersquarecentimeter) { double value = (double) nanowattspersquarecentimeter; - return new Irradiance(value, IrradianceUnit.NanowattPerSquareCentimeter); + return new Irradiance(value, IrradianceUnit.NanowattPerSquareCentimeter); } /// - /// Get Irradiance from NanowattsPerSquareMeter. + /// Get from NanowattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiance FromNanowattsPerSquareMeter(QuantityValue nanowattspersquaremeter) + public static Irradiance FromNanowattsPerSquareMeter(QuantityValue nanowattspersquaremeter) { double value = (double) nanowattspersquaremeter; - return new Irradiance(value, IrradianceUnit.NanowattPerSquareMeter); + return new Irradiance(value, IrradianceUnit.NanowattPerSquareMeter); } /// - /// Get Irradiance from PicowattsPerSquareCentimeter. + /// Get from PicowattsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiance FromPicowattsPerSquareCentimeter(QuantityValue picowattspersquarecentimeter) + public static Irradiance FromPicowattsPerSquareCentimeter(QuantityValue picowattspersquarecentimeter) { double value = (double) picowattspersquarecentimeter; - return new Irradiance(value, IrradianceUnit.PicowattPerSquareCentimeter); + return new Irradiance(value, IrradianceUnit.PicowattPerSquareCentimeter); } /// - /// Get Irradiance from PicowattsPerSquareMeter. + /// Get from PicowattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiance FromPicowattsPerSquareMeter(QuantityValue picowattspersquaremeter) + public static Irradiance FromPicowattsPerSquareMeter(QuantityValue picowattspersquaremeter) { double value = (double) picowattspersquaremeter; - return new Irradiance(value, IrradianceUnit.PicowattPerSquareMeter); + return new Irradiance(value, IrradianceUnit.PicowattPerSquareMeter); } /// - /// Get Irradiance from WattsPerSquareCentimeter. + /// Get from WattsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiance FromWattsPerSquareCentimeter(QuantityValue wattspersquarecentimeter) + public static Irradiance FromWattsPerSquareCentimeter(QuantityValue wattspersquarecentimeter) { double value = (double) wattspersquarecentimeter; - return new Irradiance(value, IrradianceUnit.WattPerSquareCentimeter); + return new Irradiance(value, IrradianceUnit.WattPerSquareCentimeter); } /// - /// Get Irradiance from WattsPerSquareMeter. + /// Get from WattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiance FromWattsPerSquareMeter(QuantityValue wattspersquaremeter) + public static Irradiance FromWattsPerSquareMeter(QuantityValue wattspersquaremeter) { double value = (double) wattspersquaremeter; - return new Irradiance(value, IrradianceUnit.WattPerSquareMeter); + return new Irradiance(value, IrradianceUnit.WattPerSquareMeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Irradiance unit value. - public static Irradiance From(QuantityValue value, IrradianceUnit fromUnit) + /// unit value. + public static Irradiance From(QuantityValue value, IrradianceUnit fromUnit) { - return new Irradiance((double)value, fromUnit); + return new Irradiance((double)value, fromUnit); } #endregion @@ -439,7 +439,7 @@ public static Irradiance From(QuantityValue value, IrradianceUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Irradiance Parse(string str) + public static Irradiance Parse(string str) { return Parse(str, null); } @@ -467,9 +467,9 @@ public static Irradiance Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Irradiance Parse(string str, [CanBeNull] IFormatProvider provider) + public static Irradiance Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, IrradianceUnit>( str, provider, From); @@ -483,7 +483,7 @@ public static Irradiance Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Irradiance result) + public static bool TryParse([CanBeNull] string str, out Irradiance result) { return TryParse(str, null, out result); } @@ -498,9 +498,9 @@ public static bool TryParse([CanBeNull] string str, out Irradiance result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiance result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiance result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, IrradianceUnit>( str, provider, From, @@ -562,43 +562,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Irradi #region Arithmetic Operators /// Negate the value. - public static Irradiance operator -(Irradiance right) + public static Irradiance operator -(Irradiance right) { - return new Irradiance(-right.Value, right.Unit); + return new Irradiance(-right.Value, right.Unit); } - /// Get from adding two . - public static Irradiance operator +(Irradiance left, Irradiance right) + /// Get from adding two . + public static Irradiance operator +(Irradiance left, Irradiance right) { - return new Irradiance(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Irradiance(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Irradiance operator -(Irradiance left, Irradiance right) + /// Get from subtracting two . + public static Irradiance operator -(Irradiance left, Irradiance right) { - return new Irradiance(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Irradiance(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Irradiance operator *(double left, Irradiance right) + /// Get from multiplying value and . + public static Irradiance operator *(double left, Irradiance right) { - return new Irradiance(left * right.Value, right.Unit); + return new Irradiance(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Irradiance operator *(Irradiance left, double right) + /// Get from multiplying value and . + public static Irradiance operator *(Irradiance left, double right) { - return new Irradiance(left.Value * right, left.Unit); + return new Irradiance(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Irradiance operator /(Irradiance left, double right) + /// Get from dividing by value. + public static Irradiance operator /(Irradiance left, double right) { - return new Irradiance(left.Value / right, left.Unit); + return new Irradiance(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Irradiance left, Irradiance right) + /// Get ratio value from dividing by . + public static double operator /(Irradiance left, Irradiance right) { return left.WattsPerSquareMeter / right.WattsPerSquareMeter; } @@ -608,39 +608,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Irradi #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Irradiance left, Irradiance right) + public static bool operator <=(Irradiance left, Irradiance right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Irradiance left, Irradiance right) + public static bool operator >=(Irradiance left, Irradiance right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Irradiance left, Irradiance right) + public static bool operator <(Irradiance left, Irradiance right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Irradiance left, Irradiance right) + public static bool operator >(Irradiance left, Irradiance right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Irradiance left, Irradiance right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Irradiance left, Irradiance right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Irradiance left, Irradiance right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Irradiance left, Irradiance right) { return !(left == right); } @@ -649,37 +649,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Irradi public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Irradiance objIrradiance)) throw new ArgumentException("Expected type Irradiance.", nameof(obj)); + if(!(obj is Irradiance objIrradiance)) throw new ArgumentException("Expected type Irradiance.", nameof(obj)); return CompareTo(objIrradiance); } /// - public int CompareTo(Irradiance other) + public int CompareTo(Irradiance other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Irradiance objIrradiance)) + if(obj is null || !(obj is Irradiance objIrradiance)) return false; return Equals(objIrradiance); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Irradiance other) + /// Consider using for safely comparing floating point values. + public bool Equals(Irradiance other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Irradiance within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -717,7 +717,7 @@ public bool Equals(Irradiance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Irradiance other, double tolerance, ComparisonType comparisonType) + public bool Equals(Irradiance other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -731,7 +731,7 @@ public bool Equals(Irradiance other, double tolerance, ComparisonType comparison /// /// Returns the hash code for this instance. /// - /// A hash code for the current Irradiance. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -779,13 +779,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Irradiance to another Irradiance with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Irradiance with the specified unit. - public Irradiance ToUnit(IrradianceUnit unit) + /// A with the specified unit. + public Irradiance ToUnit(IrradianceUnit unit) { var convertedValue = GetValueAs(unit); - return new Irradiance(convertedValue, unit); + return new Irradiance(convertedValue, unit); } /// @@ -798,7 +798,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Irradiance ToUnit(UnitSystem unitSystem) + public Irradiance ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -854,10 +854,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Irradiance ToBaseUnit() + internal Irradiance ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Irradiance(baseUnitValue, BaseUnit); + return new Irradiance(baseUnitValue, BaseUnit); } private double GetValueAs(IrradianceUnit unit) @@ -979,7 +979,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Irradiance)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Irradiance)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -989,12 +989,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Irradiance)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Irradiance)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Irradiance)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Irradiance)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1039,16 +1039,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Irradiance)) + if(conversionType == typeof(Irradiance)) return this; else if(conversionType == typeof(IrradianceUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Irradiance.QuantityType; + return Irradiance.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Irradiance.BaseDimensions; + return Irradiance.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Irradiance)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Irradiance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs index 4bc0411db9..060f3593a0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Irradiation /// - public partial struct Irradiation : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Irradiation : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -109,19 +109,19 @@ public Irradiation(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Irradiation, which is JoulePerSquareMeter. All conversions go via this value. + /// The base unit of , which is JoulePerSquareMeter. All conversions go via this value. /// public static IrradiationUnit BaseUnit { get; } = IrradiationUnit.JoulePerSquareMeter; /// - /// Represents the largest possible value of Irradiation + /// Represents the largest possible value of /// - public static Irradiation MaxValue { get; } = new Irradiation(double.MaxValue, BaseUnit); + public static Irradiation MaxValue { get; } = new Irradiation(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Irradiation + /// Represents the smallest possible value of /// - public static Irradiation MinValue { get; } = new Irradiation(double.MinValue, BaseUnit); + public static Irradiation MinValue { get; } = new Irradiation(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -129,14 +129,14 @@ public Irradiation(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Irradiation; /// - /// All units of measurement for the Irradiation quantity. + /// All units of measurement for the quantity. /// public static IrradiationUnit[] Units { get; } = Enum.GetValues(typeof(IrradiationUnit)).Cast().Except(new IrradiationUnit[]{ IrradiationUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerSquareMeter. /// - public static Irradiation Zero { get; } = new Irradiation(0, BaseUnit); + public static Irradiation Zero { get; } = new Irradiation(0, BaseUnit); #endregion @@ -161,49 +161,49 @@ public Irradiation(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Irradiation.QuantityType; + public QuantityType Type => Irradiation.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Irradiation.BaseDimensions; + public BaseDimensions Dimensions => Irradiation.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Irradiation in JoulesPerSquareCentimeter. + /// Get in JoulesPerSquareCentimeter. /// public double JoulesPerSquareCentimeter => As(IrradiationUnit.JoulePerSquareCentimeter); /// - /// Get Irradiation in JoulesPerSquareMeter. + /// Get in JoulesPerSquareMeter. /// public double JoulesPerSquareMeter => As(IrradiationUnit.JoulePerSquareMeter); /// - /// Get Irradiation in JoulesPerSquareMillimeter. + /// Get in JoulesPerSquareMillimeter. /// public double JoulesPerSquareMillimeter => As(IrradiationUnit.JoulePerSquareMillimeter); /// - /// Get Irradiation in KilojoulesPerSquareMeter. + /// Get in KilojoulesPerSquareMeter. /// public double KilojoulesPerSquareMeter => As(IrradiationUnit.KilojoulePerSquareMeter); /// - /// Get Irradiation in KilowattHoursPerSquareMeter. + /// Get in KilowattHoursPerSquareMeter. /// public double KilowattHoursPerSquareMeter => As(IrradiationUnit.KilowattHourPerSquareMeter); /// - /// Get Irradiation in MillijoulesPerSquareCentimeter. + /// Get in MillijoulesPerSquareCentimeter. /// public double MillijoulesPerSquareCentimeter => As(IrradiationUnit.MillijoulePerSquareCentimeter); /// - /// Get Irradiation in WattHoursPerSquareMeter. + /// Get in WattHoursPerSquareMeter. /// public double WattHoursPerSquareMeter => As(IrradiationUnit.WattHourPerSquareMeter); @@ -237,78 +237,78 @@ public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] IFormatPr #region Static Factory Methods /// - /// Get Irradiation from JoulesPerSquareCentimeter. + /// Get from JoulesPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiation FromJoulesPerSquareCentimeter(QuantityValue joulespersquarecentimeter) + public static Irradiation FromJoulesPerSquareCentimeter(QuantityValue joulespersquarecentimeter) { double value = (double) joulespersquarecentimeter; - return new Irradiation(value, IrradiationUnit.JoulePerSquareCentimeter); + return new Irradiation(value, IrradiationUnit.JoulePerSquareCentimeter); } /// - /// Get Irradiation from JoulesPerSquareMeter. + /// Get from JoulesPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiation FromJoulesPerSquareMeter(QuantityValue joulespersquaremeter) + public static Irradiation FromJoulesPerSquareMeter(QuantityValue joulespersquaremeter) { double value = (double) joulespersquaremeter; - return new Irradiation(value, IrradiationUnit.JoulePerSquareMeter); + return new Irradiation(value, IrradiationUnit.JoulePerSquareMeter); } /// - /// Get Irradiation from JoulesPerSquareMillimeter. + /// Get from JoulesPerSquareMillimeter. /// /// If value is NaN or Infinity. - public static Irradiation FromJoulesPerSquareMillimeter(QuantityValue joulespersquaremillimeter) + public static Irradiation FromJoulesPerSquareMillimeter(QuantityValue joulespersquaremillimeter) { double value = (double) joulespersquaremillimeter; - return new Irradiation(value, IrradiationUnit.JoulePerSquareMillimeter); + return new Irradiation(value, IrradiationUnit.JoulePerSquareMillimeter); } /// - /// Get Irradiation from KilojoulesPerSquareMeter. + /// Get from KilojoulesPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiation FromKilojoulesPerSquareMeter(QuantityValue kilojoulespersquaremeter) + public static Irradiation FromKilojoulesPerSquareMeter(QuantityValue kilojoulespersquaremeter) { double value = (double) kilojoulespersquaremeter; - return new Irradiation(value, IrradiationUnit.KilojoulePerSquareMeter); + return new Irradiation(value, IrradiationUnit.KilojoulePerSquareMeter); } /// - /// Get Irradiation from KilowattHoursPerSquareMeter. + /// Get from KilowattHoursPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiation FromKilowattHoursPerSquareMeter(QuantityValue kilowatthourspersquaremeter) + public static Irradiation FromKilowattHoursPerSquareMeter(QuantityValue kilowatthourspersquaremeter) { double value = (double) kilowatthourspersquaremeter; - return new Irradiation(value, IrradiationUnit.KilowattHourPerSquareMeter); + return new Irradiation(value, IrradiationUnit.KilowattHourPerSquareMeter); } /// - /// Get Irradiation from MillijoulesPerSquareCentimeter. + /// Get from MillijoulesPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiation FromMillijoulesPerSquareCentimeter(QuantityValue millijoulespersquarecentimeter) + public static Irradiation FromMillijoulesPerSquareCentimeter(QuantityValue millijoulespersquarecentimeter) { double value = (double) millijoulespersquarecentimeter; - return new Irradiation(value, IrradiationUnit.MillijoulePerSquareCentimeter); + return new Irradiation(value, IrradiationUnit.MillijoulePerSquareCentimeter); } /// - /// Get Irradiation from WattHoursPerSquareMeter. + /// Get from WattHoursPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiation FromWattHoursPerSquareMeter(QuantityValue watthourspersquaremeter) + public static Irradiation FromWattHoursPerSquareMeter(QuantityValue watthourspersquaremeter) { double value = (double) watthourspersquaremeter; - return new Irradiation(value, IrradiationUnit.WattHourPerSquareMeter); + return new Irradiation(value, IrradiationUnit.WattHourPerSquareMeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Irradiation unit value. - public static Irradiation From(QuantityValue value, IrradiationUnit fromUnit) + /// unit value. + public static Irradiation From(QuantityValue value, IrradiationUnit fromUnit) { - return new Irradiation((double)value, fromUnit); + return new Irradiation((double)value, fromUnit); } #endregion @@ -337,7 +337,7 @@ public static Irradiation From(QuantityValue value, IrradiationUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Irradiation Parse(string str) + public static Irradiation Parse(string str) { return Parse(str, null); } @@ -365,9 +365,9 @@ public static Irradiation Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Irradiation Parse(string str, [CanBeNull] IFormatProvider provider) + public static Irradiation Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, IrradiationUnit>( str, provider, From); @@ -381,7 +381,7 @@ public static Irradiation Parse(string str, [CanBeNull] IFormatProvider provider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Irradiation result) + public static bool TryParse([CanBeNull] string str, out Irradiation result) { return TryParse(str, null, out result); } @@ -396,9 +396,9 @@ public static bool TryParse([CanBeNull] string str, out Irradiation result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiation result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiation result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, IrradiationUnit>( str, provider, From, @@ -460,43 +460,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Irradi #region Arithmetic Operators /// Negate the value. - public static Irradiation operator -(Irradiation right) + public static Irradiation operator -(Irradiation right) { - return new Irradiation(-right.Value, right.Unit); + return new Irradiation(-right.Value, right.Unit); } - /// Get from adding two . - public static Irradiation operator +(Irradiation left, Irradiation right) + /// Get from adding two . + public static Irradiation operator +(Irradiation left, Irradiation right) { - return new Irradiation(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Irradiation(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Irradiation operator -(Irradiation left, Irradiation right) + /// Get from subtracting two . + public static Irradiation operator -(Irradiation left, Irradiation right) { - return new Irradiation(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Irradiation(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Irradiation operator *(double left, Irradiation right) + /// Get from multiplying value and . + public static Irradiation operator *(double left, Irradiation right) { - return new Irradiation(left * right.Value, right.Unit); + return new Irradiation(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Irradiation operator *(Irradiation left, double right) + /// Get from multiplying value and . + public static Irradiation operator *(Irradiation left, double right) { - return new Irradiation(left.Value * right, left.Unit); + return new Irradiation(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Irradiation operator /(Irradiation left, double right) + /// Get from dividing by value. + public static Irradiation operator /(Irradiation left, double right) { - return new Irradiation(left.Value / right, left.Unit); + return new Irradiation(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Irradiation left, Irradiation right) + /// Get ratio value from dividing by . + public static double operator /(Irradiation left, Irradiation right) { return left.JoulesPerSquareMeter / right.JoulesPerSquareMeter; } @@ -506,39 +506,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Irradi #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Irradiation left, Irradiation right) + public static bool operator <=(Irradiation left, Irradiation right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Irradiation left, Irradiation right) + public static bool operator >=(Irradiation left, Irradiation right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Irradiation left, Irradiation right) + public static bool operator <(Irradiation left, Irradiation right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Irradiation left, Irradiation right) + public static bool operator >(Irradiation left, Irradiation right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Irradiation left, Irradiation right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Irradiation left, Irradiation right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Irradiation left, Irradiation right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Irradiation left, Irradiation right) { return !(left == right); } @@ -547,37 +547,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Irradi public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Irradiation objIrradiation)) throw new ArgumentException("Expected type Irradiation.", nameof(obj)); + if(!(obj is Irradiation objIrradiation)) throw new ArgumentException("Expected type Irradiation.", nameof(obj)); return CompareTo(objIrradiation); } /// - public int CompareTo(Irradiation other) + public int CompareTo(Irradiation other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Irradiation objIrradiation)) + if(obj is null || !(obj is Irradiation objIrradiation)) return false; return Equals(objIrradiation); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Irradiation other) + /// Consider using for safely comparing floating point values. + public bool Equals(Irradiation other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Irradiation within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -615,7 +615,7 @@ public bool Equals(Irradiation other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Irradiation other, double tolerance, ComparisonType comparisonType) + public bool Equals(Irradiation other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -629,7 +629,7 @@ public bool Equals(Irradiation other, double tolerance, ComparisonType compariso /// /// Returns the hash code for this instance. /// - /// A hash code for the current Irradiation. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -677,13 +677,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Irradiation to another Irradiation with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Irradiation with the specified unit. - public Irradiation ToUnit(IrradiationUnit unit) + /// A with the specified unit. + public Irradiation ToUnit(IrradiationUnit unit) { var convertedValue = GetValueAs(unit); - return new Irradiation(convertedValue, unit); + return new Irradiation(convertedValue, unit); } /// @@ -696,7 +696,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Irradiation ToUnit(UnitSystem unitSystem) + public Irradiation ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -745,10 +745,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Irradiation ToBaseUnit() + internal Irradiation ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Irradiation(baseUnitValue, BaseUnit); + return new Irradiation(baseUnitValue, BaseUnit); } private double GetValueAs(IrradiationUnit unit) @@ -863,7 +863,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Irradiation)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Irradiation)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -873,12 +873,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Irradiation)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Irradiation)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Irradiation)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Irradiation)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -923,16 +923,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Irradiation)) + if(conversionType == typeof(Irradiation)) return this; else if(conversionType == typeof(IrradiationUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Irradiation.QuantityType; + return Irradiation.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Irradiation.BaseDimensions; + return Irradiation.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Irradiation)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Irradiation)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs index dea04acfbc..e5d18852ca 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// http://en.wikipedia.org/wiki/Viscosity /// - public partial struct KinematicViscosity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct KinematicViscosity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -110,19 +110,19 @@ public KinematicViscosity(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of KinematicViscosity, which is SquareMeterPerSecond. All conversions go via this value. + /// The base unit of , which is SquareMeterPerSecond. All conversions go via this value. /// public static KinematicViscosityUnit BaseUnit { get; } = KinematicViscosityUnit.SquareMeterPerSecond; /// - /// Represents the largest possible value of KinematicViscosity + /// Represents the largest possible value of /// - public static KinematicViscosity MaxValue { get; } = new KinematicViscosity(double.MaxValue, BaseUnit); + public static KinematicViscosity MaxValue { get; } = new KinematicViscosity(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of KinematicViscosity + /// Represents the smallest possible value of /// - public static KinematicViscosity MinValue { get; } = new KinematicViscosity(double.MinValue, BaseUnit); + public static KinematicViscosity MinValue { get; } = new KinematicViscosity(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -130,14 +130,14 @@ public KinematicViscosity(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.KinematicViscosity; /// - /// All units of measurement for the KinematicViscosity quantity. + /// All units of measurement for the quantity. /// public static KinematicViscosityUnit[] Units { get; } = Enum.GetValues(typeof(KinematicViscosityUnit)).Cast().Except(new KinematicViscosityUnit[]{ KinematicViscosityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeterPerSecond. /// - public static KinematicViscosity Zero { get; } = new KinematicViscosity(0, BaseUnit); + public static KinematicViscosity Zero { get; } = new KinematicViscosity(0, BaseUnit); #endregion @@ -162,54 +162,54 @@ public KinematicViscosity(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => KinematicViscosity.QuantityType; + public QuantityType Type => KinematicViscosity.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => KinematicViscosity.BaseDimensions; + public BaseDimensions Dimensions => KinematicViscosity.BaseDimensions; #endregion #region Conversion Properties /// - /// Get KinematicViscosity in Centistokes. + /// Get in Centistokes. /// public double Centistokes => As(KinematicViscosityUnit.Centistokes); /// - /// Get KinematicViscosity in Decistokes. + /// Get in Decistokes. /// public double Decistokes => As(KinematicViscosityUnit.Decistokes); /// - /// Get KinematicViscosity in Kilostokes. + /// Get in Kilostokes. /// public double Kilostokes => As(KinematicViscosityUnit.Kilostokes); /// - /// Get KinematicViscosity in Microstokes. + /// Get in Microstokes. /// public double Microstokes => As(KinematicViscosityUnit.Microstokes); /// - /// Get KinematicViscosity in Millistokes. + /// Get in Millistokes. /// public double Millistokes => As(KinematicViscosityUnit.Millistokes); /// - /// Get KinematicViscosity in Nanostokes. + /// Get in Nanostokes. /// public double Nanostokes => As(KinematicViscosityUnit.Nanostokes); /// - /// Get KinematicViscosity in SquareMetersPerSecond. + /// Get in SquareMetersPerSecond. /// public double SquareMetersPerSecond => As(KinematicViscosityUnit.SquareMeterPerSecond); /// - /// Get KinematicViscosity in Stokes. + /// Get in Stokes. /// public double Stokes => As(KinematicViscosityUnit.Stokes); @@ -243,87 +243,87 @@ public static string GetAbbreviation(KinematicViscosityUnit unit, [CanBeNull] IF #region Static Factory Methods /// - /// Get KinematicViscosity from Centistokes. + /// Get from Centistokes. /// /// If value is NaN or Infinity. - public static KinematicViscosity FromCentistokes(QuantityValue centistokes) + public static KinematicViscosity FromCentistokes(QuantityValue centistokes) { double value = (double) centistokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Centistokes); + return new KinematicViscosity(value, KinematicViscosityUnit.Centistokes); } /// - /// Get KinematicViscosity from Decistokes. + /// Get from Decistokes. /// /// If value is NaN or Infinity. - public static KinematicViscosity FromDecistokes(QuantityValue decistokes) + public static KinematicViscosity FromDecistokes(QuantityValue decistokes) { double value = (double) decistokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Decistokes); + return new KinematicViscosity(value, KinematicViscosityUnit.Decistokes); } /// - /// Get KinematicViscosity from Kilostokes. + /// Get from Kilostokes. /// /// If value is NaN or Infinity. - public static KinematicViscosity FromKilostokes(QuantityValue kilostokes) + public static KinematicViscosity FromKilostokes(QuantityValue kilostokes) { double value = (double) kilostokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Kilostokes); + return new KinematicViscosity(value, KinematicViscosityUnit.Kilostokes); } /// - /// Get KinematicViscosity from Microstokes. + /// Get from Microstokes. /// /// If value is NaN or Infinity. - public static KinematicViscosity FromMicrostokes(QuantityValue microstokes) + public static KinematicViscosity FromMicrostokes(QuantityValue microstokes) { double value = (double) microstokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Microstokes); + return new KinematicViscosity(value, KinematicViscosityUnit.Microstokes); } /// - /// Get KinematicViscosity from Millistokes. + /// Get from Millistokes. /// /// If value is NaN or Infinity. - public static KinematicViscosity FromMillistokes(QuantityValue millistokes) + public static KinematicViscosity FromMillistokes(QuantityValue millistokes) { double value = (double) millistokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Millistokes); + return new KinematicViscosity(value, KinematicViscosityUnit.Millistokes); } /// - /// Get KinematicViscosity from Nanostokes. + /// Get from Nanostokes. /// /// If value is NaN or Infinity. - public static KinematicViscosity FromNanostokes(QuantityValue nanostokes) + public static KinematicViscosity FromNanostokes(QuantityValue nanostokes) { double value = (double) nanostokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Nanostokes); + return new KinematicViscosity(value, KinematicViscosityUnit.Nanostokes); } /// - /// Get KinematicViscosity from SquareMetersPerSecond. + /// Get from SquareMetersPerSecond. /// /// If value is NaN or Infinity. - public static KinematicViscosity FromSquareMetersPerSecond(QuantityValue squaremeterspersecond) + public static KinematicViscosity FromSquareMetersPerSecond(QuantityValue squaremeterspersecond) { double value = (double) squaremeterspersecond; - return new KinematicViscosity(value, KinematicViscosityUnit.SquareMeterPerSecond); + return new KinematicViscosity(value, KinematicViscosityUnit.SquareMeterPerSecond); } /// - /// Get KinematicViscosity from Stokes. + /// Get from Stokes. /// /// If value is NaN or Infinity. - public static KinematicViscosity FromStokes(QuantityValue stokes) + public static KinematicViscosity FromStokes(QuantityValue stokes) { double value = (double) stokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Stokes); + return new KinematicViscosity(value, KinematicViscosityUnit.Stokes); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// KinematicViscosity unit value. - public static KinematicViscosity From(QuantityValue value, KinematicViscosityUnit fromUnit) + /// unit value. + public static KinematicViscosity From(QuantityValue value, KinematicViscosityUnit fromUnit) { - return new KinematicViscosity((double)value, fromUnit); + return new KinematicViscosity((double)value, fromUnit); } #endregion @@ -352,7 +352,7 @@ public static KinematicViscosity From(QuantityValue value, KinematicViscosityUni /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static KinematicViscosity Parse(string str) + public static KinematicViscosity Parse(string str) { return Parse(str, null); } @@ -380,9 +380,9 @@ public static KinematicViscosity Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static KinematicViscosity Parse(string str, [CanBeNull] IFormatProvider provider) + public static KinematicViscosity Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, KinematicViscosityUnit>( str, provider, From); @@ -396,7 +396,7 @@ public static KinematicViscosity Parse(string str, [CanBeNull] IFormatProvider p /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out KinematicViscosity result) + public static bool TryParse([CanBeNull] string str, out KinematicViscosity result) { return TryParse(str, null, out result); } @@ -411,9 +411,9 @@ public static bool TryParse([CanBeNull] string str, out KinematicViscosity resul /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out KinematicViscosity result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out KinematicViscosity result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, KinematicViscosityUnit>( str, provider, From, @@ -475,43 +475,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Kinema #region Arithmetic Operators /// Negate the value. - public static KinematicViscosity operator -(KinematicViscosity right) + public static KinematicViscosity operator -(KinematicViscosity right) { - return new KinematicViscosity(-right.Value, right.Unit); + return new KinematicViscosity(-right.Value, right.Unit); } - /// Get from adding two . - public static KinematicViscosity operator +(KinematicViscosity left, KinematicViscosity right) + /// Get from adding two . + public static KinematicViscosity operator +(KinematicViscosity left, KinematicViscosity right) { - return new KinematicViscosity(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new KinematicViscosity(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static KinematicViscosity operator -(KinematicViscosity left, KinematicViscosity right) + /// Get from subtracting two . + public static KinematicViscosity operator -(KinematicViscosity left, KinematicViscosity right) { - return new KinematicViscosity(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new KinematicViscosity(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static KinematicViscosity operator *(double left, KinematicViscosity right) + /// Get from multiplying value and . + public static KinematicViscosity operator *(double left, KinematicViscosity right) { - return new KinematicViscosity(left * right.Value, right.Unit); + return new KinematicViscosity(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static KinematicViscosity operator *(KinematicViscosity left, double right) + /// Get from multiplying value and . + public static KinematicViscosity operator *(KinematicViscosity left, double right) { - return new KinematicViscosity(left.Value * right, left.Unit); + return new KinematicViscosity(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static KinematicViscosity operator /(KinematicViscosity left, double right) + /// Get from dividing by value. + public static KinematicViscosity operator /(KinematicViscosity left, double right) { - return new KinematicViscosity(left.Value / right, left.Unit); + return new KinematicViscosity(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(KinematicViscosity left, KinematicViscosity right) + /// Get ratio value from dividing by . + public static double operator /(KinematicViscosity left, KinematicViscosity right) { return left.SquareMetersPerSecond / right.SquareMetersPerSecond; } @@ -521,39 +521,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Kinema #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(KinematicViscosity left, KinematicViscosity right) + public static bool operator <=(KinematicViscosity left, KinematicViscosity right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(KinematicViscosity left, KinematicViscosity right) + public static bool operator >=(KinematicViscosity left, KinematicViscosity right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(KinematicViscosity left, KinematicViscosity right) + public static bool operator <(KinematicViscosity left, KinematicViscosity right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(KinematicViscosity left, KinematicViscosity right) + public static bool operator >(KinematicViscosity left, KinematicViscosity right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(KinematicViscosity left, KinematicViscosity right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(KinematicViscosity left, KinematicViscosity right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(KinematicViscosity left, KinematicViscosity right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(KinematicViscosity left, KinematicViscosity right) { return !(left == right); } @@ -562,37 +562,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Kinema public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is KinematicViscosity objKinematicViscosity)) throw new ArgumentException("Expected type KinematicViscosity.", nameof(obj)); + if(!(obj is KinematicViscosity objKinematicViscosity)) throw new ArgumentException("Expected type KinematicViscosity.", nameof(obj)); return CompareTo(objKinematicViscosity); } /// - public int CompareTo(KinematicViscosity other) + public int CompareTo(KinematicViscosity other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is KinematicViscosity objKinematicViscosity)) + if(obj is null || !(obj is KinematicViscosity objKinematicViscosity)) return false; return Equals(objKinematicViscosity); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(KinematicViscosity other) + /// Consider using for safely comparing floating point values. + public bool Equals(KinematicViscosity other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another KinematicViscosity within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -630,7 +630,7 @@ public bool Equals(KinematicViscosity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(KinematicViscosity other, double tolerance, ComparisonType comparisonType) + public bool Equals(KinematicViscosity other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -644,7 +644,7 @@ public bool Equals(KinematicViscosity other, double tolerance, ComparisonType co /// /// Returns the hash code for this instance. /// - /// A hash code for the current KinematicViscosity. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -692,13 +692,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this KinematicViscosity to another KinematicViscosity with the unit representation . + /// Converts this to another with the unit representation . /// - /// A KinematicViscosity with the specified unit. - public KinematicViscosity ToUnit(KinematicViscosityUnit unit) + /// A with the specified unit. + public KinematicViscosity ToUnit(KinematicViscosityUnit unit) { var convertedValue = GetValueAs(unit); - return new KinematicViscosity(convertedValue, unit); + return new KinematicViscosity(convertedValue, unit); } /// @@ -711,7 +711,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public KinematicViscosity ToUnit(UnitSystem unitSystem) + public KinematicViscosity ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -761,10 +761,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal KinematicViscosity ToBaseUnit() + internal KinematicViscosity ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new KinematicViscosity(baseUnitValue, BaseUnit); + return new KinematicViscosity(baseUnitValue, BaseUnit); } private double GetValueAs(KinematicViscosityUnit unit) @@ -880,7 +880,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -890,12 +890,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -940,16 +940,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(KinematicViscosity)) + if(conversionType == typeof(KinematicViscosity)) return this; else if(conversionType == typeof(KinematicViscosityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return KinematicViscosity.QuantityType; + return KinematicViscosity.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return KinematicViscosity.BaseDimensions; + return KinematicViscosity.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs index 87a837abf3..b2052d4023 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Lapse rate is the rate at which Earth's atmospheric temperature decreases with an increase in altitude, or increases with the decrease in altitude. /// - public partial struct LapseRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct LapseRate : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -100,19 +100,19 @@ public LapseRate(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of LapseRate, which is DegreeCelsiusPerKilometer. All conversions go via this value. + /// The base unit of , which is DegreeCelsiusPerKilometer. All conversions go via this value. /// public static LapseRateUnit BaseUnit { get; } = LapseRateUnit.DegreeCelsiusPerKilometer; /// - /// Represents the largest possible value of LapseRate + /// Represents the largest possible value of /// - public static LapseRate MaxValue { get; } = new LapseRate(double.MaxValue, BaseUnit); + public static LapseRate MaxValue { get; } = new LapseRate(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of LapseRate + /// Represents the smallest possible value of /// - public static LapseRate MinValue { get; } = new LapseRate(double.MinValue, BaseUnit); + public static LapseRate MinValue { get; } = new LapseRate(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -120,14 +120,14 @@ public LapseRate(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.LapseRate; /// - /// All units of measurement for the LapseRate quantity. + /// All units of measurement for the quantity. /// public static LapseRateUnit[] Units { get; } = Enum.GetValues(typeof(LapseRateUnit)).Cast().Except(new LapseRateUnit[]{ LapseRateUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit DegreeCelsiusPerKilometer. /// - public static LapseRate Zero { get; } = new LapseRate(0, BaseUnit); + public static LapseRate Zero { get; } = new LapseRate(0, BaseUnit); #endregion @@ -152,19 +152,19 @@ public LapseRate(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => LapseRate.QuantityType; + public QuantityType Type => LapseRate.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => LapseRate.BaseDimensions; + public BaseDimensions Dimensions => LapseRate.BaseDimensions; #endregion #region Conversion Properties /// - /// Get LapseRate in DegreesCelciusPerKilometer. + /// Get in DegreesCelciusPerKilometer. /// public double DegreesCelciusPerKilometer => As(LapseRateUnit.DegreeCelsiusPerKilometer); @@ -198,24 +198,24 @@ public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] IFormatProv #region Static Factory Methods /// - /// Get LapseRate from DegreesCelciusPerKilometer. + /// Get from DegreesCelciusPerKilometer. /// /// If value is NaN or Infinity. - public static LapseRate FromDegreesCelciusPerKilometer(QuantityValue degreescelciusperkilometer) + public static LapseRate FromDegreesCelciusPerKilometer(QuantityValue degreescelciusperkilometer) { double value = (double) degreescelciusperkilometer; - return new LapseRate(value, LapseRateUnit.DegreeCelsiusPerKilometer); + return new LapseRate(value, LapseRateUnit.DegreeCelsiusPerKilometer); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// LapseRate unit value. - public static LapseRate From(QuantityValue value, LapseRateUnit fromUnit) + /// unit value. + public static LapseRate From(QuantityValue value, LapseRateUnit fromUnit) { - return new LapseRate((double)value, fromUnit); + return new LapseRate((double)value, fromUnit); } #endregion @@ -244,7 +244,7 @@ public static LapseRate From(QuantityValue value, LapseRateUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static LapseRate Parse(string str) + public static LapseRate Parse(string str) { return Parse(str, null); } @@ -272,9 +272,9 @@ public static LapseRate Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static LapseRate Parse(string str, [CanBeNull] IFormatProvider provider) + public static LapseRate Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, LapseRateUnit>( str, provider, From); @@ -288,7 +288,7 @@ public static LapseRate Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out LapseRate result) + public static bool TryParse([CanBeNull] string str, out LapseRate result) { return TryParse(str, null, out result); } @@ -303,9 +303,9 @@ public static bool TryParse([CanBeNull] string str, out LapseRate result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LapseRate result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LapseRate result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, LapseRateUnit>( str, provider, From, @@ -367,43 +367,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out LapseR #region Arithmetic Operators /// Negate the value. - public static LapseRate operator -(LapseRate right) + public static LapseRate operator -(LapseRate right) { - return new LapseRate(-right.Value, right.Unit); + return new LapseRate(-right.Value, right.Unit); } - /// Get from adding two . - public static LapseRate operator +(LapseRate left, LapseRate right) + /// Get from adding two . + public static LapseRate operator +(LapseRate left, LapseRate right) { - return new LapseRate(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new LapseRate(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static LapseRate operator -(LapseRate left, LapseRate right) + /// Get from subtracting two . + public static LapseRate operator -(LapseRate left, LapseRate right) { - return new LapseRate(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new LapseRate(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static LapseRate operator *(double left, LapseRate right) + /// Get from multiplying value and . + public static LapseRate operator *(double left, LapseRate right) { - return new LapseRate(left * right.Value, right.Unit); + return new LapseRate(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static LapseRate operator *(LapseRate left, double right) + /// Get from multiplying value and . + public static LapseRate operator *(LapseRate left, double right) { - return new LapseRate(left.Value * right, left.Unit); + return new LapseRate(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static LapseRate operator /(LapseRate left, double right) + /// Get from dividing by value. + public static LapseRate operator /(LapseRate left, double right) { - return new LapseRate(left.Value / right, left.Unit); + return new LapseRate(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(LapseRate left, LapseRate right) + /// Get ratio value from dividing by . + public static double operator /(LapseRate left, LapseRate right) { return left.DegreesCelciusPerKilometer / right.DegreesCelciusPerKilometer; } @@ -413,39 +413,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out LapseR #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(LapseRate left, LapseRate right) + public static bool operator <=(LapseRate left, LapseRate right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(LapseRate left, LapseRate right) + public static bool operator >=(LapseRate left, LapseRate right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(LapseRate left, LapseRate right) + public static bool operator <(LapseRate left, LapseRate right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(LapseRate left, LapseRate right) + public static bool operator >(LapseRate left, LapseRate right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(LapseRate left, LapseRate right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(LapseRate left, LapseRate right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(LapseRate left, LapseRate right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(LapseRate left, LapseRate right) { return !(left == right); } @@ -454,37 +454,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out LapseR public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LapseRate objLapseRate)) throw new ArgumentException("Expected type LapseRate.", nameof(obj)); + if(!(obj is LapseRate objLapseRate)) throw new ArgumentException("Expected type LapseRate.", nameof(obj)); return CompareTo(objLapseRate); } /// - public int CompareTo(LapseRate other) + public int CompareTo(LapseRate other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is LapseRate objLapseRate)) + if(obj is null || !(obj is LapseRate objLapseRate)) return false; return Equals(objLapseRate); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(LapseRate other) + /// Consider using for safely comparing floating point values. + public bool Equals(LapseRate other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another LapseRate within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -522,7 +522,7 @@ public bool Equals(LapseRate other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(LapseRate other, double tolerance, ComparisonType comparisonType) + public bool Equals(LapseRate other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -536,7 +536,7 @@ public bool Equals(LapseRate other, double tolerance, ComparisonType comparisonT /// /// Returns the hash code for this instance. /// - /// A hash code for the current LapseRate. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -584,13 +584,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this LapseRate to another LapseRate with the unit representation . + /// Converts this to another with the unit representation . /// - /// A LapseRate with the specified unit. - public LapseRate ToUnit(LapseRateUnit unit) + /// A with the specified unit. + public LapseRate ToUnit(LapseRateUnit unit) { var convertedValue = GetValueAs(unit); - return new LapseRate(convertedValue, unit); + return new LapseRate(convertedValue, unit); } /// @@ -603,7 +603,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public LapseRate ToUnit(UnitSystem unitSystem) + public LapseRate ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -646,10 +646,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal LapseRate ToBaseUnit() + internal LapseRate ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new LapseRate(baseUnitValue, BaseUnit); + return new LapseRate(baseUnitValue, BaseUnit); } private double GetValueAs(LapseRateUnit unit) @@ -758,7 +758,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(LapseRate)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(LapseRate)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -768,12 +768,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(LapseRate)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(LapseRate)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(LapseRate)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(LapseRate)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -818,16 +818,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(LapseRate)) + if(conversionType == typeof(LapseRate)) return this; else if(conversionType == typeof(LapseRateUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return LapseRate.QuantityType; + return LapseRate.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return LapseRate.BaseDimensions; + return LapseRate.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(LapseRate)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(LapseRate)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs index ad84dda024..a73cd7d2d7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Many different units of length have been used around the world. The main units in modern use are U.S. customary units in the United States and the Metric system elsewhere. British Imperial units are still used for some purposes in the United Kingdom and some other countries. The metric system is sub-divided into SI and non-SI units. /// - public partial struct Length : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Length : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,19 +131,19 @@ public Length(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Length, which is Meter. All conversions go via this value. + /// The base unit of , which is Meter. All conversions go via this value. /// public static LengthUnit BaseUnit { get; } = LengthUnit.Meter; /// - /// Represents the largest possible value of Length + /// Represents the largest possible value of /// - public static Length MaxValue { get; } = new Length(double.MaxValue, BaseUnit); + public static Length MaxValue { get; } = new Length(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Length + /// Represents the smallest possible value of /// - public static Length MinValue { get; } = new Length(double.MinValue, BaseUnit); + public static Length MinValue { get; } = new Length(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -151,14 +151,14 @@ public Length(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Length; /// - /// All units of measurement for the Length quantity. + /// All units of measurement for the quantity. /// public static LengthUnit[] Units { get; } = Enum.GetValues(typeof(LengthUnit)).Cast().Except(new LengthUnit[]{ LengthUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Meter. /// - public static Length Zero { get; } = new Length(0, BaseUnit); + public static Length Zero { get; } = new Length(0, BaseUnit); #endregion @@ -183,174 +183,174 @@ public Length(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Length.QuantityType; + public QuantityType Type => Length.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Length.BaseDimensions; + public BaseDimensions Dimensions => Length.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Length in AstronomicalUnits. + /// Get in AstronomicalUnits. /// public double AstronomicalUnits => As(LengthUnit.AstronomicalUnit); /// - /// Get Length in Centimeters. + /// Get in Centimeters. /// public double Centimeters => As(LengthUnit.Centimeter); /// - /// Get Length in Decimeters. + /// Get in Decimeters. /// public double Decimeters => As(LengthUnit.Decimeter); /// - /// Get Length in DtpPicas. + /// Get in DtpPicas. /// public double DtpPicas => As(LengthUnit.DtpPica); /// - /// Get Length in DtpPoints. + /// Get in DtpPoints. /// public double DtpPoints => As(LengthUnit.DtpPoint); /// - /// Get Length in Fathoms. + /// Get in Fathoms. /// public double Fathoms => As(LengthUnit.Fathom); /// - /// Get Length in Feet. + /// Get in Feet. /// public double Feet => As(LengthUnit.Foot); /// - /// Get Length in Hands. + /// Get in Hands. /// public double Hands => As(LengthUnit.Hand); /// - /// Get Length in Hectometers. + /// Get in Hectometers. /// public double Hectometers => As(LengthUnit.Hectometer); /// - /// Get Length in Inches. + /// Get in Inches. /// public double Inches => As(LengthUnit.Inch); /// - /// Get Length in KilolightYears. + /// Get in KilolightYears. /// public double KilolightYears => As(LengthUnit.KilolightYear); /// - /// Get Length in Kilometers. + /// Get in Kilometers. /// public double Kilometers => As(LengthUnit.Kilometer); /// - /// Get Length in Kiloparsecs. + /// Get in Kiloparsecs. /// public double Kiloparsecs => As(LengthUnit.Kiloparsec); /// - /// Get Length in LightYears. + /// Get in LightYears. /// public double LightYears => As(LengthUnit.LightYear); /// - /// Get Length in MegalightYears. + /// Get in MegalightYears. /// public double MegalightYears => As(LengthUnit.MegalightYear); /// - /// Get Length in Megaparsecs. + /// Get in Megaparsecs. /// public double Megaparsecs => As(LengthUnit.Megaparsec); /// - /// Get Length in Meters. + /// Get in Meters. /// public double Meters => As(LengthUnit.Meter); /// - /// Get Length in Microinches. + /// Get in Microinches. /// public double Microinches => As(LengthUnit.Microinch); /// - /// Get Length in Micrometers. + /// Get in Micrometers. /// public double Micrometers => As(LengthUnit.Micrometer); /// - /// Get Length in Mils. + /// Get in Mils. /// public double Mils => As(LengthUnit.Mil); /// - /// Get Length in Miles. + /// Get in Miles. /// public double Miles => As(LengthUnit.Mile); /// - /// Get Length in Millimeters. + /// Get in Millimeters. /// public double Millimeters => As(LengthUnit.Millimeter); /// - /// Get Length in Nanometers. + /// Get in Nanometers. /// public double Nanometers => As(LengthUnit.Nanometer); /// - /// Get Length in NauticalMiles. + /// Get in NauticalMiles. /// public double NauticalMiles => As(LengthUnit.NauticalMile); /// - /// Get Length in Parsecs. + /// Get in Parsecs. /// public double Parsecs => As(LengthUnit.Parsec); /// - /// Get Length in PrinterPicas. + /// Get in PrinterPicas. /// public double PrinterPicas => As(LengthUnit.PrinterPica); /// - /// Get Length in PrinterPoints. + /// Get in PrinterPoints. /// public double PrinterPoints => As(LengthUnit.PrinterPoint); /// - /// Get Length in Shackles. + /// Get in Shackles. /// public double Shackles => As(LengthUnit.Shackle); /// - /// Get Length in SolarRadiuses. + /// Get in SolarRadiuses. /// public double SolarRadiuses => As(LengthUnit.SolarRadius); /// - /// Get Length in Twips. + /// Get in Twips. /// public double Twips => As(LengthUnit.Twip); /// - /// Get Length in UsSurveyFeet. + /// Get in UsSurveyFeet. /// public double UsSurveyFeet => As(LengthUnit.UsSurveyFoot); /// - /// Get Length in Yards. + /// Get in Yards. /// public double Yards => As(LengthUnit.Yard); @@ -384,303 +384,303 @@ public static string GetAbbreviation(LengthUnit unit, [CanBeNull] IFormatProvide #region Static Factory Methods /// - /// Get Length from AstronomicalUnits. + /// Get from AstronomicalUnits. /// /// If value is NaN or Infinity. - public static Length FromAstronomicalUnits(QuantityValue astronomicalunits) + public static Length FromAstronomicalUnits(QuantityValue astronomicalunits) { double value = (double) astronomicalunits; - return new Length(value, LengthUnit.AstronomicalUnit); + return new Length(value, LengthUnit.AstronomicalUnit); } /// - /// Get Length from Centimeters. + /// Get from Centimeters. /// /// If value is NaN or Infinity. - public static Length FromCentimeters(QuantityValue centimeters) + public static Length FromCentimeters(QuantityValue centimeters) { double value = (double) centimeters; - return new Length(value, LengthUnit.Centimeter); + return new Length(value, LengthUnit.Centimeter); } /// - /// Get Length from Decimeters. + /// Get from Decimeters. /// /// If value is NaN or Infinity. - public static Length FromDecimeters(QuantityValue decimeters) + public static Length FromDecimeters(QuantityValue decimeters) { double value = (double) decimeters; - return new Length(value, LengthUnit.Decimeter); + return new Length(value, LengthUnit.Decimeter); } /// - /// Get Length from DtpPicas. + /// Get from DtpPicas. /// /// If value is NaN or Infinity. - public static Length FromDtpPicas(QuantityValue dtppicas) + public static Length FromDtpPicas(QuantityValue dtppicas) { double value = (double) dtppicas; - return new Length(value, LengthUnit.DtpPica); + return new Length(value, LengthUnit.DtpPica); } /// - /// Get Length from DtpPoints. + /// Get from DtpPoints. /// /// If value is NaN or Infinity. - public static Length FromDtpPoints(QuantityValue dtppoints) + public static Length FromDtpPoints(QuantityValue dtppoints) { double value = (double) dtppoints; - return new Length(value, LengthUnit.DtpPoint); + return new Length(value, LengthUnit.DtpPoint); } /// - /// Get Length from Fathoms. + /// Get from Fathoms. /// /// If value is NaN or Infinity. - public static Length FromFathoms(QuantityValue fathoms) + public static Length FromFathoms(QuantityValue fathoms) { double value = (double) fathoms; - return new Length(value, LengthUnit.Fathom); + return new Length(value, LengthUnit.Fathom); } /// - /// Get Length from Feet. + /// Get from Feet. /// /// If value is NaN or Infinity. - public static Length FromFeet(QuantityValue feet) + public static Length FromFeet(QuantityValue feet) { double value = (double) feet; - return new Length(value, LengthUnit.Foot); + return new Length(value, LengthUnit.Foot); } /// - /// Get Length from Hands. + /// Get from Hands. /// /// If value is NaN or Infinity. - public static Length FromHands(QuantityValue hands) + public static Length FromHands(QuantityValue hands) { double value = (double) hands; - return new Length(value, LengthUnit.Hand); + return new Length(value, LengthUnit.Hand); } /// - /// Get Length from Hectometers. + /// Get from Hectometers. /// /// If value is NaN or Infinity. - public static Length FromHectometers(QuantityValue hectometers) + public static Length FromHectometers(QuantityValue hectometers) { double value = (double) hectometers; - return new Length(value, LengthUnit.Hectometer); + return new Length(value, LengthUnit.Hectometer); } /// - /// Get Length from Inches. + /// Get from Inches. /// /// If value is NaN or Infinity. - public static Length FromInches(QuantityValue inches) + public static Length FromInches(QuantityValue inches) { double value = (double) inches; - return new Length(value, LengthUnit.Inch); + return new Length(value, LengthUnit.Inch); } /// - /// Get Length from KilolightYears. + /// Get from KilolightYears. /// /// If value is NaN or Infinity. - public static Length FromKilolightYears(QuantityValue kilolightyears) + public static Length FromKilolightYears(QuantityValue kilolightyears) { double value = (double) kilolightyears; - return new Length(value, LengthUnit.KilolightYear); + return new Length(value, LengthUnit.KilolightYear); } /// - /// Get Length from Kilometers. + /// Get from Kilometers. /// /// If value is NaN or Infinity. - public static Length FromKilometers(QuantityValue kilometers) + public static Length FromKilometers(QuantityValue kilometers) { double value = (double) kilometers; - return new Length(value, LengthUnit.Kilometer); + return new Length(value, LengthUnit.Kilometer); } /// - /// Get Length from Kiloparsecs. + /// Get from Kiloparsecs. /// /// If value is NaN or Infinity. - public static Length FromKiloparsecs(QuantityValue kiloparsecs) + public static Length FromKiloparsecs(QuantityValue kiloparsecs) { double value = (double) kiloparsecs; - return new Length(value, LengthUnit.Kiloparsec); + return new Length(value, LengthUnit.Kiloparsec); } /// - /// Get Length from LightYears. + /// Get from LightYears. /// /// If value is NaN or Infinity. - public static Length FromLightYears(QuantityValue lightyears) + public static Length FromLightYears(QuantityValue lightyears) { double value = (double) lightyears; - return new Length(value, LengthUnit.LightYear); + return new Length(value, LengthUnit.LightYear); } /// - /// Get Length from MegalightYears. + /// Get from MegalightYears. /// /// If value is NaN or Infinity. - public static Length FromMegalightYears(QuantityValue megalightyears) + public static Length FromMegalightYears(QuantityValue megalightyears) { double value = (double) megalightyears; - return new Length(value, LengthUnit.MegalightYear); + return new Length(value, LengthUnit.MegalightYear); } /// - /// Get Length from Megaparsecs. + /// Get from Megaparsecs. /// /// If value is NaN or Infinity. - public static Length FromMegaparsecs(QuantityValue megaparsecs) + public static Length FromMegaparsecs(QuantityValue megaparsecs) { double value = (double) megaparsecs; - return new Length(value, LengthUnit.Megaparsec); + return new Length(value, LengthUnit.Megaparsec); } /// - /// Get Length from Meters. + /// Get from Meters. /// /// If value is NaN or Infinity. - public static Length FromMeters(QuantityValue meters) + public static Length FromMeters(QuantityValue meters) { double value = (double) meters; - return new Length(value, LengthUnit.Meter); + return new Length(value, LengthUnit.Meter); } /// - /// Get Length from Microinches. + /// Get from Microinches. /// /// If value is NaN or Infinity. - public static Length FromMicroinches(QuantityValue microinches) + public static Length FromMicroinches(QuantityValue microinches) { double value = (double) microinches; - return new Length(value, LengthUnit.Microinch); + return new Length(value, LengthUnit.Microinch); } /// - /// Get Length from Micrometers. + /// Get from Micrometers. /// /// If value is NaN or Infinity. - public static Length FromMicrometers(QuantityValue micrometers) + public static Length FromMicrometers(QuantityValue micrometers) { double value = (double) micrometers; - return new Length(value, LengthUnit.Micrometer); + return new Length(value, LengthUnit.Micrometer); } /// - /// Get Length from Mils. + /// Get from Mils. /// /// If value is NaN or Infinity. - public static Length FromMils(QuantityValue mils) + public static Length FromMils(QuantityValue mils) { double value = (double) mils; - return new Length(value, LengthUnit.Mil); + return new Length(value, LengthUnit.Mil); } /// - /// Get Length from Miles. + /// Get from Miles. /// /// If value is NaN or Infinity. - public static Length FromMiles(QuantityValue miles) + public static Length FromMiles(QuantityValue miles) { double value = (double) miles; - return new Length(value, LengthUnit.Mile); + return new Length(value, LengthUnit.Mile); } /// - /// Get Length from Millimeters. + /// Get from Millimeters. /// /// If value is NaN or Infinity. - public static Length FromMillimeters(QuantityValue millimeters) + public static Length FromMillimeters(QuantityValue millimeters) { double value = (double) millimeters; - return new Length(value, LengthUnit.Millimeter); + return new Length(value, LengthUnit.Millimeter); } /// - /// Get Length from Nanometers. + /// Get from Nanometers. /// /// If value is NaN or Infinity. - public static Length FromNanometers(QuantityValue nanometers) + public static Length FromNanometers(QuantityValue nanometers) { double value = (double) nanometers; - return new Length(value, LengthUnit.Nanometer); + return new Length(value, LengthUnit.Nanometer); } /// - /// Get Length from NauticalMiles. + /// Get from NauticalMiles. /// /// If value is NaN or Infinity. - public static Length FromNauticalMiles(QuantityValue nauticalmiles) + public static Length FromNauticalMiles(QuantityValue nauticalmiles) { double value = (double) nauticalmiles; - return new Length(value, LengthUnit.NauticalMile); + return new Length(value, LengthUnit.NauticalMile); } /// - /// Get Length from Parsecs. + /// Get from Parsecs. /// /// If value is NaN or Infinity. - public static Length FromParsecs(QuantityValue parsecs) + public static Length FromParsecs(QuantityValue parsecs) { double value = (double) parsecs; - return new Length(value, LengthUnit.Parsec); + return new Length(value, LengthUnit.Parsec); } /// - /// Get Length from PrinterPicas. + /// Get from PrinterPicas. /// /// If value is NaN or Infinity. - public static Length FromPrinterPicas(QuantityValue printerpicas) + public static Length FromPrinterPicas(QuantityValue printerpicas) { double value = (double) printerpicas; - return new Length(value, LengthUnit.PrinterPica); + return new Length(value, LengthUnit.PrinterPica); } /// - /// Get Length from PrinterPoints. + /// Get from PrinterPoints. /// /// If value is NaN or Infinity. - public static Length FromPrinterPoints(QuantityValue printerpoints) + public static Length FromPrinterPoints(QuantityValue printerpoints) { double value = (double) printerpoints; - return new Length(value, LengthUnit.PrinterPoint); + return new Length(value, LengthUnit.PrinterPoint); } /// - /// Get Length from Shackles. + /// Get from Shackles. /// /// If value is NaN or Infinity. - public static Length FromShackles(QuantityValue shackles) + public static Length FromShackles(QuantityValue shackles) { double value = (double) shackles; - return new Length(value, LengthUnit.Shackle); + return new Length(value, LengthUnit.Shackle); } /// - /// Get Length from SolarRadiuses. + /// Get from SolarRadiuses. /// /// If value is NaN or Infinity. - public static Length FromSolarRadiuses(QuantityValue solarradiuses) + public static Length FromSolarRadiuses(QuantityValue solarradiuses) { double value = (double) solarradiuses; - return new Length(value, LengthUnit.SolarRadius); + return new Length(value, LengthUnit.SolarRadius); } /// - /// Get Length from Twips. + /// Get from Twips. /// /// If value is NaN or Infinity. - public static Length FromTwips(QuantityValue twips) + public static Length FromTwips(QuantityValue twips) { double value = (double) twips; - return new Length(value, LengthUnit.Twip); + return new Length(value, LengthUnit.Twip); } /// - /// Get Length from UsSurveyFeet. + /// Get from UsSurveyFeet. /// /// If value is NaN or Infinity. - public static Length FromUsSurveyFeet(QuantityValue ussurveyfeet) + public static Length FromUsSurveyFeet(QuantityValue ussurveyfeet) { double value = (double) ussurveyfeet; - return new Length(value, LengthUnit.UsSurveyFoot); + return new Length(value, LengthUnit.UsSurveyFoot); } /// - /// Get Length from Yards. + /// Get from Yards. /// /// If value is NaN or Infinity. - public static Length FromYards(QuantityValue yards) + public static Length FromYards(QuantityValue yards) { double value = (double) yards; - return new Length(value, LengthUnit.Yard); + return new Length(value, LengthUnit.Yard); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Length unit value. - public static Length From(QuantityValue value, LengthUnit fromUnit) + /// unit value. + public static Length From(QuantityValue value, LengthUnit fromUnit) { - return new Length((double)value, fromUnit); + return new Length((double)value, fromUnit); } #endregion @@ -709,7 +709,7 @@ public static Length From(QuantityValue value, LengthUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Length Parse(string str) + public static Length Parse(string str) { return Parse(str, null); } @@ -737,9 +737,9 @@ public static Length Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Length Parse(string str, [CanBeNull] IFormatProvider provider) + public static Length Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, LengthUnit>( str, provider, From); @@ -753,7 +753,7 @@ public static Length Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Length result) + public static bool TryParse([CanBeNull] string str, out Length result) { return TryParse(str, null, out result); } @@ -768,9 +768,9 @@ public static bool TryParse([CanBeNull] string str, out Length result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Length result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Length result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, LengthUnit>( str, provider, From, @@ -832,43 +832,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Length #region Arithmetic Operators /// Negate the value. - public static Length operator -(Length right) + public static Length operator -(Length right) { - return new Length(-right.Value, right.Unit); + return new Length(-right.Value, right.Unit); } - /// Get from adding two . - public static Length operator +(Length left, Length right) + /// Get from adding two . + public static Length operator +(Length left, Length right) { - return new Length(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Length(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Length operator -(Length left, Length right) + /// Get from subtracting two . + public static Length operator -(Length left, Length right) { - return new Length(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Length(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Length operator *(double left, Length right) + /// Get from multiplying value and . + public static Length operator *(double left, Length right) { - return new Length(left * right.Value, right.Unit); + return new Length(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Length operator *(Length left, double right) + /// Get from multiplying value and . + public static Length operator *(Length left, double right) { - return new Length(left.Value * right, left.Unit); + return new Length(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Length operator /(Length left, double right) + /// Get from dividing by value. + public static Length operator /(Length left, double right) { - return new Length(left.Value / right, left.Unit); + return new Length(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Length left, Length right) + /// Get ratio value from dividing by . + public static double operator /(Length left, Length right) { return left.Meters / right.Meters; } @@ -878,39 +878,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Length #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Length left, Length right) + public static bool operator <=(Length left, Length right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Length left, Length right) + public static bool operator >=(Length left, Length right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Length left, Length right) + public static bool operator <(Length left, Length right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Length left, Length right) + public static bool operator >(Length left, Length right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Length left, Length right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Length left, Length right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Length left, Length right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Length left, Length right) { return !(left == right); } @@ -919,37 +919,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Length public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Length objLength)) throw new ArgumentException("Expected type Length.", nameof(obj)); + if(!(obj is Length objLength)) throw new ArgumentException("Expected type Length.", nameof(obj)); return CompareTo(objLength); } /// - public int CompareTo(Length other) + public int CompareTo(Length other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Length objLength)) + if(obj is null || !(obj is Length objLength)) return false; return Equals(objLength); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Length other) + /// Consider using for safely comparing floating point values. + public bool Equals(Length other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Length within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -987,7 +987,7 @@ public bool Equals(Length other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Length other, double tolerance, ComparisonType comparisonType) + public bool Equals(Length other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -1001,7 +1001,7 @@ public bool Equals(Length other, double tolerance, ComparisonType comparisonType /// /// Returns the hash code for this instance. /// - /// A hash code for the current Length. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -1049,13 +1049,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Length to another Length with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Length with the specified unit. - public Length ToUnit(LengthUnit unit) + /// A with the specified unit. + public Length ToUnit(LengthUnit unit) { var convertedValue = GetValueAs(unit); - return new Length(convertedValue, unit); + return new Length(convertedValue, unit); } /// @@ -1068,7 +1068,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Length ToUnit(UnitSystem unitSystem) + public Length ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1142,10 +1142,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Length ToBaseUnit() + internal Length ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Length(baseUnitValue, BaseUnit); + return new Length(baseUnitValue, BaseUnit); } private double GetValueAs(LengthUnit unit) @@ -1285,7 +1285,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Length)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Length)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1295,12 +1295,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Length)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Length)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Length)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Length)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1345,16 +1345,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Length)) + if(conversionType == typeof(Length)) return this; else if(conversionType == typeof(LengthUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Length.QuantityType; + return Length.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Length.BaseDimensions; + return Length.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Length)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Length)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Level.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.g.cs index 3bae838ac1..828b410167 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Level is the logarithm of the ratio of a quantity Q to a reference value of that quantity, Q₀, expressed in dimensionless units. /// - public partial struct Level : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Level : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -101,19 +101,19 @@ public Level(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Level, which is Decibel. All conversions go via this value. + /// The base unit of , which is Decibel. All conversions go via this value. /// public static LevelUnit BaseUnit { get; } = LevelUnit.Decibel; /// - /// Represents the largest possible value of Level + /// Represents the largest possible value of /// - public static Level MaxValue { get; } = new Level(double.MaxValue, BaseUnit); + public static Level MaxValue { get; } = new Level(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Level + /// Represents the smallest possible value of /// - public static Level MinValue { get; } = new Level(double.MinValue, BaseUnit); + public static Level MinValue { get; } = new Level(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -121,14 +121,14 @@ public Level(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Level; /// - /// All units of measurement for the Level quantity. + /// All units of measurement for the quantity. /// public static LevelUnit[] Units { get; } = Enum.GetValues(typeof(LevelUnit)).Cast().Except(new LevelUnit[]{ LevelUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Decibel. /// - public static Level Zero { get; } = new Level(0, BaseUnit); + public static Level Zero { get; } = new Level(0, BaseUnit); #endregion @@ -153,24 +153,24 @@ public Level(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Level.QuantityType; + public QuantityType Type => Level.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Level.BaseDimensions; + public BaseDimensions Dimensions => Level.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Level in Decibels. + /// Get in Decibels. /// public double Decibels => As(LevelUnit.Decibel); /// - /// Get Level in Nepers. + /// Get in Nepers. /// public double Nepers => As(LevelUnit.Neper); @@ -204,33 +204,33 @@ public static string GetAbbreviation(LevelUnit unit, [CanBeNull] IFormatProvider #region Static Factory Methods /// - /// Get Level from Decibels. + /// Get from Decibels. /// /// If value is NaN or Infinity. - public static Level FromDecibels(QuantityValue decibels) + public static Level FromDecibels(QuantityValue decibels) { double value = (double) decibels; - return new Level(value, LevelUnit.Decibel); + return new Level(value, LevelUnit.Decibel); } /// - /// Get Level from Nepers. + /// Get from Nepers. /// /// If value is NaN or Infinity. - public static Level FromNepers(QuantityValue nepers) + public static Level FromNepers(QuantityValue nepers) { double value = (double) nepers; - return new Level(value, LevelUnit.Neper); + return new Level(value, LevelUnit.Neper); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Level unit value. - public static Level From(QuantityValue value, LevelUnit fromUnit) + /// unit value. + public static Level From(QuantityValue value, LevelUnit fromUnit) { - return new Level((double)value, fromUnit); + return new Level((double)value, fromUnit); } #endregion @@ -259,7 +259,7 @@ public static Level From(QuantityValue value, LevelUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Level Parse(string str) + public static Level Parse(string str) { return Parse(str, null); } @@ -287,9 +287,9 @@ public static Level Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Level Parse(string str, [CanBeNull] IFormatProvider provider) + public static Level Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, LevelUnit>( str, provider, From); @@ -303,7 +303,7 @@ public static Level Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Level result) + public static bool TryParse([CanBeNull] string str, out Level result) { return TryParse(str, null, out result); } @@ -318,9 +318,9 @@ public static bool TryParse([CanBeNull] string str, out Level result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Level result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Level result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, LevelUnit>( str, provider, From, @@ -382,50 +382,50 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out LevelU #region Logarithmic Arithmetic Operators /// Negate the value. - public static Level operator -(Level right) + public static Level operator -(Level right) { - return new Level(-right.Value, right.Unit); + return new Level(-right.Value, right.Unit); } - /// Get from logarithmic addition of two . - public static Level operator +(Level left, Level right) + /// Get from logarithmic addition of two . + public static Level operator +(Level left, Level right) { // Logarithmic addition // Formula: 10*log10(10^(x/10) + 10^(y/10)) - return new Level(10*Math.Log10(Math.Pow(10, left.Value/10) + Math.Pow(10, right.GetValueAs(left.Unit)/10)), left.Unit); + return new Level(10*Math.Log10(Math.Pow(10, left.Value/10) + Math.Pow(10, right.GetValueAs(left.Unit)/10)), left.Unit); } - /// Get from logarithmic subtraction of two . - public static Level operator -(Level left, Level right) + /// Get from logarithmic subtraction of two . + public static Level operator -(Level left, Level right) { // Logarithmic subtraction // Formula: 10*log10(10^(x/10) - 10^(y/10)) - return new Level(10*Math.Log10(Math.Pow(10, left.Value/10) - Math.Pow(10, right.GetValueAs(left.Unit)/10)), left.Unit); + return new Level(10*Math.Log10(Math.Pow(10, left.Value/10) - Math.Pow(10, right.GetValueAs(left.Unit)/10)), left.Unit); } - /// Get from logarithmic multiplication of value and . - public static Level operator *(double left, Level right) + /// Get from logarithmic multiplication of value and . + public static Level operator *(double left, Level right) { // Logarithmic multiplication = addition - return new Level(left + right.Value, right.Unit); + return new Level(left + right.Value, right.Unit); } - /// Get from logarithmic multiplication of value and . - public static Level operator *(Level left, double right) + /// Get from logarithmic multiplication of value and . + public static Level operator *(Level left, double right) { // Logarithmic multiplication = addition - return new Level(left.Value + (double)right, left.Unit); + return new Level(left.Value + (double)right, left.Unit); } - /// Get from logarithmic division of by value. - public static Level operator /(Level left, double right) + /// Get from logarithmic division of by value. + public static Level operator /(Level left, double right) { // Logarithmic division = subtraction - return new Level(left.Value - (double)right, left.Unit); + return new Level(left.Value - (double)right, left.Unit); } - /// Get ratio value from logarithmic division of by . - public static double operator /(Level left, Level right) + /// Get ratio value from logarithmic division of by . + public static double operator /(Level left, Level right) { // Logarithmic division = subtraction return Convert.ToDouble(left.Value - right.GetValueAs(left.Unit)); @@ -436,39 +436,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out LevelU #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Level left, Level right) + public static bool operator <=(Level left, Level right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Level left, Level right) + public static bool operator >=(Level left, Level right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Level left, Level right) + public static bool operator <(Level left, Level right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Level left, Level right) + public static bool operator >(Level left, Level right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Level left, Level right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Level left, Level right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Level left, Level right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Level left, Level right) { return !(left == right); } @@ -477,37 +477,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out LevelU public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Level objLevel)) throw new ArgumentException("Expected type Level.", nameof(obj)); + if(!(obj is Level objLevel)) throw new ArgumentException("Expected type Level.", nameof(obj)); return CompareTo(objLevel); } /// - public int CompareTo(Level other) + public int CompareTo(Level other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Level objLevel)) + if(obj is null || !(obj is Level objLevel)) return false; return Equals(objLevel); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Level other) + /// Consider using for safely comparing floating point values. + public bool Equals(Level other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Level within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -545,7 +545,7 @@ public bool Equals(Level other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Level other, double tolerance, ComparisonType comparisonType) + public bool Equals(Level other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -559,7 +559,7 @@ public bool Equals(Level other, double tolerance, ComparisonType comparisonType) /// /// Returns the hash code for this instance. /// - /// A hash code for the current Level. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -607,13 +607,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Level to another Level with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Level with the specified unit. - public Level ToUnit(LevelUnit unit) + /// A with the specified unit. + public Level ToUnit(LevelUnit unit) { var convertedValue = GetValueAs(unit); - return new Level(convertedValue, unit); + return new Level(convertedValue, unit); } /// @@ -626,7 +626,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Level ToUnit(UnitSystem unitSystem) + public Level ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -670,10 +670,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Level ToBaseUnit() + internal Level ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Level(baseUnitValue, BaseUnit); + return new Level(baseUnitValue, BaseUnit); } private double GetValueAs(LevelUnit unit) @@ -783,7 +783,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Level)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Level)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -793,12 +793,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Level)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Level)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Level)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Level)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -843,16 +843,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Level)) + if(conversionType == typeof(Level)) return this; else if(conversionType == typeof(LevelUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Level.QuantityType; + return Level.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Level.BaseDimensions; + return Level.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Level)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Level)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs index a8cf2b155f..cd6cf643cb 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// http://en.wikipedia.org/wiki/Linear_density /// - public partial struct LinearDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct LinearDensity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -105,19 +105,19 @@ public LinearDensity(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of LinearDensity, which is KilogramPerMeter. All conversions go via this value. + /// The base unit of , which is KilogramPerMeter. All conversions go via this value. /// public static LinearDensityUnit BaseUnit { get; } = LinearDensityUnit.KilogramPerMeter; /// - /// Represents the largest possible value of LinearDensity + /// Represents the largest possible value of /// - public static LinearDensity MaxValue { get; } = new LinearDensity(double.MaxValue, BaseUnit); + public static LinearDensity MaxValue { get; } = new LinearDensity(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of LinearDensity + /// Represents the smallest possible value of /// - public static LinearDensity MinValue { get; } = new LinearDensity(double.MinValue, BaseUnit); + public static LinearDensity MinValue { get; } = new LinearDensity(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -125,14 +125,14 @@ public LinearDensity(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.LinearDensity; /// - /// All units of measurement for the LinearDensity quantity. + /// All units of measurement for the quantity. /// public static LinearDensityUnit[] Units { get; } = Enum.GetValues(typeof(LinearDensityUnit)).Cast().Except(new LinearDensityUnit[]{ LinearDensityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerMeter. /// - public static LinearDensity Zero { get; } = new LinearDensity(0, BaseUnit); + public static LinearDensity Zero { get; } = new LinearDensity(0, BaseUnit); #endregion @@ -157,29 +157,29 @@ public LinearDensity(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => LinearDensity.QuantityType; + public QuantityType Type => LinearDensity.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => LinearDensity.BaseDimensions; + public BaseDimensions Dimensions => LinearDensity.BaseDimensions; #endregion #region Conversion Properties /// - /// Get LinearDensity in GramsPerMeter. + /// Get in GramsPerMeter. /// public double GramsPerMeter => As(LinearDensityUnit.GramPerMeter); /// - /// Get LinearDensity in KilogramsPerMeter. + /// Get in KilogramsPerMeter. /// public double KilogramsPerMeter => As(LinearDensityUnit.KilogramPerMeter); /// - /// Get LinearDensity in PoundsPerFoot. + /// Get in PoundsPerFoot. /// public double PoundsPerFoot => As(LinearDensityUnit.PoundPerFoot); @@ -213,42 +213,42 @@ public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] IFormat #region Static Factory Methods /// - /// Get LinearDensity from GramsPerMeter. + /// Get from GramsPerMeter. /// /// If value is NaN or Infinity. - public static LinearDensity FromGramsPerMeter(QuantityValue gramspermeter) + public static LinearDensity FromGramsPerMeter(QuantityValue gramspermeter) { double value = (double) gramspermeter; - return new LinearDensity(value, LinearDensityUnit.GramPerMeter); + return new LinearDensity(value, LinearDensityUnit.GramPerMeter); } /// - /// Get LinearDensity from KilogramsPerMeter. + /// Get from KilogramsPerMeter. /// /// If value is NaN or Infinity. - public static LinearDensity FromKilogramsPerMeter(QuantityValue kilogramspermeter) + public static LinearDensity FromKilogramsPerMeter(QuantityValue kilogramspermeter) { double value = (double) kilogramspermeter; - return new LinearDensity(value, LinearDensityUnit.KilogramPerMeter); + return new LinearDensity(value, LinearDensityUnit.KilogramPerMeter); } /// - /// Get LinearDensity from PoundsPerFoot. + /// Get from PoundsPerFoot. /// /// If value is NaN or Infinity. - public static LinearDensity FromPoundsPerFoot(QuantityValue poundsperfoot) + public static LinearDensity FromPoundsPerFoot(QuantityValue poundsperfoot) { double value = (double) poundsperfoot; - return new LinearDensity(value, LinearDensityUnit.PoundPerFoot); + return new LinearDensity(value, LinearDensityUnit.PoundPerFoot); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// LinearDensity unit value. - public static LinearDensity From(QuantityValue value, LinearDensityUnit fromUnit) + /// unit value. + public static LinearDensity From(QuantityValue value, LinearDensityUnit fromUnit) { - return new LinearDensity((double)value, fromUnit); + return new LinearDensity((double)value, fromUnit); } #endregion @@ -277,7 +277,7 @@ public static LinearDensity From(QuantityValue value, LinearDensityUnit fromUnit /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static LinearDensity Parse(string str) + public static LinearDensity Parse(string str) { return Parse(str, null); } @@ -305,9 +305,9 @@ public static LinearDensity Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static LinearDensity Parse(string str, [CanBeNull] IFormatProvider provider) + public static LinearDensity Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, LinearDensityUnit>( str, provider, From); @@ -321,7 +321,7 @@ public static LinearDensity Parse(string str, [CanBeNull] IFormatProvider provid /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out LinearDensity result) + public static bool TryParse([CanBeNull] string str, out LinearDensity result) { return TryParse(str, null, out result); } @@ -336,9 +336,9 @@ public static bool TryParse([CanBeNull] string str, out LinearDensity result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LinearDensity result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LinearDensity result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, LinearDensityUnit>( str, provider, From, @@ -400,43 +400,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Linear #region Arithmetic Operators /// Negate the value. - public static LinearDensity operator -(LinearDensity right) + public static LinearDensity operator -(LinearDensity right) { - return new LinearDensity(-right.Value, right.Unit); + return new LinearDensity(-right.Value, right.Unit); } - /// Get from adding two . - public static LinearDensity operator +(LinearDensity left, LinearDensity right) + /// Get from adding two . + public static LinearDensity operator +(LinearDensity left, LinearDensity right) { - return new LinearDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new LinearDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static LinearDensity operator -(LinearDensity left, LinearDensity right) + /// Get from subtracting two . + public static LinearDensity operator -(LinearDensity left, LinearDensity right) { - return new LinearDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new LinearDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static LinearDensity operator *(double left, LinearDensity right) + /// Get from multiplying value and . + public static LinearDensity operator *(double left, LinearDensity right) { - return new LinearDensity(left * right.Value, right.Unit); + return new LinearDensity(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static LinearDensity operator *(LinearDensity left, double right) + /// Get from multiplying value and . + public static LinearDensity operator *(LinearDensity left, double right) { - return new LinearDensity(left.Value * right, left.Unit); + return new LinearDensity(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static LinearDensity operator /(LinearDensity left, double right) + /// Get from dividing by value. + public static LinearDensity operator /(LinearDensity left, double right) { - return new LinearDensity(left.Value / right, left.Unit); + return new LinearDensity(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(LinearDensity left, LinearDensity right) + /// Get ratio value from dividing by . + public static double operator /(LinearDensity left, LinearDensity right) { return left.KilogramsPerMeter / right.KilogramsPerMeter; } @@ -446,39 +446,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Linear #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(LinearDensity left, LinearDensity right) + public static bool operator <=(LinearDensity left, LinearDensity right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(LinearDensity left, LinearDensity right) + public static bool operator >=(LinearDensity left, LinearDensity right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(LinearDensity left, LinearDensity right) + public static bool operator <(LinearDensity left, LinearDensity right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(LinearDensity left, LinearDensity right) + public static bool operator >(LinearDensity left, LinearDensity right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(LinearDensity left, LinearDensity right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(LinearDensity left, LinearDensity right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(LinearDensity left, LinearDensity right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(LinearDensity left, LinearDensity right) { return !(left == right); } @@ -487,37 +487,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Linear public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LinearDensity objLinearDensity)) throw new ArgumentException("Expected type LinearDensity.", nameof(obj)); + if(!(obj is LinearDensity objLinearDensity)) throw new ArgumentException("Expected type LinearDensity.", nameof(obj)); return CompareTo(objLinearDensity); } /// - public int CompareTo(LinearDensity other) + public int CompareTo(LinearDensity other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is LinearDensity objLinearDensity)) + if(obj is null || !(obj is LinearDensity objLinearDensity)) return false; return Equals(objLinearDensity); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(LinearDensity other) + /// Consider using for safely comparing floating point values. + public bool Equals(LinearDensity other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another LinearDensity within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -555,7 +555,7 @@ public bool Equals(LinearDensity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(LinearDensity other, double tolerance, ComparisonType comparisonType) + public bool Equals(LinearDensity other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -569,7 +569,7 @@ public bool Equals(LinearDensity other, double tolerance, ComparisonType compari /// /// Returns the hash code for this instance. /// - /// A hash code for the current LinearDensity. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -617,13 +617,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this LinearDensity to another LinearDensity with the unit representation . + /// Converts this to another with the unit representation . /// - /// A LinearDensity with the specified unit. - public LinearDensity ToUnit(LinearDensityUnit unit) + /// A with the specified unit. + public LinearDensity ToUnit(LinearDensityUnit unit) { var convertedValue = GetValueAs(unit); - return new LinearDensity(convertedValue, unit); + return new LinearDensity(convertedValue, unit); } /// @@ -636,7 +636,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public LinearDensity ToUnit(UnitSystem unitSystem) + public LinearDensity ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -681,10 +681,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal LinearDensity ToBaseUnit() + internal LinearDensity ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new LinearDensity(baseUnitValue, BaseUnit); + return new LinearDensity(baseUnitValue, BaseUnit); } private double GetValueAs(LinearDensityUnit unit) @@ -795,7 +795,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(LinearDensity)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(LinearDensity)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -805,12 +805,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(LinearDensity)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(LinearDensity)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(LinearDensity)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(LinearDensity)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -855,16 +855,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(LinearDensity)) + if(conversionType == typeof(LinearDensity)) return this; else if(conversionType == typeof(LinearDensityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return LinearDensity.QuantityType; + return LinearDensity.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return LinearDensity.BaseDimensions; + return LinearDensity.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(LinearDensity)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(LinearDensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs index 7c37d993eb..6cac18ef64 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Luminosity /// - public partial struct Luminosity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Luminosity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -116,19 +116,19 @@ public Luminosity(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Luminosity, which is Watt. All conversions go via this value. + /// The base unit of , which is Watt. All conversions go via this value. /// public static LuminosityUnit BaseUnit { get; } = LuminosityUnit.Watt; /// - /// Represents the largest possible value of Luminosity + /// Represents the largest possible value of /// - public static Luminosity MaxValue { get; } = new Luminosity(double.MaxValue, BaseUnit); + public static Luminosity MaxValue { get; } = new Luminosity(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Luminosity + /// Represents the smallest possible value of /// - public static Luminosity MinValue { get; } = new Luminosity(double.MinValue, BaseUnit); + public static Luminosity MinValue { get; } = new Luminosity(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -136,14 +136,14 @@ public Luminosity(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Luminosity; /// - /// All units of measurement for the Luminosity quantity. + /// All units of measurement for the quantity. /// public static LuminosityUnit[] Units { get; } = Enum.GetValues(typeof(LuminosityUnit)).Cast().Except(new LuminosityUnit[]{ LuminosityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Watt. /// - public static Luminosity Zero { get; } = new Luminosity(0, BaseUnit); + public static Luminosity Zero { get; } = new Luminosity(0, BaseUnit); #endregion @@ -168,84 +168,84 @@ public Luminosity(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Luminosity.QuantityType; + public QuantityType Type => Luminosity.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Luminosity.BaseDimensions; + public BaseDimensions Dimensions => Luminosity.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Luminosity in Decawatts. + /// Get in Decawatts. /// public double Decawatts => As(LuminosityUnit.Decawatt); /// - /// Get Luminosity in Deciwatts. + /// Get in Deciwatts. /// public double Deciwatts => As(LuminosityUnit.Deciwatt); /// - /// Get Luminosity in Femtowatts. + /// Get in Femtowatts. /// public double Femtowatts => As(LuminosityUnit.Femtowatt); /// - /// Get Luminosity in Gigawatts. + /// Get in Gigawatts. /// public double Gigawatts => As(LuminosityUnit.Gigawatt); /// - /// Get Luminosity in Kilowatts. + /// Get in Kilowatts. /// public double Kilowatts => As(LuminosityUnit.Kilowatt); /// - /// Get Luminosity in Megawatts. + /// Get in Megawatts. /// public double Megawatts => As(LuminosityUnit.Megawatt); /// - /// Get Luminosity in Microwatts. + /// Get in Microwatts. /// public double Microwatts => As(LuminosityUnit.Microwatt); /// - /// Get Luminosity in Milliwatts. + /// Get in Milliwatts. /// public double Milliwatts => As(LuminosityUnit.Milliwatt); /// - /// Get Luminosity in Nanowatts. + /// Get in Nanowatts. /// public double Nanowatts => As(LuminosityUnit.Nanowatt); /// - /// Get Luminosity in Petawatts. + /// Get in Petawatts. /// public double Petawatts => As(LuminosityUnit.Petawatt); /// - /// Get Luminosity in Picowatts. + /// Get in Picowatts. /// public double Picowatts => As(LuminosityUnit.Picowatt); /// - /// Get Luminosity in SolarLuminosities. + /// Get in SolarLuminosities. /// public double SolarLuminosities => As(LuminosityUnit.SolarLuminosity); /// - /// Get Luminosity in Terawatts. + /// Get in Terawatts. /// public double Terawatts => As(LuminosityUnit.Terawatt); /// - /// Get Luminosity in Watts. + /// Get in Watts. /// public double Watts => As(LuminosityUnit.Watt); @@ -279,141 +279,141 @@ public static string GetAbbreviation(LuminosityUnit unit, [CanBeNull] IFormatPro #region Static Factory Methods /// - /// Get Luminosity from Decawatts. + /// Get from Decawatts. /// /// If value is NaN or Infinity. - public static Luminosity FromDecawatts(QuantityValue decawatts) + public static Luminosity FromDecawatts(QuantityValue decawatts) { double value = (double) decawatts; - return new Luminosity(value, LuminosityUnit.Decawatt); + return new Luminosity(value, LuminosityUnit.Decawatt); } /// - /// Get Luminosity from Deciwatts. + /// Get from Deciwatts. /// /// If value is NaN or Infinity. - public static Luminosity FromDeciwatts(QuantityValue deciwatts) + public static Luminosity FromDeciwatts(QuantityValue deciwatts) { double value = (double) deciwatts; - return new Luminosity(value, LuminosityUnit.Deciwatt); + return new Luminosity(value, LuminosityUnit.Deciwatt); } /// - /// Get Luminosity from Femtowatts. + /// Get from Femtowatts. /// /// If value is NaN or Infinity. - public static Luminosity FromFemtowatts(QuantityValue femtowatts) + public static Luminosity FromFemtowatts(QuantityValue femtowatts) { double value = (double) femtowatts; - return new Luminosity(value, LuminosityUnit.Femtowatt); + return new Luminosity(value, LuminosityUnit.Femtowatt); } /// - /// Get Luminosity from Gigawatts. + /// Get from Gigawatts. /// /// If value is NaN or Infinity. - public static Luminosity FromGigawatts(QuantityValue gigawatts) + public static Luminosity FromGigawatts(QuantityValue gigawatts) { double value = (double) gigawatts; - return new Luminosity(value, LuminosityUnit.Gigawatt); + return new Luminosity(value, LuminosityUnit.Gigawatt); } /// - /// Get Luminosity from Kilowatts. + /// Get from Kilowatts. /// /// If value is NaN or Infinity. - public static Luminosity FromKilowatts(QuantityValue kilowatts) + public static Luminosity FromKilowatts(QuantityValue kilowatts) { double value = (double) kilowatts; - return new Luminosity(value, LuminosityUnit.Kilowatt); + return new Luminosity(value, LuminosityUnit.Kilowatt); } /// - /// Get Luminosity from Megawatts. + /// Get from Megawatts. /// /// If value is NaN or Infinity. - public static Luminosity FromMegawatts(QuantityValue megawatts) + public static Luminosity FromMegawatts(QuantityValue megawatts) { double value = (double) megawatts; - return new Luminosity(value, LuminosityUnit.Megawatt); + return new Luminosity(value, LuminosityUnit.Megawatt); } /// - /// Get Luminosity from Microwatts. + /// Get from Microwatts. /// /// If value is NaN or Infinity. - public static Luminosity FromMicrowatts(QuantityValue microwatts) + public static Luminosity FromMicrowatts(QuantityValue microwatts) { double value = (double) microwatts; - return new Luminosity(value, LuminosityUnit.Microwatt); + return new Luminosity(value, LuminosityUnit.Microwatt); } /// - /// Get Luminosity from Milliwatts. + /// Get from Milliwatts. /// /// If value is NaN or Infinity. - public static Luminosity FromMilliwatts(QuantityValue milliwatts) + public static Luminosity FromMilliwatts(QuantityValue milliwatts) { double value = (double) milliwatts; - return new Luminosity(value, LuminosityUnit.Milliwatt); + return new Luminosity(value, LuminosityUnit.Milliwatt); } /// - /// Get Luminosity from Nanowatts. + /// Get from Nanowatts. /// /// If value is NaN or Infinity. - public static Luminosity FromNanowatts(QuantityValue nanowatts) + public static Luminosity FromNanowatts(QuantityValue nanowatts) { double value = (double) nanowatts; - return new Luminosity(value, LuminosityUnit.Nanowatt); + return new Luminosity(value, LuminosityUnit.Nanowatt); } /// - /// Get Luminosity from Petawatts. + /// Get from Petawatts. /// /// If value is NaN or Infinity. - public static Luminosity FromPetawatts(QuantityValue petawatts) + public static Luminosity FromPetawatts(QuantityValue petawatts) { double value = (double) petawatts; - return new Luminosity(value, LuminosityUnit.Petawatt); + return new Luminosity(value, LuminosityUnit.Petawatt); } /// - /// Get Luminosity from Picowatts. + /// Get from Picowatts. /// /// If value is NaN or Infinity. - public static Luminosity FromPicowatts(QuantityValue picowatts) + public static Luminosity FromPicowatts(QuantityValue picowatts) { double value = (double) picowatts; - return new Luminosity(value, LuminosityUnit.Picowatt); + return new Luminosity(value, LuminosityUnit.Picowatt); } /// - /// Get Luminosity from SolarLuminosities. + /// Get from SolarLuminosities. /// /// If value is NaN or Infinity. - public static Luminosity FromSolarLuminosities(QuantityValue solarluminosities) + public static Luminosity FromSolarLuminosities(QuantityValue solarluminosities) { double value = (double) solarluminosities; - return new Luminosity(value, LuminosityUnit.SolarLuminosity); + return new Luminosity(value, LuminosityUnit.SolarLuminosity); } /// - /// Get Luminosity from Terawatts. + /// Get from Terawatts. /// /// If value is NaN or Infinity. - public static Luminosity FromTerawatts(QuantityValue terawatts) + public static Luminosity FromTerawatts(QuantityValue terawatts) { double value = (double) terawatts; - return new Luminosity(value, LuminosityUnit.Terawatt); + return new Luminosity(value, LuminosityUnit.Terawatt); } /// - /// Get Luminosity from Watts. + /// Get from Watts. /// /// If value is NaN or Infinity. - public static Luminosity FromWatts(QuantityValue watts) + public static Luminosity FromWatts(QuantityValue watts) { double value = (double) watts; - return new Luminosity(value, LuminosityUnit.Watt); + return new Luminosity(value, LuminosityUnit.Watt); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Luminosity unit value. - public static Luminosity From(QuantityValue value, LuminosityUnit fromUnit) + /// unit value. + public static Luminosity From(QuantityValue value, LuminosityUnit fromUnit) { - return new Luminosity((double)value, fromUnit); + return new Luminosity((double)value, fromUnit); } #endregion @@ -442,7 +442,7 @@ public static Luminosity From(QuantityValue value, LuminosityUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Luminosity Parse(string str) + public static Luminosity Parse(string str) { return Parse(str, null); } @@ -470,9 +470,9 @@ public static Luminosity Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Luminosity Parse(string str, [CanBeNull] IFormatProvider provider) + public static Luminosity Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, LuminosityUnit>( str, provider, From); @@ -486,7 +486,7 @@ public static Luminosity Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Luminosity result) + public static bool TryParse([CanBeNull] string str, out Luminosity result) { return TryParse(str, null, out result); } @@ -501,9 +501,9 @@ public static bool TryParse([CanBeNull] string str, out Luminosity result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Luminosity result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Luminosity result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, LuminosityUnit>( str, provider, From, @@ -565,43 +565,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino #region Arithmetic Operators /// Negate the value. - public static Luminosity operator -(Luminosity right) + public static Luminosity operator -(Luminosity right) { - return new Luminosity(-right.Value, right.Unit); + return new Luminosity(-right.Value, right.Unit); } - /// Get from adding two . - public static Luminosity operator +(Luminosity left, Luminosity right) + /// Get from adding two . + public static Luminosity operator +(Luminosity left, Luminosity right) { - return new Luminosity(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Luminosity(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Luminosity operator -(Luminosity left, Luminosity right) + /// Get from subtracting two . + public static Luminosity operator -(Luminosity left, Luminosity right) { - return new Luminosity(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Luminosity(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Luminosity operator *(double left, Luminosity right) + /// Get from multiplying value and . + public static Luminosity operator *(double left, Luminosity right) { - return new Luminosity(left * right.Value, right.Unit); + return new Luminosity(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Luminosity operator *(Luminosity left, double right) + /// Get from multiplying value and . + public static Luminosity operator *(Luminosity left, double right) { - return new Luminosity(left.Value * right, left.Unit); + return new Luminosity(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Luminosity operator /(Luminosity left, double right) + /// Get from dividing by value. + public static Luminosity operator /(Luminosity left, double right) { - return new Luminosity(left.Value / right, left.Unit); + return new Luminosity(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Luminosity left, Luminosity right) + /// Get ratio value from dividing by . + public static double operator /(Luminosity left, Luminosity right) { return left.Watts / right.Watts; } @@ -611,39 +611,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Luminosity left, Luminosity right) + public static bool operator <=(Luminosity left, Luminosity right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Luminosity left, Luminosity right) + public static bool operator >=(Luminosity left, Luminosity right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Luminosity left, Luminosity right) + public static bool operator <(Luminosity left, Luminosity right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Luminosity left, Luminosity right) + public static bool operator >(Luminosity left, Luminosity right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Luminosity left, Luminosity right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Luminosity left, Luminosity right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Luminosity left, Luminosity right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Luminosity left, Luminosity right) { return !(left == right); } @@ -652,37 +652,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Luminosity objLuminosity)) throw new ArgumentException("Expected type Luminosity.", nameof(obj)); + if(!(obj is Luminosity objLuminosity)) throw new ArgumentException("Expected type Luminosity.", nameof(obj)); return CompareTo(objLuminosity); } /// - public int CompareTo(Luminosity other) + public int CompareTo(Luminosity other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Luminosity objLuminosity)) + if(obj is null || !(obj is Luminosity objLuminosity)) return false; return Equals(objLuminosity); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Luminosity other) + /// Consider using for safely comparing floating point values. + public bool Equals(Luminosity other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Luminosity within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -720,7 +720,7 @@ public bool Equals(Luminosity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Luminosity other, double tolerance, ComparisonType comparisonType) + public bool Equals(Luminosity other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -734,7 +734,7 @@ public bool Equals(Luminosity other, double tolerance, ComparisonType comparison /// /// Returns the hash code for this instance. /// - /// A hash code for the current Luminosity. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -782,13 +782,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Luminosity to another Luminosity with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Luminosity with the specified unit. - public Luminosity ToUnit(LuminosityUnit unit) + /// A with the specified unit. + public Luminosity ToUnit(LuminosityUnit unit) { var convertedValue = GetValueAs(unit); - return new Luminosity(convertedValue, unit); + return new Luminosity(convertedValue, unit); } /// @@ -801,7 +801,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Luminosity ToUnit(UnitSystem unitSystem) + public Luminosity ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -857,10 +857,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Luminosity ToBaseUnit() + internal Luminosity ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Luminosity(baseUnitValue, BaseUnit); + return new Luminosity(baseUnitValue, BaseUnit); } private double GetValueAs(LuminosityUnit unit) @@ -982,7 +982,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Luminosity)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Luminosity)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -992,12 +992,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Luminosity)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Luminosity)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Luminosity)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Luminosity)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1042,16 +1042,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Luminosity)) + if(conversionType == typeof(Luminosity)) return this; else if(conversionType == typeof(LuminosityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Luminosity.QuantityType; + return Luminosity.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Luminosity.BaseDimensions; + return Luminosity.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Luminosity)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Luminosity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs index 4c81e7d098..dd8a739de8 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Luminous_flux /// - public partial struct LuminousFlux : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct LuminousFlux : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -103,19 +103,19 @@ public LuminousFlux(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of LuminousFlux, which is Lumen. All conversions go via this value. + /// The base unit of , which is Lumen. All conversions go via this value. /// public static LuminousFluxUnit BaseUnit { get; } = LuminousFluxUnit.Lumen; /// - /// Represents the largest possible value of LuminousFlux + /// Represents the largest possible value of /// - public static LuminousFlux MaxValue { get; } = new LuminousFlux(double.MaxValue, BaseUnit); + public static LuminousFlux MaxValue { get; } = new LuminousFlux(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of LuminousFlux + /// Represents the smallest possible value of /// - public static LuminousFlux MinValue { get; } = new LuminousFlux(double.MinValue, BaseUnit); + public static LuminousFlux MinValue { get; } = new LuminousFlux(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -123,14 +123,14 @@ public LuminousFlux(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.LuminousFlux; /// - /// All units of measurement for the LuminousFlux quantity. + /// All units of measurement for the quantity. /// public static LuminousFluxUnit[] Units { get; } = Enum.GetValues(typeof(LuminousFluxUnit)).Cast().Except(new LuminousFluxUnit[]{ LuminousFluxUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Lumen. /// - public static LuminousFlux Zero { get; } = new LuminousFlux(0, BaseUnit); + public static LuminousFlux Zero { get; } = new LuminousFlux(0, BaseUnit); #endregion @@ -155,19 +155,19 @@ public LuminousFlux(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => LuminousFlux.QuantityType; + public QuantityType Type => LuminousFlux.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => LuminousFlux.BaseDimensions; + public BaseDimensions Dimensions => LuminousFlux.BaseDimensions; #endregion #region Conversion Properties /// - /// Get LuminousFlux in Lumens. + /// Get in Lumens. /// public double Lumens => As(LuminousFluxUnit.Lumen); @@ -201,24 +201,24 @@ public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] IFormatP #region Static Factory Methods /// - /// Get LuminousFlux from Lumens. + /// Get from Lumens. /// /// If value is NaN or Infinity. - public static LuminousFlux FromLumens(QuantityValue lumens) + public static LuminousFlux FromLumens(QuantityValue lumens) { double value = (double) lumens; - return new LuminousFlux(value, LuminousFluxUnit.Lumen); + return new LuminousFlux(value, LuminousFluxUnit.Lumen); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// LuminousFlux unit value. - public static LuminousFlux From(QuantityValue value, LuminousFluxUnit fromUnit) + /// unit value. + public static LuminousFlux From(QuantityValue value, LuminousFluxUnit fromUnit) { - return new LuminousFlux((double)value, fromUnit); + return new LuminousFlux((double)value, fromUnit); } #endregion @@ -247,7 +247,7 @@ public static LuminousFlux From(QuantityValue value, LuminousFluxUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static LuminousFlux Parse(string str) + public static LuminousFlux Parse(string str) { return Parse(str, null); } @@ -275,9 +275,9 @@ public static LuminousFlux Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static LuminousFlux Parse(string str, [CanBeNull] IFormatProvider provider) + public static LuminousFlux Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, LuminousFluxUnit>( str, provider, From); @@ -291,7 +291,7 @@ public static LuminousFlux Parse(string str, [CanBeNull] IFormatProvider provide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out LuminousFlux result) + public static bool TryParse([CanBeNull] string str, out LuminousFlux result) { return TryParse(str, null, out result); } @@ -306,9 +306,9 @@ public static bool TryParse([CanBeNull] string str, out LuminousFlux result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousFlux result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousFlux result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, LuminousFluxUnit>( str, provider, From, @@ -370,43 +370,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino #region Arithmetic Operators /// Negate the value. - public static LuminousFlux operator -(LuminousFlux right) + public static LuminousFlux operator -(LuminousFlux right) { - return new LuminousFlux(-right.Value, right.Unit); + return new LuminousFlux(-right.Value, right.Unit); } - /// Get from adding two . - public static LuminousFlux operator +(LuminousFlux left, LuminousFlux right) + /// Get from adding two . + public static LuminousFlux operator +(LuminousFlux left, LuminousFlux right) { - return new LuminousFlux(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new LuminousFlux(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static LuminousFlux operator -(LuminousFlux left, LuminousFlux right) + /// Get from subtracting two . + public static LuminousFlux operator -(LuminousFlux left, LuminousFlux right) { - return new LuminousFlux(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new LuminousFlux(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static LuminousFlux operator *(double left, LuminousFlux right) + /// Get from multiplying value and . + public static LuminousFlux operator *(double left, LuminousFlux right) { - return new LuminousFlux(left * right.Value, right.Unit); + return new LuminousFlux(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static LuminousFlux operator *(LuminousFlux left, double right) + /// Get from multiplying value and . + public static LuminousFlux operator *(LuminousFlux left, double right) { - return new LuminousFlux(left.Value * right, left.Unit); + return new LuminousFlux(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static LuminousFlux operator /(LuminousFlux left, double right) + /// Get from dividing by value. + public static LuminousFlux operator /(LuminousFlux left, double right) { - return new LuminousFlux(left.Value / right, left.Unit); + return new LuminousFlux(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(LuminousFlux left, LuminousFlux right) + /// Get ratio value from dividing by . + public static double operator /(LuminousFlux left, LuminousFlux right) { return left.Lumens / right.Lumens; } @@ -416,39 +416,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(LuminousFlux left, LuminousFlux right) + public static bool operator <=(LuminousFlux left, LuminousFlux right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(LuminousFlux left, LuminousFlux right) + public static bool operator >=(LuminousFlux left, LuminousFlux right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(LuminousFlux left, LuminousFlux right) + public static bool operator <(LuminousFlux left, LuminousFlux right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(LuminousFlux left, LuminousFlux right) + public static bool operator >(LuminousFlux left, LuminousFlux right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(LuminousFlux left, LuminousFlux right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(LuminousFlux left, LuminousFlux right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(LuminousFlux left, LuminousFlux right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(LuminousFlux left, LuminousFlux right) { return !(left == right); } @@ -457,37 +457,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LuminousFlux objLuminousFlux)) throw new ArgumentException("Expected type LuminousFlux.", nameof(obj)); + if(!(obj is LuminousFlux objLuminousFlux)) throw new ArgumentException("Expected type LuminousFlux.", nameof(obj)); return CompareTo(objLuminousFlux); } /// - public int CompareTo(LuminousFlux other) + public int CompareTo(LuminousFlux other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is LuminousFlux objLuminousFlux)) + if(obj is null || !(obj is LuminousFlux objLuminousFlux)) return false; return Equals(objLuminousFlux); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(LuminousFlux other) + /// Consider using for safely comparing floating point values. + public bool Equals(LuminousFlux other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another LuminousFlux within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -525,7 +525,7 @@ public bool Equals(LuminousFlux other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(LuminousFlux other, double tolerance, ComparisonType comparisonType) + public bool Equals(LuminousFlux other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -539,7 +539,7 @@ public bool Equals(LuminousFlux other, double tolerance, ComparisonType comparis /// /// Returns the hash code for this instance. /// - /// A hash code for the current LuminousFlux. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -587,13 +587,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this LuminousFlux to another LuminousFlux with the unit representation . + /// Converts this to another with the unit representation . /// - /// A LuminousFlux with the specified unit. - public LuminousFlux ToUnit(LuminousFluxUnit unit) + /// A with the specified unit. + public LuminousFlux ToUnit(LuminousFluxUnit unit) { var convertedValue = GetValueAs(unit); - return new LuminousFlux(convertedValue, unit); + return new LuminousFlux(convertedValue, unit); } /// @@ -606,7 +606,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public LuminousFlux ToUnit(UnitSystem unitSystem) + public LuminousFlux ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -649,10 +649,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal LuminousFlux ToBaseUnit() + internal LuminousFlux ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new LuminousFlux(baseUnitValue, BaseUnit); + return new LuminousFlux(baseUnitValue, BaseUnit); } private double GetValueAs(LuminousFluxUnit unit) @@ -761,7 +761,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -771,12 +771,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -821,16 +821,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(LuminousFlux)) + if(conversionType == typeof(LuminousFlux)) return this; else if(conversionType == typeof(LuminousFluxUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return LuminousFlux.QuantityType; + return LuminousFlux.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return LuminousFlux.BaseDimensions; + return LuminousFlux.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs index c63e99ab0c..de5b80f576 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Luminous_intensity /// - public partial struct LuminousIntensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct LuminousIntensity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -103,19 +103,19 @@ public LuminousIntensity(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of LuminousIntensity, which is Candela. All conversions go via this value. + /// The base unit of , which is Candela. All conversions go via this value. /// public static LuminousIntensityUnit BaseUnit { get; } = LuminousIntensityUnit.Candela; /// - /// Represents the largest possible value of LuminousIntensity + /// Represents the largest possible value of /// - public static LuminousIntensity MaxValue { get; } = new LuminousIntensity(double.MaxValue, BaseUnit); + public static LuminousIntensity MaxValue { get; } = new LuminousIntensity(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of LuminousIntensity + /// Represents the smallest possible value of /// - public static LuminousIntensity MinValue { get; } = new LuminousIntensity(double.MinValue, BaseUnit); + public static LuminousIntensity MinValue { get; } = new LuminousIntensity(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -123,14 +123,14 @@ public LuminousIntensity(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.LuminousIntensity; /// - /// All units of measurement for the LuminousIntensity quantity. + /// All units of measurement for the quantity. /// public static LuminousIntensityUnit[] Units { get; } = Enum.GetValues(typeof(LuminousIntensityUnit)).Cast().Except(new LuminousIntensityUnit[]{ LuminousIntensityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Candela. /// - public static LuminousIntensity Zero { get; } = new LuminousIntensity(0, BaseUnit); + public static LuminousIntensity Zero { get; } = new LuminousIntensity(0, BaseUnit); #endregion @@ -155,19 +155,19 @@ public LuminousIntensity(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => LuminousIntensity.QuantityType; + public QuantityType Type => LuminousIntensity.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => LuminousIntensity.BaseDimensions; + public BaseDimensions Dimensions => LuminousIntensity.BaseDimensions; #endregion #region Conversion Properties /// - /// Get LuminousIntensity in Candela. + /// Get in Candela. /// public double Candela => As(LuminousIntensityUnit.Candela); @@ -201,24 +201,24 @@ public static string GetAbbreviation(LuminousIntensityUnit unit, [CanBeNull] IFo #region Static Factory Methods /// - /// Get LuminousIntensity from Candela. + /// Get from Candela. /// /// If value is NaN or Infinity. - public static LuminousIntensity FromCandela(QuantityValue candela) + public static LuminousIntensity FromCandela(QuantityValue candela) { double value = (double) candela; - return new LuminousIntensity(value, LuminousIntensityUnit.Candela); + return new LuminousIntensity(value, LuminousIntensityUnit.Candela); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// LuminousIntensity unit value. - public static LuminousIntensity From(QuantityValue value, LuminousIntensityUnit fromUnit) + /// unit value. + public static LuminousIntensity From(QuantityValue value, LuminousIntensityUnit fromUnit) { - return new LuminousIntensity((double)value, fromUnit); + return new LuminousIntensity((double)value, fromUnit); } #endregion @@ -247,7 +247,7 @@ public static LuminousIntensity From(QuantityValue value, LuminousIntensityUnit /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static LuminousIntensity Parse(string str) + public static LuminousIntensity Parse(string str) { return Parse(str, null); } @@ -275,9 +275,9 @@ public static LuminousIntensity Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static LuminousIntensity Parse(string str, [CanBeNull] IFormatProvider provider) + public static LuminousIntensity Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, LuminousIntensityUnit>( str, provider, From); @@ -291,7 +291,7 @@ public static LuminousIntensity Parse(string str, [CanBeNull] IFormatProvider pr /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out LuminousIntensity result) + public static bool TryParse([CanBeNull] string str, out LuminousIntensity result) { return TryParse(str, null, out result); } @@ -306,9 +306,9 @@ public static bool TryParse([CanBeNull] string str, out LuminousIntensity result /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousIntensity result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousIntensity result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, LuminousIntensityUnit>( str, provider, From, @@ -370,43 +370,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino #region Arithmetic Operators /// Negate the value. - public static LuminousIntensity operator -(LuminousIntensity right) + public static LuminousIntensity operator -(LuminousIntensity right) { - return new LuminousIntensity(-right.Value, right.Unit); + return new LuminousIntensity(-right.Value, right.Unit); } - /// Get from adding two . - public static LuminousIntensity operator +(LuminousIntensity left, LuminousIntensity right) + /// Get from adding two . + public static LuminousIntensity operator +(LuminousIntensity left, LuminousIntensity right) { - return new LuminousIntensity(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new LuminousIntensity(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static LuminousIntensity operator -(LuminousIntensity left, LuminousIntensity right) + /// Get from subtracting two . + public static LuminousIntensity operator -(LuminousIntensity left, LuminousIntensity right) { - return new LuminousIntensity(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new LuminousIntensity(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static LuminousIntensity operator *(double left, LuminousIntensity right) + /// Get from multiplying value and . + public static LuminousIntensity operator *(double left, LuminousIntensity right) { - return new LuminousIntensity(left * right.Value, right.Unit); + return new LuminousIntensity(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static LuminousIntensity operator *(LuminousIntensity left, double right) + /// Get from multiplying value and . + public static LuminousIntensity operator *(LuminousIntensity left, double right) { - return new LuminousIntensity(left.Value * right, left.Unit); + return new LuminousIntensity(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static LuminousIntensity operator /(LuminousIntensity left, double right) + /// Get from dividing by value. + public static LuminousIntensity operator /(LuminousIntensity left, double right) { - return new LuminousIntensity(left.Value / right, left.Unit); + return new LuminousIntensity(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(LuminousIntensity left, LuminousIntensity right) + /// Get ratio value from dividing by . + public static double operator /(LuminousIntensity left, LuminousIntensity right) { return left.Candela / right.Candela; } @@ -416,39 +416,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(LuminousIntensity left, LuminousIntensity right) + public static bool operator <=(LuminousIntensity left, LuminousIntensity right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(LuminousIntensity left, LuminousIntensity right) + public static bool operator >=(LuminousIntensity left, LuminousIntensity right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(LuminousIntensity left, LuminousIntensity right) + public static bool operator <(LuminousIntensity left, LuminousIntensity right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(LuminousIntensity left, LuminousIntensity right) + public static bool operator >(LuminousIntensity left, LuminousIntensity right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(LuminousIntensity left, LuminousIntensity right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(LuminousIntensity left, LuminousIntensity right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(LuminousIntensity left, LuminousIntensity right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(LuminousIntensity left, LuminousIntensity right) { return !(left == right); } @@ -457,37 +457,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LuminousIntensity objLuminousIntensity)) throw new ArgumentException("Expected type LuminousIntensity.", nameof(obj)); + if(!(obj is LuminousIntensity objLuminousIntensity)) throw new ArgumentException("Expected type LuminousIntensity.", nameof(obj)); return CompareTo(objLuminousIntensity); } /// - public int CompareTo(LuminousIntensity other) + public int CompareTo(LuminousIntensity other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is LuminousIntensity objLuminousIntensity)) + if(obj is null || !(obj is LuminousIntensity objLuminousIntensity)) return false; return Equals(objLuminousIntensity); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(LuminousIntensity other) + /// Consider using for safely comparing floating point values. + public bool Equals(LuminousIntensity other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another LuminousIntensity within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -525,7 +525,7 @@ public bool Equals(LuminousIntensity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(LuminousIntensity other, double tolerance, ComparisonType comparisonType) + public bool Equals(LuminousIntensity other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -539,7 +539,7 @@ public bool Equals(LuminousIntensity other, double tolerance, ComparisonType com /// /// Returns the hash code for this instance. /// - /// A hash code for the current LuminousIntensity. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -587,13 +587,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this LuminousIntensity to another LuminousIntensity with the unit representation . + /// Converts this to another with the unit representation . /// - /// A LuminousIntensity with the specified unit. - public LuminousIntensity ToUnit(LuminousIntensityUnit unit) + /// A with the specified unit. + public LuminousIntensity ToUnit(LuminousIntensityUnit unit) { var convertedValue = GetValueAs(unit); - return new LuminousIntensity(convertedValue, unit); + return new LuminousIntensity(convertedValue, unit); } /// @@ -606,7 +606,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public LuminousIntensity ToUnit(UnitSystem unitSystem) + public LuminousIntensity ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -649,10 +649,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal LuminousIntensity ToBaseUnit() + internal LuminousIntensity ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new LuminousIntensity(baseUnitValue, BaseUnit); + return new LuminousIntensity(baseUnitValue, BaseUnit); } private double GetValueAs(LuminousIntensityUnit unit) @@ -761,7 +761,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -771,12 +771,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -821,16 +821,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(LuminousIntensity)) + if(conversionType == typeof(LuminousIntensity)) return this; else if(conversionType == typeof(LuminousIntensityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return LuminousIntensity.QuantityType; + return LuminousIntensity.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return LuminousIntensity.BaseDimensions; + return LuminousIntensity.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs index daa00c37db..1bee29779c 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Magnetic_field /// - public partial struct MagneticField : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct MagneticField : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -106,19 +106,19 @@ public MagneticField(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of MagneticField, which is Tesla. All conversions go via this value. + /// The base unit of , which is Tesla. All conversions go via this value. /// public static MagneticFieldUnit BaseUnit { get; } = MagneticFieldUnit.Tesla; /// - /// Represents the largest possible value of MagneticField + /// Represents the largest possible value of /// - public static MagneticField MaxValue { get; } = new MagneticField(double.MaxValue, BaseUnit); + public static MagneticField MaxValue { get; } = new MagneticField(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of MagneticField + /// Represents the smallest possible value of /// - public static MagneticField MinValue { get; } = new MagneticField(double.MinValue, BaseUnit); + public static MagneticField MinValue { get; } = new MagneticField(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -126,14 +126,14 @@ public MagneticField(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.MagneticField; /// - /// All units of measurement for the MagneticField quantity. + /// All units of measurement for the quantity. /// public static MagneticFieldUnit[] Units { get; } = Enum.GetValues(typeof(MagneticFieldUnit)).Cast().Except(new MagneticFieldUnit[]{ MagneticFieldUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Tesla. /// - public static MagneticField Zero { get; } = new MagneticField(0, BaseUnit); + public static MagneticField Zero { get; } = new MagneticField(0, BaseUnit); #endregion @@ -158,34 +158,34 @@ public MagneticField(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => MagneticField.QuantityType; + public QuantityType Type => MagneticField.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => MagneticField.BaseDimensions; + public BaseDimensions Dimensions => MagneticField.BaseDimensions; #endregion #region Conversion Properties /// - /// Get MagneticField in Microteslas. + /// Get in Microteslas. /// public double Microteslas => As(MagneticFieldUnit.Microtesla); /// - /// Get MagneticField in Milliteslas. + /// Get in Milliteslas. /// public double Milliteslas => As(MagneticFieldUnit.Millitesla); /// - /// Get MagneticField in Nanoteslas. + /// Get in Nanoteslas. /// public double Nanoteslas => As(MagneticFieldUnit.Nanotesla); /// - /// Get MagneticField in Teslas. + /// Get in Teslas. /// public double Teslas => As(MagneticFieldUnit.Tesla); @@ -219,51 +219,51 @@ public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] IFormat #region Static Factory Methods /// - /// Get MagneticField from Microteslas. + /// Get from Microteslas. /// /// If value is NaN or Infinity. - public static MagneticField FromMicroteslas(QuantityValue microteslas) + public static MagneticField FromMicroteslas(QuantityValue microteslas) { double value = (double) microteslas; - return new MagneticField(value, MagneticFieldUnit.Microtesla); + return new MagneticField(value, MagneticFieldUnit.Microtesla); } /// - /// Get MagneticField from Milliteslas. + /// Get from Milliteslas. /// /// If value is NaN or Infinity. - public static MagneticField FromMilliteslas(QuantityValue milliteslas) + public static MagneticField FromMilliteslas(QuantityValue milliteslas) { double value = (double) milliteslas; - return new MagneticField(value, MagneticFieldUnit.Millitesla); + return new MagneticField(value, MagneticFieldUnit.Millitesla); } /// - /// Get MagneticField from Nanoteslas. + /// Get from Nanoteslas. /// /// If value is NaN or Infinity. - public static MagneticField FromNanoteslas(QuantityValue nanoteslas) + public static MagneticField FromNanoteslas(QuantityValue nanoteslas) { double value = (double) nanoteslas; - return new MagneticField(value, MagneticFieldUnit.Nanotesla); + return new MagneticField(value, MagneticFieldUnit.Nanotesla); } /// - /// Get MagneticField from Teslas. + /// Get from Teslas. /// /// If value is NaN or Infinity. - public static MagneticField FromTeslas(QuantityValue teslas) + public static MagneticField FromTeslas(QuantityValue teslas) { double value = (double) teslas; - return new MagneticField(value, MagneticFieldUnit.Tesla); + return new MagneticField(value, MagneticFieldUnit.Tesla); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// MagneticField unit value. - public static MagneticField From(QuantityValue value, MagneticFieldUnit fromUnit) + /// unit value. + public static MagneticField From(QuantityValue value, MagneticFieldUnit fromUnit) { - return new MagneticField((double)value, fromUnit); + return new MagneticField((double)value, fromUnit); } #endregion @@ -292,7 +292,7 @@ public static MagneticField From(QuantityValue value, MagneticFieldUnit fromUnit /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static MagneticField Parse(string str) + public static MagneticField Parse(string str) { return Parse(str, null); } @@ -320,9 +320,9 @@ public static MagneticField Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static MagneticField Parse(string str, [CanBeNull] IFormatProvider provider) + public static MagneticField Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, MagneticFieldUnit>( str, provider, From); @@ -336,7 +336,7 @@ public static MagneticField Parse(string str, [CanBeNull] IFormatProvider provid /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out MagneticField result) + public static bool TryParse([CanBeNull] string str, out MagneticField result) { return TryParse(str, null, out result); } @@ -351,9 +351,9 @@ public static bool TryParse([CanBeNull] string str, out MagneticField result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticField result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticField result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, MagneticFieldUnit>( str, provider, From, @@ -415,43 +415,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet #region Arithmetic Operators /// Negate the value. - public static MagneticField operator -(MagneticField right) + public static MagneticField operator -(MagneticField right) { - return new MagneticField(-right.Value, right.Unit); + return new MagneticField(-right.Value, right.Unit); } - /// Get from adding two . - public static MagneticField operator +(MagneticField left, MagneticField right) + /// Get from adding two . + public static MagneticField operator +(MagneticField left, MagneticField right) { - return new MagneticField(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new MagneticField(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static MagneticField operator -(MagneticField left, MagneticField right) + /// Get from subtracting two . + public static MagneticField operator -(MagneticField left, MagneticField right) { - return new MagneticField(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new MagneticField(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static MagneticField operator *(double left, MagneticField right) + /// Get from multiplying value and . + public static MagneticField operator *(double left, MagneticField right) { - return new MagneticField(left * right.Value, right.Unit); + return new MagneticField(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static MagneticField operator *(MagneticField left, double right) + /// Get from multiplying value and . + public static MagneticField operator *(MagneticField left, double right) { - return new MagneticField(left.Value * right, left.Unit); + return new MagneticField(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static MagneticField operator /(MagneticField left, double right) + /// Get from dividing by value. + public static MagneticField operator /(MagneticField left, double right) { - return new MagneticField(left.Value / right, left.Unit); + return new MagneticField(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(MagneticField left, MagneticField right) + /// Get ratio value from dividing by . + public static double operator /(MagneticField left, MagneticField right) { return left.Teslas / right.Teslas; } @@ -461,39 +461,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(MagneticField left, MagneticField right) + public static bool operator <=(MagneticField left, MagneticField right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(MagneticField left, MagneticField right) + public static bool operator >=(MagneticField left, MagneticField right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(MagneticField left, MagneticField right) + public static bool operator <(MagneticField left, MagneticField right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(MagneticField left, MagneticField right) + public static bool operator >(MagneticField left, MagneticField right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(MagneticField left, MagneticField right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(MagneticField left, MagneticField right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(MagneticField left, MagneticField right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(MagneticField left, MagneticField right) { return !(left == right); } @@ -502,37 +502,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MagneticField objMagneticField)) throw new ArgumentException("Expected type MagneticField.", nameof(obj)); + if(!(obj is MagneticField objMagneticField)) throw new ArgumentException("Expected type MagneticField.", nameof(obj)); return CompareTo(objMagneticField); } /// - public int CompareTo(MagneticField other) + public int CompareTo(MagneticField other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MagneticField objMagneticField)) + if(obj is null || !(obj is MagneticField objMagneticField)) return false; return Equals(objMagneticField); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(MagneticField other) + /// Consider using for safely comparing floating point values. + public bool Equals(MagneticField other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another MagneticField within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -570,7 +570,7 @@ public bool Equals(MagneticField other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MagneticField other, double tolerance, ComparisonType comparisonType) + public bool Equals(MagneticField other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -584,7 +584,7 @@ public bool Equals(MagneticField other, double tolerance, ComparisonType compari /// /// Returns the hash code for this instance. /// - /// A hash code for the current MagneticField. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -632,13 +632,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this MagneticField to another MagneticField with the unit representation . + /// Converts this to another with the unit representation . /// - /// A MagneticField with the specified unit. - public MagneticField ToUnit(MagneticFieldUnit unit) + /// A with the specified unit. + public MagneticField ToUnit(MagneticFieldUnit unit) { var convertedValue = GetValueAs(unit); - return new MagneticField(convertedValue, unit); + return new MagneticField(convertedValue, unit); } /// @@ -651,7 +651,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public MagneticField ToUnit(UnitSystem unitSystem) + public MagneticField ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -697,10 +697,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal MagneticField ToBaseUnit() + internal MagneticField ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new MagneticField(baseUnitValue, BaseUnit); + return new MagneticField(baseUnitValue, BaseUnit); } private double GetValueAs(MagneticFieldUnit unit) @@ -812,7 +812,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MagneticField)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(MagneticField)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -822,12 +822,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MagneticField)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(MagneticField)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MagneticField)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(MagneticField)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -872,16 +872,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MagneticField)) + if(conversionType == typeof(MagneticField)) return this; else if(conversionType == typeof(MagneticFieldUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return MagneticField.QuantityType; + return MagneticField.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return MagneticField.BaseDimensions; + return MagneticField.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(MagneticField)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(MagneticField)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs index 4543262443..f5b2b104d9 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Magnetic_flux /// - public partial struct MagneticFlux : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct MagneticFlux : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -103,19 +103,19 @@ public MagneticFlux(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of MagneticFlux, which is Weber. All conversions go via this value. + /// The base unit of , which is Weber. All conversions go via this value. /// public static MagneticFluxUnit BaseUnit { get; } = MagneticFluxUnit.Weber; /// - /// Represents the largest possible value of MagneticFlux + /// Represents the largest possible value of /// - public static MagneticFlux MaxValue { get; } = new MagneticFlux(double.MaxValue, BaseUnit); + public static MagneticFlux MaxValue { get; } = new MagneticFlux(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of MagneticFlux + /// Represents the smallest possible value of /// - public static MagneticFlux MinValue { get; } = new MagneticFlux(double.MinValue, BaseUnit); + public static MagneticFlux MinValue { get; } = new MagneticFlux(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -123,14 +123,14 @@ public MagneticFlux(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.MagneticFlux; /// - /// All units of measurement for the MagneticFlux quantity. + /// All units of measurement for the quantity. /// public static MagneticFluxUnit[] Units { get; } = Enum.GetValues(typeof(MagneticFluxUnit)).Cast().Except(new MagneticFluxUnit[]{ MagneticFluxUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Weber. /// - public static MagneticFlux Zero { get; } = new MagneticFlux(0, BaseUnit); + public static MagneticFlux Zero { get; } = new MagneticFlux(0, BaseUnit); #endregion @@ -155,19 +155,19 @@ public MagneticFlux(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => MagneticFlux.QuantityType; + public QuantityType Type => MagneticFlux.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => MagneticFlux.BaseDimensions; + public BaseDimensions Dimensions => MagneticFlux.BaseDimensions; #endregion #region Conversion Properties /// - /// Get MagneticFlux in Webers. + /// Get in Webers. /// public double Webers => As(MagneticFluxUnit.Weber); @@ -201,24 +201,24 @@ public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] IFormatP #region Static Factory Methods /// - /// Get MagneticFlux from Webers. + /// Get from Webers. /// /// If value is NaN or Infinity. - public static MagneticFlux FromWebers(QuantityValue webers) + public static MagneticFlux FromWebers(QuantityValue webers) { double value = (double) webers; - return new MagneticFlux(value, MagneticFluxUnit.Weber); + return new MagneticFlux(value, MagneticFluxUnit.Weber); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// MagneticFlux unit value. - public static MagneticFlux From(QuantityValue value, MagneticFluxUnit fromUnit) + /// unit value. + public static MagneticFlux From(QuantityValue value, MagneticFluxUnit fromUnit) { - return new MagneticFlux((double)value, fromUnit); + return new MagneticFlux((double)value, fromUnit); } #endregion @@ -247,7 +247,7 @@ public static MagneticFlux From(QuantityValue value, MagneticFluxUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static MagneticFlux Parse(string str) + public static MagneticFlux Parse(string str) { return Parse(str, null); } @@ -275,9 +275,9 @@ public static MagneticFlux Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static MagneticFlux Parse(string str, [CanBeNull] IFormatProvider provider) + public static MagneticFlux Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, MagneticFluxUnit>( str, provider, From); @@ -291,7 +291,7 @@ public static MagneticFlux Parse(string str, [CanBeNull] IFormatProvider provide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out MagneticFlux result) + public static bool TryParse([CanBeNull] string str, out MagneticFlux result) { return TryParse(str, null, out result); } @@ -306,9 +306,9 @@ public static bool TryParse([CanBeNull] string str, out MagneticFlux result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticFlux result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticFlux result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, MagneticFluxUnit>( str, provider, From, @@ -370,43 +370,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet #region Arithmetic Operators /// Negate the value. - public static MagneticFlux operator -(MagneticFlux right) + public static MagneticFlux operator -(MagneticFlux right) { - return new MagneticFlux(-right.Value, right.Unit); + return new MagneticFlux(-right.Value, right.Unit); } - /// Get from adding two . - public static MagneticFlux operator +(MagneticFlux left, MagneticFlux right) + /// Get from adding two . + public static MagneticFlux operator +(MagneticFlux left, MagneticFlux right) { - return new MagneticFlux(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new MagneticFlux(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static MagneticFlux operator -(MagneticFlux left, MagneticFlux right) + /// Get from subtracting two . + public static MagneticFlux operator -(MagneticFlux left, MagneticFlux right) { - return new MagneticFlux(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new MagneticFlux(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static MagneticFlux operator *(double left, MagneticFlux right) + /// Get from multiplying value and . + public static MagneticFlux operator *(double left, MagneticFlux right) { - return new MagneticFlux(left * right.Value, right.Unit); + return new MagneticFlux(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static MagneticFlux operator *(MagneticFlux left, double right) + /// Get from multiplying value and . + public static MagneticFlux operator *(MagneticFlux left, double right) { - return new MagneticFlux(left.Value * right, left.Unit); + return new MagneticFlux(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static MagneticFlux operator /(MagneticFlux left, double right) + /// Get from dividing by value. + public static MagneticFlux operator /(MagneticFlux left, double right) { - return new MagneticFlux(left.Value / right, left.Unit); + return new MagneticFlux(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(MagneticFlux left, MagneticFlux right) + /// Get ratio value from dividing by . + public static double operator /(MagneticFlux left, MagneticFlux right) { return left.Webers / right.Webers; } @@ -416,39 +416,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(MagneticFlux left, MagneticFlux right) + public static bool operator <=(MagneticFlux left, MagneticFlux right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(MagneticFlux left, MagneticFlux right) + public static bool operator >=(MagneticFlux left, MagneticFlux right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(MagneticFlux left, MagneticFlux right) + public static bool operator <(MagneticFlux left, MagneticFlux right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(MagneticFlux left, MagneticFlux right) + public static bool operator >(MagneticFlux left, MagneticFlux right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(MagneticFlux left, MagneticFlux right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(MagneticFlux left, MagneticFlux right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(MagneticFlux left, MagneticFlux right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(MagneticFlux left, MagneticFlux right) { return !(left == right); } @@ -457,37 +457,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MagneticFlux objMagneticFlux)) throw new ArgumentException("Expected type MagneticFlux.", nameof(obj)); + if(!(obj is MagneticFlux objMagneticFlux)) throw new ArgumentException("Expected type MagneticFlux.", nameof(obj)); return CompareTo(objMagneticFlux); } /// - public int CompareTo(MagneticFlux other) + public int CompareTo(MagneticFlux other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MagneticFlux objMagneticFlux)) + if(obj is null || !(obj is MagneticFlux objMagneticFlux)) return false; return Equals(objMagneticFlux); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(MagneticFlux other) + /// Consider using for safely comparing floating point values. + public bool Equals(MagneticFlux other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another MagneticFlux within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -525,7 +525,7 @@ public bool Equals(MagneticFlux other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MagneticFlux other, double tolerance, ComparisonType comparisonType) + public bool Equals(MagneticFlux other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -539,7 +539,7 @@ public bool Equals(MagneticFlux other, double tolerance, ComparisonType comparis /// /// Returns the hash code for this instance. /// - /// A hash code for the current MagneticFlux. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -587,13 +587,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this MagneticFlux to another MagneticFlux with the unit representation . + /// Converts this to another with the unit representation . /// - /// A MagneticFlux with the specified unit. - public MagneticFlux ToUnit(MagneticFluxUnit unit) + /// A with the specified unit. + public MagneticFlux ToUnit(MagneticFluxUnit unit) { var convertedValue = GetValueAs(unit); - return new MagneticFlux(convertedValue, unit); + return new MagneticFlux(convertedValue, unit); } /// @@ -606,7 +606,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public MagneticFlux ToUnit(UnitSystem unitSystem) + public MagneticFlux ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -649,10 +649,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal MagneticFlux ToBaseUnit() + internal MagneticFlux ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new MagneticFlux(baseUnitValue, BaseUnit); + return new MagneticFlux(baseUnitValue, BaseUnit); } private double GetValueAs(MagneticFluxUnit unit) @@ -761,7 +761,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -771,12 +771,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -821,16 +821,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MagneticFlux)) + if(conversionType == typeof(MagneticFlux)) return this; else if(conversionType == typeof(MagneticFluxUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return MagneticFlux.QuantityType; + return MagneticFlux.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return MagneticFlux.BaseDimensions; + return MagneticFlux.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs index 8c1351ebaf..021bc4c506 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Magnetization /// - public partial struct Magnetization : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Magnetization : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -103,19 +103,19 @@ public Magnetization(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Magnetization, which is AmperePerMeter. All conversions go via this value. + /// The base unit of , which is AmperePerMeter. All conversions go via this value. /// public static MagnetizationUnit BaseUnit { get; } = MagnetizationUnit.AmperePerMeter; /// - /// Represents the largest possible value of Magnetization + /// Represents the largest possible value of /// - public static Magnetization MaxValue { get; } = new Magnetization(double.MaxValue, BaseUnit); + public static Magnetization MaxValue { get; } = new Magnetization(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Magnetization + /// Represents the smallest possible value of /// - public static Magnetization MinValue { get; } = new Magnetization(double.MinValue, BaseUnit); + public static Magnetization MinValue { get; } = new Magnetization(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -123,14 +123,14 @@ public Magnetization(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Magnetization; /// - /// All units of measurement for the Magnetization quantity. + /// All units of measurement for the quantity. /// public static MagnetizationUnit[] Units { get; } = Enum.GetValues(typeof(MagnetizationUnit)).Cast().Except(new MagnetizationUnit[]{ MagnetizationUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerMeter. /// - public static Magnetization Zero { get; } = new Magnetization(0, BaseUnit); + public static Magnetization Zero { get; } = new Magnetization(0, BaseUnit); #endregion @@ -155,19 +155,19 @@ public Magnetization(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Magnetization.QuantityType; + public QuantityType Type => Magnetization.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Magnetization.BaseDimensions; + public BaseDimensions Dimensions => Magnetization.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Magnetization in AmperesPerMeter. + /// Get in AmperesPerMeter. /// public double AmperesPerMeter => As(MagnetizationUnit.AmperePerMeter); @@ -201,24 +201,24 @@ public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] IFormat #region Static Factory Methods /// - /// Get Magnetization from AmperesPerMeter. + /// Get from AmperesPerMeter. /// /// If value is NaN or Infinity. - public static Magnetization FromAmperesPerMeter(QuantityValue amperespermeter) + public static Magnetization FromAmperesPerMeter(QuantityValue amperespermeter) { double value = (double) amperespermeter; - return new Magnetization(value, MagnetizationUnit.AmperePerMeter); + return new Magnetization(value, MagnetizationUnit.AmperePerMeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Magnetization unit value. - public static Magnetization From(QuantityValue value, MagnetizationUnit fromUnit) + /// unit value. + public static Magnetization From(QuantityValue value, MagnetizationUnit fromUnit) { - return new Magnetization((double)value, fromUnit); + return new Magnetization((double)value, fromUnit); } #endregion @@ -247,7 +247,7 @@ public static Magnetization From(QuantityValue value, MagnetizationUnit fromUnit /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Magnetization Parse(string str) + public static Magnetization Parse(string str) { return Parse(str, null); } @@ -275,9 +275,9 @@ public static Magnetization Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Magnetization Parse(string str, [CanBeNull] IFormatProvider provider) + public static Magnetization Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, MagnetizationUnit>( str, provider, From); @@ -291,7 +291,7 @@ public static Magnetization Parse(string str, [CanBeNull] IFormatProvider provid /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Magnetization result) + public static bool TryParse([CanBeNull] string str, out Magnetization result) { return TryParse(str, null, out result); } @@ -306,9 +306,9 @@ public static bool TryParse([CanBeNull] string str, out Magnetization result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Magnetization result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Magnetization result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, MagnetizationUnit>( str, provider, From, @@ -370,43 +370,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet #region Arithmetic Operators /// Negate the value. - public static Magnetization operator -(Magnetization right) + public static Magnetization operator -(Magnetization right) { - return new Magnetization(-right.Value, right.Unit); + return new Magnetization(-right.Value, right.Unit); } - /// Get from adding two . - public static Magnetization operator +(Magnetization left, Magnetization right) + /// Get from adding two . + public static Magnetization operator +(Magnetization left, Magnetization right) { - return new Magnetization(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Magnetization(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Magnetization operator -(Magnetization left, Magnetization right) + /// Get from subtracting two . + public static Magnetization operator -(Magnetization left, Magnetization right) { - return new Magnetization(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Magnetization(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Magnetization operator *(double left, Magnetization right) + /// Get from multiplying value and . + public static Magnetization operator *(double left, Magnetization right) { - return new Magnetization(left * right.Value, right.Unit); + return new Magnetization(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Magnetization operator *(Magnetization left, double right) + /// Get from multiplying value and . + public static Magnetization operator *(Magnetization left, double right) { - return new Magnetization(left.Value * right, left.Unit); + return new Magnetization(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Magnetization operator /(Magnetization left, double right) + /// Get from dividing by value. + public static Magnetization operator /(Magnetization left, double right) { - return new Magnetization(left.Value / right, left.Unit); + return new Magnetization(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Magnetization left, Magnetization right) + /// Get ratio value from dividing by . + public static double operator /(Magnetization left, Magnetization right) { return left.AmperesPerMeter / right.AmperesPerMeter; } @@ -416,39 +416,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Magnetization left, Magnetization right) + public static bool operator <=(Magnetization left, Magnetization right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Magnetization left, Magnetization right) + public static bool operator >=(Magnetization left, Magnetization right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Magnetization left, Magnetization right) + public static bool operator <(Magnetization left, Magnetization right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Magnetization left, Magnetization right) + public static bool operator >(Magnetization left, Magnetization right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Magnetization left, Magnetization right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Magnetization left, Magnetization right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Magnetization left, Magnetization right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Magnetization left, Magnetization right) { return !(left == right); } @@ -457,37 +457,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Magnetization objMagnetization)) throw new ArgumentException("Expected type Magnetization.", nameof(obj)); + if(!(obj is Magnetization objMagnetization)) throw new ArgumentException("Expected type Magnetization.", nameof(obj)); return CompareTo(objMagnetization); } /// - public int CompareTo(Magnetization other) + public int CompareTo(Magnetization other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Magnetization objMagnetization)) + if(obj is null || !(obj is Magnetization objMagnetization)) return false; return Equals(objMagnetization); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Magnetization other) + /// Consider using for safely comparing floating point values. + public bool Equals(Magnetization other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Magnetization within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -525,7 +525,7 @@ public bool Equals(Magnetization other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Magnetization other, double tolerance, ComparisonType comparisonType) + public bool Equals(Magnetization other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -539,7 +539,7 @@ public bool Equals(Magnetization other, double tolerance, ComparisonType compari /// /// Returns the hash code for this instance. /// - /// A hash code for the current Magnetization. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -587,13 +587,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Magnetization to another Magnetization with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Magnetization with the specified unit. - public Magnetization ToUnit(MagnetizationUnit unit) + /// A with the specified unit. + public Magnetization ToUnit(MagnetizationUnit unit) { var convertedValue = GetValueAs(unit); - return new Magnetization(convertedValue, unit); + return new Magnetization(convertedValue, unit); } /// @@ -606,7 +606,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Magnetization ToUnit(UnitSystem unitSystem) + public Magnetization ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -649,10 +649,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Magnetization ToBaseUnit() + internal Magnetization ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Magnetization(baseUnitValue, BaseUnit); + return new Magnetization(baseUnitValue, BaseUnit); } private double GetValueAs(MagnetizationUnit unit) @@ -761,7 +761,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Magnetization)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Magnetization)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -771,12 +771,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Magnetization)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Magnetization)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Magnetization)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Magnetization)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -821,16 +821,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Magnetization)) + if(conversionType == typeof(Magnetization)) return this; else if(conversionType == typeof(MagnetizationUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Magnetization.QuantityType; + return Magnetization.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Magnetization.BaseDimensions; + return Magnetization.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Magnetization)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Magnetization)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs index e6c35f10fa..b134ddb9fd 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// In physics, mass (from Greek μᾶζα "barley cake, lump [of dough]") is a property of a physical system or body, giving rise to the phenomena of the body's resistance to being accelerated by a force and the strength of its mutual gravitational attraction with other bodies. Instruments such as mass balances or scales use those phenomena to measure mass. The SI unit of mass is the kilogram (kg). /// - public partial struct Mass : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Mass : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -124,19 +124,19 @@ public Mass(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Mass, which is Kilogram. All conversions go via this value. + /// The base unit of , which is Kilogram. All conversions go via this value. /// public static MassUnit BaseUnit { get; } = MassUnit.Kilogram; /// - /// Represents the largest possible value of Mass + /// Represents the largest possible value of /// - public static Mass MaxValue { get; } = new Mass(double.MaxValue, BaseUnit); + public static Mass MaxValue { get; } = new Mass(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Mass + /// Represents the smallest possible value of /// - public static Mass MinValue { get; } = new Mass(double.MinValue, BaseUnit); + public static Mass MinValue { get; } = new Mass(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -144,14 +144,14 @@ public Mass(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Mass; /// - /// All units of measurement for the Mass quantity. + /// All units of measurement for the quantity. /// public static MassUnit[] Units { get; } = Enum.GetValues(typeof(MassUnit)).Cast().Except(new MassUnit[]{ MassUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Kilogram. /// - public static Mass Zero { get; } = new Mass(0, BaseUnit); + public static Mass Zero { get; } = new Mass(0, BaseUnit); #endregion @@ -176,139 +176,139 @@ public Mass(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Mass.QuantityType; + public QuantityType Type => Mass.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Mass.BaseDimensions; + public BaseDimensions Dimensions => Mass.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Mass in Centigrams. + /// Get in Centigrams. /// public double Centigrams => As(MassUnit.Centigram); /// - /// Get Mass in Decagrams. + /// Get in Decagrams. /// public double Decagrams => As(MassUnit.Decagram); /// - /// Get Mass in Decigrams. + /// Get in Decigrams. /// public double Decigrams => As(MassUnit.Decigram); /// - /// Get Mass in EarthMasses. + /// Get in EarthMasses. /// public double EarthMasses => As(MassUnit.EarthMass); /// - /// Get Mass in Grains. + /// Get in Grains. /// public double Grains => As(MassUnit.Grain); /// - /// Get Mass in Grams. + /// Get in Grams. /// public double Grams => As(MassUnit.Gram); /// - /// Get Mass in Hectograms. + /// Get in Hectograms. /// public double Hectograms => As(MassUnit.Hectogram); /// - /// Get Mass in Kilograms. + /// Get in Kilograms. /// public double Kilograms => As(MassUnit.Kilogram); /// - /// Get Mass in Kilopounds. + /// Get in Kilopounds. /// public double Kilopounds => As(MassUnit.Kilopound); /// - /// Get Mass in Kilotonnes. + /// Get in Kilotonnes. /// public double Kilotonnes => As(MassUnit.Kilotonne); /// - /// Get Mass in LongHundredweight. + /// Get in LongHundredweight. /// public double LongHundredweight => As(MassUnit.LongHundredweight); /// - /// Get Mass in LongTons. + /// Get in LongTons. /// public double LongTons => As(MassUnit.LongTon); /// - /// Get Mass in Megapounds. + /// Get in Megapounds. /// public double Megapounds => As(MassUnit.Megapound); /// - /// Get Mass in Megatonnes. + /// Get in Megatonnes. /// public double Megatonnes => As(MassUnit.Megatonne); /// - /// Get Mass in Micrograms. + /// Get in Micrograms. /// public double Micrograms => As(MassUnit.Microgram); /// - /// Get Mass in Milligrams. + /// Get in Milligrams. /// public double Milligrams => As(MassUnit.Milligram); /// - /// Get Mass in Nanograms. + /// Get in Nanograms. /// public double Nanograms => As(MassUnit.Nanogram); /// - /// Get Mass in Ounces. + /// Get in Ounces. /// public double Ounces => As(MassUnit.Ounce); /// - /// Get Mass in Pounds. + /// Get in Pounds. /// public double Pounds => As(MassUnit.Pound); /// - /// Get Mass in ShortHundredweight. + /// Get in ShortHundredweight. /// public double ShortHundredweight => As(MassUnit.ShortHundredweight); /// - /// Get Mass in ShortTons. + /// Get in ShortTons. /// public double ShortTons => As(MassUnit.ShortTon); /// - /// Get Mass in Slugs. + /// Get in Slugs. /// public double Slugs => As(MassUnit.Slug); /// - /// Get Mass in SolarMasses. + /// Get in SolarMasses. /// public double SolarMasses => As(MassUnit.SolarMass); /// - /// Get Mass in Stone. + /// Get in Stone. /// public double Stone => As(MassUnit.Stone); /// - /// Get Mass in Tonnes. + /// Get in Tonnes. /// public double Tonnes => As(MassUnit.Tonne); @@ -342,240 +342,240 @@ public static string GetAbbreviation(MassUnit unit, [CanBeNull] IFormatProvider #region Static Factory Methods /// - /// Get Mass from Centigrams. + /// Get from Centigrams. /// /// If value is NaN or Infinity. - public static Mass FromCentigrams(QuantityValue centigrams) + public static Mass FromCentigrams(QuantityValue centigrams) { double value = (double) centigrams; - return new Mass(value, MassUnit.Centigram); + return new Mass(value, MassUnit.Centigram); } /// - /// Get Mass from Decagrams. + /// Get from Decagrams. /// /// If value is NaN or Infinity. - public static Mass FromDecagrams(QuantityValue decagrams) + public static Mass FromDecagrams(QuantityValue decagrams) { double value = (double) decagrams; - return new Mass(value, MassUnit.Decagram); + return new Mass(value, MassUnit.Decagram); } /// - /// Get Mass from Decigrams. + /// Get from Decigrams. /// /// If value is NaN or Infinity. - public static Mass FromDecigrams(QuantityValue decigrams) + public static Mass FromDecigrams(QuantityValue decigrams) { double value = (double) decigrams; - return new Mass(value, MassUnit.Decigram); + return new Mass(value, MassUnit.Decigram); } /// - /// Get Mass from EarthMasses. + /// Get from EarthMasses. /// /// If value is NaN or Infinity. - public static Mass FromEarthMasses(QuantityValue earthmasses) + public static Mass FromEarthMasses(QuantityValue earthmasses) { double value = (double) earthmasses; - return new Mass(value, MassUnit.EarthMass); + return new Mass(value, MassUnit.EarthMass); } /// - /// Get Mass from Grains. + /// Get from Grains. /// /// If value is NaN or Infinity. - public static Mass FromGrains(QuantityValue grains) + public static Mass FromGrains(QuantityValue grains) { double value = (double) grains; - return new Mass(value, MassUnit.Grain); + return new Mass(value, MassUnit.Grain); } /// - /// Get Mass from Grams. + /// Get from Grams. /// /// If value is NaN or Infinity. - public static Mass FromGrams(QuantityValue grams) + public static Mass FromGrams(QuantityValue grams) { double value = (double) grams; - return new Mass(value, MassUnit.Gram); + return new Mass(value, MassUnit.Gram); } /// - /// Get Mass from Hectograms. + /// Get from Hectograms. /// /// If value is NaN or Infinity. - public static Mass FromHectograms(QuantityValue hectograms) + public static Mass FromHectograms(QuantityValue hectograms) { double value = (double) hectograms; - return new Mass(value, MassUnit.Hectogram); + return new Mass(value, MassUnit.Hectogram); } /// - /// Get Mass from Kilograms. + /// Get from Kilograms. /// /// If value is NaN or Infinity. - public static Mass FromKilograms(QuantityValue kilograms) + public static Mass FromKilograms(QuantityValue kilograms) { double value = (double) kilograms; - return new Mass(value, MassUnit.Kilogram); + return new Mass(value, MassUnit.Kilogram); } /// - /// Get Mass from Kilopounds. + /// Get from Kilopounds. /// /// If value is NaN or Infinity. - public static Mass FromKilopounds(QuantityValue kilopounds) + public static Mass FromKilopounds(QuantityValue kilopounds) { double value = (double) kilopounds; - return new Mass(value, MassUnit.Kilopound); + return new Mass(value, MassUnit.Kilopound); } /// - /// Get Mass from Kilotonnes. + /// Get from Kilotonnes. /// /// If value is NaN or Infinity. - public static Mass FromKilotonnes(QuantityValue kilotonnes) + public static Mass FromKilotonnes(QuantityValue kilotonnes) { double value = (double) kilotonnes; - return new Mass(value, MassUnit.Kilotonne); + return new Mass(value, MassUnit.Kilotonne); } /// - /// Get Mass from LongHundredweight. + /// Get from LongHundredweight. /// /// If value is NaN or Infinity. - public static Mass FromLongHundredweight(QuantityValue longhundredweight) + public static Mass FromLongHundredweight(QuantityValue longhundredweight) { double value = (double) longhundredweight; - return new Mass(value, MassUnit.LongHundredweight); + return new Mass(value, MassUnit.LongHundredweight); } /// - /// Get Mass from LongTons. + /// Get from LongTons. /// /// If value is NaN or Infinity. - public static Mass FromLongTons(QuantityValue longtons) + public static Mass FromLongTons(QuantityValue longtons) { double value = (double) longtons; - return new Mass(value, MassUnit.LongTon); + return new Mass(value, MassUnit.LongTon); } /// - /// Get Mass from Megapounds. + /// Get from Megapounds. /// /// If value is NaN or Infinity. - public static Mass FromMegapounds(QuantityValue megapounds) + public static Mass FromMegapounds(QuantityValue megapounds) { double value = (double) megapounds; - return new Mass(value, MassUnit.Megapound); + return new Mass(value, MassUnit.Megapound); } /// - /// Get Mass from Megatonnes. + /// Get from Megatonnes. /// /// If value is NaN or Infinity. - public static Mass FromMegatonnes(QuantityValue megatonnes) + public static Mass FromMegatonnes(QuantityValue megatonnes) { double value = (double) megatonnes; - return new Mass(value, MassUnit.Megatonne); + return new Mass(value, MassUnit.Megatonne); } /// - /// Get Mass from Micrograms. + /// Get from Micrograms. /// /// If value is NaN or Infinity. - public static Mass FromMicrograms(QuantityValue micrograms) + public static Mass FromMicrograms(QuantityValue micrograms) { double value = (double) micrograms; - return new Mass(value, MassUnit.Microgram); + return new Mass(value, MassUnit.Microgram); } /// - /// Get Mass from Milligrams. + /// Get from Milligrams. /// /// If value is NaN or Infinity. - public static Mass FromMilligrams(QuantityValue milligrams) + public static Mass FromMilligrams(QuantityValue milligrams) { double value = (double) milligrams; - return new Mass(value, MassUnit.Milligram); + return new Mass(value, MassUnit.Milligram); } /// - /// Get Mass from Nanograms. + /// Get from Nanograms. /// /// If value is NaN or Infinity. - public static Mass FromNanograms(QuantityValue nanograms) + public static Mass FromNanograms(QuantityValue nanograms) { double value = (double) nanograms; - return new Mass(value, MassUnit.Nanogram); + return new Mass(value, MassUnit.Nanogram); } /// - /// Get Mass from Ounces. + /// Get from Ounces. /// /// If value is NaN or Infinity. - public static Mass FromOunces(QuantityValue ounces) + public static Mass FromOunces(QuantityValue ounces) { double value = (double) ounces; - return new Mass(value, MassUnit.Ounce); + return new Mass(value, MassUnit.Ounce); } /// - /// Get Mass from Pounds. + /// Get from Pounds. /// /// If value is NaN or Infinity. - public static Mass FromPounds(QuantityValue pounds) + public static Mass FromPounds(QuantityValue pounds) { double value = (double) pounds; - return new Mass(value, MassUnit.Pound); + return new Mass(value, MassUnit.Pound); } /// - /// Get Mass from ShortHundredweight. + /// Get from ShortHundredweight. /// /// If value is NaN or Infinity. - public static Mass FromShortHundredweight(QuantityValue shorthundredweight) + public static Mass FromShortHundredweight(QuantityValue shorthundredweight) { double value = (double) shorthundredweight; - return new Mass(value, MassUnit.ShortHundredweight); + return new Mass(value, MassUnit.ShortHundredweight); } /// - /// Get Mass from ShortTons. + /// Get from ShortTons. /// /// If value is NaN or Infinity. - public static Mass FromShortTons(QuantityValue shorttons) + public static Mass FromShortTons(QuantityValue shorttons) { double value = (double) shorttons; - return new Mass(value, MassUnit.ShortTon); + return new Mass(value, MassUnit.ShortTon); } /// - /// Get Mass from Slugs. + /// Get from Slugs. /// /// If value is NaN or Infinity. - public static Mass FromSlugs(QuantityValue slugs) + public static Mass FromSlugs(QuantityValue slugs) { double value = (double) slugs; - return new Mass(value, MassUnit.Slug); + return new Mass(value, MassUnit.Slug); } /// - /// Get Mass from SolarMasses. + /// Get from SolarMasses. /// /// If value is NaN or Infinity. - public static Mass FromSolarMasses(QuantityValue solarmasses) + public static Mass FromSolarMasses(QuantityValue solarmasses) { double value = (double) solarmasses; - return new Mass(value, MassUnit.SolarMass); + return new Mass(value, MassUnit.SolarMass); } /// - /// Get Mass from Stone. + /// Get from Stone. /// /// If value is NaN or Infinity. - public static Mass FromStone(QuantityValue stone) + public static Mass FromStone(QuantityValue stone) { double value = (double) stone; - return new Mass(value, MassUnit.Stone); + return new Mass(value, MassUnit.Stone); } /// - /// Get Mass from Tonnes. + /// Get from Tonnes. /// /// If value is NaN or Infinity. - public static Mass FromTonnes(QuantityValue tonnes) + public static Mass FromTonnes(QuantityValue tonnes) { double value = (double) tonnes; - return new Mass(value, MassUnit.Tonne); + return new Mass(value, MassUnit.Tonne); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Mass unit value. - public static Mass From(QuantityValue value, MassUnit fromUnit) + /// unit value. + public static Mass From(QuantityValue value, MassUnit fromUnit) { - return new Mass((double)value, fromUnit); + return new Mass((double)value, fromUnit); } #endregion @@ -604,7 +604,7 @@ public static Mass From(QuantityValue value, MassUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Mass Parse(string str) + public static Mass Parse(string str) { return Parse(str, null); } @@ -632,9 +632,9 @@ public static Mass Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Mass Parse(string str, [CanBeNull] IFormatProvider provider) + public static Mass Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, MassUnit>( str, provider, From); @@ -648,7 +648,7 @@ public static Mass Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Mass result) + public static bool TryParse([CanBeNull] string str, out Mass result) { return TryParse(str, null, out result); } @@ -663,9 +663,9 @@ public static bool TryParse([CanBeNull] string str, out Mass result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Mass result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Mass result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, MassUnit>( str, provider, From, @@ -727,43 +727,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassUn #region Arithmetic Operators /// Negate the value. - public static Mass operator -(Mass right) + public static Mass operator -(Mass right) { - return new Mass(-right.Value, right.Unit); + return new Mass(-right.Value, right.Unit); } - /// Get from adding two . - public static Mass operator +(Mass left, Mass right) + /// Get from adding two . + public static Mass operator +(Mass left, Mass right) { - return new Mass(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Mass(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Mass operator -(Mass left, Mass right) + /// Get from subtracting two . + public static Mass operator -(Mass left, Mass right) { - return new Mass(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Mass(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Mass operator *(double left, Mass right) + /// Get from multiplying value and . + public static Mass operator *(double left, Mass right) { - return new Mass(left * right.Value, right.Unit); + return new Mass(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Mass operator *(Mass left, double right) + /// Get from multiplying value and . + public static Mass operator *(Mass left, double right) { - return new Mass(left.Value * right, left.Unit); + return new Mass(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Mass operator /(Mass left, double right) + /// Get from dividing by value. + public static Mass operator /(Mass left, double right) { - return new Mass(left.Value / right, left.Unit); + return new Mass(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Mass left, Mass right) + /// Get ratio value from dividing by . + public static double operator /(Mass left, Mass right) { return left.Kilograms / right.Kilograms; } @@ -773,39 +773,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassUn #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Mass left, Mass right) + public static bool operator <=(Mass left, Mass right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Mass left, Mass right) + public static bool operator >=(Mass left, Mass right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Mass left, Mass right) + public static bool operator <(Mass left, Mass right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Mass left, Mass right) + public static bool operator >(Mass left, Mass right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Mass left, Mass right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Mass left, Mass right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Mass left, Mass right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Mass left, Mass right) { return !(left == right); } @@ -814,37 +814,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassUn public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Mass objMass)) throw new ArgumentException("Expected type Mass.", nameof(obj)); + if(!(obj is Mass objMass)) throw new ArgumentException("Expected type Mass.", nameof(obj)); return CompareTo(objMass); } /// - public int CompareTo(Mass other) + public int CompareTo(Mass other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Mass objMass)) + if(obj is null || !(obj is Mass objMass)) return false; return Equals(objMass); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Mass other) + /// Consider using for safely comparing floating point values. + public bool Equals(Mass other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Mass within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -882,7 +882,7 @@ public bool Equals(Mass other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Mass other, double tolerance, ComparisonType comparisonType) + public bool Equals(Mass other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -896,7 +896,7 @@ public bool Equals(Mass other, double tolerance, ComparisonType comparisonType) /// /// Returns the hash code for this instance. /// - /// A hash code for the current Mass. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -944,13 +944,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Mass to another Mass with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Mass with the specified unit. - public Mass ToUnit(MassUnit unit) + /// A with the specified unit. + public Mass ToUnit(MassUnit unit) { var convertedValue = GetValueAs(unit); - return new Mass(convertedValue, unit); + return new Mass(convertedValue, unit); } /// @@ -963,7 +963,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Mass ToUnit(UnitSystem unitSystem) + public Mass ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1030,10 +1030,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Mass ToBaseUnit() + internal Mass ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Mass(baseUnitValue, BaseUnit); + return new Mass(baseUnitValue, BaseUnit); } private double GetValueAs(MassUnit unit) @@ -1166,7 +1166,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Mass)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Mass)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1176,12 +1176,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Mass)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Mass)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Mass)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Mass)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1226,16 +1226,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Mass)) + if(conversionType == typeof(Mass)) return this; else if(conversionType == typeof(MassUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Mass.QuantityType; + return Mass.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Mass.BaseDimensions; + return Mass.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Mass)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Mass)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs index f0961eb4ad..7bf2df6bc1 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Mass_concentration_(chemistry) /// - public partial struct MassConcentration : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct MassConcentration : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -142,19 +142,19 @@ public MassConcentration(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of MassConcentration, which is KilogramPerCubicMeter. All conversions go via this value. + /// The base unit of , which is KilogramPerCubicMeter. All conversions go via this value. /// public static MassConcentrationUnit BaseUnit { get; } = MassConcentrationUnit.KilogramPerCubicMeter; /// - /// Represents the largest possible value of MassConcentration + /// Represents the largest possible value of /// - public static MassConcentration MaxValue { get; } = new MassConcentration(double.MaxValue, BaseUnit); + public static MassConcentration MaxValue { get; } = new MassConcentration(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of MassConcentration + /// Represents the smallest possible value of /// - public static MassConcentration MinValue { get; } = new MassConcentration(double.MinValue, BaseUnit); + public static MassConcentration MinValue { get; } = new MassConcentration(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -162,14 +162,14 @@ public MassConcentration(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.MassConcentration; /// - /// All units of measurement for the MassConcentration quantity. + /// All units of measurement for the quantity. /// public static MassConcentrationUnit[] Units { get; } = Enum.GetValues(typeof(MassConcentrationUnit)).Cast().Except(new MassConcentrationUnit[]{ MassConcentrationUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerCubicMeter. /// - public static MassConcentration Zero { get; } = new MassConcentration(0, BaseUnit); + public static MassConcentration Zero { get; } = new MassConcentration(0, BaseUnit); #endregion @@ -194,214 +194,214 @@ public MassConcentration(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => MassConcentration.QuantityType; + public QuantityType Type => MassConcentration.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => MassConcentration.BaseDimensions; + public BaseDimensions Dimensions => MassConcentration.BaseDimensions; #endregion #region Conversion Properties /// - /// Get MassConcentration in CentigramsPerDeciliter. + /// Get in CentigramsPerDeciliter. /// public double CentigramsPerDeciliter => As(MassConcentrationUnit.CentigramPerDeciliter); /// - /// Get MassConcentration in CentigramsPerLiter. + /// Get in CentigramsPerLiter. /// public double CentigramsPerLiter => As(MassConcentrationUnit.CentigramPerLiter); /// - /// Get MassConcentration in CentigramsPerMilliliter. + /// Get in CentigramsPerMilliliter. /// public double CentigramsPerMilliliter => As(MassConcentrationUnit.CentigramPerMilliliter); /// - /// Get MassConcentration in DecigramsPerDeciliter. + /// Get in DecigramsPerDeciliter. /// public double DecigramsPerDeciliter => As(MassConcentrationUnit.DecigramPerDeciliter); /// - /// Get MassConcentration in DecigramsPerLiter. + /// Get in DecigramsPerLiter. /// public double DecigramsPerLiter => As(MassConcentrationUnit.DecigramPerLiter); /// - /// Get MassConcentration in DecigramsPerMilliliter. + /// Get in DecigramsPerMilliliter. /// public double DecigramsPerMilliliter => As(MassConcentrationUnit.DecigramPerMilliliter); /// - /// Get MassConcentration in GramsPerCubicCentimeter. + /// Get in GramsPerCubicCentimeter. /// public double GramsPerCubicCentimeter => As(MassConcentrationUnit.GramPerCubicCentimeter); /// - /// Get MassConcentration in GramsPerCubicMeter. + /// Get in GramsPerCubicMeter. /// public double GramsPerCubicMeter => As(MassConcentrationUnit.GramPerCubicMeter); /// - /// Get MassConcentration in GramsPerCubicMillimeter. + /// Get in GramsPerCubicMillimeter. /// public double GramsPerCubicMillimeter => As(MassConcentrationUnit.GramPerCubicMillimeter); /// - /// Get MassConcentration in GramsPerDeciliter. + /// Get in GramsPerDeciliter. /// public double GramsPerDeciliter => As(MassConcentrationUnit.GramPerDeciliter); /// - /// Get MassConcentration in GramsPerLiter. + /// Get in GramsPerLiter. /// public double GramsPerLiter => As(MassConcentrationUnit.GramPerLiter); /// - /// Get MassConcentration in GramsPerMilliliter. + /// Get in GramsPerMilliliter. /// public double GramsPerMilliliter => As(MassConcentrationUnit.GramPerMilliliter); /// - /// Get MassConcentration in KilogramsPerCubicCentimeter. + /// Get in KilogramsPerCubicCentimeter. /// public double KilogramsPerCubicCentimeter => As(MassConcentrationUnit.KilogramPerCubicCentimeter); /// - /// Get MassConcentration in KilogramsPerCubicMeter. + /// Get in KilogramsPerCubicMeter. /// public double KilogramsPerCubicMeter => As(MassConcentrationUnit.KilogramPerCubicMeter); /// - /// Get MassConcentration in KilogramsPerCubicMillimeter. + /// Get in KilogramsPerCubicMillimeter. /// public double KilogramsPerCubicMillimeter => As(MassConcentrationUnit.KilogramPerCubicMillimeter); /// - /// Get MassConcentration in KilogramsPerLiter. + /// Get in KilogramsPerLiter. /// public double KilogramsPerLiter => As(MassConcentrationUnit.KilogramPerLiter); /// - /// Get MassConcentration in KilopoundsPerCubicFoot. + /// Get in KilopoundsPerCubicFoot. /// public double KilopoundsPerCubicFoot => As(MassConcentrationUnit.KilopoundPerCubicFoot); /// - /// Get MassConcentration in KilopoundsPerCubicInch. + /// Get in KilopoundsPerCubicInch. /// public double KilopoundsPerCubicInch => As(MassConcentrationUnit.KilopoundPerCubicInch); /// - /// Get MassConcentration in MicrogramsPerCubicMeter. + /// Get in MicrogramsPerCubicMeter. /// public double MicrogramsPerCubicMeter => As(MassConcentrationUnit.MicrogramPerCubicMeter); /// - /// Get MassConcentration in MicrogramsPerDeciliter. + /// Get in MicrogramsPerDeciliter. /// public double MicrogramsPerDeciliter => As(MassConcentrationUnit.MicrogramPerDeciliter); /// - /// Get MassConcentration in MicrogramsPerLiter. + /// Get in MicrogramsPerLiter. /// public double MicrogramsPerLiter => As(MassConcentrationUnit.MicrogramPerLiter); /// - /// Get MassConcentration in MicrogramsPerMilliliter. + /// Get in MicrogramsPerMilliliter. /// public double MicrogramsPerMilliliter => As(MassConcentrationUnit.MicrogramPerMilliliter); /// - /// Get MassConcentration in MilligramsPerCubicMeter. + /// Get in MilligramsPerCubicMeter. /// public double MilligramsPerCubicMeter => As(MassConcentrationUnit.MilligramPerCubicMeter); /// - /// Get MassConcentration in MilligramsPerDeciliter. + /// Get in MilligramsPerDeciliter. /// public double MilligramsPerDeciliter => As(MassConcentrationUnit.MilligramPerDeciliter); /// - /// Get MassConcentration in MilligramsPerLiter. + /// Get in MilligramsPerLiter. /// public double MilligramsPerLiter => As(MassConcentrationUnit.MilligramPerLiter); /// - /// Get MassConcentration in MilligramsPerMilliliter. + /// Get in MilligramsPerMilliliter. /// public double MilligramsPerMilliliter => As(MassConcentrationUnit.MilligramPerMilliliter); /// - /// Get MassConcentration in NanogramsPerDeciliter. + /// Get in NanogramsPerDeciliter. /// public double NanogramsPerDeciliter => As(MassConcentrationUnit.NanogramPerDeciliter); /// - /// Get MassConcentration in NanogramsPerLiter. + /// Get in NanogramsPerLiter. /// public double NanogramsPerLiter => As(MassConcentrationUnit.NanogramPerLiter); /// - /// Get MassConcentration in NanogramsPerMilliliter. + /// Get in NanogramsPerMilliliter. /// public double NanogramsPerMilliliter => As(MassConcentrationUnit.NanogramPerMilliliter); /// - /// Get MassConcentration in PicogramsPerDeciliter. + /// Get in PicogramsPerDeciliter. /// public double PicogramsPerDeciliter => As(MassConcentrationUnit.PicogramPerDeciliter); /// - /// Get MassConcentration in PicogramsPerLiter. + /// Get in PicogramsPerLiter. /// public double PicogramsPerLiter => As(MassConcentrationUnit.PicogramPerLiter); /// - /// Get MassConcentration in PicogramsPerMilliliter. + /// Get in PicogramsPerMilliliter. /// public double PicogramsPerMilliliter => As(MassConcentrationUnit.PicogramPerMilliliter); /// - /// Get MassConcentration in PoundsPerCubicFoot. + /// Get in PoundsPerCubicFoot. /// public double PoundsPerCubicFoot => As(MassConcentrationUnit.PoundPerCubicFoot); /// - /// Get MassConcentration in PoundsPerCubicInch. + /// Get in PoundsPerCubicInch. /// public double PoundsPerCubicInch => As(MassConcentrationUnit.PoundPerCubicInch); /// - /// Get MassConcentration in PoundsPerImperialGallon. + /// Get in PoundsPerImperialGallon. /// public double PoundsPerImperialGallon => As(MassConcentrationUnit.PoundPerImperialGallon); /// - /// Get MassConcentration in PoundsPerUSGallon. + /// Get in PoundsPerUSGallon. /// public double PoundsPerUSGallon => As(MassConcentrationUnit.PoundPerUSGallon); /// - /// Get MassConcentration in SlugsPerCubicFoot. + /// Get in SlugsPerCubicFoot. /// public double SlugsPerCubicFoot => As(MassConcentrationUnit.SlugPerCubicFoot); /// - /// Get MassConcentration in TonnesPerCubicCentimeter. + /// Get in TonnesPerCubicCentimeter. /// public double TonnesPerCubicCentimeter => As(MassConcentrationUnit.TonnePerCubicCentimeter); /// - /// Get MassConcentration in TonnesPerCubicMeter. + /// Get in TonnesPerCubicMeter. /// public double TonnesPerCubicMeter => As(MassConcentrationUnit.TonnePerCubicMeter); /// - /// Get MassConcentration in TonnesPerCubicMillimeter. + /// Get in TonnesPerCubicMillimeter. /// public double TonnesPerCubicMillimeter => As(MassConcentrationUnit.TonnePerCubicMillimeter); @@ -435,375 +435,375 @@ public static string GetAbbreviation(MassConcentrationUnit unit, [CanBeNull] IFo #region Static Factory Methods /// - /// Get MassConcentration from CentigramsPerDeciliter. + /// Get from CentigramsPerDeciliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromCentigramsPerDeciliter(QuantityValue centigramsperdeciliter) + public static MassConcentration FromCentigramsPerDeciliter(QuantityValue centigramsperdeciliter) { double value = (double) centigramsperdeciliter; - return new MassConcentration(value, MassConcentrationUnit.CentigramPerDeciliter); + return new MassConcentration(value, MassConcentrationUnit.CentigramPerDeciliter); } /// - /// Get MassConcentration from CentigramsPerLiter. + /// Get from CentigramsPerLiter. /// /// If value is NaN or Infinity. - public static MassConcentration FromCentigramsPerLiter(QuantityValue centigramsperliter) + public static MassConcentration FromCentigramsPerLiter(QuantityValue centigramsperliter) { double value = (double) centigramsperliter; - return new MassConcentration(value, MassConcentrationUnit.CentigramPerLiter); + return new MassConcentration(value, MassConcentrationUnit.CentigramPerLiter); } /// - /// Get MassConcentration from CentigramsPerMilliliter. + /// Get from CentigramsPerMilliliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromCentigramsPerMilliliter(QuantityValue centigramspermilliliter) + public static MassConcentration FromCentigramsPerMilliliter(QuantityValue centigramspermilliliter) { double value = (double) centigramspermilliliter; - return new MassConcentration(value, MassConcentrationUnit.CentigramPerMilliliter); + return new MassConcentration(value, MassConcentrationUnit.CentigramPerMilliliter); } /// - /// Get MassConcentration from DecigramsPerDeciliter. + /// Get from DecigramsPerDeciliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromDecigramsPerDeciliter(QuantityValue decigramsperdeciliter) + public static MassConcentration FromDecigramsPerDeciliter(QuantityValue decigramsperdeciliter) { double value = (double) decigramsperdeciliter; - return new MassConcentration(value, MassConcentrationUnit.DecigramPerDeciliter); + return new MassConcentration(value, MassConcentrationUnit.DecigramPerDeciliter); } /// - /// Get MassConcentration from DecigramsPerLiter. + /// Get from DecigramsPerLiter. /// /// If value is NaN or Infinity. - public static MassConcentration FromDecigramsPerLiter(QuantityValue decigramsperliter) + public static MassConcentration FromDecigramsPerLiter(QuantityValue decigramsperliter) { double value = (double) decigramsperliter; - return new MassConcentration(value, MassConcentrationUnit.DecigramPerLiter); + return new MassConcentration(value, MassConcentrationUnit.DecigramPerLiter); } /// - /// Get MassConcentration from DecigramsPerMilliliter. + /// Get from DecigramsPerMilliliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromDecigramsPerMilliliter(QuantityValue decigramspermilliliter) + public static MassConcentration FromDecigramsPerMilliliter(QuantityValue decigramspermilliliter) { double value = (double) decigramspermilliliter; - return new MassConcentration(value, MassConcentrationUnit.DecigramPerMilliliter); + return new MassConcentration(value, MassConcentrationUnit.DecigramPerMilliliter); } /// - /// Get MassConcentration from GramsPerCubicCentimeter. + /// Get from GramsPerCubicCentimeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromGramsPerCubicCentimeter(QuantityValue gramspercubiccentimeter) + public static MassConcentration FromGramsPerCubicCentimeter(QuantityValue gramspercubiccentimeter) { double value = (double) gramspercubiccentimeter; - return new MassConcentration(value, MassConcentrationUnit.GramPerCubicCentimeter); + return new MassConcentration(value, MassConcentrationUnit.GramPerCubicCentimeter); } /// - /// Get MassConcentration from GramsPerCubicMeter. + /// Get from GramsPerCubicMeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromGramsPerCubicMeter(QuantityValue gramspercubicmeter) + public static MassConcentration FromGramsPerCubicMeter(QuantityValue gramspercubicmeter) { double value = (double) gramspercubicmeter; - return new MassConcentration(value, MassConcentrationUnit.GramPerCubicMeter); + return new MassConcentration(value, MassConcentrationUnit.GramPerCubicMeter); } /// - /// Get MassConcentration from GramsPerCubicMillimeter. + /// Get from GramsPerCubicMillimeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromGramsPerCubicMillimeter(QuantityValue gramspercubicmillimeter) + public static MassConcentration FromGramsPerCubicMillimeter(QuantityValue gramspercubicmillimeter) { double value = (double) gramspercubicmillimeter; - return new MassConcentration(value, MassConcentrationUnit.GramPerCubicMillimeter); + return new MassConcentration(value, MassConcentrationUnit.GramPerCubicMillimeter); } /// - /// Get MassConcentration from GramsPerDeciliter. + /// Get from GramsPerDeciliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromGramsPerDeciliter(QuantityValue gramsperdeciliter) + public static MassConcentration FromGramsPerDeciliter(QuantityValue gramsperdeciliter) { double value = (double) gramsperdeciliter; - return new MassConcentration(value, MassConcentrationUnit.GramPerDeciliter); + return new MassConcentration(value, MassConcentrationUnit.GramPerDeciliter); } /// - /// Get MassConcentration from GramsPerLiter. + /// Get from GramsPerLiter. /// /// If value is NaN or Infinity. - public static MassConcentration FromGramsPerLiter(QuantityValue gramsperliter) + public static MassConcentration FromGramsPerLiter(QuantityValue gramsperliter) { double value = (double) gramsperliter; - return new MassConcentration(value, MassConcentrationUnit.GramPerLiter); + return new MassConcentration(value, MassConcentrationUnit.GramPerLiter); } /// - /// Get MassConcentration from GramsPerMilliliter. + /// Get from GramsPerMilliliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromGramsPerMilliliter(QuantityValue gramspermilliliter) + public static MassConcentration FromGramsPerMilliliter(QuantityValue gramspermilliliter) { double value = (double) gramspermilliliter; - return new MassConcentration(value, MassConcentrationUnit.GramPerMilliliter); + return new MassConcentration(value, MassConcentrationUnit.GramPerMilliliter); } /// - /// Get MassConcentration from KilogramsPerCubicCentimeter. + /// Get from KilogramsPerCubicCentimeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromKilogramsPerCubicCentimeter(QuantityValue kilogramspercubiccentimeter) + public static MassConcentration FromKilogramsPerCubicCentimeter(QuantityValue kilogramspercubiccentimeter) { double value = (double) kilogramspercubiccentimeter; - return new MassConcentration(value, MassConcentrationUnit.KilogramPerCubicCentimeter); + return new MassConcentration(value, MassConcentrationUnit.KilogramPerCubicCentimeter); } /// - /// Get MassConcentration from KilogramsPerCubicMeter. + /// Get from KilogramsPerCubicMeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromKilogramsPerCubicMeter(QuantityValue kilogramspercubicmeter) + public static MassConcentration FromKilogramsPerCubicMeter(QuantityValue kilogramspercubicmeter) { double value = (double) kilogramspercubicmeter; - return new MassConcentration(value, MassConcentrationUnit.KilogramPerCubicMeter); + return new MassConcentration(value, MassConcentrationUnit.KilogramPerCubicMeter); } /// - /// Get MassConcentration from KilogramsPerCubicMillimeter. + /// Get from KilogramsPerCubicMillimeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromKilogramsPerCubicMillimeter(QuantityValue kilogramspercubicmillimeter) + public static MassConcentration FromKilogramsPerCubicMillimeter(QuantityValue kilogramspercubicmillimeter) { double value = (double) kilogramspercubicmillimeter; - return new MassConcentration(value, MassConcentrationUnit.KilogramPerCubicMillimeter); + return new MassConcentration(value, MassConcentrationUnit.KilogramPerCubicMillimeter); } /// - /// Get MassConcentration from KilogramsPerLiter. + /// Get from KilogramsPerLiter. /// /// If value is NaN or Infinity. - public static MassConcentration FromKilogramsPerLiter(QuantityValue kilogramsperliter) + public static MassConcentration FromKilogramsPerLiter(QuantityValue kilogramsperliter) { double value = (double) kilogramsperliter; - return new MassConcentration(value, MassConcentrationUnit.KilogramPerLiter); + return new MassConcentration(value, MassConcentrationUnit.KilogramPerLiter); } /// - /// Get MassConcentration from KilopoundsPerCubicFoot. + /// Get from KilopoundsPerCubicFoot. /// /// If value is NaN or Infinity. - public static MassConcentration FromKilopoundsPerCubicFoot(QuantityValue kilopoundspercubicfoot) + public static MassConcentration FromKilopoundsPerCubicFoot(QuantityValue kilopoundspercubicfoot) { double value = (double) kilopoundspercubicfoot; - return new MassConcentration(value, MassConcentrationUnit.KilopoundPerCubicFoot); + return new MassConcentration(value, MassConcentrationUnit.KilopoundPerCubicFoot); } /// - /// Get MassConcentration from KilopoundsPerCubicInch. + /// Get from KilopoundsPerCubicInch. /// /// If value is NaN or Infinity. - public static MassConcentration FromKilopoundsPerCubicInch(QuantityValue kilopoundspercubicinch) + public static MassConcentration FromKilopoundsPerCubicInch(QuantityValue kilopoundspercubicinch) { double value = (double) kilopoundspercubicinch; - return new MassConcentration(value, MassConcentrationUnit.KilopoundPerCubicInch); + return new MassConcentration(value, MassConcentrationUnit.KilopoundPerCubicInch); } /// - /// Get MassConcentration from MicrogramsPerCubicMeter. + /// Get from MicrogramsPerCubicMeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromMicrogramsPerCubicMeter(QuantityValue microgramspercubicmeter) + public static MassConcentration FromMicrogramsPerCubicMeter(QuantityValue microgramspercubicmeter) { double value = (double) microgramspercubicmeter; - return new MassConcentration(value, MassConcentrationUnit.MicrogramPerCubicMeter); + return new MassConcentration(value, MassConcentrationUnit.MicrogramPerCubicMeter); } /// - /// Get MassConcentration from MicrogramsPerDeciliter. + /// Get from MicrogramsPerDeciliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromMicrogramsPerDeciliter(QuantityValue microgramsperdeciliter) + public static MassConcentration FromMicrogramsPerDeciliter(QuantityValue microgramsperdeciliter) { double value = (double) microgramsperdeciliter; - return new MassConcentration(value, MassConcentrationUnit.MicrogramPerDeciliter); + return new MassConcentration(value, MassConcentrationUnit.MicrogramPerDeciliter); } /// - /// Get MassConcentration from MicrogramsPerLiter. + /// Get from MicrogramsPerLiter. /// /// If value is NaN or Infinity. - public static MassConcentration FromMicrogramsPerLiter(QuantityValue microgramsperliter) + public static MassConcentration FromMicrogramsPerLiter(QuantityValue microgramsperliter) { double value = (double) microgramsperliter; - return new MassConcentration(value, MassConcentrationUnit.MicrogramPerLiter); + return new MassConcentration(value, MassConcentrationUnit.MicrogramPerLiter); } /// - /// Get MassConcentration from MicrogramsPerMilliliter. + /// Get from MicrogramsPerMilliliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromMicrogramsPerMilliliter(QuantityValue microgramspermilliliter) + public static MassConcentration FromMicrogramsPerMilliliter(QuantityValue microgramspermilliliter) { double value = (double) microgramspermilliliter; - return new MassConcentration(value, MassConcentrationUnit.MicrogramPerMilliliter); + return new MassConcentration(value, MassConcentrationUnit.MicrogramPerMilliliter); } /// - /// Get MassConcentration from MilligramsPerCubicMeter. + /// Get from MilligramsPerCubicMeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromMilligramsPerCubicMeter(QuantityValue milligramspercubicmeter) + public static MassConcentration FromMilligramsPerCubicMeter(QuantityValue milligramspercubicmeter) { double value = (double) milligramspercubicmeter; - return new MassConcentration(value, MassConcentrationUnit.MilligramPerCubicMeter); + return new MassConcentration(value, MassConcentrationUnit.MilligramPerCubicMeter); } /// - /// Get MassConcentration from MilligramsPerDeciliter. + /// Get from MilligramsPerDeciliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromMilligramsPerDeciliter(QuantityValue milligramsperdeciliter) + public static MassConcentration FromMilligramsPerDeciliter(QuantityValue milligramsperdeciliter) { double value = (double) milligramsperdeciliter; - return new MassConcentration(value, MassConcentrationUnit.MilligramPerDeciliter); + return new MassConcentration(value, MassConcentrationUnit.MilligramPerDeciliter); } /// - /// Get MassConcentration from MilligramsPerLiter. + /// Get from MilligramsPerLiter. /// /// If value is NaN or Infinity. - public static MassConcentration FromMilligramsPerLiter(QuantityValue milligramsperliter) + public static MassConcentration FromMilligramsPerLiter(QuantityValue milligramsperliter) { double value = (double) milligramsperliter; - return new MassConcentration(value, MassConcentrationUnit.MilligramPerLiter); + return new MassConcentration(value, MassConcentrationUnit.MilligramPerLiter); } /// - /// Get MassConcentration from MilligramsPerMilliliter. + /// Get from MilligramsPerMilliliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromMilligramsPerMilliliter(QuantityValue milligramspermilliliter) + public static MassConcentration FromMilligramsPerMilliliter(QuantityValue milligramspermilliliter) { double value = (double) milligramspermilliliter; - return new MassConcentration(value, MassConcentrationUnit.MilligramPerMilliliter); + return new MassConcentration(value, MassConcentrationUnit.MilligramPerMilliliter); } /// - /// Get MassConcentration from NanogramsPerDeciliter. + /// Get from NanogramsPerDeciliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromNanogramsPerDeciliter(QuantityValue nanogramsperdeciliter) + public static MassConcentration FromNanogramsPerDeciliter(QuantityValue nanogramsperdeciliter) { double value = (double) nanogramsperdeciliter; - return new MassConcentration(value, MassConcentrationUnit.NanogramPerDeciliter); + return new MassConcentration(value, MassConcentrationUnit.NanogramPerDeciliter); } /// - /// Get MassConcentration from NanogramsPerLiter. + /// Get from NanogramsPerLiter. /// /// If value is NaN or Infinity. - public static MassConcentration FromNanogramsPerLiter(QuantityValue nanogramsperliter) + public static MassConcentration FromNanogramsPerLiter(QuantityValue nanogramsperliter) { double value = (double) nanogramsperliter; - return new MassConcentration(value, MassConcentrationUnit.NanogramPerLiter); + return new MassConcentration(value, MassConcentrationUnit.NanogramPerLiter); } /// - /// Get MassConcentration from NanogramsPerMilliliter. + /// Get from NanogramsPerMilliliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromNanogramsPerMilliliter(QuantityValue nanogramspermilliliter) + public static MassConcentration FromNanogramsPerMilliliter(QuantityValue nanogramspermilliliter) { double value = (double) nanogramspermilliliter; - return new MassConcentration(value, MassConcentrationUnit.NanogramPerMilliliter); + return new MassConcentration(value, MassConcentrationUnit.NanogramPerMilliliter); } /// - /// Get MassConcentration from PicogramsPerDeciliter. + /// Get from PicogramsPerDeciliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromPicogramsPerDeciliter(QuantityValue picogramsperdeciliter) + public static MassConcentration FromPicogramsPerDeciliter(QuantityValue picogramsperdeciliter) { double value = (double) picogramsperdeciliter; - return new MassConcentration(value, MassConcentrationUnit.PicogramPerDeciliter); + return new MassConcentration(value, MassConcentrationUnit.PicogramPerDeciliter); } /// - /// Get MassConcentration from PicogramsPerLiter. + /// Get from PicogramsPerLiter. /// /// If value is NaN or Infinity. - public static MassConcentration FromPicogramsPerLiter(QuantityValue picogramsperliter) + public static MassConcentration FromPicogramsPerLiter(QuantityValue picogramsperliter) { double value = (double) picogramsperliter; - return new MassConcentration(value, MassConcentrationUnit.PicogramPerLiter); + return new MassConcentration(value, MassConcentrationUnit.PicogramPerLiter); } /// - /// Get MassConcentration from PicogramsPerMilliliter. + /// Get from PicogramsPerMilliliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromPicogramsPerMilliliter(QuantityValue picogramspermilliliter) + public static MassConcentration FromPicogramsPerMilliliter(QuantityValue picogramspermilliliter) { double value = (double) picogramspermilliliter; - return new MassConcentration(value, MassConcentrationUnit.PicogramPerMilliliter); + return new MassConcentration(value, MassConcentrationUnit.PicogramPerMilliliter); } /// - /// Get MassConcentration from PoundsPerCubicFoot. + /// Get from PoundsPerCubicFoot. /// /// If value is NaN or Infinity. - public static MassConcentration FromPoundsPerCubicFoot(QuantityValue poundspercubicfoot) + public static MassConcentration FromPoundsPerCubicFoot(QuantityValue poundspercubicfoot) { double value = (double) poundspercubicfoot; - return new MassConcentration(value, MassConcentrationUnit.PoundPerCubicFoot); + return new MassConcentration(value, MassConcentrationUnit.PoundPerCubicFoot); } /// - /// Get MassConcentration from PoundsPerCubicInch. + /// Get from PoundsPerCubicInch. /// /// If value is NaN or Infinity. - public static MassConcentration FromPoundsPerCubicInch(QuantityValue poundspercubicinch) + public static MassConcentration FromPoundsPerCubicInch(QuantityValue poundspercubicinch) { double value = (double) poundspercubicinch; - return new MassConcentration(value, MassConcentrationUnit.PoundPerCubicInch); + return new MassConcentration(value, MassConcentrationUnit.PoundPerCubicInch); } /// - /// Get MassConcentration from PoundsPerImperialGallon. + /// Get from PoundsPerImperialGallon. /// /// If value is NaN or Infinity. - public static MassConcentration FromPoundsPerImperialGallon(QuantityValue poundsperimperialgallon) + public static MassConcentration FromPoundsPerImperialGallon(QuantityValue poundsperimperialgallon) { double value = (double) poundsperimperialgallon; - return new MassConcentration(value, MassConcentrationUnit.PoundPerImperialGallon); + return new MassConcentration(value, MassConcentrationUnit.PoundPerImperialGallon); } /// - /// Get MassConcentration from PoundsPerUSGallon. + /// Get from PoundsPerUSGallon. /// /// If value is NaN or Infinity. - public static MassConcentration FromPoundsPerUSGallon(QuantityValue poundsperusgallon) + public static MassConcentration FromPoundsPerUSGallon(QuantityValue poundsperusgallon) { double value = (double) poundsperusgallon; - return new MassConcentration(value, MassConcentrationUnit.PoundPerUSGallon); + return new MassConcentration(value, MassConcentrationUnit.PoundPerUSGallon); } /// - /// Get MassConcentration from SlugsPerCubicFoot. + /// Get from SlugsPerCubicFoot. /// /// If value is NaN or Infinity. - public static MassConcentration FromSlugsPerCubicFoot(QuantityValue slugspercubicfoot) + public static MassConcentration FromSlugsPerCubicFoot(QuantityValue slugspercubicfoot) { double value = (double) slugspercubicfoot; - return new MassConcentration(value, MassConcentrationUnit.SlugPerCubicFoot); + return new MassConcentration(value, MassConcentrationUnit.SlugPerCubicFoot); } /// - /// Get MassConcentration from TonnesPerCubicCentimeter. + /// Get from TonnesPerCubicCentimeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromTonnesPerCubicCentimeter(QuantityValue tonnespercubiccentimeter) + public static MassConcentration FromTonnesPerCubicCentimeter(QuantityValue tonnespercubiccentimeter) { double value = (double) tonnespercubiccentimeter; - return new MassConcentration(value, MassConcentrationUnit.TonnePerCubicCentimeter); + return new MassConcentration(value, MassConcentrationUnit.TonnePerCubicCentimeter); } /// - /// Get MassConcentration from TonnesPerCubicMeter. + /// Get from TonnesPerCubicMeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromTonnesPerCubicMeter(QuantityValue tonnespercubicmeter) + public static MassConcentration FromTonnesPerCubicMeter(QuantityValue tonnespercubicmeter) { double value = (double) tonnespercubicmeter; - return new MassConcentration(value, MassConcentrationUnit.TonnePerCubicMeter); + return new MassConcentration(value, MassConcentrationUnit.TonnePerCubicMeter); } /// - /// Get MassConcentration from TonnesPerCubicMillimeter. + /// Get from TonnesPerCubicMillimeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromTonnesPerCubicMillimeter(QuantityValue tonnespercubicmillimeter) + public static MassConcentration FromTonnesPerCubicMillimeter(QuantityValue tonnespercubicmillimeter) { double value = (double) tonnespercubicmillimeter; - return new MassConcentration(value, MassConcentrationUnit.TonnePerCubicMillimeter); + return new MassConcentration(value, MassConcentrationUnit.TonnePerCubicMillimeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// MassConcentration unit value. - public static MassConcentration From(QuantityValue value, MassConcentrationUnit fromUnit) + /// unit value. + public static MassConcentration From(QuantityValue value, MassConcentrationUnit fromUnit) { - return new MassConcentration((double)value, fromUnit); + return new MassConcentration((double)value, fromUnit); } #endregion @@ -832,7 +832,7 @@ public static MassConcentration From(QuantityValue value, MassConcentrationUnit /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static MassConcentration Parse(string str) + public static MassConcentration Parse(string str) { return Parse(str, null); } @@ -860,9 +860,9 @@ public static MassConcentration Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static MassConcentration Parse(string str, [CanBeNull] IFormatProvider provider) + public static MassConcentration Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, MassConcentrationUnit>( str, provider, From); @@ -876,7 +876,7 @@ public static MassConcentration Parse(string str, [CanBeNull] IFormatProvider pr /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out MassConcentration result) + public static bool TryParse([CanBeNull] string str, out MassConcentration result) { return TryParse(str, null, out result); } @@ -891,9 +891,9 @@ public static bool TryParse([CanBeNull] string str, out MassConcentration result /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassConcentration result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassConcentration result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, MassConcentrationUnit>( str, provider, From, @@ -955,43 +955,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassCo #region Arithmetic Operators /// Negate the value. - public static MassConcentration operator -(MassConcentration right) + public static MassConcentration operator -(MassConcentration right) { - return new MassConcentration(-right.Value, right.Unit); + return new MassConcentration(-right.Value, right.Unit); } - /// Get from adding two . - public static MassConcentration operator +(MassConcentration left, MassConcentration right) + /// Get from adding two . + public static MassConcentration operator +(MassConcentration left, MassConcentration right) { - return new MassConcentration(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new MassConcentration(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static MassConcentration operator -(MassConcentration left, MassConcentration right) + /// Get from subtracting two . + public static MassConcentration operator -(MassConcentration left, MassConcentration right) { - return new MassConcentration(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new MassConcentration(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static MassConcentration operator *(double left, MassConcentration right) + /// Get from multiplying value and . + public static MassConcentration operator *(double left, MassConcentration right) { - return new MassConcentration(left * right.Value, right.Unit); + return new MassConcentration(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static MassConcentration operator *(MassConcentration left, double right) + /// Get from multiplying value and . + public static MassConcentration operator *(MassConcentration left, double right) { - return new MassConcentration(left.Value * right, left.Unit); + return new MassConcentration(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static MassConcentration operator /(MassConcentration left, double right) + /// Get from dividing by value. + public static MassConcentration operator /(MassConcentration left, double right) { - return new MassConcentration(left.Value / right, left.Unit); + return new MassConcentration(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(MassConcentration left, MassConcentration right) + /// Get ratio value from dividing by . + public static double operator /(MassConcentration left, MassConcentration right) { return left.KilogramsPerCubicMeter / right.KilogramsPerCubicMeter; } @@ -1001,39 +1001,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassCo #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(MassConcentration left, MassConcentration right) + public static bool operator <=(MassConcentration left, MassConcentration right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(MassConcentration left, MassConcentration right) + public static bool operator >=(MassConcentration left, MassConcentration right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(MassConcentration left, MassConcentration right) + public static bool operator <(MassConcentration left, MassConcentration right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(MassConcentration left, MassConcentration right) + public static bool operator >(MassConcentration left, MassConcentration right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(MassConcentration left, MassConcentration right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(MassConcentration left, MassConcentration right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(MassConcentration left, MassConcentration right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(MassConcentration left, MassConcentration right) { return !(left == right); } @@ -1042,37 +1042,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassCo public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassConcentration objMassConcentration)) throw new ArgumentException("Expected type MassConcentration.", nameof(obj)); + if(!(obj is MassConcentration objMassConcentration)) throw new ArgumentException("Expected type MassConcentration.", nameof(obj)); return CompareTo(objMassConcentration); } /// - public int CompareTo(MassConcentration other) + public int CompareTo(MassConcentration other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MassConcentration objMassConcentration)) + if(obj is null || !(obj is MassConcentration objMassConcentration)) return false; return Equals(objMassConcentration); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(MassConcentration other) + /// Consider using for safely comparing floating point values. + public bool Equals(MassConcentration other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another MassConcentration within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -1110,7 +1110,7 @@ public bool Equals(MassConcentration other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MassConcentration other, double tolerance, ComparisonType comparisonType) + public bool Equals(MassConcentration other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -1124,7 +1124,7 @@ public bool Equals(MassConcentration other, double tolerance, ComparisonType com /// /// Returns the hash code for this instance. /// - /// A hash code for the current MassConcentration. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -1172,13 +1172,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this MassConcentration to another MassConcentration with the unit representation . + /// Converts this to another with the unit representation . /// - /// A MassConcentration with the specified unit. - public MassConcentration ToUnit(MassConcentrationUnit unit) + /// A with the specified unit. + public MassConcentration ToUnit(MassConcentrationUnit unit) { var convertedValue = GetValueAs(unit); - return new MassConcentration(convertedValue, unit); + return new MassConcentration(convertedValue, unit); } /// @@ -1191,7 +1191,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public MassConcentration ToUnit(UnitSystem unitSystem) + public MassConcentration ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1273,10 +1273,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal MassConcentration ToBaseUnit() + internal MassConcentration ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new MassConcentration(baseUnitValue, BaseUnit); + return new MassConcentration(baseUnitValue, BaseUnit); } private double GetValueAs(MassConcentrationUnit unit) @@ -1424,7 +1424,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MassConcentration)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(MassConcentration)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1434,12 +1434,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MassConcentration)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(MassConcentration)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MassConcentration)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(MassConcentration)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1484,16 +1484,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MassConcentration)) + if(conversionType == typeof(MassConcentration)) return this; else if(conversionType == typeof(MassConcentrationUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return MassConcentration.QuantityType; + return MassConcentration.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return MassConcentration.BaseDimensions; + return MassConcentration.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(MassConcentration)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(MassConcentration)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs index 6819d6a96a..a0944564d2 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Mass flow is the ratio of the mass change to the time during which the change occurred (value of mass changes per unit time). /// - public partial struct MassFlow : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct MassFlow : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -132,19 +132,19 @@ public MassFlow(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of MassFlow, which is GramPerSecond. All conversions go via this value. + /// The base unit of , which is GramPerSecond. All conversions go via this value. /// public static MassFlowUnit BaseUnit { get; } = MassFlowUnit.GramPerSecond; /// - /// Represents the largest possible value of MassFlow + /// Represents the largest possible value of /// - public static MassFlow MaxValue { get; } = new MassFlow(double.MaxValue, BaseUnit); + public static MassFlow MaxValue { get; } = new MassFlow(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of MassFlow + /// Represents the smallest possible value of /// - public static MassFlow MinValue { get; } = new MassFlow(double.MinValue, BaseUnit); + public static MassFlow MinValue { get; } = new MassFlow(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -152,14 +152,14 @@ public MassFlow(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.MassFlow; /// - /// All units of measurement for the MassFlow quantity. + /// All units of measurement for the quantity. /// public static MassFlowUnit[] Units { get; } = Enum.GetValues(typeof(MassFlowUnit)).Cast().Except(new MassFlowUnit[]{ MassFlowUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit GramPerSecond. /// - public static MassFlow Zero { get; } = new MassFlow(0, BaseUnit); + public static MassFlow Zero { get; } = new MassFlow(0, BaseUnit); #endregion @@ -184,179 +184,179 @@ public MassFlow(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => MassFlow.QuantityType; + public QuantityType Type => MassFlow.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => MassFlow.BaseDimensions; + public BaseDimensions Dimensions => MassFlow.BaseDimensions; #endregion #region Conversion Properties /// - /// Get MassFlow in CentigramsPerDay. + /// Get in CentigramsPerDay. /// public double CentigramsPerDay => As(MassFlowUnit.CentigramPerDay); /// - /// Get MassFlow in CentigramsPerSecond. + /// Get in CentigramsPerSecond. /// public double CentigramsPerSecond => As(MassFlowUnit.CentigramPerSecond); /// - /// Get MassFlow in DecagramsPerDay. + /// Get in DecagramsPerDay. /// public double DecagramsPerDay => As(MassFlowUnit.DecagramPerDay); /// - /// Get MassFlow in DecagramsPerSecond. + /// Get in DecagramsPerSecond. /// public double DecagramsPerSecond => As(MassFlowUnit.DecagramPerSecond); /// - /// Get MassFlow in DecigramsPerDay. + /// Get in DecigramsPerDay. /// public double DecigramsPerDay => As(MassFlowUnit.DecigramPerDay); /// - /// Get MassFlow in DecigramsPerSecond. + /// Get in DecigramsPerSecond. /// public double DecigramsPerSecond => As(MassFlowUnit.DecigramPerSecond); /// - /// Get MassFlow in GramsPerDay. + /// Get in GramsPerDay. /// public double GramsPerDay => As(MassFlowUnit.GramPerDay); /// - /// Get MassFlow in GramsPerHour. + /// Get in GramsPerHour. /// public double GramsPerHour => As(MassFlowUnit.GramPerHour); /// - /// Get MassFlow in GramsPerSecond. + /// Get in GramsPerSecond. /// public double GramsPerSecond => As(MassFlowUnit.GramPerSecond); /// - /// Get MassFlow in HectogramsPerDay. + /// Get in HectogramsPerDay. /// public double HectogramsPerDay => As(MassFlowUnit.HectogramPerDay); /// - /// Get MassFlow in HectogramsPerSecond. + /// Get in HectogramsPerSecond. /// public double HectogramsPerSecond => As(MassFlowUnit.HectogramPerSecond); /// - /// Get MassFlow in KilogramsPerDay. + /// Get in KilogramsPerDay. /// public double KilogramsPerDay => As(MassFlowUnit.KilogramPerDay); /// - /// Get MassFlow in KilogramsPerHour. + /// Get in KilogramsPerHour. /// public double KilogramsPerHour => As(MassFlowUnit.KilogramPerHour); /// - /// Get MassFlow in KilogramsPerMinute. + /// Get in KilogramsPerMinute. /// public double KilogramsPerMinute => As(MassFlowUnit.KilogramPerMinute); /// - /// Get MassFlow in KilogramsPerSecond. + /// Get in KilogramsPerSecond. /// public double KilogramsPerSecond => As(MassFlowUnit.KilogramPerSecond); /// - /// Get MassFlow in MegagramsPerDay. + /// Get in MegagramsPerDay. /// public double MegagramsPerDay => As(MassFlowUnit.MegagramPerDay); /// - /// Get MassFlow in MegapoundsPerDay. + /// Get in MegapoundsPerDay. /// public double MegapoundsPerDay => As(MassFlowUnit.MegapoundPerDay); /// - /// Get MassFlow in MegapoundsPerHour. + /// Get in MegapoundsPerHour. /// public double MegapoundsPerHour => As(MassFlowUnit.MegapoundPerHour); /// - /// Get MassFlow in MegapoundsPerMinute. + /// Get in MegapoundsPerMinute. /// public double MegapoundsPerMinute => As(MassFlowUnit.MegapoundPerMinute); /// - /// Get MassFlow in MegapoundsPerSecond. + /// Get in MegapoundsPerSecond. /// public double MegapoundsPerSecond => As(MassFlowUnit.MegapoundPerSecond); /// - /// Get MassFlow in MicrogramsPerDay. + /// Get in MicrogramsPerDay. /// public double MicrogramsPerDay => As(MassFlowUnit.MicrogramPerDay); /// - /// Get MassFlow in MicrogramsPerSecond. + /// Get in MicrogramsPerSecond. /// public double MicrogramsPerSecond => As(MassFlowUnit.MicrogramPerSecond); /// - /// Get MassFlow in MilligramsPerDay. + /// Get in MilligramsPerDay. /// public double MilligramsPerDay => As(MassFlowUnit.MilligramPerDay); /// - /// Get MassFlow in MilligramsPerSecond. + /// Get in MilligramsPerSecond. /// public double MilligramsPerSecond => As(MassFlowUnit.MilligramPerSecond); /// - /// Get MassFlow in NanogramsPerDay. + /// Get in NanogramsPerDay. /// public double NanogramsPerDay => As(MassFlowUnit.NanogramPerDay); /// - /// Get MassFlow in NanogramsPerSecond. + /// Get in NanogramsPerSecond. /// public double NanogramsPerSecond => As(MassFlowUnit.NanogramPerSecond); /// - /// Get MassFlow in PoundsPerDay. + /// Get in PoundsPerDay. /// public double PoundsPerDay => As(MassFlowUnit.PoundPerDay); /// - /// Get MassFlow in PoundsPerHour. + /// Get in PoundsPerHour. /// public double PoundsPerHour => As(MassFlowUnit.PoundPerHour); /// - /// Get MassFlow in PoundsPerMinute. + /// Get in PoundsPerMinute. /// public double PoundsPerMinute => As(MassFlowUnit.PoundPerMinute); /// - /// Get MassFlow in PoundsPerSecond. + /// Get in PoundsPerSecond. /// public double PoundsPerSecond => As(MassFlowUnit.PoundPerSecond); /// - /// Get MassFlow in ShortTonsPerHour. + /// Get in ShortTonsPerHour. /// public double ShortTonsPerHour => As(MassFlowUnit.ShortTonPerHour); /// - /// Get MassFlow in TonnesPerDay. + /// Get in TonnesPerDay. /// public double TonnesPerDay => As(MassFlowUnit.TonnePerDay); /// - /// Get MassFlow in TonnesPerHour. + /// Get in TonnesPerHour. /// public double TonnesPerHour => As(MassFlowUnit.TonnePerHour); @@ -390,312 +390,312 @@ public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] IFormatProvi #region Static Factory Methods /// - /// Get MassFlow from CentigramsPerDay. + /// Get from CentigramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromCentigramsPerDay(QuantityValue centigramsperday) + public static MassFlow FromCentigramsPerDay(QuantityValue centigramsperday) { double value = (double) centigramsperday; - return new MassFlow(value, MassFlowUnit.CentigramPerDay); + return new MassFlow(value, MassFlowUnit.CentigramPerDay); } /// - /// Get MassFlow from CentigramsPerSecond. + /// Get from CentigramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromCentigramsPerSecond(QuantityValue centigramspersecond) + public static MassFlow FromCentigramsPerSecond(QuantityValue centigramspersecond) { double value = (double) centigramspersecond; - return new MassFlow(value, MassFlowUnit.CentigramPerSecond); + return new MassFlow(value, MassFlowUnit.CentigramPerSecond); } /// - /// Get MassFlow from DecagramsPerDay. + /// Get from DecagramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromDecagramsPerDay(QuantityValue decagramsperday) + public static MassFlow FromDecagramsPerDay(QuantityValue decagramsperday) { double value = (double) decagramsperday; - return new MassFlow(value, MassFlowUnit.DecagramPerDay); + return new MassFlow(value, MassFlowUnit.DecagramPerDay); } /// - /// Get MassFlow from DecagramsPerSecond. + /// Get from DecagramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromDecagramsPerSecond(QuantityValue decagramspersecond) + public static MassFlow FromDecagramsPerSecond(QuantityValue decagramspersecond) { double value = (double) decagramspersecond; - return new MassFlow(value, MassFlowUnit.DecagramPerSecond); + return new MassFlow(value, MassFlowUnit.DecagramPerSecond); } /// - /// Get MassFlow from DecigramsPerDay. + /// Get from DecigramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromDecigramsPerDay(QuantityValue decigramsperday) + public static MassFlow FromDecigramsPerDay(QuantityValue decigramsperday) { double value = (double) decigramsperday; - return new MassFlow(value, MassFlowUnit.DecigramPerDay); + return new MassFlow(value, MassFlowUnit.DecigramPerDay); } /// - /// Get MassFlow from DecigramsPerSecond. + /// Get from DecigramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromDecigramsPerSecond(QuantityValue decigramspersecond) + public static MassFlow FromDecigramsPerSecond(QuantityValue decigramspersecond) { double value = (double) decigramspersecond; - return new MassFlow(value, MassFlowUnit.DecigramPerSecond); + return new MassFlow(value, MassFlowUnit.DecigramPerSecond); } /// - /// Get MassFlow from GramsPerDay. + /// Get from GramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromGramsPerDay(QuantityValue gramsperday) + public static MassFlow FromGramsPerDay(QuantityValue gramsperday) { double value = (double) gramsperday; - return new MassFlow(value, MassFlowUnit.GramPerDay); + return new MassFlow(value, MassFlowUnit.GramPerDay); } /// - /// Get MassFlow from GramsPerHour. + /// Get from GramsPerHour. /// /// If value is NaN or Infinity. - public static MassFlow FromGramsPerHour(QuantityValue gramsperhour) + public static MassFlow FromGramsPerHour(QuantityValue gramsperhour) { double value = (double) gramsperhour; - return new MassFlow(value, MassFlowUnit.GramPerHour); + return new MassFlow(value, MassFlowUnit.GramPerHour); } /// - /// Get MassFlow from GramsPerSecond. + /// Get from GramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromGramsPerSecond(QuantityValue gramspersecond) + public static MassFlow FromGramsPerSecond(QuantityValue gramspersecond) { double value = (double) gramspersecond; - return new MassFlow(value, MassFlowUnit.GramPerSecond); + return new MassFlow(value, MassFlowUnit.GramPerSecond); } /// - /// Get MassFlow from HectogramsPerDay. + /// Get from HectogramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromHectogramsPerDay(QuantityValue hectogramsperday) + public static MassFlow FromHectogramsPerDay(QuantityValue hectogramsperday) { double value = (double) hectogramsperday; - return new MassFlow(value, MassFlowUnit.HectogramPerDay); + return new MassFlow(value, MassFlowUnit.HectogramPerDay); } /// - /// Get MassFlow from HectogramsPerSecond. + /// Get from HectogramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromHectogramsPerSecond(QuantityValue hectogramspersecond) + public static MassFlow FromHectogramsPerSecond(QuantityValue hectogramspersecond) { double value = (double) hectogramspersecond; - return new MassFlow(value, MassFlowUnit.HectogramPerSecond); + return new MassFlow(value, MassFlowUnit.HectogramPerSecond); } /// - /// Get MassFlow from KilogramsPerDay. + /// Get from KilogramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromKilogramsPerDay(QuantityValue kilogramsperday) + public static MassFlow FromKilogramsPerDay(QuantityValue kilogramsperday) { double value = (double) kilogramsperday; - return new MassFlow(value, MassFlowUnit.KilogramPerDay); + return new MassFlow(value, MassFlowUnit.KilogramPerDay); } /// - /// Get MassFlow from KilogramsPerHour. + /// Get from KilogramsPerHour. /// /// If value is NaN or Infinity. - public static MassFlow FromKilogramsPerHour(QuantityValue kilogramsperhour) + public static MassFlow FromKilogramsPerHour(QuantityValue kilogramsperhour) { double value = (double) kilogramsperhour; - return new MassFlow(value, MassFlowUnit.KilogramPerHour); + return new MassFlow(value, MassFlowUnit.KilogramPerHour); } /// - /// Get MassFlow from KilogramsPerMinute. + /// Get from KilogramsPerMinute. /// /// If value is NaN or Infinity. - public static MassFlow FromKilogramsPerMinute(QuantityValue kilogramsperminute) + public static MassFlow FromKilogramsPerMinute(QuantityValue kilogramsperminute) { double value = (double) kilogramsperminute; - return new MassFlow(value, MassFlowUnit.KilogramPerMinute); + return new MassFlow(value, MassFlowUnit.KilogramPerMinute); } /// - /// Get MassFlow from KilogramsPerSecond. + /// Get from KilogramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromKilogramsPerSecond(QuantityValue kilogramspersecond) + public static MassFlow FromKilogramsPerSecond(QuantityValue kilogramspersecond) { double value = (double) kilogramspersecond; - return new MassFlow(value, MassFlowUnit.KilogramPerSecond); + return new MassFlow(value, MassFlowUnit.KilogramPerSecond); } /// - /// Get MassFlow from MegagramsPerDay. + /// Get from MegagramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromMegagramsPerDay(QuantityValue megagramsperday) + public static MassFlow FromMegagramsPerDay(QuantityValue megagramsperday) { double value = (double) megagramsperday; - return new MassFlow(value, MassFlowUnit.MegagramPerDay); + return new MassFlow(value, MassFlowUnit.MegagramPerDay); } /// - /// Get MassFlow from MegapoundsPerDay. + /// Get from MegapoundsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromMegapoundsPerDay(QuantityValue megapoundsperday) + public static MassFlow FromMegapoundsPerDay(QuantityValue megapoundsperday) { double value = (double) megapoundsperday; - return new MassFlow(value, MassFlowUnit.MegapoundPerDay); + return new MassFlow(value, MassFlowUnit.MegapoundPerDay); } /// - /// Get MassFlow from MegapoundsPerHour. + /// Get from MegapoundsPerHour. /// /// If value is NaN or Infinity. - public static MassFlow FromMegapoundsPerHour(QuantityValue megapoundsperhour) + public static MassFlow FromMegapoundsPerHour(QuantityValue megapoundsperhour) { double value = (double) megapoundsperhour; - return new MassFlow(value, MassFlowUnit.MegapoundPerHour); + return new MassFlow(value, MassFlowUnit.MegapoundPerHour); } /// - /// Get MassFlow from MegapoundsPerMinute. + /// Get from MegapoundsPerMinute. /// /// If value is NaN or Infinity. - public static MassFlow FromMegapoundsPerMinute(QuantityValue megapoundsperminute) + public static MassFlow FromMegapoundsPerMinute(QuantityValue megapoundsperminute) { double value = (double) megapoundsperminute; - return new MassFlow(value, MassFlowUnit.MegapoundPerMinute); + return new MassFlow(value, MassFlowUnit.MegapoundPerMinute); } /// - /// Get MassFlow from MegapoundsPerSecond. + /// Get from MegapoundsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromMegapoundsPerSecond(QuantityValue megapoundspersecond) + public static MassFlow FromMegapoundsPerSecond(QuantityValue megapoundspersecond) { double value = (double) megapoundspersecond; - return new MassFlow(value, MassFlowUnit.MegapoundPerSecond); + return new MassFlow(value, MassFlowUnit.MegapoundPerSecond); } /// - /// Get MassFlow from MicrogramsPerDay. + /// Get from MicrogramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromMicrogramsPerDay(QuantityValue microgramsperday) + public static MassFlow FromMicrogramsPerDay(QuantityValue microgramsperday) { double value = (double) microgramsperday; - return new MassFlow(value, MassFlowUnit.MicrogramPerDay); + return new MassFlow(value, MassFlowUnit.MicrogramPerDay); } /// - /// Get MassFlow from MicrogramsPerSecond. + /// Get from MicrogramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromMicrogramsPerSecond(QuantityValue microgramspersecond) + public static MassFlow FromMicrogramsPerSecond(QuantityValue microgramspersecond) { double value = (double) microgramspersecond; - return new MassFlow(value, MassFlowUnit.MicrogramPerSecond); + return new MassFlow(value, MassFlowUnit.MicrogramPerSecond); } /// - /// Get MassFlow from MilligramsPerDay. + /// Get from MilligramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromMilligramsPerDay(QuantityValue milligramsperday) + public static MassFlow FromMilligramsPerDay(QuantityValue milligramsperday) { double value = (double) milligramsperday; - return new MassFlow(value, MassFlowUnit.MilligramPerDay); + return new MassFlow(value, MassFlowUnit.MilligramPerDay); } /// - /// Get MassFlow from MilligramsPerSecond. + /// Get from MilligramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromMilligramsPerSecond(QuantityValue milligramspersecond) + public static MassFlow FromMilligramsPerSecond(QuantityValue milligramspersecond) { double value = (double) milligramspersecond; - return new MassFlow(value, MassFlowUnit.MilligramPerSecond); + return new MassFlow(value, MassFlowUnit.MilligramPerSecond); } /// - /// Get MassFlow from NanogramsPerDay. + /// Get from NanogramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromNanogramsPerDay(QuantityValue nanogramsperday) + public static MassFlow FromNanogramsPerDay(QuantityValue nanogramsperday) { double value = (double) nanogramsperday; - return new MassFlow(value, MassFlowUnit.NanogramPerDay); + return new MassFlow(value, MassFlowUnit.NanogramPerDay); } /// - /// Get MassFlow from NanogramsPerSecond. + /// Get from NanogramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromNanogramsPerSecond(QuantityValue nanogramspersecond) + public static MassFlow FromNanogramsPerSecond(QuantityValue nanogramspersecond) { double value = (double) nanogramspersecond; - return new MassFlow(value, MassFlowUnit.NanogramPerSecond); + return new MassFlow(value, MassFlowUnit.NanogramPerSecond); } /// - /// Get MassFlow from PoundsPerDay. + /// Get from PoundsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromPoundsPerDay(QuantityValue poundsperday) + public static MassFlow FromPoundsPerDay(QuantityValue poundsperday) { double value = (double) poundsperday; - return new MassFlow(value, MassFlowUnit.PoundPerDay); + return new MassFlow(value, MassFlowUnit.PoundPerDay); } /// - /// Get MassFlow from PoundsPerHour. + /// Get from PoundsPerHour. /// /// If value is NaN or Infinity. - public static MassFlow FromPoundsPerHour(QuantityValue poundsperhour) + public static MassFlow FromPoundsPerHour(QuantityValue poundsperhour) { double value = (double) poundsperhour; - return new MassFlow(value, MassFlowUnit.PoundPerHour); + return new MassFlow(value, MassFlowUnit.PoundPerHour); } /// - /// Get MassFlow from PoundsPerMinute. + /// Get from PoundsPerMinute. /// /// If value is NaN or Infinity. - public static MassFlow FromPoundsPerMinute(QuantityValue poundsperminute) + public static MassFlow FromPoundsPerMinute(QuantityValue poundsperminute) { double value = (double) poundsperminute; - return new MassFlow(value, MassFlowUnit.PoundPerMinute); + return new MassFlow(value, MassFlowUnit.PoundPerMinute); } /// - /// Get MassFlow from PoundsPerSecond. + /// Get from PoundsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromPoundsPerSecond(QuantityValue poundspersecond) + public static MassFlow FromPoundsPerSecond(QuantityValue poundspersecond) { double value = (double) poundspersecond; - return new MassFlow(value, MassFlowUnit.PoundPerSecond); + return new MassFlow(value, MassFlowUnit.PoundPerSecond); } /// - /// Get MassFlow from ShortTonsPerHour. + /// Get from ShortTonsPerHour. /// /// If value is NaN or Infinity. - public static MassFlow FromShortTonsPerHour(QuantityValue shorttonsperhour) + public static MassFlow FromShortTonsPerHour(QuantityValue shorttonsperhour) { double value = (double) shorttonsperhour; - return new MassFlow(value, MassFlowUnit.ShortTonPerHour); + return new MassFlow(value, MassFlowUnit.ShortTonPerHour); } /// - /// Get MassFlow from TonnesPerDay. + /// Get from TonnesPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromTonnesPerDay(QuantityValue tonnesperday) + public static MassFlow FromTonnesPerDay(QuantityValue tonnesperday) { double value = (double) tonnesperday; - return new MassFlow(value, MassFlowUnit.TonnePerDay); + return new MassFlow(value, MassFlowUnit.TonnePerDay); } /// - /// Get MassFlow from TonnesPerHour. + /// Get from TonnesPerHour. /// /// If value is NaN or Infinity. - public static MassFlow FromTonnesPerHour(QuantityValue tonnesperhour) + public static MassFlow FromTonnesPerHour(QuantityValue tonnesperhour) { double value = (double) tonnesperhour; - return new MassFlow(value, MassFlowUnit.TonnePerHour); + return new MassFlow(value, MassFlowUnit.TonnePerHour); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// MassFlow unit value. - public static MassFlow From(QuantityValue value, MassFlowUnit fromUnit) + /// unit value. + public static MassFlow From(QuantityValue value, MassFlowUnit fromUnit) { - return new MassFlow((double)value, fromUnit); + return new MassFlow((double)value, fromUnit); } #endregion @@ -724,7 +724,7 @@ public static MassFlow From(QuantityValue value, MassFlowUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static MassFlow Parse(string str) + public static MassFlow Parse(string str) { return Parse(str, null); } @@ -752,9 +752,9 @@ public static MassFlow Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static MassFlow Parse(string str, [CanBeNull] IFormatProvider provider) + public static MassFlow Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, MassFlowUnit>( str, provider, From); @@ -768,7 +768,7 @@ public static MassFlow Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out MassFlow result) + public static bool TryParse([CanBeNull] string str, out MassFlow result) { return TryParse(str, null, out result); } @@ -783,9 +783,9 @@ public static bool TryParse([CanBeNull] string str, out MassFlow result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlow result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlow result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, MassFlowUnit>( str, provider, From, @@ -847,43 +847,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFl #region Arithmetic Operators /// Negate the value. - public static MassFlow operator -(MassFlow right) + public static MassFlow operator -(MassFlow right) { - return new MassFlow(-right.Value, right.Unit); + return new MassFlow(-right.Value, right.Unit); } - /// Get from adding two . - public static MassFlow operator +(MassFlow left, MassFlow right) + /// Get from adding two . + public static MassFlow operator +(MassFlow left, MassFlow right) { - return new MassFlow(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new MassFlow(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static MassFlow operator -(MassFlow left, MassFlow right) + /// Get from subtracting two . + public static MassFlow operator -(MassFlow left, MassFlow right) { - return new MassFlow(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new MassFlow(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static MassFlow operator *(double left, MassFlow right) + /// Get from multiplying value and . + public static MassFlow operator *(double left, MassFlow right) { - return new MassFlow(left * right.Value, right.Unit); + return new MassFlow(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static MassFlow operator *(MassFlow left, double right) + /// Get from multiplying value and . + public static MassFlow operator *(MassFlow left, double right) { - return new MassFlow(left.Value * right, left.Unit); + return new MassFlow(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static MassFlow operator /(MassFlow left, double right) + /// Get from dividing by value. + public static MassFlow operator /(MassFlow left, double right) { - return new MassFlow(left.Value / right, left.Unit); + return new MassFlow(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(MassFlow left, MassFlow right) + /// Get ratio value from dividing by . + public static double operator /(MassFlow left, MassFlow right) { return left.GramsPerSecond / right.GramsPerSecond; } @@ -893,39 +893,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFl #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(MassFlow left, MassFlow right) + public static bool operator <=(MassFlow left, MassFlow right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(MassFlow left, MassFlow right) + public static bool operator >=(MassFlow left, MassFlow right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(MassFlow left, MassFlow right) + public static bool operator <(MassFlow left, MassFlow right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(MassFlow left, MassFlow right) + public static bool operator >(MassFlow left, MassFlow right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(MassFlow left, MassFlow right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(MassFlow left, MassFlow right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(MassFlow left, MassFlow right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(MassFlow left, MassFlow right) { return !(left == right); } @@ -934,37 +934,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFl public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassFlow objMassFlow)) throw new ArgumentException("Expected type MassFlow.", nameof(obj)); + if(!(obj is MassFlow objMassFlow)) throw new ArgumentException("Expected type MassFlow.", nameof(obj)); return CompareTo(objMassFlow); } /// - public int CompareTo(MassFlow other) + public int CompareTo(MassFlow other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MassFlow objMassFlow)) + if(obj is null || !(obj is MassFlow objMassFlow)) return false; return Equals(objMassFlow); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(MassFlow other) + /// Consider using for safely comparing floating point values. + public bool Equals(MassFlow other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another MassFlow within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -1002,7 +1002,7 @@ public bool Equals(MassFlow other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MassFlow other, double tolerance, ComparisonType comparisonType) + public bool Equals(MassFlow other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -1016,7 +1016,7 @@ public bool Equals(MassFlow other, double tolerance, ComparisonType comparisonTy /// /// Returns the hash code for this instance. /// - /// A hash code for the current MassFlow. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -1064,13 +1064,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this MassFlow to another MassFlow with the unit representation . + /// Converts this to another with the unit representation . /// - /// A MassFlow with the specified unit. - public MassFlow ToUnit(MassFlowUnit unit) + /// A with the specified unit. + public MassFlow ToUnit(MassFlowUnit unit) { var convertedValue = GetValueAs(unit); - return new MassFlow(convertedValue, unit); + return new MassFlow(convertedValue, unit); } /// @@ -1083,7 +1083,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public MassFlow ToUnit(UnitSystem unitSystem) + public MassFlow ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1158,10 +1158,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal MassFlow ToBaseUnit() + internal MassFlow ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new MassFlow(baseUnitValue, BaseUnit); + return new MassFlow(baseUnitValue, BaseUnit); } private double GetValueAs(MassFlowUnit unit) @@ -1302,7 +1302,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MassFlow)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(MassFlow)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1312,12 +1312,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MassFlow)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(MassFlow)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MassFlow)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(MassFlow)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1362,16 +1362,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MassFlow)) + if(conversionType == typeof(MassFlow)) return this; else if(conversionType == typeof(MassFlowUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return MassFlow.QuantityType; + return MassFlow.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return MassFlow.BaseDimensions; + return MassFlow.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(MassFlow)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(MassFlow)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs index 3b7bd4c264..7c90779735 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Mass flux is the mass flow rate per unit area. /// - public partial struct MassFlux : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct MassFlux : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -101,19 +101,19 @@ public MassFlux(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of MassFlux, which is KilogramPerSecondPerSquareMeter. All conversions go via this value. + /// The base unit of , which is KilogramPerSecondPerSquareMeter. All conversions go via this value. /// public static MassFluxUnit BaseUnit { get; } = MassFluxUnit.KilogramPerSecondPerSquareMeter; /// - /// Represents the largest possible value of MassFlux + /// Represents the largest possible value of /// - public static MassFlux MaxValue { get; } = new MassFlux(double.MaxValue, BaseUnit); + public static MassFlux MaxValue { get; } = new MassFlux(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of MassFlux + /// Represents the smallest possible value of /// - public static MassFlux MinValue { get; } = new MassFlux(double.MinValue, BaseUnit); + public static MassFlux MinValue { get; } = new MassFlux(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -121,14 +121,14 @@ public MassFlux(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.MassFlux; /// - /// All units of measurement for the MassFlux quantity. + /// All units of measurement for the quantity. /// public static MassFluxUnit[] Units { get; } = Enum.GetValues(typeof(MassFluxUnit)).Cast().Except(new MassFluxUnit[]{ MassFluxUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerSecondPerSquareMeter. /// - public static MassFlux Zero { get; } = new MassFlux(0, BaseUnit); + public static MassFlux Zero { get; } = new MassFlux(0, BaseUnit); #endregion @@ -153,24 +153,24 @@ public MassFlux(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => MassFlux.QuantityType; + public QuantityType Type => MassFlux.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => MassFlux.BaseDimensions; + public BaseDimensions Dimensions => MassFlux.BaseDimensions; #endregion #region Conversion Properties /// - /// Get MassFlux in GramsPerSecondPerSquareMeter. + /// Get in GramsPerSecondPerSquareMeter. /// public double GramsPerSecondPerSquareMeter => As(MassFluxUnit.GramPerSecondPerSquareMeter); /// - /// Get MassFlux in KilogramsPerSecondPerSquareMeter. + /// Get in KilogramsPerSecondPerSquareMeter. /// public double KilogramsPerSecondPerSquareMeter => As(MassFluxUnit.KilogramPerSecondPerSquareMeter); @@ -204,33 +204,33 @@ public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] IFormatProvi #region Static Factory Methods /// - /// Get MassFlux from GramsPerSecondPerSquareMeter. + /// Get from GramsPerSecondPerSquareMeter. /// /// If value is NaN or Infinity. - public static MassFlux FromGramsPerSecondPerSquareMeter(QuantityValue gramspersecondpersquaremeter) + public static MassFlux FromGramsPerSecondPerSquareMeter(QuantityValue gramspersecondpersquaremeter) { double value = (double) gramspersecondpersquaremeter; - return new MassFlux(value, MassFluxUnit.GramPerSecondPerSquareMeter); + return new MassFlux(value, MassFluxUnit.GramPerSecondPerSquareMeter); } /// - /// Get MassFlux from KilogramsPerSecondPerSquareMeter. + /// Get from KilogramsPerSecondPerSquareMeter. /// /// If value is NaN or Infinity. - public static MassFlux FromKilogramsPerSecondPerSquareMeter(QuantityValue kilogramspersecondpersquaremeter) + public static MassFlux FromKilogramsPerSecondPerSquareMeter(QuantityValue kilogramspersecondpersquaremeter) { double value = (double) kilogramspersecondpersquaremeter; - return new MassFlux(value, MassFluxUnit.KilogramPerSecondPerSquareMeter); + return new MassFlux(value, MassFluxUnit.KilogramPerSecondPerSquareMeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// MassFlux unit value. - public static MassFlux From(QuantityValue value, MassFluxUnit fromUnit) + /// unit value. + public static MassFlux From(QuantityValue value, MassFluxUnit fromUnit) { - return new MassFlux((double)value, fromUnit); + return new MassFlux((double)value, fromUnit); } #endregion @@ -259,7 +259,7 @@ public static MassFlux From(QuantityValue value, MassFluxUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static MassFlux Parse(string str) + public static MassFlux Parse(string str) { return Parse(str, null); } @@ -287,9 +287,9 @@ public static MassFlux Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static MassFlux Parse(string str, [CanBeNull] IFormatProvider provider) + public static MassFlux Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, MassFluxUnit>( str, provider, From); @@ -303,7 +303,7 @@ public static MassFlux Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out MassFlux result) + public static bool TryParse([CanBeNull] string str, out MassFlux result) { return TryParse(str, null, out result); } @@ -318,9 +318,9 @@ public static bool TryParse([CanBeNull] string str, out MassFlux result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlux result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlux result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, MassFluxUnit>( str, provider, From, @@ -382,43 +382,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFl #region Arithmetic Operators /// Negate the value. - public static MassFlux operator -(MassFlux right) + public static MassFlux operator -(MassFlux right) { - return new MassFlux(-right.Value, right.Unit); + return new MassFlux(-right.Value, right.Unit); } - /// Get from adding two . - public static MassFlux operator +(MassFlux left, MassFlux right) + /// Get from adding two . + public static MassFlux operator +(MassFlux left, MassFlux right) { - return new MassFlux(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new MassFlux(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static MassFlux operator -(MassFlux left, MassFlux right) + /// Get from subtracting two . + public static MassFlux operator -(MassFlux left, MassFlux right) { - return new MassFlux(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new MassFlux(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static MassFlux operator *(double left, MassFlux right) + /// Get from multiplying value and . + public static MassFlux operator *(double left, MassFlux right) { - return new MassFlux(left * right.Value, right.Unit); + return new MassFlux(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static MassFlux operator *(MassFlux left, double right) + /// Get from multiplying value and . + public static MassFlux operator *(MassFlux left, double right) { - return new MassFlux(left.Value * right, left.Unit); + return new MassFlux(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static MassFlux operator /(MassFlux left, double right) + /// Get from dividing by value. + public static MassFlux operator /(MassFlux left, double right) { - return new MassFlux(left.Value / right, left.Unit); + return new MassFlux(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(MassFlux left, MassFlux right) + /// Get ratio value from dividing by . + public static double operator /(MassFlux left, MassFlux right) { return left.KilogramsPerSecondPerSquareMeter / right.KilogramsPerSecondPerSquareMeter; } @@ -428,39 +428,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFl #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(MassFlux left, MassFlux right) + public static bool operator <=(MassFlux left, MassFlux right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(MassFlux left, MassFlux right) + public static bool operator >=(MassFlux left, MassFlux right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(MassFlux left, MassFlux right) + public static bool operator <(MassFlux left, MassFlux right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(MassFlux left, MassFlux right) + public static bool operator >(MassFlux left, MassFlux right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(MassFlux left, MassFlux right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(MassFlux left, MassFlux right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(MassFlux left, MassFlux right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(MassFlux left, MassFlux right) { return !(left == right); } @@ -469,37 +469,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFl public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassFlux objMassFlux)) throw new ArgumentException("Expected type MassFlux.", nameof(obj)); + if(!(obj is MassFlux objMassFlux)) throw new ArgumentException("Expected type MassFlux.", nameof(obj)); return CompareTo(objMassFlux); } /// - public int CompareTo(MassFlux other) + public int CompareTo(MassFlux other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MassFlux objMassFlux)) + if(obj is null || !(obj is MassFlux objMassFlux)) return false; return Equals(objMassFlux); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(MassFlux other) + /// Consider using for safely comparing floating point values. + public bool Equals(MassFlux other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another MassFlux within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -537,7 +537,7 @@ public bool Equals(MassFlux other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MassFlux other, double tolerance, ComparisonType comparisonType) + public bool Equals(MassFlux other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -551,7 +551,7 @@ public bool Equals(MassFlux other, double tolerance, ComparisonType comparisonTy /// /// Returns the hash code for this instance. /// - /// A hash code for the current MassFlux. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -599,13 +599,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this MassFlux to another MassFlux with the unit representation . + /// Converts this to another with the unit representation . /// - /// A MassFlux with the specified unit. - public MassFlux ToUnit(MassFluxUnit unit) + /// A with the specified unit. + public MassFlux ToUnit(MassFluxUnit unit) { var convertedValue = GetValueAs(unit); - return new MassFlux(convertedValue, unit); + return new MassFlux(convertedValue, unit); } /// @@ -618,7 +618,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public MassFlux ToUnit(UnitSystem unitSystem) + public MassFlux ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -662,10 +662,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal MassFlux ToBaseUnit() + internal MassFlux ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new MassFlux(baseUnitValue, BaseUnit); + return new MassFlux(baseUnitValue, BaseUnit); } private double GetValueAs(MassFluxUnit unit) @@ -775,7 +775,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MassFlux)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(MassFlux)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -785,12 +785,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MassFlux)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(MassFlux)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MassFlux)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(MassFlux)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -835,16 +835,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MassFlux)) + if(conversionType == typeof(MassFlux)) return this; else if(conversionType == typeof(MassFluxUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return MassFlux.QuantityType; + return MassFlux.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return MassFlux.BaseDimensions; + return MassFlux.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(MassFlux)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(MassFlux)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs index 22ab031331..19007f0676 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Mass_fraction_(chemistry) /// - public partial struct MassFraction : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct MassFraction : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -126,19 +126,19 @@ public MassFraction(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of MassFraction, which is DecimalFraction. All conversions go via this value. + /// The base unit of , which is DecimalFraction. All conversions go via this value. /// public static MassFractionUnit BaseUnit { get; } = MassFractionUnit.DecimalFraction; /// - /// Represents the largest possible value of MassFraction + /// Represents the largest possible value of /// - public static MassFraction MaxValue { get; } = new MassFraction(double.MaxValue, BaseUnit); + public static MassFraction MaxValue { get; } = new MassFraction(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of MassFraction + /// Represents the smallest possible value of /// - public static MassFraction MinValue { get; } = new MassFraction(double.MinValue, BaseUnit); + public static MassFraction MinValue { get; } = new MassFraction(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -146,14 +146,14 @@ public MassFraction(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.MassFraction; /// - /// All units of measurement for the MassFraction quantity. + /// All units of measurement for the quantity. /// public static MassFractionUnit[] Units { get; } = Enum.GetValues(typeof(MassFractionUnit)).Cast().Except(new MassFractionUnit[]{ MassFractionUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit DecimalFraction. /// - public static MassFraction Zero { get; } = new MassFraction(0, BaseUnit); + public static MassFraction Zero { get; } = new MassFraction(0, BaseUnit); #endregion @@ -178,134 +178,134 @@ public MassFraction(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => MassFraction.QuantityType; + public QuantityType Type => MassFraction.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => MassFraction.BaseDimensions; + public BaseDimensions Dimensions => MassFraction.BaseDimensions; #endregion #region Conversion Properties /// - /// Get MassFraction in CentigramsPerGram. + /// Get in CentigramsPerGram. /// public double CentigramsPerGram => As(MassFractionUnit.CentigramPerGram); /// - /// Get MassFraction in CentigramsPerKilogram. + /// Get in CentigramsPerKilogram. /// public double CentigramsPerKilogram => As(MassFractionUnit.CentigramPerKilogram); /// - /// Get MassFraction in DecagramsPerGram. + /// Get in DecagramsPerGram. /// public double DecagramsPerGram => As(MassFractionUnit.DecagramPerGram); /// - /// Get MassFraction in DecagramsPerKilogram. + /// Get in DecagramsPerKilogram. /// public double DecagramsPerKilogram => As(MassFractionUnit.DecagramPerKilogram); /// - /// Get MassFraction in DecigramsPerGram. + /// Get in DecigramsPerGram. /// public double DecigramsPerGram => As(MassFractionUnit.DecigramPerGram); /// - /// Get MassFraction in DecigramsPerKilogram. + /// Get in DecigramsPerKilogram. /// public double DecigramsPerKilogram => As(MassFractionUnit.DecigramPerKilogram); /// - /// Get MassFraction in DecimalFractions. + /// Get in DecimalFractions. /// public double DecimalFractions => As(MassFractionUnit.DecimalFraction); /// - /// Get MassFraction in GramsPerGram. + /// Get in GramsPerGram. /// public double GramsPerGram => As(MassFractionUnit.GramPerGram); /// - /// Get MassFraction in GramsPerKilogram. + /// Get in GramsPerKilogram. /// public double GramsPerKilogram => As(MassFractionUnit.GramPerKilogram); /// - /// Get MassFraction in HectogramsPerGram. + /// Get in HectogramsPerGram. /// public double HectogramsPerGram => As(MassFractionUnit.HectogramPerGram); /// - /// Get MassFraction in HectogramsPerKilogram. + /// Get in HectogramsPerKilogram. /// public double HectogramsPerKilogram => As(MassFractionUnit.HectogramPerKilogram); /// - /// Get MassFraction in KilogramsPerGram. + /// Get in KilogramsPerGram. /// public double KilogramsPerGram => As(MassFractionUnit.KilogramPerGram); /// - /// Get MassFraction in KilogramsPerKilogram. + /// Get in KilogramsPerKilogram. /// public double KilogramsPerKilogram => As(MassFractionUnit.KilogramPerKilogram); /// - /// Get MassFraction in MicrogramsPerGram. + /// Get in MicrogramsPerGram. /// public double MicrogramsPerGram => As(MassFractionUnit.MicrogramPerGram); /// - /// Get MassFraction in MicrogramsPerKilogram. + /// Get in MicrogramsPerKilogram. /// public double MicrogramsPerKilogram => As(MassFractionUnit.MicrogramPerKilogram); /// - /// Get MassFraction in MilligramsPerGram. + /// Get in MilligramsPerGram. /// public double MilligramsPerGram => As(MassFractionUnit.MilligramPerGram); /// - /// Get MassFraction in MilligramsPerKilogram. + /// Get in MilligramsPerKilogram. /// public double MilligramsPerKilogram => As(MassFractionUnit.MilligramPerKilogram); /// - /// Get MassFraction in NanogramsPerGram. + /// Get in NanogramsPerGram. /// public double NanogramsPerGram => As(MassFractionUnit.NanogramPerGram); /// - /// Get MassFraction in NanogramsPerKilogram. + /// Get in NanogramsPerKilogram. /// public double NanogramsPerKilogram => As(MassFractionUnit.NanogramPerKilogram); /// - /// Get MassFraction in PartsPerBillion. + /// Get in PartsPerBillion. /// public double PartsPerBillion => As(MassFractionUnit.PartPerBillion); /// - /// Get MassFraction in PartsPerMillion. + /// Get in PartsPerMillion. /// public double PartsPerMillion => As(MassFractionUnit.PartPerMillion); /// - /// Get MassFraction in PartsPerThousand. + /// Get in PartsPerThousand. /// public double PartsPerThousand => As(MassFractionUnit.PartPerThousand); /// - /// Get MassFraction in PartsPerTrillion. + /// Get in PartsPerTrillion. /// public double PartsPerTrillion => As(MassFractionUnit.PartPerTrillion); /// - /// Get MassFraction in Percent. + /// Get in Percent. /// public double Percent => As(MassFractionUnit.Percent); @@ -339,231 +339,231 @@ public static string GetAbbreviation(MassFractionUnit unit, [CanBeNull] IFormatP #region Static Factory Methods /// - /// Get MassFraction from CentigramsPerGram. + /// Get from CentigramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromCentigramsPerGram(QuantityValue centigramspergram) + public static MassFraction FromCentigramsPerGram(QuantityValue centigramspergram) { double value = (double) centigramspergram; - return new MassFraction(value, MassFractionUnit.CentigramPerGram); + return new MassFraction(value, MassFractionUnit.CentigramPerGram); } /// - /// Get MassFraction from CentigramsPerKilogram. + /// Get from CentigramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromCentigramsPerKilogram(QuantityValue centigramsperkilogram) + public static MassFraction FromCentigramsPerKilogram(QuantityValue centigramsperkilogram) { double value = (double) centigramsperkilogram; - return new MassFraction(value, MassFractionUnit.CentigramPerKilogram); + return new MassFraction(value, MassFractionUnit.CentigramPerKilogram); } /// - /// Get MassFraction from DecagramsPerGram. + /// Get from DecagramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromDecagramsPerGram(QuantityValue decagramspergram) + public static MassFraction FromDecagramsPerGram(QuantityValue decagramspergram) { double value = (double) decagramspergram; - return new MassFraction(value, MassFractionUnit.DecagramPerGram); + return new MassFraction(value, MassFractionUnit.DecagramPerGram); } /// - /// Get MassFraction from DecagramsPerKilogram. + /// Get from DecagramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromDecagramsPerKilogram(QuantityValue decagramsperkilogram) + public static MassFraction FromDecagramsPerKilogram(QuantityValue decagramsperkilogram) { double value = (double) decagramsperkilogram; - return new MassFraction(value, MassFractionUnit.DecagramPerKilogram); + return new MassFraction(value, MassFractionUnit.DecagramPerKilogram); } /// - /// Get MassFraction from DecigramsPerGram. + /// Get from DecigramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromDecigramsPerGram(QuantityValue decigramspergram) + public static MassFraction FromDecigramsPerGram(QuantityValue decigramspergram) { double value = (double) decigramspergram; - return new MassFraction(value, MassFractionUnit.DecigramPerGram); + return new MassFraction(value, MassFractionUnit.DecigramPerGram); } /// - /// Get MassFraction from DecigramsPerKilogram. + /// Get from DecigramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromDecigramsPerKilogram(QuantityValue decigramsperkilogram) + public static MassFraction FromDecigramsPerKilogram(QuantityValue decigramsperkilogram) { double value = (double) decigramsperkilogram; - return new MassFraction(value, MassFractionUnit.DecigramPerKilogram); + return new MassFraction(value, MassFractionUnit.DecigramPerKilogram); } /// - /// Get MassFraction from DecimalFractions. + /// Get from DecimalFractions. /// /// If value is NaN or Infinity. - public static MassFraction FromDecimalFractions(QuantityValue decimalfractions) + public static MassFraction FromDecimalFractions(QuantityValue decimalfractions) { double value = (double) decimalfractions; - return new MassFraction(value, MassFractionUnit.DecimalFraction); + return new MassFraction(value, MassFractionUnit.DecimalFraction); } /// - /// Get MassFraction from GramsPerGram. + /// Get from GramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromGramsPerGram(QuantityValue gramspergram) + public static MassFraction FromGramsPerGram(QuantityValue gramspergram) { double value = (double) gramspergram; - return new MassFraction(value, MassFractionUnit.GramPerGram); + return new MassFraction(value, MassFractionUnit.GramPerGram); } /// - /// Get MassFraction from GramsPerKilogram. + /// Get from GramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromGramsPerKilogram(QuantityValue gramsperkilogram) + public static MassFraction FromGramsPerKilogram(QuantityValue gramsperkilogram) { double value = (double) gramsperkilogram; - return new MassFraction(value, MassFractionUnit.GramPerKilogram); + return new MassFraction(value, MassFractionUnit.GramPerKilogram); } /// - /// Get MassFraction from HectogramsPerGram. + /// Get from HectogramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromHectogramsPerGram(QuantityValue hectogramspergram) + public static MassFraction FromHectogramsPerGram(QuantityValue hectogramspergram) { double value = (double) hectogramspergram; - return new MassFraction(value, MassFractionUnit.HectogramPerGram); + return new MassFraction(value, MassFractionUnit.HectogramPerGram); } /// - /// Get MassFraction from HectogramsPerKilogram. + /// Get from HectogramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromHectogramsPerKilogram(QuantityValue hectogramsperkilogram) + public static MassFraction FromHectogramsPerKilogram(QuantityValue hectogramsperkilogram) { double value = (double) hectogramsperkilogram; - return new MassFraction(value, MassFractionUnit.HectogramPerKilogram); + return new MassFraction(value, MassFractionUnit.HectogramPerKilogram); } /// - /// Get MassFraction from KilogramsPerGram. + /// Get from KilogramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromKilogramsPerGram(QuantityValue kilogramspergram) + public static MassFraction FromKilogramsPerGram(QuantityValue kilogramspergram) { double value = (double) kilogramspergram; - return new MassFraction(value, MassFractionUnit.KilogramPerGram); + return new MassFraction(value, MassFractionUnit.KilogramPerGram); } /// - /// Get MassFraction from KilogramsPerKilogram. + /// Get from KilogramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromKilogramsPerKilogram(QuantityValue kilogramsperkilogram) + public static MassFraction FromKilogramsPerKilogram(QuantityValue kilogramsperkilogram) { double value = (double) kilogramsperkilogram; - return new MassFraction(value, MassFractionUnit.KilogramPerKilogram); + return new MassFraction(value, MassFractionUnit.KilogramPerKilogram); } /// - /// Get MassFraction from MicrogramsPerGram. + /// Get from MicrogramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromMicrogramsPerGram(QuantityValue microgramspergram) + public static MassFraction FromMicrogramsPerGram(QuantityValue microgramspergram) { double value = (double) microgramspergram; - return new MassFraction(value, MassFractionUnit.MicrogramPerGram); + return new MassFraction(value, MassFractionUnit.MicrogramPerGram); } /// - /// Get MassFraction from MicrogramsPerKilogram. + /// Get from MicrogramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromMicrogramsPerKilogram(QuantityValue microgramsperkilogram) + public static MassFraction FromMicrogramsPerKilogram(QuantityValue microgramsperkilogram) { double value = (double) microgramsperkilogram; - return new MassFraction(value, MassFractionUnit.MicrogramPerKilogram); + return new MassFraction(value, MassFractionUnit.MicrogramPerKilogram); } /// - /// Get MassFraction from MilligramsPerGram. + /// Get from MilligramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromMilligramsPerGram(QuantityValue milligramspergram) + public static MassFraction FromMilligramsPerGram(QuantityValue milligramspergram) { double value = (double) milligramspergram; - return new MassFraction(value, MassFractionUnit.MilligramPerGram); + return new MassFraction(value, MassFractionUnit.MilligramPerGram); } /// - /// Get MassFraction from MilligramsPerKilogram. + /// Get from MilligramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromMilligramsPerKilogram(QuantityValue milligramsperkilogram) + public static MassFraction FromMilligramsPerKilogram(QuantityValue milligramsperkilogram) { double value = (double) milligramsperkilogram; - return new MassFraction(value, MassFractionUnit.MilligramPerKilogram); + return new MassFraction(value, MassFractionUnit.MilligramPerKilogram); } /// - /// Get MassFraction from NanogramsPerGram. + /// Get from NanogramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromNanogramsPerGram(QuantityValue nanogramspergram) + public static MassFraction FromNanogramsPerGram(QuantityValue nanogramspergram) { double value = (double) nanogramspergram; - return new MassFraction(value, MassFractionUnit.NanogramPerGram); + return new MassFraction(value, MassFractionUnit.NanogramPerGram); } /// - /// Get MassFraction from NanogramsPerKilogram. + /// Get from NanogramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromNanogramsPerKilogram(QuantityValue nanogramsperkilogram) + public static MassFraction FromNanogramsPerKilogram(QuantityValue nanogramsperkilogram) { double value = (double) nanogramsperkilogram; - return new MassFraction(value, MassFractionUnit.NanogramPerKilogram); + return new MassFraction(value, MassFractionUnit.NanogramPerKilogram); } /// - /// Get MassFraction from PartsPerBillion. + /// Get from PartsPerBillion. /// /// If value is NaN or Infinity. - public static MassFraction FromPartsPerBillion(QuantityValue partsperbillion) + public static MassFraction FromPartsPerBillion(QuantityValue partsperbillion) { double value = (double) partsperbillion; - return new MassFraction(value, MassFractionUnit.PartPerBillion); + return new MassFraction(value, MassFractionUnit.PartPerBillion); } /// - /// Get MassFraction from PartsPerMillion. + /// Get from PartsPerMillion. /// /// If value is NaN or Infinity. - public static MassFraction FromPartsPerMillion(QuantityValue partspermillion) + public static MassFraction FromPartsPerMillion(QuantityValue partspermillion) { double value = (double) partspermillion; - return new MassFraction(value, MassFractionUnit.PartPerMillion); + return new MassFraction(value, MassFractionUnit.PartPerMillion); } /// - /// Get MassFraction from PartsPerThousand. + /// Get from PartsPerThousand. /// /// If value is NaN or Infinity. - public static MassFraction FromPartsPerThousand(QuantityValue partsperthousand) + public static MassFraction FromPartsPerThousand(QuantityValue partsperthousand) { double value = (double) partsperthousand; - return new MassFraction(value, MassFractionUnit.PartPerThousand); + return new MassFraction(value, MassFractionUnit.PartPerThousand); } /// - /// Get MassFraction from PartsPerTrillion. + /// Get from PartsPerTrillion. /// /// If value is NaN or Infinity. - public static MassFraction FromPartsPerTrillion(QuantityValue partspertrillion) + public static MassFraction FromPartsPerTrillion(QuantityValue partspertrillion) { double value = (double) partspertrillion; - return new MassFraction(value, MassFractionUnit.PartPerTrillion); + return new MassFraction(value, MassFractionUnit.PartPerTrillion); } /// - /// Get MassFraction from Percent. + /// Get from Percent. /// /// If value is NaN or Infinity. - public static MassFraction FromPercent(QuantityValue percent) + public static MassFraction FromPercent(QuantityValue percent) { double value = (double) percent; - return new MassFraction(value, MassFractionUnit.Percent); + return new MassFraction(value, MassFractionUnit.Percent); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// MassFraction unit value. - public static MassFraction From(QuantityValue value, MassFractionUnit fromUnit) + /// unit value. + public static MassFraction From(QuantityValue value, MassFractionUnit fromUnit) { - return new MassFraction((double)value, fromUnit); + return new MassFraction((double)value, fromUnit); } #endregion @@ -592,7 +592,7 @@ public static MassFraction From(QuantityValue value, MassFractionUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static MassFraction Parse(string str) + public static MassFraction Parse(string str) { return Parse(str, null); } @@ -620,9 +620,9 @@ public static MassFraction Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static MassFraction Parse(string str, [CanBeNull] IFormatProvider provider) + public static MassFraction Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, MassFractionUnit>( str, provider, From); @@ -636,7 +636,7 @@ public static MassFraction Parse(string str, [CanBeNull] IFormatProvider provide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out MassFraction result) + public static bool TryParse([CanBeNull] string str, out MassFraction result) { return TryParse(str, null, out result); } @@ -651,9 +651,9 @@ public static bool TryParse([CanBeNull] string str, out MassFraction result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFraction result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFraction result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, MassFractionUnit>( str, provider, From, @@ -715,43 +715,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFr #region Arithmetic Operators /// Negate the value. - public static MassFraction operator -(MassFraction right) + public static MassFraction operator -(MassFraction right) { - return new MassFraction(-right.Value, right.Unit); + return new MassFraction(-right.Value, right.Unit); } - /// Get from adding two . - public static MassFraction operator +(MassFraction left, MassFraction right) + /// Get from adding two . + public static MassFraction operator +(MassFraction left, MassFraction right) { - return new MassFraction(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new MassFraction(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static MassFraction operator -(MassFraction left, MassFraction right) + /// Get from subtracting two . + public static MassFraction operator -(MassFraction left, MassFraction right) { - return new MassFraction(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new MassFraction(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static MassFraction operator *(double left, MassFraction right) + /// Get from multiplying value and . + public static MassFraction operator *(double left, MassFraction right) { - return new MassFraction(left * right.Value, right.Unit); + return new MassFraction(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static MassFraction operator *(MassFraction left, double right) + /// Get from multiplying value and . + public static MassFraction operator *(MassFraction left, double right) { - return new MassFraction(left.Value * right, left.Unit); + return new MassFraction(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static MassFraction operator /(MassFraction left, double right) + /// Get from dividing by value. + public static MassFraction operator /(MassFraction left, double right) { - return new MassFraction(left.Value / right, left.Unit); + return new MassFraction(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(MassFraction left, MassFraction right) + /// Get ratio value from dividing by . + public static double operator /(MassFraction left, MassFraction right) { return left.DecimalFractions / right.DecimalFractions; } @@ -761,39 +761,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFr #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(MassFraction left, MassFraction right) + public static bool operator <=(MassFraction left, MassFraction right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(MassFraction left, MassFraction right) + public static bool operator >=(MassFraction left, MassFraction right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(MassFraction left, MassFraction right) + public static bool operator <(MassFraction left, MassFraction right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(MassFraction left, MassFraction right) + public static bool operator >(MassFraction left, MassFraction right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(MassFraction left, MassFraction right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(MassFraction left, MassFraction right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(MassFraction left, MassFraction right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(MassFraction left, MassFraction right) { return !(left == right); } @@ -802,37 +802,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFr public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassFraction objMassFraction)) throw new ArgumentException("Expected type MassFraction.", nameof(obj)); + if(!(obj is MassFraction objMassFraction)) throw new ArgumentException("Expected type MassFraction.", nameof(obj)); return CompareTo(objMassFraction); } /// - public int CompareTo(MassFraction other) + public int CompareTo(MassFraction other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MassFraction objMassFraction)) + if(obj is null || !(obj is MassFraction objMassFraction)) return false; return Equals(objMassFraction); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(MassFraction other) + /// Consider using for safely comparing floating point values. + public bool Equals(MassFraction other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another MassFraction within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -870,7 +870,7 @@ public bool Equals(MassFraction other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MassFraction other, double tolerance, ComparisonType comparisonType) + public bool Equals(MassFraction other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -884,7 +884,7 @@ public bool Equals(MassFraction other, double tolerance, ComparisonType comparis /// /// Returns the hash code for this instance. /// - /// A hash code for the current MassFraction. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -932,13 +932,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this MassFraction to another MassFraction with the unit representation . + /// Converts this to another with the unit representation . /// - /// A MassFraction with the specified unit. - public MassFraction ToUnit(MassFractionUnit unit) + /// A with the specified unit. + public MassFraction ToUnit(MassFractionUnit unit) { var convertedValue = GetValueAs(unit); - return new MassFraction(convertedValue, unit); + return new MassFraction(convertedValue, unit); } /// @@ -951,7 +951,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public MassFraction ToUnit(UnitSystem unitSystem) + public MassFraction ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1017,10 +1017,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal MassFraction ToBaseUnit() + internal MassFraction ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new MassFraction(baseUnitValue, BaseUnit); + return new MassFraction(baseUnitValue, BaseUnit); } private double GetValueAs(MassFractionUnit unit) @@ -1152,7 +1152,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MassFraction)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(MassFraction)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1162,12 +1162,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MassFraction)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(MassFraction)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MassFraction)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(MassFraction)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1212,16 +1212,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MassFraction)) + if(conversionType == typeof(MassFraction)) return this; else if(conversionType == typeof(MassFractionUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return MassFraction.QuantityType; + return MassFraction.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return MassFraction.BaseDimensions; + return MassFraction.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(MassFraction)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(MassFraction)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs index c5964e13bf..4d919bedf0 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// A property of body reflects how its mass is distributed with regard to an axis. /// - public partial struct MassMomentOfInertia : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct MassMomentOfInertia : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -127,19 +127,19 @@ public MassMomentOfInertia(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of MassMomentOfInertia, which is KilogramSquareMeter. All conversions go via this value. + /// The base unit of , which is KilogramSquareMeter. All conversions go via this value. /// public static MassMomentOfInertiaUnit BaseUnit { get; } = MassMomentOfInertiaUnit.KilogramSquareMeter; /// - /// Represents the largest possible value of MassMomentOfInertia + /// Represents the largest possible value of /// - public static MassMomentOfInertia MaxValue { get; } = new MassMomentOfInertia(double.MaxValue, BaseUnit); + public static MassMomentOfInertia MaxValue { get; } = new MassMomentOfInertia(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of MassMomentOfInertia + /// Represents the smallest possible value of /// - public static MassMomentOfInertia MinValue { get; } = new MassMomentOfInertia(double.MinValue, BaseUnit); + public static MassMomentOfInertia MinValue { get; } = new MassMomentOfInertia(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -147,14 +147,14 @@ public MassMomentOfInertia(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.MassMomentOfInertia; /// - /// All units of measurement for the MassMomentOfInertia quantity. + /// All units of measurement for the quantity. /// public static MassMomentOfInertiaUnit[] Units { get; } = Enum.GetValues(typeof(MassMomentOfInertiaUnit)).Cast().Except(new MassMomentOfInertiaUnit[]{ MassMomentOfInertiaUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramSquareMeter. /// - public static MassMomentOfInertia Zero { get; } = new MassMomentOfInertia(0, BaseUnit); + public static MassMomentOfInertia Zero { get; } = new MassMomentOfInertia(0, BaseUnit); #endregion @@ -179,154 +179,154 @@ public MassMomentOfInertia(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => MassMomentOfInertia.QuantityType; + public QuantityType Type => MassMomentOfInertia.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => MassMomentOfInertia.BaseDimensions; + public BaseDimensions Dimensions => MassMomentOfInertia.BaseDimensions; #endregion #region Conversion Properties /// - /// Get MassMomentOfInertia in GramSquareCentimeters. + /// Get in GramSquareCentimeters. /// public double GramSquareCentimeters => As(MassMomentOfInertiaUnit.GramSquareCentimeter); /// - /// Get MassMomentOfInertia in GramSquareDecimeters. + /// Get in GramSquareDecimeters. /// public double GramSquareDecimeters => As(MassMomentOfInertiaUnit.GramSquareDecimeter); /// - /// Get MassMomentOfInertia in GramSquareMeters. + /// Get in GramSquareMeters. /// public double GramSquareMeters => As(MassMomentOfInertiaUnit.GramSquareMeter); /// - /// Get MassMomentOfInertia in GramSquareMillimeters. + /// Get in GramSquareMillimeters. /// public double GramSquareMillimeters => As(MassMomentOfInertiaUnit.GramSquareMillimeter); /// - /// Get MassMomentOfInertia in KilogramSquareCentimeters. + /// Get in KilogramSquareCentimeters. /// public double KilogramSquareCentimeters => As(MassMomentOfInertiaUnit.KilogramSquareCentimeter); /// - /// Get MassMomentOfInertia in KilogramSquareDecimeters. + /// Get in KilogramSquareDecimeters. /// public double KilogramSquareDecimeters => As(MassMomentOfInertiaUnit.KilogramSquareDecimeter); /// - /// Get MassMomentOfInertia in KilogramSquareMeters. + /// Get in KilogramSquareMeters. /// public double KilogramSquareMeters => As(MassMomentOfInertiaUnit.KilogramSquareMeter); /// - /// Get MassMomentOfInertia in KilogramSquareMillimeters. + /// Get in KilogramSquareMillimeters. /// public double KilogramSquareMillimeters => As(MassMomentOfInertiaUnit.KilogramSquareMillimeter); /// - /// Get MassMomentOfInertia in KilotonneSquareCentimeters. + /// Get in KilotonneSquareCentimeters. /// public double KilotonneSquareCentimeters => As(MassMomentOfInertiaUnit.KilotonneSquareCentimeter); /// - /// Get MassMomentOfInertia in KilotonneSquareDecimeters. + /// Get in KilotonneSquareDecimeters. /// public double KilotonneSquareDecimeters => As(MassMomentOfInertiaUnit.KilotonneSquareDecimeter); /// - /// Get MassMomentOfInertia in KilotonneSquareMeters. + /// Get in KilotonneSquareMeters. /// public double KilotonneSquareMeters => As(MassMomentOfInertiaUnit.KilotonneSquareMeter); /// - /// Get MassMomentOfInertia in KilotonneSquareMilimeters. + /// Get in KilotonneSquareMilimeters. /// public double KilotonneSquareMilimeters => As(MassMomentOfInertiaUnit.KilotonneSquareMilimeter); /// - /// Get MassMomentOfInertia in MegatonneSquareCentimeters. + /// Get in MegatonneSquareCentimeters. /// public double MegatonneSquareCentimeters => As(MassMomentOfInertiaUnit.MegatonneSquareCentimeter); /// - /// Get MassMomentOfInertia in MegatonneSquareDecimeters. + /// Get in MegatonneSquareDecimeters. /// public double MegatonneSquareDecimeters => As(MassMomentOfInertiaUnit.MegatonneSquareDecimeter); /// - /// Get MassMomentOfInertia in MegatonneSquareMeters. + /// Get in MegatonneSquareMeters. /// public double MegatonneSquareMeters => As(MassMomentOfInertiaUnit.MegatonneSquareMeter); /// - /// Get MassMomentOfInertia in MegatonneSquareMilimeters. + /// Get in MegatonneSquareMilimeters. /// public double MegatonneSquareMilimeters => As(MassMomentOfInertiaUnit.MegatonneSquareMilimeter); /// - /// Get MassMomentOfInertia in MilligramSquareCentimeters. + /// Get in MilligramSquareCentimeters. /// public double MilligramSquareCentimeters => As(MassMomentOfInertiaUnit.MilligramSquareCentimeter); /// - /// Get MassMomentOfInertia in MilligramSquareDecimeters. + /// Get in MilligramSquareDecimeters. /// public double MilligramSquareDecimeters => As(MassMomentOfInertiaUnit.MilligramSquareDecimeter); /// - /// Get MassMomentOfInertia in MilligramSquareMeters. + /// Get in MilligramSquareMeters. /// public double MilligramSquareMeters => As(MassMomentOfInertiaUnit.MilligramSquareMeter); /// - /// Get MassMomentOfInertia in MilligramSquareMillimeters. + /// Get in MilligramSquareMillimeters. /// public double MilligramSquareMillimeters => As(MassMomentOfInertiaUnit.MilligramSquareMillimeter); /// - /// Get MassMomentOfInertia in PoundSquareFeet. + /// Get in PoundSquareFeet. /// public double PoundSquareFeet => As(MassMomentOfInertiaUnit.PoundSquareFoot); /// - /// Get MassMomentOfInertia in PoundSquareInches. + /// Get in PoundSquareInches. /// public double PoundSquareInches => As(MassMomentOfInertiaUnit.PoundSquareInch); /// - /// Get MassMomentOfInertia in SlugSquareFeet. + /// Get in SlugSquareFeet. /// public double SlugSquareFeet => As(MassMomentOfInertiaUnit.SlugSquareFoot); /// - /// Get MassMomentOfInertia in SlugSquareInches. + /// Get in SlugSquareInches. /// public double SlugSquareInches => As(MassMomentOfInertiaUnit.SlugSquareInch); /// - /// Get MassMomentOfInertia in TonneSquareCentimeters. + /// Get in TonneSquareCentimeters. /// public double TonneSquareCentimeters => As(MassMomentOfInertiaUnit.TonneSquareCentimeter); /// - /// Get MassMomentOfInertia in TonneSquareDecimeters. + /// Get in TonneSquareDecimeters. /// public double TonneSquareDecimeters => As(MassMomentOfInertiaUnit.TonneSquareDecimeter); /// - /// Get MassMomentOfInertia in TonneSquareMeters. + /// Get in TonneSquareMeters. /// public double TonneSquareMeters => As(MassMomentOfInertiaUnit.TonneSquareMeter); /// - /// Get MassMomentOfInertia in TonneSquareMilimeters. + /// Get in TonneSquareMilimeters. /// public double TonneSquareMilimeters => As(MassMomentOfInertiaUnit.TonneSquareMilimeter); @@ -360,267 +360,267 @@ public static string GetAbbreviation(MassMomentOfInertiaUnit unit, [CanBeNull] I #region Static Factory Methods /// - /// Get MassMomentOfInertia from GramSquareCentimeters. + /// Get from GramSquareCentimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromGramSquareCentimeters(QuantityValue gramsquarecentimeters) + public static MassMomentOfInertia FromGramSquareCentimeters(QuantityValue gramsquarecentimeters) { double value = (double) gramsquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareCentimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareCentimeter); } /// - /// Get MassMomentOfInertia from GramSquareDecimeters. + /// Get from GramSquareDecimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromGramSquareDecimeters(QuantityValue gramsquaredecimeters) + public static MassMomentOfInertia FromGramSquareDecimeters(QuantityValue gramsquaredecimeters) { double value = (double) gramsquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareDecimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareDecimeter); } /// - /// Get MassMomentOfInertia from GramSquareMeters. + /// Get from GramSquareMeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromGramSquareMeters(QuantityValue gramsquaremeters) + public static MassMomentOfInertia FromGramSquareMeters(QuantityValue gramsquaremeters) { double value = (double) gramsquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareMeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareMeter); } /// - /// Get MassMomentOfInertia from GramSquareMillimeters. + /// Get from GramSquareMillimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromGramSquareMillimeters(QuantityValue gramsquaremillimeters) + public static MassMomentOfInertia FromGramSquareMillimeters(QuantityValue gramsquaremillimeters) { double value = (double) gramsquaremillimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareMillimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareMillimeter); } /// - /// Get MassMomentOfInertia from KilogramSquareCentimeters. + /// Get from KilogramSquareCentimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromKilogramSquareCentimeters(QuantityValue kilogramsquarecentimeters) + public static MassMomentOfInertia FromKilogramSquareCentimeters(QuantityValue kilogramsquarecentimeters) { double value = (double) kilogramsquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareCentimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareCentimeter); } /// - /// Get MassMomentOfInertia from KilogramSquareDecimeters. + /// Get from KilogramSquareDecimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromKilogramSquareDecimeters(QuantityValue kilogramsquaredecimeters) + public static MassMomentOfInertia FromKilogramSquareDecimeters(QuantityValue kilogramsquaredecimeters) { double value = (double) kilogramsquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareDecimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareDecimeter); } /// - /// Get MassMomentOfInertia from KilogramSquareMeters. + /// Get from KilogramSquareMeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromKilogramSquareMeters(QuantityValue kilogramsquaremeters) + public static MassMomentOfInertia FromKilogramSquareMeters(QuantityValue kilogramsquaremeters) { double value = (double) kilogramsquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareMeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareMeter); } /// - /// Get MassMomentOfInertia from KilogramSquareMillimeters. + /// Get from KilogramSquareMillimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromKilogramSquareMillimeters(QuantityValue kilogramsquaremillimeters) + public static MassMomentOfInertia FromKilogramSquareMillimeters(QuantityValue kilogramsquaremillimeters) { double value = (double) kilogramsquaremillimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareMillimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareMillimeter); } /// - /// Get MassMomentOfInertia from KilotonneSquareCentimeters. + /// Get from KilotonneSquareCentimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromKilotonneSquareCentimeters(QuantityValue kilotonnesquarecentimeters) + public static MassMomentOfInertia FromKilotonneSquareCentimeters(QuantityValue kilotonnesquarecentimeters) { double value = (double) kilotonnesquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareCentimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareCentimeter); } /// - /// Get MassMomentOfInertia from KilotonneSquareDecimeters. + /// Get from KilotonneSquareDecimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromKilotonneSquareDecimeters(QuantityValue kilotonnesquaredecimeters) + public static MassMomentOfInertia FromKilotonneSquareDecimeters(QuantityValue kilotonnesquaredecimeters) { double value = (double) kilotonnesquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareDecimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareDecimeter); } /// - /// Get MassMomentOfInertia from KilotonneSquareMeters. + /// Get from KilotonneSquareMeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromKilotonneSquareMeters(QuantityValue kilotonnesquaremeters) + public static MassMomentOfInertia FromKilotonneSquareMeters(QuantityValue kilotonnesquaremeters) { double value = (double) kilotonnesquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareMeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareMeter); } /// - /// Get MassMomentOfInertia from KilotonneSquareMilimeters. + /// Get from KilotonneSquareMilimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromKilotonneSquareMilimeters(QuantityValue kilotonnesquaremilimeters) + public static MassMomentOfInertia FromKilotonneSquareMilimeters(QuantityValue kilotonnesquaremilimeters) { double value = (double) kilotonnesquaremilimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareMilimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareMilimeter); } /// - /// Get MassMomentOfInertia from MegatonneSquareCentimeters. + /// Get from MegatonneSquareCentimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromMegatonneSquareCentimeters(QuantityValue megatonnesquarecentimeters) + public static MassMomentOfInertia FromMegatonneSquareCentimeters(QuantityValue megatonnesquarecentimeters) { double value = (double) megatonnesquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareCentimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareCentimeter); } /// - /// Get MassMomentOfInertia from MegatonneSquareDecimeters. + /// Get from MegatonneSquareDecimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromMegatonneSquareDecimeters(QuantityValue megatonnesquaredecimeters) + public static MassMomentOfInertia FromMegatonneSquareDecimeters(QuantityValue megatonnesquaredecimeters) { double value = (double) megatonnesquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareDecimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareDecimeter); } /// - /// Get MassMomentOfInertia from MegatonneSquareMeters. + /// Get from MegatonneSquareMeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromMegatonneSquareMeters(QuantityValue megatonnesquaremeters) + public static MassMomentOfInertia FromMegatonneSquareMeters(QuantityValue megatonnesquaremeters) { double value = (double) megatonnesquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareMeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareMeter); } /// - /// Get MassMomentOfInertia from MegatonneSquareMilimeters. + /// Get from MegatonneSquareMilimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromMegatonneSquareMilimeters(QuantityValue megatonnesquaremilimeters) + public static MassMomentOfInertia FromMegatonneSquareMilimeters(QuantityValue megatonnesquaremilimeters) { double value = (double) megatonnesquaremilimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareMilimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareMilimeter); } /// - /// Get MassMomentOfInertia from MilligramSquareCentimeters. + /// Get from MilligramSquareCentimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromMilligramSquareCentimeters(QuantityValue milligramsquarecentimeters) + public static MassMomentOfInertia FromMilligramSquareCentimeters(QuantityValue milligramsquarecentimeters) { double value = (double) milligramsquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareCentimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareCentimeter); } /// - /// Get MassMomentOfInertia from MilligramSquareDecimeters. + /// Get from MilligramSquareDecimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromMilligramSquareDecimeters(QuantityValue milligramsquaredecimeters) + public static MassMomentOfInertia FromMilligramSquareDecimeters(QuantityValue milligramsquaredecimeters) { double value = (double) milligramsquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareDecimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareDecimeter); } /// - /// Get MassMomentOfInertia from MilligramSquareMeters. + /// Get from MilligramSquareMeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromMilligramSquareMeters(QuantityValue milligramsquaremeters) + public static MassMomentOfInertia FromMilligramSquareMeters(QuantityValue milligramsquaremeters) { double value = (double) milligramsquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareMeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareMeter); } /// - /// Get MassMomentOfInertia from MilligramSquareMillimeters. + /// Get from MilligramSquareMillimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromMilligramSquareMillimeters(QuantityValue milligramsquaremillimeters) + public static MassMomentOfInertia FromMilligramSquareMillimeters(QuantityValue milligramsquaremillimeters) { double value = (double) milligramsquaremillimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareMillimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareMillimeter); } /// - /// Get MassMomentOfInertia from PoundSquareFeet. + /// Get from PoundSquareFeet. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromPoundSquareFeet(QuantityValue poundsquarefeet) + public static MassMomentOfInertia FromPoundSquareFeet(QuantityValue poundsquarefeet) { double value = (double) poundsquarefeet; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.PoundSquareFoot); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.PoundSquareFoot); } /// - /// Get MassMomentOfInertia from PoundSquareInches. + /// Get from PoundSquareInches. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromPoundSquareInches(QuantityValue poundsquareinches) + public static MassMomentOfInertia FromPoundSquareInches(QuantityValue poundsquareinches) { double value = (double) poundsquareinches; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.PoundSquareInch); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.PoundSquareInch); } /// - /// Get MassMomentOfInertia from SlugSquareFeet. + /// Get from SlugSquareFeet. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromSlugSquareFeet(QuantityValue slugsquarefeet) + public static MassMomentOfInertia FromSlugSquareFeet(QuantityValue slugsquarefeet) { double value = (double) slugsquarefeet; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.SlugSquareFoot); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.SlugSquareFoot); } /// - /// Get MassMomentOfInertia from SlugSquareInches. + /// Get from SlugSquareInches. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromSlugSquareInches(QuantityValue slugsquareinches) + public static MassMomentOfInertia FromSlugSquareInches(QuantityValue slugsquareinches) { double value = (double) slugsquareinches; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.SlugSquareInch); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.SlugSquareInch); } /// - /// Get MassMomentOfInertia from TonneSquareCentimeters. + /// Get from TonneSquareCentimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromTonneSquareCentimeters(QuantityValue tonnesquarecentimeters) + public static MassMomentOfInertia FromTonneSquareCentimeters(QuantityValue tonnesquarecentimeters) { double value = (double) tonnesquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareCentimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareCentimeter); } /// - /// Get MassMomentOfInertia from TonneSquareDecimeters. + /// Get from TonneSquareDecimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromTonneSquareDecimeters(QuantityValue tonnesquaredecimeters) + public static MassMomentOfInertia FromTonneSquareDecimeters(QuantityValue tonnesquaredecimeters) { double value = (double) tonnesquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareDecimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareDecimeter); } /// - /// Get MassMomentOfInertia from TonneSquareMeters. + /// Get from TonneSquareMeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromTonneSquareMeters(QuantityValue tonnesquaremeters) + public static MassMomentOfInertia FromTonneSquareMeters(QuantityValue tonnesquaremeters) { double value = (double) tonnesquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareMeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareMeter); } /// - /// Get MassMomentOfInertia from TonneSquareMilimeters. + /// Get from TonneSquareMilimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromTonneSquareMilimeters(QuantityValue tonnesquaremilimeters) + public static MassMomentOfInertia FromTonneSquareMilimeters(QuantityValue tonnesquaremilimeters) { double value = (double) tonnesquaremilimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareMilimeter); + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareMilimeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// MassMomentOfInertia unit value. - public static MassMomentOfInertia From(QuantityValue value, MassMomentOfInertiaUnit fromUnit) + /// unit value. + public static MassMomentOfInertia From(QuantityValue value, MassMomentOfInertiaUnit fromUnit) { - return new MassMomentOfInertia((double)value, fromUnit); + return new MassMomentOfInertia((double)value, fromUnit); } #endregion @@ -649,7 +649,7 @@ public static MassMomentOfInertia From(QuantityValue value, MassMomentOfInertiaU /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static MassMomentOfInertia Parse(string str) + public static MassMomentOfInertia Parse(string str) { return Parse(str, null); } @@ -677,9 +677,9 @@ public static MassMomentOfInertia Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static MassMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider provider) + public static MassMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, MassMomentOfInertiaUnit>( str, provider, From); @@ -693,7 +693,7 @@ public static MassMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out MassMomentOfInertia result) + public static bool TryParse([CanBeNull] string str, out MassMomentOfInertia result) { return TryParse(str, null, out result); } @@ -708,9 +708,9 @@ public static bool TryParse([CanBeNull] string str, out MassMomentOfInertia resu /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassMomentOfInertia result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassMomentOfInertia result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, MassMomentOfInertiaUnit>( str, provider, From, @@ -772,43 +772,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassMo #region Arithmetic Operators /// Negate the value. - public static MassMomentOfInertia operator -(MassMomentOfInertia right) + public static MassMomentOfInertia operator -(MassMomentOfInertia right) { - return new MassMomentOfInertia(-right.Value, right.Unit); + return new MassMomentOfInertia(-right.Value, right.Unit); } - /// Get from adding two . - public static MassMomentOfInertia operator +(MassMomentOfInertia left, MassMomentOfInertia right) + /// Get from adding two . + public static MassMomentOfInertia operator +(MassMomentOfInertia left, MassMomentOfInertia right) { - return new MassMomentOfInertia(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new MassMomentOfInertia(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static MassMomentOfInertia operator -(MassMomentOfInertia left, MassMomentOfInertia right) + /// Get from subtracting two . + public static MassMomentOfInertia operator -(MassMomentOfInertia left, MassMomentOfInertia right) { - return new MassMomentOfInertia(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new MassMomentOfInertia(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static MassMomentOfInertia operator *(double left, MassMomentOfInertia right) + /// Get from multiplying value and . + public static MassMomentOfInertia operator *(double left, MassMomentOfInertia right) { - return new MassMomentOfInertia(left * right.Value, right.Unit); + return new MassMomentOfInertia(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static MassMomentOfInertia operator *(MassMomentOfInertia left, double right) + /// Get from multiplying value and . + public static MassMomentOfInertia operator *(MassMomentOfInertia left, double right) { - return new MassMomentOfInertia(left.Value * right, left.Unit); + return new MassMomentOfInertia(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static MassMomentOfInertia operator /(MassMomentOfInertia left, double right) + /// Get from dividing by value. + public static MassMomentOfInertia operator /(MassMomentOfInertia left, double right) { - return new MassMomentOfInertia(left.Value / right, left.Unit); + return new MassMomentOfInertia(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(MassMomentOfInertia left, MassMomentOfInertia right) + /// Get ratio value from dividing by . + public static double operator /(MassMomentOfInertia left, MassMomentOfInertia right) { return left.KilogramSquareMeters / right.KilogramSquareMeters; } @@ -818,39 +818,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassMo #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(MassMomentOfInertia left, MassMomentOfInertia right) + public static bool operator <=(MassMomentOfInertia left, MassMomentOfInertia right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(MassMomentOfInertia left, MassMomentOfInertia right) + public static bool operator >=(MassMomentOfInertia left, MassMomentOfInertia right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(MassMomentOfInertia left, MassMomentOfInertia right) + public static bool operator <(MassMomentOfInertia left, MassMomentOfInertia right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(MassMomentOfInertia left, MassMomentOfInertia right) + public static bool operator >(MassMomentOfInertia left, MassMomentOfInertia right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(MassMomentOfInertia left, MassMomentOfInertia right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(MassMomentOfInertia left, MassMomentOfInertia right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(MassMomentOfInertia left, MassMomentOfInertia right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(MassMomentOfInertia left, MassMomentOfInertia right) { return !(left == right); } @@ -859,37 +859,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassMo public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassMomentOfInertia objMassMomentOfInertia)) throw new ArgumentException("Expected type MassMomentOfInertia.", nameof(obj)); + if(!(obj is MassMomentOfInertia objMassMomentOfInertia)) throw new ArgumentException("Expected type MassMomentOfInertia.", nameof(obj)); return CompareTo(objMassMomentOfInertia); } /// - public int CompareTo(MassMomentOfInertia other) + public int CompareTo(MassMomentOfInertia other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MassMomentOfInertia objMassMomentOfInertia)) + if(obj is null || !(obj is MassMomentOfInertia objMassMomentOfInertia)) return false; return Equals(objMassMomentOfInertia); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(MassMomentOfInertia other) + /// Consider using for safely comparing floating point values. + public bool Equals(MassMomentOfInertia other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another MassMomentOfInertia within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -927,7 +927,7 @@ public bool Equals(MassMomentOfInertia other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MassMomentOfInertia other, double tolerance, ComparisonType comparisonType) + public bool Equals(MassMomentOfInertia other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -941,7 +941,7 @@ public bool Equals(MassMomentOfInertia other, double tolerance, ComparisonType c /// /// Returns the hash code for this instance. /// - /// A hash code for the current MassMomentOfInertia. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -989,13 +989,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this MassMomentOfInertia to another MassMomentOfInertia with the unit representation . + /// Converts this to another with the unit representation . /// - /// A MassMomentOfInertia with the specified unit. - public MassMomentOfInertia ToUnit(MassMomentOfInertiaUnit unit) + /// A with the specified unit. + public MassMomentOfInertia ToUnit(MassMomentOfInertiaUnit unit) { var convertedValue = GetValueAs(unit); - return new MassMomentOfInertia(convertedValue, unit); + return new MassMomentOfInertia(convertedValue, unit); } /// @@ -1008,7 +1008,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public MassMomentOfInertia ToUnit(UnitSystem unitSystem) + public MassMomentOfInertia ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1078,10 +1078,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal MassMomentOfInertia ToBaseUnit() + internal MassMomentOfInertia ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new MassMomentOfInertia(baseUnitValue, BaseUnit); + return new MassMomentOfInertia(baseUnitValue, BaseUnit); } private double GetValueAs(MassMomentOfInertiaUnit unit) @@ -1217,7 +1217,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1227,12 +1227,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1277,16 +1277,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MassMomentOfInertia)) + if(conversionType == typeof(MassMomentOfInertia)) return this; else if(conversionType == typeof(MassMomentOfInertiaUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return MassMomentOfInertia.QuantityType; + return MassMomentOfInertia.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return MassMomentOfInertia.BaseDimensions; + return MassMomentOfInertia.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs index edbcbbc65d..071a04d7de 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Molar energy is the amount of energy stored in 1 mole of a substance. /// - public partial struct MolarEnergy : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct MolarEnergy : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -102,19 +102,19 @@ public MolarEnergy(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of MolarEnergy, which is JoulePerMole. All conversions go via this value. + /// The base unit of , which is JoulePerMole. All conversions go via this value. /// public static MolarEnergyUnit BaseUnit { get; } = MolarEnergyUnit.JoulePerMole; /// - /// Represents the largest possible value of MolarEnergy + /// Represents the largest possible value of /// - public static MolarEnergy MaxValue { get; } = new MolarEnergy(double.MaxValue, BaseUnit); + public static MolarEnergy MaxValue { get; } = new MolarEnergy(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of MolarEnergy + /// Represents the smallest possible value of /// - public static MolarEnergy MinValue { get; } = new MolarEnergy(double.MinValue, BaseUnit); + public static MolarEnergy MinValue { get; } = new MolarEnergy(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -122,14 +122,14 @@ public MolarEnergy(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.MolarEnergy; /// - /// All units of measurement for the MolarEnergy quantity. + /// All units of measurement for the quantity. /// public static MolarEnergyUnit[] Units { get; } = Enum.GetValues(typeof(MolarEnergyUnit)).Cast().Except(new MolarEnergyUnit[]{ MolarEnergyUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerMole. /// - public static MolarEnergy Zero { get; } = new MolarEnergy(0, BaseUnit); + public static MolarEnergy Zero { get; } = new MolarEnergy(0, BaseUnit); #endregion @@ -154,29 +154,29 @@ public MolarEnergy(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => MolarEnergy.QuantityType; + public QuantityType Type => MolarEnergy.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => MolarEnergy.BaseDimensions; + public BaseDimensions Dimensions => MolarEnergy.BaseDimensions; #endregion #region Conversion Properties /// - /// Get MolarEnergy in JoulesPerMole. + /// Get in JoulesPerMole. /// public double JoulesPerMole => As(MolarEnergyUnit.JoulePerMole); /// - /// Get MolarEnergy in KilojoulesPerMole. + /// Get in KilojoulesPerMole. /// public double KilojoulesPerMole => As(MolarEnergyUnit.KilojoulePerMole); /// - /// Get MolarEnergy in MegajoulesPerMole. + /// Get in MegajoulesPerMole. /// public double MegajoulesPerMole => As(MolarEnergyUnit.MegajoulePerMole); @@ -210,42 +210,42 @@ public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] IFormatPr #region Static Factory Methods /// - /// Get MolarEnergy from JoulesPerMole. + /// Get from JoulesPerMole. /// /// If value is NaN or Infinity. - public static MolarEnergy FromJoulesPerMole(QuantityValue joulespermole) + public static MolarEnergy FromJoulesPerMole(QuantityValue joulespermole) { double value = (double) joulespermole; - return new MolarEnergy(value, MolarEnergyUnit.JoulePerMole); + return new MolarEnergy(value, MolarEnergyUnit.JoulePerMole); } /// - /// Get MolarEnergy from KilojoulesPerMole. + /// Get from KilojoulesPerMole. /// /// If value is NaN or Infinity. - public static MolarEnergy FromKilojoulesPerMole(QuantityValue kilojoulespermole) + public static MolarEnergy FromKilojoulesPerMole(QuantityValue kilojoulespermole) { double value = (double) kilojoulespermole; - return new MolarEnergy(value, MolarEnergyUnit.KilojoulePerMole); + return new MolarEnergy(value, MolarEnergyUnit.KilojoulePerMole); } /// - /// Get MolarEnergy from MegajoulesPerMole. + /// Get from MegajoulesPerMole. /// /// If value is NaN or Infinity. - public static MolarEnergy FromMegajoulesPerMole(QuantityValue megajoulespermole) + public static MolarEnergy FromMegajoulesPerMole(QuantityValue megajoulespermole) { double value = (double) megajoulespermole; - return new MolarEnergy(value, MolarEnergyUnit.MegajoulePerMole); + return new MolarEnergy(value, MolarEnergyUnit.MegajoulePerMole); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// MolarEnergy unit value. - public static MolarEnergy From(QuantityValue value, MolarEnergyUnit fromUnit) + /// unit value. + public static MolarEnergy From(QuantityValue value, MolarEnergyUnit fromUnit) { - return new MolarEnergy((double)value, fromUnit); + return new MolarEnergy((double)value, fromUnit); } #endregion @@ -274,7 +274,7 @@ public static MolarEnergy From(QuantityValue value, MolarEnergyUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static MolarEnergy Parse(string str) + public static MolarEnergy Parse(string str) { return Parse(str, null); } @@ -302,9 +302,9 @@ public static MolarEnergy Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static MolarEnergy Parse(string str, [CanBeNull] IFormatProvider provider) + public static MolarEnergy Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, MolarEnergyUnit>( str, provider, From); @@ -318,7 +318,7 @@ public static MolarEnergy Parse(string str, [CanBeNull] IFormatProvider provider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out MolarEnergy result) + public static bool TryParse([CanBeNull] string str, out MolarEnergy result) { return TryParse(str, null, out result); } @@ -333,9 +333,9 @@ public static bool TryParse([CanBeNull] string str, out MolarEnergy result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEnergy result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEnergy result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, MolarEnergyUnit>( str, provider, From, @@ -397,43 +397,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarE #region Arithmetic Operators /// Negate the value. - public static MolarEnergy operator -(MolarEnergy right) + public static MolarEnergy operator -(MolarEnergy right) { - return new MolarEnergy(-right.Value, right.Unit); + return new MolarEnergy(-right.Value, right.Unit); } - /// Get from adding two . - public static MolarEnergy operator +(MolarEnergy left, MolarEnergy right) + /// Get from adding two . + public static MolarEnergy operator +(MolarEnergy left, MolarEnergy right) { - return new MolarEnergy(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new MolarEnergy(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static MolarEnergy operator -(MolarEnergy left, MolarEnergy right) + /// Get from subtracting two . + public static MolarEnergy operator -(MolarEnergy left, MolarEnergy right) { - return new MolarEnergy(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new MolarEnergy(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static MolarEnergy operator *(double left, MolarEnergy right) + /// Get from multiplying value and . + public static MolarEnergy operator *(double left, MolarEnergy right) { - return new MolarEnergy(left * right.Value, right.Unit); + return new MolarEnergy(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static MolarEnergy operator *(MolarEnergy left, double right) + /// Get from multiplying value and . + public static MolarEnergy operator *(MolarEnergy left, double right) { - return new MolarEnergy(left.Value * right, left.Unit); + return new MolarEnergy(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static MolarEnergy operator /(MolarEnergy left, double right) + /// Get from dividing by value. + public static MolarEnergy operator /(MolarEnergy left, double right) { - return new MolarEnergy(left.Value / right, left.Unit); + return new MolarEnergy(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(MolarEnergy left, MolarEnergy right) + /// Get ratio value from dividing by . + public static double operator /(MolarEnergy left, MolarEnergy right) { return left.JoulesPerMole / right.JoulesPerMole; } @@ -443,39 +443,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarE #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(MolarEnergy left, MolarEnergy right) + public static bool operator <=(MolarEnergy left, MolarEnergy right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(MolarEnergy left, MolarEnergy right) + public static bool operator >=(MolarEnergy left, MolarEnergy right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(MolarEnergy left, MolarEnergy right) + public static bool operator <(MolarEnergy left, MolarEnergy right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(MolarEnergy left, MolarEnergy right) + public static bool operator >(MolarEnergy left, MolarEnergy right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(MolarEnergy left, MolarEnergy right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(MolarEnergy left, MolarEnergy right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(MolarEnergy left, MolarEnergy right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(MolarEnergy left, MolarEnergy right) { return !(left == right); } @@ -484,37 +484,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarE public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarEnergy objMolarEnergy)) throw new ArgumentException("Expected type MolarEnergy.", nameof(obj)); + if(!(obj is MolarEnergy objMolarEnergy)) throw new ArgumentException("Expected type MolarEnergy.", nameof(obj)); return CompareTo(objMolarEnergy); } /// - public int CompareTo(MolarEnergy other) + public int CompareTo(MolarEnergy other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MolarEnergy objMolarEnergy)) + if(obj is null || !(obj is MolarEnergy objMolarEnergy)) return false; return Equals(objMolarEnergy); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(MolarEnergy other) + /// Consider using for safely comparing floating point values. + public bool Equals(MolarEnergy other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another MolarEnergy within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -552,7 +552,7 @@ public bool Equals(MolarEnergy other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MolarEnergy other, double tolerance, ComparisonType comparisonType) + public bool Equals(MolarEnergy other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -566,7 +566,7 @@ public bool Equals(MolarEnergy other, double tolerance, ComparisonType compariso /// /// Returns the hash code for this instance. /// - /// A hash code for the current MolarEnergy. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -614,13 +614,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this MolarEnergy to another MolarEnergy with the unit representation . + /// Converts this to another with the unit representation . /// - /// A MolarEnergy with the specified unit. - public MolarEnergy ToUnit(MolarEnergyUnit unit) + /// A with the specified unit. + public MolarEnergy ToUnit(MolarEnergyUnit unit) { var convertedValue = GetValueAs(unit); - return new MolarEnergy(convertedValue, unit); + return new MolarEnergy(convertedValue, unit); } /// @@ -633,7 +633,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public MolarEnergy ToUnit(UnitSystem unitSystem) + public MolarEnergy ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -678,10 +678,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal MolarEnergy ToBaseUnit() + internal MolarEnergy ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new MolarEnergy(baseUnitValue, BaseUnit); + return new MolarEnergy(baseUnitValue, BaseUnit); } private double GetValueAs(MolarEnergyUnit unit) @@ -792,7 +792,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -802,12 +802,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -852,16 +852,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MolarEnergy)) + if(conversionType == typeof(MolarEnergy)) return this; else if(conversionType == typeof(MolarEnergyUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return MolarEnergy.QuantityType; + return MolarEnergy.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return MolarEnergy.BaseDimensions; + return MolarEnergy.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs index 754ece1c49..b42f81ffd7 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Molar entropy is amount of energy required to increase temperature of 1 mole substance by 1 Kelvin. /// - public partial struct MolarEntropy : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct MolarEntropy : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -102,19 +102,19 @@ public MolarEntropy(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of MolarEntropy, which is JoulePerMoleKelvin. All conversions go via this value. + /// The base unit of , which is JoulePerMoleKelvin. All conversions go via this value. /// public static MolarEntropyUnit BaseUnit { get; } = MolarEntropyUnit.JoulePerMoleKelvin; /// - /// Represents the largest possible value of MolarEntropy + /// Represents the largest possible value of /// - public static MolarEntropy MaxValue { get; } = new MolarEntropy(double.MaxValue, BaseUnit); + public static MolarEntropy MaxValue { get; } = new MolarEntropy(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of MolarEntropy + /// Represents the smallest possible value of /// - public static MolarEntropy MinValue { get; } = new MolarEntropy(double.MinValue, BaseUnit); + public static MolarEntropy MinValue { get; } = new MolarEntropy(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -122,14 +122,14 @@ public MolarEntropy(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.MolarEntropy; /// - /// All units of measurement for the MolarEntropy quantity. + /// All units of measurement for the quantity. /// public static MolarEntropyUnit[] Units { get; } = Enum.GetValues(typeof(MolarEntropyUnit)).Cast().Except(new MolarEntropyUnit[]{ MolarEntropyUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerMoleKelvin. /// - public static MolarEntropy Zero { get; } = new MolarEntropy(0, BaseUnit); + public static MolarEntropy Zero { get; } = new MolarEntropy(0, BaseUnit); #endregion @@ -154,29 +154,29 @@ public MolarEntropy(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => MolarEntropy.QuantityType; + public QuantityType Type => MolarEntropy.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => MolarEntropy.BaseDimensions; + public BaseDimensions Dimensions => MolarEntropy.BaseDimensions; #endregion #region Conversion Properties /// - /// Get MolarEntropy in JoulesPerMoleKelvin. + /// Get in JoulesPerMoleKelvin. /// public double JoulesPerMoleKelvin => As(MolarEntropyUnit.JoulePerMoleKelvin); /// - /// Get MolarEntropy in KilojoulesPerMoleKelvin. + /// Get in KilojoulesPerMoleKelvin. /// public double KilojoulesPerMoleKelvin => As(MolarEntropyUnit.KilojoulePerMoleKelvin); /// - /// Get MolarEntropy in MegajoulesPerMoleKelvin. + /// Get in MegajoulesPerMoleKelvin. /// public double MegajoulesPerMoleKelvin => As(MolarEntropyUnit.MegajoulePerMoleKelvin); @@ -210,42 +210,42 @@ public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] IFormatP #region Static Factory Methods /// - /// Get MolarEntropy from JoulesPerMoleKelvin. + /// Get from JoulesPerMoleKelvin. /// /// If value is NaN or Infinity. - public static MolarEntropy FromJoulesPerMoleKelvin(QuantityValue joulespermolekelvin) + public static MolarEntropy FromJoulesPerMoleKelvin(QuantityValue joulespermolekelvin) { double value = (double) joulespermolekelvin; - return new MolarEntropy(value, MolarEntropyUnit.JoulePerMoleKelvin); + return new MolarEntropy(value, MolarEntropyUnit.JoulePerMoleKelvin); } /// - /// Get MolarEntropy from KilojoulesPerMoleKelvin. + /// Get from KilojoulesPerMoleKelvin. /// /// If value is NaN or Infinity. - public static MolarEntropy FromKilojoulesPerMoleKelvin(QuantityValue kilojoulespermolekelvin) + public static MolarEntropy FromKilojoulesPerMoleKelvin(QuantityValue kilojoulespermolekelvin) { double value = (double) kilojoulespermolekelvin; - return new MolarEntropy(value, MolarEntropyUnit.KilojoulePerMoleKelvin); + return new MolarEntropy(value, MolarEntropyUnit.KilojoulePerMoleKelvin); } /// - /// Get MolarEntropy from MegajoulesPerMoleKelvin. + /// Get from MegajoulesPerMoleKelvin. /// /// If value is NaN or Infinity. - public static MolarEntropy FromMegajoulesPerMoleKelvin(QuantityValue megajoulespermolekelvin) + public static MolarEntropy FromMegajoulesPerMoleKelvin(QuantityValue megajoulespermolekelvin) { double value = (double) megajoulespermolekelvin; - return new MolarEntropy(value, MolarEntropyUnit.MegajoulePerMoleKelvin); + return new MolarEntropy(value, MolarEntropyUnit.MegajoulePerMoleKelvin); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// MolarEntropy unit value. - public static MolarEntropy From(QuantityValue value, MolarEntropyUnit fromUnit) + /// unit value. + public static MolarEntropy From(QuantityValue value, MolarEntropyUnit fromUnit) { - return new MolarEntropy((double)value, fromUnit); + return new MolarEntropy((double)value, fromUnit); } #endregion @@ -274,7 +274,7 @@ public static MolarEntropy From(QuantityValue value, MolarEntropyUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static MolarEntropy Parse(string str) + public static MolarEntropy Parse(string str) { return Parse(str, null); } @@ -302,9 +302,9 @@ public static MolarEntropy Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static MolarEntropy Parse(string str, [CanBeNull] IFormatProvider provider) + public static MolarEntropy Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, MolarEntropyUnit>( str, provider, From); @@ -318,7 +318,7 @@ public static MolarEntropy Parse(string str, [CanBeNull] IFormatProvider provide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out MolarEntropy result) + public static bool TryParse([CanBeNull] string str, out MolarEntropy result) { return TryParse(str, null, out result); } @@ -333,9 +333,9 @@ public static bool TryParse([CanBeNull] string str, out MolarEntropy result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEntropy result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEntropy result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, MolarEntropyUnit>( str, provider, From, @@ -397,43 +397,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarE #region Arithmetic Operators /// Negate the value. - public static MolarEntropy operator -(MolarEntropy right) + public static MolarEntropy operator -(MolarEntropy right) { - return new MolarEntropy(-right.Value, right.Unit); + return new MolarEntropy(-right.Value, right.Unit); } - /// Get from adding two . - public static MolarEntropy operator +(MolarEntropy left, MolarEntropy right) + /// Get from adding two . + public static MolarEntropy operator +(MolarEntropy left, MolarEntropy right) { - return new MolarEntropy(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new MolarEntropy(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static MolarEntropy operator -(MolarEntropy left, MolarEntropy right) + /// Get from subtracting two . + public static MolarEntropy operator -(MolarEntropy left, MolarEntropy right) { - return new MolarEntropy(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new MolarEntropy(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static MolarEntropy operator *(double left, MolarEntropy right) + /// Get from multiplying value and . + public static MolarEntropy operator *(double left, MolarEntropy right) { - return new MolarEntropy(left * right.Value, right.Unit); + return new MolarEntropy(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static MolarEntropy operator *(MolarEntropy left, double right) + /// Get from multiplying value and . + public static MolarEntropy operator *(MolarEntropy left, double right) { - return new MolarEntropy(left.Value * right, left.Unit); + return new MolarEntropy(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static MolarEntropy operator /(MolarEntropy left, double right) + /// Get from dividing by value. + public static MolarEntropy operator /(MolarEntropy left, double right) { - return new MolarEntropy(left.Value / right, left.Unit); + return new MolarEntropy(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(MolarEntropy left, MolarEntropy right) + /// Get ratio value from dividing by . + public static double operator /(MolarEntropy left, MolarEntropy right) { return left.JoulesPerMoleKelvin / right.JoulesPerMoleKelvin; } @@ -443,39 +443,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarE #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(MolarEntropy left, MolarEntropy right) + public static bool operator <=(MolarEntropy left, MolarEntropy right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(MolarEntropy left, MolarEntropy right) + public static bool operator >=(MolarEntropy left, MolarEntropy right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(MolarEntropy left, MolarEntropy right) + public static bool operator <(MolarEntropy left, MolarEntropy right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(MolarEntropy left, MolarEntropy right) + public static bool operator >(MolarEntropy left, MolarEntropy right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(MolarEntropy left, MolarEntropy right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(MolarEntropy left, MolarEntropy right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(MolarEntropy left, MolarEntropy right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(MolarEntropy left, MolarEntropy right) { return !(left == right); } @@ -484,37 +484,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarE public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarEntropy objMolarEntropy)) throw new ArgumentException("Expected type MolarEntropy.", nameof(obj)); + if(!(obj is MolarEntropy objMolarEntropy)) throw new ArgumentException("Expected type MolarEntropy.", nameof(obj)); return CompareTo(objMolarEntropy); } /// - public int CompareTo(MolarEntropy other) + public int CompareTo(MolarEntropy other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MolarEntropy objMolarEntropy)) + if(obj is null || !(obj is MolarEntropy objMolarEntropy)) return false; return Equals(objMolarEntropy); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(MolarEntropy other) + /// Consider using for safely comparing floating point values. + public bool Equals(MolarEntropy other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another MolarEntropy within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -552,7 +552,7 @@ public bool Equals(MolarEntropy other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MolarEntropy other, double tolerance, ComparisonType comparisonType) + public bool Equals(MolarEntropy other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -566,7 +566,7 @@ public bool Equals(MolarEntropy other, double tolerance, ComparisonType comparis /// /// Returns the hash code for this instance. /// - /// A hash code for the current MolarEntropy. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -614,13 +614,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this MolarEntropy to another MolarEntropy with the unit representation . + /// Converts this to another with the unit representation . /// - /// A MolarEntropy with the specified unit. - public MolarEntropy ToUnit(MolarEntropyUnit unit) + /// A with the specified unit. + public MolarEntropy ToUnit(MolarEntropyUnit unit) { var convertedValue = GetValueAs(unit); - return new MolarEntropy(convertedValue, unit); + return new MolarEntropy(convertedValue, unit); } /// @@ -633,7 +633,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public MolarEntropy ToUnit(UnitSystem unitSystem) + public MolarEntropy ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -678,10 +678,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal MolarEntropy ToBaseUnit() + internal MolarEntropy ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new MolarEntropy(baseUnitValue, BaseUnit); + return new MolarEntropy(baseUnitValue, BaseUnit); } private double GetValueAs(MolarEntropyUnit unit) @@ -792,7 +792,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -802,12 +802,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -852,16 +852,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MolarEntropy)) + if(conversionType == typeof(MolarEntropy)) return this; else if(conversionType == typeof(MolarEntropyUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return MolarEntropy.QuantityType; + return MolarEntropy.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return MolarEntropy.BaseDimensions; + return MolarEntropy.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs index 87bc5d163f..4a2437bc05 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// In chemistry, the molar mass M is a physical property defined as the mass of a given substance (chemical element or chemical compound) divided by the amount of substance. /// - public partial struct MolarMass : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct MolarMass : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -111,19 +111,19 @@ public MolarMass(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of MolarMass, which is KilogramPerMole. All conversions go via this value. + /// The base unit of , which is KilogramPerMole. All conversions go via this value. /// public static MolarMassUnit BaseUnit { get; } = MolarMassUnit.KilogramPerMole; /// - /// Represents the largest possible value of MolarMass + /// Represents the largest possible value of /// - public static MolarMass MaxValue { get; } = new MolarMass(double.MaxValue, BaseUnit); + public static MolarMass MaxValue { get; } = new MolarMass(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of MolarMass + /// Represents the smallest possible value of /// - public static MolarMass MinValue { get; } = new MolarMass(double.MinValue, BaseUnit); + public static MolarMass MinValue { get; } = new MolarMass(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -131,14 +131,14 @@ public MolarMass(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.MolarMass; /// - /// All units of measurement for the MolarMass quantity. + /// All units of measurement for the quantity. /// public static MolarMassUnit[] Units { get; } = Enum.GetValues(typeof(MolarMassUnit)).Cast().Except(new MolarMassUnit[]{ MolarMassUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerMole. /// - public static MolarMass Zero { get; } = new MolarMass(0, BaseUnit); + public static MolarMass Zero { get; } = new MolarMass(0, BaseUnit); #endregion @@ -163,74 +163,74 @@ public MolarMass(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => MolarMass.QuantityType; + public QuantityType Type => MolarMass.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => MolarMass.BaseDimensions; + public BaseDimensions Dimensions => MolarMass.BaseDimensions; #endregion #region Conversion Properties /// - /// Get MolarMass in CentigramsPerMole. + /// Get in CentigramsPerMole. /// public double CentigramsPerMole => As(MolarMassUnit.CentigramPerMole); /// - /// Get MolarMass in DecagramsPerMole. + /// Get in DecagramsPerMole. /// public double DecagramsPerMole => As(MolarMassUnit.DecagramPerMole); /// - /// Get MolarMass in DecigramsPerMole. + /// Get in DecigramsPerMole. /// public double DecigramsPerMole => As(MolarMassUnit.DecigramPerMole); /// - /// Get MolarMass in GramsPerMole. + /// Get in GramsPerMole. /// public double GramsPerMole => As(MolarMassUnit.GramPerMole); /// - /// Get MolarMass in HectogramsPerMole. + /// Get in HectogramsPerMole. /// public double HectogramsPerMole => As(MolarMassUnit.HectogramPerMole); /// - /// Get MolarMass in KilogramsPerMole. + /// Get in KilogramsPerMole. /// public double KilogramsPerMole => As(MolarMassUnit.KilogramPerMole); /// - /// Get MolarMass in KilopoundsPerMole. + /// Get in KilopoundsPerMole. /// public double KilopoundsPerMole => As(MolarMassUnit.KilopoundPerMole); /// - /// Get MolarMass in MegapoundsPerMole. + /// Get in MegapoundsPerMole. /// public double MegapoundsPerMole => As(MolarMassUnit.MegapoundPerMole); /// - /// Get MolarMass in MicrogramsPerMole. + /// Get in MicrogramsPerMole. /// public double MicrogramsPerMole => As(MolarMassUnit.MicrogramPerMole); /// - /// Get MolarMass in MilligramsPerMole. + /// Get in MilligramsPerMole. /// public double MilligramsPerMole => As(MolarMassUnit.MilligramPerMole); /// - /// Get MolarMass in NanogramsPerMole. + /// Get in NanogramsPerMole. /// public double NanogramsPerMole => As(MolarMassUnit.NanogramPerMole); /// - /// Get MolarMass in PoundsPerMole. + /// Get in PoundsPerMole. /// public double PoundsPerMole => As(MolarMassUnit.PoundPerMole); @@ -264,123 +264,123 @@ public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] IFormatProv #region Static Factory Methods /// - /// Get MolarMass from CentigramsPerMole. + /// Get from CentigramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromCentigramsPerMole(QuantityValue centigramspermole) + public static MolarMass FromCentigramsPerMole(QuantityValue centigramspermole) { double value = (double) centigramspermole; - return new MolarMass(value, MolarMassUnit.CentigramPerMole); + return new MolarMass(value, MolarMassUnit.CentigramPerMole); } /// - /// Get MolarMass from DecagramsPerMole. + /// Get from DecagramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromDecagramsPerMole(QuantityValue decagramspermole) + public static MolarMass FromDecagramsPerMole(QuantityValue decagramspermole) { double value = (double) decagramspermole; - return new MolarMass(value, MolarMassUnit.DecagramPerMole); + return new MolarMass(value, MolarMassUnit.DecagramPerMole); } /// - /// Get MolarMass from DecigramsPerMole. + /// Get from DecigramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromDecigramsPerMole(QuantityValue decigramspermole) + public static MolarMass FromDecigramsPerMole(QuantityValue decigramspermole) { double value = (double) decigramspermole; - return new MolarMass(value, MolarMassUnit.DecigramPerMole); + return new MolarMass(value, MolarMassUnit.DecigramPerMole); } /// - /// Get MolarMass from GramsPerMole. + /// Get from GramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromGramsPerMole(QuantityValue gramspermole) + public static MolarMass FromGramsPerMole(QuantityValue gramspermole) { double value = (double) gramspermole; - return new MolarMass(value, MolarMassUnit.GramPerMole); + return new MolarMass(value, MolarMassUnit.GramPerMole); } /// - /// Get MolarMass from HectogramsPerMole. + /// Get from HectogramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromHectogramsPerMole(QuantityValue hectogramspermole) + public static MolarMass FromHectogramsPerMole(QuantityValue hectogramspermole) { double value = (double) hectogramspermole; - return new MolarMass(value, MolarMassUnit.HectogramPerMole); + return new MolarMass(value, MolarMassUnit.HectogramPerMole); } /// - /// Get MolarMass from KilogramsPerMole. + /// Get from KilogramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromKilogramsPerMole(QuantityValue kilogramspermole) + public static MolarMass FromKilogramsPerMole(QuantityValue kilogramspermole) { double value = (double) kilogramspermole; - return new MolarMass(value, MolarMassUnit.KilogramPerMole); + return new MolarMass(value, MolarMassUnit.KilogramPerMole); } /// - /// Get MolarMass from KilopoundsPerMole. + /// Get from KilopoundsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromKilopoundsPerMole(QuantityValue kilopoundspermole) + public static MolarMass FromKilopoundsPerMole(QuantityValue kilopoundspermole) { double value = (double) kilopoundspermole; - return new MolarMass(value, MolarMassUnit.KilopoundPerMole); + return new MolarMass(value, MolarMassUnit.KilopoundPerMole); } /// - /// Get MolarMass from MegapoundsPerMole. + /// Get from MegapoundsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromMegapoundsPerMole(QuantityValue megapoundspermole) + public static MolarMass FromMegapoundsPerMole(QuantityValue megapoundspermole) { double value = (double) megapoundspermole; - return new MolarMass(value, MolarMassUnit.MegapoundPerMole); + return new MolarMass(value, MolarMassUnit.MegapoundPerMole); } /// - /// Get MolarMass from MicrogramsPerMole. + /// Get from MicrogramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromMicrogramsPerMole(QuantityValue microgramspermole) + public static MolarMass FromMicrogramsPerMole(QuantityValue microgramspermole) { double value = (double) microgramspermole; - return new MolarMass(value, MolarMassUnit.MicrogramPerMole); + return new MolarMass(value, MolarMassUnit.MicrogramPerMole); } /// - /// Get MolarMass from MilligramsPerMole. + /// Get from MilligramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromMilligramsPerMole(QuantityValue milligramspermole) + public static MolarMass FromMilligramsPerMole(QuantityValue milligramspermole) { double value = (double) milligramspermole; - return new MolarMass(value, MolarMassUnit.MilligramPerMole); + return new MolarMass(value, MolarMassUnit.MilligramPerMole); } /// - /// Get MolarMass from NanogramsPerMole. + /// Get from NanogramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromNanogramsPerMole(QuantityValue nanogramspermole) + public static MolarMass FromNanogramsPerMole(QuantityValue nanogramspermole) { double value = (double) nanogramspermole; - return new MolarMass(value, MolarMassUnit.NanogramPerMole); + return new MolarMass(value, MolarMassUnit.NanogramPerMole); } /// - /// Get MolarMass from PoundsPerMole. + /// Get from PoundsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromPoundsPerMole(QuantityValue poundspermole) + public static MolarMass FromPoundsPerMole(QuantityValue poundspermole) { double value = (double) poundspermole; - return new MolarMass(value, MolarMassUnit.PoundPerMole); + return new MolarMass(value, MolarMassUnit.PoundPerMole); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// MolarMass unit value. - public static MolarMass From(QuantityValue value, MolarMassUnit fromUnit) + /// unit value. + public static MolarMass From(QuantityValue value, MolarMassUnit fromUnit) { - return new MolarMass((double)value, fromUnit); + return new MolarMass((double)value, fromUnit); } #endregion @@ -409,7 +409,7 @@ public static MolarMass From(QuantityValue value, MolarMassUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static MolarMass Parse(string str) + public static MolarMass Parse(string str) { return Parse(str, null); } @@ -437,9 +437,9 @@ public static MolarMass Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static MolarMass Parse(string str, [CanBeNull] IFormatProvider provider) + public static MolarMass Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, MolarMassUnit>( str, provider, From); @@ -453,7 +453,7 @@ public static MolarMass Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out MolarMass result) + public static bool TryParse([CanBeNull] string str, out MolarMass result) { return TryParse(str, null, out result); } @@ -468,9 +468,9 @@ public static bool TryParse([CanBeNull] string str, out MolarMass result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarMass result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarMass result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, MolarMassUnit>( str, provider, From, @@ -532,43 +532,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarM #region Arithmetic Operators /// Negate the value. - public static MolarMass operator -(MolarMass right) + public static MolarMass operator -(MolarMass right) { - return new MolarMass(-right.Value, right.Unit); + return new MolarMass(-right.Value, right.Unit); } - /// Get from adding two . - public static MolarMass operator +(MolarMass left, MolarMass right) + /// Get from adding two . + public static MolarMass operator +(MolarMass left, MolarMass right) { - return new MolarMass(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new MolarMass(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static MolarMass operator -(MolarMass left, MolarMass right) + /// Get from subtracting two . + public static MolarMass operator -(MolarMass left, MolarMass right) { - return new MolarMass(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new MolarMass(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static MolarMass operator *(double left, MolarMass right) + /// Get from multiplying value and . + public static MolarMass operator *(double left, MolarMass right) { - return new MolarMass(left * right.Value, right.Unit); + return new MolarMass(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static MolarMass operator *(MolarMass left, double right) + /// Get from multiplying value and . + public static MolarMass operator *(MolarMass left, double right) { - return new MolarMass(left.Value * right, left.Unit); + return new MolarMass(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static MolarMass operator /(MolarMass left, double right) + /// Get from dividing by value. + public static MolarMass operator /(MolarMass left, double right) { - return new MolarMass(left.Value / right, left.Unit); + return new MolarMass(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(MolarMass left, MolarMass right) + /// Get ratio value from dividing by . + public static double operator /(MolarMass left, MolarMass right) { return left.KilogramsPerMole / right.KilogramsPerMole; } @@ -578,39 +578,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarM #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(MolarMass left, MolarMass right) + public static bool operator <=(MolarMass left, MolarMass right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(MolarMass left, MolarMass right) + public static bool operator >=(MolarMass left, MolarMass right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(MolarMass left, MolarMass right) + public static bool operator <(MolarMass left, MolarMass right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(MolarMass left, MolarMass right) + public static bool operator >(MolarMass left, MolarMass right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(MolarMass left, MolarMass right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(MolarMass left, MolarMass right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(MolarMass left, MolarMass right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(MolarMass left, MolarMass right) { return !(left == right); } @@ -619,37 +619,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarM public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarMass objMolarMass)) throw new ArgumentException("Expected type MolarMass.", nameof(obj)); + if(!(obj is MolarMass objMolarMass)) throw new ArgumentException("Expected type MolarMass.", nameof(obj)); return CompareTo(objMolarMass); } /// - public int CompareTo(MolarMass other) + public int CompareTo(MolarMass other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MolarMass objMolarMass)) + if(obj is null || !(obj is MolarMass objMolarMass)) return false; return Equals(objMolarMass); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(MolarMass other) + /// Consider using for safely comparing floating point values. + public bool Equals(MolarMass other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another MolarMass within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -687,7 +687,7 @@ public bool Equals(MolarMass other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MolarMass other, double tolerance, ComparisonType comparisonType) + public bool Equals(MolarMass other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -701,7 +701,7 @@ public bool Equals(MolarMass other, double tolerance, ComparisonType comparisonT /// /// Returns the hash code for this instance. /// - /// A hash code for the current MolarMass. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -749,13 +749,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this MolarMass to another MolarMass with the unit representation . + /// Converts this to another with the unit representation . /// - /// A MolarMass with the specified unit. - public MolarMass ToUnit(MolarMassUnit unit) + /// A with the specified unit. + public MolarMass ToUnit(MolarMassUnit unit) { var convertedValue = GetValueAs(unit); - return new MolarMass(convertedValue, unit); + return new MolarMass(convertedValue, unit); } /// @@ -768,7 +768,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public MolarMass ToUnit(UnitSystem unitSystem) + public MolarMass ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -822,10 +822,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal MolarMass ToBaseUnit() + internal MolarMass ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new MolarMass(baseUnitValue, BaseUnit); + return new MolarMass(baseUnitValue, BaseUnit); } private double GetValueAs(MolarMassUnit unit) @@ -945,7 +945,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MolarMass)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(MolarMass)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -955,12 +955,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MolarMass)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(MolarMass)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(MolarMass)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(MolarMass)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1005,16 +1005,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MolarMass)) + if(conversionType == typeof(MolarMass)) return this; else if(conversionType == typeof(MolarMassUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return MolarMass.QuantityType; + return MolarMass.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return MolarMass.BaseDimensions; + return MolarMass.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(MolarMass)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(MolarMass)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs index c9e315b909..e7154dc3b8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Molar_concentration /// - public partial struct Molarity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Molarity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -110,19 +110,19 @@ public Molarity(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Molarity, which is MolesPerCubicMeter. All conversions go via this value. + /// The base unit of , which is MolesPerCubicMeter. All conversions go via this value. /// public static MolarityUnit BaseUnit { get; } = MolarityUnit.MolesPerCubicMeter; /// - /// Represents the largest possible value of Molarity + /// Represents the largest possible value of /// - public static Molarity MaxValue { get; } = new Molarity(double.MaxValue, BaseUnit); + public static Molarity MaxValue { get; } = new Molarity(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Molarity + /// Represents the smallest possible value of /// - public static Molarity MinValue { get; } = new Molarity(double.MinValue, BaseUnit); + public static Molarity MinValue { get; } = new Molarity(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -130,14 +130,14 @@ public Molarity(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Molarity; /// - /// All units of measurement for the Molarity quantity. + /// All units of measurement for the quantity. /// public static MolarityUnit[] Units { get; } = Enum.GetValues(typeof(MolarityUnit)).Cast().Except(new MolarityUnit[]{ MolarityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit MolesPerCubicMeter. /// - public static Molarity Zero { get; } = new Molarity(0, BaseUnit); + public static Molarity Zero { get; } = new Molarity(0, BaseUnit); #endregion @@ -162,54 +162,54 @@ public Molarity(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Molarity.QuantityType; + public QuantityType Type => Molarity.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Molarity.BaseDimensions; + public BaseDimensions Dimensions => Molarity.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Molarity in CentimolesPerLiter. + /// Get in CentimolesPerLiter. /// public double CentimolesPerLiter => As(MolarityUnit.CentimolesPerLiter); /// - /// Get Molarity in DecimolesPerLiter. + /// Get in DecimolesPerLiter. /// public double DecimolesPerLiter => As(MolarityUnit.DecimolesPerLiter); /// - /// Get Molarity in MicromolesPerLiter. + /// Get in MicromolesPerLiter. /// public double MicromolesPerLiter => As(MolarityUnit.MicromolesPerLiter); /// - /// Get Molarity in MillimolesPerLiter. + /// Get in MillimolesPerLiter. /// public double MillimolesPerLiter => As(MolarityUnit.MillimolesPerLiter); /// - /// Get Molarity in MolesPerCubicMeter. + /// Get in MolesPerCubicMeter. /// public double MolesPerCubicMeter => As(MolarityUnit.MolesPerCubicMeter); /// - /// Get Molarity in MolesPerLiter. + /// Get in MolesPerLiter. /// public double MolesPerLiter => As(MolarityUnit.MolesPerLiter); /// - /// Get Molarity in NanomolesPerLiter. + /// Get in NanomolesPerLiter. /// public double NanomolesPerLiter => As(MolarityUnit.NanomolesPerLiter); /// - /// Get Molarity in PicomolesPerLiter. + /// Get in PicomolesPerLiter. /// public double PicomolesPerLiter => As(MolarityUnit.PicomolesPerLiter); @@ -243,87 +243,87 @@ public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] IFormatProvi #region Static Factory Methods /// - /// Get Molarity from CentimolesPerLiter. + /// Get from CentimolesPerLiter. /// /// If value is NaN or Infinity. - public static Molarity FromCentimolesPerLiter(QuantityValue centimolesperliter) + public static Molarity FromCentimolesPerLiter(QuantityValue centimolesperliter) { double value = (double) centimolesperliter; - return new Molarity(value, MolarityUnit.CentimolesPerLiter); + return new Molarity(value, MolarityUnit.CentimolesPerLiter); } /// - /// Get Molarity from DecimolesPerLiter. + /// Get from DecimolesPerLiter. /// /// If value is NaN or Infinity. - public static Molarity FromDecimolesPerLiter(QuantityValue decimolesperliter) + public static Molarity FromDecimolesPerLiter(QuantityValue decimolesperliter) { double value = (double) decimolesperliter; - return new Molarity(value, MolarityUnit.DecimolesPerLiter); + return new Molarity(value, MolarityUnit.DecimolesPerLiter); } /// - /// Get Molarity from MicromolesPerLiter. + /// Get from MicromolesPerLiter. /// /// If value is NaN or Infinity. - public static Molarity FromMicromolesPerLiter(QuantityValue micromolesperliter) + public static Molarity FromMicromolesPerLiter(QuantityValue micromolesperliter) { double value = (double) micromolesperliter; - return new Molarity(value, MolarityUnit.MicromolesPerLiter); + return new Molarity(value, MolarityUnit.MicromolesPerLiter); } /// - /// Get Molarity from MillimolesPerLiter. + /// Get from MillimolesPerLiter. /// /// If value is NaN or Infinity. - public static Molarity FromMillimolesPerLiter(QuantityValue millimolesperliter) + public static Molarity FromMillimolesPerLiter(QuantityValue millimolesperliter) { double value = (double) millimolesperliter; - return new Molarity(value, MolarityUnit.MillimolesPerLiter); + return new Molarity(value, MolarityUnit.MillimolesPerLiter); } /// - /// Get Molarity from MolesPerCubicMeter. + /// Get from MolesPerCubicMeter. /// /// If value is NaN or Infinity. - public static Molarity FromMolesPerCubicMeter(QuantityValue molespercubicmeter) + public static Molarity FromMolesPerCubicMeter(QuantityValue molespercubicmeter) { double value = (double) molespercubicmeter; - return new Molarity(value, MolarityUnit.MolesPerCubicMeter); + return new Molarity(value, MolarityUnit.MolesPerCubicMeter); } /// - /// Get Molarity from MolesPerLiter. + /// Get from MolesPerLiter. /// /// If value is NaN or Infinity. - public static Molarity FromMolesPerLiter(QuantityValue molesperliter) + public static Molarity FromMolesPerLiter(QuantityValue molesperliter) { double value = (double) molesperliter; - return new Molarity(value, MolarityUnit.MolesPerLiter); + return new Molarity(value, MolarityUnit.MolesPerLiter); } /// - /// Get Molarity from NanomolesPerLiter. + /// Get from NanomolesPerLiter. /// /// If value is NaN or Infinity. - public static Molarity FromNanomolesPerLiter(QuantityValue nanomolesperliter) + public static Molarity FromNanomolesPerLiter(QuantityValue nanomolesperliter) { double value = (double) nanomolesperliter; - return new Molarity(value, MolarityUnit.NanomolesPerLiter); + return new Molarity(value, MolarityUnit.NanomolesPerLiter); } /// - /// Get Molarity from PicomolesPerLiter. + /// Get from PicomolesPerLiter. /// /// If value is NaN or Infinity. - public static Molarity FromPicomolesPerLiter(QuantityValue picomolesperliter) + public static Molarity FromPicomolesPerLiter(QuantityValue picomolesperliter) { double value = (double) picomolesperliter; - return new Molarity(value, MolarityUnit.PicomolesPerLiter); + return new Molarity(value, MolarityUnit.PicomolesPerLiter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Molarity unit value. - public static Molarity From(QuantityValue value, MolarityUnit fromUnit) + /// unit value. + public static Molarity From(QuantityValue value, MolarityUnit fromUnit) { - return new Molarity((double)value, fromUnit); + return new Molarity((double)value, fromUnit); } #endregion @@ -352,7 +352,7 @@ public static Molarity From(QuantityValue value, MolarityUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Molarity Parse(string str) + public static Molarity Parse(string str) { return Parse(str, null); } @@ -380,9 +380,9 @@ public static Molarity Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Molarity Parse(string str, [CanBeNull] IFormatProvider provider) + public static Molarity Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, MolarityUnit>( str, provider, From); @@ -396,7 +396,7 @@ public static Molarity Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Molarity result) + public static bool TryParse([CanBeNull] string str, out Molarity result) { return TryParse(str, null, out result); } @@ -411,9 +411,9 @@ public static bool TryParse([CanBeNull] string str, out Molarity result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Molarity result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Molarity result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, MolarityUnit>( str, provider, From, @@ -475,43 +475,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Molari #region Arithmetic Operators /// Negate the value. - public static Molarity operator -(Molarity right) + public static Molarity operator -(Molarity right) { - return new Molarity(-right.Value, right.Unit); + return new Molarity(-right.Value, right.Unit); } - /// Get from adding two . - public static Molarity operator +(Molarity left, Molarity right) + /// Get from adding two . + public static Molarity operator +(Molarity left, Molarity right) { - return new Molarity(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Molarity(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Molarity operator -(Molarity left, Molarity right) + /// Get from subtracting two . + public static Molarity operator -(Molarity left, Molarity right) { - return new Molarity(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Molarity(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Molarity operator *(double left, Molarity right) + /// Get from multiplying value and . + public static Molarity operator *(double left, Molarity right) { - return new Molarity(left * right.Value, right.Unit); + return new Molarity(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Molarity operator *(Molarity left, double right) + /// Get from multiplying value and . + public static Molarity operator *(Molarity left, double right) { - return new Molarity(left.Value * right, left.Unit); + return new Molarity(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Molarity operator /(Molarity left, double right) + /// Get from dividing by value. + public static Molarity operator /(Molarity left, double right) { - return new Molarity(left.Value / right, left.Unit); + return new Molarity(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Molarity left, Molarity right) + /// Get ratio value from dividing by . + public static double operator /(Molarity left, Molarity right) { return left.MolesPerCubicMeter / right.MolesPerCubicMeter; } @@ -521,39 +521,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Molari #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Molarity left, Molarity right) + public static bool operator <=(Molarity left, Molarity right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Molarity left, Molarity right) + public static bool operator >=(Molarity left, Molarity right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Molarity left, Molarity right) + public static bool operator <(Molarity left, Molarity right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Molarity left, Molarity right) + public static bool operator >(Molarity left, Molarity right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Molarity left, Molarity right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Molarity left, Molarity right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Molarity left, Molarity right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Molarity left, Molarity right) { return !(left == right); } @@ -562,37 +562,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Molari public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Molarity objMolarity)) throw new ArgumentException("Expected type Molarity.", nameof(obj)); + if(!(obj is Molarity objMolarity)) throw new ArgumentException("Expected type Molarity.", nameof(obj)); return CompareTo(objMolarity); } /// - public int CompareTo(Molarity other) + public int CompareTo(Molarity other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Molarity objMolarity)) + if(obj is null || !(obj is Molarity objMolarity)) return false; return Equals(objMolarity); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Molarity other) + /// Consider using for safely comparing floating point values. + public bool Equals(Molarity other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Molarity within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -630,7 +630,7 @@ public bool Equals(Molarity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Molarity other, double tolerance, ComparisonType comparisonType) + public bool Equals(Molarity other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -644,7 +644,7 @@ public bool Equals(Molarity other, double tolerance, ComparisonType comparisonTy /// /// Returns the hash code for this instance. /// - /// A hash code for the current Molarity. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -692,13 +692,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Molarity to another Molarity with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Molarity with the specified unit. - public Molarity ToUnit(MolarityUnit unit) + /// A with the specified unit. + public Molarity ToUnit(MolarityUnit unit) { var convertedValue = GetValueAs(unit); - return new Molarity(convertedValue, unit); + return new Molarity(convertedValue, unit); } /// @@ -711,7 +711,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Molarity ToUnit(UnitSystem unitSystem) + public Molarity ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -761,10 +761,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Molarity ToBaseUnit() + internal Molarity ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Molarity(baseUnitValue, BaseUnit); + return new Molarity(baseUnitValue, BaseUnit); } private double GetValueAs(MolarityUnit unit) @@ -880,7 +880,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Molarity)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Molarity)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -890,12 +890,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Molarity)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Molarity)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Molarity)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Molarity)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -940,16 +940,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Molarity)) + if(conversionType == typeof(Molarity)) return this; else if(conversionType == typeof(MolarityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Molarity.QuantityType; + return Molarity.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Molarity.BaseDimensions; + return Molarity.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Molarity)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Molarity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs index f75792d221..fd2d863723 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Permeability_(electromagnetism) /// - public partial struct Permeability : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Permeability : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -103,19 +103,19 @@ public Permeability(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Permeability, which is HenryPerMeter. All conversions go via this value. + /// The base unit of , which is HenryPerMeter. All conversions go via this value. /// public static PermeabilityUnit BaseUnit { get; } = PermeabilityUnit.HenryPerMeter; /// - /// Represents the largest possible value of Permeability + /// Represents the largest possible value of /// - public static Permeability MaxValue { get; } = new Permeability(double.MaxValue, BaseUnit); + public static Permeability MaxValue { get; } = new Permeability(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Permeability + /// Represents the smallest possible value of /// - public static Permeability MinValue { get; } = new Permeability(double.MinValue, BaseUnit); + public static Permeability MinValue { get; } = new Permeability(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -123,14 +123,14 @@ public Permeability(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Permeability; /// - /// All units of measurement for the Permeability quantity. + /// All units of measurement for the quantity. /// public static PermeabilityUnit[] Units { get; } = Enum.GetValues(typeof(PermeabilityUnit)).Cast().Except(new PermeabilityUnit[]{ PermeabilityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit HenryPerMeter. /// - public static Permeability Zero { get; } = new Permeability(0, BaseUnit); + public static Permeability Zero { get; } = new Permeability(0, BaseUnit); #endregion @@ -155,19 +155,19 @@ public Permeability(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Permeability.QuantityType; + public QuantityType Type => Permeability.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Permeability.BaseDimensions; + public BaseDimensions Dimensions => Permeability.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Permeability in HenriesPerMeter. + /// Get in HenriesPerMeter. /// public double HenriesPerMeter => As(PermeabilityUnit.HenryPerMeter); @@ -201,24 +201,24 @@ public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] IFormatP #region Static Factory Methods /// - /// Get Permeability from HenriesPerMeter. + /// Get from HenriesPerMeter. /// /// If value is NaN or Infinity. - public static Permeability FromHenriesPerMeter(QuantityValue henriespermeter) + public static Permeability FromHenriesPerMeter(QuantityValue henriespermeter) { double value = (double) henriespermeter; - return new Permeability(value, PermeabilityUnit.HenryPerMeter); + return new Permeability(value, PermeabilityUnit.HenryPerMeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Permeability unit value. - public static Permeability From(QuantityValue value, PermeabilityUnit fromUnit) + /// unit value. + public static Permeability From(QuantityValue value, PermeabilityUnit fromUnit) { - return new Permeability((double)value, fromUnit); + return new Permeability((double)value, fromUnit); } #endregion @@ -247,7 +247,7 @@ public static Permeability From(QuantityValue value, PermeabilityUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Permeability Parse(string str) + public static Permeability Parse(string str) { return Parse(str, null); } @@ -275,9 +275,9 @@ public static Permeability Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Permeability Parse(string str, [CanBeNull] IFormatProvider provider) + public static Permeability Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, PermeabilityUnit>( str, provider, From); @@ -291,7 +291,7 @@ public static Permeability Parse(string str, [CanBeNull] IFormatProvider provide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Permeability result) + public static bool TryParse([CanBeNull] string str, out Permeability result) { return TryParse(str, null, out result); } @@ -306,9 +306,9 @@ public static bool TryParse([CanBeNull] string str, out Permeability result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permeability result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permeability result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, PermeabilityUnit>( str, provider, From, @@ -370,43 +370,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Permea #region Arithmetic Operators /// Negate the value. - public static Permeability operator -(Permeability right) + public static Permeability operator -(Permeability right) { - return new Permeability(-right.Value, right.Unit); + return new Permeability(-right.Value, right.Unit); } - /// Get from adding two . - public static Permeability operator +(Permeability left, Permeability right) + /// Get from adding two . + public static Permeability operator +(Permeability left, Permeability right) { - return new Permeability(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Permeability(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Permeability operator -(Permeability left, Permeability right) + /// Get from subtracting two . + public static Permeability operator -(Permeability left, Permeability right) { - return new Permeability(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Permeability(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Permeability operator *(double left, Permeability right) + /// Get from multiplying value and . + public static Permeability operator *(double left, Permeability right) { - return new Permeability(left * right.Value, right.Unit); + return new Permeability(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Permeability operator *(Permeability left, double right) + /// Get from multiplying value and . + public static Permeability operator *(Permeability left, double right) { - return new Permeability(left.Value * right, left.Unit); + return new Permeability(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Permeability operator /(Permeability left, double right) + /// Get from dividing by value. + public static Permeability operator /(Permeability left, double right) { - return new Permeability(left.Value / right, left.Unit); + return new Permeability(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Permeability left, Permeability right) + /// Get ratio value from dividing by . + public static double operator /(Permeability left, Permeability right) { return left.HenriesPerMeter / right.HenriesPerMeter; } @@ -416,39 +416,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Permea #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Permeability left, Permeability right) + public static bool operator <=(Permeability left, Permeability right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Permeability left, Permeability right) + public static bool operator >=(Permeability left, Permeability right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Permeability left, Permeability right) + public static bool operator <(Permeability left, Permeability right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Permeability left, Permeability right) + public static bool operator >(Permeability left, Permeability right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Permeability left, Permeability right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Permeability left, Permeability right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Permeability left, Permeability right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Permeability left, Permeability right) { return !(left == right); } @@ -457,37 +457,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Permea public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Permeability objPermeability)) throw new ArgumentException("Expected type Permeability.", nameof(obj)); + if(!(obj is Permeability objPermeability)) throw new ArgumentException("Expected type Permeability.", nameof(obj)); return CompareTo(objPermeability); } /// - public int CompareTo(Permeability other) + public int CompareTo(Permeability other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Permeability objPermeability)) + if(obj is null || !(obj is Permeability objPermeability)) return false; return Equals(objPermeability); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Permeability other) + /// Consider using for safely comparing floating point values. + public bool Equals(Permeability other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Permeability within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -525,7 +525,7 @@ public bool Equals(Permeability other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Permeability other, double tolerance, ComparisonType comparisonType) + public bool Equals(Permeability other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -539,7 +539,7 @@ public bool Equals(Permeability other, double tolerance, ComparisonType comparis /// /// Returns the hash code for this instance. /// - /// A hash code for the current Permeability. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -587,13 +587,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Permeability to another Permeability with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Permeability with the specified unit. - public Permeability ToUnit(PermeabilityUnit unit) + /// A with the specified unit. + public Permeability ToUnit(PermeabilityUnit unit) { var convertedValue = GetValueAs(unit); - return new Permeability(convertedValue, unit); + return new Permeability(convertedValue, unit); } /// @@ -606,7 +606,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Permeability ToUnit(UnitSystem unitSystem) + public Permeability ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -649,10 +649,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Permeability ToBaseUnit() + internal Permeability ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Permeability(baseUnitValue, BaseUnit); + return new Permeability(baseUnitValue, BaseUnit); } private double GetValueAs(PermeabilityUnit unit) @@ -761,7 +761,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Permeability)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Permeability)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -771,12 +771,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Permeability)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Permeability)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Permeability)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Permeability)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -821,16 +821,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Permeability)) + if(conversionType == typeof(Permeability)) return this; else if(conversionType == typeof(PermeabilityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Permeability.QuantityType; + return Permeability.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Permeability.BaseDimensions; + return Permeability.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Permeability)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Permeability)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs index d1637927b8..10e222c8ec 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Permittivity /// - public partial struct Permittivity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Permittivity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -103,19 +103,19 @@ public Permittivity(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Permittivity, which is FaradPerMeter. All conversions go via this value. + /// The base unit of , which is FaradPerMeter. All conversions go via this value. /// public static PermittivityUnit BaseUnit { get; } = PermittivityUnit.FaradPerMeter; /// - /// Represents the largest possible value of Permittivity + /// Represents the largest possible value of /// - public static Permittivity MaxValue { get; } = new Permittivity(double.MaxValue, BaseUnit); + public static Permittivity MaxValue { get; } = new Permittivity(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Permittivity + /// Represents the smallest possible value of /// - public static Permittivity MinValue { get; } = new Permittivity(double.MinValue, BaseUnit); + public static Permittivity MinValue { get; } = new Permittivity(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -123,14 +123,14 @@ public Permittivity(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Permittivity; /// - /// All units of measurement for the Permittivity quantity. + /// All units of measurement for the quantity. /// public static PermittivityUnit[] Units { get; } = Enum.GetValues(typeof(PermittivityUnit)).Cast().Except(new PermittivityUnit[]{ PermittivityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit FaradPerMeter. /// - public static Permittivity Zero { get; } = new Permittivity(0, BaseUnit); + public static Permittivity Zero { get; } = new Permittivity(0, BaseUnit); #endregion @@ -155,19 +155,19 @@ public Permittivity(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Permittivity.QuantityType; + public QuantityType Type => Permittivity.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Permittivity.BaseDimensions; + public BaseDimensions Dimensions => Permittivity.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Permittivity in FaradsPerMeter. + /// Get in FaradsPerMeter. /// public double FaradsPerMeter => As(PermittivityUnit.FaradPerMeter); @@ -201,24 +201,24 @@ public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] IFormatP #region Static Factory Methods /// - /// Get Permittivity from FaradsPerMeter. + /// Get from FaradsPerMeter. /// /// If value is NaN or Infinity. - public static Permittivity FromFaradsPerMeter(QuantityValue faradspermeter) + public static Permittivity FromFaradsPerMeter(QuantityValue faradspermeter) { double value = (double) faradspermeter; - return new Permittivity(value, PermittivityUnit.FaradPerMeter); + return new Permittivity(value, PermittivityUnit.FaradPerMeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Permittivity unit value. - public static Permittivity From(QuantityValue value, PermittivityUnit fromUnit) + /// unit value. + public static Permittivity From(QuantityValue value, PermittivityUnit fromUnit) { - return new Permittivity((double)value, fromUnit); + return new Permittivity((double)value, fromUnit); } #endregion @@ -247,7 +247,7 @@ public static Permittivity From(QuantityValue value, PermittivityUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Permittivity Parse(string str) + public static Permittivity Parse(string str) { return Parse(str, null); } @@ -275,9 +275,9 @@ public static Permittivity Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Permittivity Parse(string str, [CanBeNull] IFormatProvider provider) + public static Permittivity Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, PermittivityUnit>( str, provider, From); @@ -291,7 +291,7 @@ public static Permittivity Parse(string str, [CanBeNull] IFormatProvider provide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Permittivity result) + public static bool TryParse([CanBeNull] string str, out Permittivity result) { return TryParse(str, null, out result); } @@ -306,9 +306,9 @@ public static bool TryParse([CanBeNull] string str, out Permittivity result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permittivity result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permittivity result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, PermittivityUnit>( str, provider, From, @@ -370,43 +370,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Permit #region Arithmetic Operators /// Negate the value. - public static Permittivity operator -(Permittivity right) + public static Permittivity operator -(Permittivity right) { - return new Permittivity(-right.Value, right.Unit); + return new Permittivity(-right.Value, right.Unit); } - /// Get from adding two . - public static Permittivity operator +(Permittivity left, Permittivity right) + /// Get from adding two . + public static Permittivity operator +(Permittivity left, Permittivity right) { - return new Permittivity(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Permittivity(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Permittivity operator -(Permittivity left, Permittivity right) + /// Get from subtracting two . + public static Permittivity operator -(Permittivity left, Permittivity right) { - return new Permittivity(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Permittivity(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Permittivity operator *(double left, Permittivity right) + /// Get from multiplying value and . + public static Permittivity operator *(double left, Permittivity right) { - return new Permittivity(left * right.Value, right.Unit); + return new Permittivity(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Permittivity operator *(Permittivity left, double right) + /// Get from multiplying value and . + public static Permittivity operator *(Permittivity left, double right) { - return new Permittivity(left.Value * right, left.Unit); + return new Permittivity(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Permittivity operator /(Permittivity left, double right) + /// Get from dividing by value. + public static Permittivity operator /(Permittivity left, double right) { - return new Permittivity(left.Value / right, left.Unit); + return new Permittivity(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Permittivity left, Permittivity right) + /// Get ratio value from dividing by . + public static double operator /(Permittivity left, Permittivity right) { return left.FaradsPerMeter / right.FaradsPerMeter; } @@ -416,39 +416,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Permit #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Permittivity left, Permittivity right) + public static bool operator <=(Permittivity left, Permittivity right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Permittivity left, Permittivity right) + public static bool operator >=(Permittivity left, Permittivity right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Permittivity left, Permittivity right) + public static bool operator <(Permittivity left, Permittivity right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Permittivity left, Permittivity right) + public static bool operator >(Permittivity left, Permittivity right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Permittivity left, Permittivity right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Permittivity left, Permittivity right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Permittivity left, Permittivity right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Permittivity left, Permittivity right) { return !(left == right); } @@ -457,37 +457,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Permit public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Permittivity objPermittivity)) throw new ArgumentException("Expected type Permittivity.", nameof(obj)); + if(!(obj is Permittivity objPermittivity)) throw new ArgumentException("Expected type Permittivity.", nameof(obj)); return CompareTo(objPermittivity); } /// - public int CompareTo(Permittivity other) + public int CompareTo(Permittivity other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Permittivity objPermittivity)) + if(obj is null || !(obj is Permittivity objPermittivity)) return false; return Equals(objPermittivity); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Permittivity other) + /// Consider using for safely comparing floating point values. + public bool Equals(Permittivity other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Permittivity within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -525,7 +525,7 @@ public bool Equals(Permittivity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Permittivity other, double tolerance, ComparisonType comparisonType) + public bool Equals(Permittivity other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -539,7 +539,7 @@ public bool Equals(Permittivity other, double tolerance, ComparisonType comparis /// /// Returns the hash code for this instance. /// - /// A hash code for the current Permittivity. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -587,13 +587,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Permittivity to another Permittivity with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Permittivity with the specified unit. - public Permittivity ToUnit(PermittivityUnit unit) + /// A with the specified unit. + public Permittivity ToUnit(PermittivityUnit unit) { var convertedValue = GetValueAs(unit); - return new Permittivity(convertedValue, unit); + return new Permittivity(convertedValue, unit); } /// @@ -606,7 +606,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Permittivity ToUnit(UnitSystem unitSystem) + public Permittivity ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -649,10 +649,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Permittivity ToBaseUnit() + internal Permittivity ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Permittivity(baseUnitValue, BaseUnit); + return new Permittivity(baseUnitValue, BaseUnit); } private double GetValueAs(PermittivityUnit unit) @@ -761,7 +761,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Permittivity)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Permittivity)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -771,12 +771,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Permittivity)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Permittivity)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Permittivity)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Permittivity)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -821,16 +821,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Permittivity)) + if(conversionType == typeof(Permittivity)) return this; else if(conversionType == typeof(PermittivityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Permittivity.QuantityType; + return Permittivity.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Permittivity.BaseDimensions; + return Permittivity.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Permittivity)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Permittivity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Power.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.g.cs index 78401e90c4..f608570932 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// In physics, power is the rate of doing work. It is equivalent to an amount of energy consumed per unit time. /// - public partial struct Power : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Power : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -119,19 +119,19 @@ public Power(decimal value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Power, which is Watt. All conversions go via this value. + /// The base unit of , which is Watt. All conversions go via this value. /// public static PowerUnit BaseUnit { get; } = PowerUnit.Watt; /// - /// Represents the largest possible value of Power + /// Represents the largest possible value of /// - public static Power MaxValue { get; } = new Power(decimal.MaxValue, BaseUnit); + public static Power MaxValue { get; } = new Power(decimal.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Power + /// Represents the smallest possible value of /// - public static Power MinValue { get; } = new Power(decimal.MinValue, BaseUnit); + public static Power MinValue { get; } = new Power(decimal.MinValue, BaseUnit); /// /// The of this quantity. @@ -139,14 +139,14 @@ public Power(decimal value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Power; /// - /// All units of measurement for the Power quantity. + /// All units of measurement for the quantity. /// public static PowerUnit[] Units { get; } = Enum.GetValues(typeof(PowerUnit)).Cast().Except(new PowerUnit[]{ PowerUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Watt. /// - public static Power Zero { get; } = new Power(0, BaseUnit); + public static Power Zero { get; } = new Power(0, BaseUnit); #endregion @@ -173,114 +173,114 @@ public Power(decimal value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Power.QuantityType; + public QuantityType Type => Power.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Power.BaseDimensions; + public BaseDimensions Dimensions => Power.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Power in BoilerHorsepower. + /// Get in BoilerHorsepower. /// public double BoilerHorsepower => As(PowerUnit.BoilerHorsepower); /// - /// Get Power in BritishThermalUnitsPerHour. + /// Get in BritishThermalUnitsPerHour. /// public double BritishThermalUnitsPerHour => As(PowerUnit.BritishThermalUnitPerHour); /// - /// Get Power in Decawatts. + /// Get in Decawatts. /// public double Decawatts => As(PowerUnit.Decawatt); /// - /// Get Power in Deciwatts. + /// Get in Deciwatts. /// public double Deciwatts => As(PowerUnit.Deciwatt); /// - /// Get Power in ElectricalHorsepower. + /// Get in ElectricalHorsepower. /// public double ElectricalHorsepower => As(PowerUnit.ElectricalHorsepower); /// - /// Get Power in Femtowatts. + /// Get in Femtowatts. /// public double Femtowatts => As(PowerUnit.Femtowatt); /// - /// Get Power in Gigawatts. + /// Get in Gigawatts. /// public double Gigawatts => As(PowerUnit.Gigawatt); /// - /// Get Power in HydraulicHorsepower. + /// Get in HydraulicHorsepower. /// public double HydraulicHorsepower => As(PowerUnit.HydraulicHorsepower); /// - /// Get Power in KilobritishThermalUnitsPerHour. + /// Get in KilobritishThermalUnitsPerHour. /// public double KilobritishThermalUnitsPerHour => As(PowerUnit.KilobritishThermalUnitPerHour); /// - /// Get Power in Kilowatts. + /// Get in Kilowatts. /// public double Kilowatts => As(PowerUnit.Kilowatt); /// - /// Get Power in MechanicalHorsepower. + /// Get in MechanicalHorsepower. /// public double MechanicalHorsepower => As(PowerUnit.MechanicalHorsepower); /// - /// Get Power in Megawatts. + /// Get in Megawatts. /// public double Megawatts => As(PowerUnit.Megawatt); /// - /// Get Power in MetricHorsepower. + /// Get in MetricHorsepower. /// public double MetricHorsepower => As(PowerUnit.MetricHorsepower); /// - /// Get Power in Microwatts. + /// Get in Microwatts. /// public double Microwatts => As(PowerUnit.Microwatt); /// - /// Get Power in Milliwatts. + /// Get in Milliwatts. /// public double Milliwatts => As(PowerUnit.Milliwatt); /// - /// Get Power in Nanowatts. + /// Get in Nanowatts. /// public double Nanowatts => As(PowerUnit.Nanowatt); /// - /// Get Power in Petawatts. + /// Get in Petawatts. /// public double Petawatts => As(PowerUnit.Petawatt); /// - /// Get Power in Picowatts. + /// Get in Picowatts. /// public double Picowatts => As(PowerUnit.Picowatt); /// - /// Get Power in Terawatts. + /// Get in Terawatts. /// public double Terawatts => As(PowerUnit.Terawatt); /// - /// Get Power in Watts. + /// Get in Watts. /// public double Watts => As(PowerUnit.Watt); @@ -314,195 +314,195 @@ public static string GetAbbreviation(PowerUnit unit, [CanBeNull] IFormatProvider #region Static Factory Methods /// - /// Get Power from BoilerHorsepower. + /// Get from BoilerHorsepower. /// /// If value is NaN or Infinity. - public static Power FromBoilerHorsepower(QuantityValue boilerhorsepower) + public static Power FromBoilerHorsepower(QuantityValue boilerhorsepower) { decimal value = (decimal) boilerhorsepower; - return new Power(value, PowerUnit.BoilerHorsepower); + return new Power(value, PowerUnit.BoilerHorsepower); } /// - /// Get Power from BritishThermalUnitsPerHour. + /// Get from BritishThermalUnitsPerHour. /// /// If value is NaN or Infinity. - public static Power FromBritishThermalUnitsPerHour(QuantityValue britishthermalunitsperhour) + public static Power FromBritishThermalUnitsPerHour(QuantityValue britishthermalunitsperhour) { decimal value = (decimal) britishthermalunitsperhour; - return new Power(value, PowerUnit.BritishThermalUnitPerHour); + return new Power(value, PowerUnit.BritishThermalUnitPerHour); } /// - /// Get Power from Decawatts. + /// Get from Decawatts. /// /// If value is NaN or Infinity. - public static Power FromDecawatts(QuantityValue decawatts) + public static Power FromDecawatts(QuantityValue decawatts) { decimal value = (decimal) decawatts; - return new Power(value, PowerUnit.Decawatt); + return new Power(value, PowerUnit.Decawatt); } /// - /// Get Power from Deciwatts. + /// Get from Deciwatts. /// /// If value is NaN or Infinity. - public static Power FromDeciwatts(QuantityValue deciwatts) + public static Power FromDeciwatts(QuantityValue deciwatts) { decimal value = (decimal) deciwatts; - return new Power(value, PowerUnit.Deciwatt); + return new Power(value, PowerUnit.Deciwatt); } /// - /// Get Power from ElectricalHorsepower. + /// Get from ElectricalHorsepower. /// /// If value is NaN or Infinity. - public static Power FromElectricalHorsepower(QuantityValue electricalhorsepower) + public static Power FromElectricalHorsepower(QuantityValue electricalhorsepower) { decimal value = (decimal) electricalhorsepower; - return new Power(value, PowerUnit.ElectricalHorsepower); + return new Power(value, PowerUnit.ElectricalHorsepower); } /// - /// Get Power from Femtowatts. + /// Get from Femtowatts. /// /// If value is NaN or Infinity. - public static Power FromFemtowatts(QuantityValue femtowatts) + public static Power FromFemtowatts(QuantityValue femtowatts) { decimal value = (decimal) femtowatts; - return new Power(value, PowerUnit.Femtowatt); + return new Power(value, PowerUnit.Femtowatt); } /// - /// Get Power from Gigawatts. + /// Get from Gigawatts. /// /// If value is NaN or Infinity. - public static Power FromGigawatts(QuantityValue gigawatts) + public static Power FromGigawatts(QuantityValue gigawatts) { decimal value = (decimal) gigawatts; - return new Power(value, PowerUnit.Gigawatt); + return new Power(value, PowerUnit.Gigawatt); } /// - /// Get Power from HydraulicHorsepower. + /// Get from HydraulicHorsepower. /// /// If value is NaN or Infinity. - public static Power FromHydraulicHorsepower(QuantityValue hydraulichorsepower) + public static Power FromHydraulicHorsepower(QuantityValue hydraulichorsepower) { decimal value = (decimal) hydraulichorsepower; - return new Power(value, PowerUnit.HydraulicHorsepower); + return new Power(value, PowerUnit.HydraulicHorsepower); } /// - /// Get Power from KilobritishThermalUnitsPerHour. + /// Get from KilobritishThermalUnitsPerHour. /// /// If value is NaN or Infinity. - public static Power FromKilobritishThermalUnitsPerHour(QuantityValue kilobritishthermalunitsperhour) + public static Power FromKilobritishThermalUnitsPerHour(QuantityValue kilobritishthermalunitsperhour) { decimal value = (decimal) kilobritishthermalunitsperhour; - return new Power(value, PowerUnit.KilobritishThermalUnitPerHour); + return new Power(value, PowerUnit.KilobritishThermalUnitPerHour); } /// - /// Get Power from Kilowatts. + /// Get from Kilowatts. /// /// If value is NaN or Infinity. - public static Power FromKilowatts(QuantityValue kilowatts) + public static Power FromKilowatts(QuantityValue kilowatts) { decimal value = (decimal) kilowatts; - return new Power(value, PowerUnit.Kilowatt); + return new Power(value, PowerUnit.Kilowatt); } /// - /// Get Power from MechanicalHorsepower. + /// Get from MechanicalHorsepower. /// /// If value is NaN or Infinity. - public static Power FromMechanicalHorsepower(QuantityValue mechanicalhorsepower) + public static Power FromMechanicalHorsepower(QuantityValue mechanicalhorsepower) { decimal value = (decimal) mechanicalhorsepower; - return new Power(value, PowerUnit.MechanicalHorsepower); + return new Power(value, PowerUnit.MechanicalHorsepower); } /// - /// Get Power from Megawatts. + /// Get from Megawatts. /// /// If value is NaN or Infinity. - public static Power FromMegawatts(QuantityValue megawatts) + public static Power FromMegawatts(QuantityValue megawatts) { decimal value = (decimal) megawatts; - return new Power(value, PowerUnit.Megawatt); + return new Power(value, PowerUnit.Megawatt); } /// - /// Get Power from MetricHorsepower. + /// Get from MetricHorsepower. /// /// If value is NaN or Infinity. - public static Power FromMetricHorsepower(QuantityValue metrichorsepower) + public static Power FromMetricHorsepower(QuantityValue metrichorsepower) { decimal value = (decimal) metrichorsepower; - return new Power(value, PowerUnit.MetricHorsepower); + return new Power(value, PowerUnit.MetricHorsepower); } /// - /// Get Power from Microwatts. + /// Get from Microwatts. /// /// If value is NaN or Infinity. - public static Power FromMicrowatts(QuantityValue microwatts) + public static Power FromMicrowatts(QuantityValue microwatts) { decimal value = (decimal) microwatts; - return new Power(value, PowerUnit.Microwatt); + return new Power(value, PowerUnit.Microwatt); } /// - /// Get Power from Milliwatts. + /// Get from Milliwatts. /// /// If value is NaN or Infinity. - public static Power FromMilliwatts(QuantityValue milliwatts) + public static Power FromMilliwatts(QuantityValue milliwatts) { decimal value = (decimal) milliwatts; - return new Power(value, PowerUnit.Milliwatt); + return new Power(value, PowerUnit.Milliwatt); } /// - /// Get Power from Nanowatts. + /// Get from Nanowatts. /// /// If value is NaN or Infinity. - public static Power FromNanowatts(QuantityValue nanowatts) + public static Power FromNanowatts(QuantityValue nanowatts) { decimal value = (decimal) nanowatts; - return new Power(value, PowerUnit.Nanowatt); + return new Power(value, PowerUnit.Nanowatt); } /// - /// Get Power from Petawatts. + /// Get from Petawatts. /// /// If value is NaN or Infinity. - public static Power FromPetawatts(QuantityValue petawatts) + public static Power FromPetawatts(QuantityValue petawatts) { decimal value = (decimal) petawatts; - return new Power(value, PowerUnit.Petawatt); + return new Power(value, PowerUnit.Petawatt); } /// - /// Get Power from Picowatts. + /// Get from Picowatts. /// /// If value is NaN or Infinity. - public static Power FromPicowatts(QuantityValue picowatts) + public static Power FromPicowatts(QuantityValue picowatts) { decimal value = (decimal) picowatts; - return new Power(value, PowerUnit.Picowatt); + return new Power(value, PowerUnit.Picowatt); } /// - /// Get Power from Terawatts. + /// Get from Terawatts. /// /// If value is NaN or Infinity. - public static Power FromTerawatts(QuantityValue terawatts) + public static Power FromTerawatts(QuantityValue terawatts) { decimal value = (decimal) terawatts; - return new Power(value, PowerUnit.Terawatt); + return new Power(value, PowerUnit.Terawatt); } /// - /// Get Power from Watts. + /// Get from Watts. /// /// If value is NaN or Infinity. - public static Power FromWatts(QuantityValue watts) + public static Power FromWatts(QuantityValue watts) { decimal value = (decimal) watts; - return new Power(value, PowerUnit.Watt); + return new Power(value, PowerUnit.Watt); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Power unit value. - public static Power From(QuantityValue value, PowerUnit fromUnit) + /// unit value. + public static Power From(QuantityValue value, PowerUnit fromUnit) { - return new Power((decimal)value, fromUnit); + return new Power((decimal)value, fromUnit); } #endregion @@ -531,7 +531,7 @@ public static Power From(QuantityValue value, PowerUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Power Parse(string str) + public static Power Parse(string str) { return Parse(str, null); } @@ -559,9 +559,9 @@ public static Power Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Power Parse(string str, [CanBeNull] IFormatProvider provider) + public static Power Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, PowerUnit>( str, provider, From); @@ -575,7 +575,7 @@ public static Power Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Power result) + public static bool TryParse([CanBeNull] string str, out Power result) { return TryParse(str, null, out result); } @@ -590,9 +590,9 @@ public static bool TryParse([CanBeNull] string str, out Power result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Power result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Power result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, PowerUnit>( str, provider, From, @@ -654,43 +654,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerU #region Arithmetic Operators /// Negate the value. - public static Power operator -(Power right) + public static Power operator -(Power right) { - return new Power(-right.Value, right.Unit); + return new Power(-right.Value, right.Unit); } - /// Get from adding two . - public static Power operator +(Power left, Power right) + /// Get from adding two . + public static Power operator +(Power left, Power right) { - return new Power(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Power(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Power operator -(Power left, Power right) + /// Get from subtracting two . + public static Power operator -(Power left, Power right) { - return new Power(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Power(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Power operator *(decimal left, Power right) + /// Get from multiplying value and . + public static Power operator *(decimal left, Power right) { - return new Power(left * right.Value, right.Unit); + return new Power(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Power operator *(Power left, decimal right) + /// Get from multiplying value and . + public static Power operator *(Power left, decimal right) { - return new Power(left.Value * right, left.Unit); + return new Power(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Power operator /(Power left, decimal right) + /// Get from dividing by value. + public static Power operator /(Power left, decimal right) { - return new Power(left.Value / right, left.Unit); + return new Power(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Power left, Power right) + /// Get ratio value from dividing by . + public static double operator /(Power left, Power right) { return left.Watts / right.Watts; } @@ -700,39 +700,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerU #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Power left, Power right) + public static bool operator <=(Power left, Power right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Power left, Power right) + public static bool operator >=(Power left, Power right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Power left, Power right) + public static bool operator <(Power left, Power right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Power left, Power right) + public static bool operator >(Power left, Power right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Power left, Power right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Power left, Power right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Power left, Power right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Power left, Power right) { return !(left == right); } @@ -741,37 +741,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerU public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Power objPower)) throw new ArgumentException("Expected type Power.", nameof(obj)); + if(!(obj is Power objPower)) throw new ArgumentException("Expected type Power.", nameof(obj)); return CompareTo(objPower); } /// - public int CompareTo(Power other) + public int CompareTo(Power other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Power objPower)) + if(obj is null || !(obj is Power objPower)) return false; return Equals(objPower); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Power other) + /// Consider using for safely comparing floating point values. + public bool Equals(Power other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Power within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -809,7 +809,7 @@ public bool Equals(Power other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Power other, double tolerance, ComparisonType comparisonType) + public bool Equals(Power other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -823,7 +823,7 @@ public bool Equals(Power other, double tolerance, ComparisonType comparisonType) /// /// Returns the hash code for this instance. /// - /// A hash code for the current Power. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -871,13 +871,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Power to another Power with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Power with the specified unit. - public Power ToUnit(PowerUnit unit) + /// A with the specified unit. + public Power ToUnit(PowerUnit unit) { var convertedValue = GetValueAs(unit); - return new Power(convertedValue, unit); + return new Power(convertedValue, unit); } /// @@ -890,7 +890,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Power ToUnit(UnitSystem unitSystem) + public Power ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -952,10 +952,10 @@ private decimal GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Power ToBaseUnit() + internal Power ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Power(baseUnitValue, BaseUnit); + return new Power(baseUnitValue, BaseUnit); } private decimal GetValueAs(PowerUnit unit) @@ -1083,7 +1083,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Power)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Power)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1093,12 +1093,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Power)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Power)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Power)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Power)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1143,16 +1143,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Power)) + if(conversionType == typeof(Power)) return this; else if(conversionType == typeof(PowerUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Power.QuantityType; + return Power.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Power.BaseDimensions; + return Power.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Power)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Power)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs index e714622d6a..55a9ec7b79 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// The amount of power in a volume. /// - public partial struct PowerDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct PowerDensity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -143,19 +143,19 @@ public PowerDensity(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of PowerDensity, which is WattPerCubicMeter. All conversions go via this value. + /// The base unit of , which is WattPerCubicMeter. All conversions go via this value. /// public static PowerDensityUnit BaseUnit { get; } = PowerDensityUnit.WattPerCubicMeter; /// - /// Represents the largest possible value of PowerDensity + /// Represents the largest possible value of /// - public static PowerDensity MaxValue { get; } = new PowerDensity(double.MaxValue, BaseUnit); + public static PowerDensity MaxValue { get; } = new PowerDensity(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of PowerDensity + /// Represents the smallest possible value of /// - public static PowerDensity MinValue { get; } = new PowerDensity(double.MinValue, BaseUnit); + public static PowerDensity MinValue { get; } = new PowerDensity(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -163,14 +163,14 @@ public PowerDensity(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.PowerDensity; /// - /// All units of measurement for the PowerDensity quantity. + /// All units of measurement for the quantity. /// public static PowerDensityUnit[] Units { get; } = Enum.GetValues(typeof(PowerDensityUnit)).Cast().Except(new PowerDensityUnit[]{ PowerDensityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit WattPerCubicMeter. /// - public static PowerDensity Zero { get; } = new PowerDensity(0, BaseUnit); + public static PowerDensity Zero { get; } = new PowerDensity(0, BaseUnit); #endregion @@ -195,234 +195,234 @@ public PowerDensity(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => PowerDensity.QuantityType; + public QuantityType Type => PowerDensity.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => PowerDensity.BaseDimensions; + public BaseDimensions Dimensions => PowerDensity.BaseDimensions; #endregion #region Conversion Properties /// - /// Get PowerDensity in DecawattsPerCubicFoot. + /// Get in DecawattsPerCubicFoot. /// public double DecawattsPerCubicFoot => As(PowerDensityUnit.DecawattPerCubicFoot); /// - /// Get PowerDensity in DecawattsPerCubicInch. + /// Get in DecawattsPerCubicInch. /// public double DecawattsPerCubicInch => As(PowerDensityUnit.DecawattPerCubicInch); /// - /// Get PowerDensity in DecawattsPerCubicMeter. + /// Get in DecawattsPerCubicMeter. /// public double DecawattsPerCubicMeter => As(PowerDensityUnit.DecawattPerCubicMeter); /// - /// Get PowerDensity in DecawattsPerLiter. + /// Get in DecawattsPerLiter. /// public double DecawattsPerLiter => As(PowerDensityUnit.DecawattPerLiter); /// - /// Get PowerDensity in DeciwattsPerCubicFoot. + /// Get in DeciwattsPerCubicFoot. /// public double DeciwattsPerCubicFoot => As(PowerDensityUnit.DeciwattPerCubicFoot); /// - /// Get PowerDensity in DeciwattsPerCubicInch. + /// Get in DeciwattsPerCubicInch. /// public double DeciwattsPerCubicInch => As(PowerDensityUnit.DeciwattPerCubicInch); /// - /// Get PowerDensity in DeciwattsPerCubicMeter. + /// Get in DeciwattsPerCubicMeter. /// public double DeciwattsPerCubicMeter => As(PowerDensityUnit.DeciwattPerCubicMeter); /// - /// Get PowerDensity in DeciwattsPerLiter. + /// Get in DeciwattsPerLiter. /// public double DeciwattsPerLiter => As(PowerDensityUnit.DeciwattPerLiter); /// - /// Get PowerDensity in GigawattsPerCubicFoot. + /// Get in GigawattsPerCubicFoot. /// public double GigawattsPerCubicFoot => As(PowerDensityUnit.GigawattPerCubicFoot); /// - /// Get PowerDensity in GigawattsPerCubicInch. + /// Get in GigawattsPerCubicInch. /// public double GigawattsPerCubicInch => As(PowerDensityUnit.GigawattPerCubicInch); /// - /// Get PowerDensity in GigawattsPerCubicMeter. + /// Get in GigawattsPerCubicMeter. /// public double GigawattsPerCubicMeter => As(PowerDensityUnit.GigawattPerCubicMeter); /// - /// Get PowerDensity in GigawattsPerLiter. + /// Get in GigawattsPerLiter. /// public double GigawattsPerLiter => As(PowerDensityUnit.GigawattPerLiter); /// - /// Get PowerDensity in KilowattsPerCubicFoot. + /// Get in KilowattsPerCubicFoot. /// public double KilowattsPerCubicFoot => As(PowerDensityUnit.KilowattPerCubicFoot); /// - /// Get PowerDensity in KilowattsPerCubicInch. + /// Get in KilowattsPerCubicInch. /// public double KilowattsPerCubicInch => As(PowerDensityUnit.KilowattPerCubicInch); /// - /// Get PowerDensity in KilowattsPerCubicMeter. + /// Get in KilowattsPerCubicMeter. /// public double KilowattsPerCubicMeter => As(PowerDensityUnit.KilowattPerCubicMeter); /// - /// Get PowerDensity in KilowattsPerLiter. + /// Get in KilowattsPerLiter. /// public double KilowattsPerLiter => As(PowerDensityUnit.KilowattPerLiter); /// - /// Get PowerDensity in MegawattsPerCubicFoot. + /// Get in MegawattsPerCubicFoot. /// public double MegawattsPerCubicFoot => As(PowerDensityUnit.MegawattPerCubicFoot); /// - /// Get PowerDensity in MegawattsPerCubicInch. + /// Get in MegawattsPerCubicInch. /// public double MegawattsPerCubicInch => As(PowerDensityUnit.MegawattPerCubicInch); /// - /// Get PowerDensity in MegawattsPerCubicMeter. + /// Get in MegawattsPerCubicMeter. /// public double MegawattsPerCubicMeter => As(PowerDensityUnit.MegawattPerCubicMeter); /// - /// Get PowerDensity in MegawattsPerLiter. + /// Get in MegawattsPerLiter. /// public double MegawattsPerLiter => As(PowerDensityUnit.MegawattPerLiter); /// - /// Get PowerDensity in MicrowattsPerCubicFoot. + /// Get in MicrowattsPerCubicFoot. /// public double MicrowattsPerCubicFoot => As(PowerDensityUnit.MicrowattPerCubicFoot); /// - /// Get PowerDensity in MicrowattsPerCubicInch. + /// Get in MicrowattsPerCubicInch. /// public double MicrowattsPerCubicInch => As(PowerDensityUnit.MicrowattPerCubicInch); /// - /// Get PowerDensity in MicrowattsPerCubicMeter. + /// Get in MicrowattsPerCubicMeter. /// public double MicrowattsPerCubicMeter => As(PowerDensityUnit.MicrowattPerCubicMeter); /// - /// Get PowerDensity in MicrowattsPerLiter. + /// Get in MicrowattsPerLiter. /// public double MicrowattsPerLiter => As(PowerDensityUnit.MicrowattPerLiter); /// - /// Get PowerDensity in MilliwattsPerCubicFoot. + /// Get in MilliwattsPerCubicFoot. /// public double MilliwattsPerCubicFoot => As(PowerDensityUnit.MilliwattPerCubicFoot); /// - /// Get PowerDensity in MilliwattsPerCubicInch. + /// Get in MilliwattsPerCubicInch. /// public double MilliwattsPerCubicInch => As(PowerDensityUnit.MilliwattPerCubicInch); /// - /// Get PowerDensity in MilliwattsPerCubicMeter. + /// Get in MilliwattsPerCubicMeter. /// public double MilliwattsPerCubicMeter => As(PowerDensityUnit.MilliwattPerCubicMeter); /// - /// Get PowerDensity in MilliwattsPerLiter. + /// Get in MilliwattsPerLiter. /// public double MilliwattsPerLiter => As(PowerDensityUnit.MilliwattPerLiter); /// - /// Get PowerDensity in NanowattsPerCubicFoot. + /// Get in NanowattsPerCubicFoot. /// public double NanowattsPerCubicFoot => As(PowerDensityUnit.NanowattPerCubicFoot); /// - /// Get PowerDensity in NanowattsPerCubicInch. + /// Get in NanowattsPerCubicInch. /// public double NanowattsPerCubicInch => As(PowerDensityUnit.NanowattPerCubicInch); /// - /// Get PowerDensity in NanowattsPerCubicMeter. + /// Get in NanowattsPerCubicMeter. /// public double NanowattsPerCubicMeter => As(PowerDensityUnit.NanowattPerCubicMeter); /// - /// Get PowerDensity in NanowattsPerLiter. + /// Get in NanowattsPerLiter. /// public double NanowattsPerLiter => As(PowerDensityUnit.NanowattPerLiter); /// - /// Get PowerDensity in PicowattsPerCubicFoot. + /// Get in PicowattsPerCubicFoot. /// public double PicowattsPerCubicFoot => As(PowerDensityUnit.PicowattPerCubicFoot); /// - /// Get PowerDensity in PicowattsPerCubicInch. + /// Get in PicowattsPerCubicInch. /// public double PicowattsPerCubicInch => As(PowerDensityUnit.PicowattPerCubicInch); /// - /// Get PowerDensity in PicowattsPerCubicMeter. + /// Get in PicowattsPerCubicMeter. /// public double PicowattsPerCubicMeter => As(PowerDensityUnit.PicowattPerCubicMeter); /// - /// Get PowerDensity in PicowattsPerLiter. + /// Get in PicowattsPerLiter. /// public double PicowattsPerLiter => As(PowerDensityUnit.PicowattPerLiter); /// - /// Get PowerDensity in TerawattsPerCubicFoot. + /// Get in TerawattsPerCubicFoot. /// public double TerawattsPerCubicFoot => As(PowerDensityUnit.TerawattPerCubicFoot); /// - /// Get PowerDensity in TerawattsPerCubicInch. + /// Get in TerawattsPerCubicInch. /// public double TerawattsPerCubicInch => As(PowerDensityUnit.TerawattPerCubicInch); /// - /// Get PowerDensity in TerawattsPerCubicMeter. + /// Get in TerawattsPerCubicMeter. /// public double TerawattsPerCubicMeter => As(PowerDensityUnit.TerawattPerCubicMeter); /// - /// Get PowerDensity in TerawattsPerLiter. + /// Get in TerawattsPerLiter. /// public double TerawattsPerLiter => As(PowerDensityUnit.TerawattPerLiter); /// - /// Get PowerDensity in WattsPerCubicFoot. + /// Get in WattsPerCubicFoot. /// public double WattsPerCubicFoot => As(PowerDensityUnit.WattPerCubicFoot); /// - /// Get PowerDensity in WattsPerCubicInch. + /// Get in WattsPerCubicInch. /// public double WattsPerCubicInch => As(PowerDensityUnit.WattPerCubicInch); /// - /// Get PowerDensity in WattsPerCubicMeter. + /// Get in WattsPerCubicMeter. /// public double WattsPerCubicMeter => As(PowerDensityUnit.WattPerCubicMeter); /// - /// Get PowerDensity in WattsPerLiter. + /// Get in WattsPerLiter. /// public double WattsPerLiter => As(PowerDensityUnit.WattPerLiter); @@ -456,411 +456,411 @@ public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] IFormatP #region Static Factory Methods /// - /// Get PowerDensity from DecawattsPerCubicFoot. + /// Get from DecawattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromDecawattsPerCubicFoot(QuantityValue decawattspercubicfoot) + public static PowerDensity FromDecawattsPerCubicFoot(QuantityValue decawattspercubicfoot) { double value = (double) decawattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicFoot); + return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicFoot); } /// - /// Get PowerDensity from DecawattsPerCubicInch. + /// Get from DecawattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromDecawattsPerCubicInch(QuantityValue decawattspercubicinch) + public static PowerDensity FromDecawattsPerCubicInch(QuantityValue decawattspercubicinch) { double value = (double) decawattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicInch); + return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicInch); } /// - /// Get PowerDensity from DecawattsPerCubicMeter. + /// Get from DecawattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromDecawattsPerCubicMeter(QuantityValue decawattspercubicmeter) + public static PowerDensity FromDecawattsPerCubicMeter(QuantityValue decawattspercubicmeter) { double value = (double) decawattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicMeter); + return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicMeter); } /// - /// Get PowerDensity from DecawattsPerLiter. + /// Get from DecawattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromDecawattsPerLiter(QuantityValue decawattsperliter) + public static PowerDensity FromDecawattsPerLiter(QuantityValue decawattsperliter) { double value = (double) decawattsperliter; - return new PowerDensity(value, PowerDensityUnit.DecawattPerLiter); + return new PowerDensity(value, PowerDensityUnit.DecawattPerLiter); } /// - /// Get PowerDensity from DeciwattsPerCubicFoot. + /// Get from DeciwattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromDeciwattsPerCubicFoot(QuantityValue deciwattspercubicfoot) + public static PowerDensity FromDeciwattsPerCubicFoot(QuantityValue deciwattspercubicfoot) { double value = (double) deciwattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicFoot); + return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicFoot); } /// - /// Get PowerDensity from DeciwattsPerCubicInch. + /// Get from DeciwattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromDeciwattsPerCubicInch(QuantityValue deciwattspercubicinch) + public static PowerDensity FromDeciwattsPerCubicInch(QuantityValue deciwattspercubicinch) { double value = (double) deciwattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicInch); + return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicInch); } /// - /// Get PowerDensity from DeciwattsPerCubicMeter. + /// Get from DeciwattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromDeciwattsPerCubicMeter(QuantityValue deciwattspercubicmeter) + public static PowerDensity FromDeciwattsPerCubicMeter(QuantityValue deciwattspercubicmeter) { double value = (double) deciwattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicMeter); + return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicMeter); } /// - /// Get PowerDensity from DeciwattsPerLiter. + /// Get from DeciwattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromDeciwattsPerLiter(QuantityValue deciwattsperliter) + public static PowerDensity FromDeciwattsPerLiter(QuantityValue deciwattsperliter) { double value = (double) deciwattsperliter; - return new PowerDensity(value, PowerDensityUnit.DeciwattPerLiter); + return new PowerDensity(value, PowerDensityUnit.DeciwattPerLiter); } /// - /// Get PowerDensity from GigawattsPerCubicFoot. + /// Get from GigawattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromGigawattsPerCubicFoot(QuantityValue gigawattspercubicfoot) + public static PowerDensity FromGigawattsPerCubicFoot(QuantityValue gigawattspercubicfoot) { double value = (double) gigawattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicFoot); + return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicFoot); } /// - /// Get PowerDensity from GigawattsPerCubicInch. + /// Get from GigawattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromGigawattsPerCubicInch(QuantityValue gigawattspercubicinch) + public static PowerDensity FromGigawattsPerCubicInch(QuantityValue gigawattspercubicinch) { double value = (double) gigawattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicInch); + return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicInch); } /// - /// Get PowerDensity from GigawattsPerCubicMeter. + /// Get from GigawattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromGigawattsPerCubicMeter(QuantityValue gigawattspercubicmeter) + public static PowerDensity FromGigawattsPerCubicMeter(QuantityValue gigawattspercubicmeter) { double value = (double) gigawattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicMeter); + return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicMeter); } /// - /// Get PowerDensity from GigawattsPerLiter. + /// Get from GigawattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromGigawattsPerLiter(QuantityValue gigawattsperliter) + public static PowerDensity FromGigawattsPerLiter(QuantityValue gigawattsperliter) { double value = (double) gigawattsperliter; - return new PowerDensity(value, PowerDensityUnit.GigawattPerLiter); + return new PowerDensity(value, PowerDensityUnit.GigawattPerLiter); } /// - /// Get PowerDensity from KilowattsPerCubicFoot. + /// Get from KilowattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromKilowattsPerCubicFoot(QuantityValue kilowattspercubicfoot) + public static PowerDensity FromKilowattsPerCubicFoot(QuantityValue kilowattspercubicfoot) { double value = (double) kilowattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicFoot); + return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicFoot); } /// - /// Get PowerDensity from KilowattsPerCubicInch. + /// Get from KilowattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromKilowattsPerCubicInch(QuantityValue kilowattspercubicinch) + public static PowerDensity FromKilowattsPerCubicInch(QuantityValue kilowattspercubicinch) { double value = (double) kilowattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicInch); + return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicInch); } /// - /// Get PowerDensity from KilowattsPerCubicMeter. + /// Get from KilowattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromKilowattsPerCubicMeter(QuantityValue kilowattspercubicmeter) + public static PowerDensity FromKilowattsPerCubicMeter(QuantityValue kilowattspercubicmeter) { double value = (double) kilowattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicMeter); + return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicMeter); } /// - /// Get PowerDensity from KilowattsPerLiter. + /// Get from KilowattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromKilowattsPerLiter(QuantityValue kilowattsperliter) + public static PowerDensity FromKilowattsPerLiter(QuantityValue kilowattsperliter) { double value = (double) kilowattsperliter; - return new PowerDensity(value, PowerDensityUnit.KilowattPerLiter); + return new PowerDensity(value, PowerDensityUnit.KilowattPerLiter); } /// - /// Get PowerDensity from MegawattsPerCubicFoot. + /// Get from MegawattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromMegawattsPerCubicFoot(QuantityValue megawattspercubicfoot) + public static PowerDensity FromMegawattsPerCubicFoot(QuantityValue megawattspercubicfoot) { double value = (double) megawattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicFoot); + return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicFoot); } /// - /// Get PowerDensity from MegawattsPerCubicInch. + /// Get from MegawattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromMegawattsPerCubicInch(QuantityValue megawattspercubicinch) + public static PowerDensity FromMegawattsPerCubicInch(QuantityValue megawattspercubicinch) { double value = (double) megawattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicInch); + return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicInch); } /// - /// Get PowerDensity from MegawattsPerCubicMeter. + /// Get from MegawattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromMegawattsPerCubicMeter(QuantityValue megawattspercubicmeter) + public static PowerDensity FromMegawattsPerCubicMeter(QuantityValue megawattspercubicmeter) { double value = (double) megawattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicMeter); + return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicMeter); } /// - /// Get PowerDensity from MegawattsPerLiter. + /// Get from MegawattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromMegawattsPerLiter(QuantityValue megawattsperliter) + public static PowerDensity FromMegawattsPerLiter(QuantityValue megawattsperliter) { double value = (double) megawattsperliter; - return new PowerDensity(value, PowerDensityUnit.MegawattPerLiter); + return new PowerDensity(value, PowerDensityUnit.MegawattPerLiter); } /// - /// Get PowerDensity from MicrowattsPerCubicFoot. + /// Get from MicrowattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromMicrowattsPerCubicFoot(QuantityValue microwattspercubicfoot) + public static PowerDensity FromMicrowattsPerCubicFoot(QuantityValue microwattspercubicfoot) { double value = (double) microwattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicFoot); + return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicFoot); } /// - /// Get PowerDensity from MicrowattsPerCubicInch. + /// Get from MicrowattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromMicrowattsPerCubicInch(QuantityValue microwattspercubicinch) + public static PowerDensity FromMicrowattsPerCubicInch(QuantityValue microwattspercubicinch) { double value = (double) microwattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicInch); + return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicInch); } /// - /// Get PowerDensity from MicrowattsPerCubicMeter. + /// Get from MicrowattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromMicrowattsPerCubicMeter(QuantityValue microwattspercubicmeter) + public static PowerDensity FromMicrowattsPerCubicMeter(QuantityValue microwattspercubicmeter) { double value = (double) microwattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicMeter); + return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicMeter); } /// - /// Get PowerDensity from MicrowattsPerLiter. + /// Get from MicrowattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromMicrowattsPerLiter(QuantityValue microwattsperliter) + public static PowerDensity FromMicrowattsPerLiter(QuantityValue microwattsperliter) { double value = (double) microwattsperliter; - return new PowerDensity(value, PowerDensityUnit.MicrowattPerLiter); + return new PowerDensity(value, PowerDensityUnit.MicrowattPerLiter); } /// - /// Get PowerDensity from MilliwattsPerCubicFoot. + /// Get from MilliwattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromMilliwattsPerCubicFoot(QuantityValue milliwattspercubicfoot) + public static PowerDensity FromMilliwattsPerCubicFoot(QuantityValue milliwattspercubicfoot) { double value = (double) milliwattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicFoot); + return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicFoot); } /// - /// Get PowerDensity from MilliwattsPerCubicInch. + /// Get from MilliwattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromMilliwattsPerCubicInch(QuantityValue milliwattspercubicinch) + public static PowerDensity FromMilliwattsPerCubicInch(QuantityValue milliwattspercubicinch) { double value = (double) milliwattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicInch); + return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicInch); } /// - /// Get PowerDensity from MilliwattsPerCubicMeter. + /// Get from MilliwattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromMilliwattsPerCubicMeter(QuantityValue milliwattspercubicmeter) + public static PowerDensity FromMilliwattsPerCubicMeter(QuantityValue milliwattspercubicmeter) { double value = (double) milliwattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicMeter); + return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicMeter); } /// - /// Get PowerDensity from MilliwattsPerLiter. + /// Get from MilliwattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromMilliwattsPerLiter(QuantityValue milliwattsperliter) + public static PowerDensity FromMilliwattsPerLiter(QuantityValue milliwattsperliter) { double value = (double) milliwattsperliter; - return new PowerDensity(value, PowerDensityUnit.MilliwattPerLiter); + return new PowerDensity(value, PowerDensityUnit.MilliwattPerLiter); } /// - /// Get PowerDensity from NanowattsPerCubicFoot. + /// Get from NanowattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromNanowattsPerCubicFoot(QuantityValue nanowattspercubicfoot) + public static PowerDensity FromNanowattsPerCubicFoot(QuantityValue nanowattspercubicfoot) { double value = (double) nanowattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicFoot); + return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicFoot); } /// - /// Get PowerDensity from NanowattsPerCubicInch. + /// Get from NanowattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromNanowattsPerCubicInch(QuantityValue nanowattspercubicinch) + public static PowerDensity FromNanowattsPerCubicInch(QuantityValue nanowattspercubicinch) { double value = (double) nanowattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicInch); + return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicInch); } /// - /// Get PowerDensity from NanowattsPerCubicMeter. + /// Get from NanowattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromNanowattsPerCubicMeter(QuantityValue nanowattspercubicmeter) + public static PowerDensity FromNanowattsPerCubicMeter(QuantityValue nanowattspercubicmeter) { double value = (double) nanowattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicMeter); + return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicMeter); } /// - /// Get PowerDensity from NanowattsPerLiter. + /// Get from NanowattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromNanowattsPerLiter(QuantityValue nanowattsperliter) + public static PowerDensity FromNanowattsPerLiter(QuantityValue nanowattsperliter) { double value = (double) nanowattsperliter; - return new PowerDensity(value, PowerDensityUnit.NanowattPerLiter); + return new PowerDensity(value, PowerDensityUnit.NanowattPerLiter); } /// - /// Get PowerDensity from PicowattsPerCubicFoot. + /// Get from PicowattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromPicowattsPerCubicFoot(QuantityValue picowattspercubicfoot) + public static PowerDensity FromPicowattsPerCubicFoot(QuantityValue picowattspercubicfoot) { double value = (double) picowattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicFoot); + return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicFoot); } /// - /// Get PowerDensity from PicowattsPerCubicInch. + /// Get from PicowattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromPicowattsPerCubicInch(QuantityValue picowattspercubicinch) + public static PowerDensity FromPicowattsPerCubicInch(QuantityValue picowattspercubicinch) { double value = (double) picowattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicInch); + return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicInch); } /// - /// Get PowerDensity from PicowattsPerCubicMeter. + /// Get from PicowattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromPicowattsPerCubicMeter(QuantityValue picowattspercubicmeter) + public static PowerDensity FromPicowattsPerCubicMeter(QuantityValue picowattspercubicmeter) { double value = (double) picowattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicMeter); + return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicMeter); } /// - /// Get PowerDensity from PicowattsPerLiter. + /// Get from PicowattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromPicowattsPerLiter(QuantityValue picowattsperliter) + public static PowerDensity FromPicowattsPerLiter(QuantityValue picowattsperliter) { double value = (double) picowattsperliter; - return new PowerDensity(value, PowerDensityUnit.PicowattPerLiter); + return new PowerDensity(value, PowerDensityUnit.PicowattPerLiter); } /// - /// Get PowerDensity from TerawattsPerCubicFoot. + /// Get from TerawattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromTerawattsPerCubicFoot(QuantityValue terawattspercubicfoot) + public static PowerDensity FromTerawattsPerCubicFoot(QuantityValue terawattspercubicfoot) { double value = (double) terawattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicFoot); + return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicFoot); } /// - /// Get PowerDensity from TerawattsPerCubicInch. + /// Get from TerawattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromTerawattsPerCubicInch(QuantityValue terawattspercubicinch) + public static PowerDensity FromTerawattsPerCubicInch(QuantityValue terawattspercubicinch) { double value = (double) terawattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicInch); + return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicInch); } /// - /// Get PowerDensity from TerawattsPerCubicMeter. + /// Get from TerawattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromTerawattsPerCubicMeter(QuantityValue terawattspercubicmeter) + public static PowerDensity FromTerawattsPerCubicMeter(QuantityValue terawattspercubicmeter) { double value = (double) terawattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicMeter); + return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicMeter); } /// - /// Get PowerDensity from TerawattsPerLiter. + /// Get from TerawattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromTerawattsPerLiter(QuantityValue terawattsperliter) + public static PowerDensity FromTerawattsPerLiter(QuantityValue terawattsperliter) { double value = (double) terawattsperliter; - return new PowerDensity(value, PowerDensityUnit.TerawattPerLiter); + return new PowerDensity(value, PowerDensityUnit.TerawattPerLiter); } /// - /// Get PowerDensity from WattsPerCubicFoot. + /// Get from WattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromWattsPerCubicFoot(QuantityValue wattspercubicfoot) + public static PowerDensity FromWattsPerCubicFoot(QuantityValue wattspercubicfoot) { double value = (double) wattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.WattPerCubicFoot); + return new PowerDensity(value, PowerDensityUnit.WattPerCubicFoot); } /// - /// Get PowerDensity from WattsPerCubicInch. + /// Get from WattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromWattsPerCubicInch(QuantityValue wattspercubicinch) + public static PowerDensity FromWattsPerCubicInch(QuantityValue wattspercubicinch) { double value = (double) wattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.WattPerCubicInch); + return new PowerDensity(value, PowerDensityUnit.WattPerCubicInch); } /// - /// Get PowerDensity from WattsPerCubicMeter. + /// Get from WattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromWattsPerCubicMeter(QuantityValue wattspercubicmeter) + public static PowerDensity FromWattsPerCubicMeter(QuantityValue wattspercubicmeter) { double value = (double) wattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.WattPerCubicMeter); + return new PowerDensity(value, PowerDensityUnit.WattPerCubicMeter); } /// - /// Get PowerDensity from WattsPerLiter. + /// Get from WattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromWattsPerLiter(QuantityValue wattsperliter) + public static PowerDensity FromWattsPerLiter(QuantityValue wattsperliter) { double value = (double) wattsperliter; - return new PowerDensity(value, PowerDensityUnit.WattPerLiter); + return new PowerDensity(value, PowerDensityUnit.WattPerLiter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// PowerDensity unit value. - public static PowerDensity From(QuantityValue value, PowerDensityUnit fromUnit) + /// unit value. + public static PowerDensity From(QuantityValue value, PowerDensityUnit fromUnit) { - return new PowerDensity((double)value, fromUnit); + return new PowerDensity((double)value, fromUnit); } #endregion @@ -889,7 +889,7 @@ public static PowerDensity From(QuantityValue value, PowerDensityUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static PowerDensity Parse(string str) + public static PowerDensity Parse(string str) { return Parse(str, null); } @@ -917,9 +917,9 @@ public static PowerDensity Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static PowerDensity Parse(string str, [CanBeNull] IFormatProvider provider) + public static PowerDensity Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, PowerDensityUnit>( str, provider, From); @@ -933,7 +933,7 @@ public static PowerDensity Parse(string str, [CanBeNull] IFormatProvider provide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out PowerDensity result) + public static bool TryParse([CanBeNull] string str, out PowerDensity result) { return TryParse(str, null, out result); } @@ -948,9 +948,9 @@ public static bool TryParse([CanBeNull] string str, out PowerDensity result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerDensity result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerDensity result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, PowerDensityUnit>( str, provider, From, @@ -1012,43 +1012,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerD #region Arithmetic Operators /// Negate the value. - public static PowerDensity operator -(PowerDensity right) + public static PowerDensity operator -(PowerDensity right) { - return new PowerDensity(-right.Value, right.Unit); + return new PowerDensity(-right.Value, right.Unit); } - /// Get from adding two . - public static PowerDensity operator +(PowerDensity left, PowerDensity right) + /// Get from adding two . + public static PowerDensity operator +(PowerDensity left, PowerDensity right) { - return new PowerDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new PowerDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static PowerDensity operator -(PowerDensity left, PowerDensity right) + /// Get from subtracting two . + public static PowerDensity operator -(PowerDensity left, PowerDensity right) { - return new PowerDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new PowerDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static PowerDensity operator *(double left, PowerDensity right) + /// Get from multiplying value and . + public static PowerDensity operator *(double left, PowerDensity right) { - return new PowerDensity(left * right.Value, right.Unit); + return new PowerDensity(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static PowerDensity operator *(PowerDensity left, double right) + /// Get from multiplying value and . + public static PowerDensity operator *(PowerDensity left, double right) { - return new PowerDensity(left.Value * right, left.Unit); + return new PowerDensity(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static PowerDensity operator /(PowerDensity left, double right) + /// Get from dividing by value. + public static PowerDensity operator /(PowerDensity left, double right) { - return new PowerDensity(left.Value / right, left.Unit); + return new PowerDensity(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(PowerDensity left, PowerDensity right) + /// Get ratio value from dividing by . + public static double operator /(PowerDensity left, PowerDensity right) { return left.WattsPerCubicMeter / right.WattsPerCubicMeter; } @@ -1058,39 +1058,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerD #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(PowerDensity left, PowerDensity right) + public static bool operator <=(PowerDensity left, PowerDensity right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(PowerDensity left, PowerDensity right) + public static bool operator >=(PowerDensity left, PowerDensity right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(PowerDensity left, PowerDensity right) + public static bool operator <(PowerDensity left, PowerDensity right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(PowerDensity left, PowerDensity right) + public static bool operator >(PowerDensity left, PowerDensity right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(PowerDensity left, PowerDensity right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(PowerDensity left, PowerDensity right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(PowerDensity left, PowerDensity right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(PowerDensity left, PowerDensity right) { return !(left == right); } @@ -1099,37 +1099,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerD public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PowerDensity objPowerDensity)) throw new ArgumentException("Expected type PowerDensity.", nameof(obj)); + if(!(obj is PowerDensity objPowerDensity)) throw new ArgumentException("Expected type PowerDensity.", nameof(obj)); return CompareTo(objPowerDensity); } /// - public int CompareTo(PowerDensity other) + public int CompareTo(PowerDensity other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is PowerDensity objPowerDensity)) + if(obj is null || !(obj is PowerDensity objPowerDensity)) return false; return Equals(objPowerDensity); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(PowerDensity other) + /// Consider using for safely comparing floating point values. + public bool Equals(PowerDensity other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another PowerDensity within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -1167,7 +1167,7 @@ public bool Equals(PowerDensity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(PowerDensity other, double tolerance, ComparisonType comparisonType) + public bool Equals(PowerDensity other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -1181,7 +1181,7 @@ public bool Equals(PowerDensity other, double tolerance, ComparisonType comparis /// /// Returns the hash code for this instance. /// - /// A hash code for the current PowerDensity. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -1229,13 +1229,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this PowerDensity to another PowerDensity with the unit representation . + /// Converts this to another with the unit representation . /// - /// A PowerDensity with the specified unit. - public PowerDensity ToUnit(PowerDensityUnit unit) + /// A with the specified unit. + public PowerDensity ToUnit(PowerDensityUnit unit) { var convertedValue = GetValueAs(unit); - return new PowerDensity(convertedValue, unit); + return new PowerDensity(convertedValue, unit); } /// @@ -1248,7 +1248,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public PowerDensity ToUnit(UnitSystem unitSystem) + public PowerDensity ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1334,10 +1334,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal PowerDensity ToBaseUnit() + internal PowerDensity ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new PowerDensity(baseUnitValue, BaseUnit); + return new PowerDensity(baseUnitValue, BaseUnit); } private double GetValueAs(PowerDensityUnit unit) @@ -1489,7 +1489,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(PowerDensity)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(PowerDensity)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1499,12 +1499,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(PowerDensity)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(PowerDensity)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(PowerDensity)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(PowerDensity)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1549,16 +1549,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(PowerDensity)) + if(conversionType == typeof(PowerDensity)) return this; else if(conversionType == typeof(PowerDensityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return PowerDensity.QuantityType; + return PowerDensity.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return PowerDensity.BaseDimensions; + return PowerDensity.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(PowerDensity)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(PowerDensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs index c8acd1662d..ee0454c0b1 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// The strength of a signal expressed in decibels (dB) relative to one watt. /// - public partial struct PowerRatio : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct PowerRatio : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -101,19 +101,19 @@ public PowerRatio(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of PowerRatio, which is DecibelWatt. All conversions go via this value. + /// The base unit of , which is DecibelWatt. All conversions go via this value. /// public static PowerRatioUnit BaseUnit { get; } = PowerRatioUnit.DecibelWatt; /// - /// Represents the largest possible value of PowerRatio + /// Represents the largest possible value of /// - public static PowerRatio MaxValue { get; } = new PowerRatio(double.MaxValue, BaseUnit); + public static PowerRatio MaxValue { get; } = new PowerRatio(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of PowerRatio + /// Represents the smallest possible value of /// - public static PowerRatio MinValue { get; } = new PowerRatio(double.MinValue, BaseUnit); + public static PowerRatio MinValue { get; } = new PowerRatio(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -121,14 +121,14 @@ public PowerRatio(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.PowerRatio; /// - /// All units of measurement for the PowerRatio quantity. + /// All units of measurement for the quantity. /// public static PowerRatioUnit[] Units { get; } = Enum.GetValues(typeof(PowerRatioUnit)).Cast().Except(new PowerRatioUnit[]{ PowerRatioUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit DecibelWatt. /// - public static PowerRatio Zero { get; } = new PowerRatio(0, BaseUnit); + public static PowerRatio Zero { get; } = new PowerRatio(0, BaseUnit); #endregion @@ -153,24 +153,24 @@ public PowerRatio(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => PowerRatio.QuantityType; + public QuantityType Type => PowerRatio.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => PowerRatio.BaseDimensions; + public BaseDimensions Dimensions => PowerRatio.BaseDimensions; #endregion #region Conversion Properties /// - /// Get PowerRatio in DecibelMilliwatts. + /// Get in DecibelMilliwatts. /// public double DecibelMilliwatts => As(PowerRatioUnit.DecibelMilliwatt); /// - /// Get PowerRatio in DecibelWatts. + /// Get in DecibelWatts. /// public double DecibelWatts => As(PowerRatioUnit.DecibelWatt); @@ -204,33 +204,33 @@ public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] IFormatPro #region Static Factory Methods /// - /// Get PowerRatio from DecibelMilliwatts. + /// Get from DecibelMilliwatts. /// /// If value is NaN or Infinity. - public static PowerRatio FromDecibelMilliwatts(QuantityValue decibelmilliwatts) + public static PowerRatio FromDecibelMilliwatts(QuantityValue decibelmilliwatts) { double value = (double) decibelmilliwatts; - return new PowerRatio(value, PowerRatioUnit.DecibelMilliwatt); + return new PowerRatio(value, PowerRatioUnit.DecibelMilliwatt); } /// - /// Get PowerRatio from DecibelWatts. + /// Get from DecibelWatts. /// /// If value is NaN or Infinity. - public static PowerRatio FromDecibelWatts(QuantityValue decibelwatts) + public static PowerRatio FromDecibelWatts(QuantityValue decibelwatts) { double value = (double) decibelwatts; - return new PowerRatio(value, PowerRatioUnit.DecibelWatt); + return new PowerRatio(value, PowerRatioUnit.DecibelWatt); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// PowerRatio unit value. - public static PowerRatio From(QuantityValue value, PowerRatioUnit fromUnit) + /// unit value. + public static PowerRatio From(QuantityValue value, PowerRatioUnit fromUnit) { - return new PowerRatio((double)value, fromUnit); + return new PowerRatio((double)value, fromUnit); } #endregion @@ -259,7 +259,7 @@ public static PowerRatio From(QuantityValue value, PowerRatioUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static PowerRatio Parse(string str) + public static PowerRatio Parse(string str) { return Parse(str, null); } @@ -287,9 +287,9 @@ public static PowerRatio Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static PowerRatio Parse(string str, [CanBeNull] IFormatProvider provider) + public static PowerRatio Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, PowerRatioUnit>( str, provider, From); @@ -303,7 +303,7 @@ public static PowerRatio Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out PowerRatio result) + public static bool TryParse([CanBeNull] string str, out PowerRatio result) { return TryParse(str, null, out result); } @@ -318,9 +318,9 @@ public static bool TryParse([CanBeNull] string str, out PowerRatio result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerRatio result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerRatio result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, PowerRatioUnit>( str, provider, From, @@ -382,50 +382,50 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerR #region Logarithmic Arithmetic Operators /// Negate the value. - public static PowerRatio operator -(PowerRatio right) + public static PowerRatio operator -(PowerRatio right) { - return new PowerRatio(-right.Value, right.Unit); + return new PowerRatio(-right.Value, right.Unit); } - /// Get from logarithmic addition of two . - public static PowerRatio operator +(PowerRatio left, PowerRatio right) + /// Get from logarithmic addition of two . + public static PowerRatio operator +(PowerRatio left, PowerRatio right) { // Logarithmic addition // Formula: 10*log10(10^(x/10) + 10^(y/10)) - return new PowerRatio(10*Math.Log10(Math.Pow(10, left.Value/10) + Math.Pow(10, right.GetValueAs(left.Unit)/10)), left.Unit); + return new PowerRatio(10*Math.Log10(Math.Pow(10, left.Value/10) + Math.Pow(10, right.GetValueAs(left.Unit)/10)), left.Unit); } - /// Get from logarithmic subtraction of two . - public static PowerRatio operator -(PowerRatio left, PowerRatio right) + /// Get from logarithmic subtraction of two . + public static PowerRatio operator -(PowerRatio left, PowerRatio right) { // Logarithmic subtraction // Formula: 10*log10(10^(x/10) - 10^(y/10)) - return new PowerRatio(10*Math.Log10(Math.Pow(10, left.Value/10) - Math.Pow(10, right.GetValueAs(left.Unit)/10)), left.Unit); + return new PowerRatio(10*Math.Log10(Math.Pow(10, left.Value/10) - Math.Pow(10, right.GetValueAs(left.Unit)/10)), left.Unit); } - /// Get from logarithmic multiplication of value and . - public static PowerRatio operator *(double left, PowerRatio right) + /// Get from logarithmic multiplication of value and . + public static PowerRatio operator *(double left, PowerRatio right) { // Logarithmic multiplication = addition - return new PowerRatio(left + right.Value, right.Unit); + return new PowerRatio(left + right.Value, right.Unit); } - /// Get from logarithmic multiplication of value and . - public static PowerRatio operator *(PowerRatio left, double right) + /// Get from logarithmic multiplication of value and . + public static PowerRatio operator *(PowerRatio left, double right) { // Logarithmic multiplication = addition - return new PowerRatio(left.Value + (double)right, left.Unit); + return new PowerRatio(left.Value + (double)right, left.Unit); } - /// Get from logarithmic division of by value. - public static PowerRatio operator /(PowerRatio left, double right) + /// Get from logarithmic division of by value. + public static PowerRatio operator /(PowerRatio left, double right) { // Logarithmic division = subtraction - return new PowerRatio(left.Value - (double)right, left.Unit); + return new PowerRatio(left.Value - (double)right, left.Unit); } - /// Get ratio value from logarithmic division of by . - public static double operator /(PowerRatio left, PowerRatio right) + /// Get ratio value from logarithmic division of by . + public static double operator /(PowerRatio left, PowerRatio right) { // Logarithmic division = subtraction return Convert.ToDouble(left.Value - right.GetValueAs(left.Unit)); @@ -436,39 +436,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerR #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(PowerRatio left, PowerRatio right) + public static bool operator <=(PowerRatio left, PowerRatio right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(PowerRatio left, PowerRatio right) + public static bool operator >=(PowerRatio left, PowerRatio right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(PowerRatio left, PowerRatio right) + public static bool operator <(PowerRatio left, PowerRatio right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(PowerRatio left, PowerRatio right) + public static bool operator >(PowerRatio left, PowerRatio right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(PowerRatio left, PowerRatio right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(PowerRatio left, PowerRatio right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(PowerRatio left, PowerRatio right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(PowerRatio left, PowerRatio right) { return !(left == right); } @@ -477,37 +477,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerR public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PowerRatio objPowerRatio)) throw new ArgumentException("Expected type PowerRatio.", nameof(obj)); + if(!(obj is PowerRatio objPowerRatio)) throw new ArgumentException("Expected type PowerRatio.", nameof(obj)); return CompareTo(objPowerRatio); } /// - public int CompareTo(PowerRatio other) + public int CompareTo(PowerRatio other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is PowerRatio objPowerRatio)) + if(obj is null || !(obj is PowerRatio objPowerRatio)) return false; return Equals(objPowerRatio); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(PowerRatio other) + /// Consider using for safely comparing floating point values. + public bool Equals(PowerRatio other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another PowerRatio within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -545,7 +545,7 @@ public bool Equals(PowerRatio other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(PowerRatio other, double tolerance, ComparisonType comparisonType) + public bool Equals(PowerRatio other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -559,7 +559,7 @@ public bool Equals(PowerRatio other, double tolerance, ComparisonType comparison /// /// Returns the hash code for this instance. /// - /// A hash code for the current PowerRatio. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -607,13 +607,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this PowerRatio to another PowerRatio with the unit representation . + /// Converts this to another with the unit representation . /// - /// A PowerRatio with the specified unit. - public PowerRatio ToUnit(PowerRatioUnit unit) + /// A with the specified unit. + public PowerRatio ToUnit(PowerRatioUnit unit) { var convertedValue = GetValueAs(unit); - return new PowerRatio(convertedValue, unit); + return new PowerRatio(convertedValue, unit); } /// @@ -626,7 +626,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public PowerRatio ToUnit(UnitSystem unitSystem) + public PowerRatio ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -670,10 +670,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal PowerRatio ToBaseUnit() + internal PowerRatio ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new PowerRatio(baseUnitValue, BaseUnit); + return new PowerRatio(baseUnitValue, BaseUnit); } private double GetValueAs(PowerRatioUnit unit) @@ -783,7 +783,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(PowerRatio)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(PowerRatio)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -793,12 +793,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(PowerRatio)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(PowerRatio)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(PowerRatio)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(PowerRatio)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -843,16 +843,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(PowerRatio)) + if(conversionType == typeof(PowerRatio)) return this; else if(conversionType == typeof(PowerRatioUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return PowerRatio.QuantityType; + return PowerRatio.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return PowerRatio.BaseDimensions; + return PowerRatio.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(PowerRatio)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(PowerRatio)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs index 2b23dacf30..2c52d05c6d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Pressure (symbol: P or p) is the ratio of force to the area over which that force is distributed. Pressure is force per unit area applied in a direction perpendicular to the surface of an object. Gauge pressure (also spelled gage pressure)[a] is the pressure relative to the local atmospheric or ambient pressure. Pressure is measured in any unit of force divided by any unit of area. The SI unit of pressure is the newton per square metre, which is called the pascal (Pa) after the seventeenth-century philosopher and scientist Blaise Pascal. A pressure of 1 Pa is small; it approximately equals the pressure exerted by a dollar bill resting flat on a table. Everyday pressures are often stated in kilopascals (1 kPa = 1000 Pa). /// - public partial struct Pressure : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Pressure : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -141,19 +141,19 @@ public Pressure(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Pressure, which is Pascal. All conversions go via this value. + /// The base unit of , which is Pascal. All conversions go via this value. /// public static PressureUnit BaseUnit { get; } = PressureUnit.Pascal; /// - /// Represents the largest possible value of Pressure + /// Represents the largest possible value of /// - public static Pressure MaxValue { get; } = new Pressure(double.MaxValue, BaseUnit); + public static Pressure MaxValue { get; } = new Pressure(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Pressure + /// Represents the smallest possible value of /// - public static Pressure MinValue { get; } = new Pressure(double.MinValue, BaseUnit); + public static Pressure MinValue { get; } = new Pressure(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -161,14 +161,14 @@ public Pressure(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Pressure; /// - /// All units of measurement for the Pressure quantity. + /// All units of measurement for the quantity. /// public static PressureUnit[] Units { get; } = Enum.GetValues(typeof(PressureUnit)).Cast().Except(new PressureUnit[]{ PressureUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Pascal. /// - public static Pressure Zero { get; } = new Pressure(0, BaseUnit); + public static Pressure Zero { get; } = new Pressure(0, BaseUnit); #endregion @@ -193,224 +193,224 @@ public Pressure(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Pressure.QuantityType; + public QuantityType Type => Pressure.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Pressure.BaseDimensions; + public BaseDimensions Dimensions => Pressure.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Pressure in Atmospheres. + /// Get in Atmospheres. /// public double Atmospheres => As(PressureUnit.Atmosphere); /// - /// Get Pressure in Bars. + /// Get in Bars. /// public double Bars => As(PressureUnit.Bar); /// - /// Get Pressure in Centibars. + /// Get in Centibars. /// public double Centibars => As(PressureUnit.Centibar); /// - /// Get Pressure in Decapascals. + /// Get in Decapascals. /// public double Decapascals => As(PressureUnit.Decapascal); /// - /// Get Pressure in Decibars. + /// Get in Decibars. /// public double Decibars => As(PressureUnit.Decibar); /// - /// Get Pressure in DynesPerSquareCentimeter. + /// Get in DynesPerSquareCentimeter. /// public double DynesPerSquareCentimeter => As(PressureUnit.DynePerSquareCentimeter); /// - /// Get Pressure in FeetOfHead. + /// Get in FeetOfHead. /// public double FeetOfHead => As(PressureUnit.FootOfHead); /// - /// Get Pressure in Gigapascals. + /// Get in Gigapascals. /// public double Gigapascals => As(PressureUnit.Gigapascal); /// - /// Get Pressure in Hectopascals. + /// Get in Hectopascals. /// public double Hectopascals => As(PressureUnit.Hectopascal); /// - /// Get Pressure in InchesOfMercury. + /// Get in InchesOfMercury. /// public double InchesOfMercury => As(PressureUnit.InchOfMercury); /// - /// Get Pressure in InchesOfWaterColumn. + /// Get in InchesOfWaterColumn. /// public double InchesOfWaterColumn => As(PressureUnit.InchOfWaterColumn); /// - /// Get Pressure in Kilobars. + /// Get in Kilobars. /// public double Kilobars => As(PressureUnit.Kilobar); /// - /// Get Pressure in KilogramsForcePerSquareCentimeter. + /// Get in KilogramsForcePerSquareCentimeter. /// public double KilogramsForcePerSquareCentimeter => As(PressureUnit.KilogramForcePerSquareCentimeter); /// - /// Get Pressure in KilogramsForcePerSquareMeter. + /// Get in KilogramsForcePerSquareMeter. /// public double KilogramsForcePerSquareMeter => As(PressureUnit.KilogramForcePerSquareMeter); /// - /// Get Pressure in KilogramsForcePerSquareMillimeter. + /// Get in KilogramsForcePerSquareMillimeter. /// public double KilogramsForcePerSquareMillimeter => As(PressureUnit.KilogramForcePerSquareMillimeter); /// - /// Get Pressure in KilonewtonsPerSquareCentimeter. + /// Get in KilonewtonsPerSquareCentimeter. /// public double KilonewtonsPerSquareCentimeter => As(PressureUnit.KilonewtonPerSquareCentimeter); /// - /// Get Pressure in KilonewtonsPerSquareMeter. + /// Get in KilonewtonsPerSquareMeter. /// public double KilonewtonsPerSquareMeter => As(PressureUnit.KilonewtonPerSquareMeter); /// - /// Get Pressure in KilonewtonsPerSquareMillimeter. + /// Get in KilonewtonsPerSquareMillimeter. /// public double KilonewtonsPerSquareMillimeter => As(PressureUnit.KilonewtonPerSquareMillimeter); /// - /// Get Pressure in Kilopascals. + /// Get in Kilopascals. /// public double Kilopascals => As(PressureUnit.Kilopascal); /// - /// Get Pressure in KilopoundsForcePerSquareFoot. + /// Get in KilopoundsForcePerSquareFoot. /// public double KilopoundsForcePerSquareFoot => As(PressureUnit.KilopoundForcePerSquareFoot); /// - /// Get Pressure in KilopoundsForcePerSquareInch. + /// Get in KilopoundsForcePerSquareInch. /// public double KilopoundsForcePerSquareInch => As(PressureUnit.KilopoundForcePerSquareInch); /// - /// Get Pressure in Megabars. + /// Get in Megabars. /// public double Megabars => As(PressureUnit.Megabar); /// - /// Get Pressure in MeganewtonsPerSquareMeter. + /// Get in MeganewtonsPerSquareMeter. /// public double MeganewtonsPerSquareMeter => As(PressureUnit.MeganewtonPerSquareMeter); /// - /// Get Pressure in Megapascals. + /// Get in Megapascals. /// public double Megapascals => As(PressureUnit.Megapascal); /// - /// Get Pressure in MetersOfHead. + /// Get in MetersOfHead. /// public double MetersOfHead => As(PressureUnit.MeterOfHead); /// - /// Get Pressure in Microbars. + /// Get in Microbars. /// public double Microbars => As(PressureUnit.Microbar); /// - /// Get Pressure in Micropascals. + /// Get in Micropascals. /// public double Micropascals => As(PressureUnit.Micropascal); /// - /// Get Pressure in Millibars. + /// Get in Millibars. /// public double Millibars => As(PressureUnit.Millibar); /// - /// Get Pressure in MillimetersOfMercury. + /// Get in MillimetersOfMercury. /// public double MillimetersOfMercury => As(PressureUnit.MillimeterOfMercury); /// - /// Get Pressure in Millipascals. + /// Get in Millipascals. /// public double Millipascals => As(PressureUnit.Millipascal); /// - /// Get Pressure in NewtonsPerSquareCentimeter. + /// Get in NewtonsPerSquareCentimeter. /// public double NewtonsPerSquareCentimeter => As(PressureUnit.NewtonPerSquareCentimeter); /// - /// Get Pressure in NewtonsPerSquareMeter. + /// Get in NewtonsPerSquareMeter. /// public double NewtonsPerSquareMeter => As(PressureUnit.NewtonPerSquareMeter); /// - /// Get Pressure in NewtonsPerSquareMillimeter. + /// Get in NewtonsPerSquareMillimeter. /// public double NewtonsPerSquareMillimeter => As(PressureUnit.NewtonPerSquareMillimeter); /// - /// Get Pressure in Pascals. + /// Get in Pascals. /// public double Pascals => As(PressureUnit.Pascal); /// - /// Get Pressure in PoundsForcePerSquareFoot. + /// Get in PoundsForcePerSquareFoot. /// public double PoundsForcePerSquareFoot => As(PressureUnit.PoundForcePerSquareFoot); /// - /// Get Pressure in PoundsForcePerSquareInch. + /// Get in PoundsForcePerSquareInch. /// public double PoundsForcePerSquareInch => As(PressureUnit.PoundForcePerSquareInch); /// - /// Get Pressure in PoundsPerInchSecondSquared. + /// Get in PoundsPerInchSecondSquared. /// public double PoundsPerInchSecondSquared => As(PressureUnit.PoundPerInchSecondSquared); /// - /// Get Pressure in TechnicalAtmospheres. + /// Get in TechnicalAtmospheres. /// public double TechnicalAtmospheres => As(PressureUnit.TechnicalAtmosphere); /// - /// Get Pressure in TonnesForcePerSquareCentimeter. + /// Get in TonnesForcePerSquareCentimeter. /// public double TonnesForcePerSquareCentimeter => As(PressureUnit.TonneForcePerSquareCentimeter); /// - /// Get Pressure in TonnesForcePerSquareMeter. + /// Get in TonnesForcePerSquareMeter. /// public double TonnesForcePerSquareMeter => As(PressureUnit.TonneForcePerSquareMeter); /// - /// Get Pressure in TonnesForcePerSquareMillimeter. + /// Get in TonnesForcePerSquareMillimeter. /// public double TonnesForcePerSquareMillimeter => As(PressureUnit.TonneForcePerSquareMillimeter); /// - /// Get Pressure in Torrs. + /// Get in Torrs. /// public double Torrs => As(PressureUnit.Torr); @@ -444,393 +444,393 @@ public static string GetAbbreviation(PressureUnit unit, [CanBeNull] IFormatProvi #region Static Factory Methods /// - /// Get Pressure from Atmospheres. + /// Get from Atmospheres. /// /// If value is NaN or Infinity. - public static Pressure FromAtmospheres(QuantityValue atmospheres) + public static Pressure FromAtmospheres(QuantityValue atmospheres) { double value = (double) atmospheres; - return new Pressure(value, PressureUnit.Atmosphere); + return new Pressure(value, PressureUnit.Atmosphere); } /// - /// Get Pressure from Bars. + /// Get from Bars. /// /// If value is NaN or Infinity. - public static Pressure FromBars(QuantityValue bars) + public static Pressure FromBars(QuantityValue bars) { double value = (double) bars; - return new Pressure(value, PressureUnit.Bar); + return new Pressure(value, PressureUnit.Bar); } /// - /// Get Pressure from Centibars. + /// Get from Centibars. /// /// If value is NaN or Infinity. - public static Pressure FromCentibars(QuantityValue centibars) + public static Pressure FromCentibars(QuantityValue centibars) { double value = (double) centibars; - return new Pressure(value, PressureUnit.Centibar); + return new Pressure(value, PressureUnit.Centibar); } /// - /// Get Pressure from Decapascals. + /// Get from Decapascals. /// /// If value is NaN or Infinity. - public static Pressure FromDecapascals(QuantityValue decapascals) + public static Pressure FromDecapascals(QuantityValue decapascals) { double value = (double) decapascals; - return new Pressure(value, PressureUnit.Decapascal); + return new Pressure(value, PressureUnit.Decapascal); } /// - /// Get Pressure from Decibars. + /// Get from Decibars. /// /// If value is NaN or Infinity. - public static Pressure FromDecibars(QuantityValue decibars) + public static Pressure FromDecibars(QuantityValue decibars) { double value = (double) decibars; - return new Pressure(value, PressureUnit.Decibar); + return new Pressure(value, PressureUnit.Decibar); } /// - /// Get Pressure from DynesPerSquareCentimeter. + /// Get from DynesPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Pressure FromDynesPerSquareCentimeter(QuantityValue dynespersquarecentimeter) + public static Pressure FromDynesPerSquareCentimeter(QuantityValue dynespersquarecentimeter) { double value = (double) dynespersquarecentimeter; - return new Pressure(value, PressureUnit.DynePerSquareCentimeter); + return new Pressure(value, PressureUnit.DynePerSquareCentimeter); } /// - /// Get Pressure from FeetOfHead. + /// Get from FeetOfHead. /// /// If value is NaN or Infinity. - public static Pressure FromFeetOfHead(QuantityValue feetofhead) + public static Pressure FromFeetOfHead(QuantityValue feetofhead) { double value = (double) feetofhead; - return new Pressure(value, PressureUnit.FootOfHead); + return new Pressure(value, PressureUnit.FootOfHead); } /// - /// Get Pressure from Gigapascals. + /// Get from Gigapascals. /// /// If value is NaN or Infinity. - public static Pressure FromGigapascals(QuantityValue gigapascals) + public static Pressure FromGigapascals(QuantityValue gigapascals) { double value = (double) gigapascals; - return new Pressure(value, PressureUnit.Gigapascal); + return new Pressure(value, PressureUnit.Gigapascal); } /// - /// Get Pressure from Hectopascals. + /// Get from Hectopascals. /// /// If value is NaN or Infinity. - public static Pressure FromHectopascals(QuantityValue hectopascals) + public static Pressure FromHectopascals(QuantityValue hectopascals) { double value = (double) hectopascals; - return new Pressure(value, PressureUnit.Hectopascal); + return new Pressure(value, PressureUnit.Hectopascal); } /// - /// Get Pressure from InchesOfMercury. + /// Get from InchesOfMercury. /// /// If value is NaN or Infinity. - public static Pressure FromInchesOfMercury(QuantityValue inchesofmercury) + public static Pressure FromInchesOfMercury(QuantityValue inchesofmercury) { double value = (double) inchesofmercury; - return new Pressure(value, PressureUnit.InchOfMercury); + return new Pressure(value, PressureUnit.InchOfMercury); } /// - /// Get Pressure from InchesOfWaterColumn. + /// Get from InchesOfWaterColumn. /// /// If value is NaN or Infinity. - public static Pressure FromInchesOfWaterColumn(QuantityValue inchesofwatercolumn) + public static Pressure FromInchesOfWaterColumn(QuantityValue inchesofwatercolumn) { double value = (double) inchesofwatercolumn; - return new Pressure(value, PressureUnit.InchOfWaterColumn); + return new Pressure(value, PressureUnit.InchOfWaterColumn); } /// - /// Get Pressure from Kilobars. + /// Get from Kilobars. /// /// If value is NaN or Infinity. - public static Pressure FromKilobars(QuantityValue kilobars) + public static Pressure FromKilobars(QuantityValue kilobars) { double value = (double) kilobars; - return new Pressure(value, PressureUnit.Kilobar); + return new Pressure(value, PressureUnit.Kilobar); } /// - /// Get Pressure from KilogramsForcePerSquareCentimeter. + /// Get from KilogramsForcePerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Pressure FromKilogramsForcePerSquareCentimeter(QuantityValue kilogramsforcepersquarecentimeter) + public static Pressure FromKilogramsForcePerSquareCentimeter(QuantityValue kilogramsforcepersquarecentimeter) { double value = (double) kilogramsforcepersquarecentimeter; - return new Pressure(value, PressureUnit.KilogramForcePerSquareCentimeter); + return new Pressure(value, PressureUnit.KilogramForcePerSquareCentimeter); } /// - /// Get Pressure from KilogramsForcePerSquareMeter. + /// Get from KilogramsForcePerSquareMeter. /// /// If value is NaN or Infinity. - public static Pressure FromKilogramsForcePerSquareMeter(QuantityValue kilogramsforcepersquaremeter) + public static Pressure FromKilogramsForcePerSquareMeter(QuantityValue kilogramsforcepersquaremeter) { double value = (double) kilogramsforcepersquaremeter; - return new Pressure(value, PressureUnit.KilogramForcePerSquareMeter); + return new Pressure(value, PressureUnit.KilogramForcePerSquareMeter); } /// - /// Get Pressure from KilogramsForcePerSquareMillimeter. + /// Get from KilogramsForcePerSquareMillimeter. /// /// If value is NaN or Infinity. - public static Pressure FromKilogramsForcePerSquareMillimeter(QuantityValue kilogramsforcepersquaremillimeter) + public static Pressure FromKilogramsForcePerSquareMillimeter(QuantityValue kilogramsforcepersquaremillimeter) { double value = (double) kilogramsforcepersquaremillimeter; - return new Pressure(value, PressureUnit.KilogramForcePerSquareMillimeter); + return new Pressure(value, PressureUnit.KilogramForcePerSquareMillimeter); } /// - /// Get Pressure from KilonewtonsPerSquareCentimeter. + /// Get from KilonewtonsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Pressure FromKilonewtonsPerSquareCentimeter(QuantityValue kilonewtonspersquarecentimeter) + public static Pressure FromKilonewtonsPerSquareCentimeter(QuantityValue kilonewtonspersquarecentimeter) { double value = (double) kilonewtonspersquarecentimeter; - return new Pressure(value, PressureUnit.KilonewtonPerSquareCentimeter); + return new Pressure(value, PressureUnit.KilonewtonPerSquareCentimeter); } /// - /// Get Pressure from KilonewtonsPerSquareMeter. + /// Get from KilonewtonsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Pressure FromKilonewtonsPerSquareMeter(QuantityValue kilonewtonspersquaremeter) + public static Pressure FromKilonewtonsPerSquareMeter(QuantityValue kilonewtonspersquaremeter) { double value = (double) kilonewtonspersquaremeter; - return new Pressure(value, PressureUnit.KilonewtonPerSquareMeter); + return new Pressure(value, PressureUnit.KilonewtonPerSquareMeter); } /// - /// Get Pressure from KilonewtonsPerSquareMillimeter. + /// Get from KilonewtonsPerSquareMillimeter. /// /// If value is NaN or Infinity. - public static Pressure FromKilonewtonsPerSquareMillimeter(QuantityValue kilonewtonspersquaremillimeter) + public static Pressure FromKilonewtonsPerSquareMillimeter(QuantityValue kilonewtonspersquaremillimeter) { double value = (double) kilonewtonspersquaremillimeter; - return new Pressure(value, PressureUnit.KilonewtonPerSquareMillimeter); + return new Pressure(value, PressureUnit.KilonewtonPerSquareMillimeter); } /// - /// Get Pressure from Kilopascals. + /// Get from Kilopascals. /// /// If value is NaN or Infinity. - public static Pressure FromKilopascals(QuantityValue kilopascals) + public static Pressure FromKilopascals(QuantityValue kilopascals) { double value = (double) kilopascals; - return new Pressure(value, PressureUnit.Kilopascal); + return new Pressure(value, PressureUnit.Kilopascal); } /// - /// Get Pressure from KilopoundsForcePerSquareFoot. + /// Get from KilopoundsForcePerSquareFoot. /// /// If value is NaN or Infinity. - public static Pressure FromKilopoundsForcePerSquareFoot(QuantityValue kilopoundsforcepersquarefoot) + public static Pressure FromKilopoundsForcePerSquareFoot(QuantityValue kilopoundsforcepersquarefoot) { double value = (double) kilopoundsforcepersquarefoot; - return new Pressure(value, PressureUnit.KilopoundForcePerSquareFoot); + return new Pressure(value, PressureUnit.KilopoundForcePerSquareFoot); } /// - /// Get Pressure from KilopoundsForcePerSquareInch. + /// Get from KilopoundsForcePerSquareInch. /// /// If value is NaN or Infinity. - public static Pressure FromKilopoundsForcePerSquareInch(QuantityValue kilopoundsforcepersquareinch) + public static Pressure FromKilopoundsForcePerSquareInch(QuantityValue kilopoundsforcepersquareinch) { double value = (double) kilopoundsforcepersquareinch; - return new Pressure(value, PressureUnit.KilopoundForcePerSquareInch); + return new Pressure(value, PressureUnit.KilopoundForcePerSquareInch); } /// - /// Get Pressure from Megabars. + /// Get from Megabars. /// /// If value is NaN or Infinity. - public static Pressure FromMegabars(QuantityValue megabars) + public static Pressure FromMegabars(QuantityValue megabars) { double value = (double) megabars; - return new Pressure(value, PressureUnit.Megabar); + return new Pressure(value, PressureUnit.Megabar); } /// - /// Get Pressure from MeganewtonsPerSquareMeter. + /// Get from MeganewtonsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Pressure FromMeganewtonsPerSquareMeter(QuantityValue meganewtonspersquaremeter) + public static Pressure FromMeganewtonsPerSquareMeter(QuantityValue meganewtonspersquaremeter) { double value = (double) meganewtonspersquaremeter; - return new Pressure(value, PressureUnit.MeganewtonPerSquareMeter); + return new Pressure(value, PressureUnit.MeganewtonPerSquareMeter); } /// - /// Get Pressure from Megapascals. + /// Get from Megapascals. /// /// If value is NaN or Infinity. - public static Pressure FromMegapascals(QuantityValue megapascals) + public static Pressure FromMegapascals(QuantityValue megapascals) { double value = (double) megapascals; - return new Pressure(value, PressureUnit.Megapascal); + return new Pressure(value, PressureUnit.Megapascal); } /// - /// Get Pressure from MetersOfHead. + /// Get from MetersOfHead. /// /// If value is NaN or Infinity. - public static Pressure FromMetersOfHead(QuantityValue metersofhead) + public static Pressure FromMetersOfHead(QuantityValue metersofhead) { double value = (double) metersofhead; - return new Pressure(value, PressureUnit.MeterOfHead); + return new Pressure(value, PressureUnit.MeterOfHead); } /// - /// Get Pressure from Microbars. + /// Get from Microbars. /// /// If value is NaN or Infinity. - public static Pressure FromMicrobars(QuantityValue microbars) + public static Pressure FromMicrobars(QuantityValue microbars) { double value = (double) microbars; - return new Pressure(value, PressureUnit.Microbar); + return new Pressure(value, PressureUnit.Microbar); } /// - /// Get Pressure from Micropascals. + /// Get from Micropascals. /// /// If value is NaN or Infinity. - public static Pressure FromMicropascals(QuantityValue micropascals) + public static Pressure FromMicropascals(QuantityValue micropascals) { double value = (double) micropascals; - return new Pressure(value, PressureUnit.Micropascal); + return new Pressure(value, PressureUnit.Micropascal); } /// - /// Get Pressure from Millibars. + /// Get from Millibars. /// /// If value is NaN or Infinity. - public static Pressure FromMillibars(QuantityValue millibars) + public static Pressure FromMillibars(QuantityValue millibars) { double value = (double) millibars; - return new Pressure(value, PressureUnit.Millibar); + return new Pressure(value, PressureUnit.Millibar); } /// - /// Get Pressure from MillimetersOfMercury. + /// Get from MillimetersOfMercury. /// /// If value is NaN or Infinity. - public static Pressure FromMillimetersOfMercury(QuantityValue millimetersofmercury) + public static Pressure FromMillimetersOfMercury(QuantityValue millimetersofmercury) { double value = (double) millimetersofmercury; - return new Pressure(value, PressureUnit.MillimeterOfMercury); + return new Pressure(value, PressureUnit.MillimeterOfMercury); } /// - /// Get Pressure from Millipascals. + /// Get from Millipascals. /// /// If value is NaN or Infinity. - public static Pressure FromMillipascals(QuantityValue millipascals) + public static Pressure FromMillipascals(QuantityValue millipascals) { double value = (double) millipascals; - return new Pressure(value, PressureUnit.Millipascal); + return new Pressure(value, PressureUnit.Millipascal); } /// - /// Get Pressure from NewtonsPerSquareCentimeter. + /// Get from NewtonsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Pressure FromNewtonsPerSquareCentimeter(QuantityValue newtonspersquarecentimeter) + public static Pressure FromNewtonsPerSquareCentimeter(QuantityValue newtonspersquarecentimeter) { double value = (double) newtonspersquarecentimeter; - return new Pressure(value, PressureUnit.NewtonPerSquareCentimeter); + return new Pressure(value, PressureUnit.NewtonPerSquareCentimeter); } /// - /// Get Pressure from NewtonsPerSquareMeter. + /// Get from NewtonsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Pressure FromNewtonsPerSquareMeter(QuantityValue newtonspersquaremeter) + public static Pressure FromNewtonsPerSquareMeter(QuantityValue newtonspersquaremeter) { double value = (double) newtonspersquaremeter; - return new Pressure(value, PressureUnit.NewtonPerSquareMeter); + return new Pressure(value, PressureUnit.NewtonPerSquareMeter); } /// - /// Get Pressure from NewtonsPerSquareMillimeter. + /// Get from NewtonsPerSquareMillimeter. /// /// If value is NaN or Infinity. - public static Pressure FromNewtonsPerSquareMillimeter(QuantityValue newtonspersquaremillimeter) + public static Pressure FromNewtonsPerSquareMillimeter(QuantityValue newtonspersquaremillimeter) { double value = (double) newtonspersquaremillimeter; - return new Pressure(value, PressureUnit.NewtonPerSquareMillimeter); + return new Pressure(value, PressureUnit.NewtonPerSquareMillimeter); } /// - /// Get Pressure from Pascals. + /// Get from Pascals. /// /// If value is NaN or Infinity. - public static Pressure FromPascals(QuantityValue pascals) + public static Pressure FromPascals(QuantityValue pascals) { double value = (double) pascals; - return new Pressure(value, PressureUnit.Pascal); + return new Pressure(value, PressureUnit.Pascal); } /// - /// Get Pressure from PoundsForcePerSquareFoot. + /// Get from PoundsForcePerSquareFoot. /// /// If value is NaN or Infinity. - public static Pressure FromPoundsForcePerSquareFoot(QuantityValue poundsforcepersquarefoot) + public static Pressure FromPoundsForcePerSquareFoot(QuantityValue poundsforcepersquarefoot) { double value = (double) poundsforcepersquarefoot; - return new Pressure(value, PressureUnit.PoundForcePerSquareFoot); + return new Pressure(value, PressureUnit.PoundForcePerSquareFoot); } /// - /// Get Pressure from PoundsForcePerSquareInch. + /// Get from PoundsForcePerSquareInch. /// /// If value is NaN or Infinity. - public static Pressure FromPoundsForcePerSquareInch(QuantityValue poundsforcepersquareinch) + public static Pressure FromPoundsForcePerSquareInch(QuantityValue poundsforcepersquareinch) { double value = (double) poundsforcepersquareinch; - return new Pressure(value, PressureUnit.PoundForcePerSquareInch); + return new Pressure(value, PressureUnit.PoundForcePerSquareInch); } /// - /// Get Pressure from PoundsPerInchSecondSquared. + /// Get from PoundsPerInchSecondSquared. /// /// If value is NaN or Infinity. - public static Pressure FromPoundsPerInchSecondSquared(QuantityValue poundsperinchsecondsquared) + public static Pressure FromPoundsPerInchSecondSquared(QuantityValue poundsperinchsecondsquared) { double value = (double) poundsperinchsecondsquared; - return new Pressure(value, PressureUnit.PoundPerInchSecondSquared); + return new Pressure(value, PressureUnit.PoundPerInchSecondSquared); } /// - /// Get Pressure from TechnicalAtmospheres. + /// Get from TechnicalAtmospheres. /// /// If value is NaN or Infinity. - public static Pressure FromTechnicalAtmospheres(QuantityValue technicalatmospheres) + public static Pressure FromTechnicalAtmospheres(QuantityValue technicalatmospheres) { double value = (double) technicalatmospheres; - return new Pressure(value, PressureUnit.TechnicalAtmosphere); + return new Pressure(value, PressureUnit.TechnicalAtmosphere); } /// - /// Get Pressure from TonnesForcePerSquareCentimeter. + /// Get from TonnesForcePerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Pressure FromTonnesForcePerSquareCentimeter(QuantityValue tonnesforcepersquarecentimeter) + public static Pressure FromTonnesForcePerSquareCentimeter(QuantityValue tonnesforcepersquarecentimeter) { double value = (double) tonnesforcepersquarecentimeter; - return new Pressure(value, PressureUnit.TonneForcePerSquareCentimeter); + return new Pressure(value, PressureUnit.TonneForcePerSquareCentimeter); } /// - /// Get Pressure from TonnesForcePerSquareMeter. + /// Get from TonnesForcePerSquareMeter. /// /// If value is NaN or Infinity. - public static Pressure FromTonnesForcePerSquareMeter(QuantityValue tonnesforcepersquaremeter) + public static Pressure FromTonnesForcePerSquareMeter(QuantityValue tonnesforcepersquaremeter) { double value = (double) tonnesforcepersquaremeter; - return new Pressure(value, PressureUnit.TonneForcePerSquareMeter); + return new Pressure(value, PressureUnit.TonneForcePerSquareMeter); } /// - /// Get Pressure from TonnesForcePerSquareMillimeter. + /// Get from TonnesForcePerSquareMillimeter. /// /// If value is NaN or Infinity. - public static Pressure FromTonnesForcePerSquareMillimeter(QuantityValue tonnesforcepersquaremillimeter) + public static Pressure FromTonnesForcePerSquareMillimeter(QuantityValue tonnesforcepersquaremillimeter) { double value = (double) tonnesforcepersquaremillimeter; - return new Pressure(value, PressureUnit.TonneForcePerSquareMillimeter); + return new Pressure(value, PressureUnit.TonneForcePerSquareMillimeter); } /// - /// Get Pressure from Torrs. + /// Get from Torrs. /// /// If value is NaN or Infinity. - public static Pressure FromTorrs(QuantityValue torrs) + public static Pressure FromTorrs(QuantityValue torrs) { double value = (double) torrs; - return new Pressure(value, PressureUnit.Torr); + return new Pressure(value, PressureUnit.Torr); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Pressure unit value. - public static Pressure From(QuantityValue value, PressureUnit fromUnit) + /// unit value. + public static Pressure From(QuantityValue value, PressureUnit fromUnit) { - return new Pressure((double)value, fromUnit); + return new Pressure((double)value, fromUnit); } #endregion @@ -859,7 +859,7 @@ public static Pressure From(QuantityValue value, PressureUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Pressure Parse(string str) + public static Pressure Parse(string str) { return Parse(str, null); } @@ -887,9 +887,9 @@ public static Pressure Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Pressure Parse(string str, [CanBeNull] IFormatProvider provider) + public static Pressure Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, PressureUnit>( str, provider, From); @@ -903,7 +903,7 @@ public static Pressure Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Pressure result) + public static bool TryParse([CanBeNull] string str, out Pressure result) { return TryParse(str, null, out result); } @@ -918,9 +918,9 @@ public static bool TryParse([CanBeNull] string str, out Pressure result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Pressure result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Pressure result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, PressureUnit>( str, provider, From, @@ -982,43 +982,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Pressu #region Arithmetic Operators /// Negate the value. - public static Pressure operator -(Pressure right) + public static Pressure operator -(Pressure right) { - return new Pressure(-right.Value, right.Unit); + return new Pressure(-right.Value, right.Unit); } - /// Get from adding two . - public static Pressure operator +(Pressure left, Pressure right) + /// Get from adding two . + public static Pressure operator +(Pressure left, Pressure right) { - return new Pressure(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Pressure(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Pressure operator -(Pressure left, Pressure right) + /// Get from subtracting two . + public static Pressure operator -(Pressure left, Pressure right) { - return new Pressure(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Pressure(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Pressure operator *(double left, Pressure right) + /// Get from multiplying value and . + public static Pressure operator *(double left, Pressure right) { - return new Pressure(left * right.Value, right.Unit); + return new Pressure(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Pressure operator *(Pressure left, double right) + /// Get from multiplying value and . + public static Pressure operator *(Pressure left, double right) { - return new Pressure(left.Value * right, left.Unit); + return new Pressure(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Pressure operator /(Pressure left, double right) + /// Get from dividing by value. + public static Pressure operator /(Pressure left, double right) { - return new Pressure(left.Value / right, left.Unit); + return new Pressure(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Pressure left, Pressure right) + /// Get ratio value from dividing by . + public static double operator /(Pressure left, Pressure right) { return left.Pascals / right.Pascals; } @@ -1028,39 +1028,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Pressu #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Pressure left, Pressure right) + public static bool operator <=(Pressure left, Pressure right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Pressure left, Pressure right) + public static bool operator >=(Pressure left, Pressure right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Pressure left, Pressure right) + public static bool operator <(Pressure left, Pressure right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Pressure left, Pressure right) + public static bool operator >(Pressure left, Pressure right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Pressure left, Pressure right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Pressure left, Pressure right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Pressure left, Pressure right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Pressure left, Pressure right) { return !(left == right); } @@ -1069,37 +1069,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Pressu public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Pressure objPressure)) throw new ArgumentException("Expected type Pressure.", nameof(obj)); + if(!(obj is Pressure objPressure)) throw new ArgumentException("Expected type Pressure.", nameof(obj)); return CompareTo(objPressure); } /// - public int CompareTo(Pressure other) + public int CompareTo(Pressure other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Pressure objPressure)) + if(obj is null || !(obj is Pressure objPressure)) return false; return Equals(objPressure); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Pressure other) + /// Consider using for safely comparing floating point values. + public bool Equals(Pressure other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Pressure within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -1137,7 +1137,7 @@ public bool Equals(Pressure other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Pressure other, double tolerance, ComparisonType comparisonType) + public bool Equals(Pressure other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -1151,7 +1151,7 @@ public bool Equals(Pressure other, double tolerance, ComparisonType comparisonTy /// /// Returns the hash code for this instance. /// - /// A hash code for the current Pressure. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -1199,13 +1199,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Pressure to another Pressure with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Pressure with the specified unit. - public Pressure ToUnit(PressureUnit unit) + /// A with the specified unit. + public Pressure ToUnit(PressureUnit unit) { var convertedValue = GetValueAs(unit); - return new Pressure(convertedValue, unit); + return new Pressure(convertedValue, unit); } /// @@ -1218,7 +1218,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Pressure ToUnit(UnitSystem unitSystem) + public Pressure ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1302,10 +1302,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Pressure ToBaseUnit() + internal Pressure ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Pressure(baseUnitValue, BaseUnit); + return new Pressure(baseUnitValue, BaseUnit); } private double GetValueAs(PressureUnit unit) @@ -1455,7 +1455,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Pressure)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Pressure)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1465,12 +1465,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Pressure)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Pressure)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Pressure)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Pressure)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1515,16 +1515,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Pressure)) + if(conversionType == typeof(Pressure)) return this; else if(conversionType == typeof(PressureUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Pressure.QuantityType; + return Pressure.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Pressure.BaseDimensions; + return Pressure.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Pressure)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Pressure)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs index d141c4dd0a..a104c13816 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Pressure change rate is the ratio of the pressure change to the time during which the change occurred (value of pressure changes per unit time). /// - public partial struct PressureChangeRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct PressureChangeRate : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -106,19 +106,19 @@ public PressureChangeRate(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of PressureChangeRate, which is PascalPerSecond. All conversions go via this value. + /// The base unit of , which is PascalPerSecond. All conversions go via this value. /// public static PressureChangeRateUnit BaseUnit { get; } = PressureChangeRateUnit.PascalPerSecond; /// - /// Represents the largest possible value of PressureChangeRate + /// Represents the largest possible value of /// - public static PressureChangeRate MaxValue { get; } = new PressureChangeRate(double.MaxValue, BaseUnit); + public static PressureChangeRate MaxValue { get; } = new PressureChangeRate(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of PressureChangeRate + /// Represents the smallest possible value of /// - public static PressureChangeRate MinValue { get; } = new PressureChangeRate(double.MinValue, BaseUnit); + public static PressureChangeRate MinValue { get; } = new PressureChangeRate(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -126,14 +126,14 @@ public PressureChangeRate(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.PressureChangeRate; /// - /// All units of measurement for the PressureChangeRate quantity. + /// All units of measurement for the quantity. /// public static PressureChangeRateUnit[] Units { get; } = Enum.GetValues(typeof(PressureChangeRateUnit)).Cast().Except(new PressureChangeRateUnit[]{ PressureChangeRateUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit PascalPerSecond. /// - public static PressureChangeRate Zero { get; } = new PressureChangeRate(0, BaseUnit); + public static PressureChangeRate Zero { get; } = new PressureChangeRate(0, BaseUnit); #endregion @@ -158,49 +158,49 @@ public PressureChangeRate(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => PressureChangeRate.QuantityType; + public QuantityType Type => PressureChangeRate.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => PressureChangeRate.BaseDimensions; + public BaseDimensions Dimensions => PressureChangeRate.BaseDimensions; #endregion #region Conversion Properties /// - /// Get PressureChangeRate in AtmospheresPerSecond. + /// Get in AtmospheresPerSecond. /// public double AtmospheresPerSecond => As(PressureChangeRateUnit.AtmospherePerSecond); /// - /// Get PressureChangeRate in KilopascalsPerMinute. + /// Get in KilopascalsPerMinute. /// public double KilopascalsPerMinute => As(PressureChangeRateUnit.KilopascalPerMinute); /// - /// Get PressureChangeRate in KilopascalsPerSecond. + /// Get in KilopascalsPerSecond. /// public double KilopascalsPerSecond => As(PressureChangeRateUnit.KilopascalPerSecond); /// - /// Get PressureChangeRate in MegapascalsPerMinute. + /// Get in MegapascalsPerMinute. /// public double MegapascalsPerMinute => As(PressureChangeRateUnit.MegapascalPerMinute); /// - /// Get PressureChangeRate in MegapascalsPerSecond. + /// Get in MegapascalsPerSecond. /// public double MegapascalsPerSecond => As(PressureChangeRateUnit.MegapascalPerSecond); /// - /// Get PressureChangeRate in PascalsPerMinute. + /// Get in PascalsPerMinute. /// public double PascalsPerMinute => As(PressureChangeRateUnit.PascalPerMinute); /// - /// Get PressureChangeRate in PascalsPerSecond. + /// Get in PascalsPerSecond. /// public double PascalsPerSecond => As(PressureChangeRateUnit.PascalPerSecond); @@ -234,78 +234,78 @@ public static string GetAbbreviation(PressureChangeRateUnit unit, [CanBeNull] IF #region Static Factory Methods /// - /// Get PressureChangeRate from AtmospheresPerSecond. + /// Get from AtmospheresPerSecond. /// /// If value is NaN or Infinity. - public static PressureChangeRate FromAtmospheresPerSecond(QuantityValue atmospherespersecond) + public static PressureChangeRate FromAtmospheresPerSecond(QuantityValue atmospherespersecond) { double value = (double) atmospherespersecond; - return new PressureChangeRate(value, PressureChangeRateUnit.AtmospherePerSecond); + return new PressureChangeRate(value, PressureChangeRateUnit.AtmospherePerSecond); } /// - /// Get PressureChangeRate from KilopascalsPerMinute. + /// Get from KilopascalsPerMinute. /// /// If value is NaN or Infinity. - public static PressureChangeRate FromKilopascalsPerMinute(QuantityValue kilopascalsperminute) + public static PressureChangeRate FromKilopascalsPerMinute(QuantityValue kilopascalsperminute) { double value = (double) kilopascalsperminute; - return new PressureChangeRate(value, PressureChangeRateUnit.KilopascalPerMinute); + return new PressureChangeRate(value, PressureChangeRateUnit.KilopascalPerMinute); } /// - /// Get PressureChangeRate from KilopascalsPerSecond. + /// Get from KilopascalsPerSecond. /// /// If value is NaN or Infinity. - public static PressureChangeRate FromKilopascalsPerSecond(QuantityValue kilopascalspersecond) + public static PressureChangeRate FromKilopascalsPerSecond(QuantityValue kilopascalspersecond) { double value = (double) kilopascalspersecond; - return new PressureChangeRate(value, PressureChangeRateUnit.KilopascalPerSecond); + return new PressureChangeRate(value, PressureChangeRateUnit.KilopascalPerSecond); } /// - /// Get PressureChangeRate from MegapascalsPerMinute. + /// Get from MegapascalsPerMinute. /// /// If value is NaN or Infinity. - public static PressureChangeRate FromMegapascalsPerMinute(QuantityValue megapascalsperminute) + public static PressureChangeRate FromMegapascalsPerMinute(QuantityValue megapascalsperminute) { double value = (double) megapascalsperminute; - return new PressureChangeRate(value, PressureChangeRateUnit.MegapascalPerMinute); + return new PressureChangeRate(value, PressureChangeRateUnit.MegapascalPerMinute); } /// - /// Get PressureChangeRate from MegapascalsPerSecond. + /// Get from MegapascalsPerSecond. /// /// If value is NaN or Infinity. - public static PressureChangeRate FromMegapascalsPerSecond(QuantityValue megapascalspersecond) + public static PressureChangeRate FromMegapascalsPerSecond(QuantityValue megapascalspersecond) { double value = (double) megapascalspersecond; - return new PressureChangeRate(value, PressureChangeRateUnit.MegapascalPerSecond); + return new PressureChangeRate(value, PressureChangeRateUnit.MegapascalPerSecond); } /// - /// Get PressureChangeRate from PascalsPerMinute. + /// Get from PascalsPerMinute. /// /// If value is NaN or Infinity. - public static PressureChangeRate FromPascalsPerMinute(QuantityValue pascalsperminute) + public static PressureChangeRate FromPascalsPerMinute(QuantityValue pascalsperminute) { double value = (double) pascalsperminute; - return new PressureChangeRate(value, PressureChangeRateUnit.PascalPerMinute); + return new PressureChangeRate(value, PressureChangeRateUnit.PascalPerMinute); } /// - /// Get PressureChangeRate from PascalsPerSecond. + /// Get from PascalsPerSecond. /// /// If value is NaN or Infinity. - public static PressureChangeRate FromPascalsPerSecond(QuantityValue pascalspersecond) + public static PressureChangeRate FromPascalsPerSecond(QuantityValue pascalspersecond) { double value = (double) pascalspersecond; - return new PressureChangeRate(value, PressureChangeRateUnit.PascalPerSecond); + return new PressureChangeRate(value, PressureChangeRateUnit.PascalPerSecond); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// PressureChangeRate unit value. - public static PressureChangeRate From(QuantityValue value, PressureChangeRateUnit fromUnit) + /// unit value. + public static PressureChangeRate From(QuantityValue value, PressureChangeRateUnit fromUnit) { - return new PressureChangeRate((double)value, fromUnit); + return new PressureChangeRate((double)value, fromUnit); } #endregion @@ -334,7 +334,7 @@ public static PressureChangeRate From(QuantityValue value, PressureChangeRateUni /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static PressureChangeRate Parse(string str) + public static PressureChangeRate Parse(string str) { return Parse(str, null); } @@ -362,9 +362,9 @@ public static PressureChangeRate Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static PressureChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) + public static PressureChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, PressureChangeRateUnit>( str, provider, From); @@ -378,7 +378,7 @@ public static PressureChangeRate Parse(string str, [CanBeNull] IFormatProvider p /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out PressureChangeRate result) + public static bool TryParse([CanBeNull] string str, out PressureChangeRate result) { return TryParse(str, null, out result); } @@ -393,9 +393,9 @@ public static bool TryParse([CanBeNull] string str, out PressureChangeRate resul /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PressureChangeRate result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PressureChangeRate result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, PressureChangeRateUnit>( str, provider, From, @@ -457,43 +457,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Pressu #region Arithmetic Operators /// Negate the value. - public static PressureChangeRate operator -(PressureChangeRate right) + public static PressureChangeRate operator -(PressureChangeRate right) { - return new PressureChangeRate(-right.Value, right.Unit); + return new PressureChangeRate(-right.Value, right.Unit); } - /// Get from adding two . - public static PressureChangeRate operator +(PressureChangeRate left, PressureChangeRate right) + /// Get from adding two . + public static PressureChangeRate operator +(PressureChangeRate left, PressureChangeRate right) { - return new PressureChangeRate(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new PressureChangeRate(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static PressureChangeRate operator -(PressureChangeRate left, PressureChangeRate right) + /// Get from subtracting two . + public static PressureChangeRate operator -(PressureChangeRate left, PressureChangeRate right) { - return new PressureChangeRate(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new PressureChangeRate(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static PressureChangeRate operator *(double left, PressureChangeRate right) + /// Get from multiplying value and . + public static PressureChangeRate operator *(double left, PressureChangeRate right) { - return new PressureChangeRate(left * right.Value, right.Unit); + return new PressureChangeRate(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static PressureChangeRate operator *(PressureChangeRate left, double right) + /// Get from multiplying value and . + public static PressureChangeRate operator *(PressureChangeRate left, double right) { - return new PressureChangeRate(left.Value * right, left.Unit); + return new PressureChangeRate(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static PressureChangeRate operator /(PressureChangeRate left, double right) + /// Get from dividing by value. + public static PressureChangeRate operator /(PressureChangeRate left, double right) { - return new PressureChangeRate(left.Value / right, left.Unit); + return new PressureChangeRate(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(PressureChangeRate left, PressureChangeRate right) + /// Get ratio value from dividing by . + public static double operator /(PressureChangeRate left, PressureChangeRate right) { return left.PascalsPerSecond / right.PascalsPerSecond; } @@ -503,39 +503,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Pressu #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(PressureChangeRate left, PressureChangeRate right) + public static bool operator <=(PressureChangeRate left, PressureChangeRate right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(PressureChangeRate left, PressureChangeRate right) + public static bool operator >=(PressureChangeRate left, PressureChangeRate right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(PressureChangeRate left, PressureChangeRate right) + public static bool operator <(PressureChangeRate left, PressureChangeRate right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(PressureChangeRate left, PressureChangeRate right) + public static bool operator >(PressureChangeRate left, PressureChangeRate right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(PressureChangeRate left, PressureChangeRate right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(PressureChangeRate left, PressureChangeRate right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(PressureChangeRate left, PressureChangeRate right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(PressureChangeRate left, PressureChangeRate right) { return !(left == right); } @@ -544,37 +544,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Pressu public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PressureChangeRate objPressureChangeRate)) throw new ArgumentException("Expected type PressureChangeRate.", nameof(obj)); + if(!(obj is PressureChangeRate objPressureChangeRate)) throw new ArgumentException("Expected type PressureChangeRate.", nameof(obj)); return CompareTo(objPressureChangeRate); } /// - public int CompareTo(PressureChangeRate other) + public int CompareTo(PressureChangeRate other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is PressureChangeRate objPressureChangeRate)) + if(obj is null || !(obj is PressureChangeRate objPressureChangeRate)) return false; return Equals(objPressureChangeRate); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(PressureChangeRate other) + /// Consider using for safely comparing floating point values. + public bool Equals(PressureChangeRate other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another PressureChangeRate within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -612,7 +612,7 @@ public bool Equals(PressureChangeRate other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(PressureChangeRate other, double tolerance, ComparisonType comparisonType) + public bool Equals(PressureChangeRate other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -626,7 +626,7 @@ public bool Equals(PressureChangeRate other, double tolerance, ComparisonType co /// /// Returns the hash code for this instance. /// - /// A hash code for the current PressureChangeRate. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -674,13 +674,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this PressureChangeRate to another PressureChangeRate with the unit representation . + /// Converts this to another with the unit representation . /// - /// A PressureChangeRate with the specified unit. - public PressureChangeRate ToUnit(PressureChangeRateUnit unit) + /// A with the specified unit. + public PressureChangeRate ToUnit(PressureChangeRateUnit unit) { var convertedValue = GetValueAs(unit); - return new PressureChangeRate(convertedValue, unit); + return new PressureChangeRate(convertedValue, unit); } /// @@ -693,7 +693,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public PressureChangeRate ToUnit(UnitSystem unitSystem) + public PressureChangeRate ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -742,10 +742,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal PressureChangeRate ToBaseUnit() + internal PressureChangeRate ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new PressureChangeRate(baseUnitValue, BaseUnit); + return new PressureChangeRate(baseUnitValue, BaseUnit); } private double GetValueAs(PressureChangeRateUnit unit) @@ -860,7 +860,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -870,12 +870,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -920,16 +920,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(PressureChangeRate)) + if(conversionType == typeof(PressureChangeRate)) return this; else if(conversionType == typeof(PressureChangeRateUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return PressureChangeRate.QuantityType; + return PressureChangeRate.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return PressureChangeRate.BaseDimensions; + return PressureChangeRate.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs index 8f950a9b2c..34366b1d1b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// In mathematics, a ratio is a relationship between two numbers of the same kind (e.g., objects, persons, students, spoonfuls, units of whatever identical dimension), usually expressed as "a to b" or a:b, sometimes expressed arithmetically as a dimensionless quotient of the two that explicitly indicates how many times the first number contains the second (not necessarily an integer). /// - public partial struct Ratio : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Ratio : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -105,19 +105,19 @@ public Ratio(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Ratio, which is DecimalFraction. All conversions go via this value. + /// The base unit of , which is DecimalFraction. All conversions go via this value. /// public static RatioUnit BaseUnit { get; } = RatioUnit.DecimalFraction; /// - /// Represents the largest possible value of Ratio + /// Represents the largest possible value of /// - public static Ratio MaxValue { get; } = new Ratio(double.MaxValue, BaseUnit); + public static Ratio MaxValue { get; } = new Ratio(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Ratio + /// Represents the smallest possible value of /// - public static Ratio MinValue { get; } = new Ratio(double.MinValue, BaseUnit); + public static Ratio MinValue { get; } = new Ratio(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -125,14 +125,14 @@ public Ratio(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Ratio; /// - /// All units of measurement for the Ratio quantity. + /// All units of measurement for the quantity. /// public static RatioUnit[] Units { get; } = Enum.GetValues(typeof(RatioUnit)).Cast().Except(new RatioUnit[]{ RatioUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit DecimalFraction. /// - public static Ratio Zero { get; } = new Ratio(0, BaseUnit); + public static Ratio Zero { get; } = new Ratio(0, BaseUnit); #endregion @@ -157,44 +157,44 @@ public Ratio(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Ratio.QuantityType; + public QuantityType Type => Ratio.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Ratio.BaseDimensions; + public BaseDimensions Dimensions => Ratio.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Ratio in DecimalFractions. + /// Get in DecimalFractions. /// public double DecimalFractions => As(RatioUnit.DecimalFraction); /// - /// Get Ratio in PartsPerBillion. + /// Get in PartsPerBillion. /// public double PartsPerBillion => As(RatioUnit.PartPerBillion); /// - /// Get Ratio in PartsPerMillion. + /// Get in PartsPerMillion. /// public double PartsPerMillion => As(RatioUnit.PartPerMillion); /// - /// Get Ratio in PartsPerThousand. + /// Get in PartsPerThousand. /// public double PartsPerThousand => As(RatioUnit.PartPerThousand); /// - /// Get Ratio in PartsPerTrillion. + /// Get in PartsPerTrillion. /// public double PartsPerTrillion => As(RatioUnit.PartPerTrillion); /// - /// Get Ratio in Percent. + /// Get in Percent. /// public double Percent => As(RatioUnit.Percent); @@ -228,69 +228,69 @@ public static string GetAbbreviation(RatioUnit unit, [CanBeNull] IFormatProvider #region Static Factory Methods /// - /// Get Ratio from DecimalFractions. + /// Get from DecimalFractions. /// /// If value is NaN or Infinity. - public static Ratio FromDecimalFractions(QuantityValue decimalfractions) + public static Ratio FromDecimalFractions(QuantityValue decimalfractions) { double value = (double) decimalfractions; - return new Ratio(value, RatioUnit.DecimalFraction); + return new Ratio(value, RatioUnit.DecimalFraction); } /// - /// Get Ratio from PartsPerBillion. + /// Get from PartsPerBillion. /// /// If value is NaN or Infinity. - public static Ratio FromPartsPerBillion(QuantityValue partsperbillion) + public static Ratio FromPartsPerBillion(QuantityValue partsperbillion) { double value = (double) partsperbillion; - return new Ratio(value, RatioUnit.PartPerBillion); + return new Ratio(value, RatioUnit.PartPerBillion); } /// - /// Get Ratio from PartsPerMillion. + /// Get from PartsPerMillion. /// /// If value is NaN or Infinity. - public static Ratio FromPartsPerMillion(QuantityValue partspermillion) + public static Ratio FromPartsPerMillion(QuantityValue partspermillion) { double value = (double) partspermillion; - return new Ratio(value, RatioUnit.PartPerMillion); + return new Ratio(value, RatioUnit.PartPerMillion); } /// - /// Get Ratio from PartsPerThousand. + /// Get from PartsPerThousand. /// /// If value is NaN or Infinity. - public static Ratio FromPartsPerThousand(QuantityValue partsperthousand) + public static Ratio FromPartsPerThousand(QuantityValue partsperthousand) { double value = (double) partsperthousand; - return new Ratio(value, RatioUnit.PartPerThousand); + return new Ratio(value, RatioUnit.PartPerThousand); } /// - /// Get Ratio from PartsPerTrillion. + /// Get from PartsPerTrillion. /// /// If value is NaN or Infinity. - public static Ratio FromPartsPerTrillion(QuantityValue partspertrillion) + public static Ratio FromPartsPerTrillion(QuantityValue partspertrillion) { double value = (double) partspertrillion; - return new Ratio(value, RatioUnit.PartPerTrillion); + return new Ratio(value, RatioUnit.PartPerTrillion); } /// - /// Get Ratio from Percent. + /// Get from Percent. /// /// If value is NaN or Infinity. - public static Ratio FromPercent(QuantityValue percent) + public static Ratio FromPercent(QuantityValue percent) { double value = (double) percent; - return new Ratio(value, RatioUnit.Percent); + return new Ratio(value, RatioUnit.Percent); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Ratio unit value. - public static Ratio From(QuantityValue value, RatioUnit fromUnit) + /// unit value. + public static Ratio From(QuantityValue value, RatioUnit fromUnit) { - return new Ratio((double)value, fromUnit); + return new Ratio((double)value, fromUnit); } #endregion @@ -319,7 +319,7 @@ public static Ratio From(QuantityValue value, RatioUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Ratio Parse(string str) + public static Ratio Parse(string str) { return Parse(str, null); } @@ -347,9 +347,9 @@ public static Ratio Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Ratio Parse(string str, [CanBeNull] IFormatProvider provider) + public static Ratio Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, RatioUnit>( str, provider, From); @@ -363,7 +363,7 @@ public static Ratio Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Ratio result) + public static bool TryParse([CanBeNull] string str, out Ratio result) { return TryParse(str, null, out result); } @@ -378,9 +378,9 @@ public static bool TryParse([CanBeNull] string str, out Ratio result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Ratio result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Ratio result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, RatioUnit>( str, provider, From, @@ -442,43 +442,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out RatioU #region Arithmetic Operators /// Negate the value. - public static Ratio operator -(Ratio right) + public static Ratio operator -(Ratio right) { - return new Ratio(-right.Value, right.Unit); + return new Ratio(-right.Value, right.Unit); } - /// Get from adding two . - public static Ratio operator +(Ratio left, Ratio right) + /// Get from adding two . + public static Ratio operator +(Ratio left, Ratio right) { - return new Ratio(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Ratio(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Ratio operator -(Ratio left, Ratio right) + /// Get from subtracting two . + public static Ratio operator -(Ratio left, Ratio right) { - return new Ratio(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Ratio(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Ratio operator *(double left, Ratio right) + /// Get from multiplying value and . + public static Ratio operator *(double left, Ratio right) { - return new Ratio(left * right.Value, right.Unit); + return new Ratio(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Ratio operator *(Ratio left, double right) + /// Get from multiplying value and . + public static Ratio operator *(Ratio left, double right) { - return new Ratio(left.Value * right, left.Unit); + return new Ratio(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Ratio operator /(Ratio left, double right) + /// Get from dividing by value. + public static Ratio operator /(Ratio left, double right) { - return new Ratio(left.Value / right, left.Unit); + return new Ratio(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Ratio left, Ratio right) + /// Get ratio value from dividing by . + public static double operator /(Ratio left, Ratio right) { return left.DecimalFractions / right.DecimalFractions; } @@ -488,39 +488,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out RatioU #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Ratio left, Ratio right) + public static bool operator <=(Ratio left, Ratio right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Ratio left, Ratio right) + public static bool operator >=(Ratio left, Ratio right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Ratio left, Ratio right) + public static bool operator <(Ratio left, Ratio right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Ratio left, Ratio right) + public static bool operator >(Ratio left, Ratio right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Ratio left, Ratio right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Ratio left, Ratio right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Ratio left, Ratio right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Ratio left, Ratio right) { return !(left == right); } @@ -529,37 +529,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out RatioU public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Ratio objRatio)) throw new ArgumentException("Expected type Ratio.", nameof(obj)); + if(!(obj is Ratio objRatio)) throw new ArgumentException("Expected type Ratio.", nameof(obj)); return CompareTo(objRatio); } /// - public int CompareTo(Ratio other) + public int CompareTo(Ratio other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Ratio objRatio)) + if(obj is null || !(obj is Ratio objRatio)) return false; return Equals(objRatio); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Ratio other) + /// Consider using for safely comparing floating point values. + public bool Equals(Ratio other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Ratio within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -597,7 +597,7 @@ public bool Equals(Ratio other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Ratio other, double tolerance, ComparisonType comparisonType) + public bool Equals(Ratio other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -611,7 +611,7 @@ public bool Equals(Ratio other, double tolerance, ComparisonType comparisonType) /// /// Returns the hash code for this instance. /// - /// A hash code for the current Ratio. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -659,13 +659,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Ratio to another Ratio with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Ratio with the specified unit. - public Ratio ToUnit(RatioUnit unit) + /// A with the specified unit. + public Ratio ToUnit(RatioUnit unit) { var convertedValue = GetValueAs(unit); - return new Ratio(convertedValue, unit); + return new Ratio(convertedValue, unit); } /// @@ -678,7 +678,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Ratio ToUnit(UnitSystem unitSystem) + public Ratio ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -726,10 +726,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Ratio ToBaseUnit() + internal Ratio ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Ratio(baseUnitValue, BaseUnit); + return new Ratio(baseUnitValue, BaseUnit); } private double GetValueAs(RatioUnit unit) @@ -843,7 +843,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Ratio)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Ratio)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -853,12 +853,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Ratio)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Ratio)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Ratio)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Ratio)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -903,16 +903,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Ratio)) + if(conversionType == typeof(Ratio)) return this; else if(conversionType == typeof(RatioUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Ratio.QuantityType; + return Ratio.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Ratio.BaseDimensions; + return Ratio.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Ratio)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Ratio)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs index 1659c660f9..c156bb9783 100644 --- a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// The change in ratio per unit of time. /// - public partial struct RatioChangeRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct RatioChangeRate : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -101,19 +101,19 @@ public RatioChangeRate(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of RatioChangeRate, which is DecimalFractionPerSecond. All conversions go via this value. + /// The base unit of , which is DecimalFractionPerSecond. All conversions go via this value. /// public static RatioChangeRateUnit BaseUnit { get; } = RatioChangeRateUnit.DecimalFractionPerSecond; /// - /// Represents the largest possible value of RatioChangeRate + /// Represents the largest possible value of /// - public static RatioChangeRate MaxValue { get; } = new RatioChangeRate(double.MaxValue, BaseUnit); + public static RatioChangeRate MaxValue { get; } = new RatioChangeRate(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of RatioChangeRate + /// Represents the smallest possible value of /// - public static RatioChangeRate MinValue { get; } = new RatioChangeRate(double.MinValue, BaseUnit); + public static RatioChangeRate MinValue { get; } = new RatioChangeRate(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -121,14 +121,14 @@ public RatioChangeRate(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.RatioChangeRate; /// - /// All units of measurement for the RatioChangeRate quantity. + /// All units of measurement for the quantity. /// public static RatioChangeRateUnit[] Units { get; } = Enum.GetValues(typeof(RatioChangeRateUnit)).Cast().Except(new RatioChangeRateUnit[]{ RatioChangeRateUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit DecimalFractionPerSecond. /// - public static RatioChangeRate Zero { get; } = new RatioChangeRate(0, BaseUnit); + public static RatioChangeRate Zero { get; } = new RatioChangeRate(0, BaseUnit); #endregion @@ -153,24 +153,24 @@ public RatioChangeRate(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => RatioChangeRate.QuantityType; + public QuantityType Type => RatioChangeRate.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => RatioChangeRate.BaseDimensions; + public BaseDimensions Dimensions => RatioChangeRate.BaseDimensions; #endregion #region Conversion Properties /// - /// Get RatioChangeRate in DecimalFractionsPerSecond. + /// Get in DecimalFractionsPerSecond. /// public double DecimalFractionsPerSecond => As(RatioChangeRateUnit.DecimalFractionPerSecond); /// - /// Get RatioChangeRate in PercentsPerSecond. + /// Get in PercentsPerSecond. /// public double PercentsPerSecond => As(RatioChangeRateUnit.PercentPerSecond); @@ -204,33 +204,33 @@ public static string GetAbbreviation(RatioChangeRateUnit unit, [CanBeNull] IForm #region Static Factory Methods /// - /// Get RatioChangeRate from DecimalFractionsPerSecond. + /// Get from DecimalFractionsPerSecond. /// /// If value is NaN or Infinity. - public static RatioChangeRate FromDecimalFractionsPerSecond(QuantityValue decimalfractionspersecond) + public static RatioChangeRate FromDecimalFractionsPerSecond(QuantityValue decimalfractionspersecond) { double value = (double) decimalfractionspersecond; - return new RatioChangeRate(value, RatioChangeRateUnit.DecimalFractionPerSecond); + return new RatioChangeRate(value, RatioChangeRateUnit.DecimalFractionPerSecond); } /// - /// Get RatioChangeRate from PercentsPerSecond. + /// Get from PercentsPerSecond. /// /// If value is NaN or Infinity. - public static RatioChangeRate FromPercentsPerSecond(QuantityValue percentspersecond) + public static RatioChangeRate FromPercentsPerSecond(QuantityValue percentspersecond) { double value = (double) percentspersecond; - return new RatioChangeRate(value, RatioChangeRateUnit.PercentPerSecond); + return new RatioChangeRate(value, RatioChangeRateUnit.PercentPerSecond); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// RatioChangeRate unit value. - public static RatioChangeRate From(QuantityValue value, RatioChangeRateUnit fromUnit) + /// unit value. + public static RatioChangeRate From(QuantityValue value, RatioChangeRateUnit fromUnit) { - return new RatioChangeRate((double)value, fromUnit); + return new RatioChangeRate((double)value, fromUnit); } #endregion @@ -259,7 +259,7 @@ public static RatioChangeRate From(QuantityValue value, RatioChangeRateUnit from /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static RatioChangeRate Parse(string str) + public static RatioChangeRate Parse(string str) { return Parse(str, null); } @@ -287,9 +287,9 @@ public static RatioChangeRate Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static RatioChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) + public static RatioChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, RatioChangeRateUnit>( str, provider, From); @@ -303,7 +303,7 @@ public static RatioChangeRate Parse(string str, [CanBeNull] IFormatProvider prov /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out RatioChangeRate result) + public static bool TryParse([CanBeNull] string str, out RatioChangeRate result) { return TryParse(str, null, out result); } @@ -318,9 +318,9 @@ public static bool TryParse([CanBeNull] string str, out RatioChangeRate result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RatioChangeRate result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RatioChangeRate result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, RatioChangeRateUnit>( str, provider, From, @@ -382,43 +382,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out RatioC #region Arithmetic Operators /// Negate the value. - public static RatioChangeRate operator -(RatioChangeRate right) + public static RatioChangeRate operator -(RatioChangeRate right) { - return new RatioChangeRate(-right.Value, right.Unit); + return new RatioChangeRate(-right.Value, right.Unit); } - /// Get from adding two . - public static RatioChangeRate operator +(RatioChangeRate left, RatioChangeRate right) + /// Get from adding two . + public static RatioChangeRate operator +(RatioChangeRate left, RatioChangeRate right) { - return new RatioChangeRate(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new RatioChangeRate(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static RatioChangeRate operator -(RatioChangeRate left, RatioChangeRate right) + /// Get from subtracting two . + public static RatioChangeRate operator -(RatioChangeRate left, RatioChangeRate right) { - return new RatioChangeRate(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new RatioChangeRate(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static RatioChangeRate operator *(double left, RatioChangeRate right) + /// Get from multiplying value and . + public static RatioChangeRate operator *(double left, RatioChangeRate right) { - return new RatioChangeRate(left * right.Value, right.Unit); + return new RatioChangeRate(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static RatioChangeRate operator *(RatioChangeRate left, double right) + /// Get from multiplying value and . + public static RatioChangeRate operator *(RatioChangeRate left, double right) { - return new RatioChangeRate(left.Value * right, left.Unit); + return new RatioChangeRate(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static RatioChangeRate operator /(RatioChangeRate left, double right) + /// Get from dividing by value. + public static RatioChangeRate operator /(RatioChangeRate left, double right) { - return new RatioChangeRate(left.Value / right, left.Unit); + return new RatioChangeRate(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(RatioChangeRate left, RatioChangeRate right) + /// Get ratio value from dividing by . + public static double operator /(RatioChangeRate left, RatioChangeRate right) { return left.DecimalFractionsPerSecond / right.DecimalFractionsPerSecond; } @@ -428,39 +428,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out RatioC #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(RatioChangeRate left, RatioChangeRate right) + public static bool operator <=(RatioChangeRate left, RatioChangeRate right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(RatioChangeRate left, RatioChangeRate right) + public static bool operator >=(RatioChangeRate left, RatioChangeRate right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(RatioChangeRate left, RatioChangeRate right) + public static bool operator <(RatioChangeRate left, RatioChangeRate right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(RatioChangeRate left, RatioChangeRate right) + public static bool operator >(RatioChangeRate left, RatioChangeRate right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(RatioChangeRate left, RatioChangeRate right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(RatioChangeRate left, RatioChangeRate right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(RatioChangeRate left, RatioChangeRate right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(RatioChangeRate left, RatioChangeRate right) { return !(left == right); } @@ -469,37 +469,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out RatioC public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RatioChangeRate objRatioChangeRate)) throw new ArgumentException("Expected type RatioChangeRate.", nameof(obj)); + if(!(obj is RatioChangeRate objRatioChangeRate)) throw new ArgumentException("Expected type RatioChangeRate.", nameof(obj)); return CompareTo(objRatioChangeRate); } /// - public int CompareTo(RatioChangeRate other) + public int CompareTo(RatioChangeRate other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is RatioChangeRate objRatioChangeRate)) + if(obj is null || !(obj is RatioChangeRate objRatioChangeRate)) return false; return Equals(objRatioChangeRate); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(RatioChangeRate other) + /// Consider using for safely comparing floating point values. + public bool Equals(RatioChangeRate other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another RatioChangeRate within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -537,7 +537,7 @@ public bool Equals(RatioChangeRate other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(RatioChangeRate other, double tolerance, ComparisonType comparisonType) + public bool Equals(RatioChangeRate other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -551,7 +551,7 @@ public bool Equals(RatioChangeRate other, double tolerance, ComparisonType compa /// /// Returns the hash code for this instance. /// - /// A hash code for the current RatioChangeRate. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -599,13 +599,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this RatioChangeRate to another RatioChangeRate with the unit representation . + /// Converts this to another with the unit representation . /// - /// A RatioChangeRate with the specified unit. - public RatioChangeRate ToUnit(RatioChangeRateUnit unit) + /// A with the specified unit. + public RatioChangeRate ToUnit(RatioChangeRateUnit unit) { var convertedValue = GetValueAs(unit); - return new RatioChangeRate(convertedValue, unit); + return new RatioChangeRate(convertedValue, unit); } /// @@ -618,7 +618,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public RatioChangeRate ToUnit(UnitSystem unitSystem) + public RatioChangeRate ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -662,10 +662,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal RatioChangeRate ToBaseUnit() + internal RatioChangeRate ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new RatioChangeRate(baseUnitValue, BaseUnit); + return new RatioChangeRate(baseUnitValue, BaseUnit); } private double GetValueAs(RatioChangeRateUnit unit) @@ -775,7 +775,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(RatioChangeRate)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(RatioChangeRate)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -785,12 +785,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(RatioChangeRate)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(RatioChangeRate)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(RatioChangeRate)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(RatioChangeRate)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -835,16 +835,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(RatioChangeRate)) + if(conversionType == typeof(RatioChangeRate)) return this; else if(conversionType == typeof(RatioChangeRateUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return RatioChangeRate.QuantityType; + return RatioChangeRate.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return RatioChangeRate.BaseDimensions; + return RatioChangeRate.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(RatioChangeRate)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(RatioChangeRate)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs index 1fb9e9125d..8dcedd73b1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// The Volt-ampere reactive hour (expressed as varh) is the reactive power of one Volt-ampere reactive produced in one hour. /// - public partial struct ReactiveEnergy : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ReactiveEnergy : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -102,19 +102,19 @@ public ReactiveEnergy(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ReactiveEnergy, which is VoltampereReactiveHour. All conversions go via this value. + /// The base unit of , which is VoltampereReactiveHour. All conversions go via this value. /// public static ReactiveEnergyUnit BaseUnit { get; } = ReactiveEnergyUnit.VoltampereReactiveHour; /// - /// Represents the largest possible value of ReactiveEnergy + /// Represents the largest possible value of /// - public static ReactiveEnergy MaxValue { get; } = new ReactiveEnergy(double.MaxValue, BaseUnit); + public static ReactiveEnergy MaxValue { get; } = new ReactiveEnergy(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ReactiveEnergy + /// Represents the smallest possible value of /// - public static ReactiveEnergy MinValue { get; } = new ReactiveEnergy(double.MinValue, BaseUnit); + public static ReactiveEnergy MinValue { get; } = new ReactiveEnergy(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -122,14 +122,14 @@ public ReactiveEnergy(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ReactiveEnergy; /// - /// All units of measurement for the ReactiveEnergy quantity. + /// All units of measurement for the quantity. /// public static ReactiveEnergyUnit[] Units { get; } = Enum.GetValues(typeof(ReactiveEnergyUnit)).Cast().Except(new ReactiveEnergyUnit[]{ ReactiveEnergyUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereReactiveHour. /// - public static ReactiveEnergy Zero { get; } = new ReactiveEnergy(0, BaseUnit); + public static ReactiveEnergy Zero { get; } = new ReactiveEnergy(0, BaseUnit); #endregion @@ -154,29 +154,29 @@ public ReactiveEnergy(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ReactiveEnergy.QuantityType; + public QuantityType Type => ReactiveEnergy.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ReactiveEnergy.BaseDimensions; + public BaseDimensions Dimensions => ReactiveEnergy.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ReactiveEnergy in KilovoltampereReactiveHours. + /// Get in KilovoltampereReactiveHours. /// public double KilovoltampereReactiveHours => As(ReactiveEnergyUnit.KilovoltampereReactiveHour); /// - /// Get ReactiveEnergy in MegavoltampereReactiveHours. + /// Get in MegavoltampereReactiveHours. /// public double MegavoltampereReactiveHours => As(ReactiveEnergyUnit.MegavoltampereReactiveHour); /// - /// Get ReactiveEnergy in VoltampereReactiveHours. + /// Get in VoltampereReactiveHours. /// public double VoltampereReactiveHours => As(ReactiveEnergyUnit.VoltampereReactiveHour); @@ -210,42 +210,42 @@ public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] IForma #region Static Factory Methods /// - /// Get ReactiveEnergy from KilovoltampereReactiveHours. + /// Get from KilovoltampereReactiveHours. /// /// If value is NaN or Infinity. - public static ReactiveEnergy FromKilovoltampereReactiveHours(QuantityValue kilovoltamperereactivehours) + public static ReactiveEnergy FromKilovoltampereReactiveHours(QuantityValue kilovoltamperereactivehours) { double value = (double) kilovoltamperereactivehours; - return new ReactiveEnergy(value, ReactiveEnergyUnit.KilovoltampereReactiveHour); + return new ReactiveEnergy(value, ReactiveEnergyUnit.KilovoltampereReactiveHour); } /// - /// Get ReactiveEnergy from MegavoltampereReactiveHours. + /// Get from MegavoltampereReactiveHours. /// /// If value is NaN or Infinity. - public static ReactiveEnergy FromMegavoltampereReactiveHours(QuantityValue megavoltamperereactivehours) + public static ReactiveEnergy FromMegavoltampereReactiveHours(QuantityValue megavoltamperereactivehours) { double value = (double) megavoltamperereactivehours; - return new ReactiveEnergy(value, ReactiveEnergyUnit.MegavoltampereReactiveHour); + return new ReactiveEnergy(value, ReactiveEnergyUnit.MegavoltampereReactiveHour); } /// - /// Get ReactiveEnergy from VoltampereReactiveHours. + /// Get from VoltampereReactiveHours. /// /// If value is NaN or Infinity. - public static ReactiveEnergy FromVoltampereReactiveHours(QuantityValue voltamperereactivehours) + public static ReactiveEnergy FromVoltampereReactiveHours(QuantityValue voltamperereactivehours) { double value = (double) voltamperereactivehours; - return new ReactiveEnergy(value, ReactiveEnergyUnit.VoltampereReactiveHour); + return new ReactiveEnergy(value, ReactiveEnergyUnit.VoltampereReactiveHour); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ReactiveEnergy unit value. - public static ReactiveEnergy From(QuantityValue value, ReactiveEnergyUnit fromUnit) + /// unit value. + public static ReactiveEnergy From(QuantityValue value, ReactiveEnergyUnit fromUnit) { - return new ReactiveEnergy((double)value, fromUnit); + return new ReactiveEnergy((double)value, fromUnit); } #endregion @@ -274,7 +274,7 @@ public static ReactiveEnergy From(QuantityValue value, ReactiveEnergyUnit fromUn /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ReactiveEnergy Parse(string str) + public static ReactiveEnergy Parse(string str) { return Parse(str, null); } @@ -302,9 +302,9 @@ public static ReactiveEnergy Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ReactiveEnergy Parse(string str, [CanBeNull] IFormatProvider provider) + public static ReactiveEnergy Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ReactiveEnergyUnit>( str, provider, From); @@ -318,7 +318,7 @@ public static ReactiveEnergy Parse(string str, [CanBeNull] IFormatProvider provi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ReactiveEnergy result) + public static bool TryParse([CanBeNull] string str, out ReactiveEnergy result) { return TryParse(str, null, out result); } @@ -333,9 +333,9 @@ public static bool TryParse([CanBeNull] string str, out ReactiveEnergy result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactiveEnergy result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactiveEnergy result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ReactiveEnergyUnit>( str, provider, From, @@ -397,43 +397,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Reacti #region Arithmetic Operators /// Negate the value. - public static ReactiveEnergy operator -(ReactiveEnergy right) + public static ReactiveEnergy operator -(ReactiveEnergy right) { - return new ReactiveEnergy(-right.Value, right.Unit); + return new ReactiveEnergy(-right.Value, right.Unit); } - /// Get from adding two . - public static ReactiveEnergy operator +(ReactiveEnergy left, ReactiveEnergy right) + /// Get from adding two . + public static ReactiveEnergy operator +(ReactiveEnergy left, ReactiveEnergy right) { - return new ReactiveEnergy(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ReactiveEnergy(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ReactiveEnergy operator -(ReactiveEnergy left, ReactiveEnergy right) + /// Get from subtracting two . + public static ReactiveEnergy operator -(ReactiveEnergy left, ReactiveEnergy right) { - return new ReactiveEnergy(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ReactiveEnergy(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ReactiveEnergy operator *(double left, ReactiveEnergy right) + /// Get from multiplying value and . + public static ReactiveEnergy operator *(double left, ReactiveEnergy right) { - return new ReactiveEnergy(left * right.Value, right.Unit); + return new ReactiveEnergy(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ReactiveEnergy operator *(ReactiveEnergy left, double right) + /// Get from multiplying value and . + public static ReactiveEnergy operator *(ReactiveEnergy left, double right) { - return new ReactiveEnergy(left.Value * right, left.Unit); + return new ReactiveEnergy(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ReactiveEnergy operator /(ReactiveEnergy left, double right) + /// Get from dividing by value. + public static ReactiveEnergy operator /(ReactiveEnergy left, double right) { - return new ReactiveEnergy(left.Value / right, left.Unit); + return new ReactiveEnergy(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ReactiveEnergy left, ReactiveEnergy right) + /// Get ratio value from dividing by . + public static double operator /(ReactiveEnergy left, ReactiveEnergy right) { return left.VoltampereReactiveHours / right.VoltampereReactiveHours; } @@ -443,39 +443,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Reacti #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ReactiveEnergy left, ReactiveEnergy right) + public static bool operator <=(ReactiveEnergy left, ReactiveEnergy right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ReactiveEnergy left, ReactiveEnergy right) + public static bool operator >=(ReactiveEnergy left, ReactiveEnergy right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ReactiveEnergy left, ReactiveEnergy right) + public static bool operator <(ReactiveEnergy left, ReactiveEnergy right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ReactiveEnergy left, ReactiveEnergy right) + public static bool operator >(ReactiveEnergy left, ReactiveEnergy right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ReactiveEnergy left, ReactiveEnergy right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ReactiveEnergy left, ReactiveEnergy right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ReactiveEnergy left, ReactiveEnergy right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ReactiveEnergy left, ReactiveEnergy right) { return !(left == right); } @@ -484,37 +484,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Reacti public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ReactiveEnergy objReactiveEnergy)) throw new ArgumentException("Expected type ReactiveEnergy.", nameof(obj)); + if(!(obj is ReactiveEnergy objReactiveEnergy)) throw new ArgumentException("Expected type ReactiveEnergy.", nameof(obj)); return CompareTo(objReactiveEnergy); } /// - public int CompareTo(ReactiveEnergy other) + public int CompareTo(ReactiveEnergy other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ReactiveEnergy objReactiveEnergy)) + if(obj is null || !(obj is ReactiveEnergy objReactiveEnergy)) return false; return Equals(objReactiveEnergy); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ReactiveEnergy other) + /// Consider using for safely comparing floating point values. + public bool Equals(ReactiveEnergy other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ReactiveEnergy within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -552,7 +552,7 @@ public bool Equals(ReactiveEnergy other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ReactiveEnergy other, double tolerance, ComparisonType comparisonType) + public bool Equals(ReactiveEnergy other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -566,7 +566,7 @@ public bool Equals(ReactiveEnergy other, double tolerance, ComparisonType compar /// /// Returns the hash code for this instance. /// - /// A hash code for the current ReactiveEnergy. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -614,13 +614,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ReactiveEnergy to another ReactiveEnergy with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ReactiveEnergy with the specified unit. - public ReactiveEnergy ToUnit(ReactiveEnergyUnit unit) + /// A with the specified unit. + public ReactiveEnergy ToUnit(ReactiveEnergyUnit unit) { var convertedValue = GetValueAs(unit); - return new ReactiveEnergy(convertedValue, unit); + return new ReactiveEnergy(convertedValue, unit); } /// @@ -633,7 +633,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ReactiveEnergy ToUnit(UnitSystem unitSystem) + public ReactiveEnergy ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -678,10 +678,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ReactiveEnergy ToBaseUnit() + internal ReactiveEnergy ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ReactiveEnergy(baseUnitValue, BaseUnit); + return new ReactiveEnergy(baseUnitValue, BaseUnit); } private double GetValueAs(ReactiveEnergyUnit unit) @@ -792,7 +792,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -802,12 +802,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -852,16 +852,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ReactiveEnergy)) + if(conversionType == typeof(ReactiveEnergy)) return this; else if(conversionType == typeof(ReactiveEnergyUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ReactiveEnergy.QuantityType; + return ReactiveEnergy.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ReactiveEnergy.BaseDimensions; + return ReactiveEnergy.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs index ac71aca660..deaffe4484 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Volt-ampere reactive (var) is a unit by which reactive power is expressed in an AC electric power system. Reactive power exists in an AC circuit when the current and voltage are not in phase. /// - public partial struct ReactivePower : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ReactivePower : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -103,19 +103,19 @@ public ReactivePower(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ReactivePower, which is VoltampereReactive. All conversions go via this value. + /// The base unit of , which is VoltampereReactive. All conversions go via this value. /// public static ReactivePowerUnit BaseUnit { get; } = ReactivePowerUnit.VoltampereReactive; /// - /// Represents the largest possible value of ReactivePower + /// Represents the largest possible value of /// - public static ReactivePower MaxValue { get; } = new ReactivePower(double.MaxValue, BaseUnit); + public static ReactivePower MaxValue { get; } = new ReactivePower(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ReactivePower + /// Represents the smallest possible value of /// - public static ReactivePower MinValue { get; } = new ReactivePower(double.MinValue, BaseUnit); + public static ReactivePower MinValue { get; } = new ReactivePower(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -123,14 +123,14 @@ public ReactivePower(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ReactivePower; /// - /// All units of measurement for the ReactivePower quantity. + /// All units of measurement for the quantity. /// public static ReactivePowerUnit[] Units { get; } = Enum.GetValues(typeof(ReactivePowerUnit)).Cast().Except(new ReactivePowerUnit[]{ ReactivePowerUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereReactive. /// - public static ReactivePower Zero { get; } = new ReactivePower(0, BaseUnit); + public static ReactivePower Zero { get; } = new ReactivePower(0, BaseUnit); #endregion @@ -155,34 +155,34 @@ public ReactivePower(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ReactivePower.QuantityType; + public QuantityType Type => ReactivePower.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ReactivePower.BaseDimensions; + public BaseDimensions Dimensions => ReactivePower.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ReactivePower in GigavoltamperesReactive. + /// Get in GigavoltamperesReactive. /// public double GigavoltamperesReactive => As(ReactivePowerUnit.GigavoltampereReactive); /// - /// Get ReactivePower in KilovoltamperesReactive. + /// Get in KilovoltamperesReactive. /// public double KilovoltamperesReactive => As(ReactivePowerUnit.KilovoltampereReactive); /// - /// Get ReactivePower in MegavoltamperesReactive. + /// Get in MegavoltamperesReactive. /// public double MegavoltamperesReactive => As(ReactivePowerUnit.MegavoltampereReactive); /// - /// Get ReactivePower in VoltamperesReactive. + /// Get in VoltamperesReactive. /// public double VoltamperesReactive => As(ReactivePowerUnit.VoltampereReactive); @@ -216,51 +216,51 @@ public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] IFormat #region Static Factory Methods /// - /// Get ReactivePower from GigavoltamperesReactive. + /// Get from GigavoltamperesReactive. /// /// If value is NaN or Infinity. - public static ReactivePower FromGigavoltamperesReactive(QuantityValue gigavoltamperesreactive) + public static ReactivePower FromGigavoltamperesReactive(QuantityValue gigavoltamperesreactive) { double value = (double) gigavoltamperesreactive; - return new ReactivePower(value, ReactivePowerUnit.GigavoltampereReactive); + return new ReactivePower(value, ReactivePowerUnit.GigavoltampereReactive); } /// - /// Get ReactivePower from KilovoltamperesReactive. + /// Get from KilovoltamperesReactive. /// /// If value is NaN or Infinity. - public static ReactivePower FromKilovoltamperesReactive(QuantityValue kilovoltamperesreactive) + public static ReactivePower FromKilovoltamperesReactive(QuantityValue kilovoltamperesreactive) { double value = (double) kilovoltamperesreactive; - return new ReactivePower(value, ReactivePowerUnit.KilovoltampereReactive); + return new ReactivePower(value, ReactivePowerUnit.KilovoltampereReactive); } /// - /// Get ReactivePower from MegavoltamperesReactive. + /// Get from MegavoltamperesReactive. /// /// If value is NaN or Infinity. - public static ReactivePower FromMegavoltamperesReactive(QuantityValue megavoltamperesreactive) + public static ReactivePower FromMegavoltamperesReactive(QuantityValue megavoltamperesreactive) { double value = (double) megavoltamperesreactive; - return new ReactivePower(value, ReactivePowerUnit.MegavoltampereReactive); + return new ReactivePower(value, ReactivePowerUnit.MegavoltampereReactive); } /// - /// Get ReactivePower from VoltamperesReactive. + /// Get from VoltamperesReactive. /// /// If value is NaN or Infinity. - public static ReactivePower FromVoltamperesReactive(QuantityValue voltamperesreactive) + public static ReactivePower FromVoltamperesReactive(QuantityValue voltamperesreactive) { double value = (double) voltamperesreactive; - return new ReactivePower(value, ReactivePowerUnit.VoltampereReactive); + return new ReactivePower(value, ReactivePowerUnit.VoltampereReactive); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ReactivePower unit value. - public static ReactivePower From(QuantityValue value, ReactivePowerUnit fromUnit) + /// unit value. + public static ReactivePower From(QuantityValue value, ReactivePowerUnit fromUnit) { - return new ReactivePower((double)value, fromUnit); + return new ReactivePower((double)value, fromUnit); } #endregion @@ -289,7 +289,7 @@ public static ReactivePower From(QuantityValue value, ReactivePowerUnit fromUnit /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ReactivePower Parse(string str) + public static ReactivePower Parse(string str) { return Parse(str, null); } @@ -317,9 +317,9 @@ public static ReactivePower Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ReactivePower Parse(string str, [CanBeNull] IFormatProvider provider) + public static ReactivePower Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ReactivePowerUnit>( str, provider, From); @@ -333,7 +333,7 @@ public static ReactivePower Parse(string str, [CanBeNull] IFormatProvider provid /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ReactivePower result) + public static bool TryParse([CanBeNull] string str, out ReactivePower result) { return TryParse(str, null, out result); } @@ -348,9 +348,9 @@ public static bool TryParse([CanBeNull] string str, out ReactivePower result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactivePower result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactivePower result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ReactivePowerUnit>( str, provider, From, @@ -412,43 +412,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Reacti #region Arithmetic Operators /// Negate the value. - public static ReactivePower operator -(ReactivePower right) + public static ReactivePower operator -(ReactivePower right) { - return new ReactivePower(-right.Value, right.Unit); + return new ReactivePower(-right.Value, right.Unit); } - /// Get from adding two . - public static ReactivePower operator +(ReactivePower left, ReactivePower right) + /// Get from adding two . + public static ReactivePower operator +(ReactivePower left, ReactivePower right) { - return new ReactivePower(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ReactivePower(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ReactivePower operator -(ReactivePower left, ReactivePower right) + /// Get from subtracting two . + public static ReactivePower operator -(ReactivePower left, ReactivePower right) { - return new ReactivePower(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ReactivePower(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ReactivePower operator *(double left, ReactivePower right) + /// Get from multiplying value and . + public static ReactivePower operator *(double left, ReactivePower right) { - return new ReactivePower(left * right.Value, right.Unit); + return new ReactivePower(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ReactivePower operator *(ReactivePower left, double right) + /// Get from multiplying value and . + public static ReactivePower operator *(ReactivePower left, double right) { - return new ReactivePower(left.Value * right, left.Unit); + return new ReactivePower(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ReactivePower operator /(ReactivePower left, double right) + /// Get from dividing by value. + public static ReactivePower operator /(ReactivePower left, double right) { - return new ReactivePower(left.Value / right, left.Unit); + return new ReactivePower(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ReactivePower left, ReactivePower right) + /// Get ratio value from dividing by . + public static double operator /(ReactivePower left, ReactivePower right) { return left.VoltamperesReactive / right.VoltamperesReactive; } @@ -458,39 +458,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Reacti #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ReactivePower left, ReactivePower right) + public static bool operator <=(ReactivePower left, ReactivePower right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ReactivePower left, ReactivePower right) + public static bool operator >=(ReactivePower left, ReactivePower right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ReactivePower left, ReactivePower right) + public static bool operator <(ReactivePower left, ReactivePower right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ReactivePower left, ReactivePower right) + public static bool operator >(ReactivePower left, ReactivePower right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ReactivePower left, ReactivePower right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ReactivePower left, ReactivePower right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ReactivePower left, ReactivePower right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ReactivePower left, ReactivePower right) { return !(left == right); } @@ -499,37 +499,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Reacti public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ReactivePower objReactivePower)) throw new ArgumentException("Expected type ReactivePower.", nameof(obj)); + if(!(obj is ReactivePower objReactivePower)) throw new ArgumentException("Expected type ReactivePower.", nameof(obj)); return CompareTo(objReactivePower); } /// - public int CompareTo(ReactivePower other) + public int CompareTo(ReactivePower other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ReactivePower objReactivePower)) + if(obj is null || !(obj is ReactivePower objReactivePower)) return false; return Equals(objReactivePower); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ReactivePower other) + /// Consider using for safely comparing floating point values. + public bool Equals(ReactivePower other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ReactivePower within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -567,7 +567,7 @@ public bool Equals(ReactivePower other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ReactivePower other, double tolerance, ComparisonType comparisonType) + public bool Equals(ReactivePower other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -581,7 +581,7 @@ public bool Equals(ReactivePower other, double tolerance, ComparisonType compari /// /// Returns the hash code for this instance. /// - /// A hash code for the current ReactivePower. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -629,13 +629,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ReactivePower to another ReactivePower with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ReactivePower with the specified unit. - public ReactivePower ToUnit(ReactivePowerUnit unit) + /// A with the specified unit. + public ReactivePower ToUnit(ReactivePowerUnit unit) { var convertedValue = GetValueAs(unit); - return new ReactivePower(convertedValue, unit); + return new ReactivePower(convertedValue, unit); } /// @@ -648,7 +648,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ReactivePower ToUnit(UnitSystem unitSystem) + public ReactivePower ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -694,10 +694,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ReactivePower ToBaseUnit() + internal ReactivePower ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ReactivePower(baseUnitValue, BaseUnit); + return new ReactivePower(baseUnitValue, BaseUnit); } private double GetValueAs(ReactivePowerUnit unit) @@ -809,7 +809,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ReactivePower)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ReactivePower)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -819,12 +819,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ReactivePower)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ReactivePower)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ReactivePower)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ReactivePower)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -869,16 +869,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ReactivePower)) + if(conversionType == typeof(ReactivePower)) return this; else if(conversionType == typeof(ReactivePowerUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ReactivePower.QuantityType; + return ReactivePower.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ReactivePower.BaseDimensions; + return ReactivePower.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ReactivePower)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ReactivePower)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs index 0e67b0ad9f..14b647f102 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Angular acceleration is the rate of change of rotational speed. /// - public partial struct RotationalAcceleration : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct RotationalAcceleration : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -103,19 +103,19 @@ public RotationalAcceleration(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of RotationalAcceleration, which is RadianPerSecondSquared. All conversions go via this value. + /// The base unit of , which is RadianPerSecondSquared. All conversions go via this value. /// public static RotationalAccelerationUnit BaseUnit { get; } = RotationalAccelerationUnit.RadianPerSecondSquared; /// - /// Represents the largest possible value of RotationalAcceleration + /// Represents the largest possible value of /// - public static RotationalAcceleration MaxValue { get; } = new RotationalAcceleration(double.MaxValue, BaseUnit); + public static RotationalAcceleration MaxValue { get; } = new RotationalAcceleration(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of RotationalAcceleration + /// Represents the smallest possible value of /// - public static RotationalAcceleration MinValue { get; } = new RotationalAcceleration(double.MinValue, BaseUnit); + public static RotationalAcceleration MinValue { get; } = new RotationalAcceleration(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -123,14 +123,14 @@ public RotationalAcceleration(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.RotationalAcceleration; /// - /// All units of measurement for the RotationalAcceleration quantity. + /// All units of measurement for the quantity. /// public static RotationalAccelerationUnit[] Units { get; } = Enum.GetValues(typeof(RotationalAccelerationUnit)).Cast().Except(new RotationalAccelerationUnit[]{ RotationalAccelerationUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit RadianPerSecondSquared. /// - public static RotationalAcceleration Zero { get; } = new RotationalAcceleration(0, BaseUnit); + public static RotationalAcceleration Zero { get; } = new RotationalAcceleration(0, BaseUnit); #endregion @@ -155,34 +155,34 @@ public RotationalAcceleration(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => RotationalAcceleration.QuantityType; + public QuantityType Type => RotationalAcceleration.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => RotationalAcceleration.BaseDimensions; + public BaseDimensions Dimensions => RotationalAcceleration.BaseDimensions; #endregion #region Conversion Properties /// - /// Get RotationalAcceleration in DegreesPerSecondSquared. + /// Get in DegreesPerSecondSquared. /// public double DegreesPerSecondSquared => As(RotationalAccelerationUnit.DegreePerSecondSquared); /// - /// Get RotationalAcceleration in RadiansPerSecondSquared. + /// Get in RadiansPerSecondSquared. /// public double RadiansPerSecondSquared => As(RotationalAccelerationUnit.RadianPerSecondSquared); /// - /// Get RotationalAcceleration in RevolutionsPerMinutePerSecond. + /// Get in RevolutionsPerMinutePerSecond. /// public double RevolutionsPerMinutePerSecond => As(RotationalAccelerationUnit.RevolutionPerMinutePerSecond); /// - /// Get RotationalAcceleration in RevolutionsPerSecondSquared. + /// Get in RevolutionsPerSecondSquared. /// public double RevolutionsPerSecondSquared => As(RotationalAccelerationUnit.RevolutionPerSecondSquared); @@ -216,51 +216,51 @@ public static string GetAbbreviation(RotationalAccelerationUnit unit, [CanBeNull #region Static Factory Methods /// - /// Get RotationalAcceleration from DegreesPerSecondSquared. + /// Get from DegreesPerSecondSquared. /// /// If value is NaN or Infinity. - public static RotationalAcceleration FromDegreesPerSecondSquared(QuantityValue degreespersecondsquared) + public static RotationalAcceleration FromDegreesPerSecondSquared(QuantityValue degreespersecondsquared) { double value = (double) degreespersecondsquared; - return new RotationalAcceleration(value, RotationalAccelerationUnit.DegreePerSecondSquared); + return new RotationalAcceleration(value, RotationalAccelerationUnit.DegreePerSecondSquared); } /// - /// Get RotationalAcceleration from RadiansPerSecondSquared. + /// Get from RadiansPerSecondSquared. /// /// If value is NaN or Infinity. - public static RotationalAcceleration FromRadiansPerSecondSquared(QuantityValue radianspersecondsquared) + public static RotationalAcceleration FromRadiansPerSecondSquared(QuantityValue radianspersecondsquared) { double value = (double) radianspersecondsquared; - return new RotationalAcceleration(value, RotationalAccelerationUnit.RadianPerSecondSquared); + return new RotationalAcceleration(value, RotationalAccelerationUnit.RadianPerSecondSquared); } /// - /// Get RotationalAcceleration from RevolutionsPerMinutePerSecond. + /// Get from RevolutionsPerMinutePerSecond. /// /// If value is NaN or Infinity. - public static RotationalAcceleration FromRevolutionsPerMinutePerSecond(QuantityValue revolutionsperminutepersecond) + public static RotationalAcceleration FromRevolutionsPerMinutePerSecond(QuantityValue revolutionsperminutepersecond) { double value = (double) revolutionsperminutepersecond; - return new RotationalAcceleration(value, RotationalAccelerationUnit.RevolutionPerMinutePerSecond); + return new RotationalAcceleration(value, RotationalAccelerationUnit.RevolutionPerMinutePerSecond); } /// - /// Get RotationalAcceleration from RevolutionsPerSecondSquared. + /// Get from RevolutionsPerSecondSquared. /// /// If value is NaN or Infinity. - public static RotationalAcceleration FromRevolutionsPerSecondSquared(QuantityValue revolutionspersecondsquared) + public static RotationalAcceleration FromRevolutionsPerSecondSquared(QuantityValue revolutionspersecondsquared) { double value = (double) revolutionspersecondsquared; - return new RotationalAcceleration(value, RotationalAccelerationUnit.RevolutionPerSecondSquared); + return new RotationalAcceleration(value, RotationalAccelerationUnit.RevolutionPerSecondSquared); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// RotationalAcceleration unit value. - public static RotationalAcceleration From(QuantityValue value, RotationalAccelerationUnit fromUnit) + /// unit value. + public static RotationalAcceleration From(QuantityValue value, RotationalAccelerationUnit fromUnit) { - return new RotationalAcceleration((double)value, fromUnit); + return new RotationalAcceleration((double)value, fromUnit); } #endregion @@ -289,7 +289,7 @@ public static RotationalAcceleration From(QuantityValue value, RotationalAcceler /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static RotationalAcceleration Parse(string str) + public static RotationalAcceleration Parse(string str) { return Parse(str, null); } @@ -317,9 +317,9 @@ public static RotationalAcceleration Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static RotationalAcceleration Parse(string str, [CanBeNull] IFormatProvider provider) + public static RotationalAcceleration Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, RotationalAccelerationUnit>( str, provider, From); @@ -333,7 +333,7 @@ public static RotationalAcceleration Parse(string str, [CanBeNull] IFormatProvid /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out RotationalAcceleration result) + public static bool TryParse([CanBeNull] string str, out RotationalAcceleration result) { return TryParse(str, null, out result); } @@ -348,9 +348,9 @@ public static bool TryParse([CanBeNull] string str, out RotationalAcceleration r /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalAcceleration result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalAcceleration result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, RotationalAccelerationUnit>( str, provider, From, @@ -412,43 +412,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati #region Arithmetic Operators /// Negate the value. - public static RotationalAcceleration operator -(RotationalAcceleration right) + public static RotationalAcceleration operator -(RotationalAcceleration right) { - return new RotationalAcceleration(-right.Value, right.Unit); + return new RotationalAcceleration(-right.Value, right.Unit); } - /// Get from adding two . - public static RotationalAcceleration operator +(RotationalAcceleration left, RotationalAcceleration right) + /// Get from adding two . + public static RotationalAcceleration operator +(RotationalAcceleration left, RotationalAcceleration right) { - return new RotationalAcceleration(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new RotationalAcceleration(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static RotationalAcceleration operator -(RotationalAcceleration left, RotationalAcceleration right) + /// Get from subtracting two . + public static RotationalAcceleration operator -(RotationalAcceleration left, RotationalAcceleration right) { - return new RotationalAcceleration(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new RotationalAcceleration(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static RotationalAcceleration operator *(double left, RotationalAcceleration right) + /// Get from multiplying value and . + public static RotationalAcceleration operator *(double left, RotationalAcceleration right) { - return new RotationalAcceleration(left * right.Value, right.Unit); + return new RotationalAcceleration(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static RotationalAcceleration operator *(RotationalAcceleration left, double right) + /// Get from multiplying value and . + public static RotationalAcceleration operator *(RotationalAcceleration left, double right) { - return new RotationalAcceleration(left.Value * right, left.Unit); + return new RotationalAcceleration(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static RotationalAcceleration operator /(RotationalAcceleration left, double right) + /// Get from dividing by value. + public static RotationalAcceleration operator /(RotationalAcceleration left, double right) { - return new RotationalAcceleration(left.Value / right, left.Unit); + return new RotationalAcceleration(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(RotationalAcceleration left, RotationalAcceleration right) + /// Get ratio value from dividing by . + public static double operator /(RotationalAcceleration left, RotationalAcceleration right) { return left.RadiansPerSecondSquared / right.RadiansPerSecondSquared; } @@ -458,39 +458,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(RotationalAcceleration left, RotationalAcceleration right) + public static bool operator <=(RotationalAcceleration left, RotationalAcceleration right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(RotationalAcceleration left, RotationalAcceleration right) + public static bool operator >=(RotationalAcceleration left, RotationalAcceleration right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(RotationalAcceleration left, RotationalAcceleration right) + public static bool operator <(RotationalAcceleration left, RotationalAcceleration right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(RotationalAcceleration left, RotationalAcceleration right) + public static bool operator >(RotationalAcceleration left, RotationalAcceleration right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(RotationalAcceleration left, RotationalAcceleration right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(RotationalAcceleration left, RotationalAcceleration right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(RotationalAcceleration left, RotationalAcceleration right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(RotationalAcceleration left, RotationalAcceleration right) { return !(left == right); } @@ -499,37 +499,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalAcceleration objRotationalAcceleration)) throw new ArgumentException("Expected type RotationalAcceleration.", nameof(obj)); + if(!(obj is RotationalAcceleration objRotationalAcceleration)) throw new ArgumentException("Expected type RotationalAcceleration.", nameof(obj)); return CompareTo(objRotationalAcceleration); } /// - public int CompareTo(RotationalAcceleration other) + public int CompareTo(RotationalAcceleration other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is RotationalAcceleration objRotationalAcceleration)) + if(obj is null || !(obj is RotationalAcceleration objRotationalAcceleration)) return false; return Equals(objRotationalAcceleration); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(RotationalAcceleration other) + /// Consider using for safely comparing floating point values. + public bool Equals(RotationalAcceleration other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another RotationalAcceleration within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -567,7 +567,7 @@ public bool Equals(RotationalAcceleration other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(RotationalAcceleration other, double tolerance, ComparisonType comparisonType) + public bool Equals(RotationalAcceleration other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -581,7 +581,7 @@ public bool Equals(RotationalAcceleration other, double tolerance, ComparisonTyp /// /// Returns the hash code for this instance. /// - /// A hash code for the current RotationalAcceleration. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -629,13 +629,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this RotationalAcceleration to another RotationalAcceleration with the unit representation . + /// Converts this to another with the unit representation . /// - /// A RotationalAcceleration with the specified unit. - public RotationalAcceleration ToUnit(RotationalAccelerationUnit unit) + /// A with the specified unit. + public RotationalAcceleration ToUnit(RotationalAccelerationUnit unit) { var convertedValue = GetValueAs(unit); - return new RotationalAcceleration(convertedValue, unit); + return new RotationalAcceleration(convertedValue, unit); } /// @@ -648,7 +648,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public RotationalAcceleration ToUnit(UnitSystem unitSystem) + public RotationalAcceleration ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -694,10 +694,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal RotationalAcceleration ToBaseUnit() + internal RotationalAcceleration ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new RotationalAcceleration(baseUnitValue, BaseUnit); + return new RotationalAcceleration(baseUnitValue, BaseUnit); } private double GetValueAs(RotationalAccelerationUnit unit) @@ -809,7 +809,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -819,12 +819,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -869,16 +869,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(RotationalAcceleration)) + if(conversionType == typeof(RotationalAcceleration)) return this; else if(conversionType == typeof(RotationalAccelerationUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return RotationalAcceleration.QuantityType; + return RotationalAcceleration.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return RotationalAcceleration.BaseDimensions; + return RotationalAcceleration.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs index bd301b10b7..cecee53475 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Rotational speed (sometimes called speed of revolution) is the number of complete rotations, revolutions, cycles, or turns per time unit. Rotational speed is a cyclic frequency, measured in radians per second or in hertz in the SI System by scientists, or in revolutions per minute (rpm or min-1) or revolutions per second in everyday life. The symbol for rotational speed is ω (the Greek lowercase letter "omega"). /// - public partial struct RotationalSpeed : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct RotationalSpeed : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -112,19 +112,19 @@ public RotationalSpeed(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of RotationalSpeed, which is RadianPerSecond. All conversions go via this value. + /// The base unit of , which is RadianPerSecond. All conversions go via this value. /// public static RotationalSpeedUnit BaseUnit { get; } = RotationalSpeedUnit.RadianPerSecond; /// - /// Represents the largest possible value of RotationalSpeed + /// Represents the largest possible value of /// - public static RotationalSpeed MaxValue { get; } = new RotationalSpeed(double.MaxValue, BaseUnit); + public static RotationalSpeed MaxValue { get; } = new RotationalSpeed(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of RotationalSpeed + /// Represents the smallest possible value of /// - public static RotationalSpeed MinValue { get; } = new RotationalSpeed(double.MinValue, BaseUnit); + public static RotationalSpeed MinValue { get; } = new RotationalSpeed(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -132,14 +132,14 @@ public RotationalSpeed(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.RotationalSpeed; /// - /// All units of measurement for the RotationalSpeed quantity. + /// All units of measurement for the quantity. /// public static RotationalSpeedUnit[] Units { get; } = Enum.GetValues(typeof(RotationalSpeedUnit)).Cast().Except(new RotationalSpeedUnit[]{ RotationalSpeedUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit RadianPerSecond. /// - public static RotationalSpeed Zero { get; } = new RotationalSpeed(0, BaseUnit); + public static RotationalSpeed Zero { get; } = new RotationalSpeed(0, BaseUnit); #endregion @@ -164,79 +164,79 @@ public RotationalSpeed(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => RotationalSpeed.QuantityType; + public QuantityType Type => RotationalSpeed.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => RotationalSpeed.BaseDimensions; + public BaseDimensions Dimensions => RotationalSpeed.BaseDimensions; #endregion #region Conversion Properties /// - /// Get RotationalSpeed in CentiradiansPerSecond. + /// Get in CentiradiansPerSecond. /// public double CentiradiansPerSecond => As(RotationalSpeedUnit.CentiradianPerSecond); /// - /// Get RotationalSpeed in DeciradiansPerSecond. + /// Get in DeciradiansPerSecond. /// public double DeciradiansPerSecond => As(RotationalSpeedUnit.DeciradianPerSecond); /// - /// Get RotationalSpeed in DegreesPerMinute. + /// Get in DegreesPerMinute. /// public double DegreesPerMinute => As(RotationalSpeedUnit.DegreePerMinute); /// - /// Get RotationalSpeed in DegreesPerSecond. + /// Get in DegreesPerSecond. /// public double DegreesPerSecond => As(RotationalSpeedUnit.DegreePerSecond); /// - /// Get RotationalSpeed in MicrodegreesPerSecond. + /// Get in MicrodegreesPerSecond. /// public double MicrodegreesPerSecond => As(RotationalSpeedUnit.MicrodegreePerSecond); /// - /// Get RotationalSpeed in MicroradiansPerSecond. + /// Get in MicroradiansPerSecond. /// public double MicroradiansPerSecond => As(RotationalSpeedUnit.MicroradianPerSecond); /// - /// Get RotationalSpeed in MillidegreesPerSecond. + /// Get in MillidegreesPerSecond. /// public double MillidegreesPerSecond => As(RotationalSpeedUnit.MillidegreePerSecond); /// - /// Get RotationalSpeed in MilliradiansPerSecond. + /// Get in MilliradiansPerSecond. /// public double MilliradiansPerSecond => As(RotationalSpeedUnit.MilliradianPerSecond); /// - /// Get RotationalSpeed in NanodegreesPerSecond. + /// Get in NanodegreesPerSecond. /// public double NanodegreesPerSecond => As(RotationalSpeedUnit.NanodegreePerSecond); /// - /// Get RotationalSpeed in NanoradiansPerSecond. + /// Get in NanoradiansPerSecond. /// public double NanoradiansPerSecond => As(RotationalSpeedUnit.NanoradianPerSecond); /// - /// Get RotationalSpeed in RadiansPerSecond. + /// Get in RadiansPerSecond. /// public double RadiansPerSecond => As(RotationalSpeedUnit.RadianPerSecond); /// - /// Get RotationalSpeed in RevolutionsPerMinute. + /// Get in RevolutionsPerMinute. /// public double RevolutionsPerMinute => As(RotationalSpeedUnit.RevolutionPerMinute); /// - /// Get RotationalSpeed in RevolutionsPerSecond. + /// Get in RevolutionsPerSecond. /// public double RevolutionsPerSecond => As(RotationalSpeedUnit.RevolutionPerSecond); @@ -270,132 +270,132 @@ public static string GetAbbreviation(RotationalSpeedUnit unit, [CanBeNull] IForm #region Static Factory Methods /// - /// Get RotationalSpeed from CentiradiansPerSecond. + /// Get from CentiradiansPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromCentiradiansPerSecond(QuantityValue centiradianspersecond) + public static RotationalSpeed FromCentiradiansPerSecond(QuantityValue centiradianspersecond) { double value = (double) centiradianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.CentiradianPerSecond); + return new RotationalSpeed(value, RotationalSpeedUnit.CentiradianPerSecond); } /// - /// Get RotationalSpeed from DeciradiansPerSecond. + /// Get from DeciradiansPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromDeciradiansPerSecond(QuantityValue deciradianspersecond) + public static RotationalSpeed FromDeciradiansPerSecond(QuantityValue deciradianspersecond) { double value = (double) deciradianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.DeciradianPerSecond); + return new RotationalSpeed(value, RotationalSpeedUnit.DeciradianPerSecond); } /// - /// Get RotationalSpeed from DegreesPerMinute. + /// Get from DegreesPerMinute. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromDegreesPerMinute(QuantityValue degreesperminute) + public static RotationalSpeed FromDegreesPerMinute(QuantityValue degreesperminute) { double value = (double) degreesperminute; - return new RotationalSpeed(value, RotationalSpeedUnit.DegreePerMinute); + return new RotationalSpeed(value, RotationalSpeedUnit.DegreePerMinute); } /// - /// Get RotationalSpeed from DegreesPerSecond. + /// Get from DegreesPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromDegreesPerSecond(QuantityValue degreespersecond) + public static RotationalSpeed FromDegreesPerSecond(QuantityValue degreespersecond) { double value = (double) degreespersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.DegreePerSecond); + return new RotationalSpeed(value, RotationalSpeedUnit.DegreePerSecond); } /// - /// Get RotationalSpeed from MicrodegreesPerSecond. + /// Get from MicrodegreesPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromMicrodegreesPerSecond(QuantityValue microdegreespersecond) + public static RotationalSpeed FromMicrodegreesPerSecond(QuantityValue microdegreespersecond) { double value = (double) microdegreespersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.MicrodegreePerSecond); + return new RotationalSpeed(value, RotationalSpeedUnit.MicrodegreePerSecond); } /// - /// Get RotationalSpeed from MicroradiansPerSecond. + /// Get from MicroradiansPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromMicroradiansPerSecond(QuantityValue microradianspersecond) + public static RotationalSpeed FromMicroradiansPerSecond(QuantityValue microradianspersecond) { double value = (double) microradianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.MicroradianPerSecond); + return new RotationalSpeed(value, RotationalSpeedUnit.MicroradianPerSecond); } /// - /// Get RotationalSpeed from MillidegreesPerSecond. + /// Get from MillidegreesPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromMillidegreesPerSecond(QuantityValue millidegreespersecond) + public static RotationalSpeed FromMillidegreesPerSecond(QuantityValue millidegreespersecond) { double value = (double) millidegreespersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.MillidegreePerSecond); + return new RotationalSpeed(value, RotationalSpeedUnit.MillidegreePerSecond); } /// - /// Get RotationalSpeed from MilliradiansPerSecond. + /// Get from MilliradiansPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromMilliradiansPerSecond(QuantityValue milliradianspersecond) + public static RotationalSpeed FromMilliradiansPerSecond(QuantityValue milliradianspersecond) { double value = (double) milliradianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.MilliradianPerSecond); + return new RotationalSpeed(value, RotationalSpeedUnit.MilliradianPerSecond); } /// - /// Get RotationalSpeed from NanodegreesPerSecond. + /// Get from NanodegreesPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromNanodegreesPerSecond(QuantityValue nanodegreespersecond) + public static RotationalSpeed FromNanodegreesPerSecond(QuantityValue nanodegreespersecond) { double value = (double) nanodegreespersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.NanodegreePerSecond); + return new RotationalSpeed(value, RotationalSpeedUnit.NanodegreePerSecond); } /// - /// Get RotationalSpeed from NanoradiansPerSecond. + /// Get from NanoradiansPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromNanoradiansPerSecond(QuantityValue nanoradianspersecond) + public static RotationalSpeed FromNanoradiansPerSecond(QuantityValue nanoradianspersecond) { double value = (double) nanoradianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.NanoradianPerSecond); + return new RotationalSpeed(value, RotationalSpeedUnit.NanoradianPerSecond); } /// - /// Get RotationalSpeed from RadiansPerSecond. + /// Get from RadiansPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromRadiansPerSecond(QuantityValue radianspersecond) + public static RotationalSpeed FromRadiansPerSecond(QuantityValue radianspersecond) { double value = (double) radianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.RadianPerSecond); + return new RotationalSpeed(value, RotationalSpeedUnit.RadianPerSecond); } /// - /// Get RotationalSpeed from RevolutionsPerMinute. + /// Get from RevolutionsPerMinute. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromRevolutionsPerMinute(QuantityValue revolutionsperminute) + public static RotationalSpeed FromRevolutionsPerMinute(QuantityValue revolutionsperminute) { double value = (double) revolutionsperminute; - return new RotationalSpeed(value, RotationalSpeedUnit.RevolutionPerMinute); + return new RotationalSpeed(value, RotationalSpeedUnit.RevolutionPerMinute); } /// - /// Get RotationalSpeed from RevolutionsPerSecond. + /// Get from RevolutionsPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromRevolutionsPerSecond(QuantityValue revolutionspersecond) + public static RotationalSpeed FromRevolutionsPerSecond(QuantityValue revolutionspersecond) { double value = (double) revolutionspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.RevolutionPerSecond); + return new RotationalSpeed(value, RotationalSpeedUnit.RevolutionPerSecond); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// RotationalSpeed unit value. - public static RotationalSpeed From(QuantityValue value, RotationalSpeedUnit fromUnit) + /// unit value. + public static RotationalSpeed From(QuantityValue value, RotationalSpeedUnit fromUnit) { - return new RotationalSpeed((double)value, fromUnit); + return new RotationalSpeed((double)value, fromUnit); } #endregion @@ -424,7 +424,7 @@ public static RotationalSpeed From(QuantityValue value, RotationalSpeedUnit from /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static RotationalSpeed Parse(string str) + public static RotationalSpeed Parse(string str) { return Parse(str, null); } @@ -452,9 +452,9 @@ public static RotationalSpeed Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static RotationalSpeed Parse(string str, [CanBeNull] IFormatProvider provider) + public static RotationalSpeed Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, RotationalSpeedUnit>( str, provider, From); @@ -468,7 +468,7 @@ public static RotationalSpeed Parse(string str, [CanBeNull] IFormatProvider prov /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out RotationalSpeed result) + public static bool TryParse([CanBeNull] string str, out RotationalSpeed result) { return TryParse(str, null, out result); } @@ -483,9 +483,9 @@ public static bool TryParse([CanBeNull] string str, out RotationalSpeed result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalSpeed result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalSpeed result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, RotationalSpeedUnit>( str, provider, From, @@ -547,43 +547,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati #region Arithmetic Operators /// Negate the value. - public static RotationalSpeed operator -(RotationalSpeed right) + public static RotationalSpeed operator -(RotationalSpeed right) { - return new RotationalSpeed(-right.Value, right.Unit); + return new RotationalSpeed(-right.Value, right.Unit); } - /// Get from adding two . - public static RotationalSpeed operator +(RotationalSpeed left, RotationalSpeed right) + /// Get from adding two . + public static RotationalSpeed operator +(RotationalSpeed left, RotationalSpeed right) { - return new RotationalSpeed(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new RotationalSpeed(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static RotationalSpeed operator -(RotationalSpeed left, RotationalSpeed right) + /// Get from subtracting two . + public static RotationalSpeed operator -(RotationalSpeed left, RotationalSpeed right) { - return new RotationalSpeed(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new RotationalSpeed(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static RotationalSpeed operator *(double left, RotationalSpeed right) + /// Get from multiplying value and . + public static RotationalSpeed operator *(double left, RotationalSpeed right) { - return new RotationalSpeed(left * right.Value, right.Unit); + return new RotationalSpeed(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static RotationalSpeed operator *(RotationalSpeed left, double right) + /// Get from multiplying value and . + public static RotationalSpeed operator *(RotationalSpeed left, double right) { - return new RotationalSpeed(left.Value * right, left.Unit); + return new RotationalSpeed(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static RotationalSpeed operator /(RotationalSpeed left, double right) + /// Get from dividing by value. + public static RotationalSpeed operator /(RotationalSpeed left, double right) { - return new RotationalSpeed(left.Value / right, left.Unit); + return new RotationalSpeed(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(RotationalSpeed left, RotationalSpeed right) + /// Get ratio value from dividing by . + public static double operator /(RotationalSpeed left, RotationalSpeed right) { return left.RadiansPerSecond / right.RadiansPerSecond; } @@ -593,39 +593,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(RotationalSpeed left, RotationalSpeed right) + public static bool operator <=(RotationalSpeed left, RotationalSpeed right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(RotationalSpeed left, RotationalSpeed right) + public static bool operator >=(RotationalSpeed left, RotationalSpeed right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(RotationalSpeed left, RotationalSpeed right) + public static bool operator <(RotationalSpeed left, RotationalSpeed right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(RotationalSpeed left, RotationalSpeed right) + public static bool operator >(RotationalSpeed left, RotationalSpeed right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(RotationalSpeed left, RotationalSpeed right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(RotationalSpeed left, RotationalSpeed right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(RotationalSpeed left, RotationalSpeed right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(RotationalSpeed left, RotationalSpeed right) { return !(left == right); } @@ -634,37 +634,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalSpeed objRotationalSpeed)) throw new ArgumentException("Expected type RotationalSpeed.", nameof(obj)); + if(!(obj is RotationalSpeed objRotationalSpeed)) throw new ArgumentException("Expected type RotationalSpeed.", nameof(obj)); return CompareTo(objRotationalSpeed); } /// - public int CompareTo(RotationalSpeed other) + public int CompareTo(RotationalSpeed other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is RotationalSpeed objRotationalSpeed)) + if(obj is null || !(obj is RotationalSpeed objRotationalSpeed)) return false; return Equals(objRotationalSpeed); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(RotationalSpeed other) + /// Consider using for safely comparing floating point values. + public bool Equals(RotationalSpeed other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another RotationalSpeed within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -702,7 +702,7 @@ public bool Equals(RotationalSpeed other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(RotationalSpeed other, double tolerance, ComparisonType comparisonType) + public bool Equals(RotationalSpeed other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -716,7 +716,7 @@ public bool Equals(RotationalSpeed other, double tolerance, ComparisonType compa /// /// Returns the hash code for this instance. /// - /// A hash code for the current RotationalSpeed. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -764,13 +764,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this RotationalSpeed to another RotationalSpeed with the unit representation . + /// Converts this to another with the unit representation . /// - /// A RotationalSpeed with the specified unit. - public RotationalSpeed ToUnit(RotationalSpeedUnit unit) + /// A with the specified unit. + public RotationalSpeed ToUnit(RotationalSpeedUnit unit) { var convertedValue = GetValueAs(unit); - return new RotationalSpeed(convertedValue, unit); + return new RotationalSpeed(convertedValue, unit); } /// @@ -783,7 +783,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public RotationalSpeed ToUnit(UnitSystem unitSystem) + public RotationalSpeed ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -838,10 +838,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal RotationalSpeed ToBaseUnit() + internal RotationalSpeed ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new RotationalSpeed(baseUnitValue, BaseUnit); + return new RotationalSpeed(baseUnitValue, BaseUnit); } private double GetValueAs(RotationalSpeedUnit unit) @@ -962,7 +962,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -972,12 +972,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1022,16 +1022,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(RotationalSpeed)) + if(conversionType == typeof(RotationalSpeed)) return this; else if(conversionType == typeof(RotationalSpeedUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return RotationalSpeed.QuantityType; + return RotationalSpeed.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return RotationalSpeed.BaseDimensions; + return RotationalSpeed.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs index 8f9e30e94c..859908ba69 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness /// - public partial struct RotationalStiffness : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct RotationalStiffness : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -102,19 +102,19 @@ public RotationalStiffness(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of RotationalStiffness, which is NewtonMeterPerRadian. All conversions go via this value. + /// The base unit of , which is NewtonMeterPerRadian. All conversions go via this value. /// public static RotationalStiffnessUnit BaseUnit { get; } = RotationalStiffnessUnit.NewtonMeterPerRadian; /// - /// Represents the largest possible value of RotationalStiffness + /// Represents the largest possible value of /// - public static RotationalStiffness MaxValue { get; } = new RotationalStiffness(double.MaxValue, BaseUnit); + public static RotationalStiffness MaxValue { get; } = new RotationalStiffness(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of RotationalStiffness + /// Represents the smallest possible value of /// - public static RotationalStiffness MinValue { get; } = new RotationalStiffness(double.MinValue, BaseUnit); + public static RotationalStiffness MinValue { get; } = new RotationalStiffness(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -122,14 +122,14 @@ public RotationalStiffness(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.RotationalStiffness; /// - /// All units of measurement for the RotationalStiffness quantity. + /// All units of measurement for the quantity. /// public static RotationalStiffnessUnit[] Units { get; } = Enum.GetValues(typeof(RotationalStiffnessUnit)).Cast().Except(new RotationalStiffnessUnit[]{ RotationalStiffnessUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeterPerRadian. /// - public static RotationalStiffness Zero { get; } = new RotationalStiffness(0, BaseUnit); + public static RotationalStiffness Zero { get; } = new RotationalStiffness(0, BaseUnit); #endregion @@ -154,29 +154,29 @@ public RotationalStiffness(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => RotationalStiffness.QuantityType; + public QuantityType Type => RotationalStiffness.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => RotationalStiffness.BaseDimensions; + public BaseDimensions Dimensions => RotationalStiffness.BaseDimensions; #endregion #region Conversion Properties /// - /// Get RotationalStiffness in KilonewtonMetersPerRadian. + /// Get in KilonewtonMetersPerRadian. /// public double KilonewtonMetersPerRadian => As(RotationalStiffnessUnit.KilonewtonMeterPerRadian); /// - /// Get RotationalStiffness in MeganewtonMetersPerRadian. + /// Get in MeganewtonMetersPerRadian. /// public double MeganewtonMetersPerRadian => As(RotationalStiffnessUnit.MeganewtonMeterPerRadian); /// - /// Get RotationalStiffness in NewtonMetersPerRadian. + /// Get in NewtonMetersPerRadian. /// public double NewtonMetersPerRadian => As(RotationalStiffnessUnit.NewtonMeterPerRadian); @@ -210,42 +210,42 @@ public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] I #region Static Factory Methods /// - /// Get RotationalStiffness from KilonewtonMetersPerRadian. + /// Get from KilonewtonMetersPerRadian. /// /// If value is NaN or Infinity. - public static RotationalStiffness FromKilonewtonMetersPerRadian(QuantityValue kilonewtonmetersperradian) + public static RotationalStiffness FromKilonewtonMetersPerRadian(QuantityValue kilonewtonmetersperradian) { double value = (double) kilonewtonmetersperradian; - return new RotationalStiffness(value, RotationalStiffnessUnit.KilonewtonMeterPerRadian); + return new RotationalStiffness(value, RotationalStiffnessUnit.KilonewtonMeterPerRadian); } /// - /// Get RotationalStiffness from MeganewtonMetersPerRadian. + /// Get from MeganewtonMetersPerRadian. /// /// If value is NaN or Infinity. - public static RotationalStiffness FromMeganewtonMetersPerRadian(QuantityValue meganewtonmetersperradian) + public static RotationalStiffness FromMeganewtonMetersPerRadian(QuantityValue meganewtonmetersperradian) { double value = (double) meganewtonmetersperradian; - return new RotationalStiffness(value, RotationalStiffnessUnit.MeganewtonMeterPerRadian); + return new RotationalStiffness(value, RotationalStiffnessUnit.MeganewtonMeterPerRadian); } /// - /// Get RotationalStiffness from NewtonMetersPerRadian. + /// Get from NewtonMetersPerRadian. /// /// If value is NaN or Infinity. - public static RotationalStiffness FromNewtonMetersPerRadian(QuantityValue newtonmetersperradian) + public static RotationalStiffness FromNewtonMetersPerRadian(QuantityValue newtonmetersperradian) { double value = (double) newtonmetersperradian; - return new RotationalStiffness(value, RotationalStiffnessUnit.NewtonMeterPerRadian); + return new RotationalStiffness(value, RotationalStiffnessUnit.NewtonMeterPerRadian); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// RotationalStiffness unit value. - public static RotationalStiffness From(QuantityValue value, RotationalStiffnessUnit fromUnit) + /// unit value. + public static RotationalStiffness From(QuantityValue value, RotationalStiffnessUnit fromUnit) { - return new RotationalStiffness((double)value, fromUnit); + return new RotationalStiffness((double)value, fromUnit); } #endregion @@ -274,7 +274,7 @@ public static RotationalStiffness From(QuantityValue value, RotationalStiffnessU /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static RotationalStiffness Parse(string str) + public static RotationalStiffness Parse(string str) { return Parse(str, null); } @@ -302,9 +302,9 @@ public static RotationalStiffness Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static RotationalStiffness Parse(string str, [CanBeNull] IFormatProvider provider) + public static RotationalStiffness Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, RotationalStiffnessUnit>( str, provider, From); @@ -318,7 +318,7 @@ public static RotationalStiffness Parse(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out RotationalStiffness result) + public static bool TryParse([CanBeNull] string str, out RotationalStiffness result) { return TryParse(str, null, out result); } @@ -333,9 +333,9 @@ public static bool TryParse([CanBeNull] string str, out RotationalStiffness resu /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffness result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffness result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, RotationalStiffnessUnit>( str, provider, From, @@ -397,43 +397,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati #region Arithmetic Operators /// Negate the value. - public static RotationalStiffness operator -(RotationalStiffness right) + public static RotationalStiffness operator -(RotationalStiffness right) { - return new RotationalStiffness(-right.Value, right.Unit); + return new RotationalStiffness(-right.Value, right.Unit); } - /// Get from adding two . - public static RotationalStiffness operator +(RotationalStiffness left, RotationalStiffness right) + /// Get from adding two . + public static RotationalStiffness operator +(RotationalStiffness left, RotationalStiffness right) { - return new RotationalStiffness(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new RotationalStiffness(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static RotationalStiffness operator -(RotationalStiffness left, RotationalStiffness right) + /// Get from subtracting two . + public static RotationalStiffness operator -(RotationalStiffness left, RotationalStiffness right) { - return new RotationalStiffness(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new RotationalStiffness(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static RotationalStiffness operator *(double left, RotationalStiffness right) + /// Get from multiplying value and . + public static RotationalStiffness operator *(double left, RotationalStiffness right) { - return new RotationalStiffness(left * right.Value, right.Unit); + return new RotationalStiffness(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static RotationalStiffness operator *(RotationalStiffness left, double right) + /// Get from multiplying value and . + public static RotationalStiffness operator *(RotationalStiffness left, double right) { - return new RotationalStiffness(left.Value * right, left.Unit); + return new RotationalStiffness(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static RotationalStiffness operator /(RotationalStiffness left, double right) + /// Get from dividing by value. + public static RotationalStiffness operator /(RotationalStiffness left, double right) { - return new RotationalStiffness(left.Value / right, left.Unit); + return new RotationalStiffness(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(RotationalStiffness left, RotationalStiffness right) + /// Get ratio value from dividing by . + public static double operator /(RotationalStiffness left, RotationalStiffness right) { return left.NewtonMetersPerRadian / right.NewtonMetersPerRadian; } @@ -443,39 +443,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(RotationalStiffness left, RotationalStiffness right) + public static bool operator <=(RotationalStiffness left, RotationalStiffness right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(RotationalStiffness left, RotationalStiffness right) + public static bool operator >=(RotationalStiffness left, RotationalStiffness right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(RotationalStiffness left, RotationalStiffness right) + public static bool operator <(RotationalStiffness left, RotationalStiffness right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(RotationalStiffness left, RotationalStiffness right) + public static bool operator >(RotationalStiffness left, RotationalStiffness right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(RotationalStiffness left, RotationalStiffness right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(RotationalStiffness left, RotationalStiffness right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(RotationalStiffness left, RotationalStiffness right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(RotationalStiffness left, RotationalStiffness right) { return !(left == right); } @@ -484,37 +484,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalStiffness objRotationalStiffness)) throw new ArgumentException("Expected type RotationalStiffness.", nameof(obj)); + if(!(obj is RotationalStiffness objRotationalStiffness)) throw new ArgumentException("Expected type RotationalStiffness.", nameof(obj)); return CompareTo(objRotationalStiffness); } /// - public int CompareTo(RotationalStiffness other) + public int CompareTo(RotationalStiffness other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is RotationalStiffness objRotationalStiffness)) + if(obj is null || !(obj is RotationalStiffness objRotationalStiffness)) return false; return Equals(objRotationalStiffness); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(RotationalStiffness other) + /// Consider using for safely comparing floating point values. + public bool Equals(RotationalStiffness other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another RotationalStiffness within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -552,7 +552,7 @@ public bool Equals(RotationalStiffness other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(RotationalStiffness other, double tolerance, ComparisonType comparisonType) + public bool Equals(RotationalStiffness other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -566,7 +566,7 @@ public bool Equals(RotationalStiffness other, double tolerance, ComparisonType c /// /// Returns the hash code for this instance. /// - /// A hash code for the current RotationalStiffness. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -614,13 +614,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this RotationalStiffness to another RotationalStiffness with the unit representation . + /// Converts this to another with the unit representation . /// - /// A RotationalStiffness with the specified unit. - public RotationalStiffness ToUnit(RotationalStiffnessUnit unit) + /// A with the specified unit. + public RotationalStiffness ToUnit(RotationalStiffnessUnit unit) { var convertedValue = GetValueAs(unit); - return new RotationalStiffness(convertedValue, unit); + return new RotationalStiffness(convertedValue, unit); } /// @@ -633,7 +633,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public RotationalStiffness ToUnit(UnitSystem unitSystem) + public RotationalStiffness ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -678,10 +678,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal RotationalStiffness ToBaseUnit() + internal RotationalStiffness ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new RotationalStiffness(baseUnitValue, BaseUnit); + return new RotationalStiffness(baseUnitValue, BaseUnit); } private double GetValueAs(RotationalStiffnessUnit unit) @@ -792,7 +792,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -802,12 +802,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -852,16 +852,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(RotationalStiffness)) + if(conversionType == typeof(RotationalStiffness)) return this; else if(conversionType == typeof(RotationalStiffnessUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return RotationalStiffness.QuantityType; + return RotationalStiffness.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return RotationalStiffness.BaseDimensions; + return RotationalStiffness.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs index 9d7509b9f1..dab6bb3521 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness /// - public partial struct RotationalStiffnessPerLength : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct RotationalStiffnessPerLength : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -102,19 +102,19 @@ public RotationalStiffnessPerLength(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of RotationalStiffnessPerLength, which is NewtonMeterPerRadianPerMeter. All conversions go via this value. + /// The base unit of , which is NewtonMeterPerRadianPerMeter. All conversions go via this value. /// public static RotationalStiffnessPerLengthUnit BaseUnit { get; } = RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter; /// - /// Represents the largest possible value of RotationalStiffnessPerLength + /// Represents the largest possible value of /// - public static RotationalStiffnessPerLength MaxValue { get; } = new RotationalStiffnessPerLength(double.MaxValue, BaseUnit); + public static RotationalStiffnessPerLength MaxValue { get; } = new RotationalStiffnessPerLength(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of RotationalStiffnessPerLength + /// Represents the smallest possible value of /// - public static RotationalStiffnessPerLength MinValue { get; } = new RotationalStiffnessPerLength(double.MinValue, BaseUnit); + public static RotationalStiffnessPerLength MinValue { get; } = new RotationalStiffnessPerLength(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -122,14 +122,14 @@ public RotationalStiffnessPerLength(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.RotationalStiffnessPerLength; /// - /// All units of measurement for the RotationalStiffnessPerLength quantity. + /// All units of measurement for the quantity. /// public static RotationalStiffnessPerLengthUnit[] Units { get; } = Enum.GetValues(typeof(RotationalStiffnessPerLengthUnit)).Cast().Except(new RotationalStiffnessPerLengthUnit[]{ RotationalStiffnessPerLengthUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeterPerRadianPerMeter. /// - public static RotationalStiffnessPerLength Zero { get; } = new RotationalStiffnessPerLength(0, BaseUnit); + public static RotationalStiffnessPerLength Zero { get; } = new RotationalStiffnessPerLength(0, BaseUnit); #endregion @@ -154,29 +154,29 @@ public RotationalStiffnessPerLength(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => RotationalStiffnessPerLength.QuantityType; + public QuantityType Type => RotationalStiffnessPerLength.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => RotationalStiffnessPerLength.BaseDimensions; + public BaseDimensions Dimensions => RotationalStiffnessPerLength.BaseDimensions; #endregion #region Conversion Properties /// - /// Get RotationalStiffnessPerLength in KilonewtonMetersPerRadianPerMeter. + /// Get in KilonewtonMetersPerRadianPerMeter. /// public double KilonewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter); /// - /// Get RotationalStiffnessPerLength in MeganewtonMetersPerRadianPerMeter. + /// Get in MeganewtonMetersPerRadianPerMeter. /// public double MeganewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter); /// - /// Get RotationalStiffnessPerLength in NewtonMetersPerRadianPerMeter. + /// Get in NewtonMetersPerRadianPerMeter. /// public double NewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter); @@ -210,42 +210,42 @@ public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit, [Can #region Static Factory Methods /// - /// Get RotationalStiffnessPerLength from KilonewtonMetersPerRadianPerMeter. + /// Get from KilonewtonMetersPerRadianPerMeter. /// /// If value is NaN or Infinity. - public static RotationalStiffnessPerLength FromKilonewtonMetersPerRadianPerMeter(QuantityValue kilonewtonmetersperradianpermeter) + public static RotationalStiffnessPerLength FromKilonewtonMetersPerRadianPerMeter(QuantityValue kilonewtonmetersperradianpermeter) { double value = (double) kilonewtonmetersperradianpermeter; - return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter); + return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter); } /// - /// Get RotationalStiffnessPerLength from MeganewtonMetersPerRadianPerMeter. + /// Get from MeganewtonMetersPerRadianPerMeter. /// /// If value is NaN or Infinity. - public static RotationalStiffnessPerLength FromMeganewtonMetersPerRadianPerMeter(QuantityValue meganewtonmetersperradianpermeter) + public static RotationalStiffnessPerLength FromMeganewtonMetersPerRadianPerMeter(QuantityValue meganewtonmetersperradianpermeter) { double value = (double) meganewtonmetersperradianpermeter; - return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter); + return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter); } /// - /// Get RotationalStiffnessPerLength from NewtonMetersPerRadianPerMeter. + /// Get from NewtonMetersPerRadianPerMeter. /// /// If value is NaN or Infinity. - public static RotationalStiffnessPerLength FromNewtonMetersPerRadianPerMeter(QuantityValue newtonmetersperradianpermeter) + public static RotationalStiffnessPerLength FromNewtonMetersPerRadianPerMeter(QuantityValue newtonmetersperradianpermeter) { double value = (double) newtonmetersperradianpermeter; - return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter); + return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter); } /// - /// Dynamically convert from value and unit enum to . + /// 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) + /// unit value. + public static RotationalStiffnessPerLength From(QuantityValue value, RotationalStiffnessPerLengthUnit fromUnit) { - return new RotationalStiffnessPerLength((double)value, fromUnit); + return new RotationalStiffnessPerLength((double)value, fromUnit); } #endregion @@ -274,7 +274,7 @@ public static RotationalStiffnessPerLength From(QuantityValue value, RotationalS /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static RotationalStiffnessPerLength Parse(string str) + public static RotationalStiffnessPerLength Parse(string str) { return Parse(str, null); } @@ -302,9 +302,9 @@ public static RotationalStiffnessPerLength Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static RotationalStiffnessPerLength Parse(string str, [CanBeNull] IFormatProvider provider) + public static RotationalStiffnessPerLength Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, RotationalStiffnessPerLengthUnit>( str, provider, From); @@ -318,7 +318,7 @@ public static RotationalStiffnessPerLength Parse(string str, [CanBeNull] IFormat /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out RotationalStiffnessPerLength result) + public static bool TryParse([CanBeNull] string str, out RotationalStiffnessPerLength result) { return TryParse(str, null, out result); } @@ -333,9 +333,9 @@ public static bool TryParse([CanBeNull] string str, out RotationalStiffnessPerLe /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffnessPerLength result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffnessPerLength result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, RotationalStiffnessPerLengthUnit>( str, provider, From, @@ -397,43 +397,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati #region Arithmetic Operators /// Negate the value. - public static RotationalStiffnessPerLength operator -(RotationalStiffnessPerLength right) + public static RotationalStiffnessPerLength operator -(RotationalStiffnessPerLength right) { - return new RotationalStiffnessPerLength(-right.Value, right.Unit); + return new RotationalStiffnessPerLength(-right.Value, right.Unit); } - /// Get from adding two . - public static RotationalStiffnessPerLength operator +(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + /// Get from adding two . + public static RotationalStiffnessPerLength operator +(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { - return new RotationalStiffnessPerLength(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new RotationalStiffnessPerLength(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static RotationalStiffnessPerLength operator -(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + /// Get from subtracting two . + public static RotationalStiffnessPerLength operator -(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { - return new RotationalStiffnessPerLength(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new RotationalStiffnessPerLength(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static RotationalStiffnessPerLength operator *(double left, RotationalStiffnessPerLength right) + /// Get from multiplying value and . + public static RotationalStiffnessPerLength operator *(double left, RotationalStiffnessPerLength right) { - return new RotationalStiffnessPerLength(left * right.Value, right.Unit); + return new RotationalStiffnessPerLength(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static RotationalStiffnessPerLength operator *(RotationalStiffnessPerLength left, double right) + /// Get from multiplying value and . + public static RotationalStiffnessPerLength operator *(RotationalStiffnessPerLength left, double right) { - return new RotationalStiffnessPerLength(left.Value * right, left.Unit); + return new RotationalStiffnessPerLength(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static RotationalStiffnessPerLength operator /(RotationalStiffnessPerLength left, double right) + /// Get from dividing by value. + public static RotationalStiffnessPerLength operator /(RotationalStiffnessPerLength left, double right) { - return new RotationalStiffnessPerLength(left.Value / right, left.Unit); + return new RotationalStiffnessPerLength(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + /// Get ratio value from dividing by . + public static double operator /(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { return left.NewtonMetersPerRadianPerMeter / right.NewtonMetersPerRadianPerMeter; } @@ -443,39 +443,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + public static bool operator <=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + public static bool operator >=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + public static bool operator <(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + public static bool operator >(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { return !(left == right); } @@ -484,37 +484,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalStiffnessPerLength objRotationalStiffnessPerLength)) throw new ArgumentException("Expected type RotationalStiffnessPerLength.", nameof(obj)); + if(!(obj is RotationalStiffnessPerLength objRotationalStiffnessPerLength)) throw new ArgumentException("Expected type RotationalStiffnessPerLength.", nameof(obj)); return CompareTo(objRotationalStiffnessPerLength); } /// - public int CompareTo(RotationalStiffnessPerLength other) + public int CompareTo(RotationalStiffnessPerLength other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is RotationalStiffnessPerLength objRotationalStiffnessPerLength)) + if(obj is null || !(obj is RotationalStiffnessPerLength objRotationalStiffnessPerLength)) return false; return Equals(objRotationalStiffnessPerLength); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(RotationalStiffnessPerLength other) + /// Consider using for safely comparing floating point values. + public bool Equals(RotationalStiffnessPerLength other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another RotationalStiffnessPerLength within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -552,7 +552,7 @@ public bool Equals(RotationalStiffnessPerLength other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(RotationalStiffnessPerLength other, double tolerance, ComparisonType comparisonType) + public bool Equals(RotationalStiffnessPerLength other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -566,7 +566,7 @@ public bool Equals(RotationalStiffnessPerLength other, double tolerance, Compari /// /// Returns the hash code for this instance. /// - /// A hash code for the current RotationalStiffnessPerLength. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -614,13 +614,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this RotationalStiffnessPerLength to another RotationalStiffnessPerLength with the unit representation . + /// Converts this to another with the unit representation . /// - /// A RotationalStiffnessPerLength with the specified unit. - public RotationalStiffnessPerLength ToUnit(RotationalStiffnessPerLengthUnit unit) + /// A with the specified unit. + public RotationalStiffnessPerLength ToUnit(RotationalStiffnessPerLengthUnit unit) { var convertedValue = GetValueAs(unit); - return new RotationalStiffnessPerLength(convertedValue, unit); + return new RotationalStiffnessPerLength(convertedValue, unit); } /// @@ -633,7 +633,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public RotationalStiffnessPerLength ToUnit(UnitSystem unitSystem) + public RotationalStiffnessPerLength ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -678,10 +678,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal RotationalStiffnessPerLength ToBaseUnit() + internal RotationalStiffnessPerLength ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new RotationalStiffnessPerLength(baseUnitValue, BaseUnit); + return new RotationalStiffnessPerLength(baseUnitValue, BaseUnit); } private double GetValueAs(RotationalStiffnessPerLengthUnit unit) @@ -792,7 +792,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -802,12 +802,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -852,16 +852,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(RotationalStiffnessPerLength)) + if(conversionType == typeof(RotationalStiffnessPerLength)) return this; else if(conversionType == typeof(RotationalStiffnessPerLengthUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return RotationalStiffnessPerLength.QuantityType; + return RotationalStiffnessPerLength.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return RotationalStiffnessPerLength.BaseDimensions; + return RotationalStiffnessPerLength.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs index 04b227eef1..4bfa23ec9f 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Solid_angle /// - public partial struct SolidAngle : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct SolidAngle : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -103,19 +103,19 @@ public SolidAngle(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of SolidAngle, which is Steradian. All conversions go via this value. + /// The base unit of , which is Steradian. All conversions go via this value. /// public static SolidAngleUnit BaseUnit { get; } = SolidAngleUnit.Steradian; /// - /// Represents the largest possible value of SolidAngle + /// Represents the largest possible value of /// - public static SolidAngle MaxValue { get; } = new SolidAngle(double.MaxValue, BaseUnit); + public static SolidAngle MaxValue { get; } = new SolidAngle(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of SolidAngle + /// Represents the smallest possible value of /// - public static SolidAngle MinValue { get; } = new SolidAngle(double.MinValue, BaseUnit); + public static SolidAngle MinValue { get; } = new SolidAngle(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -123,14 +123,14 @@ public SolidAngle(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.SolidAngle; /// - /// All units of measurement for the SolidAngle quantity. + /// All units of measurement for the quantity. /// public static SolidAngleUnit[] Units { get; } = Enum.GetValues(typeof(SolidAngleUnit)).Cast().Except(new SolidAngleUnit[]{ SolidAngleUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Steradian. /// - public static SolidAngle Zero { get; } = new SolidAngle(0, BaseUnit); + public static SolidAngle Zero { get; } = new SolidAngle(0, BaseUnit); #endregion @@ -155,19 +155,19 @@ public SolidAngle(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => SolidAngle.QuantityType; + public QuantityType Type => SolidAngle.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => SolidAngle.BaseDimensions; + public BaseDimensions Dimensions => SolidAngle.BaseDimensions; #endregion #region Conversion Properties /// - /// Get SolidAngle in Steradians. + /// Get in Steradians. /// public double Steradians => As(SolidAngleUnit.Steradian); @@ -201,24 +201,24 @@ public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] IFormatPro #region Static Factory Methods /// - /// Get SolidAngle from Steradians. + /// Get from Steradians. /// /// If value is NaN or Infinity. - public static SolidAngle FromSteradians(QuantityValue steradians) + public static SolidAngle FromSteradians(QuantityValue steradians) { double value = (double) steradians; - return new SolidAngle(value, SolidAngleUnit.Steradian); + return new SolidAngle(value, SolidAngleUnit.Steradian); } /// - /// Dynamically convert from value and unit enum to . + /// 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) + /// unit value. + public static SolidAngle From(QuantityValue value, SolidAngleUnit fromUnit) { - return new SolidAngle((double)value, fromUnit); + return new SolidAngle((double)value, fromUnit); } #endregion @@ -247,7 +247,7 @@ public static SolidAngle From(QuantityValue value, SolidAngleUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static SolidAngle Parse(string str) + public static SolidAngle Parse(string str) { return Parse(str, null); } @@ -275,9 +275,9 @@ public static SolidAngle Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static SolidAngle Parse(string str, [CanBeNull] IFormatProvider provider) + public static SolidAngle Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, SolidAngleUnit>( str, provider, From); @@ -291,7 +291,7 @@ public static SolidAngle Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out SolidAngle result) + public static bool TryParse([CanBeNull] string str, out SolidAngle result) { return TryParse(str, null, out result); } @@ -306,9 +306,9 @@ public static bool TryParse([CanBeNull] string str, out SolidAngle result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SolidAngle result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SolidAngle result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, SolidAngleUnit>( str, provider, From, @@ -370,43 +370,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out SolidA #region Arithmetic Operators /// Negate the value. - public static SolidAngle operator -(SolidAngle right) + public static SolidAngle operator -(SolidAngle right) { - return new SolidAngle(-right.Value, right.Unit); + return new SolidAngle(-right.Value, right.Unit); } - /// Get from adding two . - public static SolidAngle operator +(SolidAngle left, SolidAngle right) + /// Get from adding two . + public static SolidAngle operator +(SolidAngle left, SolidAngle right) { - return new SolidAngle(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new SolidAngle(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static SolidAngle operator -(SolidAngle left, SolidAngle right) + /// Get from subtracting two . + public static SolidAngle operator -(SolidAngle left, SolidAngle right) { - return new SolidAngle(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new SolidAngle(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static SolidAngle operator *(double left, SolidAngle right) + /// Get from multiplying value and . + public static SolidAngle operator *(double left, SolidAngle right) { - return new SolidAngle(left * right.Value, right.Unit); + return new SolidAngle(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static SolidAngle operator *(SolidAngle left, double right) + /// Get from multiplying value and . + public static SolidAngle operator *(SolidAngle left, double right) { - return new SolidAngle(left.Value * right, left.Unit); + return new SolidAngle(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static SolidAngle operator /(SolidAngle left, double right) + /// Get from dividing by value. + public static SolidAngle operator /(SolidAngle left, double right) { - return new SolidAngle(left.Value / right, left.Unit); + return new SolidAngle(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(SolidAngle left, SolidAngle right) + /// Get ratio value from dividing by . + public static double operator /(SolidAngle left, SolidAngle right) { return left.Steradians / right.Steradians; } @@ -416,39 +416,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out SolidA #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(SolidAngle left, SolidAngle right) + public static bool operator <=(SolidAngle left, SolidAngle right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(SolidAngle left, SolidAngle right) + public static bool operator >=(SolidAngle left, SolidAngle right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(SolidAngle left, SolidAngle right) + public static bool operator <(SolidAngle left, SolidAngle right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(SolidAngle left, SolidAngle right) + public static bool operator >(SolidAngle left, SolidAngle right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(SolidAngle left, SolidAngle right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(SolidAngle left, SolidAngle right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(SolidAngle left, SolidAngle right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(SolidAngle left, SolidAngle right) { return !(left == right); } @@ -457,37 +457,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out SolidA public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SolidAngle objSolidAngle)) throw new ArgumentException("Expected type SolidAngle.", nameof(obj)); + if(!(obj is SolidAngle objSolidAngle)) throw new ArgumentException("Expected type SolidAngle.", nameof(obj)); return CompareTo(objSolidAngle); } /// - public int CompareTo(SolidAngle other) + public int CompareTo(SolidAngle other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is SolidAngle objSolidAngle)) + if(obj is null || !(obj is SolidAngle objSolidAngle)) return false; return Equals(objSolidAngle); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(SolidAngle other) + /// Consider using for safely comparing floating point values. + public bool Equals(SolidAngle other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another SolidAngle within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -525,7 +525,7 @@ public bool Equals(SolidAngle other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(SolidAngle other, double tolerance, ComparisonType comparisonType) + public bool Equals(SolidAngle other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -539,7 +539,7 @@ public bool Equals(SolidAngle other, double tolerance, ComparisonType comparison /// /// Returns the hash code for this instance. /// - /// A hash code for the current SolidAngle. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -587,13 +587,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this SolidAngle to another SolidAngle with the unit representation . + /// Converts this to another with the unit representation . /// - /// A SolidAngle with the specified unit. - public SolidAngle ToUnit(SolidAngleUnit unit) + /// A with the specified unit. + public SolidAngle ToUnit(SolidAngleUnit unit) { var convertedValue = GetValueAs(unit); - return new SolidAngle(convertedValue, unit); + return new SolidAngle(convertedValue, unit); } /// @@ -606,7 +606,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public SolidAngle ToUnit(UnitSystem unitSystem) + public SolidAngle ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -649,10 +649,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal SolidAngle ToBaseUnit() + internal SolidAngle ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new SolidAngle(baseUnitValue, BaseUnit); + return new SolidAngle(baseUnitValue, BaseUnit); } private double GetValueAs(SolidAngleUnit unit) @@ -761,7 +761,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(SolidAngle)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(SolidAngle)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -771,12 +771,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(SolidAngle)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(SolidAngle)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(SolidAngle)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(SolidAngle)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -821,16 +821,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(SolidAngle)) + if(conversionType == typeof(SolidAngle)) return this; else if(conversionType == typeof(SolidAngleUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return SolidAngle.QuantityType; + return SolidAngle.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return SolidAngle.BaseDimensions; + return SolidAngle.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(SolidAngle)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(SolidAngle)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs index a6ba9a3e25..a11868030f 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Specific_energy /// - public partial struct SpecificEnergy : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct SpecificEnergy : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -111,19 +111,19 @@ public SpecificEnergy(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of SpecificEnergy, which is JoulePerKilogram. All conversions go via this value. + /// The base unit of , which is JoulePerKilogram. All conversions go via this value. /// public static SpecificEnergyUnit BaseUnit { get; } = SpecificEnergyUnit.JoulePerKilogram; /// - /// Represents the largest possible value of SpecificEnergy + /// Represents the largest possible value of /// - public static SpecificEnergy MaxValue { get; } = new SpecificEnergy(double.MaxValue, BaseUnit); + public static SpecificEnergy MaxValue { get; } = new SpecificEnergy(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of SpecificEnergy + /// Represents the smallest possible value of /// - public static SpecificEnergy MinValue { get; } = new SpecificEnergy(double.MinValue, BaseUnit); + public static SpecificEnergy MinValue { get; } = new SpecificEnergy(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -131,14 +131,14 @@ public SpecificEnergy(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.SpecificEnergy; /// - /// All units of measurement for the SpecificEnergy quantity. + /// All units of measurement for the quantity. /// public static SpecificEnergyUnit[] Units { get; } = Enum.GetValues(typeof(SpecificEnergyUnit)).Cast().Except(new SpecificEnergyUnit[]{ SpecificEnergyUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKilogram. /// - public static SpecificEnergy Zero { get; } = new SpecificEnergy(0, BaseUnit); + public static SpecificEnergy Zero { get; } = new SpecificEnergy(0, BaseUnit); #endregion @@ -163,59 +163,59 @@ public SpecificEnergy(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => SpecificEnergy.QuantityType; + public QuantityType Type => SpecificEnergy.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => SpecificEnergy.BaseDimensions; + public BaseDimensions Dimensions => SpecificEnergy.BaseDimensions; #endregion #region Conversion Properties /// - /// Get SpecificEnergy in BtuPerPound. + /// Get in BtuPerPound. /// public double BtuPerPound => As(SpecificEnergyUnit.BtuPerPound); /// - /// Get SpecificEnergy in CaloriesPerGram. + /// Get in CaloriesPerGram. /// public double CaloriesPerGram => As(SpecificEnergyUnit.CaloriePerGram); /// - /// Get SpecificEnergy in JoulesPerKilogram. + /// Get in JoulesPerKilogram. /// public double JoulesPerKilogram => As(SpecificEnergyUnit.JoulePerKilogram); /// - /// Get SpecificEnergy in KilocaloriesPerGram. + /// Get in KilocaloriesPerGram. /// public double KilocaloriesPerGram => As(SpecificEnergyUnit.KilocaloriePerGram); /// - /// Get SpecificEnergy in KilojoulesPerKilogram. + /// Get in KilojoulesPerKilogram. /// public double KilojoulesPerKilogram => As(SpecificEnergyUnit.KilojoulePerKilogram); /// - /// Get SpecificEnergy in KilowattHoursPerKilogram. + /// Get in KilowattHoursPerKilogram. /// public double KilowattHoursPerKilogram => As(SpecificEnergyUnit.KilowattHourPerKilogram); /// - /// Get SpecificEnergy in MegajoulesPerKilogram. + /// Get in MegajoulesPerKilogram. /// public double MegajoulesPerKilogram => As(SpecificEnergyUnit.MegajoulePerKilogram); /// - /// Get SpecificEnergy in MegawattHoursPerKilogram. + /// Get in MegawattHoursPerKilogram. /// public double MegawattHoursPerKilogram => As(SpecificEnergyUnit.MegawattHourPerKilogram); /// - /// Get SpecificEnergy in WattHoursPerKilogram. + /// Get in WattHoursPerKilogram. /// public double WattHoursPerKilogram => As(SpecificEnergyUnit.WattHourPerKilogram); @@ -249,96 +249,96 @@ public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] IForma #region Static Factory Methods /// - /// Get SpecificEnergy from BtuPerPound. + /// Get from BtuPerPound. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromBtuPerPound(QuantityValue btuperpound) + public static SpecificEnergy FromBtuPerPound(QuantityValue btuperpound) { double value = (double) btuperpound; - return new SpecificEnergy(value, SpecificEnergyUnit.BtuPerPound); + return new SpecificEnergy(value, SpecificEnergyUnit.BtuPerPound); } /// - /// Get SpecificEnergy from CaloriesPerGram. + /// Get from CaloriesPerGram. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromCaloriesPerGram(QuantityValue caloriespergram) + public static SpecificEnergy FromCaloriesPerGram(QuantityValue caloriespergram) { double value = (double) caloriespergram; - return new SpecificEnergy(value, SpecificEnergyUnit.CaloriePerGram); + return new SpecificEnergy(value, SpecificEnergyUnit.CaloriePerGram); } /// - /// Get SpecificEnergy from JoulesPerKilogram. + /// Get from JoulesPerKilogram. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromJoulesPerKilogram(QuantityValue joulesperkilogram) + public static SpecificEnergy FromJoulesPerKilogram(QuantityValue joulesperkilogram) { double value = (double) joulesperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.JoulePerKilogram); + return new SpecificEnergy(value, SpecificEnergyUnit.JoulePerKilogram); } /// - /// Get SpecificEnergy from KilocaloriesPerGram. + /// Get from KilocaloriesPerGram. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromKilocaloriesPerGram(QuantityValue kilocaloriespergram) + public static SpecificEnergy FromKilocaloriesPerGram(QuantityValue kilocaloriespergram) { double value = (double) kilocaloriespergram; - return new SpecificEnergy(value, SpecificEnergyUnit.KilocaloriePerGram); + return new SpecificEnergy(value, SpecificEnergyUnit.KilocaloriePerGram); } /// - /// Get SpecificEnergy from KilojoulesPerKilogram. + /// Get from KilojoulesPerKilogram. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromKilojoulesPerKilogram(QuantityValue kilojoulesperkilogram) + public static SpecificEnergy FromKilojoulesPerKilogram(QuantityValue kilojoulesperkilogram) { double value = (double) kilojoulesperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.KilojoulePerKilogram); + return new SpecificEnergy(value, SpecificEnergyUnit.KilojoulePerKilogram); } /// - /// Get SpecificEnergy from KilowattHoursPerKilogram. + /// Get from KilowattHoursPerKilogram. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromKilowattHoursPerKilogram(QuantityValue kilowatthoursperkilogram) + public static SpecificEnergy FromKilowattHoursPerKilogram(QuantityValue kilowatthoursperkilogram) { double value = (double) kilowatthoursperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.KilowattHourPerKilogram); + return new SpecificEnergy(value, SpecificEnergyUnit.KilowattHourPerKilogram); } /// - /// Get SpecificEnergy from MegajoulesPerKilogram. + /// Get from MegajoulesPerKilogram. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromMegajoulesPerKilogram(QuantityValue megajoulesperkilogram) + public static SpecificEnergy FromMegajoulesPerKilogram(QuantityValue megajoulesperkilogram) { double value = (double) megajoulesperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.MegajoulePerKilogram); + return new SpecificEnergy(value, SpecificEnergyUnit.MegajoulePerKilogram); } /// - /// Get SpecificEnergy from MegawattHoursPerKilogram. + /// Get from MegawattHoursPerKilogram. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromMegawattHoursPerKilogram(QuantityValue megawatthoursperkilogram) + public static SpecificEnergy FromMegawattHoursPerKilogram(QuantityValue megawatthoursperkilogram) { double value = (double) megawatthoursperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.MegawattHourPerKilogram); + return new SpecificEnergy(value, SpecificEnergyUnit.MegawattHourPerKilogram); } /// - /// Get SpecificEnergy from WattHoursPerKilogram. + /// Get from WattHoursPerKilogram. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromWattHoursPerKilogram(QuantityValue watthoursperkilogram) + public static SpecificEnergy FromWattHoursPerKilogram(QuantityValue watthoursperkilogram) { double value = (double) watthoursperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.WattHourPerKilogram); + return new SpecificEnergy(value, SpecificEnergyUnit.WattHourPerKilogram); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// SpecificEnergy unit value. - public static SpecificEnergy From(QuantityValue value, SpecificEnergyUnit fromUnit) + /// unit value. + public static SpecificEnergy From(QuantityValue value, SpecificEnergyUnit fromUnit) { - return new SpecificEnergy((double)value, fromUnit); + return new SpecificEnergy((double)value, fromUnit); } #endregion @@ -367,7 +367,7 @@ public static SpecificEnergy From(QuantityValue value, SpecificEnergyUnit fromUn /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static SpecificEnergy Parse(string str) + public static SpecificEnergy Parse(string str) { return Parse(str, null); } @@ -395,9 +395,9 @@ public static SpecificEnergy Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static SpecificEnergy Parse(string str, [CanBeNull] IFormatProvider provider) + public static SpecificEnergy Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, SpecificEnergyUnit>( str, provider, From); @@ -411,7 +411,7 @@ public static SpecificEnergy Parse(string str, [CanBeNull] IFormatProvider provi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out SpecificEnergy result) + public static bool TryParse([CanBeNull] string str, out SpecificEnergy result) { return TryParse(str, null, out result); } @@ -426,9 +426,9 @@ public static bool TryParse([CanBeNull] string str, out SpecificEnergy result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEnergy result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEnergy result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, SpecificEnergyUnit>( str, provider, From, @@ -490,43 +490,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif #region Arithmetic Operators /// Negate the value. - public static SpecificEnergy operator -(SpecificEnergy right) + public static SpecificEnergy operator -(SpecificEnergy right) { - return new SpecificEnergy(-right.Value, right.Unit); + return new SpecificEnergy(-right.Value, right.Unit); } - /// Get from adding two . - public static SpecificEnergy operator +(SpecificEnergy left, SpecificEnergy right) + /// Get from adding two . + public static SpecificEnergy operator +(SpecificEnergy left, SpecificEnergy right) { - return new SpecificEnergy(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new SpecificEnergy(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static SpecificEnergy operator -(SpecificEnergy left, SpecificEnergy right) + /// Get from subtracting two . + public static SpecificEnergy operator -(SpecificEnergy left, SpecificEnergy right) { - return new SpecificEnergy(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new SpecificEnergy(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static SpecificEnergy operator *(double left, SpecificEnergy right) + /// Get from multiplying value and . + public static SpecificEnergy operator *(double left, SpecificEnergy right) { - return new SpecificEnergy(left * right.Value, right.Unit); + return new SpecificEnergy(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static SpecificEnergy operator *(SpecificEnergy left, double right) + /// Get from multiplying value and . + public static SpecificEnergy operator *(SpecificEnergy left, double right) { - return new SpecificEnergy(left.Value * right, left.Unit); + return new SpecificEnergy(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static SpecificEnergy operator /(SpecificEnergy left, double right) + /// Get from dividing by value. + public static SpecificEnergy operator /(SpecificEnergy left, double right) { - return new SpecificEnergy(left.Value / right, left.Unit); + return new SpecificEnergy(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(SpecificEnergy left, SpecificEnergy right) + /// Get ratio value from dividing by . + public static double operator /(SpecificEnergy left, SpecificEnergy right) { return left.JoulesPerKilogram / right.JoulesPerKilogram; } @@ -536,39 +536,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(SpecificEnergy left, SpecificEnergy right) + public static bool operator <=(SpecificEnergy left, SpecificEnergy right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(SpecificEnergy left, SpecificEnergy right) + public static bool operator >=(SpecificEnergy left, SpecificEnergy right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(SpecificEnergy left, SpecificEnergy right) + public static bool operator <(SpecificEnergy left, SpecificEnergy right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(SpecificEnergy left, SpecificEnergy right) + public static bool operator >(SpecificEnergy left, SpecificEnergy right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(SpecificEnergy left, SpecificEnergy right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(SpecificEnergy left, SpecificEnergy right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(SpecificEnergy left, SpecificEnergy right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(SpecificEnergy left, SpecificEnergy right) { return !(left == right); } @@ -577,37 +577,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificEnergy objSpecificEnergy)) throw new ArgumentException("Expected type SpecificEnergy.", nameof(obj)); + if(!(obj is SpecificEnergy objSpecificEnergy)) throw new ArgumentException("Expected type SpecificEnergy.", nameof(obj)); return CompareTo(objSpecificEnergy); } /// - public int CompareTo(SpecificEnergy other) + public int CompareTo(SpecificEnergy other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is SpecificEnergy objSpecificEnergy)) + if(obj is null || !(obj is SpecificEnergy objSpecificEnergy)) return false; return Equals(objSpecificEnergy); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(SpecificEnergy other) + /// Consider using for safely comparing floating point values. + public bool Equals(SpecificEnergy other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another SpecificEnergy within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -645,7 +645,7 @@ public bool Equals(SpecificEnergy other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(SpecificEnergy other, double tolerance, ComparisonType comparisonType) + public bool Equals(SpecificEnergy other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -659,7 +659,7 @@ public bool Equals(SpecificEnergy other, double tolerance, ComparisonType compar /// /// Returns the hash code for this instance. /// - /// A hash code for the current SpecificEnergy. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -707,13 +707,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this SpecificEnergy to another SpecificEnergy with the unit representation . + /// Converts this to another with the unit representation . /// - /// A SpecificEnergy with the specified unit. - public SpecificEnergy ToUnit(SpecificEnergyUnit unit) + /// A with the specified unit. + public SpecificEnergy ToUnit(SpecificEnergyUnit unit) { var convertedValue = GetValueAs(unit); - return new SpecificEnergy(convertedValue, unit); + return new SpecificEnergy(convertedValue, unit); } /// @@ -726,7 +726,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public SpecificEnergy ToUnit(UnitSystem unitSystem) + public SpecificEnergy ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -777,10 +777,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal SpecificEnergy ToBaseUnit() + internal SpecificEnergy ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new SpecificEnergy(baseUnitValue, BaseUnit); + return new SpecificEnergy(baseUnitValue, BaseUnit); } private double GetValueAs(SpecificEnergyUnit unit) @@ -897,7 +897,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -907,12 +907,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -957,16 +957,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(SpecificEnergy)) + if(conversionType == typeof(SpecificEnergy)) return this; else if(conversionType == typeof(SpecificEnergyUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return SpecificEnergy.QuantityType; + return SpecificEnergy.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return SpecificEnergy.BaseDimensions; + return SpecificEnergy.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs index 09b8255e69..b2d770a772 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Specific entropy is an amount of energy required to raise temperature of a substance by 1 Kelvin per unit mass. /// - public partial struct SpecificEntropy : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct SpecificEntropy : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -108,19 +108,19 @@ public SpecificEntropy(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of SpecificEntropy, which is JoulePerKilogramKelvin. All conversions go via this value. + /// The base unit of , which is JoulePerKilogramKelvin. All conversions go via this value. /// public static SpecificEntropyUnit BaseUnit { get; } = SpecificEntropyUnit.JoulePerKilogramKelvin; /// - /// Represents the largest possible value of SpecificEntropy + /// Represents the largest possible value of /// - public static SpecificEntropy MaxValue { get; } = new SpecificEntropy(double.MaxValue, BaseUnit); + public static SpecificEntropy MaxValue { get; } = new SpecificEntropy(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of SpecificEntropy + /// Represents the smallest possible value of /// - public static SpecificEntropy MinValue { get; } = new SpecificEntropy(double.MinValue, BaseUnit); + public static SpecificEntropy MinValue { get; } = new SpecificEntropy(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,14 +128,14 @@ public SpecificEntropy(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.SpecificEntropy; /// - /// All units of measurement for the SpecificEntropy quantity. + /// All units of measurement for the quantity. /// public static SpecificEntropyUnit[] Units { get; } = Enum.GetValues(typeof(SpecificEntropyUnit)).Cast().Except(new SpecificEntropyUnit[]{ SpecificEntropyUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKilogramKelvin. /// - public static SpecificEntropy Zero { get; } = new SpecificEntropy(0, BaseUnit); + public static SpecificEntropy Zero { get; } = new SpecificEntropy(0, BaseUnit); #endregion @@ -160,59 +160,59 @@ public SpecificEntropy(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => SpecificEntropy.QuantityType; + public QuantityType Type => SpecificEntropy.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => SpecificEntropy.BaseDimensions; + public BaseDimensions Dimensions => SpecificEntropy.BaseDimensions; #endregion #region Conversion Properties /// - /// Get SpecificEntropy in BtusPerPoundFahrenheit. + /// Get in BtusPerPoundFahrenheit. /// public double BtusPerPoundFahrenheit => As(SpecificEntropyUnit.BtuPerPoundFahrenheit); /// - /// Get SpecificEntropy in CaloriesPerGramKelvin. + /// Get in CaloriesPerGramKelvin. /// public double CaloriesPerGramKelvin => As(SpecificEntropyUnit.CaloriePerGramKelvin); /// - /// Get SpecificEntropy in JoulesPerKilogramDegreeCelsius. + /// Get in JoulesPerKilogramDegreeCelsius. /// public double JoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.JoulePerKilogramDegreeCelsius); /// - /// Get SpecificEntropy in JoulesPerKilogramKelvin. + /// Get in JoulesPerKilogramKelvin. /// public double JoulesPerKilogramKelvin => As(SpecificEntropyUnit.JoulePerKilogramKelvin); /// - /// Get SpecificEntropy in KilocaloriesPerGramKelvin. + /// Get in KilocaloriesPerGramKelvin. /// public double KilocaloriesPerGramKelvin => As(SpecificEntropyUnit.KilocaloriePerGramKelvin); /// - /// Get SpecificEntropy in KilojoulesPerKilogramDegreeCelsius. + /// Get in KilojoulesPerKilogramDegreeCelsius. /// public double KilojoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius); /// - /// Get SpecificEntropy in KilojoulesPerKilogramKelvin. + /// Get in KilojoulesPerKilogramKelvin. /// public double KilojoulesPerKilogramKelvin => As(SpecificEntropyUnit.KilojoulePerKilogramKelvin); /// - /// Get SpecificEntropy in MegajoulesPerKilogramDegreeCelsius. + /// Get in MegajoulesPerKilogramDegreeCelsius. /// public double MegajoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius); /// - /// Get SpecificEntropy in MegajoulesPerKilogramKelvin. + /// Get in MegajoulesPerKilogramKelvin. /// public double MegajoulesPerKilogramKelvin => As(SpecificEntropyUnit.MegajoulePerKilogramKelvin); @@ -246,96 +246,96 @@ public static string GetAbbreviation(SpecificEntropyUnit unit, [CanBeNull] IForm #region Static Factory Methods /// - /// Get SpecificEntropy from BtusPerPoundFahrenheit. + /// Get from BtusPerPoundFahrenheit. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromBtusPerPoundFahrenheit(QuantityValue btusperpoundfahrenheit) + public static SpecificEntropy FromBtusPerPoundFahrenheit(QuantityValue btusperpoundfahrenheit) { double value = (double) btusperpoundfahrenheit; - return new SpecificEntropy(value, SpecificEntropyUnit.BtuPerPoundFahrenheit); + return new SpecificEntropy(value, SpecificEntropyUnit.BtuPerPoundFahrenheit); } /// - /// Get SpecificEntropy from CaloriesPerGramKelvin. + /// Get from CaloriesPerGramKelvin. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromCaloriesPerGramKelvin(QuantityValue caloriespergramkelvin) + public static SpecificEntropy FromCaloriesPerGramKelvin(QuantityValue caloriespergramkelvin) { double value = (double) caloriespergramkelvin; - return new SpecificEntropy(value, SpecificEntropyUnit.CaloriePerGramKelvin); + return new SpecificEntropy(value, SpecificEntropyUnit.CaloriePerGramKelvin); } /// - /// Get SpecificEntropy from JoulesPerKilogramDegreeCelsius. + /// Get from JoulesPerKilogramDegreeCelsius. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromJoulesPerKilogramDegreeCelsius(QuantityValue joulesperkilogramdegreecelsius) + public static SpecificEntropy FromJoulesPerKilogramDegreeCelsius(QuantityValue joulesperkilogramdegreecelsius) { double value = (double) joulesperkilogramdegreecelsius; - return new SpecificEntropy(value, SpecificEntropyUnit.JoulePerKilogramDegreeCelsius); + return new SpecificEntropy(value, SpecificEntropyUnit.JoulePerKilogramDegreeCelsius); } /// - /// Get SpecificEntropy from JoulesPerKilogramKelvin. + /// Get from JoulesPerKilogramKelvin. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromJoulesPerKilogramKelvin(QuantityValue joulesperkilogramkelvin) + public static SpecificEntropy FromJoulesPerKilogramKelvin(QuantityValue joulesperkilogramkelvin) { double value = (double) joulesperkilogramkelvin; - return new SpecificEntropy(value, SpecificEntropyUnit.JoulePerKilogramKelvin); + return new SpecificEntropy(value, SpecificEntropyUnit.JoulePerKilogramKelvin); } /// - /// Get SpecificEntropy from KilocaloriesPerGramKelvin. + /// Get from KilocaloriesPerGramKelvin. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromKilocaloriesPerGramKelvin(QuantityValue kilocaloriespergramkelvin) + public static SpecificEntropy FromKilocaloriesPerGramKelvin(QuantityValue kilocaloriespergramkelvin) { double value = (double) kilocaloriespergramkelvin; - return new SpecificEntropy(value, SpecificEntropyUnit.KilocaloriePerGramKelvin); + return new SpecificEntropy(value, SpecificEntropyUnit.KilocaloriePerGramKelvin); } /// - /// Get SpecificEntropy from KilojoulesPerKilogramDegreeCelsius. + /// Get from KilojoulesPerKilogramDegreeCelsius. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromKilojoulesPerKilogramDegreeCelsius(QuantityValue kilojoulesperkilogramdegreecelsius) + public static SpecificEntropy FromKilojoulesPerKilogramDegreeCelsius(QuantityValue kilojoulesperkilogramdegreecelsius) { double value = (double) kilojoulesperkilogramdegreecelsius; - return new SpecificEntropy(value, SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius); + return new SpecificEntropy(value, SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius); } /// - /// Get SpecificEntropy from KilojoulesPerKilogramKelvin. + /// Get from KilojoulesPerKilogramKelvin. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromKilojoulesPerKilogramKelvin(QuantityValue kilojoulesperkilogramkelvin) + public static SpecificEntropy FromKilojoulesPerKilogramKelvin(QuantityValue kilojoulesperkilogramkelvin) { double value = (double) kilojoulesperkilogramkelvin; - return new SpecificEntropy(value, SpecificEntropyUnit.KilojoulePerKilogramKelvin); + return new SpecificEntropy(value, SpecificEntropyUnit.KilojoulePerKilogramKelvin); } /// - /// Get SpecificEntropy from MegajoulesPerKilogramDegreeCelsius. + /// Get from MegajoulesPerKilogramDegreeCelsius. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromMegajoulesPerKilogramDegreeCelsius(QuantityValue megajoulesperkilogramdegreecelsius) + public static SpecificEntropy FromMegajoulesPerKilogramDegreeCelsius(QuantityValue megajoulesperkilogramdegreecelsius) { double value = (double) megajoulesperkilogramdegreecelsius; - return new SpecificEntropy(value, SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius); + return new SpecificEntropy(value, SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius); } /// - /// Get SpecificEntropy from MegajoulesPerKilogramKelvin. + /// Get from MegajoulesPerKilogramKelvin. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromMegajoulesPerKilogramKelvin(QuantityValue megajoulesperkilogramkelvin) + public static SpecificEntropy FromMegajoulesPerKilogramKelvin(QuantityValue megajoulesperkilogramkelvin) { double value = (double) megajoulesperkilogramkelvin; - return new SpecificEntropy(value, SpecificEntropyUnit.MegajoulePerKilogramKelvin); + return new SpecificEntropy(value, SpecificEntropyUnit.MegajoulePerKilogramKelvin); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// SpecificEntropy unit value. - public static SpecificEntropy From(QuantityValue value, SpecificEntropyUnit fromUnit) + /// unit value. + public static SpecificEntropy From(QuantityValue value, SpecificEntropyUnit fromUnit) { - return new SpecificEntropy((double)value, fromUnit); + return new SpecificEntropy((double)value, fromUnit); } #endregion @@ -364,7 +364,7 @@ public static SpecificEntropy From(QuantityValue value, SpecificEntropyUnit from /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static SpecificEntropy Parse(string str) + public static SpecificEntropy Parse(string str) { return Parse(str, null); } @@ -392,9 +392,9 @@ public static SpecificEntropy Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static SpecificEntropy Parse(string str, [CanBeNull] IFormatProvider provider) + public static SpecificEntropy Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, SpecificEntropyUnit>( str, provider, From); @@ -408,7 +408,7 @@ public static SpecificEntropy Parse(string str, [CanBeNull] IFormatProvider prov /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out SpecificEntropy result) + public static bool TryParse([CanBeNull] string str, out SpecificEntropy result) { return TryParse(str, null, out result); } @@ -423,9 +423,9 @@ public static bool TryParse([CanBeNull] string str, out SpecificEntropy result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEntropy result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEntropy result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, SpecificEntropyUnit>( str, provider, From, @@ -487,43 +487,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif #region Arithmetic Operators /// Negate the value. - public static SpecificEntropy operator -(SpecificEntropy right) + public static SpecificEntropy operator -(SpecificEntropy right) { - return new SpecificEntropy(-right.Value, right.Unit); + return new SpecificEntropy(-right.Value, right.Unit); } - /// Get from adding two . - public static SpecificEntropy operator +(SpecificEntropy left, SpecificEntropy right) + /// Get from adding two . + public static SpecificEntropy operator +(SpecificEntropy left, SpecificEntropy right) { - return new SpecificEntropy(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new SpecificEntropy(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static SpecificEntropy operator -(SpecificEntropy left, SpecificEntropy right) + /// Get from subtracting two . + public static SpecificEntropy operator -(SpecificEntropy left, SpecificEntropy right) { - return new SpecificEntropy(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new SpecificEntropy(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static SpecificEntropy operator *(double left, SpecificEntropy right) + /// Get from multiplying value and . + public static SpecificEntropy operator *(double left, SpecificEntropy right) { - return new SpecificEntropy(left * right.Value, right.Unit); + return new SpecificEntropy(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static SpecificEntropy operator *(SpecificEntropy left, double right) + /// Get from multiplying value and . + public static SpecificEntropy operator *(SpecificEntropy left, double right) { - return new SpecificEntropy(left.Value * right, left.Unit); + return new SpecificEntropy(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static SpecificEntropy operator /(SpecificEntropy left, double right) + /// Get from dividing by value. + public static SpecificEntropy operator /(SpecificEntropy left, double right) { - return new SpecificEntropy(left.Value / right, left.Unit); + return new SpecificEntropy(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(SpecificEntropy left, SpecificEntropy right) + /// Get ratio value from dividing by . + public static double operator /(SpecificEntropy left, SpecificEntropy right) { return left.JoulesPerKilogramKelvin / right.JoulesPerKilogramKelvin; } @@ -533,39 +533,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(SpecificEntropy left, SpecificEntropy right) + public static bool operator <=(SpecificEntropy left, SpecificEntropy right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(SpecificEntropy left, SpecificEntropy right) + public static bool operator >=(SpecificEntropy left, SpecificEntropy right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(SpecificEntropy left, SpecificEntropy right) + public static bool operator <(SpecificEntropy left, SpecificEntropy right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(SpecificEntropy left, SpecificEntropy right) + public static bool operator >(SpecificEntropy left, SpecificEntropy right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(SpecificEntropy left, SpecificEntropy right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(SpecificEntropy left, SpecificEntropy right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(SpecificEntropy left, SpecificEntropy right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(SpecificEntropy left, SpecificEntropy right) { return !(left == right); } @@ -574,37 +574,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificEntropy objSpecificEntropy)) throw new ArgumentException("Expected type SpecificEntropy.", nameof(obj)); + if(!(obj is SpecificEntropy objSpecificEntropy)) throw new ArgumentException("Expected type SpecificEntropy.", nameof(obj)); return CompareTo(objSpecificEntropy); } /// - public int CompareTo(SpecificEntropy other) + public int CompareTo(SpecificEntropy other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is SpecificEntropy objSpecificEntropy)) + if(obj is null || !(obj is SpecificEntropy objSpecificEntropy)) return false; return Equals(objSpecificEntropy); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(SpecificEntropy other) + /// Consider using for safely comparing floating point values. + public bool Equals(SpecificEntropy other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another SpecificEntropy within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -642,7 +642,7 @@ public bool Equals(SpecificEntropy other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(SpecificEntropy other, double tolerance, ComparisonType comparisonType) + public bool Equals(SpecificEntropy other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -656,7 +656,7 @@ public bool Equals(SpecificEntropy other, double tolerance, ComparisonType compa /// /// Returns the hash code for this instance. /// - /// A hash code for the current SpecificEntropy. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -704,13 +704,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this SpecificEntropy to another SpecificEntropy with the unit representation . + /// Converts this to another with the unit representation . /// - /// A SpecificEntropy with the specified unit. - public SpecificEntropy ToUnit(SpecificEntropyUnit unit) + /// A with the specified unit. + public SpecificEntropy ToUnit(SpecificEntropyUnit unit) { var convertedValue = GetValueAs(unit); - return new SpecificEntropy(convertedValue, unit); + return new SpecificEntropy(convertedValue, unit); } /// @@ -723,7 +723,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public SpecificEntropy ToUnit(UnitSystem unitSystem) + public SpecificEntropy ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -774,10 +774,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal SpecificEntropy ToBaseUnit() + internal SpecificEntropy ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new SpecificEntropy(baseUnitValue, BaseUnit); + return new SpecificEntropy(baseUnitValue, BaseUnit); } private double GetValueAs(SpecificEntropyUnit unit) @@ -894,7 +894,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -904,12 +904,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -954,16 +954,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(SpecificEntropy)) + if(conversionType == typeof(SpecificEntropy)) return this; else if(conversionType == typeof(SpecificEntropyUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return SpecificEntropy.QuantityType; + return SpecificEntropy.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return SpecificEntropy.BaseDimensions; + return SpecificEntropy.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs index b9dae762c0..a28109c12c 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// In thermodynamics, the specific volume of a substance is the ratio of the substance's volume to its mass. It is the reciprocal of density and an intrinsic property of matter as well. /// - public partial struct SpecificVolume : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct SpecificVolume : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -102,19 +102,19 @@ public SpecificVolume(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of SpecificVolume, which is CubicMeterPerKilogram. All conversions go via this value. + /// The base unit of , which is CubicMeterPerKilogram. All conversions go via this value. /// public static SpecificVolumeUnit BaseUnit { get; } = SpecificVolumeUnit.CubicMeterPerKilogram; /// - /// Represents the largest possible value of SpecificVolume + /// Represents the largest possible value of /// - public static SpecificVolume MaxValue { get; } = new SpecificVolume(double.MaxValue, BaseUnit); + public static SpecificVolume MaxValue { get; } = new SpecificVolume(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of SpecificVolume + /// Represents the smallest possible value of /// - public static SpecificVolume MinValue { get; } = new SpecificVolume(double.MinValue, BaseUnit); + public static SpecificVolume MinValue { get; } = new SpecificVolume(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -122,14 +122,14 @@ public SpecificVolume(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.SpecificVolume; /// - /// All units of measurement for the SpecificVolume quantity. + /// All units of measurement for the quantity. /// public static SpecificVolumeUnit[] Units { get; } = Enum.GetValues(typeof(SpecificVolumeUnit)).Cast().Except(new SpecificVolumeUnit[]{ SpecificVolumeUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerKilogram. /// - public static SpecificVolume Zero { get; } = new SpecificVolume(0, BaseUnit); + public static SpecificVolume Zero { get; } = new SpecificVolume(0, BaseUnit); #endregion @@ -154,29 +154,29 @@ public SpecificVolume(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => SpecificVolume.QuantityType; + public QuantityType Type => SpecificVolume.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => SpecificVolume.BaseDimensions; + public BaseDimensions Dimensions => SpecificVolume.BaseDimensions; #endregion #region Conversion Properties /// - /// Get SpecificVolume in CubicFeetPerPound. + /// Get in CubicFeetPerPound. /// public double CubicFeetPerPound => As(SpecificVolumeUnit.CubicFootPerPound); /// - /// Get SpecificVolume in CubicMetersPerKilogram. + /// Get in CubicMetersPerKilogram. /// public double CubicMetersPerKilogram => As(SpecificVolumeUnit.CubicMeterPerKilogram); /// - /// Get SpecificVolume in MillicubicMetersPerKilogram. + /// Get in MillicubicMetersPerKilogram. /// public double MillicubicMetersPerKilogram => As(SpecificVolumeUnit.MillicubicMeterPerKilogram); @@ -210,42 +210,42 @@ public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] IForma #region Static Factory Methods /// - /// Get SpecificVolume from CubicFeetPerPound. + /// Get from CubicFeetPerPound. /// /// If value is NaN or Infinity. - public static SpecificVolume FromCubicFeetPerPound(QuantityValue cubicfeetperpound) + public static SpecificVolume FromCubicFeetPerPound(QuantityValue cubicfeetperpound) { double value = (double) cubicfeetperpound; - return new SpecificVolume(value, SpecificVolumeUnit.CubicFootPerPound); + return new SpecificVolume(value, SpecificVolumeUnit.CubicFootPerPound); } /// - /// Get SpecificVolume from CubicMetersPerKilogram. + /// Get from CubicMetersPerKilogram. /// /// If value is NaN or Infinity. - public static SpecificVolume FromCubicMetersPerKilogram(QuantityValue cubicmetersperkilogram) + public static SpecificVolume FromCubicMetersPerKilogram(QuantityValue cubicmetersperkilogram) { double value = (double) cubicmetersperkilogram; - return new SpecificVolume(value, SpecificVolumeUnit.CubicMeterPerKilogram); + return new SpecificVolume(value, SpecificVolumeUnit.CubicMeterPerKilogram); } /// - /// Get SpecificVolume from MillicubicMetersPerKilogram. + /// Get from MillicubicMetersPerKilogram. /// /// If value is NaN or Infinity. - public static SpecificVolume FromMillicubicMetersPerKilogram(QuantityValue millicubicmetersperkilogram) + public static SpecificVolume FromMillicubicMetersPerKilogram(QuantityValue millicubicmetersperkilogram) { double value = (double) millicubicmetersperkilogram; - return new SpecificVolume(value, SpecificVolumeUnit.MillicubicMeterPerKilogram); + return new SpecificVolume(value, SpecificVolumeUnit.MillicubicMeterPerKilogram); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// SpecificVolume unit value. - public static SpecificVolume From(QuantityValue value, SpecificVolumeUnit fromUnit) + /// unit value. + public static SpecificVolume From(QuantityValue value, SpecificVolumeUnit fromUnit) { - return new SpecificVolume((double)value, fromUnit); + return new SpecificVolume((double)value, fromUnit); } #endregion @@ -274,7 +274,7 @@ public static SpecificVolume From(QuantityValue value, SpecificVolumeUnit fromUn /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static SpecificVolume Parse(string str) + public static SpecificVolume Parse(string str) { return Parse(str, null); } @@ -302,9 +302,9 @@ public static SpecificVolume Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static SpecificVolume Parse(string str, [CanBeNull] IFormatProvider provider) + public static SpecificVolume Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, SpecificVolumeUnit>( str, provider, From); @@ -318,7 +318,7 @@ public static SpecificVolume Parse(string str, [CanBeNull] IFormatProvider provi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out SpecificVolume result) + public static bool TryParse([CanBeNull] string str, out SpecificVolume result) { return TryParse(str, null, out result); } @@ -333,9 +333,9 @@ public static bool TryParse([CanBeNull] string str, out SpecificVolume result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificVolume result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificVolume result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, SpecificVolumeUnit>( str, provider, From, @@ -397,43 +397,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif #region Arithmetic Operators /// Negate the value. - public static SpecificVolume operator -(SpecificVolume right) + public static SpecificVolume operator -(SpecificVolume right) { - return new SpecificVolume(-right.Value, right.Unit); + return new SpecificVolume(-right.Value, right.Unit); } - /// Get from adding two . - public static SpecificVolume operator +(SpecificVolume left, SpecificVolume right) + /// Get from adding two . + public static SpecificVolume operator +(SpecificVolume left, SpecificVolume right) { - return new SpecificVolume(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new SpecificVolume(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static SpecificVolume operator -(SpecificVolume left, SpecificVolume right) + /// Get from subtracting two . + public static SpecificVolume operator -(SpecificVolume left, SpecificVolume right) { - return new SpecificVolume(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new SpecificVolume(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static SpecificVolume operator *(double left, SpecificVolume right) + /// Get from multiplying value and . + public static SpecificVolume operator *(double left, SpecificVolume right) { - return new SpecificVolume(left * right.Value, right.Unit); + return new SpecificVolume(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static SpecificVolume operator *(SpecificVolume left, double right) + /// Get from multiplying value and . + public static SpecificVolume operator *(SpecificVolume left, double right) { - return new SpecificVolume(left.Value * right, left.Unit); + return new SpecificVolume(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static SpecificVolume operator /(SpecificVolume left, double right) + /// Get from dividing by value. + public static SpecificVolume operator /(SpecificVolume left, double right) { - return new SpecificVolume(left.Value / right, left.Unit); + return new SpecificVolume(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(SpecificVolume left, SpecificVolume right) + /// Get ratio value from dividing by . + public static double operator /(SpecificVolume left, SpecificVolume right) { return left.CubicMetersPerKilogram / right.CubicMetersPerKilogram; } @@ -443,39 +443,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(SpecificVolume left, SpecificVolume right) + public static bool operator <=(SpecificVolume left, SpecificVolume right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(SpecificVolume left, SpecificVolume right) + public static bool operator >=(SpecificVolume left, SpecificVolume right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(SpecificVolume left, SpecificVolume right) + public static bool operator <(SpecificVolume left, SpecificVolume right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(SpecificVolume left, SpecificVolume right) + public static bool operator >(SpecificVolume left, SpecificVolume right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(SpecificVolume left, SpecificVolume right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(SpecificVolume left, SpecificVolume right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(SpecificVolume left, SpecificVolume right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(SpecificVolume left, SpecificVolume right) { return !(left == right); } @@ -484,37 +484,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificVolume objSpecificVolume)) throw new ArgumentException("Expected type SpecificVolume.", nameof(obj)); + if(!(obj is SpecificVolume objSpecificVolume)) throw new ArgumentException("Expected type SpecificVolume.", nameof(obj)); return CompareTo(objSpecificVolume); } /// - public int CompareTo(SpecificVolume other) + public int CompareTo(SpecificVolume other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is SpecificVolume objSpecificVolume)) + if(obj is null || !(obj is SpecificVolume objSpecificVolume)) return false; return Equals(objSpecificVolume); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(SpecificVolume other) + /// Consider using for safely comparing floating point values. + public bool Equals(SpecificVolume other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another SpecificVolume within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -552,7 +552,7 @@ public bool Equals(SpecificVolume other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(SpecificVolume other, double tolerance, ComparisonType comparisonType) + public bool Equals(SpecificVolume other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -566,7 +566,7 @@ public bool Equals(SpecificVolume other, double tolerance, ComparisonType compar /// /// Returns the hash code for this instance. /// - /// A hash code for the current SpecificVolume. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -614,13 +614,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this SpecificVolume to another SpecificVolume with the unit representation . + /// Converts this to another with the unit representation . /// - /// A SpecificVolume with the specified unit. - public SpecificVolume ToUnit(SpecificVolumeUnit unit) + /// A with the specified unit. + public SpecificVolume ToUnit(SpecificVolumeUnit unit) { var convertedValue = GetValueAs(unit); - return new SpecificVolume(convertedValue, unit); + return new SpecificVolume(convertedValue, unit); } /// @@ -633,7 +633,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public SpecificVolume ToUnit(UnitSystem unitSystem) + public SpecificVolume ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -678,10 +678,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal SpecificVolume ToBaseUnit() + internal SpecificVolume ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new SpecificVolume(baseUnitValue, BaseUnit); + return new SpecificVolume(baseUnitValue, BaseUnit); } private double GetValueAs(SpecificVolumeUnit unit) @@ -792,7 +792,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -802,12 +802,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -852,16 +852,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(SpecificVolume)) + if(conversionType == typeof(SpecificVolume)) return this; else if(conversionType == typeof(SpecificVolumeUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return SpecificVolume.QuantityType; + return SpecificVolume.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return SpecificVolume.BaseDimensions; + return SpecificVolume.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs index bdc517521b..955d7cd043 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// http://en.wikipedia.org/wiki/Specificweight /// - public partial struct SpecificWeight : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct SpecificWeight : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -119,19 +119,19 @@ public SpecificWeight(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of SpecificWeight, which is NewtonPerCubicMeter. All conversions go via this value. + /// The base unit of , which is NewtonPerCubicMeter. All conversions go via this value. /// public static SpecificWeightUnit BaseUnit { get; } = SpecificWeightUnit.NewtonPerCubicMeter; /// - /// Represents the largest possible value of SpecificWeight + /// Represents the largest possible value of /// - public static SpecificWeight MaxValue { get; } = new SpecificWeight(double.MaxValue, BaseUnit); + public static SpecificWeight MaxValue { get; } = new SpecificWeight(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of SpecificWeight + /// Represents the smallest possible value of /// - public static SpecificWeight MinValue { get; } = new SpecificWeight(double.MinValue, BaseUnit); + public static SpecificWeight MinValue { get; } = new SpecificWeight(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -139,14 +139,14 @@ public SpecificWeight(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.SpecificWeight; /// - /// All units of measurement for the SpecificWeight quantity. + /// All units of measurement for the quantity. /// public static SpecificWeightUnit[] Units { get; } = Enum.GetValues(typeof(SpecificWeightUnit)).Cast().Except(new SpecificWeightUnit[]{ SpecificWeightUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerCubicMeter. /// - public static SpecificWeight Zero { get; } = new SpecificWeight(0, BaseUnit); + public static SpecificWeight Zero { get; } = new SpecificWeight(0, BaseUnit); #endregion @@ -171,99 +171,99 @@ public SpecificWeight(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => SpecificWeight.QuantityType; + public QuantityType Type => SpecificWeight.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => SpecificWeight.BaseDimensions; + public BaseDimensions Dimensions => SpecificWeight.BaseDimensions; #endregion #region Conversion Properties /// - /// Get SpecificWeight in KilogramsForcePerCubicCentimeter. + /// Get in KilogramsForcePerCubicCentimeter. /// public double KilogramsForcePerCubicCentimeter => As(SpecificWeightUnit.KilogramForcePerCubicCentimeter); /// - /// Get SpecificWeight in KilogramsForcePerCubicMeter. + /// Get in KilogramsForcePerCubicMeter. /// public double KilogramsForcePerCubicMeter => As(SpecificWeightUnit.KilogramForcePerCubicMeter); /// - /// Get SpecificWeight in KilogramsForcePerCubicMillimeter. + /// Get in KilogramsForcePerCubicMillimeter. /// public double KilogramsForcePerCubicMillimeter => As(SpecificWeightUnit.KilogramForcePerCubicMillimeter); /// - /// Get SpecificWeight in KilonewtonsPerCubicCentimeter. + /// Get in KilonewtonsPerCubicCentimeter. /// public double KilonewtonsPerCubicCentimeter => As(SpecificWeightUnit.KilonewtonPerCubicCentimeter); /// - /// Get SpecificWeight in KilonewtonsPerCubicMeter. + /// Get in KilonewtonsPerCubicMeter. /// public double KilonewtonsPerCubicMeter => As(SpecificWeightUnit.KilonewtonPerCubicMeter); /// - /// Get SpecificWeight in KilonewtonsPerCubicMillimeter. + /// Get in KilonewtonsPerCubicMillimeter. /// public double KilonewtonsPerCubicMillimeter => As(SpecificWeightUnit.KilonewtonPerCubicMillimeter); /// - /// Get SpecificWeight in KilopoundsForcePerCubicFoot. + /// Get in KilopoundsForcePerCubicFoot. /// public double KilopoundsForcePerCubicFoot => As(SpecificWeightUnit.KilopoundForcePerCubicFoot); /// - /// Get SpecificWeight in KilopoundsForcePerCubicInch. + /// Get in KilopoundsForcePerCubicInch. /// public double KilopoundsForcePerCubicInch => As(SpecificWeightUnit.KilopoundForcePerCubicInch); /// - /// Get SpecificWeight in MeganewtonsPerCubicMeter. + /// Get in MeganewtonsPerCubicMeter. /// public double MeganewtonsPerCubicMeter => As(SpecificWeightUnit.MeganewtonPerCubicMeter); /// - /// Get SpecificWeight in NewtonsPerCubicCentimeter. + /// Get in NewtonsPerCubicCentimeter. /// public double NewtonsPerCubicCentimeter => As(SpecificWeightUnit.NewtonPerCubicCentimeter); /// - /// Get SpecificWeight in NewtonsPerCubicMeter. + /// Get in NewtonsPerCubicMeter. /// public double NewtonsPerCubicMeter => As(SpecificWeightUnit.NewtonPerCubicMeter); /// - /// Get SpecificWeight in NewtonsPerCubicMillimeter. + /// Get in NewtonsPerCubicMillimeter. /// public double NewtonsPerCubicMillimeter => As(SpecificWeightUnit.NewtonPerCubicMillimeter); /// - /// Get SpecificWeight in PoundsForcePerCubicFoot. + /// Get in PoundsForcePerCubicFoot. /// public double PoundsForcePerCubicFoot => As(SpecificWeightUnit.PoundForcePerCubicFoot); /// - /// Get SpecificWeight in PoundsForcePerCubicInch. + /// Get in PoundsForcePerCubicInch. /// public double PoundsForcePerCubicInch => As(SpecificWeightUnit.PoundForcePerCubicInch); /// - /// Get SpecificWeight in TonnesForcePerCubicCentimeter. + /// Get in TonnesForcePerCubicCentimeter. /// public double TonnesForcePerCubicCentimeter => As(SpecificWeightUnit.TonneForcePerCubicCentimeter); /// - /// Get SpecificWeight in TonnesForcePerCubicMeter. + /// Get in TonnesForcePerCubicMeter. /// public double TonnesForcePerCubicMeter => As(SpecificWeightUnit.TonneForcePerCubicMeter); /// - /// Get SpecificWeight in TonnesForcePerCubicMillimeter. + /// Get in TonnesForcePerCubicMillimeter. /// public double TonnesForcePerCubicMillimeter => As(SpecificWeightUnit.TonneForcePerCubicMillimeter); @@ -297,168 +297,168 @@ public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] IForma #region Static Factory Methods /// - /// Get SpecificWeight from KilogramsForcePerCubicCentimeter. + /// Get from KilogramsForcePerCubicCentimeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromKilogramsForcePerCubicCentimeter(QuantityValue kilogramsforcepercubiccentimeter) + public static SpecificWeight FromKilogramsForcePerCubicCentimeter(QuantityValue kilogramsforcepercubiccentimeter) { double value = (double) kilogramsforcepercubiccentimeter; - return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicCentimeter); + return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicCentimeter); } /// - /// Get SpecificWeight from KilogramsForcePerCubicMeter. + /// Get from KilogramsForcePerCubicMeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromKilogramsForcePerCubicMeter(QuantityValue kilogramsforcepercubicmeter) + public static SpecificWeight FromKilogramsForcePerCubicMeter(QuantityValue kilogramsforcepercubicmeter) { double value = (double) kilogramsforcepercubicmeter; - return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicMeter); + return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicMeter); } /// - /// Get SpecificWeight from KilogramsForcePerCubicMillimeter. + /// Get from KilogramsForcePerCubicMillimeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromKilogramsForcePerCubicMillimeter(QuantityValue kilogramsforcepercubicmillimeter) + public static SpecificWeight FromKilogramsForcePerCubicMillimeter(QuantityValue kilogramsforcepercubicmillimeter) { double value = (double) kilogramsforcepercubicmillimeter; - return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicMillimeter); + return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicMillimeter); } /// - /// Get SpecificWeight from KilonewtonsPerCubicCentimeter. + /// Get from KilonewtonsPerCubicCentimeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromKilonewtonsPerCubicCentimeter(QuantityValue kilonewtonspercubiccentimeter) + public static SpecificWeight FromKilonewtonsPerCubicCentimeter(QuantityValue kilonewtonspercubiccentimeter) { double value = (double) kilonewtonspercubiccentimeter; - return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicCentimeter); + return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicCentimeter); } /// - /// Get SpecificWeight from KilonewtonsPerCubicMeter. + /// Get from KilonewtonsPerCubicMeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromKilonewtonsPerCubicMeter(QuantityValue kilonewtonspercubicmeter) + public static SpecificWeight FromKilonewtonsPerCubicMeter(QuantityValue kilonewtonspercubicmeter) { double value = (double) kilonewtonspercubicmeter; - return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicMeter); + return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicMeter); } /// - /// Get SpecificWeight from KilonewtonsPerCubicMillimeter. + /// Get from KilonewtonsPerCubicMillimeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromKilonewtonsPerCubicMillimeter(QuantityValue kilonewtonspercubicmillimeter) + public static SpecificWeight FromKilonewtonsPerCubicMillimeter(QuantityValue kilonewtonspercubicmillimeter) { double value = (double) kilonewtonspercubicmillimeter; - return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicMillimeter); + return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicMillimeter); } /// - /// Get SpecificWeight from KilopoundsForcePerCubicFoot. + /// Get from KilopoundsForcePerCubicFoot. /// /// If value is NaN or Infinity. - public static SpecificWeight FromKilopoundsForcePerCubicFoot(QuantityValue kilopoundsforcepercubicfoot) + public static SpecificWeight FromKilopoundsForcePerCubicFoot(QuantityValue kilopoundsforcepercubicfoot) { double value = (double) kilopoundsforcepercubicfoot; - return new SpecificWeight(value, SpecificWeightUnit.KilopoundForcePerCubicFoot); + return new SpecificWeight(value, SpecificWeightUnit.KilopoundForcePerCubicFoot); } /// - /// Get SpecificWeight from KilopoundsForcePerCubicInch. + /// Get from KilopoundsForcePerCubicInch. /// /// If value is NaN or Infinity. - public static SpecificWeight FromKilopoundsForcePerCubicInch(QuantityValue kilopoundsforcepercubicinch) + public static SpecificWeight FromKilopoundsForcePerCubicInch(QuantityValue kilopoundsforcepercubicinch) { double value = (double) kilopoundsforcepercubicinch; - return new SpecificWeight(value, SpecificWeightUnit.KilopoundForcePerCubicInch); + return new SpecificWeight(value, SpecificWeightUnit.KilopoundForcePerCubicInch); } /// - /// Get SpecificWeight from MeganewtonsPerCubicMeter. + /// Get from MeganewtonsPerCubicMeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromMeganewtonsPerCubicMeter(QuantityValue meganewtonspercubicmeter) + public static SpecificWeight FromMeganewtonsPerCubicMeter(QuantityValue meganewtonspercubicmeter) { double value = (double) meganewtonspercubicmeter; - return new SpecificWeight(value, SpecificWeightUnit.MeganewtonPerCubicMeter); + return new SpecificWeight(value, SpecificWeightUnit.MeganewtonPerCubicMeter); } /// - /// Get SpecificWeight from NewtonsPerCubicCentimeter. + /// Get from NewtonsPerCubicCentimeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromNewtonsPerCubicCentimeter(QuantityValue newtonspercubiccentimeter) + public static SpecificWeight FromNewtonsPerCubicCentimeter(QuantityValue newtonspercubiccentimeter) { double value = (double) newtonspercubiccentimeter; - return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicCentimeter); + return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicCentimeter); } /// - /// Get SpecificWeight from NewtonsPerCubicMeter. + /// Get from NewtonsPerCubicMeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromNewtonsPerCubicMeter(QuantityValue newtonspercubicmeter) + public static SpecificWeight FromNewtonsPerCubicMeter(QuantityValue newtonspercubicmeter) { double value = (double) newtonspercubicmeter; - return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicMeter); + return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicMeter); } /// - /// Get SpecificWeight from NewtonsPerCubicMillimeter. + /// Get from NewtonsPerCubicMillimeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromNewtonsPerCubicMillimeter(QuantityValue newtonspercubicmillimeter) + public static SpecificWeight FromNewtonsPerCubicMillimeter(QuantityValue newtonspercubicmillimeter) { double value = (double) newtonspercubicmillimeter; - return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicMillimeter); + return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicMillimeter); } /// - /// Get SpecificWeight from PoundsForcePerCubicFoot. + /// Get from PoundsForcePerCubicFoot. /// /// If value is NaN or Infinity. - public static SpecificWeight FromPoundsForcePerCubicFoot(QuantityValue poundsforcepercubicfoot) + public static SpecificWeight FromPoundsForcePerCubicFoot(QuantityValue poundsforcepercubicfoot) { double value = (double) poundsforcepercubicfoot; - return new SpecificWeight(value, SpecificWeightUnit.PoundForcePerCubicFoot); + return new SpecificWeight(value, SpecificWeightUnit.PoundForcePerCubicFoot); } /// - /// Get SpecificWeight from PoundsForcePerCubicInch. + /// Get from PoundsForcePerCubicInch. /// /// If value is NaN or Infinity. - public static SpecificWeight FromPoundsForcePerCubicInch(QuantityValue poundsforcepercubicinch) + public static SpecificWeight FromPoundsForcePerCubicInch(QuantityValue poundsforcepercubicinch) { double value = (double) poundsforcepercubicinch; - return new SpecificWeight(value, SpecificWeightUnit.PoundForcePerCubicInch); + return new SpecificWeight(value, SpecificWeightUnit.PoundForcePerCubicInch); } /// - /// Get SpecificWeight from TonnesForcePerCubicCentimeter. + /// Get from TonnesForcePerCubicCentimeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromTonnesForcePerCubicCentimeter(QuantityValue tonnesforcepercubiccentimeter) + public static SpecificWeight FromTonnesForcePerCubicCentimeter(QuantityValue tonnesforcepercubiccentimeter) { double value = (double) tonnesforcepercubiccentimeter; - return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicCentimeter); + return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicCentimeter); } /// - /// Get SpecificWeight from TonnesForcePerCubicMeter. + /// Get from TonnesForcePerCubicMeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromTonnesForcePerCubicMeter(QuantityValue tonnesforcepercubicmeter) + public static SpecificWeight FromTonnesForcePerCubicMeter(QuantityValue tonnesforcepercubicmeter) { double value = (double) tonnesforcepercubicmeter; - return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicMeter); + return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicMeter); } /// - /// Get SpecificWeight from TonnesForcePerCubicMillimeter. + /// Get from TonnesForcePerCubicMillimeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromTonnesForcePerCubicMillimeter(QuantityValue tonnesforcepercubicmillimeter) + public static SpecificWeight FromTonnesForcePerCubicMillimeter(QuantityValue tonnesforcepercubicmillimeter) { double value = (double) tonnesforcepercubicmillimeter; - return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicMillimeter); + return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicMillimeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// SpecificWeight unit value. - public static SpecificWeight From(QuantityValue value, SpecificWeightUnit fromUnit) + /// unit value. + public static SpecificWeight From(QuantityValue value, SpecificWeightUnit fromUnit) { - return new SpecificWeight((double)value, fromUnit); + return new SpecificWeight((double)value, fromUnit); } #endregion @@ -487,7 +487,7 @@ public static SpecificWeight From(QuantityValue value, SpecificWeightUnit fromUn /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static SpecificWeight Parse(string str) + public static SpecificWeight Parse(string str) { return Parse(str, null); } @@ -515,9 +515,9 @@ public static SpecificWeight Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static SpecificWeight Parse(string str, [CanBeNull] IFormatProvider provider) + public static SpecificWeight Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, SpecificWeightUnit>( str, provider, From); @@ -531,7 +531,7 @@ public static SpecificWeight Parse(string str, [CanBeNull] IFormatProvider provi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out SpecificWeight result) + public static bool TryParse([CanBeNull] string str, out SpecificWeight result) { return TryParse(str, null, out result); } @@ -546,9 +546,9 @@ public static bool TryParse([CanBeNull] string str, out SpecificWeight result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificWeight result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificWeight result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, SpecificWeightUnit>( str, provider, From, @@ -610,43 +610,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif #region Arithmetic Operators /// Negate the value. - public static SpecificWeight operator -(SpecificWeight right) + public static SpecificWeight operator -(SpecificWeight right) { - return new SpecificWeight(-right.Value, right.Unit); + return new SpecificWeight(-right.Value, right.Unit); } - /// Get from adding two . - public static SpecificWeight operator +(SpecificWeight left, SpecificWeight right) + /// Get from adding two . + public static SpecificWeight operator +(SpecificWeight left, SpecificWeight right) { - return new SpecificWeight(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new SpecificWeight(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static SpecificWeight operator -(SpecificWeight left, SpecificWeight right) + /// Get from subtracting two . + public static SpecificWeight operator -(SpecificWeight left, SpecificWeight right) { - return new SpecificWeight(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new SpecificWeight(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static SpecificWeight operator *(double left, SpecificWeight right) + /// Get from multiplying value and . + public static SpecificWeight operator *(double left, SpecificWeight right) { - return new SpecificWeight(left * right.Value, right.Unit); + return new SpecificWeight(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static SpecificWeight operator *(SpecificWeight left, double right) + /// Get from multiplying value and . + public static SpecificWeight operator *(SpecificWeight left, double right) { - return new SpecificWeight(left.Value * right, left.Unit); + return new SpecificWeight(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static SpecificWeight operator /(SpecificWeight left, double right) + /// Get from dividing by value. + public static SpecificWeight operator /(SpecificWeight left, double right) { - return new SpecificWeight(left.Value / right, left.Unit); + return new SpecificWeight(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(SpecificWeight left, SpecificWeight right) + /// Get ratio value from dividing by . + public static double operator /(SpecificWeight left, SpecificWeight right) { return left.NewtonsPerCubicMeter / right.NewtonsPerCubicMeter; } @@ -656,39 +656,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(SpecificWeight left, SpecificWeight right) + public static bool operator <=(SpecificWeight left, SpecificWeight right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(SpecificWeight left, SpecificWeight right) + public static bool operator >=(SpecificWeight left, SpecificWeight right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(SpecificWeight left, SpecificWeight right) + public static bool operator <(SpecificWeight left, SpecificWeight right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(SpecificWeight left, SpecificWeight right) + public static bool operator >(SpecificWeight left, SpecificWeight right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(SpecificWeight left, SpecificWeight right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(SpecificWeight left, SpecificWeight right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(SpecificWeight left, SpecificWeight right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(SpecificWeight left, SpecificWeight right) { return !(left == right); } @@ -697,37 +697,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificWeight objSpecificWeight)) throw new ArgumentException("Expected type SpecificWeight.", nameof(obj)); + if(!(obj is SpecificWeight objSpecificWeight)) throw new ArgumentException("Expected type SpecificWeight.", nameof(obj)); return CompareTo(objSpecificWeight); } /// - public int CompareTo(SpecificWeight other) + public int CompareTo(SpecificWeight other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is SpecificWeight objSpecificWeight)) + if(obj is null || !(obj is SpecificWeight objSpecificWeight)) return false; return Equals(objSpecificWeight); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(SpecificWeight other) + /// Consider using for safely comparing floating point values. + public bool Equals(SpecificWeight other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another SpecificWeight within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -765,7 +765,7 @@ public bool Equals(SpecificWeight other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(SpecificWeight other, double tolerance, ComparisonType comparisonType) + public bool Equals(SpecificWeight other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -779,7 +779,7 @@ public bool Equals(SpecificWeight other, double tolerance, ComparisonType compar /// /// Returns the hash code for this instance. /// - /// A hash code for the current SpecificWeight. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -827,13 +827,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this SpecificWeight to another SpecificWeight with the unit representation . + /// Converts this to another with the unit representation . /// - /// A SpecificWeight with the specified unit. - public SpecificWeight ToUnit(SpecificWeightUnit unit) + /// A with the specified unit. + public SpecificWeight ToUnit(SpecificWeightUnit unit) { var convertedValue = GetValueAs(unit); - return new SpecificWeight(convertedValue, unit); + return new SpecificWeight(convertedValue, unit); } /// @@ -846,7 +846,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public SpecificWeight ToUnit(UnitSystem unitSystem) + public SpecificWeight ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -905,10 +905,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal SpecificWeight ToBaseUnit() + internal SpecificWeight ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new SpecificWeight(baseUnitValue, BaseUnit); + return new SpecificWeight(baseUnitValue, BaseUnit); } private double GetValueAs(SpecificWeightUnit unit) @@ -1033,7 +1033,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1043,12 +1043,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1093,16 +1093,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(SpecificWeight)) + if(conversionType == typeof(SpecificWeight)) return this; else if(conversionType == typeof(SpecificWeightUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return SpecificWeight.QuantityType; + return SpecificWeight.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return SpecificWeight.BaseDimensions; + return SpecificWeight.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs index 5016235775..ceb3913715 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// In everyday use and in kinematics, the speed of an object is the magnitude of its velocity (the rate of change of its position); it is thus a scalar quantity.[1] The average speed of an object in an interval of time is the distance travelled by the object divided by the duration of the interval;[2] the instantaneous speed is the limit of the average speed as the duration of the time interval approaches zero. /// - public partial struct Speed : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Speed : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,19 +131,19 @@ public Speed(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Speed, which is MeterPerSecond. All conversions go via this value. + /// The base unit of , which is MeterPerSecond. All conversions go via this value. /// public static SpeedUnit BaseUnit { get; } = SpeedUnit.MeterPerSecond; /// - /// Represents the largest possible value of Speed + /// Represents the largest possible value of /// - public static Speed MaxValue { get; } = new Speed(double.MaxValue, BaseUnit); + public static Speed MaxValue { get; } = new Speed(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Speed + /// Represents the smallest possible value of /// - public static Speed MinValue { get; } = new Speed(double.MinValue, BaseUnit); + public static Speed MinValue { get; } = new Speed(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -151,14 +151,14 @@ public Speed(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Speed; /// - /// All units of measurement for the Speed quantity. + /// All units of measurement for the quantity. /// public static SpeedUnit[] Units { get; } = Enum.GetValues(typeof(SpeedUnit)).Cast().Except(new SpeedUnit[]{ SpeedUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit MeterPerSecond. /// - public static Speed Zero { get; } = new Speed(0, BaseUnit); + public static Speed Zero { get; } = new Speed(0, BaseUnit); #endregion @@ -183,174 +183,174 @@ public Speed(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Speed.QuantityType; + public QuantityType Type => Speed.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Speed.BaseDimensions; + public BaseDimensions Dimensions => Speed.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Speed in CentimetersPerHour. + /// Get in CentimetersPerHour. /// public double CentimetersPerHour => As(SpeedUnit.CentimeterPerHour); /// - /// Get Speed in CentimetersPerMinutes. + /// Get in CentimetersPerMinutes. /// public double CentimetersPerMinutes => As(SpeedUnit.CentimeterPerMinute); /// - /// Get Speed in CentimetersPerSecond. + /// Get in CentimetersPerSecond. /// public double CentimetersPerSecond => As(SpeedUnit.CentimeterPerSecond); /// - /// Get Speed in DecimetersPerMinutes. + /// Get in DecimetersPerMinutes. /// public double DecimetersPerMinutes => As(SpeedUnit.DecimeterPerMinute); /// - /// Get Speed in DecimetersPerSecond. + /// Get in DecimetersPerSecond. /// public double DecimetersPerSecond => As(SpeedUnit.DecimeterPerSecond); /// - /// Get Speed in FeetPerHour. + /// Get in FeetPerHour. /// public double FeetPerHour => As(SpeedUnit.FootPerHour); /// - /// Get Speed in FeetPerMinute. + /// Get in FeetPerMinute. /// public double FeetPerMinute => As(SpeedUnit.FootPerMinute); /// - /// Get Speed in FeetPerSecond. + /// Get in FeetPerSecond. /// public double FeetPerSecond => As(SpeedUnit.FootPerSecond); /// - /// Get Speed in InchesPerHour. + /// Get in InchesPerHour. /// public double InchesPerHour => As(SpeedUnit.InchPerHour); /// - /// Get Speed in InchesPerMinute. + /// Get in InchesPerMinute. /// public double InchesPerMinute => As(SpeedUnit.InchPerMinute); /// - /// Get Speed in InchesPerSecond. + /// Get in InchesPerSecond. /// public double InchesPerSecond => As(SpeedUnit.InchPerSecond); /// - /// Get Speed in KilometersPerHour. + /// Get in KilometersPerHour. /// public double KilometersPerHour => As(SpeedUnit.KilometerPerHour); /// - /// Get Speed in KilometersPerMinutes. + /// Get in KilometersPerMinutes. /// public double KilometersPerMinutes => As(SpeedUnit.KilometerPerMinute); /// - /// Get Speed in KilometersPerSecond. + /// Get in KilometersPerSecond. /// public double KilometersPerSecond => As(SpeedUnit.KilometerPerSecond); /// - /// Get Speed in Knots. + /// Get in Knots. /// public double Knots => As(SpeedUnit.Knot); /// - /// Get Speed in MetersPerHour. + /// Get in MetersPerHour. /// public double MetersPerHour => As(SpeedUnit.MeterPerHour); /// - /// Get Speed in MetersPerMinutes. + /// Get in MetersPerMinutes. /// public double MetersPerMinutes => As(SpeedUnit.MeterPerMinute); /// - /// Get Speed in MetersPerSecond. + /// Get in MetersPerSecond. /// public double MetersPerSecond => As(SpeedUnit.MeterPerSecond); /// - /// Get Speed in MicrometersPerMinutes. + /// Get in MicrometersPerMinutes. /// public double MicrometersPerMinutes => As(SpeedUnit.MicrometerPerMinute); /// - /// Get Speed in MicrometersPerSecond. + /// Get in MicrometersPerSecond. /// public double MicrometersPerSecond => As(SpeedUnit.MicrometerPerSecond); /// - /// Get Speed in MilesPerHour. + /// Get in MilesPerHour. /// public double MilesPerHour => As(SpeedUnit.MilePerHour); /// - /// Get Speed in MillimetersPerHour. + /// Get in MillimetersPerHour. /// public double MillimetersPerHour => As(SpeedUnit.MillimeterPerHour); /// - /// Get Speed in MillimetersPerMinutes. + /// Get in MillimetersPerMinutes. /// public double MillimetersPerMinutes => As(SpeedUnit.MillimeterPerMinute); /// - /// Get Speed in MillimetersPerSecond. + /// Get in MillimetersPerSecond. /// public double MillimetersPerSecond => As(SpeedUnit.MillimeterPerSecond); /// - /// Get Speed in NanometersPerMinutes. + /// Get in NanometersPerMinutes. /// public double NanometersPerMinutes => As(SpeedUnit.NanometerPerMinute); /// - /// Get Speed in NanometersPerSecond. + /// Get in NanometersPerSecond. /// public double NanometersPerSecond => As(SpeedUnit.NanometerPerSecond); /// - /// Get Speed in UsSurveyFeetPerHour. + /// Get in UsSurveyFeetPerHour. /// public double UsSurveyFeetPerHour => As(SpeedUnit.UsSurveyFootPerHour); /// - /// Get Speed in UsSurveyFeetPerMinute. + /// Get in UsSurveyFeetPerMinute. /// public double UsSurveyFeetPerMinute => As(SpeedUnit.UsSurveyFootPerMinute); /// - /// Get Speed in UsSurveyFeetPerSecond. + /// Get in UsSurveyFeetPerSecond. /// public double UsSurveyFeetPerSecond => As(SpeedUnit.UsSurveyFootPerSecond); /// - /// Get Speed in YardsPerHour. + /// Get in YardsPerHour. /// public double YardsPerHour => As(SpeedUnit.YardPerHour); /// - /// Get Speed in YardsPerMinute. + /// Get in YardsPerMinute. /// public double YardsPerMinute => As(SpeedUnit.YardPerMinute); /// - /// Get Speed in YardsPerSecond. + /// Get in YardsPerSecond. /// public double YardsPerSecond => As(SpeedUnit.YardPerSecond); @@ -384,303 +384,303 @@ public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] IFormatProvider #region Static Factory Methods /// - /// Get Speed from CentimetersPerHour. + /// Get from CentimetersPerHour. /// /// If value is NaN or Infinity. - public static Speed FromCentimetersPerHour(QuantityValue centimetersperhour) + public static Speed FromCentimetersPerHour(QuantityValue centimetersperhour) { double value = (double) centimetersperhour; - return new Speed(value, SpeedUnit.CentimeterPerHour); + return new Speed(value, SpeedUnit.CentimeterPerHour); } /// - /// Get Speed from CentimetersPerMinutes. + /// Get from CentimetersPerMinutes. /// /// If value is NaN or Infinity. - public static Speed FromCentimetersPerMinutes(QuantityValue centimetersperminutes) + public static Speed FromCentimetersPerMinutes(QuantityValue centimetersperminutes) { double value = (double) centimetersperminutes; - return new Speed(value, SpeedUnit.CentimeterPerMinute); + return new Speed(value, SpeedUnit.CentimeterPerMinute); } /// - /// Get Speed from CentimetersPerSecond. + /// Get from CentimetersPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromCentimetersPerSecond(QuantityValue centimeterspersecond) + public static Speed FromCentimetersPerSecond(QuantityValue centimeterspersecond) { double value = (double) centimeterspersecond; - return new Speed(value, SpeedUnit.CentimeterPerSecond); + return new Speed(value, SpeedUnit.CentimeterPerSecond); } /// - /// Get Speed from DecimetersPerMinutes. + /// Get from DecimetersPerMinutes. /// /// If value is NaN or Infinity. - public static Speed FromDecimetersPerMinutes(QuantityValue decimetersperminutes) + public static Speed FromDecimetersPerMinutes(QuantityValue decimetersperminutes) { double value = (double) decimetersperminutes; - return new Speed(value, SpeedUnit.DecimeterPerMinute); + return new Speed(value, SpeedUnit.DecimeterPerMinute); } /// - /// Get Speed from DecimetersPerSecond. + /// Get from DecimetersPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromDecimetersPerSecond(QuantityValue decimeterspersecond) + public static Speed FromDecimetersPerSecond(QuantityValue decimeterspersecond) { double value = (double) decimeterspersecond; - return new Speed(value, SpeedUnit.DecimeterPerSecond); + return new Speed(value, SpeedUnit.DecimeterPerSecond); } /// - /// Get Speed from FeetPerHour. + /// Get from FeetPerHour. /// /// If value is NaN or Infinity. - public static Speed FromFeetPerHour(QuantityValue feetperhour) + public static Speed FromFeetPerHour(QuantityValue feetperhour) { double value = (double) feetperhour; - return new Speed(value, SpeedUnit.FootPerHour); + return new Speed(value, SpeedUnit.FootPerHour); } /// - /// Get Speed from FeetPerMinute. + /// Get from FeetPerMinute. /// /// If value is NaN or Infinity. - public static Speed FromFeetPerMinute(QuantityValue feetperminute) + public static Speed FromFeetPerMinute(QuantityValue feetperminute) { double value = (double) feetperminute; - return new Speed(value, SpeedUnit.FootPerMinute); + return new Speed(value, SpeedUnit.FootPerMinute); } /// - /// Get Speed from FeetPerSecond. + /// Get from FeetPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromFeetPerSecond(QuantityValue feetpersecond) + public static Speed FromFeetPerSecond(QuantityValue feetpersecond) { double value = (double) feetpersecond; - return new Speed(value, SpeedUnit.FootPerSecond); + return new Speed(value, SpeedUnit.FootPerSecond); } /// - /// Get Speed from InchesPerHour. + /// Get from InchesPerHour. /// /// If value is NaN or Infinity. - public static Speed FromInchesPerHour(QuantityValue inchesperhour) + public static Speed FromInchesPerHour(QuantityValue inchesperhour) { double value = (double) inchesperhour; - return new Speed(value, SpeedUnit.InchPerHour); + return new Speed(value, SpeedUnit.InchPerHour); } /// - /// Get Speed from InchesPerMinute. + /// Get from InchesPerMinute. /// /// If value is NaN or Infinity. - public static Speed FromInchesPerMinute(QuantityValue inchesperminute) + public static Speed FromInchesPerMinute(QuantityValue inchesperminute) { double value = (double) inchesperminute; - return new Speed(value, SpeedUnit.InchPerMinute); + return new Speed(value, SpeedUnit.InchPerMinute); } /// - /// Get Speed from InchesPerSecond. + /// Get from InchesPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromInchesPerSecond(QuantityValue inchespersecond) + public static Speed FromInchesPerSecond(QuantityValue inchespersecond) { double value = (double) inchespersecond; - return new Speed(value, SpeedUnit.InchPerSecond); + return new Speed(value, SpeedUnit.InchPerSecond); } /// - /// Get Speed from KilometersPerHour. + /// Get from KilometersPerHour. /// /// If value is NaN or Infinity. - public static Speed FromKilometersPerHour(QuantityValue kilometersperhour) + public static Speed FromKilometersPerHour(QuantityValue kilometersperhour) { double value = (double) kilometersperhour; - return new Speed(value, SpeedUnit.KilometerPerHour); + return new Speed(value, SpeedUnit.KilometerPerHour); } /// - /// Get Speed from KilometersPerMinutes. + /// Get from KilometersPerMinutes. /// /// If value is NaN or Infinity. - public static Speed FromKilometersPerMinutes(QuantityValue kilometersperminutes) + public static Speed FromKilometersPerMinutes(QuantityValue kilometersperminutes) { double value = (double) kilometersperminutes; - return new Speed(value, SpeedUnit.KilometerPerMinute); + return new Speed(value, SpeedUnit.KilometerPerMinute); } /// - /// Get Speed from KilometersPerSecond. + /// Get from KilometersPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromKilometersPerSecond(QuantityValue kilometerspersecond) + public static Speed FromKilometersPerSecond(QuantityValue kilometerspersecond) { double value = (double) kilometerspersecond; - return new Speed(value, SpeedUnit.KilometerPerSecond); + return new Speed(value, SpeedUnit.KilometerPerSecond); } /// - /// Get Speed from Knots. + /// Get from Knots. /// /// If value is NaN or Infinity. - public static Speed FromKnots(QuantityValue knots) + public static Speed FromKnots(QuantityValue knots) { double value = (double) knots; - return new Speed(value, SpeedUnit.Knot); + return new Speed(value, SpeedUnit.Knot); } /// - /// Get Speed from MetersPerHour. + /// Get from MetersPerHour. /// /// If value is NaN or Infinity. - public static Speed FromMetersPerHour(QuantityValue metersperhour) + public static Speed FromMetersPerHour(QuantityValue metersperhour) { double value = (double) metersperhour; - return new Speed(value, SpeedUnit.MeterPerHour); + return new Speed(value, SpeedUnit.MeterPerHour); } /// - /// Get Speed from MetersPerMinutes. + /// Get from MetersPerMinutes. /// /// If value is NaN or Infinity. - public static Speed FromMetersPerMinutes(QuantityValue metersperminutes) + public static Speed FromMetersPerMinutes(QuantityValue metersperminutes) { double value = (double) metersperminutes; - return new Speed(value, SpeedUnit.MeterPerMinute); + return new Speed(value, SpeedUnit.MeterPerMinute); } /// - /// Get Speed from MetersPerSecond. + /// Get from MetersPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromMetersPerSecond(QuantityValue meterspersecond) + public static Speed FromMetersPerSecond(QuantityValue meterspersecond) { double value = (double) meterspersecond; - return new Speed(value, SpeedUnit.MeterPerSecond); + return new Speed(value, SpeedUnit.MeterPerSecond); } /// - /// Get Speed from MicrometersPerMinutes. + /// Get from MicrometersPerMinutes. /// /// If value is NaN or Infinity. - public static Speed FromMicrometersPerMinutes(QuantityValue micrometersperminutes) + public static Speed FromMicrometersPerMinutes(QuantityValue micrometersperminutes) { double value = (double) micrometersperminutes; - return new Speed(value, SpeedUnit.MicrometerPerMinute); + return new Speed(value, SpeedUnit.MicrometerPerMinute); } /// - /// Get Speed from MicrometersPerSecond. + /// Get from MicrometersPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromMicrometersPerSecond(QuantityValue micrometerspersecond) + public static Speed FromMicrometersPerSecond(QuantityValue micrometerspersecond) { double value = (double) micrometerspersecond; - return new Speed(value, SpeedUnit.MicrometerPerSecond); + return new Speed(value, SpeedUnit.MicrometerPerSecond); } /// - /// Get Speed from MilesPerHour. + /// Get from MilesPerHour. /// /// If value is NaN or Infinity. - public static Speed FromMilesPerHour(QuantityValue milesperhour) + public static Speed FromMilesPerHour(QuantityValue milesperhour) { double value = (double) milesperhour; - return new Speed(value, SpeedUnit.MilePerHour); + return new Speed(value, SpeedUnit.MilePerHour); } /// - /// Get Speed from MillimetersPerHour. + /// Get from MillimetersPerHour. /// /// If value is NaN or Infinity. - public static Speed FromMillimetersPerHour(QuantityValue millimetersperhour) + public static Speed FromMillimetersPerHour(QuantityValue millimetersperhour) { double value = (double) millimetersperhour; - return new Speed(value, SpeedUnit.MillimeterPerHour); + return new Speed(value, SpeedUnit.MillimeterPerHour); } /// - /// Get Speed from MillimetersPerMinutes. + /// Get from MillimetersPerMinutes. /// /// If value is NaN or Infinity. - public static Speed FromMillimetersPerMinutes(QuantityValue millimetersperminutes) + public static Speed FromMillimetersPerMinutes(QuantityValue millimetersperminutes) { double value = (double) millimetersperminutes; - return new Speed(value, SpeedUnit.MillimeterPerMinute); + return new Speed(value, SpeedUnit.MillimeterPerMinute); } /// - /// Get Speed from MillimetersPerSecond. + /// Get from MillimetersPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromMillimetersPerSecond(QuantityValue millimeterspersecond) + public static Speed FromMillimetersPerSecond(QuantityValue millimeterspersecond) { double value = (double) millimeterspersecond; - return new Speed(value, SpeedUnit.MillimeterPerSecond); + return new Speed(value, SpeedUnit.MillimeterPerSecond); } /// - /// Get Speed from NanometersPerMinutes. + /// Get from NanometersPerMinutes. /// /// If value is NaN or Infinity. - public static Speed FromNanometersPerMinutes(QuantityValue nanometersperminutes) + public static Speed FromNanometersPerMinutes(QuantityValue nanometersperminutes) { double value = (double) nanometersperminutes; - return new Speed(value, SpeedUnit.NanometerPerMinute); + return new Speed(value, SpeedUnit.NanometerPerMinute); } /// - /// Get Speed from NanometersPerSecond. + /// Get from NanometersPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromNanometersPerSecond(QuantityValue nanometerspersecond) + public static Speed FromNanometersPerSecond(QuantityValue nanometerspersecond) { double value = (double) nanometerspersecond; - return new Speed(value, SpeedUnit.NanometerPerSecond); + return new Speed(value, SpeedUnit.NanometerPerSecond); } /// - /// Get Speed from UsSurveyFeetPerHour. + /// Get from UsSurveyFeetPerHour. /// /// If value is NaN or Infinity. - public static Speed FromUsSurveyFeetPerHour(QuantityValue ussurveyfeetperhour) + public static Speed FromUsSurveyFeetPerHour(QuantityValue ussurveyfeetperhour) { double value = (double) ussurveyfeetperhour; - return new Speed(value, SpeedUnit.UsSurveyFootPerHour); + return new Speed(value, SpeedUnit.UsSurveyFootPerHour); } /// - /// Get Speed from UsSurveyFeetPerMinute. + /// Get from UsSurveyFeetPerMinute. /// /// If value is NaN or Infinity. - public static Speed FromUsSurveyFeetPerMinute(QuantityValue ussurveyfeetperminute) + public static Speed FromUsSurveyFeetPerMinute(QuantityValue ussurveyfeetperminute) { double value = (double) ussurveyfeetperminute; - return new Speed(value, SpeedUnit.UsSurveyFootPerMinute); + return new Speed(value, SpeedUnit.UsSurveyFootPerMinute); } /// - /// Get Speed from UsSurveyFeetPerSecond. + /// Get from UsSurveyFeetPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromUsSurveyFeetPerSecond(QuantityValue ussurveyfeetpersecond) + public static Speed FromUsSurveyFeetPerSecond(QuantityValue ussurveyfeetpersecond) { double value = (double) ussurveyfeetpersecond; - return new Speed(value, SpeedUnit.UsSurveyFootPerSecond); + return new Speed(value, SpeedUnit.UsSurveyFootPerSecond); } /// - /// Get Speed from YardsPerHour. + /// Get from YardsPerHour. /// /// If value is NaN or Infinity. - public static Speed FromYardsPerHour(QuantityValue yardsperhour) + public static Speed FromYardsPerHour(QuantityValue yardsperhour) { double value = (double) yardsperhour; - return new Speed(value, SpeedUnit.YardPerHour); + return new Speed(value, SpeedUnit.YardPerHour); } /// - /// Get Speed from YardsPerMinute. + /// Get from YardsPerMinute. /// /// If value is NaN or Infinity. - public static Speed FromYardsPerMinute(QuantityValue yardsperminute) + public static Speed FromYardsPerMinute(QuantityValue yardsperminute) { double value = (double) yardsperminute; - return new Speed(value, SpeedUnit.YardPerMinute); + return new Speed(value, SpeedUnit.YardPerMinute); } /// - /// Get Speed from YardsPerSecond. + /// Get from YardsPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromYardsPerSecond(QuantityValue yardspersecond) + public static Speed FromYardsPerSecond(QuantityValue yardspersecond) { double value = (double) yardspersecond; - return new Speed(value, SpeedUnit.YardPerSecond); + return new Speed(value, SpeedUnit.YardPerSecond); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Speed unit value. - public static Speed From(QuantityValue value, SpeedUnit fromUnit) + /// unit value. + public static Speed From(QuantityValue value, SpeedUnit fromUnit) { - return new Speed((double)value, fromUnit); + return new Speed((double)value, fromUnit); } #endregion @@ -709,7 +709,7 @@ public static Speed From(QuantityValue value, SpeedUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Speed Parse(string str) + public static Speed Parse(string str) { return Parse(str, null); } @@ -737,9 +737,9 @@ public static Speed Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Speed Parse(string str, [CanBeNull] IFormatProvider provider) + public static Speed Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, SpeedUnit>( str, provider, From); @@ -753,7 +753,7 @@ public static Speed Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Speed result) + public static bool TryParse([CanBeNull] string str, out Speed result) { return TryParse(str, null, out result); } @@ -768,9 +768,9 @@ public static bool TryParse([CanBeNull] string str, out Speed result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Speed result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Speed result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, SpeedUnit>( str, provider, From, @@ -832,43 +832,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out SpeedU #region Arithmetic Operators /// Negate the value. - public static Speed operator -(Speed right) + public static Speed operator -(Speed right) { - return new Speed(-right.Value, right.Unit); + return new Speed(-right.Value, right.Unit); } - /// Get from adding two . - public static Speed operator +(Speed left, Speed right) + /// Get from adding two . + public static Speed operator +(Speed left, Speed right) { - return new Speed(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Speed(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Speed operator -(Speed left, Speed right) + /// Get from subtracting two . + public static Speed operator -(Speed left, Speed right) { - return new Speed(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Speed(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Speed operator *(double left, Speed right) + /// Get from multiplying value and . + public static Speed operator *(double left, Speed right) { - return new Speed(left * right.Value, right.Unit); + return new Speed(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Speed operator *(Speed left, double right) + /// Get from multiplying value and . + public static Speed operator *(Speed left, double right) { - return new Speed(left.Value * right, left.Unit); + return new Speed(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Speed operator /(Speed left, double right) + /// Get from dividing by value. + public static Speed operator /(Speed left, double right) { - return new Speed(left.Value / right, left.Unit); + return new Speed(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Speed left, Speed right) + /// Get ratio value from dividing by . + public static double operator /(Speed left, Speed right) { return left.MetersPerSecond / right.MetersPerSecond; } @@ -878,39 +878,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out SpeedU #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Speed left, Speed right) + public static bool operator <=(Speed left, Speed right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Speed left, Speed right) + public static bool operator >=(Speed left, Speed right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Speed left, Speed right) + public static bool operator <(Speed left, Speed right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Speed left, Speed right) + public static bool operator >(Speed left, Speed right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Speed left, Speed right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Speed left, Speed right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Speed left, Speed right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Speed left, Speed right) { return !(left == right); } @@ -919,37 +919,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out SpeedU public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Speed objSpeed)) throw new ArgumentException("Expected type Speed.", nameof(obj)); + if(!(obj is Speed objSpeed)) throw new ArgumentException("Expected type Speed.", nameof(obj)); return CompareTo(objSpeed); } /// - public int CompareTo(Speed other) + public int CompareTo(Speed other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Speed objSpeed)) + if(obj is null || !(obj is Speed objSpeed)) return false; return Equals(objSpeed); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Speed other) + /// Consider using for safely comparing floating point values. + public bool Equals(Speed other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Speed within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -987,7 +987,7 @@ public bool Equals(Speed other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Speed other, double tolerance, ComparisonType comparisonType) + public bool Equals(Speed other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -1001,7 +1001,7 @@ public bool Equals(Speed other, double tolerance, ComparisonType comparisonType) /// /// Returns the hash code for this instance. /// - /// A hash code for the current Speed. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -1049,13 +1049,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Speed to another Speed with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Speed with the specified unit. - public Speed ToUnit(SpeedUnit unit) + /// A with the specified unit. + public Speed ToUnit(SpeedUnit unit) { var convertedValue = GetValueAs(unit); - return new Speed(convertedValue, unit); + return new Speed(convertedValue, unit); } /// @@ -1068,7 +1068,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Speed ToUnit(UnitSystem unitSystem) + public Speed ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1142,10 +1142,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Speed ToBaseUnit() + internal Speed ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Speed(baseUnitValue, BaseUnit); + return new Speed(baseUnitValue, BaseUnit); } private double GetValueAs(SpeedUnit unit) @@ -1285,7 +1285,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Speed)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Speed)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1295,12 +1295,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Speed)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Speed)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Speed)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Speed)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1345,16 +1345,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Speed)) + if(conversionType == typeof(Speed)) return this; else if(conversionType == typeof(SpeedUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Speed.QuantityType; + return Speed.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Speed.BaseDimensions; + return Speed.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Speed)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Speed)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs index 748579c88e..9af3a29244 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// A temperature is a numerical measure of hot or cold. Its measurement is by detection of heat radiation or particle velocity or kinetic energy, or by the bulk behavior of a thermometric material. It may be calibrated in any of various temperature scales, Celsius, Fahrenheit, Kelvin, etc. The fundamental physical definition of temperature is provided by thermodynamics. /// - public partial struct Temperature : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Temperature : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -108,19 +108,19 @@ public Temperature(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Temperature, which is Kelvin. All conversions go via this value. + /// The base unit of , which is Kelvin. All conversions go via this value. /// public static TemperatureUnit BaseUnit { get; } = TemperatureUnit.Kelvin; /// - /// Represents the largest possible value of Temperature + /// Represents the largest possible value of /// - public static Temperature MaxValue { get; } = new Temperature(double.MaxValue, BaseUnit); + public static Temperature MaxValue { get; } = new Temperature(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Temperature + /// Represents the smallest possible value of /// - public static Temperature MinValue { get; } = new Temperature(double.MinValue, BaseUnit); + public static Temperature MinValue { get; } = new Temperature(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,14 +128,14 @@ public Temperature(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Temperature; /// - /// All units of measurement for the Temperature quantity. + /// All units of measurement for the quantity. /// public static TemperatureUnit[] Units { get; } = Enum.GetValues(typeof(TemperatureUnit)).Cast().Except(new TemperatureUnit[]{ TemperatureUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Kelvin. /// - public static Temperature Zero { get; } = new Temperature(0, BaseUnit); + public static Temperature Zero { get; } = new Temperature(0, BaseUnit); #endregion @@ -160,59 +160,59 @@ public Temperature(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Temperature.QuantityType; + public QuantityType Type => Temperature.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Temperature.BaseDimensions; + public BaseDimensions Dimensions => Temperature.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Temperature in DegreesCelsius. + /// Get in DegreesCelsius. /// public double DegreesCelsius => As(TemperatureUnit.DegreeCelsius); /// - /// Get Temperature in DegreesDelisle. + /// Get in DegreesDelisle. /// public double DegreesDelisle => As(TemperatureUnit.DegreeDelisle); /// - /// Get Temperature in DegreesFahrenheit. + /// Get in DegreesFahrenheit. /// public double DegreesFahrenheit => As(TemperatureUnit.DegreeFahrenheit); /// - /// Get Temperature in DegreesNewton. + /// Get in DegreesNewton. /// public double DegreesNewton => As(TemperatureUnit.DegreeNewton); /// - /// Get Temperature in DegreesRankine. + /// Get in DegreesRankine. /// public double DegreesRankine => As(TemperatureUnit.DegreeRankine); /// - /// Get Temperature in DegreesReaumur. + /// Get in DegreesReaumur. /// public double DegreesReaumur => As(TemperatureUnit.DegreeReaumur); /// - /// Get Temperature in DegreesRoemer. + /// Get in DegreesRoemer. /// public double DegreesRoemer => As(TemperatureUnit.DegreeRoemer); /// - /// Get Temperature in Kelvins. + /// Get in Kelvins. /// public double Kelvins => As(TemperatureUnit.Kelvin); /// - /// Get Temperature in SolarTemperatures. + /// Get in SolarTemperatures. /// public double SolarTemperatures => As(TemperatureUnit.SolarTemperature); @@ -246,96 +246,96 @@ public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] IFormatPr #region Static Factory Methods /// - /// Get Temperature from DegreesCelsius. + /// Get from DegreesCelsius. /// /// If value is NaN or Infinity. - public static Temperature FromDegreesCelsius(QuantityValue degreescelsius) + public static Temperature FromDegreesCelsius(QuantityValue degreescelsius) { double value = (double) degreescelsius; - return new Temperature(value, TemperatureUnit.DegreeCelsius); + return new Temperature(value, TemperatureUnit.DegreeCelsius); } /// - /// Get Temperature from DegreesDelisle. + /// Get from DegreesDelisle. /// /// If value is NaN or Infinity. - public static Temperature FromDegreesDelisle(QuantityValue degreesdelisle) + public static Temperature FromDegreesDelisle(QuantityValue degreesdelisle) { double value = (double) degreesdelisle; - return new Temperature(value, TemperatureUnit.DegreeDelisle); + return new Temperature(value, TemperatureUnit.DegreeDelisle); } /// - /// Get Temperature from DegreesFahrenheit. + /// Get from DegreesFahrenheit. /// /// If value is NaN or Infinity. - public static Temperature FromDegreesFahrenheit(QuantityValue degreesfahrenheit) + public static Temperature FromDegreesFahrenheit(QuantityValue degreesfahrenheit) { double value = (double) degreesfahrenheit; - return new Temperature(value, TemperatureUnit.DegreeFahrenheit); + return new Temperature(value, TemperatureUnit.DegreeFahrenheit); } /// - /// Get Temperature from DegreesNewton. + /// Get from DegreesNewton. /// /// If value is NaN or Infinity. - public static Temperature FromDegreesNewton(QuantityValue degreesnewton) + public static Temperature FromDegreesNewton(QuantityValue degreesnewton) { double value = (double) degreesnewton; - return new Temperature(value, TemperatureUnit.DegreeNewton); + return new Temperature(value, TemperatureUnit.DegreeNewton); } /// - /// Get Temperature from DegreesRankine. + /// Get from DegreesRankine. /// /// If value is NaN or Infinity. - public static Temperature FromDegreesRankine(QuantityValue degreesrankine) + public static Temperature FromDegreesRankine(QuantityValue degreesrankine) { double value = (double) degreesrankine; - return new Temperature(value, TemperatureUnit.DegreeRankine); + return new Temperature(value, TemperatureUnit.DegreeRankine); } /// - /// Get Temperature from DegreesReaumur. + /// Get from DegreesReaumur. /// /// If value is NaN or Infinity. - public static Temperature FromDegreesReaumur(QuantityValue degreesreaumur) + public static Temperature FromDegreesReaumur(QuantityValue degreesreaumur) { double value = (double) degreesreaumur; - return new Temperature(value, TemperatureUnit.DegreeReaumur); + return new Temperature(value, TemperatureUnit.DegreeReaumur); } /// - /// Get Temperature from DegreesRoemer. + /// Get from DegreesRoemer. /// /// If value is NaN or Infinity. - public static Temperature FromDegreesRoemer(QuantityValue degreesroemer) + public static Temperature FromDegreesRoemer(QuantityValue degreesroemer) { double value = (double) degreesroemer; - return new Temperature(value, TemperatureUnit.DegreeRoemer); + return new Temperature(value, TemperatureUnit.DegreeRoemer); } /// - /// Get Temperature from Kelvins. + /// Get from Kelvins. /// /// If value is NaN or Infinity. - public static Temperature FromKelvins(QuantityValue kelvins) + public static Temperature FromKelvins(QuantityValue kelvins) { double value = (double) kelvins; - return new Temperature(value, TemperatureUnit.Kelvin); + return new Temperature(value, TemperatureUnit.Kelvin); } /// - /// Get Temperature from SolarTemperatures. + /// Get from SolarTemperatures. /// /// If value is NaN or Infinity. - public static Temperature FromSolarTemperatures(QuantityValue solartemperatures) + public static Temperature FromSolarTemperatures(QuantityValue solartemperatures) { double value = (double) solartemperatures; - return new Temperature(value, TemperatureUnit.SolarTemperature); + return new Temperature(value, TemperatureUnit.SolarTemperature); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Temperature unit value. - public static Temperature From(QuantityValue value, TemperatureUnit fromUnit) + /// unit value. + public static Temperature From(QuantityValue value, TemperatureUnit fromUnit) { - return new Temperature((double)value, fromUnit); + return new Temperature((double)value, fromUnit); } #endregion @@ -364,7 +364,7 @@ public static Temperature From(QuantityValue value, TemperatureUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Temperature Parse(string str) + public static Temperature Parse(string str) { return Parse(str, null); } @@ -392,9 +392,9 @@ public static Temperature Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Temperature Parse(string str, [CanBeNull] IFormatProvider provider) + public static Temperature Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, TemperatureUnit>( str, provider, From); @@ -408,7 +408,7 @@ public static Temperature Parse(string str, [CanBeNull] IFormatProvider provider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Temperature result) + public static bool TryParse([CanBeNull] string str, out Temperature result) { return TryParse(str, null, out result); } @@ -423,9 +423,9 @@ public static bool TryParse([CanBeNull] string str, out Temperature result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Temperature result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Temperature result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, TemperatureUnit>( str, provider, From, @@ -487,39 +487,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Temperature left, Temperature right) + public static bool operator <=(Temperature left, Temperature right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Temperature left, Temperature right) + public static bool operator >=(Temperature left, Temperature right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Temperature left, Temperature right) + public static bool operator <(Temperature left, Temperature right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Temperature left, Temperature right) + public static bool operator >(Temperature left, Temperature right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Temperature left, Temperature right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Temperature left, Temperature right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Temperature left, Temperature right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Temperature left, Temperature right) { return !(left == right); } @@ -528,37 +528,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Temperature objTemperature)) throw new ArgumentException("Expected type Temperature.", nameof(obj)); + if(!(obj is Temperature objTemperature)) throw new ArgumentException("Expected type Temperature.", nameof(obj)); return CompareTo(objTemperature); } /// - public int CompareTo(Temperature other) + public int CompareTo(Temperature other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Temperature objTemperature)) + if(obj is null || !(obj is Temperature objTemperature)) return false; return Equals(objTemperature); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Temperature other) + /// Consider using for safely comparing floating point values. + public bool Equals(Temperature other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Temperature within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -596,7 +596,7 @@ public bool Equals(Temperature other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Temperature other, double tolerance, ComparisonType comparisonType) + public bool Equals(Temperature other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -610,7 +610,7 @@ public bool Equals(Temperature other, double tolerance, ComparisonType compariso /// /// Returns the hash code for this instance. /// - /// A hash code for the current Temperature. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -658,13 +658,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Temperature to another Temperature with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Temperature with the specified unit. - public Temperature ToUnit(TemperatureUnit unit) + /// A with the specified unit. + public Temperature ToUnit(TemperatureUnit unit) { var convertedValue = GetValueAs(unit); - return new Temperature(convertedValue, unit); + return new Temperature(convertedValue, unit); } /// @@ -677,7 +677,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Temperature ToUnit(UnitSystem unitSystem) + public Temperature ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -728,10 +728,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Temperature ToBaseUnit() + internal Temperature ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Temperature(baseUnitValue, BaseUnit); + return new Temperature(baseUnitValue, BaseUnit); } private double GetValueAs(TemperatureUnit unit) @@ -848,7 +848,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Temperature)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Temperature)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -858,12 +858,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Temperature)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Temperature)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Temperature)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Temperature)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -908,16 +908,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Temperature)) + if(conversionType == typeof(Temperature)) return this; else if(conversionType == typeof(TemperatureUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Temperature.QuantityType; + return Temperature.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Temperature.BaseDimensions; + return Temperature.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Temperature)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Temperature)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs index ef6a2f6b47..4d2a73f9dd 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Temperature change rate is the ratio of the temperature change to the time during which the change occurred (value of temperature changes per unit time). /// - public partial struct TemperatureChangeRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct TemperatureChangeRate : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -109,19 +109,19 @@ public TemperatureChangeRate(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of TemperatureChangeRate, which is DegreeCelsiusPerSecond. All conversions go via this value. + /// The base unit of , which is DegreeCelsiusPerSecond. All conversions go via this value. /// public static TemperatureChangeRateUnit BaseUnit { get; } = TemperatureChangeRateUnit.DegreeCelsiusPerSecond; /// - /// Represents the largest possible value of TemperatureChangeRate + /// Represents the largest possible value of /// - public static TemperatureChangeRate MaxValue { get; } = new TemperatureChangeRate(double.MaxValue, BaseUnit); + public static TemperatureChangeRate MaxValue { get; } = new TemperatureChangeRate(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of TemperatureChangeRate + /// Represents the smallest possible value of /// - public static TemperatureChangeRate MinValue { get; } = new TemperatureChangeRate(double.MinValue, BaseUnit); + public static TemperatureChangeRate MinValue { get; } = new TemperatureChangeRate(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -129,14 +129,14 @@ public TemperatureChangeRate(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.TemperatureChangeRate; /// - /// All units of measurement for the TemperatureChangeRate quantity. + /// All units of measurement for the quantity. /// public static TemperatureChangeRateUnit[] Units { get; } = Enum.GetValues(typeof(TemperatureChangeRateUnit)).Cast().Except(new TemperatureChangeRateUnit[]{ TemperatureChangeRateUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit DegreeCelsiusPerSecond. /// - public static TemperatureChangeRate Zero { get; } = new TemperatureChangeRate(0, BaseUnit); + public static TemperatureChangeRate Zero { get; } = new TemperatureChangeRate(0, BaseUnit); #endregion @@ -161,64 +161,64 @@ public TemperatureChangeRate(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => TemperatureChangeRate.QuantityType; + public QuantityType Type => TemperatureChangeRate.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => TemperatureChangeRate.BaseDimensions; + public BaseDimensions Dimensions => TemperatureChangeRate.BaseDimensions; #endregion #region Conversion Properties /// - /// Get TemperatureChangeRate in CentidegreesCelsiusPerSecond. + /// Get in CentidegreesCelsiusPerSecond. /// public double CentidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond); /// - /// Get TemperatureChangeRate in DecadegreesCelsiusPerSecond. + /// Get in DecadegreesCelsiusPerSecond. /// public double DecadegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond); /// - /// Get TemperatureChangeRate in DecidegreesCelsiusPerSecond. + /// Get in DecidegreesCelsiusPerSecond. /// public double DecidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond); /// - /// Get TemperatureChangeRate in DegreesCelsiusPerMinute. + /// Get in DegreesCelsiusPerMinute. /// public double DegreesCelsiusPerMinute => As(TemperatureChangeRateUnit.DegreeCelsiusPerMinute); /// - /// Get TemperatureChangeRate in DegreesCelsiusPerSecond. + /// Get in DegreesCelsiusPerSecond. /// public double DegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DegreeCelsiusPerSecond); /// - /// Get TemperatureChangeRate in HectodegreesCelsiusPerSecond. + /// Get in HectodegreesCelsiusPerSecond. /// public double HectodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond); /// - /// Get TemperatureChangeRate in KilodegreesCelsiusPerSecond. + /// Get in KilodegreesCelsiusPerSecond. /// public double KilodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond); /// - /// Get TemperatureChangeRate in MicrodegreesCelsiusPerSecond. + /// Get in MicrodegreesCelsiusPerSecond. /// public double MicrodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond); /// - /// Get TemperatureChangeRate in MillidegreesCelsiusPerSecond. + /// Get in MillidegreesCelsiusPerSecond. /// public double MillidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond); /// - /// Get TemperatureChangeRate in NanodegreesCelsiusPerSecond. + /// Get in NanodegreesCelsiusPerSecond. /// public double NanodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond); @@ -252,105 +252,105 @@ public static string GetAbbreviation(TemperatureChangeRateUnit unit, [CanBeNull] #region Static Factory Methods /// - /// Get TemperatureChangeRate from CentidegreesCelsiusPerSecond. + /// Get from CentidegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromCentidegreesCelsiusPerSecond(QuantityValue centidegreescelsiuspersecond) + public static TemperatureChangeRate FromCentidegreesCelsiusPerSecond(QuantityValue centidegreescelsiuspersecond) { double value = (double) centidegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond); + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond); } /// - /// Get TemperatureChangeRate from DecadegreesCelsiusPerSecond. + /// Get from DecadegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromDecadegreesCelsiusPerSecond(QuantityValue decadegreescelsiuspersecond) + public static TemperatureChangeRate FromDecadegreesCelsiusPerSecond(QuantityValue decadegreescelsiuspersecond) { double value = (double) decadegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond); + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond); } /// - /// Get TemperatureChangeRate from DecidegreesCelsiusPerSecond. + /// Get from DecidegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromDecidegreesCelsiusPerSecond(QuantityValue decidegreescelsiuspersecond) + public static TemperatureChangeRate FromDecidegreesCelsiusPerSecond(QuantityValue decidegreescelsiuspersecond) { double value = (double) decidegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond); + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond); } /// - /// Get TemperatureChangeRate from DegreesCelsiusPerMinute. + /// Get from DegreesCelsiusPerMinute. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromDegreesCelsiusPerMinute(QuantityValue degreescelsiusperminute) + public static TemperatureChangeRate FromDegreesCelsiusPerMinute(QuantityValue degreescelsiusperminute) { double value = (double) degreescelsiusperminute; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DegreeCelsiusPerMinute); + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DegreeCelsiusPerMinute); } /// - /// Get TemperatureChangeRate from DegreesCelsiusPerSecond. + /// Get from DegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromDegreesCelsiusPerSecond(QuantityValue degreescelsiuspersecond) + public static TemperatureChangeRate FromDegreesCelsiusPerSecond(QuantityValue degreescelsiuspersecond) { double value = (double) degreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DegreeCelsiusPerSecond); + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DegreeCelsiusPerSecond); } /// - /// Get TemperatureChangeRate from HectodegreesCelsiusPerSecond. + /// Get from HectodegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromHectodegreesCelsiusPerSecond(QuantityValue hectodegreescelsiuspersecond) + public static TemperatureChangeRate FromHectodegreesCelsiusPerSecond(QuantityValue hectodegreescelsiuspersecond) { double value = (double) hectodegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond); + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond); } /// - /// Get TemperatureChangeRate from KilodegreesCelsiusPerSecond. + /// Get from KilodegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromKilodegreesCelsiusPerSecond(QuantityValue kilodegreescelsiuspersecond) + public static TemperatureChangeRate FromKilodegreesCelsiusPerSecond(QuantityValue kilodegreescelsiuspersecond) { double value = (double) kilodegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond); + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond); } /// - /// Get TemperatureChangeRate from MicrodegreesCelsiusPerSecond. + /// Get from MicrodegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromMicrodegreesCelsiusPerSecond(QuantityValue microdegreescelsiuspersecond) + public static TemperatureChangeRate FromMicrodegreesCelsiusPerSecond(QuantityValue microdegreescelsiuspersecond) { double value = (double) microdegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond); + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond); } /// - /// Get TemperatureChangeRate from MillidegreesCelsiusPerSecond. + /// Get from MillidegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromMillidegreesCelsiusPerSecond(QuantityValue millidegreescelsiuspersecond) + public static TemperatureChangeRate FromMillidegreesCelsiusPerSecond(QuantityValue millidegreescelsiuspersecond) { double value = (double) millidegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond); + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond); } /// - /// Get TemperatureChangeRate from NanodegreesCelsiusPerSecond. + /// Get from NanodegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromNanodegreesCelsiusPerSecond(QuantityValue nanodegreescelsiuspersecond) + public static TemperatureChangeRate FromNanodegreesCelsiusPerSecond(QuantityValue nanodegreescelsiuspersecond) { double value = (double) nanodegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond); + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// TemperatureChangeRate unit value. - public static TemperatureChangeRate From(QuantityValue value, TemperatureChangeRateUnit fromUnit) + /// unit value. + public static TemperatureChangeRate From(QuantityValue value, TemperatureChangeRateUnit fromUnit) { - return new TemperatureChangeRate((double)value, fromUnit); + return new TemperatureChangeRate((double)value, fromUnit); } #endregion @@ -379,7 +379,7 @@ public static TemperatureChangeRate From(QuantityValue value, TemperatureChangeR /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static TemperatureChangeRate Parse(string str) + public static TemperatureChangeRate Parse(string str) { return Parse(str, null); } @@ -407,9 +407,9 @@ public static TemperatureChangeRate Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static TemperatureChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) + public static TemperatureChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, TemperatureChangeRateUnit>( str, provider, From); @@ -423,7 +423,7 @@ public static TemperatureChangeRate Parse(string str, [CanBeNull] IFormatProvide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out TemperatureChangeRate result) + public static bool TryParse([CanBeNull] string str, out TemperatureChangeRate result) { return TryParse(str, null, out result); } @@ -438,9 +438,9 @@ public static bool TryParse([CanBeNull] string str, out TemperatureChangeRate re /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureChangeRate result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureChangeRate result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, TemperatureChangeRateUnit>( str, provider, From, @@ -502,43 +502,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper #region Arithmetic Operators /// Negate the value. - public static TemperatureChangeRate operator -(TemperatureChangeRate right) + public static TemperatureChangeRate operator -(TemperatureChangeRate right) { - return new TemperatureChangeRate(-right.Value, right.Unit); + return new TemperatureChangeRate(-right.Value, right.Unit); } - /// Get from adding two . - public static TemperatureChangeRate operator +(TemperatureChangeRate left, TemperatureChangeRate right) + /// Get from adding two . + public static TemperatureChangeRate operator +(TemperatureChangeRate left, TemperatureChangeRate right) { - return new TemperatureChangeRate(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new TemperatureChangeRate(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static TemperatureChangeRate operator -(TemperatureChangeRate left, TemperatureChangeRate right) + /// Get from subtracting two . + public static TemperatureChangeRate operator -(TemperatureChangeRate left, TemperatureChangeRate right) { - return new TemperatureChangeRate(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new TemperatureChangeRate(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static TemperatureChangeRate operator *(double left, TemperatureChangeRate right) + /// Get from multiplying value and . + public static TemperatureChangeRate operator *(double left, TemperatureChangeRate right) { - return new TemperatureChangeRate(left * right.Value, right.Unit); + return new TemperatureChangeRate(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static TemperatureChangeRate operator *(TemperatureChangeRate left, double right) + /// Get from multiplying value and . + public static TemperatureChangeRate operator *(TemperatureChangeRate left, double right) { - return new TemperatureChangeRate(left.Value * right, left.Unit); + return new TemperatureChangeRate(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static TemperatureChangeRate operator /(TemperatureChangeRate left, double right) + /// Get from dividing by value. + public static TemperatureChangeRate operator /(TemperatureChangeRate left, double right) { - return new TemperatureChangeRate(left.Value / right, left.Unit); + return new TemperatureChangeRate(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(TemperatureChangeRate left, TemperatureChangeRate right) + /// Get ratio value from dividing by . + public static double operator /(TemperatureChangeRate left, TemperatureChangeRate right) { return left.DegreesCelsiusPerSecond / right.DegreesCelsiusPerSecond; } @@ -548,39 +548,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(TemperatureChangeRate left, TemperatureChangeRate right) + public static bool operator <=(TemperatureChangeRate left, TemperatureChangeRate right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(TemperatureChangeRate left, TemperatureChangeRate right) + public static bool operator >=(TemperatureChangeRate left, TemperatureChangeRate right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(TemperatureChangeRate left, TemperatureChangeRate right) + public static bool operator <(TemperatureChangeRate left, TemperatureChangeRate right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(TemperatureChangeRate left, TemperatureChangeRate right) + public static bool operator >(TemperatureChangeRate left, TemperatureChangeRate right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(TemperatureChangeRate left, TemperatureChangeRate right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(TemperatureChangeRate left, TemperatureChangeRate right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(TemperatureChangeRate left, TemperatureChangeRate right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(TemperatureChangeRate left, TemperatureChangeRate right) { return !(left == right); } @@ -589,37 +589,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is TemperatureChangeRate objTemperatureChangeRate)) throw new ArgumentException("Expected type TemperatureChangeRate.", nameof(obj)); + if(!(obj is TemperatureChangeRate objTemperatureChangeRate)) throw new ArgumentException("Expected type TemperatureChangeRate.", nameof(obj)); return CompareTo(objTemperatureChangeRate); } /// - public int CompareTo(TemperatureChangeRate other) + public int CompareTo(TemperatureChangeRate other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is TemperatureChangeRate objTemperatureChangeRate)) + if(obj is null || !(obj is TemperatureChangeRate objTemperatureChangeRate)) return false; return Equals(objTemperatureChangeRate); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(TemperatureChangeRate other) + /// Consider using for safely comparing floating point values. + public bool Equals(TemperatureChangeRate other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another TemperatureChangeRate within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -657,7 +657,7 @@ public bool Equals(TemperatureChangeRate other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(TemperatureChangeRate other, double tolerance, ComparisonType comparisonType) + public bool Equals(TemperatureChangeRate other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -671,7 +671,7 @@ public bool Equals(TemperatureChangeRate other, double tolerance, ComparisonType /// /// Returns the hash code for this instance. /// - /// A hash code for the current TemperatureChangeRate. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -719,13 +719,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this TemperatureChangeRate to another TemperatureChangeRate with the unit representation . + /// Converts this to another with the unit representation . /// - /// A TemperatureChangeRate with the specified unit. - public TemperatureChangeRate ToUnit(TemperatureChangeRateUnit unit) + /// A with the specified unit. + public TemperatureChangeRate ToUnit(TemperatureChangeRateUnit unit) { var convertedValue = GetValueAs(unit); - return new TemperatureChangeRate(convertedValue, unit); + return new TemperatureChangeRate(convertedValue, unit); } /// @@ -738,7 +738,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public TemperatureChangeRate ToUnit(UnitSystem unitSystem) + public TemperatureChangeRate ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -790,10 +790,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal TemperatureChangeRate ToBaseUnit() + internal TemperatureChangeRate ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new TemperatureChangeRate(baseUnitValue, BaseUnit); + return new TemperatureChangeRate(baseUnitValue, BaseUnit); } private double GetValueAs(TemperatureChangeRateUnit unit) @@ -911,7 +911,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -921,12 +921,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -971,16 +971,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(TemperatureChangeRate)) + if(conversionType == typeof(TemperatureChangeRate)) return this; else if(conversionType == typeof(TemperatureChangeRateUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return TemperatureChangeRate.QuantityType; + return TemperatureChangeRate.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return TemperatureChangeRate.BaseDimensions; + return TemperatureChangeRate.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs index 8cbe90dd65..d074cb57cf 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Difference between two temperatures. The conversions are different than for Temperature. /// - public partial struct TemperatureDelta : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct TemperatureDelta : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -107,19 +107,19 @@ public TemperatureDelta(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of TemperatureDelta, which is Kelvin. All conversions go via this value. + /// The base unit of , which is Kelvin. All conversions go via this value. /// public static TemperatureDeltaUnit BaseUnit { get; } = TemperatureDeltaUnit.Kelvin; /// - /// Represents the largest possible value of TemperatureDelta + /// Represents the largest possible value of /// - public static TemperatureDelta MaxValue { get; } = new TemperatureDelta(double.MaxValue, BaseUnit); + public static TemperatureDelta MaxValue { get; } = new TemperatureDelta(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of TemperatureDelta + /// Represents the smallest possible value of /// - public static TemperatureDelta MinValue { get; } = new TemperatureDelta(double.MinValue, BaseUnit); + public static TemperatureDelta MinValue { get; } = new TemperatureDelta(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -127,14 +127,14 @@ public TemperatureDelta(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.TemperatureDelta; /// - /// All units of measurement for the TemperatureDelta quantity. + /// All units of measurement for the quantity. /// public static TemperatureDeltaUnit[] Units { get; } = Enum.GetValues(typeof(TemperatureDeltaUnit)).Cast().Except(new TemperatureDeltaUnit[]{ TemperatureDeltaUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit Kelvin. /// - public static TemperatureDelta Zero { get; } = new TemperatureDelta(0, BaseUnit); + public static TemperatureDelta Zero { get; } = new TemperatureDelta(0, BaseUnit); #endregion @@ -159,54 +159,54 @@ public TemperatureDelta(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => TemperatureDelta.QuantityType; + public QuantityType Type => TemperatureDelta.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => TemperatureDelta.BaseDimensions; + public BaseDimensions Dimensions => TemperatureDelta.BaseDimensions; #endregion #region Conversion Properties /// - /// Get TemperatureDelta in DegreesCelsius. + /// Get in DegreesCelsius. /// public double DegreesCelsius => As(TemperatureDeltaUnit.DegreeCelsius); /// - /// Get TemperatureDelta in DegreesDelisle. + /// Get in DegreesDelisle. /// public double DegreesDelisle => As(TemperatureDeltaUnit.DegreeDelisle); /// - /// Get TemperatureDelta in DegreesFahrenheit. + /// Get in DegreesFahrenheit. /// public double DegreesFahrenheit => As(TemperatureDeltaUnit.DegreeFahrenheit); /// - /// Get TemperatureDelta in DegreesNewton. + /// Get in DegreesNewton. /// public double DegreesNewton => As(TemperatureDeltaUnit.DegreeNewton); /// - /// Get TemperatureDelta in DegreesRankine. + /// Get in DegreesRankine. /// public double DegreesRankine => As(TemperatureDeltaUnit.DegreeRankine); /// - /// Get TemperatureDelta in DegreesReaumur. + /// Get in DegreesReaumur. /// public double DegreesReaumur => As(TemperatureDeltaUnit.DegreeReaumur); /// - /// Get TemperatureDelta in DegreesRoemer. + /// Get in DegreesRoemer. /// public double DegreesRoemer => As(TemperatureDeltaUnit.DegreeRoemer); /// - /// Get TemperatureDelta in Kelvins. + /// Get in Kelvins. /// public double Kelvins => As(TemperatureDeltaUnit.Kelvin); @@ -240,87 +240,87 @@ public static string GetAbbreviation(TemperatureDeltaUnit unit, [CanBeNull] IFor #region Static Factory Methods /// - /// Get TemperatureDelta from DegreesCelsius. + /// Get from DegreesCelsius. /// /// If value is NaN or Infinity. - public static TemperatureDelta FromDegreesCelsius(QuantityValue degreescelsius) + public static TemperatureDelta FromDegreesCelsius(QuantityValue degreescelsius) { double value = (double) degreescelsius; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeCelsius); + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeCelsius); } /// - /// Get TemperatureDelta from DegreesDelisle. + /// Get from DegreesDelisle. /// /// If value is NaN or Infinity. - public static TemperatureDelta FromDegreesDelisle(QuantityValue degreesdelisle) + public static TemperatureDelta FromDegreesDelisle(QuantityValue degreesdelisle) { double value = (double) degreesdelisle; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeDelisle); + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeDelisle); } /// - /// Get TemperatureDelta from DegreesFahrenheit. + /// Get from DegreesFahrenheit. /// /// If value is NaN or Infinity. - public static TemperatureDelta FromDegreesFahrenheit(QuantityValue degreesfahrenheit) + public static TemperatureDelta FromDegreesFahrenheit(QuantityValue degreesfahrenheit) { double value = (double) degreesfahrenheit; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeFahrenheit); + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeFahrenheit); } /// - /// Get TemperatureDelta from DegreesNewton. + /// Get from DegreesNewton. /// /// If value is NaN or Infinity. - public static TemperatureDelta FromDegreesNewton(QuantityValue degreesnewton) + public static TemperatureDelta FromDegreesNewton(QuantityValue degreesnewton) { double value = (double) degreesnewton; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeNewton); + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeNewton); } /// - /// Get TemperatureDelta from DegreesRankine. + /// Get from DegreesRankine. /// /// If value is NaN or Infinity. - public static TemperatureDelta FromDegreesRankine(QuantityValue degreesrankine) + public static TemperatureDelta FromDegreesRankine(QuantityValue degreesrankine) { double value = (double) degreesrankine; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeRankine); + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeRankine); } /// - /// Get TemperatureDelta from DegreesReaumur. + /// Get from DegreesReaumur. /// /// If value is NaN or Infinity. - public static TemperatureDelta FromDegreesReaumur(QuantityValue degreesreaumur) + public static TemperatureDelta FromDegreesReaumur(QuantityValue degreesreaumur) { double value = (double) degreesreaumur; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeReaumur); + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeReaumur); } /// - /// Get TemperatureDelta from DegreesRoemer. + /// Get from DegreesRoemer. /// /// If value is NaN or Infinity. - public static TemperatureDelta FromDegreesRoemer(QuantityValue degreesroemer) + public static TemperatureDelta FromDegreesRoemer(QuantityValue degreesroemer) { double value = (double) degreesroemer; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeRoemer); + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeRoemer); } /// - /// Get TemperatureDelta from Kelvins. + /// Get from Kelvins. /// /// If value is NaN or Infinity. - public static TemperatureDelta FromKelvins(QuantityValue kelvins) + public static TemperatureDelta FromKelvins(QuantityValue kelvins) { double value = (double) kelvins; - return new TemperatureDelta(value, TemperatureDeltaUnit.Kelvin); + return new TemperatureDelta(value, TemperatureDeltaUnit.Kelvin); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// TemperatureDelta unit value. - public static TemperatureDelta From(QuantityValue value, TemperatureDeltaUnit fromUnit) + /// unit value. + public static TemperatureDelta From(QuantityValue value, TemperatureDeltaUnit fromUnit) { - return new TemperatureDelta((double)value, fromUnit); + return new TemperatureDelta((double)value, fromUnit); } #endregion @@ -349,7 +349,7 @@ public static TemperatureDelta From(QuantityValue value, TemperatureDeltaUnit fr /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static TemperatureDelta Parse(string str) + public static TemperatureDelta Parse(string str) { return Parse(str, null); } @@ -377,9 +377,9 @@ public static TemperatureDelta Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static TemperatureDelta Parse(string str, [CanBeNull] IFormatProvider provider) + public static TemperatureDelta Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, TemperatureDeltaUnit>( str, provider, From); @@ -393,7 +393,7 @@ public static TemperatureDelta Parse(string str, [CanBeNull] IFormatProvider pro /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out TemperatureDelta result) + public static bool TryParse([CanBeNull] string str, out TemperatureDelta result) { return TryParse(str, null, out result); } @@ -408,9 +408,9 @@ public static bool TryParse([CanBeNull] string str, out TemperatureDelta result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureDelta result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureDelta result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, TemperatureDeltaUnit>( str, provider, From, @@ -472,43 +472,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper #region Arithmetic Operators /// Negate the value. - public static TemperatureDelta operator -(TemperatureDelta right) + public static TemperatureDelta operator -(TemperatureDelta right) { - return new TemperatureDelta(-right.Value, right.Unit); + return new TemperatureDelta(-right.Value, right.Unit); } - /// Get from adding two . - public static TemperatureDelta operator +(TemperatureDelta left, TemperatureDelta right) + /// Get from adding two . + public static TemperatureDelta operator +(TemperatureDelta left, TemperatureDelta right) { - return new TemperatureDelta(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new TemperatureDelta(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static TemperatureDelta operator -(TemperatureDelta left, TemperatureDelta right) + /// Get from subtracting two . + public static TemperatureDelta operator -(TemperatureDelta left, TemperatureDelta right) { - return new TemperatureDelta(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new TemperatureDelta(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static TemperatureDelta operator *(double left, TemperatureDelta right) + /// Get from multiplying value and . + public static TemperatureDelta operator *(double left, TemperatureDelta right) { - return new TemperatureDelta(left * right.Value, right.Unit); + return new TemperatureDelta(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static TemperatureDelta operator *(TemperatureDelta left, double right) + /// Get from multiplying value and . + public static TemperatureDelta operator *(TemperatureDelta left, double right) { - return new TemperatureDelta(left.Value * right, left.Unit); + return new TemperatureDelta(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static TemperatureDelta operator /(TemperatureDelta left, double right) + /// Get from dividing by value. + public static TemperatureDelta operator /(TemperatureDelta left, double right) { - return new TemperatureDelta(left.Value / right, left.Unit); + return new TemperatureDelta(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(TemperatureDelta left, TemperatureDelta right) + /// Get ratio value from dividing by . + public static double operator /(TemperatureDelta left, TemperatureDelta right) { return left.Kelvins / right.Kelvins; } @@ -518,39 +518,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(TemperatureDelta left, TemperatureDelta right) + public static bool operator <=(TemperatureDelta left, TemperatureDelta right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(TemperatureDelta left, TemperatureDelta right) + public static bool operator >=(TemperatureDelta left, TemperatureDelta right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(TemperatureDelta left, TemperatureDelta right) + public static bool operator <(TemperatureDelta left, TemperatureDelta right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(TemperatureDelta left, TemperatureDelta right) + public static bool operator >(TemperatureDelta left, TemperatureDelta right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(TemperatureDelta left, TemperatureDelta right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(TemperatureDelta left, TemperatureDelta right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(TemperatureDelta left, TemperatureDelta right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(TemperatureDelta left, TemperatureDelta right) { return !(left == right); } @@ -559,37 +559,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is TemperatureDelta objTemperatureDelta)) throw new ArgumentException("Expected type TemperatureDelta.", nameof(obj)); + if(!(obj is TemperatureDelta objTemperatureDelta)) throw new ArgumentException("Expected type TemperatureDelta.", nameof(obj)); return CompareTo(objTemperatureDelta); } /// - public int CompareTo(TemperatureDelta other) + public int CompareTo(TemperatureDelta other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is TemperatureDelta objTemperatureDelta)) + if(obj is null || !(obj is TemperatureDelta objTemperatureDelta)) return false; return Equals(objTemperatureDelta); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(TemperatureDelta other) + /// Consider using for safely comparing floating point values. + public bool Equals(TemperatureDelta other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another TemperatureDelta within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -627,7 +627,7 @@ public bool Equals(TemperatureDelta other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(TemperatureDelta other, double tolerance, ComparisonType comparisonType) + public bool Equals(TemperatureDelta other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -641,7 +641,7 @@ public bool Equals(TemperatureDelta other, double tolerance, ComparisonType comp /// /// Returns the hash code for this instance. /// - /// A hash code for the current TemperatureDelta. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -689,13 +689,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this TemperatureDelta to another TemperatureDelta with the unit representation . + /// Converts this to another with the unit representation . /// - /// A TemperatureDelta with the specified unit. - public TemperatureDelta ToUnit(TemperatureDeltaUnit unit) + /// A with the specified unit. + public TemperatureDelta ToUnit(TemperatureDeltaUnit unit) { var convertedValue = GetValueAs(unit); - return new TemperatureDelta(convertedValue, unit); + return new TemperatureDelta(convertedValue, unit); } /// @@ -708,7 +708,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public TemperatureDelta ToUnit(UnitSystem unitSystem) + public TemperatureDelta ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -758,10 +758,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal TemperatureDelta ToBaseUnit() + internal TemperatureDelta ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new TemperatureDelta(baseUnitValue, BaseUnit); + return new TemperatureDelta(baseUnitValue, BaseUnit); } private double GetValueAs(TemperatureDeltaUnit unit) @@ -877,7 +877,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -887,12 +887,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -937,16 +937,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(TemperatureDelta)) + if(conversionType == typeof(TemperatureDelta)) return this; else if(conversionType == typeof(TemperatureDeltaUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return TemperatureDelta.QuantityType; + return TemperatureDelta.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return TemperatureDelta.BaseDimensions; + return TemperatureDelta.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs index d253dc1eb7..7a69d3a224 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Thermal_Conductivity /// - public partial struct ThermalConductivity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ThermalConductivity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -104,19 +104,19 @@ public ThermalConductivity(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ThermalConductivity, which is WattPerMeterKelvin. All conversions go via this value. + /// The base unit of , which is WattPerMeterKelvin. All conversions go via this value. /// public static ThermalConductivityUnit BaseUnit { get; } = ThermalConductivityUnit.WattPerMeterKelvin; /// - /// Represents the largest possible value of ThermalConductivity + /// Represents the largest possible value of /// - public static ThermalConductivity MaxValue { get; } = new ThermalConductivity(double.MaxValue, BaseUnit); + public static ThermalConductivity MaxValue { get; } = new ThermalConductivity(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ThermalConductivity + /// Represents the smallest possible value of /// - public static ThermalConductivity MinValue { get; } = new ThermalConductivity(double.MinValue, BaseUnit); + public static ThermalConductivity MinValue { get; } = new ThermalConductivity(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -124,14 +124,14 @@ public ThermalConductivity(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ThermalConductivity; /// - /// All units of measurement for the ThermalConductivity quantity. + /// All units of measurement for the quantity. /// public static ThermalConductivityUnit[] Units { get; } = Enum.GetValues(typeof(ThermalConductivityUnit)).Cast().Except(new ThermalConductivityUnit[]{ ThermalConductivityUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit WattPerMeterKelvin. /// - public static ThermalConductivity Zero { get; } = new ThermalConductivity(0, BaseUnit); + public static ThermalConductivity Zero { get; } = new ThermalConductivity(0, BaseUnit); #endregion @@ -156,24 +156,24 @@ public ThermalConductivity(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ThermalConductivity.QuantityType; + public QuantityType Type => ThermalConductivity.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ThermalConductivity.BaseDimensions; + public BaseDimensions Dimensions => ThermalConductivity.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ThermalConductivity in BtusPerHourFootFahrenheit. + /// Get in BtusPerHourFootFahrenheit. /// public double BtusPerHourFootFahrenheit => As(ThermalConductivityUnit.BtuPerHourFootFahrenheit); /// - /// Get ThermalConductivity in WattsPerMeterKelvin. + /// Get in WattsPerMeterKelvin. /// public double WattsPerMeterKelvin => As(ThermalConductivityUnit.WattPerMeterKelvin); @@ -207,33 +207,33 @@ public static string GetAbbreviation(ThermalConductivityUnit unit, [CanBeNull] I #region Static Factory Methods /// - /// Get ThermalConductivity from BtusPerHourFootFahrenheit. + /// Get from BtusPerHourFootFahrenheit. /// /// If value is NaN or Infinity. - public static ThermalConductivity FromBtusPerHourFootFahrenheit(QuantityValue btusperhourfootfahrenheit) + public static ThermalConductivity FromBtusPerHourFootFahrenheit(QuantityValue btusperhourfootfahrenheit) { double value = (double) btusperhourfootfahrenheit; - return new ThermalConductivity(value, ThermalConductivityUnit.BtuPerHourFootFahrenheit); + return new ThermalConductivity(value, ThermalConductivityUnit.BtuPerHourFootFahrenheit); } /// - /// Get ThermalConductivity from WattsPerMeterKelvin. + /// Get from WattsPerMeterKelvin. /// /// If value is NaN or Infinity. - public static ThermalConductivity FromWattsPerMeterKelvin(QuantityValue wattspermeterkelvin) + public static ThermalConductivity FromWattsPerMeterKelvin(QuantityValue wattspermeterkelvin) { double value = (double) wattspermeterkelvin; - return new ThermalConductivity(value, ThermalConductivityUnit.WattPerMeterKelvin); + return new ThermalConductivity(value, ThermalConductivityUnit.WattPerMeterKelvin); } /// - /// Dynamically convert from value and unit enum to . + /// 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) + /// unit value. + public static ThermalConductivity From(QuantityValue value, ThermalConductivityUnit fromUnit) { - return new ThermalConductivity((double)value, fromUnit); + return new ThermalConductivity((double)value, fromUnit); } #endregion @@ -262,7 +262,7 @@ public static ThermalConductivity From(QuantityValue value, ThermalConductivityU /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ThermalConductivity Parse(string str) + public static ThermalConductivity Parse(string str) { return Parse(str, null); } @@ -290,9 +290,9 @@ public static ThermalConductivity Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ThermalConductivity Parse(string str, [CanBeNull] IFormatProvider provider) + public static ThermalConductivity Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ThermalConductivityUnit>( str, provider, From); @@ -306,7 +306,7 @@ public static ThermalConductivity Parse(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ThermalConductivity result) + public static bool TryParse([CanBeNull] string str, out ThermalConductivity result) { return TryParse(str, null, out result); } @@ -321,9 +321,9 @@ public static bool TryParse([CanBeNull] string str, out ThermalConductivity resu /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalConductivity result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalConductivity result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ThermalConductivityUnit>( str, provider, From, @@ -385,43 +385,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Therma #region Arithmetic Operators /// Negate the value. - public static ThermalConductivity operator -(ThermalConductivity right) + public static ThermalConductivity operator -(ThermalConductivity right) { - return new ThermalConductivity(-right.Value, right.Unit); + return new ThermalConductivity(-right.Value, right.Unit); } - /// Get from adding two . - public static ThermalConductivity operator +(ThermalConductivity left, ThermalConductivity right) + /// Get from adding two . + public static ThermalConductivity operator +(ThermalConductivity left, ThermalConductivity right) { - return new ThermalConductivity(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ThermalConductivity(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ThermalConductivity operator -(ThermalConductivity left, ThermalConductivity right) + /// Get from subtracting two . + public static ThermalConductivity operator -(ThermalConductivity left, ThermalConductivity right) { - return new ThermalConductivity(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ThermalConductivity(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ThermalConductivity operator *(double left, ThermalConductivity right) + /// Get from multiplying value and . + public static ThermalConductivity operator *(double left, ThermalConductivity right) { - return new ThermalConductivity(left * right.Value, right.Unit); + return new ThermalConductivity(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ThermalConductivity operator *(ThermalConductivity left, double right) + /// Get from multiplying value and . + public static ThermalConductivity operator *(ThermalConductivity left, double right) { - return new ThermalConductivity(left.Value * right, left.Unit); + return new ThermalConductivity(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ThermalConductivity operator /(ThermalConductivity left, double right) + /// Get from dividing by value. + public static ThermalConductivity operator /(ThermalConductivity left, double right) { - return new ThermalConductivity(left.Value / right, left.Unit); + return new ThermalConductivity(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ThermalConductivity left, ThermalConductivity right) + /// Get ratio value from dividing by . + public static double operator /(ThermalConductivity left, ThermalConductivity right) { return left.WattsPerMeterKelvin / right.WattsPerMeterKelvin; } @@ -431,39 +431,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Therma #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ThermalConductivity left, ThermalConductivity right) + public static bool operator <=(ThermalConductivity left, ThermalConductivity right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ThermalConductivity left, ThermalConductivity right) + public static bool operator >=(ThermalConductivity left, ThermalConductivity right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ThermalConductivity left, ThermalConductivity right) + public static bool operator <(ThermalConductivity left, ThermalConductivity right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ThermalConductivity left, ThermalConductivity right) + public static bool operator >(ThermalConductivity left, ThermalConductivity right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ThermalConductivity left, ThermalConductivity right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ThermalConductivity left, ThermalConductivity right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ThermalConductivity left, ThermalConductivity right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ThermalConductivity left, ThermalConductivity right) { return !(left == right); } @@ -472,37 +472,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Therma public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ThermalConductivity objThermalConductivity)) throw new ArgumentException("Expected type ThermalConductivity.", nameof(obj)); + if(!(obj is ThermalConductivity objThermalConductivity)) throw new ArgumentException("Expected type ThermalConductivity.", nameof(obj)); return CompareTo(objThermalConductivity); } /// - public int CompareTo(ThermalConductivity other) + public int CompareTo(ThermalConductivity other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ThermalConductivity objThermalConductivity)) + if(obj is null || !(obj is ThermalConductivity objThermalConductivity)) return false; return Equals(objThermalConductivity); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ThermalConductivity other) + /// Consider using for safely comparing floating point values. + public bool Equals(ThermalConductivity other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ThermalConductivity within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -540,7 +540,7 @@ public bool Equals(ThermalConductivity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ThermalConductivity other, double tolerance, ComparisonType comparisonType) + public bool Equals(ThermalConductivity other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -554,7 +554,7 @@ public bool Equals(ThermalConductivity other, double tolerance, ComparisonType c /// /// Returns the hash code for this instance. /// - /// A hash code for the current ThermalConductivity. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -602,13 +602,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ThermalConductivity to another ThermalConductivity with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ThermalConductivity with the specified unit. - public ThermalConductivity ToUnit(ThermalConductivityUnit unit) + /// A with the specified unit. + public ThermalConductivity ToUnit(ThermalConductivityUnit unit) { var convertedValue = GetValueAs(unit); - return new ThermalConductivity(convertedValue, unit); + return new ThermalConductivity(convertedValue, unit); } /// @@ -621,7 +621,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ThermalConductivity ToUnit(UnitSystem unitSystem) + public ThermalConductivity ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -665,10 +665,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ThermalConductivity ToBaseUnit() + internal ThermalConductivity ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ThermalConductivity(baseUnitValue, BaseUnit); + return new ThermalConductivity(baseUnitValue, BaseUnit); } private double GetValueAs(ThermalConductivityUnit unit) @@ -778,7 +778,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -788,12 +788,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -838,16 +838,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ThermalConductivity)) + if(conversionType == typeof(ThermalConductivity)) return this; else if(conversionType == typeof(ThermalConductivityUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ThermalConductivity.QuantityType; + return ThermalConductivity.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ThermalConductivity.BaseDimensions; + return ThermalConductivity.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs index e86109f59d..84e72ca39d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Heat Transfer Coefficient or Thermal conductivity - indicates a materials ability to conduct heat. /// - public partial struct ThermalResistance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct ThermalResistance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -104,19 +104,19 @@ public ThermalResistance(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of ThermalResistance, which is SquareMeterKelvinPerKilowatt. All conversions go via this value. + /// The base unit of , which is SquareMeterKelvinPerKilowatt. All conversions go via this value. /// public static ThermalResistanceUnit BaseUnit { get; } = ThermalResistanceUnit.SquareMeterKelvinPerKilowatt; /// - /// Represents the largest possible value of ThermalResistance + /// Represents the largest possible value of /// - public static ThermalResistance MaxValue { get; } = new ThermalResistance(double.MaxValue, BaseUnit); + public static ThermalResistance MaxValue { get; } = new ThermalResistance(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of ThermalResistance + /// Represents the smallest possible value of /// - public static ThermalResistance MinValue { get; } = new ThermalResistance(double.MinValue, BaseUnit); + public static ThermalResistance MinValue { get; } = new ThermalResistance(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -124,14 +124,14 @@ public ThermalResistance(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.ThermalResistance; /// - /// All units of measurement for the ThermalResistance quantity. + /// All units of measurement for the quantity. /// public static ThermalResistanceUnit[] Units { get; } = Enum.GetValues(typeof(ThermalResistanceUnit)).Cast().Except(new ThermalResistanceUnit[]{ ThermalResistanceUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeterKelvinPerKilowatt. /// - public static ThermalResistance Zero { get; } = new ThermalResistance(0, BaseUnit); + public static ThermalResistance Zero { get; } = new ThermalResistance(0, BaseUnit); #endregion @@ -156,39 +156,39 @@ public ThermalResistance(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => ThermalResistance.QuantityType; + public QuantityType Type => ThermalResistance.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => ThermalResistance.BaseDimensions; + public BaseDimensions Dimensions => ThermalResistance.BaseDimensions; #endregion #region Conversion Properties /// - /// Get ThermalResistance in HourSquareFeetDegreesFahrenheitPerBtu. + /// Get in HourSquareFeetDegreesFahrenheitPerBtu. /// public double HourSquareFeetDegreesFahrenheitPerBtu => As(ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu); /// - /// Get ThermalResistance in SquareCentimeterHourDegreesCelsiusPerKilocalorie. + /// Get in SquareCentimeterHourDegreesCelsiusPerKilocalorie. /// public double SquareCentimeterHourDegreesCelsiusPerKilocalorie => As(ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie); /// - /// Get ThermalResistance in SquareCentimeterKelvinsPerWatt. + /// Get in SquareCentimeterKelvinsPerWatt. /// public double SquareCentimeterKelvinsPerWatt => As(ThermalResistanceUnit.SquareCentimeterKelvinPerWatt); /// - /// Get ThermalResistance in SquareMeterDegreesCelsiusPerWatt. + /// Get in SquareMeterDegreesCelsiusPerWatt. /// public double SquareMeterDegreesCelsiusPerWatt => As(ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt); /// - /// Get ThermalResistance in SquareMeterKelvinsPerKilowatt. + /// Get in SquareMeterKelvinsPerKilowatt. /// public double SquareMeterKelvinsPerKilowatt => As(ThermalResistanceUnit.SquareMeterKelvinPerKilowatt); @@ -222,60 +222,60 @@ public static string GetAbbreviation(ThermalResistanceUnit unit, [CanBeNull] IFo #region Static Factory Methods /// - /// Get ThermalResistance from HourSquareFeetDegreesFahrenheitPerBtu. + /// Get from HourSquareFeetDegreesFahrenheitPerBtu. /// /// If value is NaN or Infinity. - public static ThermalResistance FromHourSquareFeetDegreesFahrenheitPerBtu(QuantityValue hoursquarefeetdegreesfahrenheitperbtu) + public static ThermalResistance FromHourSquareFeetDegreesFahrenheitPerBtu(QuantityValue hoursquarefeetdegreesfahrenheitperbtu) { double value = (double) hoursquarefeetdegreesfahrenheitperbtu; - return new ThermalResistance(value, ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu); + return new ThermalResistance(value, ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu); } /// - /// Get ThermalResistance from SquareCentimeterHourDegreesCelsiusPerKilocalorie. + /// Get from SquareCentimeterHourDegreesCelsiusPerKilocalorie. /// /// If value is NaN or Infinity. - public static ThermalResistance FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(QuantityValue squarecentimeterhourdegreescelsiusperkilocalorie) + public static ThermalResistance FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(QuantityValue squarecentimeterhourdegreescelsiusperkilocalorie) { double value = (double) squarecentimeterhourdegreescelsiusperkilocalorie; - return new ThermalResistance(value, ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie); + return new ThermalResistance(value, ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie); } /// - /// Get ThermalResistance from SquareCentimeterKelvinsPerWatt. + /// Get from SquareCentimeterKelvinsPerWatt. /// /// If value is NaN or Infinity. - public static ThermalResistance FromSquareCentimeterKelvinsPerWatt(QuantityValue squarecentimeterkelvinsperwatt) + public static ThermalResistance FromSquareCentimeterKelvinsPerWatt(QuantityValue squarecentimeterkelvinsperwatt) { double value = (double) squarecentimeterkelvinsperwatt; - return new ThermalResistance(value, ThermalResistanceUnit.SquareCentimeterKelvinPerWatt); + return new ThermalResistance(value, ThermalResistanceUnit.SquareCentimeterKelvinPerWatt); } /// - /// Get ThermalResistance from SquareMeterDegreesCelsiusPerWatt. + /// Get from SquareMeterDegreesCelsiusPerWatt. /// /// If value is NaN or Infinity. - public static ThermalResistance FromSquareMeterDegreesCelsiusPerWatt(QuantityValue squaremeterdegreescelsiusperwatt) + public static ThermalResistance FromSquareMeterDegreesCelsiusPerWatt(QuantityValue squaremeterdegreescelsiusperwatt) { double value = (double) squaremeterdegreescelsiusperwatt; - return new ThermalResistance(value, ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt); + return new ThermalResistance(value, ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt); } /// - /// Get ThermalResistance from SquareMeterKelvinsPerKilowatt. + /// Get from SquareMeterKelvinsPerKilowatt. /// /// If value is NaN or Infinity. - public static ThermalResistance FromSquareMeterKelvinsPerKilowatt(QuantityValue squaremeterkelvinsperkilowatt) + public static ThermalResistance FromSquareMeterKelvinsPerKilowatt(QuantityValue squaremeterkelvinsperkilowatt) { double value = (double) squaremeterkelvinsperkilowatt; - return new ThermalResistance(value, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt); + return new ThermalResistance(value, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// ThermalResistance unit value. - public static ThermalResistance From(QuantityValue value, ThermalResistanceUnit fromUnit) + /// unit value. + public static ThermalResistance From(QuantityValue value, ThermalResistanceUnit fromUnit) { - return new ThermalResistance((double)value, fromUnit); + return new ThermalResistance((double)value, fromUnit); } #endregion @@ -304,7 +304,7 @@ public static ThermalResistance From(QuantityValue value, ThermalResistanceUnit /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static ThermalResistance Parse(string str) + public static ThermalResistance Parse(string str) { return Parse(str, null); } @@ -332,9 +332,9 @@ public static ThermalResistance Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static ThermalResistance Parse(string str, [CanBeNull] IFormatProvider provider) + public static ThermalResistance Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, ThermalResistanceUnit>( str, provider, From); @@ -348,7 +348,7 @@ public static ThermalResistance Parse(string str, [CanBeNull] IFormatProvider pr /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out ThermalResistance result) + public static bool TryParse([CanBeNull] string str, out ThermalResistance result) { return TryParse(str, null, out result); } @@ -363,9 +363,9 @@ public static bool TryParse([CanBeNull] string str, out ThermalResistance result /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalResistance result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalResistance result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, ThermalResistanceUnit>( str, provider, From, @@ -427,43 +427,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Therma #region Arithmetic Operators /// Negate the value. - public static ThermalResistance operator -(ThermalResistance right) + public static ThermalResistance operator -(ThermalResistance right) { - return new ThermalResistance(-right.Value, right.Unit); + return new ThermalResistance(-right.Value, right.Unit); } - /// Get from adding two . - public static ThermalResistance operator +(ThermalResistance left, ThermalResistance right) + /// Get from adding two . + public static ThermalResistance operator +(ThermalResistance left, ThermalResistance right) { - return new ThermalResistance(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new ThermalResistance(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static ThermalResistance operator -(ThermalResistance left, ThermalResistance right) + /// Get from subtracting two . + public static ThermalResistance operator -(ThermalResistance left, ThermalResistance right) { - return new ThermalResistance(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new ThermalResistance(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static ThermalResistance operator *(double left, ThermalResistance right) + /// Get from multiplying value and . + public static ThermalResistance operator *(double left, ThermalResistance right) { - return new ThermalResistance(left * right.Value, right.Unit); + return new ThermalResistance(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static ThermalResistance operator *(ThermalResistance left, double right) + /// Get from multiplying value and . + public static ThermalResistance operator *(ThermalResistance left, double right) { - return new ThermalResistance(left.Value * right, left.Unit); + return new ThermalResistance(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static ThermalResistance operator /(ThermalResistance left, double right) + /// Get from dividing by value. + public static ThermalResistance operator /(ThermalResistance left, double right) { - return new ThermalResistance(left.Value / right, left.Unit); + return new ThermalResistance(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(ThermalResistance left, ThermalResistance right) + /// Get ratio value from dividing by . + public static double operator /(ThermalResistance left, ThermalResistance right) { return left.SquareMeterKelvinsPerKilowatt / right.SquareMeterKelvinsPerKilowatt; } @@ -473,39 +473,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Therma #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(ThermalResistance left, ThermalResistance right) + public static bool operator <=(ThermalResistance left, ThermalResistance right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(ThermalResistance left, ThermalResistance right) + public static bool operator >=(ThermalResistance left, ThermalResistance right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(ThermalResistance left, ThermalResistance right) + public static bool operator <(ThermalResistance left, ThermalResistance right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(ThermalResistance left, ThermalResistance right) + public static bool operator >(ThermalResistance left, ThermalResistance right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(ThermalResistance left, ThermalResistance right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(ThermalResistance left, ThermalResistance right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(ThermalResistance left, ThermalResistance right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(ThermalResistance left, ThermalResistance right) { return !(left == right); } @@ -514,37 +514,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Therma public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ThermalResistance objThermalResistance)) throw new ArgumentException("Expected type ThermalResistance.", nameof(obj)); + if(!(obj is ThermalResistance objThermalResistance)) throw new ArgumentException("Expected type ThermalResistance.", nameof(obj)); return CompareTo(objThermalResistance); } /// - public int CompareTo(ThermalResistance other) + public int CompareTo(ThermalResistance other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ThermalResistance objThermalResistance)) + if(obj is null || !(obj is ThermalResistance objThermalResistance)) return false; return Equals(objThermalResistance); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(ThermalResistance other) + /// Consider using for safely comparing floating point values. + public bool Equals(ThermalResistance other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another ThermalResistance within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -582,7 +582,7 @@ public bool Equals(ThermalResistance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ThermalResistance other, double tolerance, ComparisonType comparisonType) + public bool Equals(ThermalResistance other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -596,7 +596,7 @@ public bool Equals(ThermalResistance other, double tolerance, ComparisonType com /// /// Returns the hash code for this instance. /// - /// A hash code for the current ThermalResistance. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -644,13 +644,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this ThermalResistance to another ThermalResistance with the unit representation . + /// Converts this to another with the unit representation . /// - /// A ThermalResistance with the specified unit. - public ThermalResistance ToUnit(ThermalResistanceUnit unit) + /// A with the specified unit. + public ThermalResistance ToUnit(ThermalResistanceUnit unit) { var convertedValue = GetValueAs(unit); - return new ThermalResistance(convertedValue, unit); + return new ThermalResistance(convertedValue, unit); } /// @@ -663,7 +663,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public ThermalResistance ToUnit(UnitSystem unitSystem) + public ThermalResistance ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -710,10 +710,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal ThermalResistance ToBaseUnit() + internal ThermalResistance ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new ThermalResistance(baseUnitValue, BaseUnit); + return new ThermalResistance(baseUnitValue, BaseUnit); } private double GetValueAs(ThermalResistanceUnit unit) @@ -826,7 +826,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -836,12 +836,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -886,16 +886,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ThermalResistance)) + if(conversionType == typeof(ThermalResistance)) return this; else if(conversionType == typeof(ThermalResistanceUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return ThermalResistance.QuantityType; + return ThermalResistance.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return ThermalResistance.BaseDimensions; + return ThermalResistance.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs index 46e15adb3a..8a3fb1d239 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Torque, moment or moment of force (see the terminology below), is the tendency of a force to rotate an object about an axis,[1] fulcrum, or pivot. Just as a force is a push or a pull, a torque can be thought of as a twist to an object. Mathematically, torque is defined as the cross product of the lever-arm distance and force, which tends to produce rotation. Loosely speaking, torque is a measure of the turning force on an object such as a bolt or a flywheel. For example, pushing or pulling the handle of a wrench connected to a nut or bolt produces a torque (turning force) that loosens or tightens the nut or bolt. /// - public partial struct Torque : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Torque : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -120,19 +120,19 @@ public Torque(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Torque, which is NewtonMeter. All conversions go via this value. + /// The base unit of , which is NewtonMeter. All conversions go via this value. /// public static TorqueUnit BaseUnit { get; } = TorqueUnit.NewtonMeter; /// - /// Represents the largest possible value of Torque + /// Represents the largest possible value of /// - public static Torque MaxValue { get; } = new Torque(double.MaxValue, BaseUnit); + public static Torque MaxValue { get; } = new Torque(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Torque + /// Represents the smallest possible value of /// - public static Torque MinValue { get; } = new Torque(double.MinValue, BaseUnit); + public static Torque MinValue { get; } = new Torque(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -140,14 +140,14 @@ public Torque(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Torque; /// - /// All units of measurement for the Torque quantity. + /// All units of measurement for the quantity. /// public static TorqueUnit[] Units { get; } = Enum.GetValues(typeof(TorqueUnit)).Cast().Except(new TorqueUnit[]{ TorqueUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeter. /// - public static Torque Zero { get; } = new Torque(0, BaseUnit); + public static Torque Zero { get; } = new Torque(0, BaseUnit); #endregion @@ -172,119 +172,119 @@ public Torque(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Torque.QuantityType; + public QuantityType Type => Torque.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Torque.BaseDimensions; + public BaseDimensions Dimensions => Torque.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Torque in KilogramForceCentimeters. + /// Get in KilogramForceCentimeters. /// public double KilogramForceCentimeters => As(TorqueUnit.KilogramForceCentimeter); /// - /// Get Torque in KilogramForceMeters. + /// Get in KilogramForceMeters. /// public double KilogramForceMeters => As(TorqueUnit.KilogramForceMeter); /// - /// Get Torque in KilogramForceMillimeters. + /// Get in KilogramForceMillimeters. /// public double KilogramForceMillimeters => As(TorqueUnit.KilogramForceMillimeter); /// - /// Get Torque in KilonewtonCentimeters. + /// Get in KilonewtonCentimeters. /// public double KilonewtonCentimeters => As(TorqueUnit.KilonewtonCentimeter); /// - /// Get Torque in KilonewtonMeters. + /// Get in KilonewtonMeters. /// public double KilonewtonMeters => As(TorqueUnit.KilonewtonMeter); /// - /// Get Torque in KilonewtonMillimeters. + /// Get in KilonewtonMillimeters. /// public double KilonewtonMillimeters => As(TorqueUnit.KilonewtonMillimeter); /// - /// Get Torque in KilopoundForceFeet. + /// Get in KilopoundForceFeet. /// public double KilopoundForceFeet => As(TorqueUnit.KilopoundForceFoot); /// - /// Get Torque in KilopoundForceInches. + /// Get in KilopoundForceInches. /// public double KilopoundForceInches => As(TorqueUnit.KilopoundForceInch); /// - /// Get Torque in MeganewtonCentimeters. + /// Get in MeganewtonCentimeters. /// public double MeganewtonCentimeters => As(TorqueUnit.MeganewtonCentimeter); /// - /// Get Torque in MeganewtonMeters. + /// Get in MeganewtonMeters. /// public double MeganewtonMeters => As(TorqueUnit.MeganewtonMeter); /// - /// Get Torque in MeganewtonMillimeters. + /// Get in MeganewtonMillimeters. /// public double MeganewtonMillimeters => As(TorqueUnit.MeganewtonMillimeter); /// - /// Get Torque in MegapoundForceFeet. + /// Get in MegapoundForceFeet. /// public double MegapoundForceFeet => As(TorqueUnit.MegapoundForceFoot); /// - /// Get Torque in MegapoundForceInches. + /// Get in MegapoundForceInches. /// public double MegapoundForceInches => As(TorqueUnit.MegapoundForceInch); /// - /// Get Torque in NewtonCentimeters. + /// Get in NewtonCentimeters. /// public double NewtonCentimeters => As(TorqueUnit.NewtonCentimeter); /// - /// Get Torque in NewtonMeters. + /// Get in NewtonMeters. /// public double NewtonMeters => As(TorqueUnit.NewtonMeter); /// - /// Get Torque in NewtonMillimeters. + /// Get in NewtonMillimeters. /// public double NewtonMillimeters => As(TorqueUnit.NewtonMillimeter); /// - /// Get Torque in PoundForceFeet. + /// Get in PoundForceFeet. /// public double PoundForceFeet => As(TorqueUnit.PoundForceFoot); /// - /// Get Torque in PoundForceInches. + /// Get in PoundForceInches. /// public double PoundForceInches => As(TorqueUnit.PoundForceInch); /// - /// Get Torque in TonneForceCentimeters. + /// Get in TonneForceCentimeters. /// public double TonneForceCentimeters => As(TorqueUnit.TonneForceCentimeter); /// - /// Get Torque in TonneForceMeters. + /// Get in TonneForceMeters. /// public double TonneForceMeters => As(TorqueUnit.TonneForceMeter); /// - /// Get Torque in TonneForceMillimeters. + /// Get in TonneForceMillimeters. /// public double TonneForceMillimeters => As(TorqueUnit.TonneForceMillimeter); @@ -318,204 +318,204 @@ public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] IFormatProvide #region Static Factory Methods /// - /// Get Torque from KilogramForceCentimeters. + /// Get from KilogramForceCentimeters. /// /// If value is NaN or Infinity. - public static Torque FromKilogramForceCentimeters(QuantityValue kilogramforcecentimeters) + public static Torque FromKilogramForceCentimeters(QuantityValue kilogramforcecentimeters) { double value = (double) kilogramforcecentimeters; - return new Torque(value, TorqueUnit.KilogramForceCentimeter); + return new Torque(value, TorqueUnit.KilogramForceCentimeter); } /// - /// Get Torque from KilogramForceMeters. + /// Get from KilogramForceMeters. /// /// If value is NaN or Infinity. - public static Torque FromKilogramForceMeters(QuantityValue kilogramforcemeters) + public static Torque FromKilogramForceMeters(QuantityValue kilogramforcemeters) { double value = (double) kilogramforcemeters; - return new Torque(value, TorqueUnit.KilogramForceMeter); + return new Torque(value, TorqueUnit.KilogramForceMeter); } /// - /// Get Torque from KilogramForceMillimeters. + /// Get from KilogramForceMillimeters. /// /// If value is NaN or Infinity. - public static Torque FromKilogramForceMillimeters(QuantityValue kilogramforcemillimeters) + public static Torque FromKilogramForceMillimeters(QuantityValue kilogramforcemillimeters) { double value = (double) kilogramforcemillimeters; - return new Torque(value, TorqueUnit.KilogramForceMillimeter); + return new Torque(value, TorqueUnit.KilogramForceMillimeter); } /// - /// Get Torque from KilonewtonCentimeters. + /// Get from KilonewtonCentimeters. /// /// If value is NaN or Infinity. - public static Torque FromKilonewtonCentimeters(QuantityValue kilonewtoncentimeters) + public static Torque FromKilonewtonCentimeters(QuantityValue kilonewtoncentimeters) { double value = (double) kilonewtoncentimeters; - return new Torque(value, TorqueUnit.KilonewtonCentimeter); + return new Torque(value, TorqueUnit.KilonewtonCentimeter); } /// - /// Get Torque from KilonewtonMeters. + /// Get from KilonewtonMeters. /// /// If value is NaN or Infinity. - public static Torque FromKilonewtonMeters(QuantityValue kilonewtonmeters) + public static Torque FromKilonewtonMeters(QuantityValue kilonewtonmeters) { double value = (double) kilonewtonmeters; - return new Torque(value, TorqueUnit.KilonewtonMeter); + return new Torque(value, TorqueUnit.KilonewtonMeter); } /// - /// Get Torque from KilonewtonMillimeters. + /// Get from KilonewtonMillimeters. /// /// If value is NaN or Infinity. - public static Torque FromKilonewtonMillimeters(QuantityValue kilonewtonmillimeters) + public static Torque FromKilonewtonMillimeters(QuantityValue kilonewtonmillimeters) { double value = (double) kilonewtonmillimeters; - return new Torque(value, TorqueUnit.KilonewtonMillimeter); + return new Torque(value, TorqueUnit.KilonewtonMillimeter); } /// - /// Get Torque from KilopoundForceFeet. + /// Get from KilopoundForceFeet. /// /// If value is NaN or Infinity. - public static Torque FromKilopoundForceFeet(QuantityValue kilopoundforcefeet) + public static Torque FromKilopoundForceFeet(QuantityValue kilopoundforcefeet) { double value = (double) kilopoundforcefeet; - return new Torque(value, TorqueUnit.KilopoundForceFoot); + return new Torque(value, TorqueUnit.KilopoundForceFoot); } /// - /// Get Torque from KilopoundForceInches. + /// Get from KilopoundForceInches. /// /// If value is NaN or Infinity. - public static Torque FromKilopoundForceInches(QuantityValue kilopoundforceinches) + public static Torque FromKilopoundForceInches(QuantityValue kilopoundforceinches) { double value = (double) kilopoundforceinches; - return new Torque(value, TorqueUnit.KilopoundForceInch); + return new Torque(value, TorqueUnit.KilopoundForceInch); } /// - /// Get Torque from MeganewtonCentimeters. + /// Get from MeganewtonCentimeters. /// /// If value is NaN or Infinity. - public static Torque FromMeganewtonCentimeters(QuantityValue meganewtoncentimeters) + public static Torque FromMeganewtonCentimeters(QuantityValue meganewtoncentimeters) { double value = (double) meganewtoncentimeters; - return new Torque(value, TorqueUnit.MeganewtonCentimeter); + return new Torque(value, TorqueUnit.MeganewtonCentimeter); } /// - /// Get Torque from MeganewtonMeters. + /// Get from MeganewtonMeters. /// /// If value is NaN or Infinity. - public static Torque FromMeganewtonMeters(QuantityValue meganewtonmeters) + public static Torque FromMeganewtonMeters(QuantityValue meganewtonmeters) { double value = (double) meganewtonmeters; - return new Torque(value, TorqueUnit.MeganewtonMeter); + return new Torque(value, TorqueUnit.MeganewtonMeter); } /// - /// Get Torque from MeganewtonMillimeters. + /// Get from MeganewtonMillimeters. /// /// If value is NaN or Infinity. - public static Torque FromMeganewtonMillimeters(QuantityValue meganewtonmillimeters) + public static Torque FromMeganewtonMillimeters(QuantityValue meganewtonmillimeters) { double value = (double) meganewtonmillimeters; - return new Torque(value, TorqueUnit.MeganewtonMillimeter); + return new Torque(value, TorqueUnit.MeganewtonMillimeter); } /// - /// Get Torque from MegapoundForceFeet. + /// Get from MegapoundForceFeet. /// /// If value is NaN or Infinity. - public static Torque FromMegapoundForceFeet(QuantityValue megapoundforcefeet) + public static Torque FromMegapoundForceFeet(QuantityValue megapoundforcefeet) { double value = (double) megapoundforcefeet; - return new Torque(value, TorqueUnit.MegapoundForceFoot); + return new Torque(value, TorqueUnit.MegapoundForceFoot); } /// - /// Get Torque from MegapoundForceInches. + /// Get from MegapoundForceInches. /// /// If value is NaN or Infinity. - public static Torque FromMegapoundForceInches(QuantityValue megapoundforceinches) + public static Torque FromMegapoundForceInches(QuantityValue megapoundforceinches) { double value = (double) megapoundforceinches; - return new Torque(value, TorqueUnit.MegapoundForceInch); + return new Torque(value, TorqueUnit.MegapoundForceInch); } /// - /// Get Torque from NewtonCentimeters. + /// Get from NewtonCentimeters. /// /// If value is NaN or Infinity. - public static Torque FromNewtonCentimeters(QuantityValue newtoncentimeters) + public static Torque FromNewtonCentimeters(QuantityValue newtoncentimeters) { double value = (double) newtoncentimeters; - return new Torque(value, TorqueUnit.NewtonCentimeter); + return new Torque(value, TorqueUnit.NewtonCentimeter); } /// - /// Get Torque from NewtonMeters. + /// Get from NewtonMeters. /// /// If value is NaN or Infinity. - public static Torque FromNewtonMeters(QuantityValue newtonmeters) + public static Torque FromNewtonMeters(QuantityValue newtonmeters) { double value = (double) newtonmeters; - return new Torque(value, TorqueUnit.NewtonMeter); + return new Torque(value, TorqueUnit.NewtonMeter); } /// - /// Get Torque from NewtonMillimeters. + /// Get from NewtonMillimeters. /// /// If value is NaN or Infinity. - public static Torque FromNewtonMillimeters(QuantityValue newtonmillimeters) + public static Torque FromNewtonMillimeters(QuantityValue newtonmillimeters) { double value = (double) newtonmillimeters; - return new Torque(value, TorqueUnit.NewtonMillimeter); + return new Torque(value, TorqueUnit.NewtonMillimeter); } /// - /// Get Torque from PoundForceFeet. + /// Get from PoundForceFeet. /// /// If value is NaN or Infinity. - public static Torque FromPoundForceFeet(QuantityValue poundforcefeet) + public static Torque FromPoundForceFeet(QuantityValue poundforcefeet) { double value = (double) poundforcefeet; - return new Torque(value, TorqueUnit.PoundForceFoot); + return new Torque(value, TorqueUnit.PoundForceFoot); } /// - /// Get Torque from PoundForceInches. + /// Get from PoundForceInches. /// /// If value is NaN or Infinity. - public static Torque FromPoundForceInches(QuantityValue poundforceinches) + public static Torque FromPoundForceInches(QuantityValue poundforceinches) { double value = (double) poundforceinches; - return new Torque(value, TorqueUnit.PoundForceInch); + return new Torque(value, TorqueUnit.PoundForceInch); } /// - /// Get Torque from TonneForceCentimeters. + /// Get from TonneForceCentimeters. /// /// If value is NaN or Infinity. - public static Torque FromTonneForceCentimeters(QuantityValue tonneforcecentimeters) + public static Torque FromTonneForceCentimeters(QuantityValue tonneforcecentimeters) { double value = (double) tonneforcecentimeters; - return new Torque(value, TorqueUnit.TonneForceCentimeter); + return new Torque(value, TorqueUnit.TonneForceCentimeter); } /// - /// Get Torque from TonneForceMeters. + /// Get from TonneForceMeters. /// /// If value is NaN or Infinity. - public static Torque FromTonneForceMeters(QuantityValue tonneforcemeters) + public static Torque FromTonneForceMeters(QuantityValue tonneforcemeters) { double value = (double) tonneforcemeters; - return new Torque(value, TorqueUnit.TonneForceMeter); + return new Torque(value, TorqueUnit.TonneForceMeter); } /// - /// Get Torque from TonneForceMillimeters. + /// Get from TonneForceMillimeters. /// /// If value is NaN or Infinity. - public static Torque FromTonneForceMillimeters(QuantityValue tonneforcemillimeters) + public static Torque FromTonneForceMillimeters(QuantityValue tonneforcemillimeters) { double value = (double) tonneforcemillimeters; - return new Torque(value, TorqueUnit.TonneForceMillimeter); + return new Torque(value, TorqueUnit.TonneForceMillimeter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Torque unit value. - public static Torque From(QuantityValue value, TorqueUnit fromUnit) + /// unit value. + public static Torque From(QuantityValue value, TorqueUnit fromUnit) { - return new Torque((double)value, fromUnit); + return new Torque((double)value, fromUnit); } #endregion @@ -544,7 +544,7 @@ public static Torque From(QuantityValue value, TorqueUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Torque Parse(string str) + public static Torque Parse(string str) { return Parse(str, null); } @@ -572,9 +572,9 @@ public static Torque Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Torque Parse(string str, [CanBeNull] IFormatProvider provider) + public static Torque Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, TorqueUnit>( str, provider, From); @@ -588,7 +588,7 @@ public static Torque Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Torque result) + public static bool TryParse([CanBeNull] string str, out Torque result) { return TryParse(str, null, out result); } @@ -603,9 +603,9 @@ public static bool TryParse([CanBeNull] string str, out Torque result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Torque result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Torque result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, TorqueUnit>( str, provider, From, @@ -667,43 +667,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Torque #region Arithmetic Operators /// Negate the value. - public static Torque operator -(Torque right) + public static Torque operator -(Torque right) { - return new Torque(-right.Value, right.Unit); + return new Torque(-right.Value, right.Unit); } - /// Get from adding two . - public static Torque operator +(Torque left, Torque right) + /// Get from adding two . + public static Torque operator +(Torque left, Torque right) { - return new Torque(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Torque(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Torque operator -(Torque left, Torque right) + /// Get from subtracting two . + public static Torque operator -(Torque left, Torque right) { - return new Torque(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Torque(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Torque operator *(double left, Torque right) + /// Get from multiplying value and . + public static Torque operator *(double left, Torque right) { - return new Torque(left * right.Value, right.Unit); + return new Torque(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Torque operator *(Torque left, double right) + /// Get from multiplying value and . + public static Torque operator *(Torque left, double right) { - return new Torque(left.Value * right, left.Unit); + return new Torque(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Torque operator /(Torque left, double right) + /// Get from dividing by value. + public static Torque operator /(Torque left, double right) { - return new Torque(left.Value / right, left.Unit); + return new Torque(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Torque left, Torque right) + /// Get ratio value from dividing by . + public static double operator /(Torque left, Torque right) { return left.NewtonMeters / right.NewtonMeters; } @@ -713,39 +713,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Torque #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Torque left, Torque right) + public static bool operator <=(Torque left, Torque right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Torque left, Torque right) + public static bool operator >=(Torque left, Torque right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Torque left, Torque right) + public static bool operator <(Torque left, Torque right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Torque left, Torque right) + public static bool operator >(Torque left, Torque right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Torque left, Torque right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Torque left, Torque right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Torque left, Torque right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Torque left, Torque right) { return !(left == right); } @@ -754,37 +754,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Torque public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Torque objTorque)) throw new ArgumentException("Expected type Torque.", nameof(obj)); + if(!(obj is Torque objTorque)) throw new ArgumentException("Expected type Torque.", nameof(obj)); return CompareTo(objTorque); } /// - public int CompareTo(Torque other) + public int CompareTo(Torque other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Torque objTorque)) + if(obj is null || !(obj is Torque objTorque)) return false; return Equals(objTorque); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Torque other) + /// Consider using for safely comparing floating point values. + public bool Equals(Torque other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Torque within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -822,7 +822,7 @@ public bool Equals(Torque other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Torque other, double tolerance, ComparisonType comparisonType) + public bool Equals(Torque other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -836,7 +836,7 @@ public bool Equals(Torque other, double tolerance, ComparisonType comparisonType /// /// Returns the hash code for this instance. /// - /// A hash code for the current Torque. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -884,13 +884,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Torque to another Torque with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Torque with the specified unit. - public Torque ToUnit(TorqueUnit unit) + /// A with the specified unit. + public Torque ToUnit(TorqueUnit unit) { var convertedValue = GetValueAs(unit); - return new Torque(convertedValue, unit); + return new Torque(convertedValue, unit); } /// @@ -903,7 +903,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Torque ToUnit(UnitSystem unitSystem) + public Torque ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -966,10 +966,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Torque ToBaseUnit() + internal Torque ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Torque(baseUnitValue, BaseUnit); + return new Torque(baseUnitValue, BaseUnit); } private double GetValueAs(TorqueUnit unit) @@ -1098,7 +1098,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Torque)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Torque)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1108,12 +1108,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Torque)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Torque)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Torque)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Torque)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1158,16 +1158,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Torque)) + if(conversionType == typeof(Torque)) return this; else if(conversionType == typeof(TorqueUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Torque.QuantityType; + return Torque.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Torque.BaseDimensions; + return Torque.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Torque)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Torque)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs index a6e2a5e142..585b89947b 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Vitamin A: 1 IU is the biological equivalent of 0.3 µg retinol, or of 0.6 µg beta-carotene. /// - public partial struct VitaminA : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct VitaminA : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -100,19 +100,19 @@ public VitaminA(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of VitaminA, which is InternationalUnit. All conversions go via this value. + /// The base unit of , which is InternationalUnit. All conversions go via this value. /// public static VitaminAUnit BaseUnit { get; } = VitaminAUnit.InternationalUnit; /// - /// Represents the largest possible value of VitaminA + /// Represents the largest possible value of /// - public static VitaminA MaxValue { get; } = new VitaminA(double.MaxValue, BaseUnit); + public static VitaminA MaxValue { get; } = new VitaminA(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of VitaminA + /// Represents the smallest possible value of /// - public static VitaminA MinValue { get; } = new VitaminA(double.MinValue, BaseUnit); + public static VitaminA MinValue { get; } = new VitaminA(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -120,14 +120,14 @@ public VitaminA(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.VitaminA; /// - /// All units of measurement for the VitaminA quantity. + /// All units of measurement for the quantity. /// public static VitaminAUnit[] Units { get; } = Enum.GetValues(typeof(VitaminAUnit)).Cast().Except(new VitaminAUnit[]{ VitaminAUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit InternationalUnit. /// - public static VitaminA Zero { get; } = new VitaminA(0, BaseUnit); + public static VitaminA Zero { get; } = new VitaminA(0, BaseUnit); #endregion @@ -152,19 +152,19 @@ public VitaminA(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => VitaminA.QuantityType; + public QuantityType Type => VitaminA.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => VitaminA.BaseDimensions; + public BaseDimensions Dimensions => VitaminA.BaseDimensions; #endregion #region Conversion Properties /// - /// Get VitaminA in InternationalUnits. + /// Get in InternationalUnits. /// public double InternationalUnits => As(VitaminAUnit.InternationalUnit); @@ -198,24 +198,24 @@ public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] IFormatProvi #region Static Factory Methods /// - /// Get VitaminA from InternationalUnits. + /// Get from InternationalUnits. /// /// If value is NaN or Infinity. - public static VitaminA FromInternationalUnits(QuantityValue internationalunits) + public static VitaminA FromInternationalUnits(QuantityValue internationalunits) { double value = (double) internationalunits; - return new VitaminA(value, VitaminAUnit.InternationalUnit); + return new VitaminA(value, VitaminAUnit.InternationalUnit); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// VitaminA unit value. - public static VitaminA From(QuantityValue value, VitaminAUnit fromUnit) + /// unit value. + public static VitaminA From(QuantityValue value, VitaminAUnit fromUnit) { - return new VitaminA((double)value, fromUnit); + return new VitaminA((double)value, fromUnit); } #endregion @@ -244,7 +244,7 @@ public static VitaminA From(QuantityValue value, VitaminAUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static VitaminA Parse(string str) + public static VitaminA Parse(string str) { return Parse(str, null); } @@ -272,9 +272,9 @@ public static VitaminA Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static VitaminA Parse(string str, [CanBeNull] IFormatProvider provider) + public static VitaminA Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, VitaminAUnit>( str, provider, From); @@ -288,7 +288,7 @@ public static VitaminA Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out VitaminA result) + public static bool TryParse([CanBeNull] string str, out VitaminA result) { return TryParse(str, null, out result); } @@ -303,9 +303,9 @@ public static bool TryParse([CanBeNull] string str, out VitaminA result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VitaminA result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VitaminA result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, VitaminAUnit>( str, provider, From, @@ -367,43 +367,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Vitami #region Arithmetic Operators /// Negate the value. - public static VitaminA operator -(VitaminA right) + public static VitaminA operator -(VitaminA right) { - return new VitaminA(-right.Value, right.Unit); + return new VitaminA(-right.Value, right.Unit); } - /// Get from adding two . - public static VitaminA operator +(VitaminA left, VitaminA right) + /// Get from adding two . + public static VitaminA operator +(VitaminA left, VitaminA right) { - return new VitaminA(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new VitaminA(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static VitaminA operator -(VitaminA left, VitaminA right) + /// Get from subtracting two . + public static VitaminA operator -(VitaminA left, VitaminA right) { - return new VitaminA(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new VitaminA(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static VitaminA operator *(double left, VitaminA right) + /// Get from multiplying value and . + public static VitaminA operator *(double left, VitaminA right) { - return new VitaminA(left * right.Value, right.Unit); + return new VitaminA(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static VitaminA operator *(VitaminA left, double right) + /// Get from multiplying value and . + public static VitaminA operator *(VitaminA left, double right) { - return new VitaminA(left.Value * right, left.Unit); + return new VitaminA(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static VitaminA operator /(VitaminA left, double right) + /// Get from dividing by value. + public static VitaminA operator /(VitaminA left, double right) { - return new VitaminA(left.Value / right, left.Unit); + return new VitaminA(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(VitaminA left, VitaminA right) + /// Get ratio value from dividing by . + public static double operator /(VitaminA left, VitaminA right) { return left.InternationalUnits / right.InternationalUnits; } @@ -413,39 +413,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Vitami #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(VitaminA left, VitaminA right) + public static bool operator <=(VitaminA left, VitaminA right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(VitaminA left, VitaminA right) + public static bool operator >=(VitaminA left, VitaminA right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(VitaminA left, VitaminA right) + public static bool operator <(VitaminA left, VitaminA right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(VitaminA left, VitaminA right) + public static bool operator >(VitaminA left, VitaminA right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(VitaminA left, VitaminA right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(VitaminA left, VitaminA right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(VitaminA left, VitaminA right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(VitaminA left, VitaminA right) { return !(left == right); } @@ -454,37 +454,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Vitami public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VitaminA objVitaminA)) throw new ArgumentException("Expected type VitaminA.", nameof(obj)); + if(!(obj is VitaminA objVitaminA)) throw new ArgumentException("Expected type VitaminA.", nameof(obj)); return CompareTo(objVitaminA); } /// - public int CompareTo(VitaminA other) + public int CompareTo(VitaminA other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is VitaminA objVitaminA)) + if(obj is null || !(obj is VitaminA objVitaminA)) return false; return Equals(objVitaminA); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(VitaminA other) + /// Consider using for safely comparing floating point values. + public bool Equals(VitaminA other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another VitaminA within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -522,7 +522,7 @@ public bool Equals(VitaminA other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(VitaminA other, double tolerance, ComparisonType comparisonType) + public bool Equals(VitaminA other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -536,7 +536,7 @@ public bool Equals(VitaminA other, double tolerance, ComparisonType comparisonTy /// /// Returns the hash code for this instance. /// - /// A hash code for the current VitaminA. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -584,13 +584,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this VitaminA to another VitaminA with the unit representation . + /// Converts this to another with the unit representation . /// - /// A VitaminA with the specified unit. - public VitaminA ToUnit(VitaminAUnit unit) + /// A with the specified unit. + public VitaminA ToUnit(VitaminAUnit unit) { var convertedValue = GetValueAs(unit); - return new VitaminA(convertedValue, unit); + return new VitaminA(convertedValue, unit); } /// @@ -603,7 +603,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public VitaminA ToUnit(UnitSystem unitSystem) + public VitaminA ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -646,10 +646,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal VitaminA ToBaseUnit() + internal VitaminA ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new VitaminA(baseUnitValue, BaseUnit); + return new VitaminA(baseUnitValue, BaseUnit); } private double GetValueAs(VitaminAUnit unit) @@ -758,7 +758,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(VitaminA)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(VitaminA)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -768,12 +768,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(VitaminA)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(VitaminA)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(VitaminA)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(VitaminA)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -818,16 +818,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(VitaminA)) + if(conversionType == typeof(VitaminA)) return this; else if(conversionType == typeof(VitaminAUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return VitaminA.QuantityType; + return VitaminA.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return VitaminA.BaseDimensions; + return VitaminA.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(VitaminA)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(VitaminA)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs index d3a12dceaa..bae8b9b039 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Volume is the quantity of three-dimensional space enclosed by some closed boundary, for example, the space that a substance (solid, liquid, gas, or plasma) or shape occupies or contains.[1] Volume is often quantified numerically using the SI derived unit, the cubic metre. The volume of a container is generally understood to be the capacity of the container, i. e. the amount of fluid (gas or liquid) that the container could hold, rather than the amount of space the container itself displaces. /// - public partial struct Volume : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct Volume : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -146,19 +146,19 @@ public Volume(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of Volume, which is CubicMeter. All conversions go via this value. + /// The base unit of , which is CubicMeter. All conversions go via this value. /// public static VolumeUnit BaseUnit { get; } = VolumeUnit.CubicMeter; /// - /// Represents the largest possible value of Volume + /// Represents the largest possible value of /// - public static Volume MaxValue { get; } = new Volume(double.MaxValue, BaseUnit); + public static Volume MaxValue { get; } = new Volume(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of Volume + /// Represents the smallest possible value of /// - public static Volume MinValue { get; } = new Volume(double.MinValue, BaseUnit); + public static Volume MinValue { get; } = new Volume(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -166,14 +166,14 @@ public Volume(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.Volume; /// - /// All units of measurement for the Volume quantity. + /// All units of measurement for the quantity. /// public static VolumeUnit[] Units { get; } = Enum.GetValues(typeof(VolumeUnit)).Cast().Except(new VolumeUnit[]{ VolumeUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeter. /// - public static Volume Zero { get; } = new Volume(0, BaseUnit); + public static Volume Zero { get; } = new Volume(0, BaseUnit); #endregion @@ -198,249 +198,249 @@ public Volume(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => Volume.QuantityType; + public QuantityType Type => Volume.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => Volume.BaseDimensions; + public BaseDimensions Dimensions => Volume.BaseDimensions; #endregion #region Conversion Properties /// - /// Get Volume in AcreFeet. + /// Get in AcreFeet. /// public double AcreFeet => As(VolumeUnit.AcreFoot); /// - /// Get Volume in AuTablespoons. + /// Get in AuTablespoons. /// public double AuTablespoons => As(VolumeUnit.AuTablespoon); /// - /// Get Volume in Centiliters. + /// Get in Centiliters. /// public double Centiliters => As(VolumeUnit.Centiliter); /// - /// Get Volume in CubicCentimeters. + /// Get in CubicCentimeters. /// public double CubicCentimeters => As(VolumeUnit.CubicCentimeter); /// - /// Get Volume in CubicDecimeters. + /// Get in CubicDecimeters. /// public double CubicDecimeters => As(VolumeUnit.CubicDecimeter); /// - /// Get Volume in CubicFeet. + /// Get in CubicFeet. /// public double CubicFeet => As(VolumeUnit.CubicFoot); /// - /// Get Volume in CubicHectometers. + /// Get in CubicHectometers. /// public double CubicHectometers => As(VolumeUnit.CubicHectometer); /// - /// Get Volume in CubicInches. + /// Get in CubicInches. /// public double CubicInches => As(VolumeUnit.CubicInch); /// - /// Get Volume in CubicKilometers. + /// Get in CubicKilometers. /// public double CubicKilometers => As(VolumeUnit.CubicKilometer); /// - /// Get Volume in CubicMeters. + /// Get in CubicMeters. /// public double CubicMeters => As(VolumeUnit.CubicMeter); /// - /// Get Volume in CubicMicrometers. + /// Get in CubicMicrometers. /// public double CubicMicrometers => As(VolumeUnit.CubicMicrometer); /// - /// Get Volume in CubicMiles. + /// Get in CubicMiles. /// public double CubicMiles => As(VolumeUnit.CubicMile); /// - /// Get Volume in CubicMillimeters. + /// Get in CubicMillimeters. /// public double CubicMillimeters => As(VolumeUnit.CubicMillimeter); /// - /// Get Volume in CubicYards. + /// Get in CubicYards. /// public double CubicYards => As(VolumeUnit.CubicYard); /// - /// Get Volume in Deciliters. + /// Get in Deciliters. /// public double Deciliters => As(VolumeUnit.Deciliter); /// - /// Get Volume in HectocubicFeet. + /// Get in HectocubicFeet. /// public double HectocubicFeet => As(VolumeUnit.HectocubicFoot); /// - /// Get Volume in HectocubicMeters. + /// Get in HectocubicMeters. /// public double HectocubicMeters => As(VolumeUnit.HectocubicMeter); /// - /// Get Volume in Hectoliters. + /// Get in Hectoliters. /// public double Hectoliters => As(VolumeUnit.Hectoliter); /// - /// Get Volume in ImperialBeerBarrels. + /// Get in ImperialBeerBarrels. /// public double ImperialBeerBarrels => As(VolumeUnit.ImperialBeerBarrel); /// - /// Get Volume in ImperialGallons. + /// Get in ImperialGallons. /// public double ImperialGallons => As(VolumeUnit.ImperialGallon); /// - /// Get Volume in ImperialOunces. + /// Get in ImperialOunces. /// public double ImperialOunces => As(VolumeUnit.ImperialOunce); /// - /// Get Volume in ImperialPints. + /// Get in ImperialPints. /// public double ImperialPints => As(VolumeUnit.ImperialPint); /// - /// Get Volume in KilocubicFeet. + /// Get in KilocubicFeet. /// public double KilocubicFeet => As(VolumeUnit.KilocubicFoot); /// - /// Get Volume in KilocubicMeters. + /// Get in KilocubicMeters. /// public double KilocubicMeters => As(VolumeUnit.KilocubicMeter); /// - /// Get Volume in KiloimperialGallons. + /// Get in KiloimperialGallons. /// public double KiloimperialGallons => As(VolumeUnit.KiloimperialGallon); /// - /// Get Volume in Kiloliters. + /// Get in Kiloliters. /// public double Kiloliters => As(VolumeUnit.Kiloliter); /// - /// Get Volume in KilousGallons. + /// Get in KilousGallons. /// public double KilousGallons => As(VolumeUnit.KilousGallon); /// - /// Get Volume in Liters. + /// Get in Liters. /// public double Liters => As(VolumeUnit.Liter); /// - /// Get Volume in MegacubicFeet. + /// Get in MegacubicFeet. /// public double MegacubicFeet => As(VolumeUnit.MegacubicFoot); /// - /// Get Volume in MegaimperialGallons. + /// Get in MegaimperialGallons. /// public double MegaimperialGallons => As(VolumeUnit.MegaimperialGallon); /// - /// Get Volume in Megaliters. + /// Get in Megaliters. /// public double Megaliters => As(VolumeUnit.Megaliter); /// - /// Get Volume in MegausGallons. + /// Get in MegausGallons. /// public double MegausGallons => As(VolumeUnit.MegausGallon); /// - /// Get Volume in MetricCups. + /// Get in MetricCups. /// public double MetricCups => As(VolumeUnit.MetricCup); /// - /// Get Volume in MetricTeaspoons. + /// Get in MetricTeaspoons. /// public double MetricTeaspoons => As(VolumeUnit.MetricTeaspoon); /// - /// Get Volume in Microliters. + /// Get in Microliters. /// public double Microliters => As(VolumeUnit.Microliter); /// - /// Get Volume in Milliliters. + /// Get in Milliliters. /// public double Milliliters => As(VolumeUnit.Milliliter); /// - /// Get Volume in OilBarrels. + /// Get in OilBarrels. /// public double OilBarrels => As(VolumeUnit.OilBarrel); /// - /// Get Volume in UkTablespoons. + /// Get in UkTablespoons. /// public double UkTablespoons => As(VolumeUnit.UkTablespoon); /// - /// Get Volume in UsBeerBarrels. + /// Get in UsBeerBarrels. /// public double UsBeerBarrels => As(VolumeUnit.UsBeerBarrel); /// - /// Get Volume in UsCustomaryCups. + /// Get in UsCustomaryCups. /// public double UsCustomaryCups => As(VolumeUnit.UsCustomaryCup); /// - /// Get Volume in UsGallons. + /// Get in UsGallons. /// public double UsGallons => As(VolumeUnit.UsGallon); /// - /// Get Volume in UsLegalCups. + /// Get in UsLegalCups. /// public double UsLegalCups => As(VolumeUnit.UsLegalCup); /// - /// Get Volume in UsOunces. + /// Get in UsOunces. /// public double UsOunces => As(VolumeUnit.UsOunce); /// - /// Get Volume in UsPints. + /// Get in UsPints. /// public double UsPints => As(VolumeUnit.UsPint); /// - /// Get Volume in UsQuarts. + /// Get in UsQuarts. /// public double UsQuarts => As(VolumeUnit.UsQuart); /// - /// Get Volume in UsTablespoons. + /// Get in UsTablespoons. /// public double UsTablespoons => As(VolumeUnit.UsTablespoon); /// - /// Get Volume in UsTeaspoons. + /// Get in UsTeaspoons. /// public double UsTeaspoons => As(VolumeUnit.UsTeaspoon); @@ -474,438 +474,438 @@ public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] IFormatProvide #region Static Factory Methods /// - /// Get Volume from AcreFeet. + /// Get from AcreFeet. /// /// If value is NaN or Infinity. - public static Volume FromAcreFeet(QuantityValue acrefeet) + public static Volume FromAcreFeet(QuantityValue acrefeet) { double value = (double) acrefeet; - return new Volume(value, VolumeUnit.AcreFoot); + return new Volume(value, VolumeUnit.AcreFoot); } /// - /// Get Volume from AuTablespoons. + /// Get from AuTablespoons. /// /// If value is NaN or Infinity. - public static Volume FromAuTablespoons(QuantityValue autablespoons) + public static Volume FromAuTablespoons(QuantityValue autablespoons) { double value = (double) autablespoons; - return new Volume(value, VolumeUnit.AuTablespoon); + return new Volume(value, VolumeUnit.AuTablespoon); } /// - /// Get Volume from Centiliters. + /// Get from Centiliters. /// /// If value is NaN or Infinity. - public static Volume FromCentiliters(QuantityValue centiliters) + public static Volume FromCentiliters(QuantityValue centiliters) { double value = (double) centiliters; - return new Volume(value, VolumeUnit.Centiliter); + return new Volume(value, VolumeUnit.Centiliter); } /// - /// Get Volume from CubicCentimeters. + /// Get from CubicCentimeters. /// /// If value is NaN or Infinity. - public static Volume FromCubicCentimeters(QuantityValue cubiccentimeters) + public static Volume FromCubicCentimeters(QuantityValue cubiccentimeters) { double value = (double) cubiccentimeters; - return new Volume(value, VolumeUnit.CubicCentimeter); + return new Volume(value, VolumeUnit.CubicCentimeter); } /// - /// Get Volume from CubicDecimeters. + /// Get from CubicDecimeters. /// /// If value is NaN or Infinity. - public static Volume FromCubicDecimeters(QuantityValue cubicdecimeters) + public static Volume FromCubicDecimeters(QuantityValue cubicdecimeters) { double value = (double) cubicdecimeters; - return new Volume(value, VolumeUnit.CubicDecimeter); + return new Volume(value, VolumeUnit.CubicDecimeter); } /// - /// Get Volume from CubicFeet. + /// Get from CubicFeet. /// /// If value is NaN or Infinity. - public static Volume FromCubicFeet(QuantityValue cubicfeet) + public static Volume FromCubicFeet(QuantityValue cubicfeet) { double value = (double) cubicfeet; - return new Volume(value, VolumeUnit.CubicFoot); + return new Volume(value, VolumeUnit.CubicFoot); } /// - /// Get Volume from CubicHectometers. + /// Get from CubicHectometers. /// /// If value is NaN or Infinity. - public static Volume FromCubicHectometers(QuantityValue cubichectometers) + public static Volume FromCubicHectometers(QuantityValue cubichectometers) { double value = (double) cubichectometers; - return new Volume(value, VolumeUnit.CubicHectometer); + return new Volume(value, VolumeUnit.CubicHectometer); } /// - /// Get Volume from CubicInches. + /// Get from CubicInches. /// /// If value is NaN or Infinity. - public static Volume FromCubicInches(QuantityValue cubicinches) + public static Volume FromCubicInches(QuantityValue cubicinches) { double value = (double) cubicinches; - return new Volume(value, VolumeUnit.CubicInch); + return new Volume(value, VolumeUnit.CubicInch); } /// - /// Get Volume from CubicKilometers. + /// Get from CubicKilometers. /// /// If value is NaN or Infinity. - public static Volume FromCubicKilometers(QuantityValue cubickilometers) + public static Volume FromCubicKilometers(QuantityValue cubickilometers) { double value = (double) cubickilometers; - return new Volume(value, VolumeUnit.CubicKilometer); + return new Volume(value, VolumeUnit.CubicKilometer); } /// - /// Get Volume from CubicMeters. + /// Get from CubicMeters. /// /// If value is NaN or Infinity. - public static Volume FromCubicMeters(QuantityValue cubicmeters) + public static Volume FromCubicMeters(QuantityValue cubicmeters) { double value = (double) cubicmeters; - return new Volume(value, VolumeUnit.CubicMeter); + return new Volume(value, VolumeUnit.CubicMeter); } /// - /// Get Volume from CubicMicrometers. + /// Get from CubicMicrometers. /// /// If value is NaN or Infinity. - public static Volume FromCubicMicrometers(QuantityValue cubicmicrometers) + public static Volume FromCubicMicrometers(QuantityValue cubicmicrometers) { double value = (double) cubicmicrometers; - return new Volume(value, VolumeUnit.CubicMicrometer); + return new Volume(value, VolumeUnit.CubicMicrometer); } /// - /// Get Volume from CubicMiles. + /// Get from CubicMiles. /// /// If value is NaN or Infinity. - public static Volume FromCubicMiles(QuantityValue cubicmiles) + public static Volume FromCubicMiles(QuantityValue cubicmiles) { double value = (double) cubicmiles; - return new Volume(value, VolumeUnit.CubicMile); + return new Volume(value, VolumeUnit.CubicMile); } /// - /// Get Volume from CubicMillimeters. + /// Get from CubicMillimeters. /// /// If value is NaN or Infinity. - public static Volume FromCubicMillimeters(QuantityValue cubicmillimeters) + public static Volume FromCubicMillimeters(QuantityValue cubicmillimeters) { double value = (double) cubicmillimeters; - return new Volume(value, VolumeUnit.CubicMillimeter); + return new Volume(value, VolumeUnit.CubicMillimeter); } /// - /// Get Volume from CubicYards. + /// Get from CubicYards. /// /// If value is NaN or Infinity. - public static Volume FromCubicYards(QuantityValue cubicyards) + public static Volume FromCubicYards(QuantityValue cubicyards) { double value = (double) cubicyards; - return new Volume(value, VolumeUnit.CubicYard); + return new Volume(value, VolumeUnit.CubicYard); } /// - /// Get Volume from Deciliters. + /// Get from Deciliters. /// /// If value is NaN or Infinity. - public static Volume FromDeciliters(QuantityValue deciliters) + public static Volume FromDeciliters(QuantityValue deciliters) { double value = (double) deciliters; - return new Volume(value, VolumeUnit.Deciliter); + return new Volume(value, VolumeUnit.Deciliter); } /// - /// Get Volume from HectocubicFeet. + /// Get from HectocubicFeet. /// /// If value is NaN or Infinity. - public static Volume FromHectocubicFeet(QuantityValue hectocubicfeet) + public static Volume FromHectocubicFeet(QuantityValue hectocubicfeet) { double value = (double) hectocubicfeet; - return new Volume(value, VolumeUnit.HectocubicFoot); + return new Volume(value, VolumeUnit.HectocubicFoot); } /// - /// Get Volume from HectocubicMeters. + /// Get from HectocubicMeters. /// /// If value is NaN or Infinity. - public static Volume FromHectocubicMeters(QuantityValue hectocubicmeters) + public static Volume FromHectocubicMeters(QuantityValue hectocubicmeters) { double value = (double) hectocubicmeters; - return new Volume(value, VolumeUnit.HectocubicMeter); + return new Volume(value, VolumeUnit.HectocubicMeter); } /// - /// Get Volume from Hectoliters. + /// Get from Hectoliters. /// /// If value is NaN or Infinity. - public static Volume FromHectoliters(QuantityValue hectoliters) + public static Volume FromHectoliters(QuantityValue hectoliters) { double value = (double) hectoliters; - return new Volume(value, VolumeUnit.Hectoliter); + return new Volume(value, VolumeUnit.Hectoliter); } /// - /// Get Volume from ImperialBeerBarrels. + /// Get from ImperialBeerBarrels. /// /// If value is NaN or Infinity. - public static Volume FromImperialBeerBarrels(QuantityValue imperialbeerbarrels) + public static Volume FromImperialBeerBarrels(QuantityValue imperialbeerbarrels) { double value = (double) imperialbeerbarrels; - return new Volume(value, VolumeUnit.ImperialBeerBarrel); + return new Volume(value, VolumeUnit.ImperialBeerBarrel); } /// - /// Get Volume from ImperialGallons. + /// Get from ImperialGallons. /// /// If value is NaN or Infinity. - public static Volume FromImperialGallons(QuantityValue imperialgallons) + public static Volume FromImperialGallons(QuantityValue imperialgallons) { double value = (double) imperialgallons; - return new Volume(value, VolumeUnit.ImperialGallon); + return new Volume(value, VolumeUnit.ImperialGallon); } /// - /// Get Volume from ImperialOunces. + /// Get from ImperialOunces. /// /// If value is NaN or Infinity. - public static Volume FromImperialOunces(QuantityValue imperialounces) + public static Volume FromImperialOunces(QuantityValue imperialounces) { double value = (double) imperialounces; - return new Volume(value, VolumeUnit.ImperialOunce); + return new Volume(value, VolumeUnit.ImperialOunce); } /// - /// Get Volume from ImperialPints. + /// Get from ImperialPints. /// /// If value is NaN or Infinity. - public static Volume FromImperialPints(QuantityValue imperialpints) + public static Volume FromImperialPints(QuantityValue imperialpints) { double value = (double) imperialpints; - return new Volume(value, VolumeUnit.ImperialPint); + return new Volume(value, VolumeUnit.ImperialPint); } /// - /// Get Volume from KilocubicFeet. + /// Get from KilocubicFeet. /// /// If value is NaN or Infinity. - public static Volume FromKilocubicFeet(QuantityValue kilocubicfeet) + public static Volume FromKilocubicFeet(QuantityValue kilocubicfeet) { double value = (double) kilocubicfeet; - return new Volume(value, VolumeUnit.KilocubicFoot); + return new Volume(value, VolumeUnit.KilocubicFoot); } /// - /// Get Volume from KilocubicMeters. + /// Get from KilocubicMeters. /// /// If value is NaN or Infinity. - public static Volume FromKilocubicMeters(QuantityValue kilocubicmeters) + public static Volume FromKilocubicMeters(QuantityValue kilocubicmeters) { double value = (double) kilocubicmeters; - return new Volume(value, VolumeUnit.KilocubicMeter); + return new Volume(value, VolumeUnit.KilocubicMeter); } /// - /// Get Volume from KiloimperialGallons. + /// Get from KiloimperialGallons. /// /// If value is NaN or Infinity. - public static Volume FromKiloimperialGallons(QuantityValue kiloimperialgallons) + public static Volume FromKiloimperialGallons(QuantityValue kiloimperialgallons) { double value = (double) kiloimperialgallons; - return new Volume(value, VolumeUnit.KiloimperialGallon); + return new Volume(value, VolumeUnit.KiloimperialGallon); } /// - /// Get Volume from Kiloliters. + /// Get from Kiloliters. /// /// If value is NaN or Infinity. - public static Volume FromKiloliters(QuantityValue kiloliters) + public static Volume FromKiloliters(QuantityValue kiloliters) { double value = (double) kiloliters; - return new Volume(value, VolumeUnit.Kiloliter); + return new Volume(value, VolumeUnit.Kiloliter); } /// - /// Get Volume from KilousGallons. + /// Get from KilousGallons. /// /// If value is NaN or Infinity. - public static Volume FromKilousGallons(QuantityValue kilousgallons) + public static Volume FromKilousGallons(QuantityValue kilousgallons) { double value = (double) kilousgallons; - return new Volume(value, VolumeUnit.KilousGallon); + return new Volume(value, VolumeUnit.KilousGallon); } /// - /// Get Volume from Liters. + /// Get from Liters. /// /// If value is NaN or Infinity. - public static Volume FromLiters(QuantityValue liters) + public static Volume FromLiters(QuantityValue liters) { double value = (double) liters; - return new Volume(value, VolumeUnit.Liter); + return new Volume(value, VolumeUnit.Liter); } /// - /// Get Volume from MegacubicFeet. + /// Get from MegacubicFeet. /// /// If value is NaN or Infinity. - public static Volume FromMegacubicFeet(QuantityValue megacubicfeet) + public static Volume FromMegacubicFeet(QuantityValue megacubicfeet) { double value = (double) megacubicfeet; - return new Volume(value, VolumeUnit.MegacubicFoot); + return new Volume(value, VolumeUnit.MegacubicFoot); } /// - /// Get Volume from MegaimperialGallons. + /// Get from MegaimperialGallons. /// /// If value is NaN or Infinity. - public static Volume FromMegaimperialGallons(QuantityValue megaimperialgallons) + public static Volume FromMegaimperialGallons(QuantityValue megaimperialgallons) { double value = (double) megaimperialgallons; - return new Volume(value, VolumeUnit.MegaimperialGallon); + return new Volume(value, VolumeUnit.MegaimperialGallon); } /// - /// Get Volume from Megaliters. + /// Get from Megaliters. /// /// If value is NaN or Infinity. - public static Volume FromMegaliters(QuantityValue megaliters) + public static Volume FromMegaliters(QuantityValue megaliters) { double value = (double) megaliters; - return new Volume(value, VolumeUnit.Megaliter); + return new Volume(value, VolumeUnit.Megaliter); } /// - /// Get Volume from MegausGallons. + /// Get from MegausGallons. /// /// If value is NaN or Infinity. - public static Volume FromMegausGallons(QuantityValue megausgallons) + public static Volume FromMegausGallons(QuantityValue megausgallons) { double value = (double) megausgallons; - return new Volume(value, VolumeUnit.MegausGallon); + return new Volume(value, VolumeUnit.MegausGallon); } /// - /// Get Volume from MetricCups. + /// Get from MetricCups. /// /// If value is NaN or Infinity. - public static Volume FromMetricCups(QuantityValue metriccups) + public static Volume FromMetricCups(QuantityValue metriccups) { double value = (double) metriccups; - return new Volume(value, VolumeUnit.MetricCup); + return new Volume(value, VolumeUnit.MetricCup); } /// - /// Get Volume from MetricTeaspoons. + /// Get from MetricTeaspoons. /// /// If value is NaN or Infinity. - public static Volume FromMetricTeaspoons(QuantityValue metricteaspoons) + public static Volume FromMetricTeaspoons(QuantityValue metricteaspoons) { double value = (double) metricteaspoons; - return new Volume(value, VolumeUnit.MetricTeaspoon); + return new Volume(value, VolumeUnit.MetricTeaspoon); } /// - /// Get Volume from Microliters. + /// Get from Microliters. /// /// If value is NaN or Infinity. - public static Volume FromMicroliters(QuantityValue microliters) + public static Volume FromMicroliters(QuantityValue microliters) { double value = (double) microliters; - return new Volume(value, VolumeUnit.Microliter); + return new Volume(value, VolumeUnit.Microliter); } /// - /// Get Volume from Milliliters. + /// Get from Milliliters. /// /// If value is NaN or Infinity. - public static Volume FromMilliliters(QuantityValue milliliters) + public static Volume FromMilliliters(QuantityValue milliliters) { double value = (double) milliliters; - return new Volume(value, VolumeUnit.Milliliter); + return new Volume(value, VolumeUnit.Milliliter); } /// - /// Get Volume from OilBarrels. + /// Get from OilBarrels. /// /// If value is NaN or Infinity. - public static Volume FromOilBarrels(QuantityValue oilbarrels) + public static Volume FromOilBarrels(QuantityValue oilbarrels) { double value = (double) oilbarrels; - return new Volume(value, VolumeUnit.OilBarrel); + return new Volume(value, VolumeUnit.OilBarrel); } /// - /// Get Volume from UkTablespoons. + /// Get from UkTablespoons. /// /// If value is NaN or Infinity. - public static Volume FromUkTablespoons(QuantityValue uktablespoons) + public static Volume FromUkTablespoons(QuantityValue uktablespoons) { double value = (double) uktablespoons; - return new Volume(value, VolumeUnit.UkTablespoon); + return new Volume(value, VolumeUnit.UkTablespoon); } /// - /// Get Volume from UsBeerBarrels. + /// Get from UsBeerBarrels. /// /// If value is NaN or Infinity. - public static Volume FromUsBeerBarrels(QuantityValue usbeerbarrels) + public static Volume FromUsBeerBarrels(QuantityValue usbeerbarrels) { double value = (double) usbeerbarrels; - return new Volume(value, VolumeUnit.UsBeerBarrel); + return new Volume(value, VolumeUnit.UsBeerBarrel); } /// - /// Get Volume from UsCustomaryCups. + /// Get from UsCustomaryCups. /// /// If value is NaN or Infinity. - public static Volume FromUsCustomaryCups(QuantityValue uscustomarycups) + public static Volume FromUsCustomaryCups(QuantityValue uscustomarycups) { double value = (double) uscustomarycups; - return new Volume(value, VolumeUnit.UsCustomaryCup); + return new Volume(value, VolumeUnit.UsCustomaryCup); } /// - /// Get Volume from UsGallons. + /// Get from UsGallons. /// /// If value is NaN or Infinity. - public static Volume FromUsGallons(QuantityValue usgallons) + public static Volume FromUsGallons(QuantityValue usgallons) { double value = (double) usgallons; - return new Volume(value, VolumeUnit.UsGallon); + return new Volume(value, VolumeUnit.UsGallon); } /// - /// Get Volume from UsLegalCups. + /// Get from UsLegalCups. /// /// If value is NaN or Infinity. - public static Volume FromUsLegalCups(QuantityValue uslegalcups) + public static Volume FromUsLegalCups(QuantityValue uslegalcups) { double value = (double) uslegalcups; - return new Volume(value, VolumeUnit.UsLegalCup); + return new Volume(value, VolumeUnit.UsLegalCup); } /// - /// Get Volume from UsOunces. + /// Get from UsOunces. /// /// If value is NaN or Infinity. - public static Volume FromUsOunces(QuantityValue usounces) + public static Volume FromUsOunces(QuantityValue usounces) { double value = (double) usounces; - return new Volume(value, VolumeUnit.UsOunce); + return new Volume(value, VolumeUnit.UsOunce); } /// - /// Get Volume from UsPints. + /// Get from UsPints. /// /// If value is NaN or Infinity. - public static Volume FromUsPints(QuantityValue uspints) + public static Volume FromUsPints(QuantityValue uspints) { double value = (double) uspints; - return new Volume(value, VolumeUnit.UsPint); + return new Volume(value, VolumeUnit.UsPint); } /// - /// Get Volume from UsQuarts. + /// Get from UsQuarts. /// /// If value is NaN or Infinity. - public static Volume FromUsQuarts(QuantityValue usquarts) + public static Volume FromUsQuarts(QuantityValue usquarts) { double value = (double) usquarts; - return new Volume(value, VolumeUnit.UsQuart); + return new Volume(value, VolumeUnit.UsQuart); } /// - /// Get Volume from UsTablespoons. + /// Get from UsTablespoons. /// /// If value is NaN or Infinity. - public static Volume FromUsTablespoons(QuantityValue ustablespoons) + public static Volume FromUsTablespoons(QuantityValue ustablespoons) { double value = (double) ustablespoons; - return new Volume(value, VolumeUnit.UsTablespoon); + return new Volume(value, VolumeUnit.UsTablespoon); } /// - /// Get Volume from UsTeaspoons. + /// Get from UsTeaspoons. /// /// If value is NaN or Infinity. - public static Volume FromUsTeaspoons(QuantityValue usteaspoons) + public static Volume FromUsTeaspoons(QuantityValue usteaspoons) { double value = (double) usteaspoons; - return new Volume(value, VolumeUnit.UsTeaspoon); + return new Volume(value, VolumeUnit.UsTeaspoon); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// Volume unit value. - public static Volume From(QuantityValue value, VolumeUnit fromUnit) + /// unit value. + public static Volume From(QuantityValue value, VolumeUnit fromUnit) { - return new Volume((double)value, fromUnit); + return new Volume((double)value, fromUnit); } #endregion @@ -934,7 +934,7 @@ public static Volume From(QuantityValue value, VolumeUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Volume Parse(string str) + public static Volume Parse(string str) { return Parse(str, null); } @@ -962,9 +962,9 @@ public static Volume Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static Volume Parse(string str, [CanBeNull] IFormatProvider provider) + public static Volume Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, VolumeUnit>( str, provider, From); @@ -978,7 +978,7 @@ public static Volume Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out Volume result) + public static bool TryParse([CanBeNull] string str, out Volume result) { return TryParse(str, null, out result); } @@ -993,9 +993,9 @@ public static bool TryParse([CanBeNull] string str, out Volume result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Volume result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Volume result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, VolumeUnit>( str, provider, From, @@ -1057,43 +1057,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume #region Arithmetic Operators /// Negate the value. - public static Volume operator -(Volume right) + public static Volume operator -(Volume right) { - return new Volume(-right.Value, right.Unit); + return new Volume(-right.Value, right.Unit); } - /// Get from adding two . - public static Volume operator +(Volume left, Volume right) + /// Get from adding two . + public static Volume operator +(Volume left, Volume right) { - return new Volume(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new Volume(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static Volume operator -(Volume left, Volume right) + /// Get from subtracting two . + public static Volume operator -(Volume left, Volume right) { - return new Volume(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new Volume(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static Volume operator *(double left, Volume right) + /// Get from multiplying value and . + public static Volume operator *(double left, Volume right) { - return new Volume(left * right.Value, right.Unit); + return new Volume(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static Volume operator *(Volume left, double right) + /// Get from multiplying value and . + public static Volume operator *(Volume left, double right) { - return new Volume(left.Value * right, left.Unit); + return new Volume(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static Volume operator /(Volume left, double right) + /// Get from dividing by value. + public static Volume operator /(Volume left, double right) { - return new Volume(left.Value / right, left.Unit); + return new Volume(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(Volume left, Volume right) + /// Get ratio value from dividing by . + public static double operator /(Volume left, Volume right) { return left.CubicMeters / right.CubicMeters; } @@ -1103,39 +1103,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(Volume left, Volume right) + public static bool operator <=(Volume left, Volume right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(Volume left, Volume right) + public static bool operator >=(Volume left, Volume right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(Volume left, Volume right) + public static bool operator <(Volume left, Volume right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(Volume left, Volume right) + public static bool operator >(Volume left, Volume right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(Volume left, Volume right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(Volume left, Volume right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(Volume left, Volume right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(Volume left, Volume right) { return !(left == right); } @@ -1144,37 +1144,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Volume objVolume)) throw new ArgumentException("Expected type Volume.", nameof(obj)); + if(!(obj is Volume objVolume)) throw new ArgumentException("Expected type Volume.", nameof(obj)); return CompareTo(objVolume); } /// - public int CompareTo(Volume other) + public int CompareTo(Volume other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Volume objVolume)) + if(obj is null || !(obj is Volume objVolume)) return false; return Equals(objVolume); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(Volume other) + /// Consider using for safely comparing floating point values. + public bool Equals(Volume other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another Volume within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -1212,7 +1212,7 @@ public bool Equals(Volume other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Volume other, double tolerance, ComparisonType comparisonType) + public bool Equals(Volume other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -1226,7 +1226,7 @@ public bool Equals(Volume other, double tolerance, ComparisonType comparisonType /// /// Returns the hash code for this instance. /// - /// A hash code for the current Volume. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -1274,13 +1274,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this Volume to another Volume with the unit representation . + /// Converts this to another with the unit representation . /// - /// A Volume with the specified unit. - public Volume ToUnit(VolumeUnit unit) + /// A with the specified unit. + public Volume ToUnit(VolumeUnit unit) { var convertedValue = GetValueAs(unit); - return new Volume(convertedValue, unit); + return new Volume(convertedValue, unit); } /// @@ -1293,7 +1293,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public Volume ToUnit(UnitSystem unitSystem) + public Volume ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1382,10 +1382,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal Volume ToBaseUnit() + internal Volume ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new Volume(baseUnitValue, BaseUnit); + return new Volume(baseUnitValue, BaseUnit); } private double GetValueAs(VolumeUnit unit) @@ -1540,7 +1540,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Volume)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(Volume)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1550,12 +1550,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Volume)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(Volume)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(Volume)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(Volume)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1600,16 +1600,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Volume)) + if(conversionType == typeof(Volume)) return this; else if(conversionType == typeof(VolumeUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return Volume.QuantityType; + return Volume.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return Volume.BaseDimensions; + return Volume.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(Volume)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(Volume)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs index ba2b5cf025..bd1f0f2d10 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs @@ -35,7 +35,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Concentration#Volume_concentration /// - public partial struct VolumeConcentration : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct VolumeConcentration : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -122,19 +122,19 @@ public VolumeConcentration(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of VolumeConcentration, which is DecimalFraction. All conversions go via this value. + /// The base unit of , which is DecimalFraction. All conversions go via this value. /// public static VolumeConcentrationUnit BaseUnit { get; } = VolumeConcentrationUnit.DecimalFraction; /// - /// Represents the largest possible value of VolumeConcentration + /// Represents the largest possible value of /// - public static VolumeConcentration MaxValue { get; } = new VolumeConcentration(double.MaxValue, BaseUnit); + public static VolumeConcentration MaxValue { get; } = new VolumeConcentration(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of VolumeConcentration + /// Represents the smallest possible value of /// - public static VolumeConcentration MinValue { get; } = new VolumeConcentration(double.MinValue, BaseUnit); + public static VolumeConcentration MinValue { get; } = new VolumeConcentration(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -142,14 +142,14 @@ public VolumeConcentration(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.VolumeConcentration; /// - /// All units of measurement for the VolumeConcentration quantity. + /// All units of measurement for the quantity. /// public static VolumeConcentrationUnit[] Units { get; } = Enum.GetValues(typeof(VolumeConcentrationUnit)).Cast().Except(new VolumeConcentrationUnit[]{ VolumeConcentrationUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit DecimalFraction. /// - public static VolumeConcentration Zero { get; } = new VolumeConcentration(0, BaseUnit); + public static VolumeConcentration Zero { get; } = new VolumeConcentration(0, BaseUnit); #endregion @@ -174,114 +174,114 @@ public VolumeConcentration(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => VolumeConcentration.QuantityType; + public QuantityType Type => VolumeConcentration.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => VolumeConcentration.BaseDimensions; + public BaseDimensions Dimensions => VolumeConcentration.BaseDimensions; #endregion #region Conversion Properties /// - /// Get VolumeConcentration in CentilitersPerLiter. + /// Get in CentilitersPerLiter. /// public double CentilitersPerLiter => As(VolumeConcentrationUnit.CentilitersPerLiter); /// - /// Get VolumeConcentration in CentilitersPerMililiter. + /// Get in CentilitersPerMililiter. /// public double CentilitersPerMililiter => As(VolumeConcentrationUnit.CentilitersPerMililiter); /// - /// Get VolumeConcentration in DecilitersPerLiter. + /// Get in DecilitersPerLiter. /// public double DecilitersPerLiter => As(VolumeConcentrationUnit.DecilitersPerLiter); /// - /// Get VolumeConcentration in DecilitersPerMililiter. + /// Get in DecilitersPerMililiter. /// public double DecilitersPerMililiter => As(VolumeConcentrationUnit.DecilitersPerMililiter); /// - /// Get VolumeConcentration in DecimalFractions. + /// Get in DecimalFractions. /// public double DecimalFractions => As(VolumeConcentrationUnit.DecimalFraction); /// - /// Get VolumeConcentration in LitersPerLiter. + /// Get in LitersPerLiter. /// public double LitersPerLiter => As(VolumeConcentrationUnit.LitersPerLiter); /// - /// Get VolumeConcentration in LitersPerMililiter. + /// Get in LitersPerMililiter. /// public double LitersPerMililiter => As(VolumeConcentrationUnit.LitersPerMililiter); /// - /// Get VolumeConcentration in MicrolitersPerLiter. + /// Get in MicrolitersPerLiter. /// public double MicrolitersPerLiter => As(VolumeConcentrationUnit.MicrolitersPerLiter); /// - /// Get VolumeConcentration in MicrolitersPerMililiter. + /// Get in MicrolitersPerMililiter. /// public double MicrolitersPerMililiter => As(VolumeConcentrationUnit.MicrolitersPerMililiter); /// - /// Get VolumeConcentration in MillilitersPerLiter. + /// Get in MillilitersPerLiter. /// public double MillilitersPerLiter => As(VolumeConcentrationUnit.MillilitersPerLiter); /// - /// Get VolumeConcentration in MillilitersPerMililiter. + /// Get in MillilitersPerMililiter. /// public double MillilitersPerMililiter => As(VolumeConcentrationUnit.MillilitersPerMililiter); /// - /// Get VolumeConcentration in NanolitersPerLiter. + /// Get in NanolitersPerLiter. /// public double NanolitersPerLiter => As(VolumeConcentrationUnit.NanolitersPerLiter); /// - /// Get VolumeConcentration in NanolitersPerMililiter. + /// Get in NanolitersPerMililiter. /// public double NanolitersPerMililiter => As(VolumeConcentrationUnit.NanolitersPerMililiter); /// - /// Get VolumeConcentration in PartsPerBillion. + /// Get in PartsPerBillion. /// public double PartsPerBillion => As(VolumeConcentrationUnit.PartPerBillion); /// - /// Get VolumeConcentration in PartsPerMillion. + /// Get in PartsPerMillion. /// public double PartsPerMillion => As(VolumeConcentrationUnit.PartPerMillion); /// - /// Get VolumeConcentration in PartsPerThousand. + /// Get in PartsPerThousand. /// public double PartsPerThousand => As(VolumeConcentrationUnit.PartPerThousand); /// - /// Get VolumeConcentration in PartsPerTrillion. + /// Get in PartsPerTrillion. /// public double PartsPerTrillion => As(VolumeConcentrationUnit.PartPerTrillion); /// - /// Get VolumeConcentration in Percent. + /// Get in Percent. /// public double Percent => As(VolumeConcentrationUnit.Percent); /// - /// Get VolumeConcentration in PicolitersPerLiter. + /// Get in PicolitersPerLiter. /// public double PicolitersPerLiter => As(VolumeConcentrationUnit.PicolitersPerLiter); /// - /// Get VolumeConcentration in PicolitersPerMililiter. + /// Get in PicolitersPerMililiter. /// public double PicolitersPerMililiter => As(VolumeConcentrationUnit.PicolitersPerMililiter); @@ -315,195 +315,195 @@ public static string GetAbbreviation(VolumeConcentrationUnit unit, [CanBeNull] I #region Static Factory Methods /// - /// Get VolumeConcentration from CentilitersPerLiter. + /// Get from CentilitersPerLiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromCentilitersPerLiter(QuantityValue centilitersperliter) + public static VolumeConcentration FromCentilitersPerLiter(QuantityValue centilitersperliter) { double value = (double) centilitersperliter; - return new VolumeConcentration(value, VolumeConcentrationUnit.CentilitersPerLiter); + return new VolumeConcentration(value, VolumeConcentrationUnit.CentilitersPerLiter); } /// - /// Get VolumeConcentration from CentilitersPerMililiter. + /// Get from CentilitersPerMililiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromCentilitersPerMililiter(QuantityValue centiliterspermililiter) + public static VolumeConcentration FromCentilitersPerMililiter(QuantityValue centiliterspermililiter) { double value = (double) centiliterspermililiter; - return new VolumeConcentration(value, VolumeConcentrationUnit.CentilitersPerMililiter); + return new VolumeConcentration(value, VolumeConcentrationUnit.CentilitersPerMililiter); } /// - /// Get VolumeConcentration from DecilitersPerLiter. + /// Get from DecilitersPerLiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromDecilitersPerLiter(QuantityValue decilitersperliter) + public static VolumeConcentration FromDecilitersPerLiter(QuantityValue decilitersperliter) { double value = (double) decilitersperliter; - return new VolumeConcentration(value, VolumeConcentrationUnit.DecilitersPerLiter); + return new VolumeConcentration(value, VolumeConcentrationUnit.DecilitersPerLiter); } /// - /// Get VolumeConcentration from DecilitersPerMililiter. + /// Get from DecilitersPerMililiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromDecilitersPerMililiter(QuantityValue deciliterspermililiter) + public static VolumeConcentration FromDecilitersPerMililiter(QuantityValue deciliterspermililiter) { double value = (double) deciliterspermililiter; - return new VolumeConcentration(value, VolumeConcentrationUnit.DecilitersPerMililiter); + return new VolumeConcentration(value, VolumeConcentrationUnit.DecilitersPerMililiter); } /// - /// Get VolumeConcentration from DecimalFractions. + /// Get from DecimalFractions. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromDecimalFractions(QuantityValue decimalfractions) + public static VolumeConcentration FromDecimalFractions(QuantityValue decimalfractions) { double value = (double) decimalfractions; - return new VolumeConcentration(value, VolumeConcentrationUnit.DecimalFraction); + return new VolumeConcentration(value, VolumeConcentrationUnit.DecimalFraction); } /// - /// Get VolumeConcentration from LitersPerLiter. + /// Get from LitersPerLiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromLitersPerLiter(QuantityValue litersperliter) + public static VolumeConcentration FromLitersPerLiter(QuantityValue litersperliter) { double value = (double) litersperliter; - return new VolumeConcentration(value, VolumeConcentrationUnit.LitersPerLiter); + return new VolumeConcentration(value, VolumeConcentrationUnit.LitersPerLiter); } /// - /// Get VolumeConcentration from LitersPerMililiter. + /// Get from LitersPerMililiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromLitersPerMililiter(QuantityValue literspermililiter) + public static VolumeConcentration FromLitersPerMililiter(QuantityValue literspermililiter) { double value = (double) literspermililiter; - return new VolumeConcentration(value, VolumeConcentrationUnit.LitersPerMililiter); + return new VolumeConcentration(value, VolumeConcentrationUnit.LitersPerMililiter); } /// - /// Get VolumeConcentration from MicrolitersPerLiter. + /// Get from MicrolitersPerLiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromMicrolitersPerLiter(QuantityValue microlitersperliter) + public static VolumeConcentration FromMicrolitersPerLiter(QuantityValue microlitersperliter) { double value = (double) microlitersperliter; - return new VolumeConcentration(value, VolumeConcentrationUnit.MicrolitersPerLiter); + return new VolumeConcentration(value, VolumeConcentrationUnit.MicrolitersPerLiter); } /// - /// Get VolumeConcentration from MicrolitersPerMililiter. + /// Get from MicrolitersPerMililiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromMicrolitersPerMililiter(QuantityValue microliterspermililiter) + public static VolumeConcentration FromMicrolitersPerMililiter(QuantityValue microliterspermililiter) { double value = (double) microliterspermililiter; - return new VolumeConcentration(value, VolumeConcentrationUnit.MicrolitersPerMililiter); + return new VolumeConcentration(value, VolumeConcentrationUnit.MicrolitersPerMililiter); } /// - /// Get VolumeConcentration from MillilitersPerLiter. + /// Get from MillilitersPerLiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromMillilitersPerLiter(QuantityValue millilitersperliter) + public static VolumeConcentration FromMillilitersPerLiter(QuantityValue millilitersperliter) { double value = (double) millilitersperliter; - return new VolumeConcentration(value, VolumeConcentrationUnit.MillilitersPerLiter); + return new VolumeConcentration(value, VolumeConcentrationUnit.MillilitersPerLiter); } /// - /// Get VolumeConcentration from MillilitersPerMililiter. + /// Get from MillilitersPerMililiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromMillilitersPerMililiter(QuantityValue milliliterspermililiter) + public static VolumeConcentration FromMillilitersPerMililiter(QuantityValue milliliterspermililiter) { double value = (double) milliliterspermililiter; - return new VolumeConcentration(value, VolumeConcentrationUnit.MillilitersPerMililiter); + return new VolumeConcentration(value, VolumeConcentrationUnit.MillilitersPerMililiter); } /// - /// Get VolumeConcentration from NanolitersPerLiter. + /// Get from NanolitersPerLiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromNanolitersPerLiter(QuantityValue nanolitersperliter) + public static VolumeConcentration FromNanolitersPerLiter(QuantityValue nanolitersperliter) { double value = (double) nanolitersperliter; - return new VolumeConcentration(value, VolumeConcentrationUnit.NanolitersPerLiter); + return new VolumeConcentration(value, VolumeConcentrationUnit.NanolitersPerLiter); } /// - /// Get VolumeConcentration from NanolitersPerMililiter. + /// Get from NanolitersPerMililiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromNanolitersPerMililiter(QuantityValue nanoliterspermililiter) + public static VolumeConcentration FromNanolitersPerMililiter(QuantityValue nanoliterspermililiter) { double value = (double) nanoliterspermililiter; - return new VolumeConcentration(value, VolumeConcentrationUnit.NanolitersPerMililiter); + return new VolumeConcentration(value, VolumeConcentrationUnit.NanolitersPerMililiter); } /// - /// Get VolumeConcentration from PartsPerBillion. + /// Get from PartsPerBillion. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromPartsPerBillion(QuantityValue partsperbillion) + public static VolumeConcentration FromPartsPerBillion(QuantityValue partsperbillion) { double value = (double) partsperbillion; - return new VolumeConcentration(value, VolumeConcentrationUnit.PartPerBillion); + return new VolumeConcentration(value, VolumeConcentrationUnit.PartPerBillion); } /// - /// Get VolumeConcentration from PartsPerMillion. + /// Get from PartsPerMillion. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromPartsPerMillion(QuantityValue partspermillion) + public static VolumeConcentration FromPartsPerMillion(QuantityValue partspermillion) { double value = (double) partspermillion; - return new VolumeConcentration(value, VolumeConcentrationUnit.PartPerMillion); + return new VolumeConcentration(value, VolumeConcentrationUnit.PartPerMillion); } /// - /// Get VolumeConcentration from PartsPerThousand. + /// Get from PartsPerThousand. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromPartsPerThousand(QuantityValue partsperthousand) + public static VolumeConcentration FromPartsPerThousand(QuantityValue partsperthousand) { double value = (double) partsperthousand; - return new VolumeConcentration(value, VolumeConcentrationUnit.PartPerThousand); + return new VolumeConcentration(value, VolumeConcentrationUnit.PartPerThousand); } /// - /// Get VolumeConcentration from PartsPerTrillion. + /// Get from PartsPerTrillion. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromPartsPerTrillion(QuantityValue partspertrillion) + public static VolumeConcentration FromPartsPerTrillion(QuantityValue partspertrillion) { double value = (double) partspertrillion; - return new VolumeConcentration(value, VolumeConcentrationUnit.PartPerTrillion); + return new VolumeConcentration(value, VolumeConcentrationUnit.PartPerTrillion); } /// - /// Get VolumeConcentration from Percent. + /// Get from Percent. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromPercent(QuantityValue percent) + public static VolumeConcentration FromPercent(QuantityValue percent) { double value = (double) percent; - return new VolumeConcentration(value, VolumeConcentrationUnit.Percent); + return new VolumeConcentration(value, VolumeConcentrationUnit.Percent); } /// - /// Get VolumeConcentration from PicolitersPerLiter. + /// Get from PicolitersPerLiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromPicolitersPerLiter(QuantityValue picolitersperliter) + public static VolumeConcentration FromPicolitersPerLiter(QuantityValue picolitersperliter) { double value = (double) picolitersperliter; - return new VolumeConcentration(value, VolumeConcentrationUnit.PicolitersPerLiter); + return new VolumeConcentration(value, VolumeConcentrationUnit.PicolitersPerLiter); } /// - /// Get VolumeConcentration from PicolitersPerMililiter. + /// Get from PicolitersPerMililiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromPicolitersPerMililiter(QuantityValue picoliterspermililiter) + public static VolumeConcentration FromPicolitersPerMililiter(QuantityValue picoliterspermililiter) { double value = (double) picoliterspermililiter; - return new VolumeConcentration(value, VolumeConcentrationUnit.PicolitersPerMililiter); + return new VolumeConcentration(value, VolumeConcentrationUnit.PicolitersPerMililiter); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// VolumeConcentration unit value. - public static VolumeConcentration From(QuantityValue value, VolumeConcentrationUnit fromUnit) + /// unit value. + public static VolumeConcentration From(QuantityValue value, VolumeConcentrationUnit fromUnit) { - return new VolumeConcentration((double)value, fromUnit); + return new VolumeConcentration((double)value, fromUnit); } #endregion @@ -532,7 +532,7 @@ public static VolumeConcentration From(QuantityValue value, VolumeConcentrationU /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static VolumeConcentration Parse(string str) + public static VolumeConcentration Parse(string str) { return Parse(str, null); } @@ -560,9 +560,9 @@ public static VolumeConcentration Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static VolumeConcentration Parse(string str, [CanBeNull] IFormatProvider provider) + public static VolumeConcentration Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, VolumeConcentrationUnit>( str, provider, From); @@ -576,7 +576,7 @@ public static VolumeConcentration Parse(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out VolumeConcentration result) + public static bool TryParse([CanBeNull] string str, out VolumeConcentration result) { return TryParse(str, null, out result); } @@ -591,9 +591,9 @@ public static bool TryParse([CanBeNull] string str, out VolumeConcentration resu /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VolumeConcentration result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VolumeConcentration result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, VolumeConcentrationUnit>( str, provider, From, @@ -655,43 +655,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume #region Arithmetic Operators /// Negate the value. - public static VolumeConcentration operator -(VolumeConcentration right) + public static VolumeConcentration operator -(VolumeConcentration right) { - return new VolumeConcentration(-right.Value, right.Unit); + return new VolumeConcentration(-right.Value, right.Unit); } - /// Get from adding two . - public static VolumeConcentration operator +(VolumeConcentration left, VolumeConcentration right) + /// Get from adding two . + public static VolumeConcentration operator +(VolumeConcentration left, VolumeConcentration right) { - return new VolumeConcentration(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new VolumeConcentration(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static VolumeConcentration operator -(VolumeConcentration left, VolumeConcentration right) + /// Get from subtracting two . + public static VolumeConcentration operator -(VolumeConcentration left, VolumeConcentration right) { - return new VolumeConcentration(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new VolumeConcentration(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static VolumeConcentration operator *(double left, VolumeConcentration right) + /// Get from multiplying value and . + public static VolumeConcentration operator *(double left, VolumeConcentration right) { - return new VolumeConcentration(left * right.Value, right.Unit); + return new VolumeConcentration(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static VolumeConcentration operator *(VolumeConcentration left, double right) + /// Get from multiplying value and . + public static VolumeConcentration operator *(VolumeConcentration left, double right) { - return new VolumeConcentration(left.Value * right, left.Unit); + return new VolumeConcentration(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static VolumeConcentration operator /(VolumeConcentration left, double right) + /// Get from dividing by value. + public static VolumeConcentration operator /(VolumeConcentration left, double right) { - return new VolumeConcentration(left.Value / right, left.Unit); + return new VolumeConcentration(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(VolumeConcentration left, VolumeConcentration right) + /// Get ratio value from dividing by . + public static double operator /(VolumeConcentration left, VolumeConcentration right) { return left.DecimalFractions / right.DecimalFractions; } @@ -701,39 +701,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(VolumeConcentration left, VolumeConcentration right) + public static bool operator <=(VolumeConcentration left, VolumeConcentration right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(VolumeConcentration left, VolumeConcentration right) + public static bool operator >=(VolumeConcentration left, VolumeConcentration right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(VolumeConcentration left, VolumeConcentration right) + public static bool operator <(VolumeConcentration left, VolumeConcentration right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(VolumeConcentration left, VolumeConcentration right) + public static bool operator >(VolumeConcentration left, VolumeConcentration right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(VolumeConcentration left, VolumeConcentration right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(VolumeConcentration left, VolumeConcentration right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(VolumeConcentration left, VolumeConcentration right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(VolumeConcentration left, VolumeConcentration right) { return !(left == right); } @@ -742,37 +742,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumeConcentration objVolumeConcentration)) throw new ArgumentException("Expected type VolumeConcentration.", nameof(obj)); + if(!(obj is VolumeConcentration objVolumeConcentration)) throw new ArgumentException("Expected type VolumeConcentration.", nameof(obj)); return CompareTo(objVolumeConcentration); } /// - public int CompareTo(VolumeConcentration other) + public int CompareTo(VolumeConcentration other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is VolumeConcentration objVolumeConcentration)) + if(obj is null || !(obj is VolumeConcentration objVolumeConcentration)) return false; return Equals(objVolumeConcentration); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(VolumeConcentration other) + /// Consider using for safely comparing floating point values. + public bool Equals(VolumeConcentration other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another VolumeConcentration within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -810,7 +810,7 @@ public bool Equals(VolumeConcentration other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(VolumeConcentration other, double tolerance, ComparisonType comparisonType) + public bool Equals(VolumeConcentration other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -824,7 +824,7 @@ public bool Equals(VolumeConcentration other, double tolerance, ComparisonType c /// /// Returns the hash code for this instance. /// - /// A hash code for the current VolumeConcentration. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -872,13 +872,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this VolumeConcentration to another VolumeConcentration with the unit representation . + /// Converts this to another with the unit representation . /// - /// A VolumeConcentration with the specified unit. - public VolumeConcentration ToUnit(VolumeConcentrationUnit unit) + /// A with the specified unit. + public VolumeConcentration ToUnit(VolumeConcentrationUnit unit) { var convertedValue = GetValueAs(unit); - return new VolumeConcentration(convertedValue, unit); + return new VolumeConcentration(convertedValue, unit); } /// @@ -891,7 +891,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public VolumeConcentration ToUnit(UnitSystem unitSystem) + public VolumeConcentration ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -953,10 +953,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal VolumeConcentration ToBaseUnit() + internal VolumeConcentration ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new VolumeConcentration(baseUnitValue, BaseUnit); + return new VolumeConcentration(baseUnitValue, BaseUnit); } private double GetValueAs(VolumeConcentrationUnit unit) @@ -1084,7 +1084,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(VolumeConcentration)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(VolumeConcentration)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1094,12 +1094,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(VolumeConcentration)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(VolumeConcentration)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(VolumeConcentration)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(VolumeConcentration)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1144,16 +1144,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(VolumeConcentration)) + if(conversionType == typeof(VolumeConcentration)) return this; else if(conversionType == typeof(VolumeConcentrationUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return VolumeConcentration.QuantityType; + return VolumeConcentration.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return VolumeConcentration.BaseDimensions; + return VolumeConcentration.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(VolumeConcentration)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(VolumeConcentration)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs index 920d10fcfa..a84b63266d 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q. /// - public partial struct VolumeFlow : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct VolumeFlow : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -148,19 +148,19 @@ public VolumeFlow(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of VolumeFlow, which is CubicMeterPerSecond. All conversions go via this value. + /// The base unit of , which is CubicMeterPerSecond. All conversions go via this value. /// public static VolumeFlowUnit BaseUnit { get; } = VolumeFlowUnit.CubicMeterPerSecond; /// - /// Represents the largest possible value of VolumeFlow + /// Represents the largest possible value of /// - public static VolumeFlow MaxValue { get; } = new VolumeFlow(double.MaxValue, BaseUnit); + public static VolumeFlow MaxValue { get; } = new VolumeFlow(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of VolumeFlow + /// Represents the smallest possible value of /// - public static VolumeFlow MinValue { get; } = new VolumeFlow(double.MinValue, BaseUnit); + public static VolumeFlow MinValue { get; } = new VolumeFlow(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -168,14 +168,14 @@ public VolumeFlow(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.VolumeFlow; /// - /// All units of measurement for the VolumeFlow quantity. + /// All units of measurement for the quantity. /// public static VolumeFlowUnit[] Units { get; } = Enum.GetValues(typeof(VolumeFlowUnit)).Cast().Except(new VolumeFlowUnit[]{ VolumeFlowUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerSecond. /// - public static VolumeFlow Zero { get; } = new VolumeFlow(0, BaseUnit); + public static VolumeFlow Zero { get; } = new VolumeFlow(0, BaseUnit); #endregion @@ -200,259 +200,259 @@ public VolumeFlow(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => VolumeFlow.QuantityType; + public QuantityType Type => VolumeFlow.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => VolumeFlow.BaseDimensions; + public BaseDimensions Dimensions => VolumeFlow.BaseDimensions; #endregion #region Conversion Properties /// - /// Get VolumeFlow in AcreFeetPerDay. + /// Get in AcreFeetPerDay. /// public double AcreFeetPerDay => As(VolumeFlowUnit.AcreFootPerDay); /// - /// Get VolumeFlow in AcreFeetPerHour. + /// Get in AcreFeetPerHour. /// public double AcreFeetPerHour => As(VolumeFlowUnit.AcreFootPerHour); /// - /// Get VolumeFlow in AcreFeetPerMinute. + /// Get in AcreFeetPerMinute. /// public double AcreFeetPerMinute => As(VolumeFlowUnit.AcreFootPerMinute); /// - /// Get VolumeFlow in AcreFeetPerSecond. + /// Get in AcreFeetPerSecond. /// public double AcreFeetPerSecond => As(VolumeFlowUnit.AcreFootPerSecond); /// - /// Get VolumeFlow in CentilitersPerDay. + /// Get in CentilitersPerDay. /// public double CentilitersPerDay => As(VolumeFlowUnit.CentiliterPerDay); /// - /// Get VolumeFlow in CentilitersPerMinute. + /// Get in CentilitersPerMinute. /// public double CentilitersPerMinute => As(VolumeFlowUnit.CentiliterPerMinute); /// - /// Get VolumeFlow in CubicDecimetersPerMinute. + /// Get in CubicDecimetersPerMinute. /// public double CubicDecimetersPerMinute => As(VolumeFlowUnit.CubicDecimeterPerMinute); /// - /// Get VolumeFlow in CubicFeetPerHour. + /// Get in CubicFeetPerHour. /// public double CubicFeetPerHour => As(VolumeFlowUnit.CubicFootPerHour); /// - /// Get VolumeFlow in CubicFeetPerMinute. + /// Get in CubicFeetPerMinute. /// public double CubicFeetPerMinute => As(VolumeFlowUnit.CubicFootPerMinute); /// - /// Get VolumeFlow in CubicFeetPerSecond. + /// Get in CubicFeetPerSecond. /// public double CubicFeetPerSecond => As(VolumeFlowUnit.CubicFootPerSecond); /// - /// Get VolumeFlow in CubicMetersPerDay. + /// Get in CubicMetersPerDay. /// public double CubicMetersPerDay => As(VolumeFlowUnit.CubicMeterPerDay); /// - /// Get VolumeFlow in CubicMetersPerHour. + /// Get in CubicMetersPerHour. /// public double CubicMetersPerHour => As(VolumeFlowUnit.CubicMeterPerHour); /// - /// Get VolumeFlow in CubicMetersPerMinute. + /// Get in CubicMetersPerMinute. /// public double CubicMetersPerMinute => As(VolumeFlowUnit.CubicMeterPerMinute); /// - /// Get VolumeFlow in CubicMetersPerSecond. + /// Get in CubicMetersPerSecond. /// public double CubicMetersPerSecond => As(VolumeFlowUnit.CubicMeterPerSecond); /// - /// Get VolumeFlow in CubicMillimetersPerSecond. + /// Get in CubicMillimetersPerSecond. /// public double CubicMillimetersPerSecond => As(VolumeFlowUnit.CubicMillimeterPerSecond); /// - /// Get VolumeFlow in CubicYardsPerDay. + /// Get in CubicYardsPerDay. /// public double CubicYardsPerDay => As(VolumeFlowUnit.CubicYardPerDay); /// - /// Get VolumeFlow in CubicYardsPerHour. + /// Get in CubicYardsPerHour. /// public double CubicYardsPerHour => As(VolumeFlowUnit.CubicYardPerHour); /// - /// Get VolumeFlow in CubicYardsPerMinute. + /// Get in CubicYardsPerMinute. /// public double CubicYardsPerMinute => As(VolumeFlowUnit.CubicYardPerMinute); /// - /// Get VolumeFlow in CubicYardsPerSecond. + /// Get in CubicYardsPerSecond. /// public double CubicYardsPerSecond => As(VolumeFlowUnit.CubicYardPerSecond); /// - /// Get VolumeFlow in DecilitersPerDay. + /// Get in DecilitersPerDay. /// public double DecilitersPerDay => As(VolumeFlowUnit.DeciliterPerDay); /// - /// Get VolumeFlow in DecilitersPerMinute. + /// Get in DecilitersPerMinute. /// public double DecilitersPerMinute => As(VolumeFlowUnit.DeciliterPerMinute); /// - /// Get VolumeFlow in KilolitersPerDay. + /// Get in KilolitersPerDay. /// public double KilolitersPerDay => As(VolumeFlowUnit.KiloliterPerDay); /// - /// Get VolumeFlow in KilolitersPerMinute. + /// Get in KilolitersPerMinute. /// public double KilolitersPerMinute => As(VolumeFlowUnit.KiloliterPerMinute); /// - /// Get VolumeFlow in KilousGallonsPerMinute. + /// Get in KilousGallonsPerMinute. /// public double KilousGallonsPerMinute => As(VolumeFlowUnit.KilousGallonPerMinute); /// - /// Get VolumeFlow in LitersPerDay. + /// Get in LitersPerDay. /// public double LitersPerDay => As(VolumeFlowUnit.LiterPerDay); /// - /// Get VolumeFlow in LitersPerHour. + /// Get in LitersPerHour. /// public double LitersPerHour => As(VolumeFlowUnit.LiterPerHour); /// - /// Get VolumeFlow in LitersPerMinute. + /// Get in LitersPerMinute. /// public double LitersPerMinute => As(VolumeFlowUnit.LiterPerMinute); /// - /// Get VolumeFlow in LitersPerSecond. + /// Get in LitersPerSecond. /// public double LitersPerSecond => As(VolumeFlowUnit.LiterPerSecond); /// - /// Get VolumeFlow in MegalitersPerDay. + /// Get in MegalitersPerDay. /// public double MegalitersPerDay => As(VolumeFlowUnit.MegaliterPerDay); /// - /// Get VolumeFlow in MegaukGallonsPerSecond. + /// Get in MegaukGallonsPerSecond. /// public double MegaukGallonsPerSecond => As(VolumeFlowUnit.MegaukGallonPerSecond); /// - /// Get VolumeFlow in MicrolitersPerDay. + /// Get in MicrolitersPerDay. /// public double MicrolitersPerDay => As(VolumeFlowUnit.MicroliterPerDay); /// - /// Get VolumeFlow in MicrolitersPerMinute. + /// Get in MicrolitersPerMinute. /// public double MicrolitersPerMinute => As(VolumeFlowUnit.MicroliterPerMinute); /// - /// Get VolumeFlow in MillilitersPerDay. + /// Get in MillilitersPerDay. /// public double MillilitersPerDay => As(VolumeFlowUnit.MilliliterPerDay); /// - /// Get VolumeFlow in MillilitersPerMinute. + /// Get in MillilitersPerMinute. /// public double MillilitersPerMinute => As(VolumeFlowUnit.MilliliterPerMinute); /// - /// Get VolumeFlow in MillionUsGallonsPerDay. + /// Get in MillionUsGallonsPerDay. /// public double MillionUsGallonsPerDay => As(VolumeFlowUnit.MillionUsGallonsPerDay); /// - /// Get VolumeFlow in NanolitersPerDay. + /// Get in NanolitersPerDay. /// public double NanolitersPerDay => As(VolumeFlowUnit.NanoliterPerDay); /// - /// Get VolumeFlow in NanolitersPerMinute. + /// Get in NanolitersPerMinute. /// public double NanolitersPerMinute => As(VolumeFlowUnit.NanoliterPerMinute); /// - /// Get VolumeFlow in OilBarrelsPerDay. + /// Get in OilBarrelsPerDay. /// public double OilBarrelsPerDay => As(VolumeFlowUnit.OilBarrelPerDay); /// - /// Get VolumeFlow in OilBarrelsPerHour. + /// Get in OilBarrelsPerHour. /// public double OilBarrelsPerHour => As(VolumeFlowUnit.OilBarrelPerHour); /// - /// Get VolumeFlow in OilBarrelsPerMinute. + /// Get in OilBarrelsPerMinute. /// public double OilBarrelsPerMinute => As(VolumeFlowUnit.OilBarrelPerMinute); /// - /// Get VolumeFlow in OilBarrelsPerSecond. + /// Get in OilBarrelsPerSecond. /// public double OilBarrelsPerSecond => As(VolumeFlowUnit.OilBarrelPerSecond); /// - /// Get VolumeFlow in UkGallonsPerDay. + /// Get in UkGallonsPerDay. /// public double UkGallonsPerDay => As(VolumeFlowUnit.UkGallonPerDay); /// - /// Get VolumeFlow in UkGallonsPerHour. + /// Get in UkGallonsPerHour. /// public double UkGallonsPerHour => As(VolumeFlowUnit.UkGallonPerHour); /// - /// Get VolumeFlow in UkGallonsPerMinute. + /// Get in UkGallonsPerMinute. /// public double UkGallonsPerMinute => As(VolumeFlowUnit.UkGallonPerMinute); /// - /// Get VolumeFlow in UkGallonsPerSecond. + /// Get in UkGallonsPerSecond. /// public double UkGallonsPerSecond => As(VolumeFlowUnit.UkGallonPerSecond); /// - /// Get VolumeFlow in UsGallonsPerDay. + /// Get in UsGallonsPerDay. /// public double UsGallonsPerDay => As(VolumeFlowUnit.UsGallonPerDay); /// - /// Get VolumeFlow in UsGallonsPerHour. + /// Get in UsGallonsPerHour. /// public double UsGallonsPerHour => As(VolumeFlowUnit.UsGallonPerHour); /// - /// Get VolumeFlow in UsGallonsPerMinute. + /// Get in UsGallonsPerMinute. /// public double UsGallonsPerMinute => As(VolumeFlowUnit.UsGallonPerMinute); /// - /// Get VolumeFlow in UsGallonsPerSecond. + /// Get in UsGallonsPerSecond. /// public double UsGallonsPerSecond => As(VolumeFlowUnit.UsGallonPerSecond); @@ -486,456 +486,456 @@ public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] IFormatPro #region Static Factory Methods /// - /// Get VolumeFlow from AcreFeetPerDay. + /// Get from AcreFeetPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromAcreFeetPerDay(QuantityValue acrefeetperday) + public static VolumeFlow FromAcreFeetPerDay(QuantityValue acrefeetperday) { double value = (double) acrefeetperday; - return new VolumeFlow(value, VolumeFlowUnit.AcreFootPerDay); + return new VolumeFlow(value, VolumeFlowUnit.AcreFootPerDay); } /// - /// Get VolumeFlow from AcreFeetPerHour. + /// Get from AcreFeetPerHour. /// /// If value is NaN or Infinity. - public static VolumeFlow FromAcreFeetPerHour(QuantityValue acrefeetperhour) + public static VolumeFlow FromAcreFeetPerHour(QuantityValue acrefeetperhour) { double value = (double) acrefeetperhour; - return new VolumeFlow(value, VolumeFlowUnit.AcreFootPerHour); + return new VolumeFlow(value, VolumeFlowUnit.AcreFootPerHour); } /// - /// Get VolumeFlow from AcreFeetPerMinute. + /// Get from AcreFeetPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromAcreFeetPerMinute(QuantityValue acrefeetperminute) + public static VolumeFlow FromAcreFeetPerMinute(QuantityValue acrefeetperminute) { double value = (double) acrefeetperminute; - return new VolumeFlow(value, VolumeFlowUnit.AcreFootPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.AcreFootPerMinute); } /// - /// Get VolumeFlow from AcreFeetPerSecond. + /// Get from AcreFeetPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromAcreFeetPerSecond(QuantityValue acrefeetpersecond) + public static VolumeFlow FromAcreFeetPerSecond(QuantityValue acrefeetpersecond) { double value = (double) acrefeetpersecond; - return new VolumeFlow(value, VolumeFlowUnit.AcreFootPerSecond); + return new VolumeFlow(value, VolumeFlowUnit.AcreFootPerSecond); } /// - /// Get VolumeFlow from CentilitersPerDay. + /// Get from CentilitersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCentilitersPerDay(QuantityValue centilitersperday) + public static VolumeFlow FromCentilitersPerDay(QuantityValue centilitersperday) { double value = (double) centilitersperday; - return new VolumeFlow(value, VolumeFlowUnit.CentiliterPerDay); + return new VolumeFlow(value, VolumeFlowUnit.CentiliterPerDay); } /// - /// Get VolumeFlow from CentilitersPerMinute. + /// Get from CentilitersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCentilitersPerMinute(QuantityValue centilitersperminute) + public static VolumeFlow FromCentilitersPerMinute(QuantityValue centilitersperminute) { double value = (double) centilitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.CentiliterPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.CentiliterPerMinute); } /// - /// Get VolumeFlow from CubicDecimetersPerMinute. + /// Get from CubicDecimetersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicDecimetersPerMinute(QuantityValue cubicdecimetersperminute) + public static VolumeFlow FromCubicDecimetersPerMinute(QuantityValue cubicdecimetersperminute) { double value = (double) cubicdecimetersperminute; - return new VolumeFlow(value, VolumeFlowUnit.CubicDecimeterPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.CubicDecimeterPerMinute); } /// - /// Get VolumeFlow from CubicFeetPerHour. + /// Get from CubicFeetPerHour. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicFeetPerHour(QuantityValue cubicfeetperhour) + public static VolumeFlow FromCubicFeetPerHour(QuantityValue cubicfeetperhour) { double value = (double) cubicfeetperhour; - return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerHour); + return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerHour); } /// - /// Get VolumeFlow from CubicFeetPerMinute. + /// Get from CubicFeetPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicFeetPerMinute(QuantityValue cubicfeetperminute) + public static VolumeFlow FromCubicFeetPerMinute(QuantityValue cubicfeetperminute) { double value = (double) cubicfeetperminute; - return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerMinute); } /// - /// Get VolumeFlow from CubicFeetPerSecond. + /// Get from CubicFeetPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicFeetPerSecond(QuantityValue cubicfeetpersecond) + public static VolumeFlow FromCubicFeetPerSecond(QuantityValue cubicfeetpersecond) { double value = (double) cubicfeetpersecond; - return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerSecond); + return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerSecond); } /// - /// Get VolumeFlow from CubicMetersPerDay. + /// Get from CubicMetersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicMetersPerDay(QuantityValue cubicmetersperday) + public static VolumeFlow FromCubicMetersPerDay(QuantityValue cubicmetersperday) { double value = (double) cubicmetersperday; - return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerDay); + return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerDay); } /// - /// Get VolumeFlow from CubicMetersPerHour. + /// Get from CubicMetersPerHour. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicMetersPerHour(QuantityValue cubicmetersperhour) + public static VolumeFlow FromCubicMetersPerHour(QuantityValue cubicmetersperhour) { double value = (double) cubicmetersperhour; - return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerHour); + return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerHour); } /// - /// Get VolumeFlow from CubicMetersPerMinute. + /// Get from CubicMetersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicMetersPerMinute(QuantityValue cubicmetersperminute) + public static VolumeFlow FromCubicMetersPerMinute(QuantityValue cubicmetersperminute) { double value = (double) cubicmetersperminute; - return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerMinute); } /// - /// Get VolumeFlow from CubicMetersPerSecond. + /// Get from CubicMetersPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicMetersPerSecond(QuantityValue cubicmeterspersecond) + public static VolumeFlow FromCubicMetersPerSecond(QuantityValue cubicmeterspersecond) { double value = (double) cubicmeterspersecond; - return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerSecond); + return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerSecond); } /// - /// Get VolumeFlow from CubicMillimetersPerSecond. + /// Get from CubicMillimetersPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicMillimetersPerSecond(QuantityValue cubicmillimeterspersecond) + public static VolumeFlow FromCubicMillimetersPerSecond(QuantityValue cubicmillimeterspersecond) { double value = (double) cubicmillimeterspersecond; - return new VolumeFlow(value, VolumeFlowUnit.CubicMillimeterPerSecond); + return new VolumeFlow(value, VolumeFlowUnit.CubicMillimeterPerSecond); } /// - /// Get VolumeFlow from CubicYardsPerDay. + /// Get from CubicYardsPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicYardsPerDay(QuantityValue cubicyardsperday) + public static VolumeFlow FromCubicYardsPerDay(QuantityValue cubicyardsperday) { double value = (double) cubicyardsperday; - return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerDay); + return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerDay); } /// - /// Get VolumeFlow from CubicYardsPerHour. + /// Get from CubicYardsPerHour. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicYardsPerHour(QuantityValue cubicyardsperhour) + public static VolumeFlow FromCubicYardsPerHour(QuantityValue cubicyardsperhour) { double value = (double) cubicyardsperhour; - return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerHour); + return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerHour); } /// - /// Get VolumeFlow from CubicYardsPerMinute. + /// Get from CubicYardsPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicYardsPerMinute(QuantityValue cubicyardsperminute) + public static VolumeFlow FromCubicYardsPerMinute(QuantityValue cubicyardsperminute) { double value = (double) cubicyardsperminute; - return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerMinute); } /// - /// Get VolumeFlow from CubicYardsPerSecond. + /// Get from CubicYardsPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicYardsPerSecond(QuantityValue cubicyardspersecond) + public static VolumeFlow FromCubicYardsPerSecond(QuantityValue cubicyardspersecond) { double value = (double) cubicyardspersecond; - return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerSecond); + return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerSecond); } /// - /// Get VolumeFlow from DecilitersPerDay. + /// Get from DecilitersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromDecilitersPerDay(QuantityValue decilitersperday) + public static VolumeFlow FromDecilitersPerDay(QuantityValue decilitersperday) { double value = (double) decilitersperday; - return new VolumeFlow(value, VolumeFlowUnit.DeciliterPerDay); + return new VolumeFlow(value, VolumeFlowUnit.DeciliterPerDay); } /// - /// Get VolumeFlow from DecilitersPerMinute. + /// Get from DecilitersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromDecilitersPerMinute(QuantityValue decilitersperminute) + public static VolumeFlow FromDecilitersPerMinute(QuantityValue decilitersperminute) { double value = (double) decilitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.DeciliterPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.DeciliterPerMinute); } /// - /// Get VolumeFlow from KilolitersPerDay. + /// Get from KilolitersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromKilolitersPerDay(QuantityValue kilolitersperday) + public static VolumeFlow FromKilolitersPerDay(QuantityValue kilolitersperday) { double value = (double) kilolitersperday; - return new VolumeFlow(value, VolumeFlowUnit.KiloliterPerDay); + return new VolumeFlow(value, VolumeFlowUnit.KiloliterPerDay); } /// - /// Get VolumeFlow from KilolitersPerMinute. + /// Get from KilolitersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromKilolitersPerMinute(QuantityValue kilolitersperminute) + public static VolumeFlow FromKilolitersPerMinute(QuantityValue kilolitersperminute) { double value = (double) kilolitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.KiloliterPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.KiloliterPerMinute); } /// - /// Get VolumeFlow from KilousGallonsPerMinute. + /// Get from KilousGallonsPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromKilousGallonsPerMinute(QuantityValue kilousgallonsperminute) + public static VolumeFlow FromKilousGallonsPerMinute(QuantityValue kilousgallonsperminute) { double value = (double) kilousgallonsperminute; - return new VolumeFlow(value, VolumeFlowUnit.KilousGallonPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.KilousGallonPerMinute); } /// - /// Get VolumeFlow from LitersPerDay. + /// Get from LitersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromLitersPerDay(QuantityValue litersperday) + public static VolumeFlow FromLitersPerDay(QuantityValue litersperday) { double value = (double) litersperday; - return new VolumeFlow(value, VolumeFlowUnit.LiterPerDay); + return new VolumeFlow(value, VolumeFlowUnit.LiterPerDay); } /// - /// Get VolumeFlow from LitersPerHour. + /// Get from LitersPerHour. /// /// If value is NaN or Infinity. - public static VolumeFlow FromLitersPerHour(QuantityValue litersperhour) + public static VolumeFlow FromLitersPerHour(QuantityValue litersperhour) { double value = (double) litersperhour; - return new VolumeFlow(value, VolumeFlowUnit.LiterPerHour); + return new VolumeFlow(value, VolumeFlowUnit.LiterPerHour); } /// - /// Get VolumeFlow from LitersPerMinute. + /// Get from LitersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromLitersPerMinute(QuantityValue litersperminute) + public static VolumeFlow FromLitersPerMinute(QuantityValue litersperminute) { double value = (double) litersperminute; - return new VolumeFlow(value, VolumeFlowUnit.LiterPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.LiterPerMinute); } /// - /// Get VolumeFlow from LitersPerSecond. + /// Get from LitersPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromLitersPerSecond(QuantityValue literspersecond) + public static VolumeFlow FromLitersPerSecond(QuantityValue literspersecond) { double value = (double) literspersecond; - return new VolumeFlow(value, VolumeFlowUnit.LiterPerSecond); + return new VolumeFlow(value, VolumeFlowUnit.LiterPerSecond); } /// - /// Get VolumeFlow from MegalitersPerDay. + /// Get from MegalitersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromMegalitersPerDay(QuantityValue megalitersperday) + public static VolumeFlow FromMegalitersPerDay(QuantityValue megalitersperday) { double value = (double) megalitersperday; - return new VolumeFlow(value, VolumeFlowUnit.MegaliterPerDay); + return new VolumeFlow(value, VolumeFlowUnit.MegaliterPerDay); } /// - /// Get VolumeFlow from MegaukGallonsPerSecond. + /// Get from MegaukGallonsPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromMegaukGallonsPerSecond(QuantityValue megaukgallonspersecond) + public static VolumeFlow FromMegaukGallonsPerSecond(QuantityValue megaukgallonspersecond) { double value = (double) megaukgallonspersecond; - return new VolumeFlow(value, VolumeFlowUnit.MegaukGallonPerSecond); + return new VolumeFlow(value, VolumeFlowUnit.MegaukGallonPerSecond); } /// - /// Get VolumeFlow from MicrolitersPerDay. + /// Get from MicrolitersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromMicrolitersPerDay(QuantityValue microlitersperday) + public static VolumeFlow FromMicrolitersPerDay(QuantityValue microlitersperday) { double value = (double) microlitersperday; - return new VolumeFlow(value, VolumeFlowUnit.MicroliterPerDay); + return new VolumeFlow(value, VolumeFlowUnit.MicroliterPerDay); } /// - /// Get VolumeFlow from MicrolitersPerMinute. + /// Get from MicrolitersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromMicrolitersPerMinute(QuantityValue microlitersperminute) + public static VolumeFlow FromMicrolitersPerMinute(QuantityValue microlitersperminute) { double value = (double) microlitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.MicroliterPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.MicroliterPerMinute); } /// - /// Get VolumeFlow from MillilitersPerDay. + /// Get from MillilitersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromMillilitersPerDay(QuantityValue millilitersperday) + public static VolumeFlow FromMillilitersPerDay(QuantityValue millilitersperday) { double value = (double) millilitersperday; - return new VolumeFlow(value, VolumeFlowUnit.MilliliterPerDay); + return new VolumeFlow(value, VolumeFlowUnit.MilliliterPerDay); } /// - /// Get VolumeFlow from MillilitersPerMinute. + /// Get from MillilitersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromMillilitersPerMinute(QuantityValue millilitersperminute) + public static VolumeFlow FromMillilitersPerMinute(QuantityValue millilitersperminute) { double value = (double) millilitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.MilliliterPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.MilliliterPerMinute); } /// - /// Get VolumeFlow from MillionUsGallonsPerDay. + /// Get from MillionUsGallonsPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromMillionUsGallonsPerDay(QuantityValue millionusgallonsperday) + public static VolumeFlow FromMillionUsGallonsPerDay(QuantityValue millionusgallonsperday) { double value = (double) millionusgallonsperday; - return new VolumeFlow(value, VolumeFlowUnit.MillionUsGallonsPerDay); + return new VolumeFlow(value, VolumeFlowUnit.MillionUsGallonsPerDay); } /// - /// Get VolumeFlow from NanolitersPerDay. + /// Get from NanolitersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromNanolitersPerDay(QuantityValue nanolitersperday) + public static VolumeFlow FromNanolitersPerDay(QuantityValue nanolitersperday) { double value = (double) nanolitersperday; - return new VolumeFlow(value, VolumeFlowUnit.NanoliterPerDay); + return new VolumeFlow(value, VolumeFlowUnit.NanoliterPerDay); } /// - /// Get VolumeFlow from NanolitersPerMinute. + /// Get from NanolitersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromNanolitersPerMinute(QuantityValue nanolitersperminute) + public static VolumeFlow FromNanolitersPerMinute(QuantityValue nanolitersperminute) { double value = (double) nanolitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.NanoliterPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.NanoliterPerMinute); } /// - /// Get VolumeFlow from OilBarrelsPerDay. + /// Get from OilBarrelsPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromOilBarrelsPerDay(QuantityValue oilbarrelsperday) + public static VolumeFlow FromOilBarrelsPerDay(QuantityValue oilbarrelsperday) { double value = (double) oilbarrelsperday; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerDay); + return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerDay); } /// - /// Get VolumeFlow from OilBarrelsPerHour. + /// Get from OilBarrelsPerHour. /// /// If value is NaN or Infinity. - public static VolumeFlow FromOilBarrelsPerHour(QuantityValue oilbarrelsperhour) + public static VolumeFlow FromOilBarrelsPerHour(QuantityValue oilbarrelsperhour) { double value = (double) oilbarrelsperhour; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerHour); + return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerHour); } /// - /// Get VolumeFlow from OilBarrelsPerMinute. + /// Get from OilBarrelsPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromOilBarrelsPerMinute(QuantityValue oilbarrelsperminute) + public static VolumeFlow FromOilBarrelsPerMinute(QuantityValue oilbarrelsperminute) { double value = (double) oilbarrelsperminute; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerMinute); } /// - /// Get VolumeFlow from OilBarrelsPerSecond. + /// Get from OilBarrelsPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromOilBarrelsPerSecond(QuantityValue oilbarrelspersecond) + public static VolumeFlow FromOilBarrelsPerSecond(QuantityValue oilbarrelspersecond) { double value = (double) oilbarrelspersecond; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerSecond); + return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerSecond); } /// - /// Get VolumeFlow from UkGallonsPerDay. + /// Get from UkGallonsPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromUkGallonsPerDay(QuantityValue ukgallonsperday) + public static VolumeFlow FromUkGallonsPerDay(QuantityValue ukgallonsperday) { double value = (double) ukgallonsperday; - return new VolumeFlow(value, VolumeFlowUnit.UkGallonPerDay); + return new VolumeFlow(value, VolumeFlowUnit.UkGallonPerDay); } /// - /// Get VolumeFlow from UkGallonsPerHour. + /// Get from UkGallonsPerHour. /// /// If value is NaN or Infinity. - public static VolumeFlow FromUkGallonsPerHour(QuantityValue ukgallonsperhour) + public static VolumeFlow FromUkGallonsPerHour(QuantityValue ukgallonsperhour) { double value = (double) ukgallonsperhour; - return new VolumeFlow(value, VolumeFlowUnit.UkGallonPerHour); + return new VolumeFlow(value, VolumeFlowUnit.UkGallonPerHour); } /// - /// Get VolumeFlow from UkGallonsPerMinute. + /// Get from UkGallonsPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromUkGallonsPerMinute(QuantityValue ukgallonsperminute) + public static VolumeFlow FromUkGallonsPerMinute(QuantityValue ukgallonsperminute) { double value = (double) ukgallonsperminute; - return new VolumeFlow(value, VolumeFlowUnit.UkGallonPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.UkGallonPerMinute); } /// - /// Get VolumeFlow from UkGallonsPerSecond. + /// Get from UkGallonsPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromUkGallonsPerSecond(QuantityValue ukgallonspersecond) + public static VolumeFlow FromUkGallonsPerSecond(QuantityValue ukgallonspersecond) { double value = (double) ukgallonspersecond; - return new VolumeFlow(value, VolumeFlowUnit.UkGallonPerSecond); + return new VolumeFlow(value, VolumeFlowUnit.UkGallonPerSecond); } /// - /// Get VolumeFlow from UsGallonsPerDay. + /// Get from UsGallonsPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromUsGallonsPerDay(QuantityValue usgallonsperday) + public static VolumeFlow FromUsGallonsPerDay(QuantityValue usgallonsperday) { double value = (double) usgallonsperday; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerDay); + return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerDay); } /// - /// Get VolumeFlow from UsGallonsPerHour. + /// Get from UsGallonsPerHour. /// /// If value is NaN or Infinity. - public static VolumeFlow FromUsGallonsPerHour(QuantityValue usgallonsperhour) + public static VolumeFlow FromUsGallonsPerHour(QuantityValue usgallonsperhour) { double value = (double) usgallonsperhour; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerHour); + return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerHour); } /// - /// Get VolumeFlow from UsGallonsPerMinute. + /// Get from UsGallonsPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromUsGallonsPerMinute(QuantityValue usgallonsperminute) + public static VolumeFlow FromUsGallonsPerMinute(QuantityValue usgallonsperminute) { double value = (double) usgallonsperminute; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerMinute); } /// - /// Get VolumeFlow from UsGallonsPerSecond. + /// Get from UsGallonsPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromUsGallonsPerSecond(QuantityValue usgallonspersecond) + public static VolumeFlow FromUsGallonsPerSecond(QuantityValue usgallonspersecond) { double value = (double) usgallonspersecond; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerSecond); + return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerSecond); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// VolumeFlow unit value. - public static VolumeFlow From(QuantityValue value, VolumeFlowUnit fromUnit) + /// unit value. + public static VolumeFlow From(QuantityValue value, VolumeFlowUnit fromUnit) { - return new VolumeFlow((double)value, fromUnit); + return new VolumeFlow((double)value, fromUnit); } #endregion @@ -964,7 +964,7 @@ public static VolumeFlow From(QuantityValue value, VolumeFlowUnit fromUnit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static VolumeFlow Parse(string str) + public static VolumeFlow Parse(string str) { return Parse(str, null); } @@ -992,9 +992,9 @@ public static VolumeFlow Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static VolumeFlow Parse(string str, [CanBeNull] IFormatProvider provider) + public static VolumeFlow Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, VolumeFlowUnit>( str, provider, From); @@ -1008,7 +1008,7 @@ public static VolumeFlow Parse(string str, [CanBeNull] IFormatProvider provider) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out VolumeFlow result) + public static bool TryParse([CanBeNull] string str, out VolumeFlow result) { return TryParse(str, null, out result); } @@ -1023,9 +1023,9 @@ public static bool TryParse([CanBeNull] string str, out VolumeFlow result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VolumeFlow result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VolumeFlow result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, VolumeFlowUnit>( str, provider, From, @@ -1087,43 +1087,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume #region Arithmetic Operators /// Negate the value. - public static VolumeFlow operator -(VolumeFlow right) + public static VolumeFlow operator -(VolumeFlow right) { - return new VolumeFlow(-right.Value, right.Unit); + return new VolumeFlow(-right.Value, right.Unit); } - /// Get from adding two . - public static VolumeFlow operator +(VolumeFlow left, VolumeFlow right) + /// Get from adding two . + public static VolumeFlow operator +(VolumeFlow left, VolumeFlow right) { - return new VolumeFlow(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new VolumeFlow(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static VolumeFlow operator -(VolumeFlow left, VolumeFlow right) + /// Get from subtracting two . + public static VolumeFlow operator -(VolumeFlow left, VolumeFlow right) { - return new VolumeFlow(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new VolumeFlow(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static VolumeFlow operator *(double left, VolumeFlow right) + /// Get from multiplying value and . + public static VolumeFlow operator *(double left, VolumeFlow right) { - return new VolumeFlow(left * right.Value, right.Unit); + return new VolumeFlow(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static VolumeFlow operator *(VolumeFlow left, double right) + /// Get from multiplying value and . + public static VolumeFlow operator *(VolumeFlow left, double right) { - return new VolumeFlow(left.Value * right, left.Unit); + return new VolumeFlow(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static VolumeFlow operator /(VolumeFlow left, double right) + /// Get from dividing by value. + public static VolumeFlow operator /(VolumeFlow left, double right) { - return new VolumeFlow(left.Value / right, left.Unit); + return new VolumeFlow(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(VolumeFlow left, VolumeFlow right) + /// Get ratio value from dividing by . + public static double operator /(VolumeFlow left, VolumeFlow right) { return left.CubicMetersPerSecond / right.CubicMetersPerSecond; } @@ -1133,39 +1133,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(VolumeFlow left, VolumeFlow right) + public static bool operator <=(VolumeFlow left, VolumeFlow right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(VolumeFlow left, VolumeFlow right) + public static bool operator >=(VolumeFlow left, VolumeFlow right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(VolumeFlow left, VolumeFlow right) + public static bool operator <(VolumeFlow left, VolumeFlow right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(VolumeFlow left, VolumeFlow right) + public static bool operator >(VolumeFlow left, VolumeFlow right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(VolumeFlow left, VolumeFlow right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(VolumeFlow left, VolumeFlow right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(VolumeFlow left, VolumeFlow right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(VolumeFlow left, VolumeFlow right) { return !(left == right); } @@ -1174,37 +1174,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumeFlow objVolumeFlow)) throw new ArgumentException("Expected type VolumeFlow.", nameof(obj)); + if(!(obj is VolumeFlow objVolumeFlow)) throw new ArgumentException("Expected type VolumeFlow.", nameof(obj)); return CompareTo(objVolumeFlow); } /// - public int CompareTo(VolumeFlow other) + public int CompareTo(VolumeFlow other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is VolumeFlow objVolumeFlow)) + if(obj is null || !(obj is VolumeFlow objVolumeFlow)) return false; return Equals(objVolumeFlow); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(VolumeFlow other) + /// Consider using for safely comparing floating point values. + public bool Equals(VolumeFlow other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another VolumeFlow within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -1242,7 +1242,7 @@ public bool Equals(VolumeFlow other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(VolumeFlow other, double tolerance, ComparisonType comparisonType) + public bool Equals(VolumeFlow other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -1256,7 +1256,7 @@ public bool Equals(VolumeFlow other, double tolerance, ComparisonType comparison /// /// Returns the hash code for this instance. /// - /// A hash code for the current VolumeFlow. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -1304,13 +1304,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this VolumeFlow to another VolumeFlow with the unit representation . + /// Converts this to another with the unit representation . /// - /// A VolumeFlow with the specified unit. - public VolumeFlow ToUnit(VolumeFlowUnit unit) + /// A with the specified unit. + public VolumeFlow ToUnit(VolumeFlowUnit unit) { var convertedValue = GetValueAs(unit); - return new VolumeFlow(convertedValue, unit); + return new VolumeFlow(convertedValue, unit); } /// @@ -1323,7 +1323,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public VolumeFlow ToUnit(UnitSystem unitSystem) + public VolumeFlow ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1414,10 +1414,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal VolumeFlow ToBaseUnit() + internal VolumeFlow ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new VolumeFlow(baseUnitValue, BaseUnit); + return new VolumeFlow(baseUnitValue, BaseUnit); } private double GetValueAs(VolumeFlowUnit unit) @@ -1574,7 +1574,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -1584,12 +1584,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -1634,16 +1634,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(VolumeFlow)) + if(conversionType == typeof(VolumeFlow)) return this; else if(conversionType == typeof(VolumeFlowUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return VolumeFlow.QuantityType; + return VolumeFlow.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return VolumeFlow.BaseDimensions; + return VolumeFlow.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs index f172de4651..f2b686a155 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -32,7 +32,7 @@ namespace UnitsNet /// /// Volume, typically of fluid, that a container can hold within a unit of length. /// - public partial struct VolumePerLength : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public partial struct VolumePerLength : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -102,19 +102,19 @@ public VolumePerLength(double value, UnitSystem unitSystem) public static BaseDimensions BaseDimensions { get; } /// - /// The base unit of VolumePerLength, which is CubicMeterPerMeter. All conversions go via this value. + /// The base unit of , which is CubicMeterPerMeter. All conversions go via this value. /// public static VolumePerLengthUnit BaseUnit { get; } = VolumePerLengthUnit.CubicMeterPerMeter; /// - /// Represents the largest possible value of VolumePerLength + /// Represents the largest possible value of /// - public static VolumePerLength MaxValue { get; } = new VolumePerLength(double.MaxValue, BaseUnit); + public static VolumePerLength MaxValue { get; } = new VolumePerLength(double.MaxValue, BaseUnit); /// - /// Represents the smallest possible value of VolumePerLength + /// Represents the smallest possible value of /// - public static VolumePerLength MinValue { get; } = new VolumePerLength(double.MinValue, BaseUnit); + public static VolumePerLength MinValue { get; } = new VolumePerLength(double.MinValue, BaseUnit); /// /// The of this quantity. @@ -122,14 +122,14 @@ public VolumePerLength(double value, UnitSystem unitSystem) public static QuantityType QuantityType { get; } = QuantityType.VolumePerLength; /// - /// All units of measurement for the VolumePerLength quantity. + /// All units of measurement for the quantity. /// public static VolumePerLengthUnit[] Units { get; } = Enum.GetValues(typeof(VolumePerLengthUnit)).Cast().Except(new VolumePerLengthUnit[]{ VolumePerLengthUnit.Undefined }).ToArray(); /// /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerMeter. /// - public static VolumePerLength Zero { get; } = new VolumePerLength(0, BaseUnit); + public static VolumePerLength Zero { get; } = new VolumePerLength(0, BaseUnit); #endregion @@ -154,29 +154,29 @@ public VolumePerLength(double value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => VolumePerLength.QuantityType; + public QuantityType Type => VolumePerLength.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => VolumePerLength.BaseDimensions; + public BaseDimensions Dimensions => VolumePerLength.BaseDimensions; #endregion #region Conversion Properties /// - /// Get VolumePerLength in CubicMetersPerMeter. + /// Get in CubicMetersPerMeter. /// public double CubicMetersPerMeter => As(VolumePerLengthUnit.CubicMeterPerMeter); /// - /// Get VolumePerLength in LitersPerMeter. + /// Get in LitersPerMeter. /// public double LitersPerMeter => As(VolumePerLengthUnit.LiterPerMeter); /// - /// Get VolumePerLength in OilBarrelsPerFoot. + /// Get in OilBarrelsPerFoot. /// public double OilBarrelsPerFoot => As(VolumePerLengthUnit.OilBarrelPerFoot); @@ -210,42 +210,42 @@ public static string GetAbbreviation(VolumePerLengthUnit unit, [CanBeNull] IForm #region Static Factory Methods /// - /// Get VolumePerLength from CubicMetersPerMeter. + /// Get from CubicMetersPerMeter. /// /// If value is NaN or Infinity. - public static VolumePerLength FromCubicMetersPerMeter(QuantityValue cubicmeterspermeter) + public static VolumePerLength FromCubicMetersPerMeter(QuantityValue cubicmeterspermeter) { double value = (double) cubicmeterspermeter; - return new VolumePerLength(value, VolumePerLengthUnit.CubicMeterPerMeter); + return new VolumePerLength(value, VolumePerLengthUnit.CubicMeterPerMeter); } /// - /// Get VolumePerLength from LitersPerMeter. + /// Get from LitersPerMeter. /// /// If value is NaN or Infinity. - public static VolumePerLength FromLitersPerMeter(QuantityValue literspermeter) + public static VolumePerLength FromLitersPerMeter(QuantityValue literspermeter) { double value = (double) literspermeter; - return new VolumePerLength(value, VolumePerLengthUnit.LiterPerMeter); + return new VolumePerLength(value, VolumePerLengthUnit.LiterPerMeter); } /// - /// Get VolumePerLength from OilBarrelsPerFoot. + /// Get from OilBarrelsPerFoot. /// /// If value is NaN or Infinity. - public static VolumePerLength FromOilBarrelsPerFoot(QuantityValue oilbarrelsperfoot) + public static VolumePerLength FromOilBarrelsPerFoot(QuantityValue oilbarrelsperfoot) { double value = (double) oilbarrelsperfoot; - return new VolumePerLength(value, VolumePerLengthUnit.OilBarrelPerFoot); + return new VolumePerLength(value, VolumePerLengthUnit.OilBarrelPerFoot); } /// - /// Dynamically convert from value and unit enum to . + /// Dynamically convert from value and unit enum to . /// /// Value to convert from. /// Unit to convert from. - /// VolumePerLength unit value. - public static VolumePerLength From(QuantityValue value, VolumePerLengthUnit fromUnit) + /// unit value. + public static VolumePerLength From(QuantityValue value, VolumePerLengthUnit fromUnit) { - return new VolumePerLength((double)value, fromUnit); + return new VolumePerLength((double)value, fromUnit); } #endregion @@ -274,7 +274,7 @@ public static VolumePerLength From(QuantityValue value, VolumePerLengthUnit from /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static VolumePerLength Parse(string str) + public static VolumePerLength Parse(string str) { return Parse(str, null); } @@ -302,9 +302,9 @@ public static VolumePerLength Parse(string str) /// Units.NET exceptions from other exceptions. /// /// Format to use when parsing number and unit. Defaults to if null. - public static VolumePerLength Parse(string str, [CanBeNull] IFormatProvider provider) + public static VolumePerLength Parse(string str, [CanBeNull] IFormatProvider provider) { - return QuantityParser.Default.Parse( + return QuantityParser.Default.Parse, VolumePerLengthUnit>( str, provider, From); @@ -318,7 +318,7 @@ public static VolumePerLength Parse(string str, [CanBeNull] IFormatProvider prov /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, out VolumePerLength result) + public static bool TryParse([CanBeNull] string str, out VolumePerLength result) { return TryParse(str, null, out result); } @@ -333,9 +333,9 @@ public static bool TryParse([CanBeNull] string str, out VolumePerLength result) /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// /// Format to use when parsing number and unit. Defaults to if null. - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VolumePerLength result) + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VolumePerLength result) { - return QuantityParser.Default.TryParse( + return QuantityParser.Default.TryParse, VolumePerLengthUnit>( str, provider, From, @@ -397,43 +397,43 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume #region Arithmetic Operators /// Negate the value. - public static VolumePerLength operator -(VolumePerLength right) + public static VolumePerLength operator -(VolumePerLength right) { - return new VolumePerLength(-right.Value, right.Unit); + return new VolumePerLength(-right.Value, right.Unit); } - /// Get from adding two . - public static VolumePerLength operator +(VolumePerLength left, VolumePerLength right) + /// Get from adding two . + public static VolumePerLength operator +(VolumePerLength left, VolumePerLength right) { - return new VolumePerLength(left.Value + right.GetValueAs(left.Unit), left.Unit); + return new VolumePerLength(left.Value + right.GetValueAs(left.Unit), left.Unit); } - /// Get from subtracting two . - public static VolumePerLength operator -(VolumePerLength left, VolumePerLength right) + /// Get from subtracting two . + public static VolumePerLength operator -(VolumePerLength left, VolumePerLength right) { - return new VolumePerLength(left.Value - right.GetValueAs(left.Unit), left.Unit); + return new VolumePerLength(left.Value - right.GetValueAs(left.Unit), left.Unit); } - /// Get from multiplying value and . - public static VolumePerLength operator *(double left, VolumePerLength right) + /// Get from multiplying value and . + public static VolumePerLength operator *(double left, VolumePerLength right) { - return new VolumePerLength(left * right.Value, right.Unit); + return new VolumePerLength(left * right.Value, right.Unit); } - /// Get from multiplying value and . - public static VolumePerLength operator *(VolumePerLength left, double right) + /// Get from multiplying value and . + public static VolumePerLength operator *(VolumePerLength left, double right) { - return new VolumePerLength(left.Value * right, left.Unit); + return new VolumePerLength(left.Value * right, left.Unit); } - /// Get from dividing by value. - public static VolumePerLength operator /(VolumePerLength left, double right) + /// Get from dividing by value. + public static VolumePerLength operator /(VolumePerLength left, double right) { - return new VolumePerLength(left.Value / right, left.Unit); + return new VolumePerLength(left.Value / right, left.Unit); } - /// Get ratio value from dividing by . - public static double operator /(VolumePerLength left, VolumePerLength right) + /// Get ratio value from dividing by . + public static double operator /(VolumePerLength left, VolumePerLength right) { return left.CubicMetersPerMeter / right.CubicMetersPerMeter; } @@ -443,39 +443,39 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume #region Equality / IComparable /// Returns true if less or equal to. - public static bool operator <=(VolumePerLength left, VolumePerLength right) + public static bool operator <=(VolumePerLength left, VolumePerLength right) { return left.Value <= right.GetValueAs(left.Unit); } /// Returns true if greater than or equal to. - public static bool operator >=(VolumePerLength left, VolumePerLength right) + public static bool operator >=(VolumePerLength left, VolumePerLength right) { return left.Value >= right.GetValueAs(left.Unit); } /// Returns true if less than. - public static bool operator <(VolumePerLength left, VolumePerLength right) + public static bool operator <(VolumePerLength left, VolumePerLength right) { return left.Value < right.GetValueAs(left.Unit); } /// Returns true if greater than. - public static bool operator >(VolumePerLength left, VolumePerLength right) + public static bool operator >(VolumePerLength left, VolumePerLength right) { return left.Value > right.GetValueAs(left.Unit); } /// Returns true if exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator ==(VolumePerLength left, VolumePerLength right) + /// Consider using for safely comparing floating point values. + public static bool operator ==(VolumePerLength left, VolumePerLength right) { return left.Equals(right); } /// Returns true if not exactly equal. - /// Consider using for safely comparing floating point values. - public static bool operator !=(VolumePerLength left, VolumePerLength right) + /// Consider using for safely comparing floating point values. + public static bool operator !=(VolumePerLength left, VolumePerLength right) { return !(left == right); } @@ -484,37 +484,37 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumePerLength objVolumePerLength)) throw new ArgumentException("Expected type VolumePerLength.", nameof(obj)); + if(!(obj is VolumePerLength objVolumePerLength)) throw new ArgumentException("Expected type VolumePerLength.", nameof(obj)); return CompareTo(objVolumePerLength); } /// - public int CompareTo(VolumePerLength other) + public int CompareTo(VolumePerLength other) { return _value.CompareTo(other.GetValueAs(this.Unit)); } /// - /// Consider using for safely comparing floating point values. + /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is VolumePerLength objVolumePerLength)) + if(obj is null || !(obj is VolumePerLength objVolumePerLength)) return false; return Equals(objVolumePerLength); } /// - /// Consider using for safely comparing floating point values. - public bool Equals(VolumePerLength other) + /// Consider using for safely comparing floating point values. + public bool Equals(VolumePerLength other) { return _value.Equals(other.GetValueAs(this.Unit)); } /// /// - /// Compare equality to another VolumePerLength within the given absolute or relative tolerance. + /// Compare equality to another within the given absolute or relative tolerance. /// /// /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and @@ -552,7 +552,7 @@ public bool Equals(VolumePerLength other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(VolumePerLength other, double tolerance, ComparisonType comparisonType) + public bool Equals(VolumePerLength other, double tolerance, ComparisonType comparisonType) { if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); @@ -566,7 +566,7 @@ public bool Equals(VolumePerLength other, double tolerance, ComparisonType compa /// /// Returns the hash code for this instance. /// - /// A hash code for the current VolumePerLength. + /// A hash code for the current . public override int GetHashCode() { return new { QuantityType, Value, Unit }.GetHashCode(); @@ -614,13 +614,13 @@ double IQuantity.As(Enum unit) } /// - /// Converts this VolumePerLength to another VolumePerLength with the unit representation . + /// Converts this to another with the unit representation . /// - /// A VolumePerLength with the specified unit. - public VolumePerLength ToUnit(VolumePerLengthUnit unit) + /// A with the specified unit. + public VolumePerLength ToUnit(VolumePerLengthUnit unit) { var convertedValue = GetValueAs(unit); - return new VolumePerLength(convertedValue, unit); + return new VolumePerLength(convertedValue, unit); } /// @@ -633,7 +633,7 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - public VolumePerLength ToUnit(UnitSystem unitSystem) + public VolumePerLength ToUnit(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -678,10 +678,10 @@ private double GetValueInBaseUnit() /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - internal VolumePerLength ToBaseUnit() + internal VolumePerLength ToBaseUnit() { var baseUnitValue = GetValueInBaseUnit(); - return new VolumePerLength(baseUnitValue, BaseUnit); + return new VolumePerLength(baseUnitValue, BaseUnit); } private double GetValueAs(VolumePerLengthUnit unit) @@ -792,7 +792,7 @@ TypeCode IConvertible.GetTypeCode() bool IConvertible.ToBoolean(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(VolumePerLength)} to bool is not supported."); + throw new InvalidCastException($"Converting {typeof(VolumePerLength)} to bool is not supported."); } byte IConvertible.ToByte(IFormatProvider provider) @@ -802,12 +802,12 @@ byte IConvertible.ToByte(IFormatProvider provider) char IConvertible.ToChar(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(VolumePerLength)} to char is not supported."); + throw new InvalidCastException($"Converting {typeof(VolumePerLength)} to char is not supported."); } DateTime IConvertible.ToDateTime(IFormatProvider provider) { - throw new InvalidCastException($"Converting {typeof(VolumePerLength)} to DateTime is not supported."); + throw new InvalidCastException($"Converting {typeof(VolumePerLength)} to DateTime is not supported."); } decimal IConvertible.ToDecimal(IFormatProvider provider) @@ -852,16 +852,16 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(VolumePerLength)) + if(conversionType == typeof(VolumePerLength)) return this; else if(conversionType == typeof(VolumePerLengthUnit)) return Unit; else if(conversionType == typeof(QuantityType)) - return VolumePerLength.QuantityType; + return VolumePerLength.QuantityType; else if(conversionType == typeof(BaseDimensions)) - return VolumePerLength.BaseDimensions; + return VolumePerLength.BaseDimensions; else - throw new InvalidCastException($"Converting {typeof(VolumePerLength)} to {conversionType} is not supported."); + throw new InvalidCastException($"Converting {typeof(VolumePerLength)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) From 37b04140c87428ec66cf345d47837d7b36ae8fa1 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 22 Oct 2019 10:59:25 -0400 Subject: [PATCH 07/13] Making extra classes generic --- .../Quantities/AmountOfSubstance.extra.cs | 32 ++++---- .../Quantities/AmplitudeRatio.extra.cs | 26 +++--- UnitsNet/CustomCode/Quantities/Angle.extra.cs | 14 ++-- UnitsNet/CustomCode/Quantities/Area.extra.cs | 26 +++--- .../Quantities/AreaMomentOfInertia.extra.cs | 8 +- .../BrakeSpecificFuelConsumption.extra.cs | 18 ++--- .../CustomCode/Quantities/Density.extra.cs | 56 ++++++------- .../CustomCode/Quantities/Duration.extra.cs | 58 +++++++------- .../Quantities/DynamicViscosity.extra.cs | 8 +- .../Quantities/ElectricPotential.extra.cs | 8 +- UnitsNet/CustomCode/Quantities/Force.extra.cs | 50 ++++++------ .../Quantities/ForcePerLength.extra.cs | 20 ++--- .../CustomCode/Quantities/HeatFlux.extra.cs | 8 +- .../Quantities/KinematicViscosity.extra.cs | 38 ++++----- .../CustomCode/Quantities/LapseRate.extra.cs | 18 ++--- .../CustomCode/Quantities/Length.extra.cs | 78 +++++++++--------- UnitsNet/CustomCode/Quantities/Level.extra.cs | 4 +- UnitsNet/CustomCode/Quantities/Mass.extra.cs | 56 ++++++------- .../Quantities/MassConcentration.extra.cs | 46 +++++------ .../CustomCode/Quantities/MassFlow.extra.cs | 68 ++++++++-------- .../CustomCode/Quantities/MassFlux.extra.cs | 20 ++--- .../Quantities/MassFraction.extra.cs | 34 ++++---- .../CustomCode/Quantities/Molarity.extra.cs | 56 ++++++------- UnitsNet/CustomCode/Quantities/Power.extra.cs | 80 +++++++++---------- .../CustomCode/Quantities/PowerRatio.extra.cs | 24 +++--- .../CustomCode/Quantities/Pressure.extra.cs | 26 +++--- .../Quantities/RotationalSpeed.extra.cs | 26 +++--- .../Quantities/RotationalStiffness.extra.cs | 20 ++--- .../RotationalStiffnessPerLength.extra.cs | 8 +- .../Quantities/SpecificEnergy.extra.cs | 30 +++---- .../Quantities/SpecificVolume.extra.cs | 14 ++-- .../Quantities/SpecificWeight.extra.cs | 32 ++++---- UnitsNet/CustomCode/Quantities/Speed.extra.cs | 62 +++++++------- .../Quantities/Temperature.extra.cs | 34 ++++---- .../Quantities/TemperatureDelta.extra.cs | 18 ++--- .../CustomCode/Quantities/Torque.extra.cs | 26 +++--- .../CustomCode/Quantities/Volume.extra.cs | 30 +++---- .../Quantities/VolumeConcentration.extra.cs | 32 ++++---- .../CustomCode/Quantities/VolumeFlow.extra.cs | 38 ++++----- 39 files changed, 625 insertions(+), 625 deletions(-) diff --git a/UnitsNet/CustomCode/Quantities/AmountOfSubstance.extra.cs b/UnitsNet/CustomCode/Quantities/AmountOfSubstance.extra.cs index 30693f48eb..2d2a555cae 100644 --- a/UnitsNet/CustomCode/Quantities/AmountOfSubstance.extra.cs +++ b/UnitsNet/CustomCode/Quantities/AmountOfSubstance.extra.cs @@ -7,7 +7,7 @@ namespace UnitsNet { - public partial struct AmountOfSubstance + public partial struct AmountOfSubstance { /// /// The Avogadro constant is the number of constituent particles, usually molecules, @@ -35,34 +35,34 @@ public double NumberOfParticles() } - /// Get from and a given . - public static AmountOfSubstance FromMass(Mass mass, MolarMass molarMass) + /// Get from and a given . + public static AmountOfSubstance FromMass(Mass mass, MolarMass molarMass ) { return mass / molarMass; } - - /// Get from for a given . - public static Mass operator *(AmountOfSubstance amountOfSubstance, MolarMass molarMass) + + /// Get from for a given . + public static Mass operator *(AmountOfSubstance amountOfSubstance, MolarMass molarMass ) { - return Mass.FromGrams(amountOfSubstance.Moles * molarMass.GramsPerMole); + return Mass.FromGrams(amountOfSubstance.Moles * molarMass.GramsPerMole); } - /// Get from for a given . - public static Mass operator *(MolarMass molarMass, AmountOfSubstance amountOfSubstance) + /// Get from for a given . + public static Mass operator *(MolarMass molarMass, AmountOfSubstance amountOfSubstance ) { - return Mass.FromGrams(amountOfSubstance.Moles * molarMass.GramsPerMole); + return Mass.FromGrams(amountOfSubstance.Moles * molarMass.GramsPerMole); } - /// Get from divided by . - public static Molarity operator /(AmountOfSubstance amountOfComponent, Volume mixtureVolume) + /// Get from divided by . + public static Molarity operator /(AmountOfSubstance amountOfComponent, Volume mixtureVolume ) { - return Molarity.FromMolesPerCubicMeter(amountOfComponent.Moles / mixtureVolume.CubicMeters); + return Molarity.FromMolesPerCubicMeter(amountOfComponent.Moles / mixtureVolume.CubicMeters); } - /// Get from divided by . - public static Volume operator /(AmountOfSubstance amountOfSubstance, Molarity molarity) + /// Get from divided by . + public static Volume operator /(AmountOfSubstance amountOfSubstance, Molarity molarity ) { - return Volume.FromCubicMeters(amountOfSubstance.Moles / molarity.MolesPerCubicMeter); + return Volume.FromCubicMeters(amountOfSubstance.Moles / molarity.MolesPerCubicMeter); } } diff --git a/UnitsNet/CustomCode/Quantities/AmplitudeRatio.extra.cs b/UnitsNet/CustomCode/Quantities/AmplitudeRatio.extra.cs index cc0a3cfcdf..55bc926724 100644 --- a/UnitsNet/CustomCode/Quantities/AmplitudeRatio.extra.cs +++ b/UnitsNet/CustomCode/Quantities/AmplitudeRatio.extra.cs @@ -6,16 +6,16 @@ namespace UnitsNet { - public partial struct AmplitudeRatio + public partial struct AmplitudeRatio { /// - /// Initializes a new instance of the struct from the specified electric potential + /// Initializes a new instance of the struct from the specified electric potential /// referenced to one volt RMS. This assumes both the specified electric potential and the one volt reference have the /// same /// resistance. /// /// The electric potential referenced to one volt. - public AmplitudeRatio(ElectricPotential voltage) + public AmplitudeRatio(ElectricPotential voltage ) : this() { if (voltage.Volts <= 0) @@ -29,7 +29,7 @@ public AmplitudeRatio(ElectricPotential voltage) } /// - /// Gets an from this . + /// Gets an from this . /// /// /// Provides a nicer syntax for converting an amplitude ratio back to a voltage. @@ -37,33 +37,33 @@ public AmplitudeRatio(ElectricPotential voltage) /// var voltage = voltageRatio.ToElectricPotential(); /// /// - public ElectricPotential ToElectricPotential() + public ElectricPotential ToElectricPotential() { // E(V) = 1V * 10^(E(dBV)/20) - return ElectricPotential.FromVolts( Math.Pow( 10, DecibelVolts / 20 ) ); + return ElectricPotential.FromVolts( Math.Pow( 10, DecibelVolts / 20 ) ); } /// - /// Converts this to a . + /// Converts this to a . /// /// The input impedance of the load. This is usually 50, 75 or 600 ohms. /// http://www.maximintegrated.com/en/app-notes/index.mvp/id/808 - public PowerRatio ToPowerRatio( ElectricResistance impedance ) + public PowerRatio ToPowerRatio( ElectricResistance impedance ) { // P(dBW) = E(dBV) - 10*log10(Z(Ω)/1) - return PowerRatio.FromDecibelWatts( DecibelVolts - 10 * Math.Log10( impedance.Ohms / 1 ) ); + return PowerRatio.FromDecibelWatts( DecibelVolts - 10 * Math.Log10( impedance.Ohms / 1 ) ); } #region Static Methods /// - /// Gets an in decibels (dB) relative to 1 volt RMS from an - /// . + /// Gets an in decibels (dB) relative to 1 volt RMS from an + /// . /// /// The voltage (electric potential) relative to one volt RMS. - public static AmplitudeRatio FromElectricPotential(ElectricPotential voltage) + public static AmplitudeRatio FromElectricPotential(ElectricPotential voltage ) { - return new AmplitudeRatio(voltage); + return new AmplitudeRatio( voltage); } #endregion diff --git a/UnitsNet/CustomCode/Quantities/Angle.extra.cs b/UnitsNet/CustomCode/Quantities/Angle.extra.cs index 59318915c4..4ee5eba580 100644 --- a/UnitsNet/CustomCode/Quantities/Angle.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Angle.extra.cs @@ -5,18 +5,18 @@ namespace UnitsNet { - public partial struct Angle + public partial struct Angle { - /// Get from delta over time delta. - public static RotationalSpeed operator /(Angle angle, TimeSpan timeSpan) + /// Get from delta over time delta. + public static RotationalSpeed operator /(Angle angle, TimeSpan timeSpan ) { - return RotationalSpeed.FromRadiansPerSecond(angle.Radians / timeSpan.TotalSeconds); + return RotationalSpeed.FromRadiansPerSecond(angle.Radians / timeSpan.TotalSeconds); } - /// - public static RotationalSpeed operator /(Angle angle, Duration duration) + /// + public static RotationalSpeed operator /(Angle angle, Duration duration ) { - return RotationalSpeed.FromRadiansPerSecond(angle.Radians / duration.Seconds); + return RotationalSpeed.FromRadiansPerSecond(angle.Radians / duration.Seconds); } } } diff --git a/UnitsNet/CustomCode/Quantities/Area.extra.cs b/UnitsNet/CustomCode/Quantities/Area.extra.cs index a4c005015c..b4707122e7 100644 --- a/UnitsNet/CustomCode/Quantities/Area.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Area.extra.cs @@ -5,41 +5,41 @@ namespace UnitsNet { - public partial struct Area + public partial struct Area { #region Static Methods /// Get circle area from a diameter. - public static Area FromCircleDiameter(Length diameter) + public static Area FromCircleDiameter(Length diameter ) { - var radius = Length.FromMeters(diameter.Meters / 2d); + var radius = Length.FromMeters(diameter.Meters / 2d); return FromCircleRadius(radius); } /// Get circle area from a radius. - public static Area FromCircleRadius(Length radius) + public static Area FromCircleRadius(Length radius ) { return FromSquareMeters(Math.PI * radius.Meters * radius.Meters); } #endregion - /// Get from divided by . - public static Length operator /(Area area, Length length) + /// Get from divided by . + public static Length operator /(Area area, Length length ) { - return Length.FromMeters(area.SquareMeters / length.Meters); + return Length.FromMeters(area.SquareMeters / length.Meters); } - /// Get from times . - public static MassFlow operator *(Area area, MassFlux massFlux) + /// Get from times . + public static MassFlow operator *(Area area, MassFlux massFlux ) { - return MassFlow.FromGramsPerSecond(area.SquareMeters * massFlux.GramsPerSecondPerSquareMeter); + return MassFlow.FromGramsPerSecond(area.SquareMeters * massFlux.GramsPerSecondPerSquareMeter); } - /// Get from times . - public static VolumeFlow operator *(Area area, Speed speed) + /// Get from times . + public static VolumeFlow operator *(Area area, Speed speed ) { - return VolumeFlow.FromCubicMetersPerSecond(area.SquareMeters * speed.MetersPerSecond); + return VolumeFlow.FromCubicMetersPerSecond(area.SquareMeters * speed.MetersPerSecond); } } } diff --git a/UnitsNet/CustomCode/Quantities/AreaMomentOfInertia.extra.cs b/UnitsNet/CustomCode/Quantities/AreaMomentOfInertia.extra.cs index 6afa77213e..213125a490 100644 --- a/UnitsNet/CustomCode/Quantities/AreaMomentOfInertia.extra.cs +++ b/UnitsNet/CustomCode/Quantities/AreaMomentOfInertia.extra.cs @@ -5,12 +5,12 @@ namespace UnitsNet { - public partial struct AreaMomentOfInertia + public partial struct AreaMomentOfInertia { - /// Get from divided by . - public static Volume operator /(AreaMomentOfInertia areaMomentOfInertia, Length length) + /// Get from divided by . + public static Volume operator /(AreaMomentOfInertia areaMomentOfInertia, Length length ) { - return Volume.FromCubicMeters(areaMomentOfInertia.MetersToTheFourth / length.Meters); + return Volume.FromCubicMeters(areaMomentOfInertia.MetersToTheFourth / length.Meters); } } } diff --git a/UnitsNet/CustomCode/Quantities/BrakeSpecificFuelConsumption.extra.cs b/UnitsNet/CustomCode/Quantities/BrakeSpecificFuelConsumption.extra.cs index 5bd29a877a..e94543ee3e 100644 --- a/UnitsNet/CustomCode/Quantities/BrakeSpecificFuelConsumption.extra.cs +++ b/UnitsNet/CustomCode/Quantities/BrakeSpecificFuelConsumption.extra.cs @@ -3,22 +3,22 @@ namespace UnitsNet { - public partial struct BrakeSpecificFuelConsumption + public partial struct BrakeSpecificFuelConsumption { - /// Get from times . - public static MassFlow operator *(BrakeSpecificFuelConsumption bsfc, Power power) + /// Get from times . + public static MassFlow operator *(BrakeSpecificFuelConsumption bsfc, Power power ) { - return MassFlow.FromKilogramsPerSecond(bsfc.KilogramsPerJoule*power.Watts); + return MassFlow.FromKilogramsPerSecond(bsfc.KilogramsPerJoule*power.Watts); } - /// Get from divided by . - public static SpecificEnergy operator /(double value, BrakeSpecificFuelConsumption bsfc) + /// Get from divided by . + public static SpecificEnergy operator /(double value, BrakeSpecificFuelConsumption bsfc ) { - return SpecificEnergy.FromJoulesPerKilogram(value/bsfc.KilogramsPerJoule); + return SpecificEnergy.FromJoulesPerKilogram(value/bsfc.KilogramsPerJoule); } - /// Get constant from times . - public static double operator *(BrakeSpecificFuelConsumption bsfc, SpecificEnergy specificEnergy) + /// Get constant from times . + public static double operator *(BrakeSpecificFuelConsumption bsfc, SpecificEnergy specificEnergy ) { return specificEnergy.JoulesPerKilogram*bsfc.KilogramsPerJoule; } diff --git a/UnitsNet/CustomCode/Quantities/Density.extra.cs b/UnitsNet/CustomCode/Quantities/Density.extra.cs index e569cefac5..7795ce8242 100644 --- a/UnitsNet/CustomCode/Quantities/Density.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Density.extra.cs @@ -6,69 +6,69 @@ namespace UnitsNet { - public partial struct Density + public partial struct Density { /// - /// Gets from this . + /// Gets from this . /// /// - /// + /// [Obsolete("This method is deprecated in favor of MassConcentration.ToMolarity(MolarMass).")] - public Molarity ToMolarity(Mass molecularWeight) + public Molarity ToMolarity(Mass molecularWeight ) { - return Molarity.FromMolesPerCubicMeter(KilogramsPerCubicMeter / molecularWeight.Kilograms); + return Molarity.FromMolesPerCubicMeter(KilogramsPerCubicMeter / molecularWeight.Kilograms); } #region Static Methods /// - /// Get from . + /// Get from . /// - /// + /// [Obsolete("This method is deprecated in favor of MassConcentration.FromMolarity(Molarity, MolarMass).")] - public static Density FromMolarity(Molarity molarity, Mass molecularWeight) + public static Density FromMolarity(Molarity molarity, Mass molecularWeight ) { - return new Density(molarity.MolesPerCubicMeter * molecularWeight.Kilograms, DensityUnit.KilogramPerCubicMeter); + return new Density( molarity.MolesPerCubicMeter * molecularWeight.Kilograms, DensityUnit.KilogramPerCubicMeter); } #endregion - /// Get from times . - public static Mass operator *(Density density, Volume volume) + /// Get from times . + public static Mass operator *(Density density, Volume volume ) { - return Mass.FromKilograms(density.KilogramsPerCubicMeter * volume.CubicMeters); + return Mass.FromKilograms(density.KilogramsPerCubicMeter * volume.CubicMeters); } - /// Get from times . - public static Mass operator *(Volume volume, Density density) + /// Get from times . + public static Mass operator *(Volume volume, Density density ) { - return Mass.FromKilograms(density.KilogramsPerCubicMeter * volume.CubicMeters); + return Mass.FromKilograms(density.KilogramsPerCubicMeter * volume.CubicMeters); } - /// Get from times . - public static DynamicViscosity operator *(Density density, KinematicViscosity kinematicViscosity) + /// Get from times . + public static DynamicViscosity operator *(Density density, KinematicViscosity kinematicViscosity ) { - return DynamicViscosity.FromNewtonSecondsPerMeterSquared(kinematicViscosity.SquareMetersPerSecond * density.KilogramsPerCubicMeter); + return DynamicViscosity.FromNewtonSecondsPerMeterSquared(kinematicViscosity.SquareMetersPerSecond * density.KilogramsPerCubicMeter); } - /// Get times . - public static MassFlux operator *(Density density, Speed speed) + /// Get times . + public static MassFlux operator *(Density density, Speed speed ) { - return MassFlux.FromKilogramsPerSecondPerSquareMeter(density.KilogramsPerCubicMeter * speed.MetersPerSecond); + return MassFlux.FromKilogramsPerSecondPerSquareMeter(density.KilogramsPerCubicMeter * speed.MetersPerSecond); } - /// Get from times . - public static SpecificWeight operator *(Density density, Acceleration acceleration) + /// Get from times . + public static SpecificWeight operator *(Density density, Acceleration acceleration ) { - return new SpecificWeight(density.KilogramsPerCubicMeter * acceleration.MetersPerSecondSquared, SpecificWeightUnit.NewtonPerCubicMeter); + return new SpecificWeight( density.KilogramsPerCubicMeter * acceleration.MetersPerSecondSquared, SpecificWeightUnit.NewtonPerCubicMeter); } - /// Get from divided by . - /// + /// Get from divided by . + /// [Obsolete("This operator is deprecated in favor of MassConcentration.op_Division(MassConcentration, MolarMass).")] - public static Molarity operator /(Density density, Mass molecularWeight) + public static Molarity operator /(Density density, Mass molecularWeight ) { - return new Molarity(density.KilogramsPerCubicMeter / molecularWeight.Kilograms, MolarityUnit.MolesPerCubicMeter); + return new Molarity( density.KilogramsPerCubicMeter / molecularWeight.Kilograms, MolarityUnit.MolesPerCubicMeter); } } } diff --git a/UnitsNet/CustomCode/Quantities/Duration.extra.cs b/UnitsNet/CustomCode/Quantities/Duration.extra.cs index 61501525a0..5b1bded61f 100644 --- a/UnitsNet/CustomCode/Quantities/Duration.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Duration.extra.cs @@ -5,7 +5,7 @@ namespace UnitsNet { - public partial struct Duration + public partial struct Duration { /// /// Convert a Duration to a TimeSpan. @@ -16,86 +16,86 @@ public TimeSpan ToTimeSpan() { if( Seconds > TimeSpan.MaxValue.TotalSeconds || Seconds < TimeSpan.MinValue.TotalSeconds ) - throw new ArgumentOutOfRangeException( nameof( Duration ), "The duration is too large or small to fit in a TimeSpan" ); + throw new ArgumentOutOfRangeException( nameof( Duration ), "The duration is too large or small to fit in a TimeSpan" ); return TimeSpan.FromSeconds( Seconds ); } - /// Get from plus . - public static DateTime operator +(DateTime time, Duration duration) + /// Get from plus . + public static DateTime operator +(DateTime time, Duration duration ) { return time.AddSeconds(duration.Seconds); } - /// Get from minus . - public static DateTime operator -(DateTime time, Duration duration) + /// Get from minus . + public static DateTime operator -(DateTime time, Duration duration ) { return time.AddSeconds(-duration.Seconds); } - /// Explicitly cast to . - public static explicit operator TimeSpan(Duration duration) + /// Explicitly cast to . + public static explicit operator TimeSpan(Duration duration ) { return duration.ToTimeSpan(); } - /// Explicitly cast to . - public static explicit operator Duration(TimeSpan duration) + /// Explicitly cast to . + public static explicit operator Duration( TimeSpan duration) { return FromSeconds(duration.TotalSeconds); } - /// True if is less than . - public static bool operator <(Duration duration, TimeSpan timeSpan) + /// True if is less than . + public static bool operator <(Duration duration, TimeSpan timeSpan) { return duration.Seconds < timeSpan.TotalSeconds; } - /// True if is greater than . - public static bool operator >(Duration duration, TimeSpan timeSpan) + /// True if is greater than . + public static bool operator >(Duration duration, TimeSpan timeSpan) { return duration.Seconds > timeSpan.TotalSeconds; } - /// True if is less than or equal to . - public static bool operator <=(Duration duration, TimeSpan timeSpan) + /// True if is less than or equal to . + public static bool operator <=(Duration duration, TimeSpan timeSpan) { return duration.Seconds <= timeSpan.TotalSeconds; } - /// True if is greater than or equal to . - public static bool operator >=(Duration duration, TimeSpan timeSpan) + /// True if is greater than or equal to . + public static bool operator >=(Duration duration, TimeSpan timeSpan) { return duration.Seconds >= timeSpan.TotalSeconds; } - /// True if is less than . - public static bool operator <(TimeSpan timeSpan, Duration duration) + /// True if is less than . + public static bool operator <(TimeSpan timeSpan, Duration duration ) { return timeSpan.TotalSeconds < duration.Seconds; } - /// True if is greater than . - public static bool operator >(TimeSpan timeSpan, Duration duration) + /// True if is greater than . + public static bool operator >(TimeSpan timeSpan, Duration duration ) { return timeSpan.TotalSeconds > duration.Seconds; } - /// True if is less than or equal to . - public static bool operator <=(TimeSpan timeSpan, Duration duration) + /// True if is less than or equal to . + public static bool operator <=(TimeSpan timeSpan, Duration duration ) { return timeSpan.TotalSeconds <= duration.Seconds; } - /// True if is greater than or equal to . - public static bool operator >=(TimeSpan timeSpan, Duration duration) + /// True if is greater than or equal to . + public static bool operator >=(TimeSpan timeSpan, Duration duration ) { return timeSpan.TotalSeconds >= duration.Seconds; } - /// Get from times . - public static Volume operator *(Duration duration, VolumeFlow volumeFlow) + /// Get from times . + public static Volume operator *(Duration duration, VolumeFlow volumeFlow ) { - return Volume.FromCubicMeters(volumeFlow.CubicMetersPerSecond * duration.Seconds); + return Volume.FromCubicMeters(volumeFlow.CubicMetersPerSecond * duration.Seconds); } } } diff --git a/UnitsNet/CustomCode/Quantities/DynamicViscosity.extra.cs b/UnitsNet/CustomCode/Quantities/DynamicViscosity.extra.cs index e99348a111..ed89a3ac20 100644 --- a/UnitsNet/CustomCode/Quantities/DynamicViscosity.extra.cs +++ b/UnitsNet/CustomCode/Quantities/DynamicViscosity.extra.cs @@ -3,12 +3,12 @@ namespace UnitsNet { - public partial struct DynamicViscosity + public partial struct DynamicViscosity { - /// Get from divided by . - public static KinematicViscosity operator /(DynamicViscosity dynamicViscosity, Density density) + /// Get from divided by . + public static KinematicViscosity operator /(DynamicViscosity dynamicViscosity, Density density ) { - return KinematicViscosity.FromSquareMetersPerSecond(dynamicViscosity.NewtonSecondsPerMeterSquared / density.KilogramsPerCubicMeter); + return KinematicViscosity.FromSquareMetersPerSecond(dynamicViscosity.NewtonSecondsPerMeterSquared / density.KilogramsPerCubicMeter); } } } diff --git a/UnitsNet/CustomCode/Quantities/ElectricPotential.extra.cs b/UnitsNet/CustomCode/Quantities/ElectricPotential.extra.cs index 5a807c63c5..03b6267501 100644 --- a/UnitsNet/CustomCode/Quantities/ElectricPotential.extra.cs +++ b/UnitsNet/CustomCode/Quantities/ElectricPotential.extra.cs @@ -3,10 +3,10 @@ namespace UnitsNet { - public partial struct ElectricPotential + public partial struct ElectricPotential { /// - /// Gets an in decibels (dB) relative to 1 volt RMS from this . + /// Gets an in decibels (dB) relative to 1 volt RMS from this . /// /// /// Provides a nicer syntax for converting a voltage to an amplitude ratio (relative to 1 volt RMS). @@ -14,9 +14,9 @@ public partial struct ElectricPotential /// var voltageRatio = voltage.ToAmplitudeRatio(); /// /// - public AmplitudeRatio ToAmplitudeRatio() + public AmplitudeRatio ToAmplitudeRatio() { - return AmplitudeRatio.FromElectricPotential(this); + return AmplitudeRatio.FromElectricPotential(this); } } } diff --git a/UnitsNet/CustomCode/Quantities/Force.extra.cs b/UnitsNet/CustomCode/Quantities/Force.extra.cs index 1d9881edff..ec98adb856 100644 --- a/UnitsNet/CustomCode/Quantities/Force.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Force.extra.cs @@ -5,55 +5,55 @@ namespace UnitsNet { - public partial struct Force + public partial struct Force { - /// Get from divided by . - public static Force FromPressureByArea(Pressure p, Area area) + /// Get from divided by . + public static Force FromPressureByArea(Pressure p, Area area ) { double newtons = p.Pascals * area.SquareMeters; - return new Force(newtons, ForceUnit.Newton); + return new Force( newtons, ForceUnit.Newton); } - /// Get from times . - public static Force FromMassByAcceleration(Mass mass, Acceleration acceleration) + /// Get from times . + public static Force FromMassByAcceleration(Mass mass, Acceleration acceleration ) { - return new Force(mass.Kilograms * acceleration.MetersPerSecondSquared, ForceUnit.Newton); + return new Force( mass.Kilograms * acceleration.MetersPerSecondSquared, ForceUnit.Newton); } - /// Get from times . - public static Power operator *(Force force, Speed speed) + /// Get from times . + public static Power operator *(Force force, Speed speed ) { - return Power.FromWatts(force.Newtons * speed.MetersPerSecond); + return Power.FromWatts(force.Newtons * speed.MetersPerSecond); } - /// Get from times . - public static Power operator *(Speed speed, Force force) + /// Get from times . + public static Power operator *(Speed speed, Force force ) { - return Power.FromWatts(force.Newtons * speed.MetersPerSecond); + return Power.FromWatts(force.Newtons * speed.MetersPerSecond); } - /// Get from divided by . - public static Acceleration operator /(Force force, Mass mass) + /// Get from divided by . + public static Acceleration operator /(Force force, Mass mass ) { - return Acceleration.FromMetersPerSecondSquared(force.Newtons / mass.Kilograms); + return Acceleration.FromMetersPerSecondSquared(force.Newtons / mass.Kilograms); } - /// Get from divided by . - public static Mass operator /(Force force, Acceleration acceleration) + /// Get from divided by . + public static Mass operator /(Force force, Acceleration acceleration ) { - return Mass.FromKilograms(force.Newtons / acceleration.MetersPerSecondSquared); + return Mass.FromKilograms(force.Newtons / acceleration.MetersPerSecondSquared); } - /// Get from divided by . - public static Pressure operator /(Force force, Area area) + /// Get from divided by . + public static Pressure operator /(Force force, Area area ) { - return Pressure.FromPascals(force.Newtons / area.SquareMeters); + return Pressure.FromPascals(force.Newtons / area.SquareMeters); } - /// Get from divided by . - public static ForcePerLength operator /(Force force, Length length) + /// Get from divided by . + public static ForcePerLength operator /(Force force, Length length ) { - return ForcePerLength.FromNewtonsPerMeter(force.Newtons / length.Meters); + return ForcePerLength.FromNewtonsPerMeter(force.Newtons / length.Meters); } } } diff --git a/UnitsNet/CustomCode/Quantities/ForcePerLength.extra.cs b/UnitsNet/CustomCode/Quantities/ForcePerLength.extra.cs index 813190866f..de1f262424 100644 --- a/UnitsNet/CustomCode/Quantities/ForcePerLength.extra.cs +++ b/UnitsNet/CustomCode/Quantities/ForcePerLength.extra.cs @@ -3,24 +3,24 @@ namespace UnitsNet { - public partial struct ForcePerLength + public partial struct ForcePerLength { - /// Get from divided by . - public static Force operator *(ForcePerLength forcePerLength, Length length) + /// Get from divided by . + public static Force operator *(ForcePerLength forcePerLength, Length length ) { - return Force.FromNewtons(forcePerLength.NewtonsPerMeter * length.Meters); + return Force.FromNewtons(forcePerLength.NewtonsPerMeter * length.Meters); } - /// Get from divided by . - public static Length operator /(Force force, ForcePerLength forcePerLength) + /// Get from divided by . + public static Length operator /(Force force, ForcePerLength forcePerLength ) { - return Length.FromMeters(force.Newtons / forcePerLength.NewtonsPerMeter); + return Length.FromMeters(force.Newtons / forcePerLength.NewtonsPerMeter); } - /// Get from divided by . - public static Pressure operator /(ForcePerLength forcePerLength, Length length) + /// Get from divided by . + public static Pressure operator /(ForcePerLength forcePerLength, Length length ) { - return Pressure.FromNewtonsPerSquareMeter(forcePerLength.NewtonsPerMeter / length.Meters); + return Pressure.FromNewtonsPerSquareMeter(forcePerLength.NewtonsPerMeter / length.Meters); } } } diff --git a/UnitsNet/CustomCode/Quantities/HeatFlux.extra.cs b/UnitsNet/CustomCode/Quantities/HeatFlux.extra.cs index 395661fb1f..e5a33b51cf 100644 --- a/UnitsNet/CustomCode/Quantities/HeatFlux.extra.cs +++ b/UnitsNet/CustomCode/Quantities/HeatFlux.extra.cs @@ -3,12 +3,12 @@ namespace UnitsNet { - public partial struct HeatFlux + public partial struct HeatFlux { - /// Get from times . - public static Power operator *(HeatFlux heatFlux, Area area) + /// Get from times . + public static Power operator *(HeatFlux heatFlux, Area area ) { - return Power.FromWatts(heatFlux.WattsPerSquareMeter * area.SquareMeters); + return Power.FromWatts(heatFlux.WattsPerSquareMeter * area.SquareMeters); } } } diff --git a/UnitsNet/CustomCode/Quantities/KinematicViscosity.extra.cs b/UnitsNet/CustomCode/Quantities/KinematicViscosity.extra.cs index f43b75534c..a7b8f927c7 100644 --- a/UnitsNet/CustomCode/Quantities/KinematicViscosity.extra.cs +++ b/UnitsNet/CustomCode/Quantities/KinematicViscosity.extra.cs @@ -5,42 +5,42 @@ namespace UnitsNet { - public partial struct KinematicViscosity + public partial struct KinematicViscosity { - /// Get from divided by . - public static Speed operator /(KinematicViscosity kinematicViscosity, Length length) + /// Get from divided by . + public static Speed operator /(KinematicViscosity kinematicViscosity, Length length ) { - return Speed.FromMetersPerSecond(kinematicViscosity.SquareMetersPerSecond / length.Meters); + return Speed.FromMetersPerSecond(kinematicViscosity.SquareMetersPerSecond / length.Meters); } - /// Get from times . - public static Area operator *(KinematicViscosity kinematicViscosity, TimeSpan timeSpan) + /// Get from times . + public static Area operator *(KinematicViscosity kinematicViscosity, TimeSpan timeSpan) { - return Area.FromSquareMeters(kinematicViscosity.SquareMetersPerSecond * timeSpan.TotalSeconds); + return Area.FromSquareMeters(kinematicViscosity.SquareMetersPerSecond * timeSpan.TotalSeconds); } - /// Get from times . - public static Area operator *(TimeSpan timeSpan, KinematicViscosity kinematicViscosity) + /// Get from times . + public static Area operator *(TimeSpan timeSpan, KinematicViscosity kinematicViscosity ) { - return Area.FromSquareMeters(kinematicViscosity.SquareMetersPerSecond * timeSpan.TotalSeconds); + return Area.FromSquareMeters(kinematicViscosity.SquareMetersPerSecond * timeSpan.TotalSeconds); } - /// Get from times . - public static Area operator *(KinematicViscosity kinematicViscosity, Duration duration) + /// Get from times . + public static Area operator *(KinematicViscosity kinematicViscosity, Duration duration ) { - return Area.FromSquareMeters(kinematicViscosity.SquareMetersPerSecond * duration.Seconds); + return Area.FromSquareMeters(kinematicViscosity.SquareMetersPerSecond * duration.Seconds); } - /// Get from times . - public static Area operator *(Duration duration, KinematicViscosity kinematicViscosity) + /// Get from times . + public static Area operator *(Duration duration, KinematicViscosity kinematicViscosity ) { - return Area.FromSquareMeters(kinematicViscosity.SquareMetersPerSecond * duration.Seconds); + return Area.FromSquareMeters(kinematicViscosity.SquareMetersPerSecond * duration.Seconds); } - /// Get from times . - public static DynamicViscosity operator *(KinematicViscosity kinematicViscosity, Density density) + /// Get from times . + public static DynamicViscosity operator *(KinematicViscosity kinematicViscosity, Density density ) { - return DynamicViscosity.FromNewtonSecondsPerMeterSquared(kinematicViscosity.SquareMetersPerSecond * density.KilogramsPerCubicMeter); + return DynamicViscosity.FromNewtonSecondsPerMeterSquared(kinematicViscosity.SquareMetersPerSecond * density.KilogramsPerCubicMeter); } } } diff --git a/UnitsNet/CustomCode/Quantities/LapseRate.extra.cs b/UnitsNet/CustomCode/Quantities/LapseRate.extra.cs index 6f675602e0..34f77c4e9a 100644 --- a/UnitsNet/CustomCode/Quantities/LapseRate.extra.cs +++ b/UnitsNet/CustomCode/Quantities/LapseRate.extra.cs @@ -3,21 +3,21 @@ namespace UnitsNet { - public partial struct LapseRate + public partial struct LapseRate { - /// Get from divided by . - public static Length operator /(TemperatureDelta left, LapseRate right) + /// Get from divided by . + public static Length operator /(TemperatureDelta left, LapseRate right ) { - return Length.FromKilometers(left.Kelvins / right.DegreesCelciusPerKilometer); + return Length.FromKilometers(left.Kelvins / right.DegreesCelciusPerKilometer); } - /// Get from times . - public static TemperatureDelta operator *(Length left, LapseRate right) => right * left; + /// Get from times . + public static TemperatureDelta operator *(Length left, LapseRate right ) => right * left; - /// Get from times . - public static TemperatureDelta operator *(LapseRate left, Length right) + /// Get from times . + public static TemperatureDelta operator *(LapseRate left, Length right ) { - return TemperatureDelta.FromDegreesCelsius(left.DegreesCelciusPerKilometer * right.Kilometers); + return TemperatureDelta.FromDegreesCelsius(left.DegreesCelciusPerKilometer * right.Kilometers); } } } diff --git a/UnitsNet/CustomCode/Quantities/Length.extra.cs b/UnitsNet/CustomCode/Quantities/Length.extra.cs index 97f64c4805..71db6bcbe2 100644 --- a/UnitsNet/CustomCode/Quantities/Length.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Length.extra.cs @@ -10,7 +10,7 @@ namespace UnitsNet { - public partial struct Length + public partial struct Length { private const double InchesInOneFoot = 12; @@ -32,7 +32,7 @@ public FeetInches FeetInches /// /// Get length from combination of feet and inches. /// - public static Length FromFeetInches(double feet, double inches) + public static Length FromFeetInches(double feet, double inches) { return FromInches(InchesInOneFoot*feet + inches); } @@ -47,10 +47,10 @@ public static Length FromFeetInches(double feet, double inches) /// /// Optionally specify the culture format numbers and localize unit abbreviations. Defaults to thread's culture. /// Parsed length. - public static Length ParseFeetInches([NotNull] string str, IFormatProvider formatProvider = null) + public static Length ParseFeetInches([NotNull] string str, IFormatProvider formatProvider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); - if (!TryParseFeetInches(str, out Length result, formatProvider)) + if (!TryParseFeetInches(str, out Length result, formatProvider)) { // A bit lazy, but I didn't want to duplicate this edge case implementation just to get more narrow exception descriptions. throw new FormatException("Unable to parse feet and inches. Expected format \"2' 4\"\" or \"2 ft 4 in\". Whitespace is optional."); @@ -69,7 +69,7 @@ public static Length ParseFeetInches([NotNull] string str, IFormatProvider forma /// /// Parsed length. /// Optionally specify the culture format numbers and localize unit abbreviations. Defaults to thread's culture. - public static bool TryParseFeetInches([CanBeNull] string str, out Length result, IFormatProvider formatProvider = null) + public static bool TryParseFeetInches([CanBeNull] string str, out Length result, IFormatProvider formatProvider = null) { if (str == null) { @@ -98,8 +98,8 @@ public static bool TryParseFeetInches([CanBeNull] string str, out Length result, var feetGroup = match.Groups["feet"]; var inchesGroup = match.Groups["inches"]; - if (TryParse(feetGroup.Value, formatProvider, out Length feet) && - TryParse(inchesGroup.Value, formatProvider, out Length inches)) + if (TryParse(feetGroup.Value, formatProvider, out Length feet ) && + TryParse(inchesGroup.Value, formatProvider, out Length inches )) { result = feet + inches; @@ -113,70 +113,70 @@ public static bool TryParseFeetInches([CanBeNull] string str, out Length result, return false; } - /// Get from divided by . - public static Speed operator /(Length length, TimeSpan timeSpan) + /// Get from divided by . + public static Speed operator /(Length length, TimeSpan timeSpan) { - return Speed.FromMetersPerSecond(length.Meters/timeSpan.TotalSeconds); + return Speed.FromMetersPerSecond(length.Meters/timeSpan.TotalSeconds); } - /// Get from divided by . - public static Speed operator /(Length length, Duration duration) + /// Get from divided by . + public static Speed operator /(Length length, Duration duration ) { - return Speed.FromMetersPerSecond(length.Meters/duration.Seconds); + return Speed.FromMetersPerSecond(length.Meters/duration.Seconds); } - /// Get from divided by . - public static Duration operator /(Length length, Speed speed) + /// Get from divided by . + public static Duration operator /(Length length, Speed speed ) { - return Duration.FromSeconds(length.Meters/speed.MetersPerSecond); + return Duration.FromSeconds(length.Meters/speed.MetersPerSecond); } - /// Get from times . - public static Area operator *(Length length1, Length length2) + /// Get from times . + public static Area operator *(Length length1, Length length2 ) { - return Area.FromSquareMeters(length1.Meters*length2.Meters); + return Area.FromSquareMeters(length1.Meters*length2.Meters); } - /// Get from times . - public static Volume operator *(Area area, Length length) + /// Get from times . + public static Volume operator *(Area area, Length length ) { - return Volume.FromCubicMeters(area.SquareMeters*length.Meters); + return Volume.FromCubicMeters(area.SquareMeters*length.Meters); } - /// Get from times . - public static Volume operator *(Length length, Area area) + /// Get from times . + public static Volume operator *(Length length, Area area ) { - return Volume.FromCubicMeters(area.SquareMeters*length.Meters); + return Volume.FromCubicMeters(area.SquareMeters*length.Meters); } - /// Get from times . - public static Torque operator *(Force force, Length length) + /// Get from times . + public static Torque operator *(Force force, Length length ) { - return Torque.FromNewtonMeters(force.Newtons*length.Meters); + return Torque.FromNewtonMeters(force.Newtons*length.Meters); } - /// Get from times . - public static Torque operator *(Length length, Force force) + /// Get from times . + public static Torque operator *(Length length, Force force ) { - return Torque.FromNewtonMeters(force.Newtons*length.Meters); + return Torque.FromNewtonMeters(force.Newtons*length.Meters); } - /// Get from times . - public static KinematicViscosity operator *(Length length, Speed speed) + /// Get from times . + public static KinematicViscosity operator *(Length length, Speed speed ) { - return KinematicViscosity.FromSquareMetersPerSecond(length.Meters*speed.MetersPerSecond); + return KinematicViscosity.FromSquareMetersPerSecond(length.Meters*speed.MetersPerSecond); } - /// Get from times . - public static Pressure operator *(Length length, SpecificWeight specificWeight) + /// Get from times . + public static Pressure operator *(Length length, SpecificWeight specificWeight ) { - return new Pressure(length.Meters * specificWeight.NewtonsPerCubicMeter, PressureUnit.Pascal); + return new Pressure( length.Meters * specificWeight.NewtonsPerCubicMeter, PressureUnit.Pascal); } } /// - /// Representation of feet and inches, used to preserve the original values when constructing by - /// and later output them unaltered with . + /// Representation of feet and inches, used to preserve the original values when constructing by + /// and later output them unaltered with . /// public sealed class FeetInches { diff --git a/UnitsNet/CustomCode/Quantities/Level.extra.cs b/UnitsNet/CustomCode/Quantities/Level.extra.cs index a7b1a82825..5e8ed17fb9 100644 --- a/UnitsNet/CustomCode/Quantities/Level.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Level.extra.cs @@ -6,10 +6,10 @@ namespace UnitsNet { - public partial struct Level + public partial struct Level { /// - /// Initializes a new instance of the logarithmic struct which is the ratio of a quantity Q to a + /// Initializes a new instance of the logarithmic struct which is the ratio of a quantity Q to a /// reference value of that quantity Q0. /// /// The quantity. diff --git a/UnitsNet/CustomCode/Quantities/Mass.extra.cs b/UnitsNet/CustomCode/Quantities/Mass.extra.cs index 418adf58f8..8554caf873 100644 --- a/UnitsNet/CustomCode/Quantities/Mass.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Mass.extra.cs @@ -9,12 +9,12 @@ namespace UnitsNet { - public partial struct Mass + public partial struct Mass { - /// Get from of gravity. - public static Mass FromGravitationalForce(Force f) + /// Get from of gravity. + public static Mass FromGravitationalForce(Force f ) { - return new Mass(f.KilogramsForce, MassUnit.Kilogram); + return new Mass( f.KilogramsForce, MassUnit.Kilogram); } /// @@ -42,57 +42,57 @@ public StonePounds StonePounds /// /// Get Mass from combination of stone and pounds. /// - public static Mass FromStonePounds(double stone, double pounds) + public static Mass FromStonePounds(double stone, double pounds) { return FromPounds(StonesInOnePound*stone + pounds); } - /// Get from divided by . - public static MassFlow operator /(Mass mass, TimeSpan timeSpan) + /// Get from divided by . + public static MassFlow operator /(Mass mass, TimeSpan timeSpan) { - return MassFlow.FromKilogramsPerSecond(mass.Kilograms/timeSpan.TotalSeconds); + return MassFlow.FromKilogramsPerSecond(mass.Kilograms/timeSpan.TotalSeconds); } - /// Get from divided by . - public static MassFlow operator /(Mass mass, Duration duration) + /// Get from divided by . + public static MassFlow operator /(Mass mass, Duration duration ) { - return MassFlow.FromKilogramsPerSecond(mass.Kilograms/duration.Seconds); + return MassFlow.FromKilogramsPerSecond(mass.Kilograms/duration.Seconds); } - /// Get from divided by . - public static Density operator /(Mass mass, Volume volume) + /// Get from divided by . + public static Density operator /(Mass mass, Volume volume ) { - return Density.FromKilogramsPerCubicMeter(mass.Kilograms/volume.CubicMeters); + return Density.FromKilogramsPerCubicMeter(mass.Kilograms/volume.CubicMeters); } - /// Get from divided by . - public static Volume operator /(Mass mass, Density density) + /// Get from divided by . + public static Volume operator /(Mass mass, Density density ) { - return Volume.FromCubicMeters(mass.Kilograms / density.KilogramsPerCubicMeter); + return Volume.FromCubicMeters(mass.Kilograms / density.KilogramsPerCubicMeter); } - /// Get from divided by . - public static AmountOfSubstance operator /(Mass mass, MolarMass molarMass) + /// Get from divided by . + public static AmountOfSubstance operator /(Mass mass, MolarMass molarMass ) { - return AmountOfSubstance.FromMoles(mass.Kilograms / molarMass.KilogramsPerMole); + return AmountOfSubstance.FromMoles(mass.Kilograms / molarMass.KilogramsPerMole); } - /// Get from times . - public static Force operator *(Mass mass, Acceleration acceleration) + /// Get from times . + public static Force operator *(Mass mass, Acceleration acceleration ) { - return Force.FromNewtons(mass.Kilograms*acceleration.MetersPerSecondSquared); + return Force.FromNewtons(mass.Kilograms*acceleration.MetersPerSecondSquared); } - /// Get from times . - public static Force operator *(Acceleration acceleration, Mass mass) + /// Get from times . + public static Force operator *(Acceleration acceleration, Mass mass ) { - return Force.FromNewtons(mass.Kilograms*acceleration.MetersPerSecondSquared); + return Force.FromNewtons(mass.Kilograms*acceleration.MetersPerSecondSquared); } } /// - /// Representation of stone and pounds, used to preserve the original values when constructing by - /// and later output them unaltered with . + /// Representation of stone and pounds, used to preserve the original values when constructing by + /// and later output them unaltered with . /// public sealed class StonePounds { diff --git a/UnitsNet/CustomCode/Quantities/MassConcentration.extra.cs b/UnitsNet/CustomCode/Quantities/MassConcentration.extra.cs index edce6c4ee2..84ded33d69 100644 --- a/UnitsNet/CustomCode/Quantities/MassConcentration.extra.cs +++ b/UnitsNet/CustomCode/Quantities/MassConcentration.extra.cs @@ -5,23 +5,23 @@ namespace UnitsNet { - public partial struct MassConcentration + public partial struct MassConcentration { /// - /// Get from this using the known component . + /// Get from this using the known component . /// /// - public Molarity ToMolarity(MolarMass molecularWeight) + public Molarity ToMolarity(MolarMass molecularWeight ) { return this / molecularWeight; } /// - /// Get from this using the known component . + /// Get from this using the known component . /// /// /// - public VolumeConcentration ToVolumeConcentration(Density componentDensity) + public VolumeConcentration ToVolumeConcentration(Density componentDensity ) { return this / componentDensity; } @@ -30,17 +30,17 @@ public VolumeConcentration ToVolumeConcentration(Density componentDensity) #region Static Methods /// - /// Get from . + /// Get from . /// - public static MassConcentration FromMolarity(Molarity molarity, MolarMass mass) + public static MassConcentration FromMolarity(Molarity molarity, MolarMass mass ) { return molarity * mass; } /// - /// Get from and component . + /// Get from and component . /// - public static MassConcentration FromVolumeConcentration(VolumeConcentration volumeConcentration, Density componentDensity) + public static MassConcentration FromVolumeConcentration(VolumeConcentration volumeConcentration, Density componentDensity ) { return volumeConcentration * componentDensity; } @@ -48,29 +48,29 @@ public static MassConcentration FromVolumeConcentration(VolumeConcentration volu #endregion #region Operators - - /// Get from times . - public static Mass operator *(MassConcentration density, Volume volume) + + /// Get from times . + public static Mass operator *(MassConcentration density, Volume volume ) { - return Mass.FromKilograms(density.KilogramsPerCubicMeter * volume.CubicMeters); + return Mass.FromKilograms(density.KilogramsPerCubicMeter * volume.CubicMeters); } - /// Get from times . - public static Mass operator *(Volume volume, MassConcentration density) + /// Get from times . + public static Mass operator *(Volume volume, MassConcentration density ) { - return Mass.FromKilograms(density.KilogramsPerCubicMeter * volume.CubicMeters); + return Mass.FromKilograms(density.KilogramsPerCubicMeter * volume.CubicMeters); } - - /// Get from divided by the component's . - public static Molarity operator /(MassConcentration massConcentration, MolarMass componentMass) + + /// Get from divided by the component's . + public static Molarity operator /(MassConcentration massConcentration, MolarMass componentMass ) { - return Molarity.FromMolesPerCubicMeter(massConcentration.GramsPerCubicMeter / componentMass.GramsPerMole); + return Molarity.FromMolesPerCubicMeter(massConcentration.GramsPerCubicMeter / componentMass.GramsPerMole); } - /// Get from divided by the component's . - public static VolumeConcentration operator /(MassConcentration massConcentration, Density componentDensity) + /// Get from divided by the component's . + public static VolumeConcentration operator /(MassConcentration massConcentration, Density componentDensity ) { - return VolumeConcentration.FromDecimalFractions(massConcentration.KilogramsPerCubicMeter / componentDensity.KilogramsPerCubicMeter); + return VolumeConcentration.FromDecimalFractions(massConcentration.KilogramsPerCubicMeter / componentDensity.KilogramsPerCubicMeter); } #endregion diff --git a/UnitsNet/CustomCode/Quantities/MassFlow.extra.cs b/UnitsNet/CustomCode/Quantities/MassFlow.extra.cs index e60c5c75d8..dcbabc97bf 100644 --- a/UnitsNet/CustomCode/Quantities/MassFlow.extra.cs +++ b/UnitsNet/CustomCode/Quantities/MassFlow.extra.cs @@ -5,72 +5,72 @@ namespace UnitsNet { - public partial struct MassFlow + public partial struct MassFlow { - /// Get from times . - public static Mass operator *(MassFlow massFlow, TimeSpan time) + /// Get from times . + public static Mass operator *(MassFlow massFlow, TimeSpan time) { - return Mass.FromKilograms(massFlow.KilogramsPerSecond * time.TotalSeconds); + return Mass.FromKilograms(massFlow.KilogramsPerSecond * time.TotalSeconds); } - /// Get from times . - public static Mass operator *(TimeSpan time, MassFlow massFlow) + /// Get from times . + public static Mass operator *(TimeSpan time, MassFlow massFlow ) { - return Mass.FromKilograms(massFlow.KilogramsPerSecond * time.TotalSeconds); + return Mass.FromKilograms(massFlow.KilogramsPerSecond * time.TotalSeconds); } - /// Get from times . - public static Mass operator *(MassFlow massFlow, Duration duration) + /// Get from times . + public static Mass operator *(MassFlow massFlow, Duration duration ) { - return Mass.FromKilograms(massFlow.KilogramsPerSecond * duration.Seconds); + return Mass.FromKilograms(massFlow.KilogramsPerSecond * duration.Seconds); } - /// Get from times . - public static Mass operator *(Duration duration, MassFlow massFlow) + /// Get from times . + public static Mass operator *(Duration duration, MassFlow massFlow ) { - return Mass.FromKilograms(massFlow.KilogramsPerSecond * duration.Seconds); + return Mass.FromKilograms(massFlow.KilogramsPerSecond * duration.Seconds); } - /// Get from divided by . - public static Power operator /(MassFlow massFlow, BrakeSpecificFuelConsumption bsfc) + /// Get from divided by . + public static Power operator /(MassFlow massFlow, BrakeSpecificFuelConsumption bsfc ) { - return Power.FromWatts(massFlow.KilogramsPerSecond / bsfc.KilogramsPerJoule); + return Power.FromWatts(massFlow.KilogramsPerSecond / bsfc.KilogramsPerJoule); } - /// Get from divided by . - public static BrakeSpecificFuelConsumption operator /(MassFlow massFlow, Power power) + /// Get from divided by . + public static BrakeSpecificFuelConsumption operator /(MassFlow massFlow, Power power ) { - return BrakeSpecificFuelConsumption.FromKilogramsPerJoule(massFlow.KilogramsPerSecond / power.Watts); + return BrakeSpecificFuelConsumption.FromKilogramsPerJoule(massFlow.KilogramsPerSecond / power.Watts); } - /// Get from times . - public static Power operator *(MassFlow massFlow, SpecificEnergy specificEnergy) + /// Get from times . + public static Power operator *(MassFlow massFlow, SpecificEnergy specificEnergy ) { - return Power.FromWatts(massFlow.KilogramsPerSecond * specificEnergy.JoulesPerKilogram); + return Power.FromWatts(massFlow.KilogramsPerSecond * specificEnergy.JoulesPerKilogram); } - /// Get from divided by . - public static MassFlux operator /(MassFlow massFlow, Area area) + /// Get from divided by . + public static MassFlux operator /(MassFlow massFlow, Area area ) { - return MassFlux.FromKilogramsPerSecondPerSquareMeter(massFlow.KilogramsPerSecond / area.SquareMeters); + return MassFlux.FromKilogramsPerSecondPerSquareMeter(massFlow.KilogramsPerSecond / area.SquareMeters); } - /// Get from divided by . - public static Area operator /(MassFlow massFlow, MassFlux massFlux) + /// Get from divided by . + public static Area operator /(MassFlow massFlow, MassFlux massFlux ) { - return Area.FromSquareMeters(massFlow.KilogramsPerSecond / massFlux.KilogramsPerSecondPerSquareMeter); + return Area.FromSquareMeters(massFlow.KilogramsPerSecond / massFlux.KilogramsPerSecondPerSquareMeter); } - /// Get from divided by . - public static Density operator /(MassFlow massFlow, VolumeFlow volumeFlow) + /// Get from divided by . + public static Density operator /(MassFlow massFlow, VolumeFlow volumeFlow ) { - return Density.FromKilogramsPerCubicMeter(massFlow.KilogramsPerSecond / volumeFlow.CubicMetersPerSecond); + return Density.FromKilogramsPerCubicMeter(massFlow.KilogramsPerSecond / volumeFlow.CubicMetersPerSecond); } - /// Get from divided by . - public static VolumeFlow operator /(MassFlow massFlow, Density density) + /// Get from divided by . + public static VolumeFlow operator /(MassFlow massFlow, Density density ) { - return VolumeFlow.FromCubicMetersPerSecond(massFlow.KilogramsPerSecond / density.KilogramsPerCubicMeter); + return VolumeFlow.FromCubicMetersPerSecond(massFlow.KilogramsPerSecond / density.KilogramsPerCubicMeter); } } } diff --git a/UnitsNet/CustomCode/Quantities/MassFlux.extra.cs b/UnitsNet/CustomCode/Quantities/MassFlux.extra.cs index 654ce48a20..c005f050b3 100644 --- a/UnitsNet/CustomCode/Quantities/MassFlux.extra.cs +++ b/UnitsNet/CustomCode/Quantities/MassFlux.extra.cs @@ -3,24 +3,24 @@ namespace UnitsNet { - public partial struct MassFlux + public partial struct MassFlux { - /// Get from divided by . - public static Density operator /(MassFlux massFlux, Speed speed) + /// Get from divided by . + public static Density operator /(MassFlux massFlux, Speed speed ) { - return Density.FromKilogramsPerCubicMeter(massFlux.KilogramsPerSecondPerSquareMeter / speed.MetersPerSecond); + return Density.FromKilogramsPerCubicMeter(massFlux.KilogramsPerSecondPerSquareMeter / speed.MetersPerSecond); } - /// Get from divided by . - public static Speed operator /(MassFlux massFlux, Density density) + /// Get from divided by . + public static Speed operator /(MassFlux massFlux, Density density ) { - return Speed.FromMetersPerSecond(massFlux.KilogramsPerSecondPerSquareMeter / density.KilogramsPerCubicMeter); + return Speed.FromMetersPerSecond(massFlux.KilogramsPerSecondPerSquareMeter / density.KilogramsPerCubicMeter); } - /// Get from times . - public static MassFlow operator *(MassFlux massFlux, Area area) + /// Get from times . + public static MassFlow operator *(MassFlux massFlux, Area area ) { - return MassFlow.FromGramsPerSecond(massFlux.GramsPerSecondPerSquareMeter * area.SquareMeters); + return MassFlow.FromGramsPerSecond(massFlux.GramsPerSecondPerSquareMeter * area.SquareMeters); } } } diff --git a/UnitsNet/CustomCode/Quantities/MassFraction.extra.cs b/UnitsNet/CustomCode/Quantities/MassFraction.extra.cs index c685887214..9676ab5beb 100644 --- a/UnitsNet/CustomCode/Quantities/MassFraction.extra.cs +++ b/UnitsNet/CustomCode/Quantities/MassFraction.extra.cs @@ -2,24 +2,24 @@ namespace UnitsNet { - public partial struct MassFraction + public partial struct MassFraction { /// - /// Get the of the component by multiplying the of the mixture and this . + /// Get the of the component by multiplying the of the mixture and this . /// /// The total mass of the mixture /// The actual mass of the component involved in this mixture - public Mass GetComponentMass(Mass totalMass) + public Mass GetComponentMass(Mass totalMass ) { return totalMass * this; } /// - /// Get the total of the mixture by dividing the of the component by this + /// Get the total of the mixture by dividing the of the component by this /// /// The actual mass of the component involved in this mixture /// The total mass of the mixture - public Mass GetTotalMass(Mass componentMass) + public Mass GetTotalMass(Mass componentMass ) { return componentMass / this; } @@ -27,30 +27,30 @@ public Mass GetTotalMass(Mass componentMass) #region Static Methods /// - /// Get from a component and total mixture . + /// Get from a component and total mixture . /// - public static MassFraction FromMasses(Mass componentMass, Mass mixtureMass) + public static MassFraction FromMasses(Mass componentMass, Mass mixtureMass ) { - return new MassFraction(componentMass / mixtureMass, MassFractionUnit.DecimalFraction); + return new MassFraction( componentMass / mixtureMass, MassFractionUnit.DecimalFraction); } #endregion - /// Get from multiplied by a . - public static Mass operator *(MassFraction massFraction, Mass mass) + /// Get from multiplied by a . + public static Mass operator *(MassFraction massFraction, Mass mass ) { - return Mass.FromKilograms(massFraction.DecimalFractions * mass.Kilograms); + return Mass.FromKilograms(massFraction.DecimalFractions * mass.Kilograms); } - /// Get from multiplied by a . - public static Mass operator *(Mass mass, MassFraction massFraction) + /// Get from multiplied by a . + public static Mass operator *(Mass mass, MassFraction massFraction ) { - return Mass.FromKilograms(massFraction.DecimalFractions * mass.Kilograms); + return Mass.FromKilograms(massFraction.DecimalFractions * mass.Kilograms); } - /// Get the total by dividing the component by a . - public static Mass operator /(Mass mass, MassFraction massFraction) + /// Get the total by dividing the component by a . + public static Mass operator /(Mass mass, MassFraction massFraction ) { - return Mass.FromKilograms(mass.Kilograms / massFraction.DecimalFractions); + return Mass.FromKilograms(mass.Kilograms / massFraction.DecimalFractions); } } diff --git a/UnitsNet/CustomCode/Quantities/Molarity.extra.cs b/UnitsNet/CustomCode/Quantities/Molarity.extra.cs index 53af6eeb15..0a3d7fcc7f 100644 --- a/UnitsNet/CustomCode/Quantities/Molarity.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Molarity.extra.cs @@ -3,14 +3,14 @@ namespace UnitsNet { - public partial struct Molarity + public partial struct Molarity { /// - /// Construct from divided by . + /// Construct from divided by . /// - /// + /// [Obsolete("This constructor will be removed in favor of operator overload MassConcentration.op_Division(MassConcentration,MolarMass).")] - public Molarity(Density density, Mass molecularWeight) + public Molarity(Density density, Mass molecularWeight ) : this() { _value = density.KilogramsPerCubicMeter / molecularWeight.Kilograms; @@ -18,31 +18,31 @@ public Molarity(Density density, Mass molecularWeight) } /// - /// Get a from this . + /// Get a from this . /// /// - /// + /// [Obsolete("This method will be removed in favor of ToMassConcentration(MolarMass)")] - public Density ToDensity(Mass molecularWeight) + public Density ToDensity(Mass molecularWeight ) { - return Density.FromKilogramsPerCubicMeter(MolesPerCubicMeter * molecularWeight.Kilograms); + return Density.FromKilogramsPerCubicMeter(MolesPerCubicMeter * molecularWeight.Kilograms); } /// - /// Get a from this . + /// Get a from this . /// /// - public MassConcentration ToMassConcentration(MolarMass molecularWeight) + public MassConcentration ToMassConcentration(MolarMass molecularWeight ) { return this * molecularWeight; } /// - /// Get a from this . + /// Get a from this . /// /// /// - public VolumeConcentration ToVolumeConcentration(Density componentDensity, MolarMass componentMass) + public VolumeConcentration ToVolumeConcentration(Density componentDensity, MolarMass componentMass ) { return this * componentMass / componentDensity; } @@ -50,24 +50,24 @@ public VolumeConcentration ToVolumeConcentration(Density componentDensity, Molar #region Static Methods /// - /// Get from . + /// Get from . /// /// /// [Obsolete("Use MassConcentration / MolarMass operator overload instead.")] - public static Molarity FromDensity(Density density, Mass molecularWeight) + public static Molarity FromDensity(Density density, Mass molecularWeight ) { return density / molecularWeight; } /// - /// Get from and known component and . + /// Get from and known component and . /// /// /// /// /// - public static Molarity FromVolumeConcentration(VolumeConcentration volumeConcentration, Density componentDensity, MolarMass componentMass) + public static Molarity FromVolumeConcentration(VolumeConcentration volumeConcentration, Density componentDensity, MolarMass componentMass ) { return volumeConcentration * componentDensity / componentMass; } @@ -76,28 +76,28 @@ public static Molarity FromVolumeConcentration(VolumeConcentration volumeConcent #region Operators - /// Get from times the . - public static MassConcentration operator *(Molarity molarity, MolarMass componentMass) + /// Get from times the . + public static MassConcentration operator *(Molarity molarity, MolarMass componentMass ) { - return MassConcentration.FromGramsPerCubicMeter(molarity.MolesPerCubicMeter * componentMass.GramsPerMole); + return MassConcentration.FromGramsPerCubicMeter(molarity.MolesPerCubicMeter * componentMass.GramsPerMole); } - /// Get from times the . - public static MassConcentration operator *(MolarMass componentMass, Molarity molarity) + /// Get from times the . + public static MassConcentration operator *(MolarMass componentMass, Molarity molarity ) { - return MassConcentration.FromGramsPerCubicMeter(molarity.MolesPerCubicMeter * componentMass.GramsPerMole); + return MassConcentration.FromGramsPerCubicMeter(molarity.MolesPerCubicMeter * componentMass.GramsPerMole); } - /// Get from diluting the current by the given . - public static Molarity operator *(Molarity molarity, VolumeConcentration volumeConcentration) + /// Get from diluting the current by the given . + public static Molarity operator *(Molarity molarity, VolumeConcentration volumeConcentration ) { - return new Molarity(molarity.MolesPerCubicMeter * volumeConcentration.DecimalFractions, MolarityUnit.MolesPerCubicMeter); + return new Molarity( molarity.MolesPerCubicMeter * volumeConcentration.DecimalFractions, MolarityUnit.MolesPerCubicMeter); } - /// Get from diluting the current by the given . - public static Molarity operator *(VolumeConcentration volumeConcentration, Molarity molarity) + /// Get from diluting the current by the given . + public static Molarity operator *(VolumeConcentration volumeConcentration, Molarity molarity ) { - return new Molarity(molarity.MolesPerCubicMeter * volumeConcentration.DecimalFractions, MolarityUnit.MolesPerCubicMeter); + return new Molarity( molarity.MolesPerCubicMeter * volumeConcentration.DecimalFractions, MolarityUnit.MolesPerCubicMeter); } #endregion diff --git a/UnitsNet/CustomCode/Quantities/Power.extra.cs b/UnitsNet/CustomCode/Quantities/Power.extra.cs index 4b61a19b76..319b8502a1 100644 --- a/UnitsNet/CustomCode/Quantities/Power.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Power.extra.cs @@ -5,10 +5,10 @@ namespace UnitsNet { - public partial struct Power + public partial struct Power { /// - /// Gets a from this relative to one watt. + /// Gets a from this relative to one watt. /// /// /// Provides a nicer syntax for converting a power to a power ratio (relative to 1 watt). @@ -16,81 +16,81 @@ public partial struct Power /// var powerRatio = power.ToPowerRatio(); /// /// - public PowerRatio ToPowerRatio() + public PowerRatio ToPowerRatio() { - return PowerRatio.FromPower(this); + return PowerRatio.FromPower(this); } - /// Get from times . - public static Energy operator *(Power power, TimeSpan time) + /// Get from times . + public static Energy operator *(Power power, TimeSpan time) { - return Energy.FromJoules(power.Watts * time.TotalSeconds); + return Energy.FromJoules(power.Watts * time.TotalSeconds); } - /// Get from times . - public static Energy operator *(TimeSpan time, Power power) + /// Get from times . + public static Energy operator *(TimeSpan time, Power power ) { - return Energy.FromJoules(power.Watts * time.TotalSeconds); + return Energy.FromJoules(power.Watts * time.TotalSeconds); } - /// Get from times . - public static Energy operator *(Power power, Duration duration) + /// Get from times . + public static Energy operator *(Power power, Duration duration ) { - return Energy.FromJoules(power.Watts * duration.Seconds); + return Energy.FromJoules(power.Watts * duration.Seconds); } - /// Get from times . - public static Energy operator *(Duration duration, Power power) + /// Get from times . + public static Energy operator *(Duration duration, Power power ) { - return Energy.FromJoules(power.Watts * duration.Seconds); + return Energy.FromJoules(power.Watts * duration.Seconds); } - /// Get from divided by . - public static Force operator /(Power power, Speed speed) + /// Get from divided by . + public static Force operator /(Power power, Speed speed ) { - return Force.FromNewtons(power.Watts / speed.MetersPerSecond); + return Force.FromNewtons(power.Watts / speed.MetersPerSecond); } - /// Get from divided by . - public static Torque operator /(Power power, RotationalSpeed rotationalSpeed) + /// Get from divided by . + public static Torque operator /(Power power, RotationalSpeed rotationalSpeed ) { - return Torque.FromNewtonMeters(power.Watts / rotationalSpeed.RadiansPerSecond); + return Torque.FromNewtonMeters(power.Watts / rotationalSpeed.RadiansPerSecond); } - /// Get from divided by . - public static RotationalSpeed operator /(Power power, Torque torque) + /// Get from divided by . + public static RotationalSpeed operator /(Power power, Torque torque ) { - return RotationalSpeed.FromRadiansPerSecond(power.Watts / torque.NewtonMeters); + return RotationalSpeed.FromRadiansPerSecond(power.Watts / torque.NewtonMeters); } - /// Get from times . - public static MassFlow operator *(Power power, BrakeSpecificFuelConsumption bsfc) + /// Get from times . + public static MassFlow operator *(Power power, BrakeSpecificFuelConsumption bsfc ) { - return MassFlow.FromKilogramsPerSecond(bsfc.KilogramsPerJoule * power.Watts); + return MassFlow.FromKilogramsPerSecond(bsfc.KilogramsPerJoule * power.Watts); } - /// Get from divided by . - public static SpecificEnergy operator /(Power power, MassFlow massFlow) + /// Get from divided by . + public static SpecificEnergy operator /(Power power, MassFlow massFlow ) { - return SpecificEnergy.FromJoulesPerKilogram(power.Watts / massFlow.KilogramsPerSecond); + return SpecificEnergy.FromJoulesPerKilogram(power.Watts / massFlow.KilogramsPerSecond); } - /// Get from divided by . - public static MassFlow operator /(Power power, SpecificEnergy specificEnergy) + /// Get from divided by . + public static MassFlow operator /(Power power, SpecificEnergy specificEnergy ) { - return MassFlow.FromKilogramsPerSecond(power.Watts / specificEnergy.JoulesPerKilogram); + return MassFlow.FromKilogramsPerSecond(power.Watts / specificEnergy.JoulesPerKilogram); } - /// Get from divided by . - public static HeatFlux operator /(Power power, Area area) + /// Get from divided by . + public static HeatFlux operator /(Power power, Area area ) { - return HeatFlux.FromWattsPerSquareMeter(power.Watts / area.SquareMeters); + return HeatFlux.FromWattsPerSquareMeter(power.Watts / area.SquareMeters); } - /// Get from divided by . - public static Area operator /(Power power, HeatFlux heatFlux) + /// Get from divided by . + public static Area operator /(Power power, HeatFlux heatFlux ) { - return Area.FromSquareMeters( power.Watts / heatFlux.WattsPerSquareMeter ); + return Area.FromSquareMeters( power.Watts / heatFlux.WattsPerSquareMeter ); } } } diff --git a/UnitsNet/CustomCode/Quantities/PowerRatio.extra.cs b/UnitsNet/CustomCode/Quantities/PowerRatio.extra.cs index f563f720ae..a392c560d4 100644 --- a/UnitsNet/CustomCode/Quantities/PowerRatio.extra.cs +++ b/UnitsNet/CustomCode/Quantities/PowerRatio.extra.cs @@ -6,14 +6,14 @@ namespace UnitsNet { - public partial struct PowerRatio + public partial struct PowerRatio { /// - /// Initializes a new instance of the struct from the specified power referenced to one watt. + /// Initializes a new instance of the struct from the specified power referenced to one watt. /// /// The power relative to one watt. - public PowerRatio(Power power) + public PowerRatio(Power power ) : this() { if (power.Watts <= 0) @@ -26,7 +26,7 @@ public PowerRatio(Power power) } /// - /// Gets a from this (which is a power level relative to one watt). + /// Gets a from this (which is a power level relative to one watt). /// /// /// Provides a nicer syntax for converting a power ratio back to a power. @@ -34,31 +34,31 @@ public PowerRatio(Power power) /// var power = powerRatio.ToPower(); /// /// - public Power ToPower() + public Power ToPower() { // P(W) = 1W * 10^(P(dBW)/10) - return Power.FromWatts(Math.Pow(10, DecibelWatts / 10)); + return Power.FromWatts(Math.Pow(10, DecibelWatts / 10)); } /// - /// Gets a from this . + /// Gets a from this . /// /// The input impedance of the load. This is usually 50, 75 or 600 ohms. - public AmplitudeRatio ToAmplitudeRatio(ElectricResistance impedance) + public AmplitudeRatio ToAmplitudeRatio(ElectricResistance impedance ) { // E(dBV) = 10*log10(Z(Ω)/1) + P(dBW) - return AmplitudeRatio.FromDecibelVolts(10 * Math.Log10(impedance.Ohms / 1) + DecibelWatts); + return AmplitudeRatio.FromDecibelVolts(10 * Math.Log10(impedance.Ohms / 1) + DecibelWatts); } #region Static Methods /// - /// Gets a from a relative to one watt. + /// Gets a from a relative to one watt. /// /// The power relative to one watt. - public static PowerRatio FromPower(Power power) + public static PowerRatio FromPower(Power power ) { - return new PowerRatio(power); + return new PowerRatio( power); } #endregion diff --git a/UnitsNet/CustomCode/Quantities/Pressure.extra.cs b/UnitsNet/CustomCode/Quantities/Pressure.extra.cs index ecaf977ed6..652ff729b4 100644 --- a/UnitsNet/CustomCode/Quantities/Pressure.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Pressure.extra.cs @@ -3,30 +3,30 @@ namespace UnitsNet { - public partial struct Pressure + public partial struct Pressure { - /// Get from times . - public static Force operator *(Pressure pressure, Area area) + /// Get from times . + public static Force operator *(Pressure pressure, Area area ) { - return Force.FromNewtons(pressure.Pascals * area.SquareMeters); + return Force.FromNewtons(pressure.Pascals * area.SquareMeters); } - /// Get from times . - public static Force operator *(Area area, Pressure pressure) + /// Get from times . + public static Force operator *(Area area, Pressure pressure ) { - return Force.FromNewtons(pressure.Pascals * area.SquareMeters); + return Force.FromNewtons(pressure.Pascals * area.SquareMeters); } - /// Get from divided by . - public static Length operator /(Pressure pressure, SpecificWeight specificWeight) + /// Get from divided by . + public static Length operator /(Pressure pressure, SpecificWeight specificWeight ) { - return new Length(pressure.Pascals / specificWeight.NewtonsPerCubicMeter, UnitsNet.Units.LengthUnit.Meter); + return new Length( pressure.Pascals / specificWeight.NewtonsPerCubicMeter, UnitsNet.Units.LengthUnit.Meter); } - /// Get from divided by . - public static SpecificWeight operator /(Pressure pressure, Length length) + /// Get from divided by . + public static SpecificWeight operator /(Pressure pressure, Length length ) { - return new SpecificWeight(pressure.Pascals / length.Meters, UnitsNet.Units.SpecificWeightUnit.NewtonPerCubicMeter); + return new SpecificWeight( pressure.Pascals / length.Meters, UnitsNet.Units.SpecificWeightUnit.NewtonPerCubicMeter); } } } diff --git a/UnitsNet/CustomCode/Quantities/RotationalSpeed.extra.cs b/UnitsNet/CustomCode/Quantities/RotationalSpeed.extra.cs index a1f18c79cd..b6f6d326a4 100644 --- a/UnitsNet/CustomCode/Quantities/RotationalSpeed.extra.cs +++ b/UnitsNet/CustomCode/Quantities/RotationalSpeed.extra.cs @@ -5,30 +5,30 @@ namespace UnitsNet { - public partial struct RotationalSpeed + public partial struct RotationalSpeed { - /// Get from times . - public static Angle operator *(RotationalSpeed rotationalSpeed, TimeSpan timeSpan) + /// Get from times . + public static Angle operator *(RotationalSpeed rotationalSpeed, TimeSpan timeSpan ) { - return Angle.FromRadians(rotationalSpeed.RadiansPerSecond * timeSpan.TotalSeconds); + return Angle.FromRadians(rotationalSpeed.RadiansPerSecond * timeSpan.TotalSeconds); } - /// Get from times . - public static Angle operator *(TimeSpan timeSpan, RotationalSpeed rotationalSpeed) + /// Get from times . + public static Angle operator *(TimeSpan timeSpan, RotationalSpeed rotationalSpeed ) { - return Angle.FromRadians(rotationalSpeed.RadiansPerSecond * timeSpan.TotalSeconds); + return Angle.FromRadians(rotationalSpeed.RadiansPerSecond * timeSpan.TotalSeconds); } - /// Get from times . - public static Angle operator *(RotationalSpeed rotationalSpeed, Duration duration) + /// Get from times . + public static Angle operator *(RotationalSpeed rotationalSpeed, Duration duration ) { - return Angle.FromRadians(rotationalSpeed.RadiansPerSecond * duration.Seconds); + return Angle.FromRadians(rotationalSpeed.RadiansPerSecond * duration.Seconds); } - /// Get from times . - public static Angle operator *(Duration duration, RotationalSpeed rotationalSpeed) + /// Get from times . + public static Angle operator *(Duration duration, RotationalSpeed rotationalSpeed ) { - return Angle.FromRadians(rotationalSpeed.RadiansPerSecond * duration.Seconds); + return Angle.FromRadians(rotationalSpeed.RadiansPerSecond * duration.Seconds); } } } diff --git a/UnitsNet/CustomCode/Quantities/RotationalStiffness.extra.cs b/UnitsNet/CustomCode/Quantities/RotationalStiffness.extra.cs index 48b9342455..700d01030f 100644 --- a/UnitsNet/CustomCode/Quantities/RotationalStiffness.extra.cs +++ b/UnitsNet/CustomCode/Quantities/RotationalStiffness.extra.cs @@ -3,24 +3,24 @@ namespace UnitsNet { - public partial struct RotationalStiffness + public partial struct RotationalStiffness { - /// Get from times . - public static Torque operator *(RotationalStiffness rotationalStiffness, Angle angle) + /// Get from times . + public static Torque operator *(RotationalStiffness rotationalStiffness, Angle angle ) { - return Torque.FromNewtonMeters(rotationalStiffness.NewtonMetersPerRadian * angle.Radians); + return Torque.FromNewtonMeters(rotationalStiffness.NewtonMetersPerRadian * angle.Radians); } - /// Get from divided by . - public static RotationalStiffnessPerLength operator /(RotationalStiffness rotationalStiffness, Length length) + /// Get from divided by . + public static RotationalStiffnessPerLength operator /(RotationalStiffness rotationalStiffness, Length length ) { - return RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(rotationalStiffness.NewtonMetersPerRadian / length.Meters); + return RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(rotationalStiffness.NewtonMetersPerRadian / length.Meters); } - /// Get from divided by . - public static Length operator /(RotationalStiffness rotationalStiffness, RotationalStiffnessPerLength rotationalStiffnessPerLength) + /// Get from divided by . + public static Length operator /(RotationalStiffness rotationalStiffness, RotationalStiffnessPerLength rotationalStiffnessPerLength ) { - return Length.FromMeters(rotationalStiffness.NewtonMetersPerRadian / rotationalStiffnessPerLength.NewtonMetersPerRadianPerMeter); + return Length.FromMeters(rotationalStiffness.NewtonMetersPerRadian / rotationalStiffnessPerLength.NewtonMetersPerRadianPerMeter); } } } diff --git a/UnitsNet/CustomCode/Quantities/RotationalStiffnessPerLength.extra.cs b/UnitsNet/CustomCode/Quantities/RotationalStiffnessPerLength.extra.cs index 1aef772c05..693146a611 100644 --- a/UnitsNet/CustomCode/Quantities/RotationalStiffnessPerLength.extra.cs +++ b/UnitsNet/CustomCode/Quantities/RotationalStiffnessPerLength.extra.cs @@ -4,12 +4,12 @@ // ReSharper disable once CheckNamespace namespace UnitsNet { - public partial struct RotationalStiffnessPerLength + public partial struct RotationalStiffnessPerLength { - /// Get from times . - public static RotationalStiffness operator *(RotationalStiffnessPerLength rotationalStiffness, Length length) + /// Get from times . + public static RotationalStiffness operator *(RotationalStiffnessPerLength rotationalStiffness, Length length ) { - return RotationalStiffness.FromNewtonMetersPerRadian(rotationalStiffness.NewtonMetersPerRadianPerMeter * length.Meters); + return RotationalStiffness.FromNewtonMetersPerRadian(rotationalStiffness.NewtonMetersPerRadianPerMeter * length.Meters); } } } diff --git a/UnitsNet/CustomCode/Quantities/SpecificEnergy.extra.cs b/UnitsNet/CustomCode/Quantities/SpecificEnergy.extra.cs index 45f4473f80..be370c6f37 100644 --- a/UnitsNet/CustomCode/Quantities/SpecificEnergy.extra.cs +++ b/UnitsNet/CustomCode/Quantities/SpecificEnergy.extra.cs @@ -3,36 +3,36 @@ namespace UnitsNet { - public partial struct SpecificEnergy + public partial struct SpecificEnergy { - /// Get from times . - public static Energy operator *(SpecificEnergy specificEnergy, Mass mass) + /// Get from times . + public static Energy operator *(SpecificEnergy specificEnergy, Mass mass ) { - return Energy.FromJoules(specificEnergy.JoulesPerKilogram * mass.Kilograms); + return Energy.FromJoules(specificEnergy.JoulesPerKilogram * mass.Kilograms); } - /// Get from times . - public static Energy operator *(Mass mass, SpecificEnergy specificEnergy) + /// Get from times . + public static Energy operator *(Mass mass, SpecificEnergy specificEnergy ) { - return Energy.FromJoules(specificEnergy.JoulesPerKilogram * mass.Kilograms); + return Energy.FromJoules(specificEnergy.JoulesPerKilogram * mass.Kilograms); } - /// Get from divided by . - public static BrakeSpecificFuelConsumption operator /(double value, SpecificEnergy specificEnergy) + /// Get from divided by . + public static BrakeSpecificFuelConsumption operator /(double value, SpecificEnergy specificEnergy ) { - return BrakeSpecificFuelConsumption.FromKilogramsPerJoule(value / specificEnergy.JoulesPerKilogram); + return BrakeSpecificFuelConsumption.FromKilogramsPerJoule(value / specificEnergy.JoulesPerKilogram); } - /// Get from times . - public static double operator *(SpecificEnergy specificEnergy, BrakeSpecificFuelConsumption bsfc) + /// Get from times . + public static double operator *(SpecificEnergy specificEnergy, BrakeSpecificFuelConsumption bsfc ) { return specificEnergy.JoulesPerKilogram * bsfc.KilogramsPerJoule; } - /// Get from times . - public static Power operator *(SpecificEnergy specificEnergy, MassFlow massFlow) + /// Get from times . + public static Power operator *(SpecificEnergy specificEnergy, MassFlow massFlow ) { - return Power.FromWatts(massFlow.KilogramsPerSecond * specificEnergy.JoulesPerKilogram); + return Power.FromWatts(massFlow.KilogramsPerSecond * specificEnergy.JoulesPerKilogram); } } } diff --git a/UnitsNet/CustomCode/Quantities/SpecificVolume.extra.cs b/UnitsNet/CustomCode/Quantities/SpecificVolume.extra.cs index f284f8bb28..3bd2be1ddb 100644 --- a/UnitsNet/CustomCode/Quantities/SpecificVolume.extra.cs +++ b/UnitsNet/CustomCode/Quantities/SpecificVolume.extra.cs @@ -3,18 +3,18 @@ namespace UnitsNet { - public partial struct SpecificVolume + public partial struct SpecificVolume { - /// Get from divided by . - public static Density operator /(double constant, SpecificVolume volume) + /// Get from divided by . + public static Density operator /(double constant, SpecificVolume volume ) { - return Density.FromKilogramsPerCubicMeter(constant / volume.CubicMetersPerKilogram); + return Density.FromKilogramsPerCubicMeter(constant / volume.CubicMetersPerKilogram); } - /// Get from times . - public static Volume operator *(SpecificVolume volume, Mass mass) + /// Get from times . + public static Volume operator *(SpecificVolume volume, Mass mass ) { - return Volume.FromCubicMeters(volume.CubicMetersPerKilogram * mass.Kilograms); + return Volume.FromCubicMeters(volume.CubicMetersPerKilogram * mass.Kilograms); } } } diff --git a/UnitsNet/CustomCode/Quantities/SpecificWeight.extra.cs b/UnitsNet/CustomCode/Quantities/SpecificWeight.extra.cs index 85f4f8bae1..4f9a999533 100644 --- a/UnitsNet/CustomCode/Quantities/SpecificWeight.extra.cs +++ b/UnitsNet/CustomCode/Quantities/SpecificWeight.extra.cs @@ -5,36 +5,36 @@ namespace UnitsNet { - public partial struct SpecificWeight + public partial struct SpecificWeight { - /// Get from times . - public static Pressure operator *(SpecificWeight specificWeight, Length length) + /// Get from times . + public static Pressure operator *(SpecificWeight specificWeight, Length length ) { - return new Pressure(specificWeight.NewtonsPerCubicMeter * length.Meters, UnitsNet.Units.PressureUnit.Pascal); + return new Pressure( specificWeight.NewtonsPerCubicMeter * length.Meters, UnitsNet.Units.PressureUnit.Pascal); } - /// Get from times . - public static ForcePerLength operator *(SpecificWeight specificWeight, Area area) + /// Get from times . + public static ForcePerLength operator *(SpecificWeight specificWeight, Area area ) { - return new ForcePerLength(specificWeight.NewtonsPerCubicMeter * area.SquareMeters, ForcePerLengthUnit.NewtonPerMeter); + return new ForcePerLength( specificWeight.NewtonsPerCubicMeter * area.SquareMeters, ForcePerLengthUnit.NewtonPerMeter); } - /// Get from times . - public static ForcePerLength operator *(Area area, SpecificWeight specificWeight) + /// Get from times . + public static ForcePerLength operator *(Area area, SpecificWeight specificWeight ) { - return new ForcePerLength(area.SquareMeters * specificWeight.NewtonsPerCubicMeter, ForcePerLengthUnit.NewtonPerMeter); + return new ForcePerLength( area.SquareMeters * specificWeight.NewtonsPerCubicMeter, ForcePerLengthUnit.NewtonPerMeter); } - /// Get from divided by . - public static Acceleration operator /(SpecificWeight specificWeight, Density density) + /// Get from divided by . + public static Acceleration operator /(SpecificWeight specificWeight, Density density ) { - return new Acceleration(specificWeight.NewtonsPerCubicMeter / density.KilogramsPerCubicMeter, UnitsNet.Units.AccelerationUnit.MeterPerSecondSquared); + return new Acceleration( specificWeight.NewtonsPerCubicMeter / density.KilogramsPerCubicMeter, UnitsNet.Units.AccelerationUnit.MeterPerSecondSquared); } - /// Get from divided by . - public static Density operator /(SpecificWeight specific, Acceleration acceleration) + /// Get from divided by . + public static Density operator /(SpecificWeight specific, Acceleration acceleration ) { - return new Density(specific.NewtonsPerCubicMeter / acceleration.MetersPerSecondSquared, UnitsNet.Units.DensityUnit.KilogramPerCubicMeter); + return new Density( specific.NewtonsPerCubicMeter / acceleration.MetersPerSecondSquared, UnitsNet.Units.DensityUnit.KilogramPerCubicMeter); } } } diff --git a/UnitsNet/CustomCode/Quantities/Speed.extra.cs b/UnitsNet/CustomCode/Quantities/Speed.extra.cs index 549fff0bea..6c147eab35 100644 --- a/UnitsNet/CustomCode/Quantities/Speed.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Speed.extra.cs @@ -5,66 +5,66 @@ namespace UnitsNet { - public partial struct Speed + public partial struct Speed { - /// Get from divided by . - public static Acceleration operator /(Speed speed, TimeSpan timeSpan) + /// Get from divided by . + public static Acceleration operator /(Speed speed, TimeSpan timeSpan ) { - return Acceleration.FromMetersPerSecondSquared(speed.MetersPerSecond / timeSpan.TotalSeconds); + return Acceleration.FromMetersPerSecondSquared(speed.MetersPerSecond / timeSpan.TotalSeconds); } - /// Get from times . - public static Length operator *(Speed speed, TimeSpan timeSpan) + /// Get from times . + public static Length operator *(Speed speed, TimeSpan timeSpan) { - return Length.FromMeters(speed.MetersPerSecond * timeSpan.TotalSeconds); + return Length.FromMeters(speed.MetersPerSecond * timeSpan.TotalSeconds); } - /// Get from times . - public static Length operator *(TimeSpan timeSpan, Speed speed) + /// Get from times . + public static Length operator *(TimeSpan timeSpan, Speed speed ) { - return Length.FromMeters(speed.MetersPerSecond * timeSpan.TotalSeconds); + return Length.FromMeters(speed.MetersPerSecond * timeSpan.TotalSeconds); } - /// Get from divided by . - public static Acceleration operator /(Speed speed, Duration duration) + /// Get from divided by . + public static Acceleration operator /(Speed speed, Duration duration ) { - return Acceleration.FromMetersPerSecondSquared(speed.MetersPerSecond / duration.Seconds); + return Acceleration.FromMetersPerSecondSquared(speed.MetersPerSecond / duration.Seconds); } - /// Get from times . - public static Length operator *(Speed speed, Duration duration) + /// Get from times . + public static Length operator *(Speed speed, Duration duration ) { - return Length.FromMeters(speed.MetersPerSecond * duration.Seconds); + return Length.FromMeters(speed.MetersPerSecond * duration.Seconds); } - /// Get from times . - public static Length operator *(Duration duration, Speed speed) + /// Get from times . + public static Length operator *(Duration duration, Speed speed ) { - return Length.FromMeters(speed.MetersPerSecond * duration.Seconds); + return Length.FromMeters(speed.MetersPerSecond * duration.Seconds); } - /// Get from times . - public static KinematicViscosity operator *(Speed speed, Length length) + /// Get from times . + public static KinematicViscosity operator *(Speed speed, Length length ) { - return KinematicViscosity.FromSquareMetersPerSecond(length.Meters * speed.MetersPerSecond); + return KinematicViscosity.FromSquareMetersPerSecond(length.Meters * speed.MetersPerSecond); } - /// Get from times . - public static SpecificEnergy operator *(Speed left, Speed right) + /// Get from times . + public static SpecificEnergy operator *(Speed left, Speed right ) { - return SpecificEnergy.FromJoulesPerKilogram(left.MetersPerSecond * right.MetersPerSecond); + return SpecificEnergy.FromJoulesPerKilogram(left.MetersPerSecond * right.MetersPerSecond); } - /// Get from times . - public static MassFlux operator *(Speed speed, Density density) + /// Get from times . + public static MassFlux operator *(Speed speed, Density density ) { - return MassFlux.FromKilogramsPerSecondPerSquareMeter(speed.MetersPerSecond * density.KilogramsPerCubicMeter); + return MassFlux.FromKilogramsPerSecondPerSquareMeter(speed.MetersPerSecond * density.KilogramsPerCubicMeter); } - /// Get from times . - public static VolumeFlow operator *(Speed speed, Area area) + /// Get from times . + public static VolumeFlow operator *(Speed speed, Area area ) { - return VolumeFlow.FromCubicMetersPerSecond(speed.MetersPerSecond * area.SquareMeters); + return VolumeFlow.FromCubicMetersPerSecond(speed.MetersPerSecond * area.SquareMeters); } } } diff --git a/UnitsNet/CustomCode/Quantities/Temperature.extra.cs b/UnitsNet/CustomCode/Quantities/Temperature.extra.cs index cfce09a948..cdbe809944 100644 --- a/UnitsNet/CustomCode/Quantities/Temperature.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Temperature.extra.cs @@ -5,46 +5,46 @@ namespace UnitsNet { - public partial struct Temperature + public partial struct Temperature { /// - /// Add a and a . + /// Add a and a . /// /// Due to temperature units having different scales, the arithmetic must be performed on the same scale. /// The new temperature. - public static Temperature operator +(Temperature left, TemperatureDelta right) + public static Temperature operator +(Temperature left, TemperatureDelta right ) { - return new Temperature(left.Kelvins + right.Kelvins, TemperatureUnit.Kelvin); + return new Temperature( left.Kelvins + right.Kelvins, TemperatureUnit.Kelvin); } /// - /// Add a and a . + /// Add a and a . /// /// Due to temperature units having different scales, the arithmetic must be performed on the same scale. /// The new temperature. - public static Temperature operator +(TemperatureDelta left, Temperature right) + public static Temperature operator +(TemperatureDelta left, Temperature right ) { - return new Temperature(left.Kelvins + right.Kelvins, TemperatureUnit.Kelvin); + return new Temperature( left.Kelvins + right.Kelvins, TemperatureUnit.Kelvin); } /// - /// Subtract a by a . + /// Subtract a by a . /// /// Due to temperature units having different scales, the arithmetic must be performed on the same scale. /// The new temperature. - public static Temperature operator -(Temperature left, TemperatureDelta right) + public static Temperature operator -(Temperature left, TemperatureDelta right ) { - return new Temperature(left.Kelvins - right.Kelvins, TemperatureUnit.Kelvin); + return new Temperature( left.Kelvins - right.Kelvins, TemperatureUnit.Kelvin); } /// - /// Subtract a by a . + /// Subtract a by a . /// /// Due to temperature units having different scales, the arithmetic must be performed on the same scale. /// The delta temperature (difference). - public static TemperatureDelta operator -(Temperature left, Temperature right) + public static TemperatureDelta operator -(Temperature left, Temperature right ) { - return new TemperatureDelta(left.Kelvins - right.Kelvins, TemperatureDeltaUnit.Kelvin); + return new TemperatureDelta( left.Kelvins - right.Kelvins, TemperatureDeltaUnit.Kelvin); } /// @@ -57,8 +57,8 @@ public partial struct Temperature /// /// Factor to multiply by. /// Unit to perform multiplication in. - /// The resulting . - public Temperature Multiply(double factor, TemperatureUnit unit) + /// The resulting . + public Temperature Multiply(double factor, TemperatureUnit unit) { double resultInUnit = As(unit) * factor; return From(resultInUnit, unit); @@ -75,8 +75,8 @@ public Temperature Multiply(double factor, TemperatureUnit unit) /// /// Factor to multiply by. /// Unit to perform multiplication in. - /// The resulting . - public Temperature Divide(double divisor, TemperatureUnit unit) + /// The resulting . + public Temperature Divide(double divisor, TemperatureUnit unit) { double resultInUnit = As(unit) / divisor; return From(resultInUnit, unit); diff --git a/UnitsNet/CustomCode/Quantities/TemperatureDelta.extra.cs b/UnitsNet/CustomCode/Quantities/TemperatureDelta.extra.cs index b3b3878cbb..d0bc1ecf97 100644 --- a/UnitsNet/CustomCode/Quantities/TemperatureDelta.extra.cs +++ b/UnitsNet/CustomCode/Quantities/TemperatureDelta.extra.cs @@ -3,22 +3,22 @@ namespace UnitsNet { - public partial struct TemperatureDelta + public partial struct TemperatureDelta { - /// Get from divided by . - public static LapseRate operator /(TemperatureDelta left, Length right) + /// Get from divided by . + public static LapseRate operator /(TemperatureDelta left, Length right ) { - return LapseRate.FromDegreesCelciusPerKilometer(left.DegreesCelsius / right.Kilometers); + return LapseRate.FromDegreesCelciusPerKilometer(left.DegreesCelsius / right.Kilometers); } - /// Get from times . - public static SpecificEnergy operator *(SpecificEntropy specificEntropy, TemperatureDelta temperatureDelta) + /// Get from times . + public static SpecificEnergy operator *(SpecificEntropy specificEntropy, TemperatureDelta temperatureDelta ) { - return SpecificEnergy.FromJoulesPerKilogram(specificEntropy.JoulesPerKilogramKelvin * temperatureDelta.Kelvins); + return SpecificEnergy.FromJoulesPerKilogram(specificEntropy.JoulesPerKilogramKelvin * temperatureDelta.Kelvins); } - /// Get from times . - public static SpecificEnergy operator *(TemperatureDelta temperatureDelta, SpecificEntropy specificEntropy) + /// Get from times . + public static SpecificEnergy operator *(TemperatureDelta temperatureDelta, SpecificEntropy specificEntropy ) { return specificEntropy * temperatureDelta; } diff --git a/UnitsNet/CustomCode/Quantities/Torque.extra.cs b/UnitsNet/CustomCode/Quantities/Torque.extra.cs index 26bd4f551b..55e68598f5 100644 --- a/UnitsNet/CustomCode/Quantities/Torque.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Torque.extra.cs @@ -3,30 +3,30 @@ namespace UnitsNet { - public partial struct Torque + public partial struct Torque { - /// Get from times . - public static Force operator /(Torque torque, Length length) + /// Get from times . + public static Force operator /(Torque torque, Length length ) { - return Force.FromNewtons(torque.NewtonMeters / length.Meters); + return Force.FromNewtons(torque.NewtonMeters / length.Meters); } - /// Get from times . - public static Length operator /(Torque torque, Force force) + /// Get from times . + public static Length operator /(Torque torque, Force force ) { - return Length.FromMeters(torque.NewtonMeters / force.Newtons); + return Length.FromMeters(torque.NewtonMeters / force.Newtons); } - /// Get from times . - public static RotationalStiffness operator /(Torque torque, Angle angle) + /// Get from times . + public static RotationalStiffness operator /(Torque torque, Angle angle ) { - return RotationalStiffness.FromNewtonMetersPerRadian(torque.NewtonMeters / angle.Radians); + return RotationalStiffness.FromNewtonMetersPerRadian(torque.NewtonMeters / angle.Radians); } - /// Get from times . - public static Angle operator /(Torque torque, RotationalStiffness rotationalStiffness) + /// Get from times . + public static Angle operator /(Torque torque, RotationalStiffness rotationalStiffness ) { - return Angle.FromRadians(torque.NewtonMeters / rotationalStiffness.NewtonMetersPerRadian); + return Angle.FromRadians(torque.NewtonMeters / rotationalStiffness.NewtonMetersPerRadian); } } } diff --git a/UnitsNet/CustomCode/Quantities/Volume.extra.cs b/UnitsNet/CustomCode/Quantities/Volume.extra.cs index aab43915a4..8d3cf8e8fd 100644 --- a/UnitsNet/CustomCode/Quantities/Volume.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Volume.extra.cs @@ -5,34 +5,34 @@ namespace UnitsNet { - public partial struct Volume + public partial struct Volume { - /// Get from divided by . - public static Area operator /(Volume volume, Length length) + /// Get from divided by . + public static Area operator /(Volume volume, Length length ) { - return Area.FromSquareMeters(volume.CubicMeters / length.Meters); + return Area.FromSquareMeters(volume.CubicMeters / length.Meters); } - /// Get from divided by . - public static Length operator /(Volume volume, Area area) + /// Get from divided by . + public static Length operator /(Volume volume, Area area ) { - return Length.FromMeters(volume.CubicMeters / area.SquareMeters); + return Length.FromMeters(volume.CubicMeters / area.SquareMeters); } - /// Get from divided by . - public static VolumeFlow operator /(Volume volume, Duration duration) + /// Get from divided by . + public static VolumeFlow operator /(Volume volume, Duration duration ) { - return VolumeFlow.FromCubicMetersPerSecond(volume.CubicMeters / duration.Seconds); + return VolumeFlow.FromCubicMetersPerSecond(volume.CubicMeters / duration.Seconds); } - /// Get from divided by . - public static VolumeFlow operator /(Volume volume, TimeSpan timeSpan) + /// Get from divided by . + public static VolumeFlow operator /(Volume volume, TimeSpan timeSpan) { - return VolumeFlow.FromCubicMetersPerSecond(volume.CubicMeters / timeSpan.TotalSeconds); + return VolumeFlow.FromCubicMetersPerSecond(volume.CubicMeters / timeSpan.TotalSeconds); } - /// Get from divided by . - public static TimeSpan operator /(Volume volume, VolumeFlow volumeFlow) + /// Get from divided by . + public static TimeSpan operator /(Volume volume, VolumeFlow volumeFlow ) { return TimeSpan.FromSeconds(volume.CubicMeters / volumeFlow.CubicMetersPerSecond); } diff --git a/UnitsNet/CustomCode/Quantities/VolumeConcentration.extra.cs b/UnitsNet/CustomCode/Quantities/VolumeConcentration.extra.cs index e90942cfd1..8dce4d284f 100644 --- a/UnitsNet/CustomCode/Quantities/VolumeConcentration.extra.cs +++ b/UnitsNet/CustomCode/Quantities/VolumeConcentration.extra.cs @@ -2,25 +2,25 @@ namespace UnitsNet { - public partial struct VolumeConcentration + public partial struct VolumeConcentration { /// - /// Get from this and component . + /// Get from this and component . /// /// /// - public MassConcentration ToMassConcentration(Density componentDensity) + public MassConcentration ToMassConcentration(Density componentDensity ) { return this * componentDensity; } /// - /// Get from this and component and . + /// Get from this and component and . /// /// /// /// - public Molarity ToMolarity(Density componentDensity, MolarMass compontMolarMass) + public Molarity ToMolarity(Density componentDensity, MolarMass compontMolarMass ) { return this * componentDensity / compontMolarMass; } @@ -28,20 +28,20 @@ public Molarity ToMolarity(Density componentDensity, MolarMass compontMolarMass) #region Static Methods /// - /// Get from a component and total mixture . + /// Get from a component and total mixture . /// - public static VolumeConcentration FromVolumes(Volume componentVolume, Volume mixtureMass) + public static VolumeConcentration FromVolumes(Volume componentVolume, Volume mixtureMass ) { - return new VolumeConcentration(componentVolume / mixtureMass, VolumeConcentrationUnit.DecimalFraction); + return new VolumeConcentration( componentVolume / mixtureMass, VolumeConcentrationUnit.DecimalFraction); } /// - /// Get a from and a component and . + /// Get a from and a component and . /// /// /// /// - public static VolumeConcentration FromMolarity(Molarity molarity, Density componentDensity, MolarMass componentMolarMass) + public static VolumeConcentration FromMolarity(Molarity molarity, Density componentDensity, MolarMass componentMolarMass ) { return molarity * componentMolarMass / componentDensity; } @@ -51,16 +51,16 @@ public static VolumeConcentration FromMolarity(Molarity molarity, Density compon #region Operators - /// Get from times the component . - public static MassConcentration operator *(VolumeConcentration volumeConcentration, Density componentDensity) + /// Get from times the component . + public static MassConcentration operator *(VolumeConcentration volumeConcentration, Density componentDensity ) { - return MassConcentration.FromKilogramsPerCubicMeter(volumeConcentration.DecimalFractions * componentDensity.KilogramsPerCubicMeter); + return MassConcentration.FromKilogramsPerCubicMeter(volumeConcentration.DecimalFractions * componentDensity.KilogramsPerCubicMeter); } - /// Get from times the component . - public static MassConcentration operator *(Density componentDensity, VolumeConcentration volumeConcentration) + /// Get from times the component . + public static MassConcentration operator *(Density componentDensity, VolumeConcentration volumeConcentration ) { - return MassConcentration.FromKilogramsPerCubicMeter(volumeConcentration.DecimalFractions * componentDensity.KilogramsPerCubicMeter); + return MassConcentration.FromKilogramsPerCubicMeter(volumeConcentration.DecimalFractions * componentDensity.KilogramsPerCubicMeter); } #endregion diff --git a/UnitsNet/CustomCode/Quantities/VolumeFlow.extra.cs b/UnitsNet/CustomCode/Quantities/VolumeFlow.extra.cs index 51e71e8180..4c5d12f078 100644 --- a/UnitsNet/CustomCode/Quantities/VolumeFlow.extra.cs +++ b/UnitsNet/CustomCode/Quantities/VolumeFlow.extra.cs @@ -5,42 +5,42 @@ namespace UnitsNet { - public partial struct VolumeFlow + public partial struct VolumeFlow { - /// Get from times . - public static Volume operator *(VolumeFlow volumeFlow, TimeSpan timeSpan) + /// Get from times . + public static Volume operator *(VolumeFlow volumeFlow, TimeSpan timeSpan) { - return Volume.FromCubicMeters(volumeFlow.CubicMetersPerSecond * timeSpan.TotalSeconds); + return Volume.FromCubicMeters(volumeFlow.CubicMetersPerSecond * timeSpan.TotalSeconds); } - /// Get from times . - public static Volume operator *(VolumeFlow volumeFlow, Duration duration) + /// Get from times . + public static Volume operator *(VolumeFlow volumeFlow, Duration duration ) { - return Volume.FromCubicMeters(volumeFlow.CubicMetersPerSecond * duration.Seconds); + return Volume.FromCubicMeters(volumeFlow.CubicMetersPerSecond * duration.Seconds); } - /// Get from divided by . - public static Speed operator /(VolumeFlow volumeFlow, Area area) + /// Get from divided by . + public static Speed operator /(VolumeFlow volumeFlow, Area area ) { - return Speed.FromMetersPerSecond(volumeFlow.CubicMetersPerSecond / area.SquareMeters); + return Speed.FromMetersPerSecond(volumeFlow.CubicMetersPerSecond / area.SquareMeters); } - /// Get from divided by . - public static Area operator /(VolumeFlow volumeFlow, Speed speed) + /// Get from divided by . + public static Area operator /(VolumeFlow volumeFlow, Speed speed ) { - return Area.FromSquareMeters(volumeFlow.CubicMetersPerSecond / speed.MetersPerSecond); + return Area.FromSquareMeters(volumeFlow.CubicMetersPerSecond / speed.MetersPerSecond); } - /// Get from times . - public static MassFlow operator *(VolumeFlow volumeFlow, Density density) + /// Get from times . + public static MassFlow operator *(VolumeFlow volumeFlow, Density density ) { - return MassFlow.FromKilogramsPerSecond(volumeFlow.CubicMetersPerSecond * density.KilogramsPerCubicMeter); + return MassFlow.FromKilogramsPerSecond(volumeFlow.CubicMetersPerSecond * density.KilogramsPerCubicMeter); } - /// Get from times . - public static MassFlow operator *(Density density, VolumeFlow volumeFlow) + /// Get from times . + public static MassFlow operator *(Density density, VolumeFlow volumeFlow ) { - return MassFlow.FromKilogramsPerSecond(volumeFlow.CubicMetersPerSecond * density.KilogramsPerCubicMeter); + return MassFlow.FromKilogramsPerSecond(volumeFlow.CubicMetersPerSecond * density.KilogramsPerCubicMeter); } } } From d88aa34cb1daa1683940a8f39229471e78d69579 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 22 Oct 2019 11:38:14 -0400 Subject: [PATCH 08/13] Convert remaining classes to generics --- .../UnitsNetGen/StaticQuantityGenerator.cs | 16 +- .../UnitsNetGen/UnitConverterGenerator.cs | 14 +- UnitsNet/CustomCode/GlobalConfiguration.cs | 4 +- UnitsNet/CustomCode/Quantities/Power.extra.cs | 2 +- UnitsNet/CustomCode/Quantity.cs | 24 +- UnitsNet/CustomCode/UnitAbbreviationsCache.cs | 2 +- UnitsNet/GeneratedCode/Quantity.g.cs | 792 ++-- UnitsNet/GeneratedCode/UnitConverter.g.cs | 3976 ++++++++--------- UnitsNet/IQuantity.cs | 4 +- UnitsNet/QuantityInfo.cs | 10 +- UnitsNet/QuantityNotFoundException.cs | 2 +- UnitsNet/QuantityTypeConverter.cs | 8 +- UnitsNet/UnitConverter.cs | 14 +- UnitsNet/UnitMath.cs | 36 +- UnitsNet/UnitNotFoundException.cs | 4 +- 15 files changed, 2456 insertions(+), 2452 deletions(-) diff --git a/CodeGen/Generators/UnitsNetGen/StaticQuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/StaticQuantityGenerator.cs index 25d9143e49..a3b5d522ae 100644 --- a/CodeGen/Generators/UnitsNetGen/StaticQuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/StaticQuantityGenerator.cs @@ -1,4 +1,4 @@ -using CodeGen.Helpers; +using CodeGen.Helpers; using CodeGen.JsonTypes; namespace CodeGen.Generators.UnitsNetGen @@ -35,7 +35,7 @@ public static partial class Quantity /// The of the quantity to create. /// The value to construct the quantity with. /// The created quantity. - public static IQuantity FromQuantityType(QuantityType quantityType, QuantityValue value) + public static IQuantity FromQuantityType(QuantityType quantityType, QuantityValue value) { switch(quantityType) {"); @@ -44,7 +44,7 @@ public static IQuantity FromQuantityType(QuantityType quantityType, QuantityValu var quantityName = quantity.Name; Writer.WL($@" case QuantityType.{quantityName}: - return {quantityName}.From(value, {quantityName}.BaseUnit);"); + return {quantityName}.From(value, {quantityName}.BaseUnit);"); } Writer.WL(@" @@ -60,7 +60,7 @@ public static IQuantity FromQuantityType(QuantityType quantityType, QuantityValu /// Unit enum value. /// The resulting quantity if successful, otherwise default. /// True if successful with assigned the value, otherwise false. - public static bool TryFrom(QuantityValue value, Enum unit, out IQuantity quantity) + public static bool TryFrom(QuantityValue value, Enum unit, out IQuantity quantity) { switch (unit) {"); @@ -71,7 +71,7 @@ public static bool TryFrom(QuantityValue value, Enum unit, out IQuantity quantit var unitValue = unitTypeName.ToCamelCase(); Writer.WL($@" case {unitTypeName} {unitValue}: - quantity = {quantityName}.From(value, {unitValue}); + quantity = {quantityName}.From(value, {unitValue}); return true;"); } @@ -92,7 +92,7 @@ public static bool TryFrom(QuantityValue value, Enum unit, out IQuantity quantit /// Quantity string representation, such as ""1.5 kg"". Must be compatible with given quantity type. /// The resulting quantity if successful, otherwise default. /// The parsed quantity. - public static bool TryParse([CanBeNull] IFormatProvider formatProvider, Type quantityType, string quantityString, out IQuantity quantity) + public static bool TryParse([CanBeNull] IFormatProvider formatProvider, Type quantityType, string quantityString, out IQuantity quantity) { quantity = default(IQuantity); @@ -107,8 +107,8 @@ public static bool TryParse([CanBeNull] IFormatProvider formatProvider, Type qua { var quantityName = quantity.Name; Writer.WL($@" - case Type _ when quantityType == typeof({quantityName}): - return parser.TryParse<{quantityName}, {quantityName}Unit>(quantityString, formatProvider, {quantityName}.From, out quantity);"); + case Type _ when quantityType == typeof({quantityName}): + return parser.TryParse<{quantityName}, {quantityName}Unit>(quantityString, formatProvider, {quantityName}.From, out quantity);"); } Writer.WL(@" diff --git a/CodeGen/Generators/UnitsNetGen/UnitConverterGenerator.cs b/CodeGen/Generators/UnitsNetGen/UnitConverterGenerator.cs index 09047b06e9..72346ae768 100644 --- a/CodeGen/Generators/UnitsNetGen/UnitConverterGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/UnitConverterGenerator.cs @@ -1,4 +1,4 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. +// Licensed under MIT No Attribution, see LICENSE file at the root. // Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. using CodeGen.Helpers; @@ -26,23 +26,23 @@ public override string Generate() namespace UnitsNet {{ - public sealed partial class UnitConverter + public sealed partial class UnitConverter {{ /// /// Registers the default conversion functions in the given instance. /// /// The to register the default conversion functions in. - public static void RegisterDefaultConversions(UnitConverter unitConverter) - {{"); + public static void RegisterDefaultConversions(UnitConverter unitConverter) + {{" ); foreach (Quantity quantity in _quantities) foreach (Unit unit in quantity.Units) { Writer.WL(quantity.BaseUnit == unit.SingularName ? $@" - unitConverter.SetConversionFunction<{quantity.Name}>({quantity.Name}.BaseUnit, {quantity.Name}.BaseUnit, q => q);" + unitConverter.SetConversionFunction<{quantity.Name}>({quantity.Name}.BaseUnit, {quantity.Name}.BaseUnit, q => q);" : $@" - unitConverter.SetConversionFunction<{quantity.Name}>({quantity.Name}.BaseUnit, {quantity.Name}Unit.{unit.SingularName}, q => q.ToUnit({quantity.Name}Unit.{unit.SingularName})); - unitConverter.SetConversionFunction<{quantity.Name}>({quantity.Name}Unit.{unit.SingularName}, {quantity.Name}.BaseUnit, q => q.ToBaseUnit());"); + unitConverter.SetConversionFunction<{quantity.Name}>({quantity.Name}.BaseUnit, {quantity.Name}Unit.{unit.SingularName}, q => q.ToUnit({quantity.Name}Unit.{unit.SingularName})); + unitConverter.SetConversionFunction<{quantity.Name}>({quantity.Name}Unit.{unit.SingularName}, {quantity.Name}.BaseUnit, q => q.ToBaseUnit());"); } Writer.WL($@" diff --git a/UnitsNet/CustomCode/GlobalConfiguration.cs b/UnitsNet/CustomCode/GlobalConfiguration.cs index 746e98dc65..f7eff3a926 100644 --- a/UnitsNet/CustomCode/GlobalConfiguration.cs +++ b/UnitsNet/CustomCode/GlobalConfiguration.cs @@ -9,8 +9,8 @@ namespace UnitsNet { /// - /// Global configuration for culture, used as default culture in methods like and - /// . + /// Global configuration for culture, used as default culture in methods like and + /// . /// [Obsolete("The only property DefaultCulture is now deprecated. Manipulate Thread.CurrentThread.CurrentUICulture instead.")] public static class GlobalConfiguration diff --git a/UnitsNet/CustomCode/Quantities/Power.extra.cs b/UnitsNet/CustomCode/Quantities/Power.extra.cs index 319b8502a1..3206de6466 100644 --- a/UnitsNet/CustomCode/Quantities/Power.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Power.extra.cs @@ -33,7 +33,7 @@ public PowerRatio ToPowerRatio() return Energy.FromJoules(power.Watts * time.TotalSeconds); } - /// Get from times . + /// Get from times . public static Energy operator *(Power power, Duration duration ) { return Energy.FromJoules(power.Watts * duration.Seconds); diff --git a/UnitsNet/CustomCode/Quantity.cs b/UnitsNet/CustomCode/Quantity.cs index 74fe89d86d..9bc4efd589 100644 --- a/UnitsNet/CustomCode/Quantity.cs +++ b/UnitsNet/CustomCode/Quantity.cs @@ -18,7 +18,7 @@ static Quantity() Names = quantityTypes.Select(qt => qt.ToString()).ToArray(); InfosLazy = new Lazy(() => Types - .Select(quantityType => FromQuantityType(quantityType, 0.0).QuantityInfo) + .Select(quantityType => FromQuantityType(quantityType, 0.0).QuantityInfo) .OrderBy(quantityInfo => quantityInfo.Name) .ToArray()); } @@ -34,7 +34,7 @@ static Quantity() public static string[] Names { get; } /// - /// All quantity information objects, such as and . + /// All quantity information objects, such as and . /// public static QuantityInfo[] Infos => InfosLazy.Value; @@ -45,9 +45,9 @@ static Quantity() /// Unit enum value. /// An object. /// Unit value is not a know unit enum type. - public static IQuantity From(QuantityValue value, Enum unit) + public static IQuantity From( QuantityValue value, Enum unit) { - if (TryFrom(value, unit, out IQuantity quantity)) + if (TryFrom( value, unit, out IQuantity quantity)) return quantity; throw new ArgumentException( @@ -55,7 +55,7 @@ public static IQuantity From(QuantityValue value, Enum unit) } /// - public static bool TryFrom(double value, Enum unit, out IQuantity quantity) + public static bool TryFrom( double value, Enum unit, out IQuantity quantity) { // Implicit cast to QuantityValue would prevent TryFrom from being called, // so we need to explicitly check this here for double arguments. @@ -65,33 +65,33 @@ public static bool TryFrom(double value, Enum unit, out IQuantity quantity) return false; } - return TryFrom((QuantityValue)value, unit, out quantity); + return TryFrom( (QuantityValue)value, unit, out quantity); } /// - public static IQuantity Parse(Type quantityType, string quantityString) => Parse(null, quantityType, quantityString); + public static IQuantity Parse( Type quantityType, string quantityString) => Parse( null, quantityType, quantityString); /// /// Dynamically parse a quantity string representation. /// /// The format provider to use for lookup. Defaults to if null. - /// Type of quantity, such as . + /// Type of quantity, such as . /// Quantity string representation, such as "1.5 kg". Must be compatible with given quantity type. /// The parsed quantity. /// Type must be of type UnitsNet.IQuantity -or- Type is not a known quantity type. - public static IQuantity Parse([CanBeNull] IFormatProvider formatProvider, Type quantityType, string quantityString) + public static IQuantity Parse([CanBeNull] IFormatProvider formatProvider, Type quantityType, string quantityString) { if (!typeof(IQuantity).Wrap().IsAssignableFrom(quantityType)) throw new ArgumentException($"Type {quantityType} must be of type UnitsNet.IQuantity."); - if (TryParse(formatProvider, quantityType, quantityString, out IQuantity quantity)) return quantity; + if (TryParse( formatProvider, quantityType, quantityString, out IQuantity quantity)) return quantity; throw new ArgumentException($"Quantity string could not be parsed to quantity {quantityType}."); } /// - public static bool TryParse(Type quantityType, string quantityString, out IQuantity quantity) => - TryParse(null, quantityType, quantityString, out quantity); + public static bool TryParse( Type quantityType, string quantityString, out IQuantity quantity) => + TryParse( null, quantityType, quantityString, out quantity); /// /// Get information about the given quantity type. diff --git a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs index d10b08b5fe..9806a11cc3 100644 --- a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs +++ b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs @@ -27,7 +27,7 @@ public sealed partial class UnitAbbreviationsCache /// if no abbreviations are found with a given culture. /// /// - /// User wants to call or with Russian + /// User wants to call or with Russian /// culture, but no translation is defined, so we return the US English definition as a last resort. If it's not /// defined there either, an exception is thrown. /// diff --git a/UnitsNet/GeneratedCode/Quantity.g.cs b/UnitsNet/GeneratedCode/Quantity.g.cs index cc8d944318..3301b13eac 100644 --- a/UnitsNet/GeneratedCode/Quantity.g.cs +++ b/UnitsNet/GeneratedCode/Quantity.g.cs @@ -36,206 +36,206 @@ public static partial class Quantity /// The of the quantity to create. /// The value to construct the quantity with. /// The created quantity. - public static IQuantity FromQuantityType(QuantityType quantityType, QuantityValue value) + public static IQuantity FromQuantityType(QuantityType quantityType, QuantityValue value) { switch(quantityType) { case QuantityType.Acceleration: - return Acceleration.From(value, Acceleration.BaseUnit); + return Acceleration.From(value, Acceleration.BaseUnit); case QuantityType.AmountOfSubstance: - return AmountOfSubstance.From(value, AmountOfSubstance.BaseUnit); + return AmountOfSubstance.From(value, AmountOfSubstance.BaseUnit); case QuantityType.AmplitudeRatio: - return AmplitudeRatio.From(value, AmplitudeRatio.BaseUnit); + return AmplitudeRatio.From(value, AmplitudeRatio.BaseUnit); case QuantityType.Angle: - return Angle.From(value, Angle.BaseUnit); + return Angle.From(value, Angle.BaseUnit); case QuantityType.ApparentEnergy: - return ApparentEnergy.From(value, ApparentEnergy.BaseUnit); + return ApparentEnergy.From(value, ApparentEnergy.BaseUnit); case QuantityType.ApparentPower: - return ApparentPower.From(value, ApparentPower.BaseUnit); + return ApparentPower.From(value, ApparentPower.BaseUnit); case QuantityType.Area: - return Area.From(value, Area.BaseUnit); + return Area.From(value, Area.BaseUnit); case QuantityType.AreaDensity: - return AreaDensity.From(value, AreaDensity.BaseUnit); + return AreaDensity.From(value, AreaDensity.BaseUnit); case QuantityType.AreaMomentOfInertia: - return AreaMomentOfInertia.From(value, AreaMomentOfInertia.BaseUnit); + return AreaMomentOfInertia.From(value, AreaMomentOfInertia.BaseUnit); case QuantityType.BitRate: - return BitRate.From(value, BitRate.BaseUnit); + return BitRate.From(value, BitRate.BaseUnit); case QuantityType.BrakeSpecificFuelConsumption: - return BrakeSpecificFuelConsumption.From(value, BrakeSpecificFuelConsumption.BaseUnit); + return BrakeSpecificFuelConsumption.From(value, BrakeSpecificFuelConsumption.BaseUnit); case QuantityType.Capacitance: - return Capacitance.From(value, Capacitance.BaseUnit); + return Capacitance.From(value, Capacitance.BaseUnit); case QuantityType.CoefficientOfThermalExpansion: - return CoefficientOfThermalExpansion.From(value, CoefficientOfThermalExpansion.BaseUnit); + return CoefficientOfThermalExpansion.From(value, CoefficientOfThermalExpansion.BaseUnit); case QuantityType.Density: - return Density.From(value, Density.BaseUnit); + return Density.From(value, Density.BaseUnit); case QuantityType.Duration: - return Duration.From(value, Duration.BaseUnit); + return Duration.From(value, Duration.BaseUnit); case QuantityType.DynamicViscosity: - return DynamicViscosity.From(value, DynamicViscosity.BaseUnit); + return DynamicViscosity.From(value, DynamicViscosity.BaseUnit); case QuantityType.ElectricAdmittance: - return ElectricAdmittance.From(value, ElectricAdmittance.BaseUnit); + return ElectricAdmittance.From(value, ElectricAdmittance.BaseUnit); case QuantityType.ElectricCharge: - return ElectricCharge.From(value, ElectricCharge.BaseUnit); + return ElectricCharge.From(value, ElectricCharge.BaseUnit); case QuantityType.ElectricChargeDensity: - return ElectricChargeDensity.From(value, ElectricChargeDensity.BaseUnit); + return ElectricChargeDensity.From(value, ElectricChargeDensity.BaseUnit); case QuantityType.ElectricConductance: - return ElectricConductance.From(value, ElectricConductance.BaseUnit); + return ElectricConductance.From(value, ElectricConductance.BaseUnit); case QuantityType.ElectricConductivity: - return ElectricConductivity.From(value, ElectricConductivity.BaseUnit); + return ElectricConductivity.From(value, ElectricConductivity.BaseUnit); case QuantityType.ElectricCurrent: - return ElectricCurrent.From(value, ElectricCurrent.BaseUnit); + return ElectricCurrent.From(value, ElectricCurrent.BaseUnit); case QuantityType.ElectricCurrentDensity: - return ElectricCurrentDensity.From(value, ElectricCurrentDensity.BaseUnit); + return ElectricCurrentDensity.From(value, ElectricCurrentDensity.BaseUnit); case QuantityType.ElectricCurrentGradient: - return ElectricCurrentGradient.From(value, ElectricCurrentGradient.BaseUnit); + return ElectricCurrentGradient.From(value, ElectricCurrentGradient.BaseUnit); case QuantityType.ElectricField: - return ElectricField.From(value, ElectricField.BaseUnit); + return ElectricField.From(value, ElectricField.BaseUnit); case QuantityType.ElectricInductance: - return ElectricInductance.From(value, ElectricInductance.BaseUnit); + return ElectricInductance.From(value, ElectricInductance.BaseUnit); case QuantityType.ElectricPotential: - return ElectricPotential.From(value, ElectricPotential.BaseUnit); + return ElectricPotential.From(value, ElectricPotential.BaseUnit); case QuantityType.ElectricPotentialAc: - return ElectricPotentialAc.From(value, ElectricPotentialAc.BaseUnit); + return ElectricPotentialAc.From(value, ElectricPotentialAc.BaseUnit); case QuantityType.ElectricPotentialDc: - return ElectricPotentialDc.From(value, ElectricPotentialDc.BaseUnit); + return ElectricPotentialDc.From(value, ElectricPotentialDc.BaseUnit); case QuantityType.ElectricResistance: - return ElectricResistance.From(value, ElectricResistance.BaseUnit); + return ElectricResistance.From(value, ElectricResistance.BaseUnit); case QuantityType.ElectricResistivity: - return ElectricResistivity.From(value, ElectricResistivity.BaseUnit); + return ElectricResistivity.From(value, ElectricResistivity.BaseUnit); case QuantityType.ElectricSurfaceChargeDensity: - return ElectricSurfaceChargeDensity.From(value, ElectricSurfaceChargeDensity.BaseUnit); + return ElectricSurfaceChargeDensity.From(value, ElectricSurfaceChargeDensity.BaseUnit); case QuantityType.Energy: - return Energy.From(value, Energy.BaseUnit); + return Energy.From(value, Energy.BaseUnit); case QuantityType.Entropy: - return Entropy.From(value, Entropy.BaseUnit); + return Entropy.From(value, Entropy.BaseUnit); case QuantityType.Force: - return Force.From(value, Force.BaseUnit); + return Force.From(value, Force.BaseUnit); case QuantityType.ForceChangeRate: - return ForceChangeRate.From(value, ForceChangeRate.BaseUnit); + return ForceChangeRate.From(value, ForceChangeRate.BaseUnit); case QuantityType.ForcePerLength: - return ForcePerLength.From(value, ForcePerLength.BaseUnit); + return ForcePerLength.From(value, ForcePerLength.BaseUnit); case QuantityType.Frequency: - return Frequency.From(value, Frequency.BaseUnit); + return Frequency.From(value, Frequency.BaseUnit); case QuantityType.FuelEfficiency: - return FuelEfficiency.From(value, FuelEfficiency.BaseUnit); + return FuelEfficiency.From(value, FuelEfficiency.BaseUnit); case QuantityType.HeatFlux: - return HeatFlux.From(value, HeatFlux.BaseUnit); + return HeatFlux.From(value, HeatFlux.BaseUnit); case QuantityType.HeatTransferCoefficient: - return HeatTransferCoefficient.From(value, HeatTransferCoefficient.BaseUnit); + return HeatTransferCoefficient.From(value, HeatTransferCoefficient.BaseUnit); case QuantityType.Illuminance: - return Illuminance.From(value, Illuminance.BaseUnit); + return Illuminance.From(value, Illuminance.BaseUnit); case QuantityType.Information: - return Information.From(value, Information.BaseUnit); + return Information.From(value, Information.BaseUnit); case QuantityType.Irradiance: - return Irradiance.From(value, Irradiance.BaseUnit); + return Irradiance.From(value, Irradiance.BaseUnit); case QuantityType.Irradiation: - return Irradiation.From(value, Irradiation.BaseUnit); + return Irradiation.From(value, Irradiation.BaseUnit); case QuantityType.KinematicViscosity: - return KinematicViscosity.From(value, KinematicViscosity.BaseUnit); + return KinematicViscosity.From(value, KinematicViscosity.BaseUnit); case QuantityType.LapseRate: - return LapseRate.From(value, LapseRate.BaseUnit); + return LapseRate.From(value, LapseRate.BaseUnit); case QuantityType.Length: - return Length.From(value, Length.BaseUnit); + return Length.From(value, Length.BaseUnit); case QuantityType.Level: - return Level.From(value, Level.BaseUnit); + return Level.From(value, Level.BaseUnit); case QuantityType.LinearDensity: - return LinearDensity.From(value, LinearDensity.BaseUnit); + return LinearDensity.From(value, LinearDensity.BaseUnit); case QuantityType.Luminosity: - return Luminosity.From(value, Luminosity.BaseUnit); + return Luminosity.From(value, Luminosity.BaseUnit); case QuantityType.LuminousFlux: - return LuminousFlux.From(value, LuminousFlux.BaseUnit); + return LuminousFlux.From(value, LuminousFlux.BaseUnit); case QuantityType.LuminousIntensity: - return LuminousIntensity.From(value, LuminousIntensity.BaseUnit); + return LuminousIntensity.From(value, LuminousIntensity.BaseUnit); case QuantityType.MagneticField: - return MagneticField.From(value, MagneticField.BaseUnit); + return MagneticField.From(value, MagneticField.BaseUnit); case QuantityType.MagneticFlux: - return MagneticFlux.From(value, MagneticFlux.BaseUnit); + return MagneticFlux.From(value, MagneticFlux.BaseUnit); case QuantityType.Magnetization: - return Magnetization.From(value, Magnetization.BaseUnit); + return Magnetization.From(value, Magnetization.BaseUnit); case QuantityType.Mass: - return Mass.From(value, Mass.BaseUnit); + return Mass.From(value, Mass.BaseUnit); case QuantityType.MassConcentration: - return MassConcentration.From(value, MassConcentration.BaseUnit); + return MassConcentration.From(value, MassConcentration.BaseUnit); case QuantityType.MassFlow: - return MassFlow.From(value, MassFlow.BaseUnit); + return MassFlow.From(value, MassFlow.BaseUnit); case QuantityType.MassFlux: - return MassFlux.From(value, MassFlux.BaseUnit); + return MassFlux.From(value, MassFlux.BaseUnit); case QuantityType.MassFraction: - return MassFraction.From(value, MassFraction.BaseUnit); + return MassFraction.From(value, MassFraction.BaseUnit); case QuantityType.MassMomentOfInertia: - return MassMomentOfInertia.From(value, MassMomentOfInertia.BaseUnit); + return MassMomentOfInertia.From(value, MassMomentOfInertia.BaseUnit); case QuantityType.MolarEnergy: - return MolarEnergy.From(value, MolarEnergy.BaseUnit); + return MolarEnergy.From(value, MolarEnergy.BaseUnit); case QuantityType.MolarEntropy: - return MolarEntropy.From(value, MolarEntropy.BaseUnit); + return MolarEntropy.From(value, MolarEntropy.BaseUnit); case QuantityType.Molarity: - return Molarity.From(value, Molarity.BaseUnit); + return Molarity.From(value, Molarity.BaseUnit); case QuantityType.MolarMass: - return MolarMass.From(value, MolarMass.BaseUnit); + return MolarMass.From(value, MolarMass.BaseUnit); case QuantityType.Permeability: - return Permeability.From(value, Permeability.BaseUnit); + return Permeability.From(value, Permeability.BaseUnit); case QuantityType.Permittivity: - return Permittivity.From(value, Permittivity.BaseUnit); + return Permittivity.From(value, Permittivity.BaseUnit); case QuantityType.Power: - return Power.From(value, Power.BaseUnit); + return Power.From(value, Power.BaseUnit); case QuantityType.PowerDensity: - return PowerDensity.From(value, PowerDensity.BaseUnit); + return PowerDensity.From(value, PowerDensity.BaseUnit); case QuantityType.PowerRatio: - return PowerRatio.From(value, PowerRatio.BaseUnit); + return PowerRatio.From(value, PowerRatio.BaseUnit); case QuantityType.Pressure: - return Pressure.From(value, Pressure.BaseUnit); + return Pressure.From(value, Pressure.BaseUnit); case QuantityType.PressureChangeRate: - return PressureChangeRate.From(value, PressureChangeRate.BaseUnit); + return PressureChangeRate.From(value, PressureChangeRate.BaseUnit); case QuantityType.Ratio: - return Ratio.From(value, Ratio.BaseUnit); + return Ratio.From(value, Ratio.BaseUnit); case QuantityType.RatioChangeRate: - return RatioChangeRate.From(value, RatioChangeRate.BaseUnit); + return RatioChangeRate.From(value, RatioChangeRate.BaseUnit); case QuantityType.ReactiveEnergy: - return ReactiveEnergy.From(value, ReactiveEnergy.BaseUnit); + return ReactiveEnergy.From(value, ReactiveEnergy.BaseUnit); case QuantityType.ReactivePower: - return ReactivePower.From(value, ReactivePower.BaseUnit); + return ReactivePower.From(value, ReactivePower.BaseUnit); case QuantityType.RotationalAcceleration: - return RotationalAcceleration.From(value, RotationalAcceleration.BaseUnit); + return RotationalAcceleration.From(value, RotationalAcceleration.BaseUnit); case QuantityType.RotationalSpeed: - return RotationalSpeed.From(value, RotationalSpeed.BaseUnit); + return RotationalSpeed.From(value, RotationalSpeed.BaseUnit); case QuantityType.RotationalStiffness: - return RotationalStiffness.From(value, RotationalStiffness.BaseUnit); + return RotationalStiffness.From(value, RotationalStiffness.BaseUnit); case QuantityType.RotationalStiffnessPerLength: - return RotationalStiffnessPerLength.From(value, RotationalStiffnessPerLength.BaseUnit); + return RotationalStiffnessPerLength.From(value, RotationalStiffnessPerLength.BaseUnit); case QuantityType.SolidAngle: - return SolidAngle.From(value, SolidAngle.BaseUnit); + return SolidAngle.From(value, SolidAngle.BaseUnit); case QuantityType.SpecificEnergy: - return SpecificEnergy.From(value, SpecificEnergy.BaseUnit); + return SpecificEnergy.From(value, SpecificEnergy.BaseUnit); case QuantityType.SpecificEntropy: - return SpecificEntropy.From(value, SpecificEntropy.BaseUnit); + return SpecificEntropy.From(value, SpecificEntropy.BaseUnit); case QuantityType.SpecificVolume: - return SpecificVolume.From(value, SpecificVolume.BaseUnit); + return SpecificVolume.From(value, SpecificVolume.BaseUnit); case QuantityType.SpecificWeight: - return SpecificWeight.From(value, SpecificWeight.BaseUnit); + return SpecificWeight.From(value, SpecificWeight.BaseUnit); case QuantityType.Speed: - return Speed.From(value, Speed.BaseUnit); + return Speed.From(value, Speed.BaseUnit); case QuantityType.Temperature: - return Temperature.From(value, Temperature.BaseUnit); + return Temperature.From(value, Temperature.BaseUnit); case QuantityType.TemperatureChangeRate: - return TemperatureChangeRate.From(value, TemperatureChangeRate.BaseUnit); + return TemperatureChangeRate.From(value, TemperatureChangeRate.BaseUnit); case QuantityType.TemperatureDelta: - return TemperatureDelta.From(value, TemperatureDelta.BaseUnit); + return TemperatureDelta.From(value, TemperatureDelta.BaseUnit); case QuantityType.ThermalConductivity: - return ThermalConductivity.From(value, ThermalConductivity.BaseUnit); + return ThermalConductivity.From(value, ThermalConductivity.BaseUnit); case QuantityType.ThermalResistance: - return ThermalResistance.From(value, ThermalResistance.BaseUnit); + return ThermalResistance.From(value, ThermalResistance.BaseUnit); case QuantityType.Torque: - return Torque.From(value, Torque.BaseUnit); + return Torque.From(value, Torque.BaseUnit); case QuantityType.VitaminA: - return VitaminA.From(value, VitaminA.BaseUnit); + return VitaminA.From(value, VitaminA.BaseUnit); case QuantityType.Volume: - return Volume.From(value, Volume.BaseUnit); + return Volume.From(value, Volume.BaseUnit); case QuantityType.VolumeConcentration: - return VolumeConcentration.From(value, VolumeConcentration.BaseUnit); + return VolumeConcentration.From(value, VolumeConcentration.BaseUnit); case QuantityType.VolumeFlow: - return VolumeFlow.From(value, VolumeFlow.BaseUnit); + return VolumeFlow.From(value, VolumeFlow.BaseUnit); case QuantityType.VolumePerLength: - return VolumePerLength.From(value, VolumePerLength.BaseUnit); + return VolumePerLength.From(value, VolumePerLength.BaseUnit); default: throw new ArgumentException($"{quantityType} is not a supported quantity type."); } @@ -248,303 +248,303 @@ public static IQuantity FromQuantityType(QuantityType quantityType, QuantityValu /// Unit enum value. /// The resulting quantity if successful, otherwise default. /// True if successful with assigned the value, otherwise false. - public static bool TryFrom(QuantityValue value, Enum unit, out IQuantity quantity) + public static bool TryFrom(QuantityValue value, Enum unit, out IQuantity quantity) { switch (unit) { case AccelerationUnit accelerationUnit: - quantity = Acceleration.From(value, accelerationUnit); + quantity = Acceleration.From(value, accelerationUnit); return true; case AmountOfSubstanceUnit amountOfSubstanceUnit: - quantity = AmountOfSubstance.From(value, amountOfSubstanceUnit); + quantity = AmountOfSubstance.From(value, amountOfSubstanceUnit); return true; case AmplitudeRatioUnit amplitudeRatioUnit: - quantity = AmplitudeRatio.From(value, amplitudeRatioUnit); + quantity = AmplitudeRatio.From(value, amplitudeRatioUnit); return true; case AngleUnit angleUnit: - quantity = Angle.From(value, angleUnit); + quantity = Angle.From(value, angleUnit); return true; case ApparentEnergyUnit apparentEnergyUnit: - quantity = ApparentEnergy.From(value, apparentEnergyUnit); + quantity = ApparentEnergy.From(value, apparentEnergyUnit); return true; case ApparentPowerUnit apparentPowerUnit: - quantity = ApparentPower.From(value, apparentPowerUnit); + quantity = ApparentPower.From(value, apparentPowerUnit); return true; case AreaUnit areaUnit: - quantity = Area.From(value, areaUnit); + quantity = Area.From(value, areaUnit); return true; case AreaDensityUnit areaDensityUnit: - quantity = AreaDensity.From(value, areaDensityUnit); + quantity = AreaDensity.From(value, areaDensityUnit); return true; case AreaMomentOfInertiaUnit areaMomentOfInertiaUnit: - quantity = AreaMomentOfInertia.From(value, areaMomentOfInertiaUnit); + quantity = AreaMomentOfInertia.From(value, areaMomentOfInertiaUnit); return true; case BitRateUnit bitRateUnit: - quantity = BitRate.From(value, bitRateUnit); + quantity = BitRate.From(value, bitRateUnit); return true; case BrakeSpecificFuelConsumptionUnit brakeSpecificFuelConsumptionUnit: - quantity = BrakeSpecificFuelConsumption.From(value, brakeSpecificFuelConsumptionUnit); + quantity = BrakeSpecificFuelConsumption.From(value, brakeSpecificFuelConsumptionUnit); return true; case CapacitanceUnit capacitanceUnit: - quantity = Capacitance.From(value, capacitanceUnit); + quantity = Capacitance.From(value, capacitanceUnit); return true; case CoefficientOfThermalExpansionUnit coefficientOfThermalExpansionUnit: - quantity = CoefficientOfThermalExpansion.From(value, coefficientOfThermalExpansionUnit); + quantity = CoefficientOfThermalExpansion.From(value, coefficientOfThermalExpansionUnit); return true; case DensityUnit densityUnit: - quantity = Density.From(value, densityUnit); + quantity = Density.From(value, densityUnit); return true; case DurationUnit durationUnit: - quantity = Duration.From(value, durationUnit); + quantity = Duration.From(value, durationUnit); return true; case DynamicViscosityUnit dynamicViscosityUnit: - quantity = DynamicViscosity.From(value, dynamicViscosityUnit); + quantity = DynamicViscosity.From(value, dynamicViscosityUnit); return true; case ElectricAdmittanceUnit electricAdmittanceUnit: - quantity = ElectricAdmittance.From(value, electricAdmittanceUnit); + quantity = ElectricAdmittance.From(value, electricAdmittanceUnit); return true; case ElectricChargeUnit electricChargeUnit: - quantity = ElectricCharge.From(value, electricChargeUnit); + quantity = ElectricCharge.From(value, electricChargeUnit); return true; case ElectricChargeDensityUnit electricChargeDensityUnit: - quantity = ElectricChargeDensity.From(value, electricChargeDensityUnit); + quantity = ElectricChargeDensity.From(value, electricChargeDensityUnit); return true; case ElectricConductanceUnit electricConductanceUnit: - quantity = ElectricConductance.From(value, electricConductanceUnit); + quantity = ElectricConductance.From(value, electricConductanceUnit); return true; case ElectricConductivityUnit electricConductivityUnit: - quantity = ElectricConductivity.From(value, electricConductivityUnit); + quantity = ElectricConductivity.From(value, electricConductivityUnit); return true; case ElectricCurrentUnit electricCurrentUnit: - quantity = ElectricCurrent.From(value, electricCurrentUnit); + quantity = ElectricCurrent.From(value, electricCurrentUnit); return true; case ElectricCurrentDensityUnit electricCurrentDensityUnit: - quantity = ElectricCurrentDensity.From(value, electricCurrentDensityUnit); + quantity = ElectricCurrentDensity.From(value, electricCurrentDensityUnit); return true; case ElectricCurrentGradientUnit electricCurrentGradientUnit: - quantity = ElectricCurrentGradient.From(value, electricCurrentGradientUnit); + quantity = ElectricCurrentGradient.From(value, electricCurrentGradientUnit); return true; case ElectricFieldUnit electricFieldUnit: - quantity = ElectricField.From(value, electricFieldUnit); + quantity = ElectricField.From(value, electricFieldUnit); return true; case ElectricInductanceUnit electricInductanceUnit: - quantity = ElectricInductance.From(value, electricInductanceUnit); + quantity = ElectricInductance.From(value, electricInductanceUnit); return true; case ElectricPotentialUnit electricPotentialUnit: - quantity = ElectricPotential.From(value, electricPotentialUnit); + quantity = ElectricPotential.From(value, electricPotentialUnit); return true; case ElectricPotentialAcUnit electricPotentialAcUnit: - quantity = ElectricPotentialAc.From(value, electricPotentialAcUnit); + quantity = ElectricPotentialAc.From(value, electricPotentialAcUnit); return true; case ElectricPotentialDcUnit electricPotentialDcUnit: - quantity = ElectricPotentialDc.From(value, electricPotentialDcUnit); + quantity = ElectricPotentialDc.From(value, electricPotentialDcUnit); return true; case ElectricResistanceUnit electricResistanceUnit: - quantity = ElectricResistance.From(value, electricResistanceUnit); + quantity = ElectricResistance.From(value, electricResistanceUnit); return true; case ElectricResistivityUnit electricResistivityUnit: - quantity = ElectricResistivity.From(value, electricResistivityUnit); + quantity = ElectricResistivity.From(value, electricResistivityUnit); return true; case ElectricSurfaceChargeDensityUnit electricSurfaceChargeDensityUnit: - quantity = ElectricSurfaceChargeDensity.From(value, electricSurfaceChargeDensityUnit); + quantity = ElectricSurfaceChargeDensity.From(value, electricSurfaceChargeDensityUnit); return true; case EnergyUnit energyUnit: - quantity = Energy.From(value, energyUnit); + quantity = Energy.From(value, energyUnit); return true; case EntropyUnit entropyUnit: - quantity = Entropy.From(value, entropyUnit); + quantity = Entropy.From(value, entropyUnit); return true; case ForceUnit forceUnit: - quantity = Force.From(value, forceUnit); + quantity = Force.From(value, forceUnit); return true; case ForceChangeRateUnit forceChangeRateUnit: - quantity = ForceChangeRate.From(value, forceChangeRateUnit); + quantity = ForceChangeRate.From(value, forceChangeRateUnit); return true; case ForcePerLengthUnit forcePerLengthUnit: - quantity = ForcePerLength.From(value, forcePerLengthUnit); + quantity = ForcePerLength.From(value, forcePerLengthUnit); return true; case FrequencyUnit frequencyUnit: - quantity = Frequency.From(value, frequencyUnit); + quantity = Frequency.From(value, frequencyUnit); return true; case FuelEfficiencyUnit fuelEfficiencyUnit: - quantity = FuelEfficiency.From(value, fuelEfficiencyUnit); + quantity = FuelEfficiency.From(value, fuelEfficiencyUnit); return true; case HeatFluxUnit heatFluxUnit: - quantity = HeatFlux.From(value, heatFluxUnit); + quantity = HeatFlux.From(value, heatFluxUnit); return true; case HeatTransferCoefficientUnit heatTransferCoefficientUnit: - quantity = HeatTransferCoefficient.From(value, heatTransferCoefficientUnit); + quantity = HeatTransferCoefficient.From(value, heatTransferCoefficientUnit); return true; case IlluminanceUnit illuminanceUnit: - quantity = Illuminance.From(value, illuminanceUnit); + quantity = Illuminance.From(value, illuminanceUnit); return true; case InformationUnit informationUnit: - quantity = Information.From(value, informationUnit); + quantity = Information.From(value, informationUnit); return true; case IrradianceUnit irradianceUnit: - quantity = Irradiance.From(value, irradianceUnit); + quantity = Irradiance.From(value, irradianceUnit); return true; case IrradiationUnit irradiationUnit: - quantity = Irradiation.From(value, irradiationUnit); + quantity = Irradiation.From(value, irradiationUnit); return true; case KinematicViscosityUnit kinematicViscosityUnit: - quantity = KinematicViscosity.From(value, kinematicViscosityUnit); + quantity = KinematicViscosity.From(value, kinematicViscosityUnit); return true; case LapseRateUnit lapseRateUnit: - quantity = LapseRate.From(value, lapseRateUnit); + quantity = LapseRate.From(value, lapseRateUnit); return true; case LengthUnit lengthUnit: - quantity = Length.From(value, lengthUnit); + quantity = Length.From(value, lengthUnit); return true; case LevelUnit levelUnit: - quantity = Level.From(value, levelUnit); + quantity = Level.From(value, levelUnit); return true; case LinearDensityUnit linearDensityUnit: - quantity = LinearDensity.From(value, linearDensityUnit); + quantity = LinearDensity.From(value, linearDensityUnit); return true; case LuminosityUnit luminosityUnit: - quantity = Luminosity.From(value, luminosityUnit); + quantity = Luminosity.From(value, luminosityUnit); return true; case LuminousFluxUnit luminousFluxUnit: - quantity = LuminousFlux.From(value, luminousFluxUnit); + quantity = LuminousFlux.From(value, luminousFluxUnit); return true; case LuminousIntensityUnit luminousIntensityUnit: - quantity = LuminousIntensity.From(value, luminousIntensityUnit); + quantity = LuminousIntensity.From(value, luminousIntensityUnit); return true; case MagneticFieldUnit magneticFieldUnit: - quantity = MagneticField.From(value, magneticFieldUnit); + quantity = MagneticField.From(value, magneticFieldUnit); return true; case MagneticFluxUnit magneticFluxUnit: - quantity = MagneticFlux.From(value, magneticFluxUnit); + quantity = MagneticFlux.From(value, magneticFluxUnit); return true; case MagnetizationUnit magnetizationUnit: - quantity = Magnetization.From(value, magnetizationUnit); + quantity = Magnetization.From(value, magnetizationUnit); return true; case MassUnit massUnit: - quantity = Mass.From(value, massUnit); + quantity = Mass.From(value, massUnit); return true; case MassConcentrationUnit massConcentrationUnit: - quantity = MassConcentration.From(value, massConcentrationUnit); + quantity = MassConcentration.From(value, massConcentrationUnit); return true; case MassFlowUnit massFlowUnit: - quantity = MassFlow.From(value, massFlowUnit); + quantity = MassFlow.From(value, massFlowUnit); return true; case MassFluxUnit massFluxUnit: - quantity = MassFlux.From(value, massFluxUnit); + quantity = MassFlux.From(value, massFluxUnit); return true; case MassFractionUnit massFractionUnit: - quantity = MassFraction.From(value, massFractionUnit); + quantity = MassFraction.From(value, massFractionUnit); return true; case MassMomentOfInertiaUnit massMomentOfInertiaUnit: - quantity = MassMomentOfInertia.From(value, massMomentOfInertiaUnit); + quantity = MassMomentOfInertia.From(value, massMomentOfInertiaUnit); return true; case MolarEnergyUnit molarEnergyUnit: - quantity = MolarEnergy.From(value, molarEnergyUnit); + quantity = MolarEnergy.From(value, molarEnergyUnit); return true; case MolarEntropyUnit molarEntropyUnit: - quantity = MolarEntropy.From(value, molarEntropyUnit); + quantity = MolarEntropy.From(value, molarEntropyUnit); return true; case MolarityUnit molarityUnit: - quantity = Molarity.From(value, molarityUnit); + quantity = Molarity.From(value, molarityUnit); return true; case MolarMassUnit molarMassUnit: - quantity = MolarMass.From(value, molarMassUnit); + quantity = MolarMass.From(value, molarMassUnit); return true; case PermeabilityUnit permeabilityUnit: - quantity = Permeability.From(value, permeabilityUnit); + quantity = Permeability.From(value, permeabilityUnit); return true; case PermittivityUnit permittivityUnit: - quantity = Permittivity.From(value, permittivityUnit); + quantity = Permittivity.From(value, permittivityUnit); return true; case PowerUnit powerUnit: - quantity = Power.From(value, powerUnit); + quantity = Power.From(value, powerUnit); return true; case PowerDensityUnit powerDensityUnit: - quantity = PowerDensity.From(value, powerDensityUnit); + quantity = PowerDensity.From(value, powerDensityUnit); return true; case PowerRatioUnit powerRatioUnit: - quantity = PowerRatio.From(value, powerRatioUnit); + quantity = PowerRatio.From(value, powerRatioUnit); return true; case PressureUnit pressureUnit: - quantity = Pressure.From(value, pressureUnit); + quantity = Pressure.From(value, pressureUnit); return true; case PressureChangeRateUnit pressureChangeRateUnit: - quantity = PressureChangeRate.From(value, pressureChangeRateUnit); + quantity = PressureChangeRate.From(value, pressureChangeRateUnit); return true; case RatioUnit ratioUnit: - quantity = Ratio.From(value, ratioUnit); + quantity = Ratio.From(value, ratioUnit); return true; case RatioChangeRateUnit ratioChangeRateUnit: - quantity = RatioChangeRate.From(value, ratioChangeRateUnit); + quantity = RatioChangeRate.From(value, ratioChangeRateUnit); return true; case ReactiveEnergyUnit reactiveEnergyUnit: - quantity = ReactiveEnergy.From(value, reactiveEnergyUnit); + quantity = ReactiveEnergy.From(value, reactiveEnergyUnit); return true; case ReactivePowerUnit reactivePowerUnit: - quantity = ReactivePower.From(value, reactivePowerUnit); + quantity = ReactivePower.From(value, reactivePowerUnit); return true; case RotationalAccelerationUnit rotationalAccelerationUnit: - quantity = RotationalAcceleration.From(value, rotationalAccelerationUnit); + quantity = RotationalAcceleration.From(value, rotationalAccelerationUnit); return true; case RotationalSpeedUnit rotationalSpeedUnit: - quantity = RotationalSpeed.From(value, rotationalSpeedUnit); + quantity = RotationalSpeed.From(value, rotationalSpeedUnit); return true; case RotationalStiffnessUnit rotationalStiffnessUnit: - quantity = RotationalStiffness.From(value, rotationalStiffnessUnit); + quantity = RotationalStiffness.From(value, rotationalStiffnessUnit); return true; case RotationalStiffnessPerLengthUnit rotationalStiffnessPerLengthUnit: - quantity = RotationalStiffnessPerLength.From(value, rotationalStiffnessPerLengthUnit); + quantity = RotationalStiffnessPerLength.From(value, rotationalStiffnessPerLengthUnit); return true; case SolidAngleUnit solidAngleUnit: - quantity = SolidAngle.From(value, solidAngleUnit); + quantity = SolidAngle.From(value, solidAngleUnit); return true; case SpecificEnergyUnit specificEnergyUnit: - quantity = SpecificEnergy.From(value, specificEnergyUnit); + quantity = SpecificEnergy.From(value, specificEnergyUnit); return true; case SpecificEntropyUnit specificEntropyUnit: - quantity = SpecificEntropy.From(value, specificEntropyUnit); + quantity = SpecificEntropy.From(value, specificEntropyUnit); return true; case SpecificVolumeUnit specificVolumeUnit: - quantity = SpecificVolume.From(value, specificVolumeUnit); + quantity = SpecificVolume.From(value, specificVolumeUnit); return true; case SpecificWeightUnit specificWeightUnit: - quantity = SpecificWeight.From(value, specificWeightUnit); + quantity = SpecificWeight.From(value, specificWeightUnit); return true; case SpeedUnit speedUnit: - quantity = Speed.From(value, speedUnit); + quantity = Speed.From(value, speedUnit); return true; case TemperatureUnit temperatureUnit: - quantity = Temperature.From(value, temperatureUnit); + quantity = Temperature.From(value, temperatureUnit); return true; case TemperatureChangeRateUnit temperatureChangeRateUnit: - quantity = TemperatureChangeRate.From(value, temperatureChangeRateUnit); + quantity = TemperatureChangeRate.From(value, temperatureChangeRateUnit); return true; case TemperatureDeltaUnit temperatureDeltaUnit: - quantity = TemperatureDelta.From(value, temperatureDeltaUnit); + quantity = TemperatureDelta.From(value, temperatureDeltaUnit); return true; case ThermalConductivityUnit thermalConductivityUnit: - quantity = ThermalConductivity.From(value, thermalConductivityUnit); + quantity = ThermalConductivity.From(value, thermalConductivityUnit); return true; case ThermalResistanceUnit thermalResistanceUnit: - quantity = ThermalResistance.From(value, thermalResistanceUnit); + quantity = ThermalResistance.From(value, thermalResistanceUnit); return true; case TorqueUnit torqueUnit: - quantity = Torque.From(value, torqueUnit); + quantity = Torque.From(value, torqueUnit); return true; case VitaminAUnit vitaminAUnit: - quantity = VitaminA.From(value, vitaminAUnit); + quantity = VitaminA.From(value, vitaminAUnit); return true; case VolumeUnit volumeUnit: - quantity = Volume.From(value, volumeUnit); + quantity = Volume.From(value, volumeUnit); return true; case VolumeConcentrationUnit volumeConcentrationUnit: - quantity = VolumeConcentration.From(value, volumeConcentrationUnit); + quantity = VolumeConcentration.From(value, volumeConcentrationUnit); return true; case VolumeFlowUnit volumeFlowUnit: - quantity = VolumeFlow.From(value, volumeFlowUnit); + quantity = VolumeFlow.From(value, volumeFlowUnit); return true; case VolumePerLengthUnit volumePerLengthUnit: - quantity = VolumePerLength.From(value, volumePerLengthUnit); + quantity = VolumePerLength.From(value, volumePerLengthUnit); return true; default: { @@ -558,11 +558,11 @@ public static bool TryFrom(QuantityValue value, Enum unit, out IQuantity quantit /// Try to dynamically parse a quantity string representation. /// /// The format provider to use for lookup. Defaults to if null. - /// Type of quantity, such as . + /// Type of quantity, such as . /// Quantity string representation, such as "1.5 kg". Must be compatible with given quantity type. /// The resulting quantity if successful, otherwise default. /// The parsed quantity. - public static bool TryParse([CanBeNull] IFormatProvider formatProvider, Type quantityType, string quantityString, out IQuantity quantity) + public static bool TryParse([CanBeNull] IFormatProvider formatProvider, Type quantityType, string quantityString, out IQuantity quantity) { quantity = default(IQuantity); @@ -573,202 +573,202 @@ public static bool TryParse([CanBeNull] IFormatProvider formatProvider, Type qua switch(quantityType) { - case Type _ when quantityType == typeof(Acceleration): - return parser.TryParse(quantityString, formatProvider, Acceleration.From, out quantity); - case Type _ when quantityType == typeof(AmountOfSubstance): - return parser.TryParse(quantityString, formatProvider, AmountOfSubstance.From, out quantity); - case Type _ when quantityType == typeof(AmplitudeRatio): - return parser.TryParse(quantityString, formatProvider, AmplitudeRatio.From, out quantity); - case Type _ when quantityType == typeof(Angle): - return parser.TryParse(quantityString, formatProvider, Angle.From, out quantity); - case Type _ when quantityType == typeof(ApparentEnergy): - return parser.TryParse(quantityString, formatProvider, ApparentEnergy.From, out quantity); - case Type _ when quantityType == typeof(ApparentPower): - return parser.TryParse(quantityString, formatProvider, ApparentPower.From, out quantity); - case Type _ when quantityType == typeof(Area): - return parser.TryParse(quantityString, formatProvider, Area.From, out quantity); - case Type _ when quantityType == typeof(AreaDensity): - return parser.TryParse(quantityString, formatProvider, AreaDensity.From, out quantity); - case Type _ when quantityType == typeof(AreaMomentOfInertia): - return parser.TryParse(quantityString, formatProvider, AreaMomentOfInertia.From, out quantity); - case Type _ when quantityType == typeof(BitRate): - return parser.TryParse(quantityString, formatProvider, BitRate.From, out quantity); - case Type _ when quantityType == typeof(BrakeSpecificFuelConsumption): - return parser.TryParse(quantityString, formatProvider, BrakeSpecificFuelConsumption.From, out quantity); - case Type _ when quantityType == typeof(Capacitance): - return parser.TryParse(quantityString, formatProvider, Capacitance.From, out quantity); - case Type _ when quantityType == typeof(CoefficientOfThermalExpansion): - return parser.TryParse(quantityString, formatProvider, CoefficientOfThermalExpansion.From, out quantity); - case Type _ when quantityType == typeof(Density): - return parser.TryParse(quantityString, formatProvider, Density.From, out quantity); - case Type _ when quantityType == typeof(Duration): - return parser.TryParse(quantityString, formatProvider, Duration.From, out quantity); - case Type _ when quantityType == typeof(DynamicViscosity): - return parser.TryParse(quantityString, formatProvider, DynamicViscosity.From, out quantity); - case Type _ when quantityType == typeof(ElectricAdmittance): - return parser.TryParse(quantityString, formatProvider, ElectricAdmittance.From, out quantity); - case Type _ when quantityType == typeof(ElectricCharge): - return parser.TryParse(quantityString, formatProvider, ElectricCharge.From, out quantity); - case Type _ when quantityType == typeof(ElectricChargeDensity): - return parser.TryParse(quantityString, formatProvider, ElectricChargeDensity.From, out quantity); - case Type _ when quantityType == typeof(ElectricConductance): - return parser.TryParse(quantityString, formatProvider, ElectricConductance.From, out quantity); - case Type _ when quantityType == typeof(ElectricConductivity): - return parser.TryParse(quantityString, formatProvider, ElectricConductivity.From, out quantity); - case Type _ when quantityType == typeof(ElectricCurrent): - return parser.TryParse(quantityString, formatProvider, ElectricCurrent.From, out quantity); - case Type _ when quantityType == typeof(ElectricCurrentDensity): - return parser.TryParse(quantityString, formatProvider, ElectricCurrentDensity.From, out quantity); - case Type _ when quantityType == typeof(ElectricCurrentGradient): - return parser.TryParse(quantityString, formatProvider, ElectricCurrentGradient.From, out quantity); - case Type _ when quantityType == typeof(ElectricField): - return parser.TryParse(quantityString, formatProvider, ElectricField.From, out quantity); - case Type _ when quantityType == typeof(ElectricInductance): - return parser.TryParse(quantityString, formatProvider, ElectricInductance.From, out quantity); - case Type _ when quantityType == typeof(ElectricPotential): - return parser.TryParse(quantityString, formatProvider, ElectricPotential.From, out quantity); - case Type _ when quantityType == typeof(ElectricPotentialAc): - return parser.TryParse(quantityString, formatProvider, ElectricPotentialAc.From, out quantity); - case Type _ when quantityType == typeof(ElectricPotentialDc): - return parser.TryParse(quantityString, formatProvider, ElectricPotentialDc.From, out quantity); - case Type _ when quantityType == typeof(ElectricResistance): - return parser.TryParse(quantityString, formatProvider, ElectricResistance.From, out quantity); - case Type _ when quantityType == typeof(ElectricResistivity): - return parser.TryParse(quantityString, formatProvider, ElectricResistivity.From, out quantity); - case Type _ when quantityType == typeof(ElectricSurfaceChargeDensity): - return parser.TryParse(quantityString, formatProvider, ElectricSurfaceChargeDensity.From, out quantity); - case Type _ when quantityType == typeof(Energy): - return parser.TryParse(quantityString, formatProvider, Energy.From, out quantity); - case Type _ when quantityType == typeof(Entropy): - return parser.TryParse(quantityString, formatProvider, Entropy.From, out quantity); - case Type _ when quantityType == typeof(Force): - return parser.TryParse(quantityString, formatProvider, Force.From, out quantity); - case Type _ when quantityType == typeof(ForceChangeRate): - return parser.TryParse(quantityString, formatProvider, ForceChangeRate.From, out quantity); - case Type _ when quantityType == typeof(ForcePerLength): - return parser.TryParse(quantityString, formatProvider, ForcePerLength.From, out quantity); - case Type _ when quantityType == typeof(Frequency): - return parser.TryParse(quantityString, formatProvider, Frequency.From, out quantity); - case Type _ when quantityType == typeof(FuelEfficiency): - return parser.TryParse(quantityString, formatProvider, FuelEfficiency.From, out quantity); - case Type _ when quantityType == typeof(HeatFlux): - return parser.TryParse(quantityString, formatProvider, HeatFlux.From, out quantity); - case Type _ when quantityType == typeof(HeatTransferCoefficient): - return parser.TryParse(quantityString, formatProvider, HeatTransferCoefficient.From, out quantity); - case Type _ when quantityType == typeof(Illuminance): - return parser.TryParse(quantityString, formatProvider, Illuminance.From, out quantity); - case Type _ when quantityType == typeof(Information): - return parser.TryParse(quantityString, formatProvider, Information.From, out quantity); - case Type _ when quantityType == typeof(Irradiance): - return parser.TryParse(quantityString, formatProvider, Irradiance.From, out quantity); - case Type _ when quantityType == typeof(Irradiation): - return parser.TryParse(quantityString, formatProvider, Irradiation.From, out quantity); - case Type _ when quantityType == typeof(KinematicViscosity): - return parser.TryParse(quantityString, formatProvider, KinematicViscosity.From, out quantity); - case Type _ when quantityType == typeof(LapseRate): - return parser.TryParse(quantityString, formatProvider, LapseRate.From, out quantity); - case Type _ when quantityType == typeof(Length): - return parser.TryParse(quantityString, formatProvider, Length.From, out quantity); - case Type _ when quantityType == typeof(Level): - return parser.TryParse(quantityString, formatProvider, Level.From, out quantity); - case Type _ when quantityType == typeof(LinearDensity): - return parser.TryParse(quantityString, formatProvider, LinearDensity.From, out quantity); - case Type _ when quantityType == typeof(Luminosity): - return parser.TryParse(quantityString, formatProvider, Luminosity.From, out quantity); - case Type _ when quantityType == typeof(LuminousFlux): - return parser.TryParse(quantityString, formatProvider, LuminousFlux.From, out quantity); - case Type _ when quantityType == typeof(LuminousIntensity): - return parser.TryParse(quantityString, formatProvider, LuminousIntensity.From, out quantity); - case Type _ when quantityType == typeof(MagneticField): - return parser.TryParse(quantityString, formatProvider, MagneticField.From, out quantity); - case Type _ when quantityType == typeof(MagneticFlux): - return parser.TryParse(quantityString, formatProvider, MagneticFlux.From, out quantity); - case Type _ when quantityType == typeof(Magnetization): - return parser.TryParse(quantityString, formatProvider, Magnetization.From, out quantity); - case Type _ when quantityType == typeof(Mass): - return parser.TryParse(quantityString, formatProvider, Mass.From, out quantity); - case Type _ when quantityType == typeof(MassConcentration): - return parser.TryParse(quantityString, formatProvider, MassConcentration.From, out quantity); - case Type _ when quantityType == typeof(MassFlow): - return parser.TryParse(quantityString, formatProvider, MassFlow.From, out quantity); - case Type _ when quantityType == typeof(MassFlux): - return parser.TryParse(quantityString, formatProvider, MassFlux.From, out quantity); - case Type _ when quantityType == typeof(MassFraction): - return parser.TryParse(quantityString, formatProvider, MassFraction.From, out quantity); - case Type _ when quantityType == typeof(MassMomentOfInertia): - return parser.TryParse(quantityString, formatProvider, MassMomentOfInertia.From, out quantity); - case Type _ when quantityType == typeof(MolarEnergy): - return parser.TryParse(quantityString, formatProvider, MolarEnergy.From, out quantity); - case Type _ when quantityType == typeof(MolarEntropy): - return parser.TryParse(quantityString, formatProvider, MolarEntropy.From, out quantity); - case Type _ when quantityType == typeof(Molarity): - return parser.TryParse(quantityString, formatProvider, Molarity.From, out quantity); - case Type _ when quantityType == typeof(MolarMass): - return parser.TryParse(quantityString, formatProvider, MolarMass.From, out quantity); - case Type _ when quantityType == typeof(Permeability): - return parser.TryParse(quantityString, formatProvider, Permeability.From, out quantity); - case Type _ when quantityType == typeof(Permittivity): - return parser.TryParse(quantityString, formatProvider, Permittivity.From, out quantity); - case Type _ when quantityType == typeof(Power): - return parser.TryParse(quantityString, formatProvider, Power.From, out quantity); - case Type _ when quantityType == typeof(PowerDensity): - return parser.TryParse(quantityString, formatProvider, PowerDensity.From, out quantity); - case Type _ when quantityType == typeof(PowerRatio): - return parser.TryParse(quantityString, formatProvider, PowerRatio.From, out quantity); - case Type _ when quantityType == typeof(Pressure): - return parser.TryParse(quantityString, formatProvider, Pressure.From, out quantity); - case Type _ when quantityType == typeof(PressureChangeRate): - return parser.TryParse(quantityString, formatProvider, PressureChangeRate.From, out quantity); - case Type _ when quantityType == typeof(Ratio): - return parser.TryParse(quantityString, formatProvider, Ratio.From, out quantity); - case Type _ when quantityType == typeof(RatioChangeRate): - return parser.TryParse(quantityString, formatProvider, RatioChangeRate.From, out quantity); - case Type _ when quantityType == typeof(ReactiveEnergy): - return parser.TryParse(quantityString, formatProvider, ReactiveEnergy.From, out quantity); - case Type _ when quantityType == typeof(ReactivePower): - return parser.TryParse(quantityString, formatProvider, ReactivePower.From, out quantity); - case Type _ when quantityType == typeof(RotationalAcceleration): - return parser.TryParse(quantityString, formatProvider, RotationalAcceleration.From, out quantity); - case Type _ when quantityType == typeof(RotationalSpeed): - return parser.TryParse(quantityString, formatProvider, RotationalSpeed.From, out quantity); - case Type _ when quantityType == typeof(RotationalStiffness): - return parser.TryParse(quantityString, formatProvider, RotationalStiffness.From, out quantity); - case Type _ when quantityType == typeof(RotationalStiffnessPerLength): - return parser.TryParse(quantityString, formatProvider, RotationalStiffnessPerLength.From, out quantity); - case Type _ when quantityType == typeof(SolidAngle): - return parser.TryParse(quantityString, formatProvider, SolidAngle.From, out quantity); - case Type _ when quantityType == typeof(SpecificEnergy): - return parser.TryParse(quantityString, formatProvider, SpecificEnergy.From, out quantity); - case Type _ when quantityType == typeof(SpecificEntropy): - return parser.TryParse(quantityString, formatProvider, SpecificEntropy.From, out quantity); - case Type _ when quantityType == typeof(SpecificVolume): - return parser.TryParse(quantityString, formatProvider, SpecificVolume.From, out quantity); - case Type _ when quantityType == typeof(SpecificWeight): - return parser.TryParse(quantityString, formatProvider, SpecificWeight.From, out quantity); - case Type _ when quantityType == typeof(Speed): - return parser.TryParse(quantityString, formatProvider, Speed.From, out quantity); - case Type _ when quantityType == typeof(Temperature): - return parser.TryParse(quantityString, formatProvider, Temperature.From, out quantity); - case Type _ when quantityType == typeof(TemperatureChangeRate): - return parser.TryParse(quantityString, formatProvider, TemperatureChangeRate.From, out quantity); - case Type _ when quantityType == typeof(TemperatureDelta): - return parser.TryParse(quantityString, formatProvider, TemperatureDelta.From, out quantity); - case Type _ when quantityType == typeof(ThermalConductivity): - return parser.TryParse(quantityString, formatProvider, ThermalConductivity.From, out quantity); - case Type _ when quantityType == typeof(ThermalResistance): - return parser.TryParse(quantityString, formatProvider, ThermalResistance.From, out quantity); - case Type _ when quantityType == typeof(Torque): - return parser.TryParse(quantityString, formatProvider, Torque.From, out quantity); - case Type _ when quantityType == typeof(VitaminA): - return parser.TryParse(quantityString, formatProvider, VitaminA.From, out quantity); - case Type _ when quantityType == typeof(Volume): - return parser.TryParse(quantityString, formatProvider, Volume.From, out quantity); - case Type _ when quantityType == typeof(VolumeConcentration): - return parser.TryParse(quantityString, formatProvider, VolumeConcentration.From, out quantity); - case Type _ when quantityType == typeof(VolumeFlow): - return parser.TryParse(quantityString, formatProvider, VolumeFlow.From, out quantity); - case Type _ when quantityType == typeof(VolumePerLength): - return parser.TryParse(quantityString, formatProvider, VolumePerLength.From, out quantity); + case Type _ when quantityType == typeof(Acceleration): + return parser.TryParse, AccelerationUnit>(quantityString, formatProvider, Acceleration.From, out quantity); + case Type _ when quantityType == typeof(AmountOfSubstance): + return parser.TryParse, AmountOfSubstanceUnit>(quantityString, formatProvider, AmountOfSubstance.From, out quantity); + case Type _ when quantityType == typeof(AmplitudeRatio): + return parser.TryParse, AmplitudeRatioUnit>(quantityString, formatProvider, AmplitudeRatio.From, out quantity); + case Type _ when quantityType == typeof(Angle): + return parser.TryParse, AngleUnit>(quantityString, formatProvider, Angle.From, out quantity); + case Type _ when quantityType == typeof(ApparentEnergy): + return parser.TryParse, ApparentEnergyUnit>(quantityString, formatProvider, ApparentEnergy.From, out quantity); + case Type _ when quantityType == typeof(ApparentPower): + return parser.TryParse, ApparentPowerUnit>(quantityString, formatProvider, ApparentPower.From, out quantity); + case Type _ when quantityType == typeof(Area): + return parser.TryParse, AreaUnit>(quantityString, formatProvider, Area.From, out quantity); + case Type _ when quantityType == typeof(AreaDensity): + return parser.TryParse, AreaDensityUnit>(quantityString, formatProvider, AreaDensity.From, out quantity); + case Type _ when quantityType == typeof(AreaMomentOfInertia): + return parser.TryParse, AreaMomentOfInertiaUnit>(quantityString, formatProvider, AreaMomentOfInertia.From, out quantity); + case Type _ when quantityType == typeof(BitRate): + return parser.TryParse, BitRateUnit>(quantityString, formatProvider, BitRate.From, out quantity); + case Type _ when quantityType == typeof(BrakeSpecificFuelConsumption): + return parser.TryParse, BrakeSpecificFuelConsumptionUnit>(quantityString, formatProvider, BrakeSpecificFuelConsumption.From, out quantity); + case Type _ when quantityType == typeof(Capacitance): + return parser.TryParse, CapacitanceUnit>(quantityString, formatProvider, Capacitance.From, out quantity); + case Type _ when quantityType == typeof(CoefficientOfThermalExpansion): + return parser.TryParse, CoefficientOfThermalExpansionUnit>(quantityString, formatProvider, CoefficientOfThermalExpansion.From, out quantity); + case Type _ when quantityType == typeof(Density): + return parser.TryParse, DensityUnit>(quantityString, formatProvider, Density.From, out quantity); + case Type _ when quantityType == typeof(Duration): + return parser.TryParse, DurationUnit>(quantityString, formatProvider, Duration.From, out quantity); + case Type _ when quantityType == typeof(DynamicViscosity): + return parser.TryParse, DynamicViscosityUnit>(quantityString, formatProvider, DynamicViscosity.From, out quantity); + case Type _ when quantityType == typeof(ElectricAdmittance): + return parser.TryParse, ElectricAdmittanceUnit>(quantityString, formatProvider, ElectricAdmittance.From, out quantity); + case Type _ when quantityType == typeof(ElectricCharge): + return parser.TryParse, ElectricChargeUnit>(quantityString, formatProvider, ElectricCharge.From, out quantity); + case Type _ when quantityType == typeof(ElectricChargeDensity): + return parser.TryParse, ElectricChargeDensityUnit>(quantityString, formatProvider, ElectricChargeDensity.From, out quantity); + case Type _ when quantityType == typeof(ElectricConductance): + return parser.TryParse, ElectricConductanceUnit>(quantityString, formatProvider, ElectricConductance.From, out quantity); + case Type _ when quantityType == typeof(ElectricConductivity): + return parser.TryParse, ElectricConductivityUnit>(quantityString, formatProvider, ElectricConductivity.From, out quantity); + case Type _ when quantityType == typeof(ElectricCurrent): + return parser.TryParse, ElectricCurrentUnit>(quantityString, formatProvider, ElectricCurrent.From, out quantity); + case Type _ when quantityType == typeof(ElectricCurrentDensity): + return parser.TryParse, ElectricCurrentDensityUnit>(quantityString, formatProvider, ElectricCurrentDensity.From, out quantity); + case Type _ when quantityType == typeof(ElectricCurrentGradient): + return parser.TryParse, ElectricCurrentGradientUnit>(quantityString, formatProvider, ElectricCurrentGradient.From, out quantity); + case Type _ when quantityType == typeof(ElectricField): + return parser.TryParse, ElectricFieldUnit>(quantityString, formatProvider, ElectricField.From, out quantity); + case Type _ when quantityType == typeof(ElectricInductance): + return parser.TryParse, ElectricInductanceUnit>(quantityString, formatProvider, ElectricInductance.From, out quantity); + case Type _ when quantityType == typeof(ElectricPotential): + return parser.TryParse, ElectricPotentialUnit>(quantityString, formatProvider, ElectricPotential.From, out quantity); + case Type _ when quantityType == typeof(ElectricPotentialAc): + return parser.TryParse, ElectricPotentialAcUnit>(quantityString, formatProvider, ElectricPotentialAc.From, out quantity); + case Type _ when quantityType == typeof(ElectricPotentialDc): + return parser.TryParse, ElectricPotentialDcUnit>(quantityString, formatProvider, ElectricPotentialDc.From, out quantity); + case Type _ when quantityType == typeof(ElectricResistance): + return parser.TryParse, ElectricResistanceUnit>(quantityString, formatProvider, ElectricResistance.From, out quantity); + case Type _ when quantityType == typeof(ElectricResistivity): + return parser.TryParse, ElectricResistivityUnit>(quantityString, formatProvider, ElectricResistivity.From, out quantity); + case Type _ when quantityType == typeof(ElectricSurfaceChargeDensity): + return parser.TryParse, ElectricSurfaceChargeDensityUnit>(quantityString, formatProvider, ElectricSurfaceChargeDensity.From, out quantity); + case Type _ when quantityType == typeof(Energy): + return parser.TryParse, EnergyUnit>(quantityString, formatProvider, Energy.From, out quantity); + case Type _ when quantityType == typeof(Entropy): + return parser.TryParse, EntropyUnit>(quantityString, formatProvider, Entropy.From, out quantity); + case Type _ when quantityType == typeof(Force): + return parser.TryParse, ForceUnit>(quantityString, formatProvider, Force.From, out quantity); + case Type _ when quantityType == typeof(ForceChangeRate): + return parser.TryParse, ForceChangeRateUnit>(quantityString, formatProvider, ForceChangeRate.From, out quantity); + case Type _ when quantityType == typeof(ForcePerLength): + return parser.TryParse, ForcePerLengthUnit>(quantityString, formatProvider, ForcePerLength.From, out quantity); + case Type _ when quantityType == typeof(Frequency): + return parser.TryParse, FrequencyUnit>(quantityString, formatProvider, Frequency.From, out quantity); + case Type _ when quantityType == typeof(FuelEfficiency): + return parser.TryParse, FuelEfficiencyUnit>(quantityString, formatProvider, FuelEfficiency.From, out quantity); + case Type _ when quantityType == typeof(HeatFlux): + return parser.TryParse, HeatFluxUnit>(quantityString, formatProvider, HeatFlux.From, out quantity); + case Type _ when quantityType == typeof(HeatTransferCoefficient): + return parser.TryParse, HeatTransferCoefficientUnit>(quantityString, formatProvider, HeatTransferCoefficient.From, out quantity); + case Type _ when quantityType == typeof(Illuminance): + return parser.TryParse, IlluminanceUnit>(quantityString, formatProvider, Illuminance.From, out quantity); + case Type _ when quantityType == typeof(Information): + return parser.TryParse, InformationUnit>(quantityString, formatProvider, Information.From, out quantity); + case Type _ when quantityType == typeof(Irradiance): + return parser.TryParse, IrradianceUnit>(quantityString, formatProvider, Irradiance.From, out quantity); + case Type _ when quantityType == typeof(Irradiation): + return parser.TryParse, IrradiationUnit>(quantityString, formatProvider, Irradiation.From, out quantity); + case Type _ when quantityType == typeof(KinematicViscosity): + return parser.TryParse, KinematicViscosityUnit>(quantityString, formatProvider, KinematicViscosity.From, out quantity); + case Type _ when quantityType == typeof(LapseRate): + return parser.TryParse, LapseRateUnit>(quantityString, formatProvider, LapseRate.From, out quantity); + case Type _ when quantityType == typeof(Length): + return parser.TryParse, LengthUnit>(quantityString, formatProvider, Length.From, out quantity); + case Type _ when quantityType == typeof(Level): + return parser.TryParse, LevelUnit>(quantityString, formatProvider, Level.From, out quantity); + case Type _ when quantityType == typeof(LinearDensity): + return parser.TryParse, LinearDensityUnit>(quantityString, formatProvider, LinearDensity.From, out quantity); + case Type _ when quantityType == typeof(Luminosity): + return parser.TryParse, LuminosityUnit>(quantityString, formatProvider, Luminosity.From, out quantity); + case Type _ when quantityType == typeof(LuminousFlux): + return parser.TryParse, LuminousFluxUnit>(quantityString, formatProvider, LuminousFlux.From, out quantity); + case Type _ when quantityType == typeof(LuminousIntensity): + return parser.TryParse, LuminousIntensityUnit>(quantityString, formatProvider, LuminousIntensity.From, out quantity); + case Type _ when quantityType == typeof(MagneticField): + return parser.TryParse, MagneticFieldUnit>(quantityString, formatProvider, MagneticField.From, out quantity); + case Type _ when quantityType == typeof(MagneticFlux): + return parser.TryParse, MagneticFluxUnit>(quantityString, formatProvider, MagneticFlux.From, out quantity); + case Type _ when quantityType == typeof(Magnetization): + return parser.TryParse, MagnetizationUnit>(quantityString, formatProvider, Magnetization.From, out quantity); + case Type _ when quantityType == typeof(Mass): + return parser.TryParse, MassUnit>(quantityString, formatProvider, Mass.From, out quantity); + case Type _ when quantityType == typeof(MassConcentration): + return parser.TryParse, MassConcentrationUnit>(quantityString, formatProvider, MassConcentration.From, out quantity); + case Type _ when quantityType == typeof(MassFlow): + return parser.TryParse, MassFlowUnit>(quantityString, formatProvider, MassFlow.From, out quantity); + case Type _ when quantityType == typeof(MassFlux): + return parser.TryParse, MassFluxUnit>(quantityString, formatProvider, MassFlux.From, out quantity); + case Type _ when quantityType == typeof(MassFraction): + return parser.TryParse, MassFractionUnit>(quantityString, formatProvider, MassFraction.From, out quantity); + case Type _ when quantityType == typeof(MassMomentOfInertia): + return parser.TryParse, MassMomentOfInertiaUnit>(quantityString, formatProvider, MassMomentOfInertia.From, out quantity); + case Type _ when quantityType == typeof(MolarEnergy): + return parser.TryParse, MolarEnergyUnit>(quantityString, formatProvider, MolarEnergy.From, out quantity); + case Type _ when quantityType == typeof(MolarEntropy): + return parser.TryParse, MolarEntropyUnit>(quantityString, formatProvider, MolarEntropy.From, out quantity); + case Type _ when quantityType == typeof(Molarity): + return parser.TryParse, MolarityUnit>(quantityString, formatProvider, Molarity.From, out quantity); + case Type _ when quantityType == typeof(MolarMass): + return parser.TryParse, MolarMassUnit>(quantityString, formatProvider, MolarMass.From, out quantity); + case Type _ when quantityType == typeof(Permeability): + return parser.TryParse, PermeabilityUnit>(quantityString, formatProvider, Permeability.From, out quantity); + case Type _ when quantityType == typeof(Permittivity): + return parser.TryParse, PermittivityUnit>(quantityString, formatProvider, Permittivity.From, out quantity); + case Type _ when quantityType == typeof(Power): + return parser.TryParse, PowerUnit>(quantityString, formatProvider, Power.From, out quantity); + case Type _ when quantityType == typeof(PowerDensity): + return parser.TryParse, PowerDensityUnit>(quantityString, formatProvider, PowerDensity.From, out quantity); + case Type _ when quantityType == typeof(PowerRatio): + return parser.TryParse, PowerRatioUnit>(quantityString, formatProvider, PowerRatio.From, out quantity); + case Type _ when quantityType == typeof(Pressure): + return parser.TryParse, PressureUnit>(quantityString, formatProvider, Pressure.From, out quantity); + case Type _ when quantityType == typeof(PressureChangeRate): + return parser.TryParse, PressureChangeRateUnit>(quantityString, formatProvider, PressureChangeRate.From, out quantity); + case Type _ when quantityType == typeof(Ratio): + return parser.TryParse, RatioUnit>(quantityString, formatProvider, Ratio.From, out quantity); + case Type _ when quantityType == typeof(RatioChangeRate): + return parser.TryParse, RatioChangeRateUnit>(quantityString, formatProvider, RatioChangeRate.From, out quantity); + case Type _ when quantityType == typeof(ReactiveEnergy): + return parser.TryParse, ReactiveEnergyUnit>(quantityString, formatProvider, ReactiveEnergy.From, out quantity); + case Type _ when quantityType == typeof(ReactivePower): + return parser.TryParse, ReactivePowerUnit>(quantityString, formatProvider, ReactivePower.From, out quantity); + case Type _ when quantityType == typeof(RotationalAcceleration): + return parser.TryParse, RotationalAccelerationUnit>(quantityString, formatProvider, RotationalAcceleration.From, out quantity); + case Type _ when quantityType == typeof(RotationalSpeed): + return parser.TryParse, RotationalSpeedUnit>(quantityString, formatProvider, RotationalSpeed.From, out quantity); + case Type _ when quantityType == typeof(RotationalStiffness): + return parser.TryParse, RotationalStiffnessUnit>(quantityString, formatProvider, RotationalStiffness.From, out quantity); + case Type _ when quantityType == typeof(RotationalStiffnessPerLength): + return parser.TryParse, RotationalStiffnessPerLengthUnit>(quantityString, formatProvider, RotationalStiffnessPerLength.From, out quantity); + case Type _ when quantityType == typeof(SolidAngle): + return parser.TryParse, SolidAngleUnit>(quantityString, formatProvider, SolidAngle.From, out quantity); + case Type _ when quantityType == typeof(SpecificEnergy): + return parser.TryParse, SpecificEnergyUnit>(quantityString, formatProvider, SpecificEnergy.From, out quantity); + case Type _ when quantityType == typeof(SpecificEntropy): + return parser.TryParse, SpecificEntropyUnit>(quantityString, formatProvider, SpecificEntropy.From, out quantity); + case Type _ when quantityType == typeof(SpecificVolume): + return parser.TryParse, SpecificVolumeUnit>(quantityString, formatProvider, SpecificVolume.From, out quantity); + case Type _ when quantityType == typeof(SpecificWeight): + return parser.TryParse, SpecificWeightUnit>(quantityString, formatProvider, SpecificWeight.From, out quantity); + case Type _ when quantityType == typeof(Speed): + return parser.TryParse, SpeedUnit>(quantityString, formatProvider, Speed.From, out quantity); + case Type _ when quantityType == typeof(Temperature): + return parser.TryParse, TemperatureUnit>(quantityString, formatProvider, Temperature.From, out quantity); + case Type _ when quantityType == typeof(TemperatureChangeRate): + return parser.TryParse, TemperatureChangeRateUnit>(quantityString, formatProvider, TemperatureChangeRate.From, out quantity); + case Type _ when quantityType == typeof(TemperatureDelta): + return parser.TryParse, TemperatureDeltaUnit>(quantityString, formatProvider, TemperatureDelta.From, out quantity); + case Type _ when quantityType == typeof(ThermalConductivity): + return parser.TryParse, ThermalConductivityUnit>(quantityString, formatProvider, ThermalConductivity.From, out quantity); + case Type _ when quantityType == typeof(ThermalResistance): + return parser.TryParse, ThermalResistanceUnit>(quantityString, formatProvider, ThermalResistance.From, out quantity); + case Type _ when quantityType == typeof(Torque): + return parser.TryParse, TorqueUnit>(quantityString, formatProvider, Torque.From, out quantity); + case Type _ when quantityType == typeof(VitaminA): + return parser.TryParse, VitaminAUnit>(quantityString, formatProvider, VitaminA.From, out quantity); + case Type _ when quantityType == typeof(Volume): + return parser.TryParse, VolumeUnit>(quantityString, formatProvider, Volume.From, out quantity); + case Type _ when quantityType == typeof(VolumeConcentration): + return parser.TryParse, VolumeConcentrationUnit>(quantityString, formatProvider, VolumeConcentration.From, out quantity); + case Type _ when quantityType == typeof(VolumeFlow): + return parser.TryParse, VolumeFlowUnit>(quantityString, formatProvider, VolumeFlow.From, out quantity); + case Type _ when quantityType == typeof(VolumePerLength): + return parser.TryParse, VolumePerLengthUnit>(quantityString, formatProvider, VolumePerLength.From, out quantity); default: return false; } diff --git a/UnitsNet/GeneratedCode/UnitConverter.g.cs b/UnitsNet/GeneratedCode/UnitConverter.g.cs index 9ce7e69a61..8f60b6322e 100644 --- a/UnitsNet/GeneratedCode/UnitConverter.g.cs +++ b/UnitsNet/GeneratedCode/UnitConverter.g.cs @@ -24,1998 +24,1998 @@ namespace UnitsNet { - public sealed partial class UnitConverter + public sealed partial class UnitConverter { /// - /// Registers the default conversion functions in the given instance. + /// Registers the default conversion functions in the given instance. /// - /// The to register the default conversion functions in. - public static void RegisterDefaultConversions(UnitConverter unitConverter) + /// The to register the default conversion functions in. + public static void RegisterDefaultConversions(UnitConverter unitConverter) { - unitConverter.SetConversionFunction(Acceleration.BaseUnit, AccelerationUnit.CentimeterPerSecondSquared, q => q.ToUnit(AccelerationUnit.CentimeterPerSecondSquared)); - unitConverter.SetConversionFunction(AccelerationUnit.CentimeterPerSecondSquared, Acceleration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Acceleration.BaseUnit, AccelerationUnit.DecimeterPerSecondSquared, q => q.ToUnit(AccelerationUnit.DecimeterPerSecondSquared)); - unitConverter.SetConversionFunction(AccelerationUnit.DecimeterPerSecondSquared, Acceleration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Acceleration.BaseUnit, AccelerationUnit.FootPerSecondSquared, q => q.ToUnit(AccelerationUnit.FootPerSecondSquared)); - unitConverter.SetConversionFunction(AccelerationUnit.FootPerSecondSquared, Acceleration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Acceleration.BaseUnit, AccelerationUnit.InchPerSecondSquared, q => q.ToUnit(AccelerationUnit.InchPerSecondSquared)); - unitConverter.SetConversionFunction(AccelerationUnit.InchPerSecondSquared, Acceleration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Acceleration.BaseUnit, AccelerationUnit.KilometerPerSecondSquared, q => q.ToUnit(AccelerationUnit.KilometerPerSecondSquared)); - unitConverter.SetConversionFunction(AccelerationUnit.KilometerPerSecondSquared, Acceleration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Acceleration.BaseUnit, AccelerationUnit.KnotPerHour, q => q.ToUnit(AccelerationUnit.KnotPerHour)); - unitConverter.SetConversionFunction(AccelerationUnit.KnotPerHour, Acceleration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Acceleration.BaseUnit, AccelerationUnit.KnotPerMinute, q => q.ToUnit(AccelerationUnit.KnotPerMinute)); - unitConverter.SetConversionFunction(AccelerationUnit.KnotPerMinute, Acceleration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Acceleration.BaseUnit, AccelerationUnit.KnotPerSecond, q => q.ToUnit(AccelerationUnit.KnotPerSecond)); - unitConverter.SetConversionFunction(AccelerationUnit.KnotPerSecond, Acceleration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Acceleration.BaseUnit, Acceleration.BaseUnit, q => q); - unitConverter.SetConversionFunction(Acceleration.BaseUnit, AccelerationUnit.MicrometerPerSecondSquared, q => q.ToUnit(AccelerationUnit.MicrometerPerSecondSquared)); - unitConverter.SetConversionFunction(AccelerationUnit.MicrometerPerSecondSquared, Acceleration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Acceleration.BaseUnit, AccelerationUnit.MillimeterPerSecondSquared, q => q.ToUnit(AccelerationUnit.MillimeterPerSecondSquared)); - unitConverter.SetConversionFunction(AccelerationUnit.MillimeterPerSecondSquared, Acceleration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Acceleration.BaseUnit, AccelerationUnit.NanometerPerSecondSquared, q => q.ToUnit(AccelerationUnit.NanometerPerSecondSquared)); - unitConverter.SetConversionFunction(AccelerationUnit.NanometerPerSecondSquared, Acceleration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Acceleration.BaseUnit, AccelerationUnit.StandardGravity, q => q.ToUnit(AccelerationUnit.StandardGravity)); - unitConverter.SetConversionFunction(AccelerationUnit.StandardGravity, Acceleration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.Centimole, q => q.ToUnit(AmountOfSubstanceUnit.Centimole)); - unitConverter.SetConversionFunction(AmountOfSubstanceUnit.Centimole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.CentipoundMole, q => q.ToUnit(AmountOfSubstanceUnit.CentipoundMole)); - unitConverter.SetConversionFunction(AmountOfSubstanceUnit.CentipoundMole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.Decimole, q => q.ToUnit(AmountOfSubstanceUnit.Decimole)); - unitConverter.SetConversionFunction(AmountOfSubstanceUnit.Decimole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.DecipoundMole, q => q.ToUnit(AmountOfSubstanceUnit.DecipoundMole)); - unitConverter.SetConversionFunction(AmountOfSubstanceUnit.DecipoundMole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.Kilomole, q => q.ToUnit(AmountOfSubstanceUnit.Kilomole)); - unitConverter.SetConversionFunction(AmountOfSubstanceUnit.Kilomole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.KilopoundMole, q => q.ToUnit(AmountOfSubstanceUnit.KilopoundMole)); - unitConverter.SetConversionFunction(AmountOfSubstanceUnit.KilopoundMole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.Megamole, q => q.ToUnit(AmountOfSubstanceUnit.Megamole)); - unitConverter.SetConversionFunction(AmountOfSubstanceUnit.Megamole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.Micromole, q => q.ToUnit(AmountOfSubstanceUnit.Micromole)); - unitConverter.SetConversionFunction(AmountOfSubstanceUnit.Micromole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.MicropoundMole, q => q.ToUnit(AmountOfSubstanceUnit.MicropoundMole)); - unitConverter.SetConversionFunction(AmountOfSubstanceUnit.MicropoundMole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.Millimole, q => q.ToUnit(AmountOfSubstanceUnit.Millimole)); - unitConverter.SetConversionFunction(AmountOfSubstanceUnit.Millimole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.MillipoundMole, q => q.ToUnit(AmountOfSubstanceUnit.MillipoundMole)); - unitConverter.SetConversionFunction(AmountOfSubstanceUnit.MillipoundMole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmountOfSubstance.BaseUnit, AmountOfSubstance.BaseUnit, q => q); - unitConverter.SetConversionFunction(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.Nanomole, q => q.ToUnit(AmountOfSubstanceUnit.Nanomole)); - unitConverter.SetConversionFunction(AmountOfSubstanceUnit.Nanomole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.NanopoundMole, q => q.ToUnit(AmountOfSubstanceUnit.NanopoundMole)); - unitConverter.SetConversionFunction(AmountOfSubstanceUnit.NanopoundMole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.PoundMole, q => q.ToUnit(AmountOfSubstanceUnit.PoundMole)); - unitConverter.SetConversionFunction(AmountOfSubstanceUnit.PoundMole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmplitudeRatio.BaseUnit, AmplitudeRatioUnit.DecibelMicrovolt, q => q.ToUnit(AmplitudeRatioUnit.DecibelMicrovolt)); - unitConverter.SetConversionFunction(AmplitudeRatioUnit.DecibelMicrovolt, AmplitudeRatio.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmplitudeRatio.BaseUnit, AmplitudeRatioUnit.DecibelMillivolt, q => q.ToUnit(AmplitudeRatioUnit.DecibelMillivolt)); - unitConverter.SetConversionFunction(AmplitudeRatioUnit.DecibelMillivolt, AmplitudeRatio.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmplitudeRatio.BaseUnit, AmplitudeRatioUnit.DecibelUnloaded, q => q.ToUnit(AmplitudeRatioUnit.DecibelUnloaded)); - unitConverter.SetConversionFunction(AmplitudeRatioUnit.DecibelUnloaded, AmplitudeRatio.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AmplitudeRatio.BaseUnit, AmplitudeRatio.BaseUnit, q => q); - unitConverter.SetConversionFunction(Angle.BaseUnit, AngleUnit.Arcminute, q => q.ToUnit(AngleUnit.Arcminute)); - unitConverter.SetConversionFunction(AngleUnit.Arcminute, Angle.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Angle.BaseUnit, AngleUnit.Arcsecond, q => q.ToUnit(AngleUnit.Arcsecond)); - unitConverter.SetConversionFunction(AngleUnit.Arcsecond, Angle.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Angle.BaseUnit, AngleUnit.Centiradian, q => q.ToUnit(AngleUnit.Centiradian)); - unitConverter.SetConversionFunction(AngleUnit.Centiradian, Angle.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Angle.BaseUnit, AngleUnit.Deciradian, q => q.ToUnit(AngleUnit.Deciradian)); - unitConverter.SetConversionFunction(AngleUnit.Deciradian, Angle.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Angle.BaseUnit, Angle.BaseUnit, q => q); - unitConverter.SetConversionFunction(Angle.BaseUnit, AngleUnit.Gradian, q => q.ToUnit(AngleUnit.Gradian)); - unitConverter.SetConversionFunction(AngleUnit.Gradian, Angle.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Angle.BaseUnit, AngleUnit.Microdegree, q => q.ToUnit(AngleUnit.Microdegree)); - unitConverter.SetConversionFunction(AngleUnit.Microdegree, Angle.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Angle.BaseUnit, AngleUnit.Microradian, q => q.ToUnit(AngleUnit.Microradian)); - unitConverter.SetConversionFunction(AngleUnit.Microradian, Angle.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Angle.BaseUnit, AngleUnit.Millidegree, q => q.ToUnit(AngleUnit.Millidegree)); - unitConverter.SetConversionFunction(AngleUnit.Millidegree, Angle.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Angle.BaseUnit, AngleUnit.Milliradian, q => q.ToUnit(AngleUnit.Milliradian)); - unitConverter.SetConversionFunction(AngleUnit.Milliradian, Angle.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Angle.BaseUnit, AngleUnit.Nanodegree, q => q.ToUnit(AngleUnit.Nanodegree)); - unitConverter.SetConversionFunction(AngleUnit.Nanodegree, Angle.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Angle.BaseUnit, AngleUnit.Nanoradian, q => q.ToUnit(AngleUnit.Nanoradian)); - unitConverter.SetConversionFunction(AngleUnit.Nanoradian, Angle.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Angle.BaseUnit, AngleUnit.Radian, q => q.ToUnit(AngleUnit.Radian)); - unitConverter.SetConversionFunction(AngleUnit.Radian, Angle.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Angle.BaseUnit, AngleUnit.Revolution, q => q.ToUnit(AngleUnit.Revolution)); - unitConverter.SetConversionFunction(AngleUnit.Revolution, Angle.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ApparentEnergy.BaseUnit, ApparentEnergyUnit.KilovoltampereHour, q => q.ToUnit(ApparentEnergyUnit.KilovoltampereHour)); - unitConverter.SetConversionFunction(ApparentEnergyUnit.KilovoltampereHour, ApparentEnergy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ApparentEnergy.BaseUnit, ApparentEnergyUnit.MegavoltampereHour, q => q.ToUnit(ApparentEnergyUnit.MegavoltampereHour)); - unitConverter.SetConversionFunction(ApparentEnergyUnit.MegavoltampereHour, ApparentEnergy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ApparentEnergy.BaseUnit, ApparentEnergy.BaseUnit, q => q); - unitConverter.SetConversionFunction(ApparentPower.BaseUnit, ApparentPowerUnit.Gigavoltampere, q => q.ToUnit(ApparentPowerUnit.Gigavoltampere)); - unitConverter.SetConversionFunction(ApparentPowerUnit.Gigavoltampere, ApparentPower.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ApparentPower.BaseUnit, ApparentPowerUnit.Kilovoltampere, q => q.ToUnit(ApparentPowerUnit.Kilovoltampere)); - unitConverter.SetConversionFunction(ApparentPowerUnit.Kilovoltampere, ApparentPower.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ApparentPower.BaseUnit, ApparentPowerUnit.Megavoltampere, q => q.ToUnit(ApparentPowerUnit.Megavoltampere)); - unitConverter.SetConversionFunction(ApparentPowerUnit.Megavoltampere, ApparentPower.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ApparentPower.BaseUnit, ApparentPower.BaseUnit, q => q); - unitConverter.SetConversionFunction(Area.BaseUnit, AreaUnit.Acre, q => q.ToUnit(AreaUnit.Acre)); - unitConverter.SetConversionFunction(AreaUnit.Acre, Area.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Area.BaseUnit, AreaUnit.Hectare, q => q.ToUnit(AreaUnit.Hectare)); - unitConverter.SetConversionFunction(AreaUnit.Hectare, Area.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Area.BaseUnit, AreaUnit.SquareCentimeter, q => q.ToUnit(AreaUnit.SquareCentimeter)); - unitConverter.SetConversionFunction(AreaUnit.SquareCentimeter, Area.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Area.BaseUnit, AreaUnit.SquareDecimeter, q => q.ToUnit(AreaUnit.SquareDecimeter)); - unitConverter.SetConversionFunction(AreaUnit.SquareDecimeter, Area.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Area.BaseUnit, AreaUnit.SquareFoot, q => q.ToUnit(AreaUnit.SquareFoot)); - unitConverter.SetConversionFunction(AreaUnit.SquareFoot, Area.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Area.BaseUnit, AreaUnit.SquareInch, q => q.ToUnit(AreaUnit.SquareInch)); - unitConverter.SetConversionFunction(AreaUnit.SquareInch, Area.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Area.BaseUnit, AreaUnit.SquareKilometer, q => q.ToUnit(AreaUnit.SquareKilometer)); - unitConverter.SetConversionFunction(AreaUnit.SquareKilometer, Area.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Area.BaseUnit, Area.BaseUnit, q => q); - unitConverter.SetConversionFunction(Area.BaseUnit, AreaUnit.SquareMicrometer, q => q.ToUnit(AreaUnit.SquareMicrometer)); - unitConverter.SetConversionFunction(AreaUnit.SquareMicrometer, Area.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Area.BaseUnit, AreaUnit.SquareMile, q => q.ToUnit(AreaUnit.SquareMile)); - unitConverter.SetConversionFunction(AreaUnit.SquareMile, Area.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Area.BaseUnit, AreaUnit.SquareMillimeter, q => q.ToUnit(AreaUnit.SquareMillimeter)); - unitConverter.SetConversionFunction(AreaUnit.SquareMillimeter, Area.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Area.BaseUnit, AreaUnit.SquareNauticalMile, q => q.ToUnit(AreaUnit.SquareNauticalMile)); - unitConverter.SetConversionFunction(AreaUnit.SquareNauticalMile, Area.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Area.BaseUnit, AreaUnit.SquareYard, q => q.ToUnit(AreaUnit.SquareYard)); - unitConverter.SetConversionFunction(AreaUnit.SquareYard, Area.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Area.BaseUnit, AreaUnit.UsSurveySquareFoot, q => q.ToUnit(AreaUnit.UsSurveySquareFoot)); - unitConverter.SetConversionFunction(AreaUnit.UsSurveySquareFoot, Area.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AreaDensity.BaseUnit, AreaDensity.BaseUnit, q => q); - unitConverter.SetConversionFunction(AreaMomentOfInertia.BaseUnit, AreaMomentOfInertiaUnit.CentimeterToTheFourth, q => q.ToUnit(AreaMomentOfInertiaUnit.CentimeterToTheFourth)); - unitConverter.SetConversionFunction(AreaMomentOfInertiaUnit.CentimeterToTheFourth, AreaMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AreaMomentOfInertia.BaseUnit, AreaMomentOfInertiaUnit.DecimeterToTheFourth, q => q.ToUnit(AreaMomentOfInertiaUnit.DecimeterToTheFourth)); - unitConverter.SetConversionFunction(AreaMomentOfInertiaUnit.DecimeterToTheFourth, AreaMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AreaMomentOfInertia.BaseUnit, AreaMomentOfInertiaUnit.FootToTheFourth, q => q.ToUnit(AreaMomentOfInertiaUnit.FootToTheFourth)); - unitConverter.SetConversionFunction(AreaMomentOfInertiaUnit.FootToTheFourth, AreaMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AreaMomentOfInertia.BaseUnit, AreaMomentOfInertiaUnit.InchToTheFourth, q => q.ToUnit(AreaMomentOfInertiaUnit.InchToTheFourth)); - unitConverter.SetConversionFunction(AreaMomentOfInertiaUnit.InchToTheFourth, AreaMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(AreaMomentOfInertia.BaseUnit, AreaMomentOfInertia.BaseUnit, q => q); - unitConverter.SetConversionFunction(AreaMomentOfInertia.BaseUnit, AreaMomentOfInertiaUnit.MillimeterToTheFourth, q => q.ToUnit(AreaMomentOfInertiaUnit.MillimeterToTheFourth)); - unitConverter.SetConversionFunction(AreaMomentOfInertiaUnit.MillimeterToTheFourth, AreaMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRate.BaseUnit, q => q); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.BytePerSecond, q => q.ToUnit(BitRateUnit.BytePerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.BytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.ExabitPerSecond, q => q.ToUnit(BitRateUnit.ExabitPerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.ExabitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.ExabytePerSecond, q => q.ToUnit(BitRateUnit.ExabytePerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.ExabytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.ExbibitPerSecond, q => q.ToUnit(BitRateUnit.ExbibitPerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.ExbibitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.ExbibytePerSecond, q => q.ToUnit(BitRateUnit.ExbibytePerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.ExbibytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.GibibitPerSecond, q => q.ToUnit(BitRateUnit.GibibitPerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.GibibitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.GibibytePerSecond, q => q.ToUnit(BitRateUnit.GibibytePerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.GibibytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.GigabitPerSecond, q => q.ToUnit(BitRateUnit.GigabitPerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.GigabitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.GigabytePerSecond, q => q.ToUnit(BitRateUnit.GigabytePerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.GigabytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.KibibitPerSecond, q => q.ToUnit(BitRateUnit.KibibitPerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.KibibitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.KibibytePerSecond, q => q.ToUnit(BitRateUnit.KibibytePerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.KibibytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.KilobitPerSecond, q => q.ToUnit(BitRateUnit.KilobitPerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.KilobitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.KilobytePerSecond, q => q.ToUnit(BitRateUnit.KilobytePerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.KilobytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.MebibitPerSecond, q => q.ToUnit(BitRateUnit.MebibitPerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.MebibitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.MebibytePerSecond, q => q.ToUnit(BitRateUnit.MebibytePerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.MebibytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.MegabitPerSecond, q => q.ToUnit(BitRateUnit.MegabitPerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.MegabitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.MegabytePerSecond, q => q.ToUnit(BitRateUnit.MegabytePerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.MegabytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.PebibitPerSecond, q => q.ToUnit(BitRateUnit.PebibitPerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.PebibitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.PebibytePerSecond, q => q.ToUnit(BitRateUnit.PebibytePerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.PebibytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.PetabitPerSecond, q => q.ToUnit(BitRateUnit.PetabitPerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.PetabitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.PetabytePerSecond, q => q.ToUnit(BitRateUnit.PetabytePerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.PetabytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.TebibitPerSecond, q => q.ToUnit(BitRateUnit.TebibitPerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.TebibitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.TebibytePerSecond, q => q.ToUnit(BitRateUnit.TebibytePerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.TebibytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.TerabitPerSecond, q => q.ToUnit(BitRateUnit.TerabitPerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.TerabitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BitRate.BaseUnit, BitRateUnit.TerabytePerSecond, q => q.ToUnit(BitRateUnit.TerabytePerSecond)); - unitConverter.SetConversionFunction(BitRateUnit.TerabytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BrakeSpecificFuelConsumption.BaseUnit, BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour, q => q.ToUnit(BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour)); - unitConverter.SetConversionFunction(BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour, BrakeSpecificFuelConsumption.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(BrakeSpecificFuelConsumption.BaseUnit, BrakeSpecificFuelConsumption.BaseUnit, q => q); - unitConverter.SetConversionFunction(BrakeSpecificFuelConsumption.BaseUnit, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour, q => q.ToUnit(BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour)); - unitConverter.SetConversionFunction(BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour, BrakeSpecificFuelConsumption.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Capacitance.BaseUnit, Capacitance.BaseUnit, q => q); - unitConverter.SetConversionFunction(Capacitance.BaseUnit, CapacitanceUnit.Kilofarad, q => q.ToUnit(CapacitanceUnit.Kilofarad)); - unitConverter.SetConversionFunction(CapacitanceUnit.Kilofarad, Capacitance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Capacitance.BaseUnit, CapacitanceUnit.Megafarad, q => q.ToUnit(CapacitanceUnit.Megafarad)); - unitConverter.SetConversionFunction(CapacitanceUnit.Megafarad, Capacitance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Capacitance.BaseUnit, CapacitanceUnit.Microfarad, q => q.ToUnit(CapacitanceUnit.Microfarad)); - unitConverter.SetConversionFunction(CapacitanceUnit.Microfarad, Capacitance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Capacitance.BaseUnit, CapacitanceUnit.Millifarad, q => q.ToUnit(CapacitanceUnit.Millifarad)); - unitConverter.SetConversionFunction(CapacitanceUnit.Millifarad, Capacitance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Capacitance.BaseUnit, CapacitanceUnit.Nanofarad, q => q.ToUnit(CapacitanceUnit.Nanofarad)); - unitConverter.SetConversionFunction(CapacitanceUnit.Nanofarad, Capacitance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Capacitance.BaseUnit, CapacitanceUnit.Picofarad, q => q.ToUnit(CapacitanceUnit.Picofarad)); - unitConverter.SetConversionFunction(CapacitanceUnit.Picofarad, Capacitance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(CoefficientOfThermalExpansion.BaseUnit, CoefficientOfThermalExpansionUnit.InverseDegreeCelsius, q => q.ToUnit(CoefficientOfThermalExpansionUnit.InverseDegreeCelsius)); - unitConverter.SetConversionFunction(CoefficientOfThermalExpansionUnit.InverseDegreeCelsius, CoefficientOfThermalExpansion.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(CoefficientOfThermalExpansion.BaseUnit, CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit, q => q.ToUnit(CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit)); - unitConverter.SetConversionFunction(CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit, CoefficientOfThermalExpansion.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(CoefficientOfThermalExpansion.BaseUnit, CoefficientOfThermalExpansion.BaseUnit, q => q); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.CentigramPerDeciliter, q => q.ToUnit(DensityUnit.CentigramPerDeciliter)); - unitConverter.SetConversionFunction(DensityUnit.CentigramPerDeciliter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.CentigramPerLiter, q => q.ToUnit(DensityUnit.CentigramPerLiter)); - unitConverter.SetConversionFunction(DensityUnit.CentigramPerLiter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.CentigramPerMilliliter, q => q.ToUnit(DensityUnit.CentigramPerMilliliter)); - unitConverter.SetConversionFunction(DensityUnit.CentigramPerMilliliter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.DecigramPerDeciliter, q => q.ToUnit(DensityUnit.DecigramPerDeciliter)); - unitConverter.SetConversionFunction(DensityUnit.DecigramPerDeciliter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.DecigramPerLiter, q => q.ToUnit(DensityUnit.DecigramPerLiter)); - unitConverter.SetConversionFunction(DensityUnit.DecigramPerLiter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.DecigramPerMilliliter, q => q.ToUnit(DensityUnit.DecigramPerMilliliter)); - unitConverter.SetConversionFunction(DensityUnit.DecigramPerMilliliter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.GramPerCubicCentimeter, q => q.ToUnit(DensityUnit.GramPerCubicCentimeter)); - unitConverter.SetConversionFunction(DensityUnit.GramPerCubicCentimeter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.GramPerCubicMeter, q => q.ToUnit(DensityUnit.GramPerCubicMeter)); - unitConverter.SetConversionFunction(DensityUnit.GramPerCubicMeter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.GramPerCubicMillimeter, q => q.ToUnit(DensityUnit.GramPerCubicMillimeter)); - unitConverter.SetConversionFunction(DensityUnit.GramPerCubicMillimeter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.GramPerDeciliter, q => q.ToUnit(DensityUnit.GramPerDeciliter)); - unitConverter.SetConversionFunction(DensityUnit.GramPerDeciliter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.GramPerLiter, q => q.ToUnit(DensityUnit.GramPerLiter)); - unitConverter.SetConversionFunction(DensityUnit.GramPerLiter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.GramPerMilliliter, q => q.ToUnit(DensityUnit.GramPerMilliliter)); - unitConverter.SetConversionFunction(DensityUnit.GramPerMilliliter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.KilogramPerCubicCentimeter, q => q.ToUnit(DensityUnit.KilogramPerCubicCentimeter)); - unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicCentimeter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, Density.BaseUnit, q => q); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.KilogramPerCubicMillimeter, q => q.ToUnit(DensityUnit.KilogramPerCubicMillimeter)); - unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMillimeter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.KilogramPerLiter, q => q.ToUnit(DensityUnit.KilogramPerLiter)); - unitConverter.SetConversionFunction(DensityUnit.KilogramPerLiter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.KilopoundPerCubicFoot, q => q.ToUnit(DensityUnit.KilopoundPerCubicFoot)); - unitConverter.SetConversionFunction(DensityUnit.KilopoundPerCubicFoot, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.KilopoundPerCubicInch, q => q.ToUnit(DensityUnit.KilopoundPerCubicInch)); - unitConverter.SetConversionFunction(DensityUnit.KilopoundPerCubicInch, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.MicrogramPerCubicMeter, q => q.ToUnit(DensityUnit.MicrogramPerCubicMeter)); - unitConverter.SetConversionFunction(DensityUnit.MicrogramPerCubicMeter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.MicrogramPerDeciliter, q => q.ToUnit(DensityUnit.MicrogramPerDeciliter)); - unitConverter.SetConversionFunction(DensityUnit.MicrogramPerDeciliter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.MicrogramPerLiter, q => q.ToUnit(DensityUnit.MicrogramPerLiter)); - unitConverter.SetConversionFunction(DensityUnit.MicrogramPerLiter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.MicrogramPerMilliliter, q => q.ToUnit(DensityUnit.MicrogramPerMilliliter)); - unitConverter.SetConversionFunction(DensityUnit.MicrogramPerMilliliter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.MilligramPerCubicMeter, q => q.ToUnit(DensityUnit.MilligramPerCubicMeter)); - unitConverter.SetConversionFunction(DensityUnit.MilligramPerCubicMeter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.MilligramPerDeciliter, q => q.ToUnit(DensityUnit.MilligramPerDeciliter)); - unitConverter.SetConversionFunction(DensityUnit.MilligramPerDeciliter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.MilligramPerLiter, q => q.ToUnit(DensityUnit.MilligramPerLiter)); - unitConverter.SetConversionFunction(DensityUnit.MilligramPerLiter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.MilligramPerMilliliter, q => q.ToUnit(DensityUnit.MilligramPerMilliliter)); - unitConverter.SetConversionFunction(DensityUnit.MilligramPerMilliliter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.NanogramPerDeciliter, q => q.ToUnit(DensityUnit.NanogramPerDeciliter)); - unitConverter.SetConversionFunction(DensityUnit.NanogramPerDeciliter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.NanogramPerLiter, q => q.ToUnit(DensityUnit.NanogramPerLiter)); - unitConverter.SetConversionFunction(DensityUnit.NanogramPerLiter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.NanogramPerMilliliter, q => q.ToUnit(DensityUnit.NanogramPerMilliliter)); - unitConverter.SetConversionFunction(DensityUnit.NanogramPerMilliliter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.PicogramPerDeciliter, q => q.ToUnit(DensityUnit.PicogramPerDeciliter)); - unitConverter.SetConversionFunction(DensityUnit.PicogramPerDeciliter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.PicogramPerLiter, q => q.ToUnit(DensityUnit.PicogramPerLiter)); - unitConverter.SetConversionFunction(DensityUnit.PicogramPerLiter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.PicogramPerMilliliter, q => q.ToUnit(DensityUnit.PicogramPerMilliliter)); - unitConverter.SetConversionFunction(DensityUnit.PicogramPerMilliliter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.PoundPerCubicFoot, q => q.ToUnit(DensityUnit.PoundPerCubicFoot)); - unitConverter.SetConversionFunction(DensityUnit.PoundPerCubicFoot, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.PoundPerCubicInch, q => q.ToUnit(DensityUnit.PoundPerCubicInch)); - unitConverter.SetConversionFunction(DensityUnit.PoundPerCubicInch, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.PoundPerImperialGallon, q => q.ToUnit(DensityUnit.PoundPerImperialGallon)); - unitConverter.SetConversionFunction(DensityUnit.PoundPerImperialGallon, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.PoundPerUSGallon, q => q.ToUnit(DensityUnit.PoundPerUSGallon)); - unitConverter.SetConversionFunction(DensityUnit.PoundPerUSGallon, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.SlugPerCubicFoot, q => q.ToUnit(DensityUnit.SlugPerCubicFoot)); - unitConverter.SetConversionFunction(DensityUnit.SlugPerCubicFoot, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.TonnePerCubicCentimeter, q => q.ToUnit(DensityUnit.TonnePerCubicCentimeter)); - unitConverter.SetConversionFunction(DensityUnit.TonnePerCubicCentimeter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.TonnePerCubicMeter, q => q.ToUnit(DensityUnit.TonnePerCubicMeter)); - unitConverter.SetConversionFunction(DensityUnit.TonnePerCubicMeter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Density.BaseUnit, DensityUnit.TonnePerCubicMillimeter, q => q.ToUnit(DensityUnit.TonnePerCubicMillimeter)); - unitConverter.SetConversionFunction(DensityUnit.TonnePerCubicMillimeter, Density.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Duration.BaseUnit, DurationUnit.Day, q => q.ToUnit(DurationUnit.Day)); - unitConverter.SetConversionFunction(DurationUnit.Day, Duration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Duration.BaseUnit, DurationUnit.Hour, q => q.ToUnit(DurationUnit.Hour)); - unitConverter.SetConversionFunction(DurationUnit.Hour, Duration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Duration.BaseUnit, DurationUnit.Microsecond, q => q.ToUnit(DurationUnit.Microsecond)); - unitConverter.SetConversionFunction(DurationUnit.Microsecond, Duration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Duration.BaseUnit, DurationUnit.Millisecond, q => q.ToUnit(DurationUnit.Millisecond)); - unitConverter.SetConversionFunction(DurationUnit.Millisecond, Duration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Duration.BaseUnit, DurationUnit.Minute, q => q.ToUnit(DurationUnit.Minute)); - unitConverter.SetConversionFunction(DurationUnit.Minute, Duration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Duration.BaseUnit, DurationUnit.Month30, q => q.ToUnit(DurationUnit.Month30)); - unitConverter.SetConversionFunction(DurationUnit.Month30, Duration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Duration.BaseUnit, DurationUnit.Nanosecond, q => q.ToUnit(DurationUnit.Nanosecond)); - unitConverter.SetConversionFunction(DurationUnit.Nanosecond, Duration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Duration.BaseUnit, Duration.BaseUnit, q => q); - unitConverter.SetConversionFunction(Duration.BaseUnit, DurationUnit.Week, q => q.ToUnit(DurationUnit.Week)); - unitConverter.SetConversionFunction(DurationUnit.Week, Duration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Duration.BaseUnit, DurationUnit.Year365, q => q.ToUnit(DurationUnit.Year365)); - unitConverter.SetConversionFunction(DurationUnit.Year365, Duration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(DynamicViscosity.BaseUnit, DynamicViscosityUnit.Centipoise, q => q.ToUnit(DynamicViscosityUnit.Centipoise)); - unitConverter.SetConversionFunction(DynamicViscosityUnit.Centipoise, DynamicViscosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(DynamicViscosity.BaseUnit, DynamicViscosityUnit.MicropascalSecond, q => q.ToUnit(DynamicViscosityUnit.MicropascalSecond)); - unitConverter.SetConversionFunction(DynamicViscosityUnit.MicropascalSecond, DynamicViscosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(DynamicViscosity.BaseUnit, DynamicViscosityUnit.MillipascalSecond, q => q.ToUnit(DynamicViscosityUnit.MillipascalSecond)); - unitConverter.SetConversionFunction(DynamicViscosityUnit.MillipascalSecond, DynamicViscosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(DynamicViscosity.BaseUnit, DynamicViscosity.BaseUnit, q => q); - unitConverter.SetConversionFunction(DynamicViscosity.BaseUnit, DynamicViscosityUnit.PascalSecond, q => q.ToUnit(DynamicViscosityUnit.PascalSecond)); - unitConverter.SetConversionFunction(DynamicViscosityUnit.PascalSecond, DynamicViscosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(DynamicViscosity.BaseUnit, DynamicViscosityUnit.Poise, q => q.ToUnit(DynamicViscosityUnit.Poise)); - unitConverter.SetConversionFunction(DynamicViscosityUnit.Poise, DynamicViscosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(DynamicViscosity.BaseUnit, DynamicViscosityUnit.PoundForceSecondPerSquareFoot, q => q.ToUnit(DynamicViscosityUnit.PoundForceSecondPerSquareFoot)); - unitConverter.SetConversionFunction(DynamicViscosityUnit.PoundForceSecondPerSquareFoot, DynamicViscosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(DynamicViscosity.BaseUnit, DynamicViscosityUnit.PoundForceSecondPerSquareInch, q => q.ToUnit(DynamicViscosityUnit.PoundForceSecondPerSquareInch)); - unitConverter.SetConversionFunction(DynamicViscosityUnit.PoundForceSecondPerSquareInch, DynamicViscosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(DynamicViscosity.BaseUnit, DynamicViscosityUnit.Reyn, q => q.ToUnit(DynamicViscosityUnit.Reyn)); - unitConverter.SetConversionFunction(DynamicViscosityUnit.Reyn, DynamicViscosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricAdmittance.BaseUnit, ElectricAdmittanceUnit.Microsiemens, q => q.ToUnit(ElectricAdmittanceUnit.Microsiemens)); - unitConverter.SetConversionFunction(ElectricAdmittanceUnit.Microsiemens, ElectricAdmittance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricAdmittance.BaseUnit, ElectricAdmittanceUnit.Millisiemens, q => q.ToUnit(ElectricAdmittanceUnit.Millisiemens)); - unitConverter.SetConversionFunction(ElectricAdmittanceUnit.Millisiemens, ElectricAdmittance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricAdmittance.BaseUnit, ElectricAdmittanceUnit.Nanosiemens, q => q.ToUnit(ElectricAdmittanceUnit.Nanosiemens)); - unitConverter.SetConversionFunction(ElectricAdmittanceUnit.Nanosiemens, ElectricAdmittance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricAdmittance.BaseUnit, ElectricAdmittance.BaseUnit, q => q); - unitConverter.SetConversionFunction(ElectricCharge.BaseUnit, ElectricChargeUnit.AmpereHour, q => q.ToUnit(ElectricChargeUnit.AmpereHour)); - unitConverter.SetConversionFunction(ElectricChargeUnit.AmpereHour, ElectricCharge.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricCharge.BaseUnit, ElectricCharge.BaseUnit, q => q); - unitConverter.SetConversionFunction(ElectricCharge.BaseUnit, ElectricChargeUnit.KiloampereHour, q => q.ToUnit(ElectricChargeUnit.KiloampereHour)); - unitConverter.SetConversionFunction(ElectricChargeUnit.KiloampereHour, ElectricCharge.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricCharge.BaseUnit, ElectricChargeUnit.MegaampereHour, q => q.ToUnit(ElectricChargeUnit.MegaampereHour)); - unitConverter.SetConversionFunction(ElectricChargeUnit.MegaampereHour, ElectricCharge.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricCharge.BaseUnit, ElectricChargeUnit.MilliampereHour, q => q.ToUnit(ElectricChargeUnit.MilliampereHour)); - unitConverter.SetConversionFunction(ElectricChargeUnit.MilliampereHour, ElectricCharge.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricChargeDensity.BaseUnit, ElectricChargeDensity.BaseUnit, q => q); - unitConverter.SetConversionFunction(ElectricConductance.BaseUnit, ElectricConductanceUnit.Microsiemens, q => q.ToUnit(ElectricConductanceUnit.Microsiemens)); - unitConverter.SetConversionFunction(ElectricConductanceUnit.Microsiemens, ElectricConductance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricConductance.BaseUnit, ElectricConductanceUnit.Millisiemens, q => q.ToUnit(ElectricConductanceUnit.Millisiemens)); - unitConverter.SetConversionFunction(ElectricConductanceUnit.Millisiemens, ElectricConductance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricConductance.BaseUnit, ElectricConductance.BaseUnit, q => q); - unitConverter.SetConversionFunction(ElectricConductivity.BaseUnit, ElectricConductivityUnit.SiemensPerFoot, q => q.ToUnit(ElectricConductivityUnit.SiemensPerFoot)); - unitConverter.SetConversionFunction(ElectricConductivityUnit.SiemensPerFoot, ElectricConductivity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricConductivity.BaseUnit, ElectricConductivityUnit.SiemensPerInch, q => q.ToUnit(ElectricConductivityUnit.SiemensPerInch)); - unitConverter.SetConversionFunction(ElectricConductivityUnit.SiemensPerInch, ElectricConductivity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricConductivity.BaseUnit, ElectricConductivity.BaseUnit, q => q); - unitConverter.SetConversionFunction(ElectricCurrent.BaseUnit, ElectricCurrent.BaseUnit, q => q); - unitConverter.SetConversionFunction(ElectricCurrent.BaseUnit, ElectricCurrentUnit.Centiampere, q => q.ToUnit(ElectricCurrentUnit.Centiampere)); - unitConverter.SetConversionFunction(ElectricCurrentUnit.Centiampere, ElectricCurrent.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricCurrent.BaseUnit, ElectricCurrentUnit.Kiloampere, q => q.ToUnit(ElectricCurrentUnit.Kiloampere)); - unitConverter.SetConversionFunction(ElectricCurrentUnit.Kiloampere, ElectricCurrent.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricCurrent.BaseUnit, ElectricCurrentUnit.Megaampere, q => q.ToUnit(ElectricCurrentUnit.Megaampere)); - unitConverter.SetConversionFunction(ElectricCurrentUnit.Megaampere, ElectricCurrent.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricCurrent.BaseUnit, ElectricCurrentUnit.Microampere, q => q.ToUnit(ElectricCurrentUnit.Microampere)); - unitConverter.SetConversionFunction(ElectricCurrentUnit.Microampere, ElectricCurrent.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricCurrent.BaseUnit, ElectricCurrentUnit.Milliampere, q => q.ToUnit(ElectricCurrentUnit.Milliampere)); - unitConverter.SetConversionFunction(ElectricCurrentUnit.Milliampere, ElectricCurrent.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricCurrent.BaseUnit, ElectricCurrentUnit.Nanoampere, q => q.ToUnit(ElectricCurrentUnit.Nanoampere)); - unitConverter.SetConversionFunction(ElectricCurrentUnit.Nanoampere, ElectricCurrent.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricCurrent.BaseUnit, ElectricCurrentUnit.Picoampere, q => q.ToUnit(ElectricCurrentUnit.Picoampere)); - unitConverter.SetConversionFunction(ElectricCurrentUnit.Picoampere, ElectricCurrent.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricCurrentDensity.BaseUnit, ElectricCurrentDensityUnit.AmperePerSquareFoot, q => q.ToUnit(ElectricCurrentDensityUnit.AmperePerSquareFoot)); - unitConverter.SetConversionFunction(ElectricCurrentDensityUnit.AmperePerSquareFoot, ElectricCurrentDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricCurrentDensity.BaseUnit, ElectricCurrentDensityUnit.AmperePerSquareInch, q => q.ToUnit(ElectricCurrentDensityUnit.AmperePerSquareInch)); - unitConverter.SetConversionFunction(ElectricCurrentDensityUnit.AmperePerSquareInch, ElectricCurrentDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricCurrentDensity.BaseUnit, ElectricCurrentDensity.BaseUnit, q => q); - unitConverter.SetConversionFunction(ElectricCurrentGradient.BaseUnit, ElectricCurrentGradient.BaseUnit, q => q); - unitConverter.SetConversionFunction(ElectricField.BaseUnit, ElectricField.BaseUnit, q => q); - unitConverter.SetConversionFunction(ElectricInductance.BaseUnit, ElectricInductance.BaseUnit, q => q); - unitConverter.SetConversionFunction(ElectricInductance.BaseUnit, ElectricInductanceUnit.Microhenry, q => q.ToUnit(ElectricInductanceUnit.Microhenry)); - unitConverter.SetConversionFunction(ElectricInductanceUnit.Microhenry, ElectricInductance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricInductance.BaseUnit, ElectricInductanceUnit.Millihenry, q => q.ToUnit(ElectricInductanceUnit.Millihenry)); - unitConverter.SetConversionFunction(ElectricInductanceUnit.Millihenry, ElectricInductance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricInductance.BaseUnit, ElectricInductanceUnit.Nanohenry, q => q.ToUnit(ElectricInductanceUnit.Nanohenry)); - unitConverter.SetConversionFunction(ElectricInductanceUnit.Nanohenry, ElectricInductance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricPotential.BaseUnit, ElectricPotentialUnit.Kilovolt, q => q.ToUnit(ElectricPotentialUnit.Kilovolt)); - unitConverter.SetConversionFunction(ElectricPotentialUnit.Kilovolt, ElectricPotential.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricPotential.BaseUnit, ElectricPotentialUnit.Megavolt, q => q.ToUnit(ElectricPotentialUnit.Megavolt)); - unitConverter.SetConversionFunction(ElectricPotentialUnit.Megavolt, ElectricPotential.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricPotential.BaseUnit, ElectricPotentialUnit.Microvolt, q => q.ToUnit(ElectricPotentialUnit.Microvolt)); - unitConverter.SetConversionFunction(ElectricPotentialUnit.Microvolt, ElectricPotential.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricPotential.BaseUnit, ElectricPotentialUnit.Millivolt, q => q.ToUnit(ElectricPotentialUnit.Millivolt)); - unitConverter.SetConversionFunction(ElectricPotentialUnit.Millivolt, ElectricPotential.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricPotential.BaseUnit, ElectricPotential.BaseUnit, q => q); - unitConverter.SetConversionFunction(ElectricPotentialAc.BaseUnit, ElectricPotentialAcUnit.KilovoltAc, q => q.ToUnit(ElectricPotentialAcUnit.KilovoltAc)); - unitConverter.SetConversionFunction(ElectricPotentialAcUnit.KilovoltAc, ElectricPotentialAc.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricPotentialAc.BaseUnit, ElectricPotentialAcUnit.MegavoltAc, q => q.ToUnit(ElectricPotentialAcUnit.MegavoltAc)); - unitConverter.SetConversionFunction(ElectricPotentialAcUnit.MegavoltAc, ElectricPotentialAc.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricPotentialAc.BaseUnit, ElectricPotentialAcUnit.MicrovoltAc, q => q.ToUnit(ElectricPotentialAcUnit.MicrovoltAc)); - unitConverter.SetConversionFunction(ElectricPotentialAcUnit.MicrovoltAc, ElectricPotentialAc.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricPotentialAc.BaseUnit, ElectricPotentialAcUnit.MillivoltAc, q => q.ToUnit(ElectricPotentialAcUnit.MillivoltAc)); - unitConverter.SetConversionFunction(ElectricPotentialAcUnit.MillivoltAc, ElectricPotentialAc.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricPotentialAc.BaseUnit, ElectricPotentialAc.BaseUnit, q => q); - unitConverter.SetConversionFunction(ElectricPotentialDc.BaseUnit, ElectricPotentialDcUnit.KilovoltDc, q => q.ToUnit(ElectricPotentialDcUnit.KilovoltDc)); - unitConverter.SetConversionFunction(ElectricPotentialDcUnit.KilovoltDc, ElectricPotentialDc.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricPotentialDc.BaseUnit, ElectricPotentialDcUnit.MegavoltDc, q => q.ToUnit(ElectricPotentialDcUnit.MegavoltDc)); - unitConverter.SetConversionFunction(ElectricPotentialDcUnit.MegavoltDc, ElectricPotentialDc.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricPotentialDc.BaseUnit, ElectricPotentialDcUnit.MicrovoltDc, q => q.ToUnit(ElectricPotentialDcUnit.MicrovoltDc)); - unitConverter.SetConversionFunction(ElectricPotentialDcUnit.MicrovoltDc, ElectricPotentialDc.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricPotentialDc.BaseUnit, ElectricPotentialDcUnit.MillivoltDc, q => q.ToUnit(ElectricPotentialDcUnit.MillivoltDc)); - unitConverter.SetConversionFunction(ElectricPotentialDcUnit.MillivoltDc, ElectricPotentialDc.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricPotentialDc.BaseUnit, ElectricPotentialDc.BaseUnit, q => q); - unitConverter.SetConversionFunction(ElectricResistance.BaseUnit, ElectricResistanceUnit.Gigaohm, q => q.ToUnit(ElectricResistanceUnit.Gigaohm)); - unitConverter.SetConversionFunction(ElectricResistanceUnit.Gigaohm, ElectricResistance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricResistance.BaseUnit, ElectricResistanceUnit.Kiloohm, q => q.ToUnit(ElectricResistanceUnit.Kiloohm)); - unitConverter.SetConversionFunction(ElectricResistanceUnit.Kiloohm, ElectricResistance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricResistance.BaseUnit, ElectricResistanceUnit.Megaohm, q => q.ToUnit(ElectricResistanceUnit.Megaohm)); - unitConverter.SetConversionFunction(ElectricResistanceUnit.Megaohm, ElectricResistance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricResistance.BaseUnit, ElectricResistanceUnit.Milliohm, q => q.ToUnit(ElectricResistanceUnit.Milliohm)); - unitConverter.SetConversionFunction(ElectricResistanceUnit.Milliohm, ElectricResistance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricResistance.BaseUnit, ElectricResistance.BaseUnit, q => q); - unitConverter.SetConversionFunction(ElectricResistivity.BaseUnit, ElectricResistivityUnit.KiloohmCentimeter, q => q.ToUnit(ElectricResistivityUnit.KiloohmCentimeter)); - unitConverter.SetConversionFunction(ElectricResistivityUnit.KiloohmCentimeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricResistivity.BaseUnit, ElectricResistivityUnit.KiloohmMeter, q => q.ToUnit(ElectricResistivityUnit.KiloohmMeter)); - unitConverter.SetConversionFunction(ElectricResistivityUnit.KiloohmMeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricResistivity.BaseUnit, ElectricResistivityUnit.MegaohmCentimeter, q => q.ToUnit(ElectricResistivityUnit.MegaohmCentimeter)); - unitConverter.SetConversionFunction(ElectricResistivityUnit.MegaohmCentimeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricResistivity.BaseUnit, ElectricResistivityUnit.MegaohmMeter, q => q.ToUnit(ElectricResistivityUnit.MegaohmMeter)); - unitConverter.SetConversionFunction(ElectricResistivityUnit.MegaohmMeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricResistivity.BaseUnit, ElectricResistivityUnit.MicroohmCentimeter, q => q.ToUnit(ElectricResistivityUnit.MicroohmCentimeter)); - unitConverter.SetConversionFunction(ElectricResistivityUnit.MicroohmCentimeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricResistivity.BaseUnit, ElectricResistivityUnit.MicroohmMeter, q => q.ToUnit(ElectricResistivityUnit.MicroohmMeter)); - unitConverter.SetConversionFunction(ElectricResistivityUnit.MicroohmMeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricResistivity.BaseUnit, ElectricResistivityUnit.MilliohmCentimeter, q => q.ToUnit(ElectricResistivityUnit.MilliohmCentimeter)); - unitConverter.SetConversionFunction(ElectricResistivityUnit.MilliohmCentimeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricResistivity.BaseUnit, ElectricResistivityUnit.MilliohmMeter, q => q.ToUnit(ElectricResistivityUnit.MilliohmMeter)); - unitConverter.SetConversionFunction(ElectricResistivityUnit.MilliohmMeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricResistivity.BaseUnit, ElectricResistivityUnit.NanoohmCentimeter, q => q.ToUnit(ElectricResistivityUnit.NanoohmCentimeter)); - unitConverter.SetConversionFunction(ElectricResistivityUnit.NanoohmCentimeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricResistivity.BaseUnit, ElectricResistivityUnit.NanoohmMeter, q => q.ToUnit(ElectricResistivityUnit.NanoohmMeter)); - unitConverter.SetConversionFunction(ElectricResistivityUnit.NanoohmMeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricResistivity.BaseUnit, ElectricResistivityUnit.OhmCentimeter, q => q.ToUnit(ElectricResistivityUnit.OhmCentimeter)); - unitConverter.SetConversionFunction(ElectricResistivityUnit.OhmCentimeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricResistivity.BaseUnit, ElectricResistivity.BaseUnit, q => q); - unitConverter.SetConversionFunction(ElectricResistivity.BaseUnit, ElectricResistivityUnit.PicoohmCentimeter, q => q.ToUnit(ElectricResistivityUnit.PicoohmCentimeter)); - unitConverter.SetConversionFunction(ElectricResistivityUnit.PicoohmCentimeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricResistivity.BaseUnit, ElectricResistivityUnit.PicoohmMeter, q => q.ToUnit(ElectricResistivityUnit.PicoohmMeter)); - unitConverter.SetConversionFunction(ElectricResistivityUnit.PicoohmMeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricSurfaceChargeDensity.BaseUnit, ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter, q => q.ToUnit(ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter)); - unitConverter.SetConversionFunction(ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter, ElectricSurfaceChargeDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricSurfaceChargeDensity.BaseUnit, ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch, q => q.ToUnit(ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch)); - unitConverter.SetConversionFunction(ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch, ElectricSurfaceChargeDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ElectricSurfaceChargeDensity.BaseUnit, ElectricSurfaceChargeDensity.BaseUnit, q => q); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.BritishThermalUnit, q => q.ToUnit(EnergyUnit.BritishThermalUnit)); - unitConverter.SetConversionFunction(EnergyUnit.BritishThermalUnit, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.Calorie, q => q.ToUnit(EnergyUnit.Calorie)); - unitConverter.SetConversionFunction(EnergyUnit.Calorie, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.DecathermEc, q => q.ToUnit(EnergyUnit.DecathermEc)); - unitConverter.SetConversionFunction(EnergyUnit.DecathermEc, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.DecathermImperial, q => q.ToUnit(EnergyUnit.DecathermImperial)); - unitConverter.SetConversionFunction(EnergyUnit.DecathermImperial, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.DecathermUs, q => q.ToUnit(EnergyUnit.DecathermUs)); - unitConverter.SetConversionFunction(EnergyUnit.DecathermUs, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.ElectronVolt, q => q.ToUnit(EnergyUnit.ElectronVolt)); - unitConverter.SetConversionFunction(EnergyUnit.ElectronVolt, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.Erg, q => q.ToUnit(EnergyUnit.Erg)); - unitConverter.SetConversionFunction(EnergyUnit.Erg, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.FootPound, q => q.ToUnit(EnergyUnit.FootPound)); - unitConverter.SetConversionFunction(EnergyUnit.FootPound, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.GigabritishThermalUnit, q => q.ToUnit(EnergyUnit.GigabritishThermalUnit)); - unitConverter.SetConversionFunction(EnergyUnit.GigabritishThermalUnit, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.GigawattHour, q => q.ToUnit(EnergyUnit.GigawattHour)); - unitConverter.SetConversionFunction(EnergyUnit.GigawattHour, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, Energy.BaseUnit, q => q); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.KilobritishThermalUnit, q => q.ToUnit(EnergyUnit.KilobritishThermalUnit)); - unitConverter.SetConversionFunction(EnergyUnit.KilobritishThermalUnit, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.Kilocalorie, q => q.ToUnit(EnergyUnit.Kilocalorie)); - unitConverter.SetConversionFunction(EnergyUnit.Kilocalorie, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.Kilojoule, q => q.ToUnit(EnergyUnit.Kilojoule)); - unitConverter.SetConversionFunction(EnergyUnit.Kilojoule, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.KilowattHour, q => q.ToUnit(EnergyUnit.KilowattHour)); - unitConverter.SetConversionFunction(EnergyUnit.KilowattHour, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.MegabritishThermalUnit, q => q.ToUnit(EnergyUnit.MegabritishThermalUnit)); - unitConverter.SetConversionFunction(EnergyUnit.MegabritishThermalUnit, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.Megajoule, q => q.ToUnit(EnergyUnit.Megajoule)); - unitConverter.SetConversionFunction(EnergyUnit.Megajoule, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.MegawattHour, q => q.ToUnit(EnergyUnit.MegawattHour)); - unitConverter.SetConversionFunction(EnergyUnit.MegawattHour, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.Millijoule, q => q.ToUnit(EnergyUnit.Millijoule)); - unitConverter.SetConversionFunction(EnergyUnit.Millijoule, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.TerawattHour, q => q.ToUnit(EnergyUnit.TerawattHour)); - unitConverter.SetConversionFunction(EnergyUnit.TerawattHour, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.ThermEc, q => q.ToUnit(EnergyUnit.ThermEc)); - unitConverter.SetConversionFunction(EnergyUnit.ThermEc, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.ThermImperial, q => q.ToUnit(EnergyUnit.ThermImperial)); - unitConverter.SetConversionFunction(EnergyUnit.ThermImperial, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.ThermUs, q => q.ToUnit(EnergyUnit.ThermUs)); - unitConverter.SetConversionFunction(EnergyUnit.ThermUs, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Energy.BaseUnit, EnergyUnit.WattHour, q => q.ToUnit(EnergyUnit.WattHour)); - unitConverter.SetConversionFunction(EnergyUnit.WattHour, Energy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Entropy.BaseUnit, EntropyUnit.CaloriePerKelvin, q => q.ToUnit(EntropyUnit.CaloriePerKelvin)); - unitConverter.SetConversionFunction(EntropyUnit.CaloriePerKelvin, Entropy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Entropy.BaseUnit, EntropyUnit.JoulePerDegreeCelsius, q => q.ToUnit(EntropyUnit.JoulePerDegreeCelsius)); - unitConverter.SetConversionFunction(EntropyUnit.JoulePerDegreeCelsius, Entropy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Entropy.BaseUnit, Entropy.BaseUnit, q => q); - unitConverter.SetConversionFunction(Entropy.BaseUnit, EntropyUnit.KilocaloriePerKelvin, q => q.ToUnit(EntropyUnit.KilocaloriePerKelvin)); - unitConverter.SetConversionFunction(EntropyUnit.KilocaloriePerKelvin, Entropy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Entropy.BaseUnit, EntropyUnit.KilojoulePerDegreeCelsius, q => q.ToUnit(EntropyUnit.KilojoulePerDegreeCelsius)); - unitConverter.SetConversionFunction(EntropyUnit.KilojoulePerDegreeCelsius, Entropy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Entropy.BaseUnit, EntropyUnit.KilojoulePerKelvin, q => q.ToUnit(EntropyUnit.KilojoulePerKelvin)); - unitConverter.SetConversionFunction(EntropyUnit.KilojoulePerKelvin, Entropy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Entropy.BaseUnit, EntropyUnit.MegajoulePerKelvin, q => q.ToUnit(EntropyUnit.MegajoulePerKelvin)); - unitConverter.SetConversionFunction(EntropyUnit.MegajoulePerKelvin, Entropy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Force.BaseUnit, ForceUnit.Decanewton, q => q.ToUnit(ForceUnit.Decanewton)); - unitConverter.SetConversionFunction(ForceUnit.Decanewton, Force.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Force.BaseUnit, ForceUnit.Dyn, q => q.ToUnit(ForceUnit.Dyn)); - unitConverter.SetConversionFunction(ForceUnit.Dyn, Force.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Force.BaseUnit, ForceUnit.KilogramForce, q => q.ToUnit(ForceUnit.KilogramForce)); - unitConverter.SetConversionFunction(ForceUnit.KilogramForce, Force.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Force.BaseUnit, ForceUnit.Kilonewton, q => q.ToUnit(ForceUnit.Kilonewton)); - unitConverter.SetConversionFunction(ForceUnit.Kilonewton, Force.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Force.BaseUnit, ForceUnit.KiloPond, q => q.ToUnit(ForceUnit.KiloPond)); - unitConverter.SetConversionFunction(ForceUnit.KiloPond, Force.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Force.BaseUnit, ForceUnit.Meganewton, q => q.ToUnit(ForceUnit.Meganewton)); - unitConverter.SetConversionFunction(ForceUnit.Meganewton, Force.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Force.BaseUnit, ForceUnit.Micronewton, q => q.ToUnit(ForceUnit.Micronewton)); - unitConverter.SetConversionFunction(ForceUnit.Micronewton, Force.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Force.BaseUnit, ForceUnit.Millinewton, q => q.ToUnit(ForceUnit.Millinewton)); - unitConverter.SetConversionFunction(ForceUnit.Millinewton, Force.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Force.BaseUnit, Force.BaseUnit, q => q); - unitConverter.SetConversionFunction(Force.BaseUnit, ForceUnit.OunceForce, q => q.ToUnit(ForceUnit.OunceForce)); - unitConverter.SetConversionFunction(ForceUnit.OunceForce, Force.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Force.BaseUnit, ForceUnit.Poundal, q => q.ToUnit(ForceUnit.Poundal)); - unitConverter.SetConversionFunction(ForceUnit.Poundal, Force.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Force.BaseUnit, ForceUnit.PoundForce, q => q.ToUnit(ForceUnit.PoundForce)); - unitConverter.SetConversionFunction(ForceUnit.PoundForce, Force.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Force.BaseUnit, ForceUnit.TonneForce, q => q.ToUnit(ForceUnit.TonneForce)); - unitConverter.SetConversionFunction(ForceUnit.TonneForce, Force.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForceChangeRate.BaseUnit, ForceChangeRateUnit.CentinewtonPerSecond, q => q.ToUnit(ForceChangeRateUnit.CentinewtonPerSecond)); - unitConverter.SetConversionFunction(ForceChangeRateUnit.CentinewtonPerSecond, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForceChangeRate.BaseUnit, ForceChangeRateUnit.DecanewtonPerMinute, q => q.ToUnit(ForceChangeRateUnit.DecanewtonPerMinute)); - unitConverter.SetConversionFunction(ForceChangeRateUnit.DecanewtonPerMinute, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForceChangeRate.BaseUnit, ForceChangeRateUnit.DecanewtonPerSecond, q => q.ToUnit(ForceChangeRateUnit.DecanewtonPerSecond)); - unitConverter.SetConversionFunction(ForceChangeRateUnit.DecanewtonPerSecond, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForceChangeRate.BaseUnit, ForceChangeRateUnit.DecinewtonPerSecond, q => q.ToUnit(ForceChangeRateUnit.DecinewtonPerSecond)); - unitConverter.SetConversionFunction(ForceChangeRateUnit.DecinewtonPerSecond, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForceChangeRate.BaseUnit, ForceChangeRateUnit.KilonewtonPerMinute, q => q.ToUnit(ForceChangeRateUnit.KilonewtonPerMinute)); - unitConverter.SetConversionFunction(ForceChangeRateUnit.KilonewtonPerMinute, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForceChangeRate.BaseUnit, ForceChangeRateUnit.KilonewtonPerSecond, q => q.ToUnit(ForceChangeRateUnit.KilonewtonPerSecond)); - unitConverter.SetConversionFunction(ForceChangeRateUnit.KilonewtonPerSecond, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForceChangeRate.BaseUnit, ForceChangeRateUnit.MicronewtonPerSecond, q => q.ToUnit(ForceChangeRateUnit.MicronewtonPerSecond)); - unitConverter.SetConversionFunction(ForceChangeRateUnit.MicronewtonPerSecond, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForceChangeRate.BaseUnit, ForceChangeRateUnit.MillinewtonPerSecond, q => q.ToUnit(ForceChangeRateUnit.MillinewtonPerSecond)); - unitConverter.SetConversionFunction(ForceChangeRateUnit.MillinewtonPerSecond, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForceChangeRate.BaseUnit, ForceChangeRateUnit.NanonewtonPerSecond, q => q.ToUnit(ForceChangeRateUnit.NanonewtonPerSecond)); - unitConverter.SetConversionFunction(ForceChangeRateUnit.NanonewtonPerSecond, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForceChangeRate.BaseUnit, ForceChangeRateUnit.NewtonPerMinute, q => q.ToUnit(ForceChangeRateUnit.NewtonPerMinute)); - unitConverter.SetConversionFunction(ForceChangeRateUnit.NewtonPerMinute, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForceChangeRate.BaseUnit, ForceChangeRate.BaseUnit, q => q); - unitConverter.SetConversionFunction(ForcePerLength.BaseUnit, ForcePerLengthUnit.CentinewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.CentinewtonPerMeter)); - unitConverter.SetConversionFunction(ForcePerLengthUnit.CentinewtonPerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForcePerLength.BaseUnit, ForcePerLengthUnit.DecinewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.DecinewtonPerMeter)); - unitConverter.SetConversionFunction(ForcePerLengthUnit.DecinewtonPerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForcePerLength.BaseUnit, ForcePerLengthUnit.KilogramForcePerMeter, q => q.ToUnit(ForcePerLengthUnit.KilogramForcePerMeter)); - unitConverter.SetConversionFunction(ForcePerLengthUnit.KilogramForcePerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForcePerLength.BaseUnit, ForcePerLengthUnit.KilonewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.KilonewtonPerMeter)); - unitConverter.SetConversionFunction(ForcePerLengthUnit.KilonewtonPerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForcePerLength.BaseUnit, ForcePerLengthUnit.MeganewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.MeganewtonPerMeter)); - unitConverter.SetConversionFunction(ForcePerLengthUnit.MeganewtonPerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForcePerLength.BaseUnit, ForcePerLengthUnit.MicronewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.MicronewtonPerMeter)); - unitConverter.SetConversionFunction(ForcePerLengthUnit.MicronewtonPerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForcePerLength.BaseUnit, ForcePerLengthUnit.MillinewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.MillinewtonPerMeter)); - unitConverter.SetConversionFunction(ForcePerLengthUnit.MillinewtonPerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForcePerLength.BaseUnit, ForcePerLengthUnit.NanonewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.NanonewtonPerMeter)); - unitConverter.SetConversionFunction(ForcePerLengthUnit.NanonewtonPerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForcePerLength.BaseUnit, ForcePerLength.BaseUnit, q => q); - unitConverter.SetConversionFunction(ForcePerLength.BaseUnit, ForcePerLengthUnit.PoundForcePerFoot, q => q.ToUnit(ForcePerLengthUnit.PoundForcePerFoot)); - unitConverter.SetConversionFunction(ForcePerLengthUnit.PoundForcePerFoot, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForcePerLength.BaseUnit, ForcePerLengthUnit.PoundForcePerInch, q => q.ToUnit(ForcePerLengthUnit.PoundForcePerInch)); - unitConverter.SetConversionFunction(ForcePerLengthUnit.PoundForcePerInch, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ForcePerLength.BaseUnit, ForcePerLengthUnit.PoundForcePerYard, q => q.ToUnit(ForcePerLengthUnit.PoundForcePerYard)); - unitConverter.SetConversionFunction(ForcePerLengthUnit.PoundForcePerYard, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Frequency.BaseUnit, FrequencyUnit.BeatPerMinute, q => q.ToUnit(FrequencyUnit.BeatPerMinute)); - unitConverter.SetConversionFunction(FrequencyUnit.BeatPerMinute, Frequency.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Frequency.BaseUnit, FrequencyUnit.CyclePerHour, q => q.ToUnit(FrequencyUnit.CyclePerHour)); - unitConverter.SetConversionFunction(FrequencyUnit.CyclePerHour, Frequency.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Frequency.BaseUnit, FrequencyUnit.CyclePerMinute, q => q.ToUnit(FrequencyUnit.CyclePerMinute)); - unitConverter.SetConversionFunction(FrequencyUnit.CyclePerMinute, Frequency.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Frequency.BaseUnit, FrequencyUnit.Gigahertz, q => q.ToUnit(FrequencyUnit.Gigahertz)); - unitConverter.SetConversionFunction(FrequencyUnit.Gigahertz, Frequency.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Frequency.BaseUnit, Frequency.BaseUnit, q => q); - unitConverter.SetConversionFunction(Frequency.BaseUnit, FrequencyUnit.Kilohertz, q => q.ToUnit(FrequencyUnit.Kilohertz)); - unitConverter.SetConversionFunction(FrequencyUnit.Kilohertz, Frequency.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Frequency.BaseUnit, FrequencyUnit.Megahertz, q => q.ToUnit(FrequencyUnit.Megahertz)); - unitConverter.SetConversionFunction(FrequencyUnit.Megahertz, Frequency.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Frequency.BaseUnit, FrequencyUnit.RadianPerSecond, q => q.ToUnit(FrequencyUnit.RadianPerSecond)); - unitConverter.SetConversionFunction(FrequencyUnit.RadianPerSecond, Frequency.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Frequency.BaseUnit, FrequencyUnit.Terahertz, q => q.ToUnit(FrequencyUnit.Terahertz)); - unitConverter.SetConversionFunction(FrequencyUnit.Terahertz, Frequency.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(FuelEfficiency.BaseUnit, FuelEfficiencyUnit.KilometerPerLiter, q => q.ToUnit(FuelEfficiencyUnit.KilometerPerLiter)); - unitConverter.SetConversionFunction(FuelEfficiencyUnit.KilometerPerLiter, FuelEfficiency.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(FuelEfficiency.BaseUnit, FuelEfficiency.BaseUnit, q => q); - unitConverter.SetConversionFunction(FuelEfficiency.BaseUnit, FuelEfficiencyUnit.MilePerUkGallon, q => q.ToUnit(FuelEfficiencyUnit.MilePerUkGallon)); - unitConverter.SetConversionFunction(FuelEfficiencyUnit.MilePerUkGallon, FuelEfficiency.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(FuelEfficiency.BaseUnit, FuelEfficiencyUnit.MilePerUsGallon, q => q.ToUnit(FuelEfficiencyUnit.MilePerUsGallon)); - unitConverter.SetConversionFunction(FuelEfficiencyUnit.MilePerUsGallon, FuelEfficiency.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.BtuPerHourSquareFoot, q => q.ToUnit(HeatFluxUnit.BtuPerHourSquareFoot)); - unitConverter.SetConversionFunction(HeatFluxUnit.BtuPerHourSquareFoot, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.BtuPerMinuteSquareFoot, q => q.ToUnit(HeatFluxUnit.BtuPerMinuteSquareFoot)); - unitConverter.SetConversionFunction(HeatFluxUnit.BtuPerMinuteSquareFoot, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.BtuPerSecondSquareFoot, q => q.ToUnit(HeatFluxUnit.BtuPerSecondSquareFoot)); - unitConverter.SetConversionFunction(HeatFluxUnit.BtuPerSecondSquareFoot, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.BtuPerSecondSquareInch, q => q.ToUnit(HeatFluxUnit.BtuPerSecondSquareInch)); - unitConverter.SetConversionFunction(HeatFluxUnit.BtuPerSecondSquareInch, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.CaloriePerSecondSquareCentimeter, q => q.ToUnit(HeatFluxUnit.CaloriePerSecondSquareCentimeter)); - unitConverter.SetConversionFunction(HeatFluxUnit.CaloriePerSecondSquareCentimeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.CentiwattPerSquareMeter, q => q.ToUnit(HeatFluxUnit.CentiwattPerSquareMeter)); - unitConverter.SetConversionFunction(HeatFluxUnit.CentiwattPerSquareMeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.DeciwattPerSquareMeter, q => q.ToUnit(HeatFluxUnit.DeciwattPerSquareMeter)); - unitConverter.SetConversionFunction(HeatFluxUnit.DeciwattPerSquareMeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.KilocaloriePerHourSquareMeter, q => q.ToUnit(HeatFluxUnit.KilocaloriePerHourSquareMeter)); - unitConverter.SetConversionFunction(HeatFluxUnit.KilocaloriePerHourSquareMeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.KilocaloriePerSecondSquareCentimeter, q => q.ToUnit(HeatFluxUnit.KilocaloriePerSecondSquareCentimeter)); - unitConverter.SetConversionFunction(HeatFluxUnit.KilocaloriePerSecondSquareCentimeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.KilowattPerSquareMeter, q => q.ToUnit(HeatFluxUnit.KilowattPerSquareMeter)); - unitConverter.SetConversionFunction(HeatFluxUnit.KilowattPerSquareMeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.MicrowattPerSquareMeter, q => q.ToUnit(HeatFluxUnit.MicrowattPerSquareMeter)); - unitConverter.SetConversionFunction(HeatFluxUnit.MicrowattPerSquareMeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.MilliwattPerSquareMeter, q => q.ToUnit(HeatFluxUnit.MilliwattPerSquareMeter)); - unitConverter.SetConversionFunction(HeatFluxUnit.MilliwattPerSquareMeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.NanowattPerSquareMeter, q => q.ToUnit(HeatFluxUnit.NanowattPerSquareMeter)); - unitConverter.SetConversionFunction(HeatFluxUnit.NanowattPerSquareMeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.PoundForcePerFootSecond, q => q.ToUnit(HeatFluxUnit.PoundForcePerFootSecond)); - unitConverter.SetConversionFunction(HeatFluxUnit.PoundForcePerFootSecond, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.PoundPerSecondCubed, q => q.ToUnit(HeatFluxUnit.PoundPerSecondCubed)); - unitConverter.SetConversionFunction(HeatFluxUnit.PoundPerSecondCubed, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.WattPerSquareFoot, q => q.ToUnit(HeatFluxUnit.WattPerSquareFoot)); - unitConverter.SetConversionFunction(HeatFluxUnit.WattPerSquareFoot, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFluxUnit.WattPerSquareInch, q => q.ToUnit(HeatFluxUnit.WattPerSquareInch)); - unitConverter.SetConversionFunction(HeatFluxUnit.WattPerSquareInch, HeatFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatFlux.BaseUnit, HeatFlux.BaseUnit, q => q); - unitConverter.SetConversionFunction(HeatTransferCoefficient.BaseUnit, HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit, q => q.ToUnit(HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit)); - unitConverter.SetConversionFunction(HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit, HeatTransferCoefficient.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatTransferCoefficient.BaseUnit, HeatTransferCoefficientUnit.WattPerSquareMeterCelsius, q => q.ToUnit(HeatTransferCoefficientUnit.WattPerSquareMeterCelsius)); - unitConverter.SetConversionFunction(HeatTransferCoefficientUnit.WattPerSquareMeterCelsius, HeatTransferCoefficient.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(HeatTransferCoefficient.BaseUnit, HeatTransferCoefficient.BaseUnit, q => q); - unitConverter.SetConversionFunction(Illuminance.BaseUnit, IlluminanceUnit.Kilolux, q => q.ToUnit(IlluminanceUnit.Kilolux)); - unitConverter.SetConversionFunction(IlluminanceUnit.Kilolux, Illuminance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Illuminance.BaseUnit, Illuminance.BaseUnit, q => q); - unitConverter.SetConversionFunction(Illuminance.BaseUnit, IlluminanceUnit.Megalux, q => q.ToUnit(IlluminanceUnit.Megalux)); - unitConverter.SetConversionFunction(IlluminanceUnit.Megalux, Illuminance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Illuminance.BaseUnit, IlluminanceUnit.Millilux, q => q.ToUnit(IlluminanceUnit.Millilux)); - unitConverter.SetConversionFunction(IlluminanceUnit.Millilux, Illuminance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, Information.BaseUnit, q => q); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Byte, q => q.ToUnit(InformationUnit.Byte)); - unitConverter.SetConversionFunction(InformationUnit.Byte, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Exabit, q => q.ToUnit(InformationUnit.Exabit)); - unitConverter.SetConversionFunction(InformationUnit.Exabit, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Exabyte, q => q.ToUnit(InformationUnit.Exabyte)); - unitConverter.SetConversionFunction(InformationUnit.Exabyte, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Exbibit, q => q.ToUnit(InformationUnit.Exbibit)); - unitConverter.SetConversionFunction(InformationUnit.Exbibit, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Exbibyte, q => q.ToUnit(InformationUnit.Exbibyte)); - unitConverter.SetConversionFunction(InformationUnit.Exbibyte, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Gibibit, q => q.ToUnit(InformationUnit.Gibibit)); - unitConverter.SetConversionFunction(InformationUnit.Gibibit, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Gibibyte, q => q.ToUnit(InformationUnit.Gibibyte)); - unitConverter.SetConversionFunction(InformationUnit.Gibibyte, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Gigabit, q => q.ToUnit(InformationUnit.Gigabit)); - unitConverter.SetConversionFunction(InformationUnit.Gigabit, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Gigabyte, q => q.ToUnit(InformationUnit.Gigabyte)); - unitConverter.SetConversionFunction(InformationUnit.Gigabyte, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Kibibit, q => q.ToUnit(InformationUnit.Kibibit)); - unitConverter.SetConversionFunction(InformationUnit.Kibibit, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Kibibyte, q => q.ToUnit(InformationUnit.Kibibyte)); - unitConverter.SetConversionFunction(InformationUnit.Kibibyte, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Kilobit, q => q.ToUnit(InformationUnit.Kilobit)); - unitConverter.SetConversionFunction(InformationUnit.Kilobit, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Kilobyte, q => q.ToUnit(InformationUnit.Kilobyte)); - unitConverter.SetConversionFunction(InformationUnit.Kilobyte, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Mebibit, q => q.ToUnit(InformationUnit.Mebibit)); - unitConverter.SetConversionFunction(InformationUnit.Mebibit, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Mebibyte, q => q.ToUnit(InformationUnit.Mebibyte)); - unitConverter.SetConversionFunction(InformationUnit.Mebibyte, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Megabit, q => q.ToUnit(InformationUnit.Megabit)); - unitConverter.SetConversionFunction(InformationUnit.Megabit, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Megabyte, q => q.ToUnit(InformationUnit.Megabyte)); - unitConverter.SetConversionFunction(InformationUnit.Megabyte, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Pebibit, q => q.ToUnit(InformationUnit.Pebibit)); - unitConverter.SetConversionFunction(InformationUnit.Pebibit, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Pebibyte, q => q.ToUnit(InformationUnit.Pebibyte)); - unitConverter.SetConversionFunction(InformationUnit.Pebibyte, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Petabit, q => q.ToUnit(InformationUnit.Petabit)); - unitConverter.SetConversionFunction(InformationUnit.Petabit, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Petabyte, q => q.ToUnit(InformationUnit.Petabyte)); - unitConverter.SetConversionFunction(InformationUnit.Petabyte, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Tebibit, q => q.ToUnit(InformationUnit.Tebibit)); - unitConverter.SetConversionFunction(InformationUnit.Tebibit, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Tebibyte, q => q.ToUnit(InformationUnit.Tebibyte)); - unitConverter.SetConversionFunction(InformationUnit.Tebibyte, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Terabit, q => q.ToUnit(InformationUnit.Terabit)); - unitConverter.SetConversionFunction(InformationUnit.Terabit, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Information.BaseUnit, InformationUnit.Terabyte, q => q.ToUnit(InformationUnit.Terabyte)); - unitConverter.SetConversionFunction(InformationUnit.Terabyte, Information.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiance.BaseUnit, IrradianceUnit.KilowattPerSquareCentimeter, q => q.ToUnit(IrradianceUnit.KilowattPerSquareCentimeter)); - unitConverter.SetConversionFunction(IrradianceUnit.KilowattPerSquareCentimeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiance.BaseUnit, IrradianceUnit.KilowattPerSquareMeter, q => q.ToUnit(IrradianceUnit.KilowattPerSquareMeter)); - unitConverter.SetConversionFunction(IrradianceUnit.KilowattPerSquareMeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiance.BaseUnit, IrradianceUnit.MegawattPerSquareCentimeter, q => q.ToUnit(IrradianceUnit.MegawattPerSquareCentimeter)); - unitConverter.SetConversionFunction(IrradianceUnit.MegawattPerSquareCentimeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiance.BaseUnit, IrradianceUnit.MegawattPerSquareMeter, q => q.ToUnit(IrradianceUnit.MegawattPerSquareMeter)); - unitConverter.SetConversionFunction(IrradianceUnit.MegawattPerSquareMeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiance.BaseUnit, IrradianceUnit.MicrowattPerSquareCentimeter, q => q.ToUnit(IrradianceUnit.MicrowattPerSquareCentimeter)); - unitConverter.SetConversionFunction(IrradianceUnit.MicrowattPerSquareCentimeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiance.BaseUnit, IrradianceUnit.MicrowattPerSquareMeter, q => q.ToUnit(IrradianceUnit.MicrowattPerSquareMeter)); - unitConverter.SetConversionFunction(IrradianceUnit.MicrowattPerSquareMeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiance.BaseUnit, IrradianceUnit.MilliwattPerSquareCentimeter, q => q.ToUnit(IrradianceUnit.MilliwattPerSquareCentimeter)); - unitConverter.SetConversionFunction(IrradianceUnit.MilliwattPerSquareCentimeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiance.BaseUnit, IrradianceUnit.MilliwattPerSquareMeter, q => q.ToUnit(IrradianceUnit.MilliwattPerSquareMeter)); - unitConverter.SetConversionFunction(IrradianceUnit.MilliwattPerSquareMeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiance.BaseUnit, IrradianceUnit.NanowattPerSquareCentimeter, q => q.ToUnit(IrradianceUnit.NanowattPerSquareCentimeter)); - unitConverter.SetConversionFunction(IrradianceUnit.NanowattPerSquareCentimeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiance.BaseUnit, IrradianceUnit.NanowattPerSquareMeter, q => q.ToUnit(IrradianceUnit.NanowattPerSquareMeter)); - unitConverter.SetConversionFunction(IrradianceUnit.NanowattPerSquareMeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiance.BaseUnit, IrradianceUnit.PicowattPerSquareCentimeter, q => q.ToUnit(IrradianceUnit.PicowattPerSquareCentimeter)); - unitConverter.SetConversionFunction(IrradianceUnit.PicowattPerSquareCentimeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiance.BaseUnit, IrradianceUnit.PicowattPerSquareMeter, q => q.ToUnit(IrradianceUnit.PicowattPerSquareMeter)); - unitConverter.SetConversionFunction(IrradianceUnit.PicowattPerSquareMeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiance.BaseUnit, IrradianceUnit.WattPerSquareCentimeter, q => q.ToUnit(IrradianceUnit.WattPerSquareCentimeter)); - unitConverter.SetConversionFunction(IrradianceUnit.WattPerSquareCentimeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiance.BaseUnit, Irradiance.BaseUnit, q => q); - unitConverter.SetConversionFunction(Irradiation.BaseUnit, IrradiationUnit.JoulePerSquareCentimeter, q => q.ToUnit(IrradiationUnit.JoulePerSquareCentimeter)); - unitConverter.SetConversionFunction(IrradiationUnit.JoulePerSquareCentimeter, Irradiation.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiation.BaseUnit, Irradiation.BaseUnit, q => q); - unitConverter.SetConversionFunction(Irradiation.BaseUnit, IrradiationUnit.JoulePerSquareMillimeter, q => q.ToUnit(IrradiationUnit.JoulePerSquareMillimeter)); - unitConverter.SetConversionFunction(IrradiationUnit.JoulePerSquareMillimeter, Irradiation.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiation.BaseUnit, IrradiationUnit.KilojoulePerSquareMeter, q => q.ToUnit(IrradiationUnit.KilojoulePerSquareMeter)); - unitConverter.SetConversionFunction(IrradiationUnit.KilojoulePerSquareMeter, Irradiation.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiation.BaseUnit, IrradiationUnit.KilowattHourPerSquareMeter, q => q.ToUnit(IrradiationUnit.KilowattHourPerSquareMeter)); - unitConverter.SetConversionFunction(IrradiationUnit.KilowattHourPerSquareMeter, Irradiation.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiation.BaseUnit, IrradiationUnit.MillijoulePerSquareCentimeter, q => q.ToUnit(IrradiationUnit.MillijoulePerSquareCentimeter)); - unitConverter.SetConversionFunction(IrradiationUnit.MillijoulePerSquareCentimeter, Irradiation.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Irradiation.BaseUnit, IrradiationUnit.WattHourPerSquareMeter, q => q.ToUnit(IrradiationUnit.WattHourPerSquareMeter)); - unitConverter.SetConversionFunction(IrradiationUnit.WattHourPerSquareMeter, Irradiation.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(KinematicViscosity.BaseUnit, KinematicViscosityUnit.Centistokes, q => q.ToUnit(KinematicViscosityUnit.Centistokes)); - unitConverter.SetConversionFunction(KinematicViscosityUnit.Centistokes, KinematicViscosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(KinematicViscosity.BaseUnit, KinematicViscosityUnit.Decistokes, q => q.ToUnit(KinematicViscosityUnit.Decistokes)); - unitConverter.SetConversionFunction(KinematicViscosityUnit.Decistokes, KinematicViscosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(KinematicViscosity.BaseUnit, KinematicViscosityUnit.Kilostokes, q => q.ToUnit(KinematicViscosityUnit.Kilostokes)); - unitConverter.SetConversionFunction(KinematicViscosityUnit.Kilostokes, KinematicViscosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(KinematicViscosity.BaseUnit, KinematicViscosityUnit.Microstokes, q => q.ToUnit(KinematicViscosityUnit.Microstokes)); - unitConverter.SetConversionFunction(KinematicViscosityUnit.Microstokes, KinematicViscosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(KinematicViscosity.BaseUnit, KinematicViscosityUnit.Millistokes, q => q.ToUnit(KinematicViscosityUnit.Millistokes)); - unitConverter.SetConversionFunction(KinematicViscosityUnit.Millistokes, KinematicViscosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(KinematicViscosity.BaseUnit, KinematicViscosityUnit.Nanostokes, q => q.ToUnit(KinematicViscosityUnit.Nanostokes)); - unitConverter.SetConversionFunction(KinematicViscosityUnit.Nanostokes, KinematicViscosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(KinematicViscosity.BaseUnit, KinematicViscosity.BaseUnit, q => q); - unitConverter.SetConversionFunction(KinematicViscosity.BaseUnit, KinematicViscosityUnit.Stokes, q => q.ToUnit(KinematicViscosityUnit.Stokes)); - unitConverter.SetConversionFunction(KinematicViscosityUnit.Stokes, KinematicViscosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(LapseRate.BaseUnit, LapseRate.BaseUnit, q => q); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.AstronomicalUnit, q => q.ToUnit(LengthUnit.AstronomicalUnit)); - unitConverter.SetConversionFunction(LengthUnit.AstronomicalUnit, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Centimeter, q => q.ToUnit(LengthUnit.Centimeter)); - unitConverter.SetConversionFunction(LengthUnit.Centimeter, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Decimeter, q => q.ToUnit(LengthUnit.Decimeter)); - unitConverter.SetConversionFunction(LengthUnit.Decimeter, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.DtpPica, q => q.ToUnit(LengthUnit.DtpPica)); - unitConverter.SetConversionFunction(LengthUnit.DtpPica, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.DtpPoint, q => q.ToUnit(LengthUnit.DtpPoint)); - unitConverter.SetConversionFunction(LengthUnit.DtpPoint, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Fathom, q => q.ToUnit(LengthUnit.Fathom)); - unitConverter.SetConversionFunction(LengthUnit.Fathom, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Foot, q => q.ToUnit(LengthUnit.Foot)); - unitConverter.SetConversionFunction(LengthUnit.Foot, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Hand, q => q.ToUnit(LengthUnit.Hand)); - unitConverter.SetConversionFunction(LengthUnit.Hand, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Hectometer, q => q.ToUnit(LengthUnit.Hectometer)); - unitConverter.SetConversionFunction(LengthUnit.Hectometer, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Inch, q => q.ToUnit(LengthUnit.Inch)); - unitConverter.SetConversionFunction(LengthUnit.Inch, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.KilolightYear, q => q.ToUnit(LengthUnit.KilolightYear)); - unitConverter.SetConversionFunction(LengthUnit.KilolightYear, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Kilometer, q => q.ToUnit(LengthUnit.Kilometer)); - unitConverter.SetConversionFunction(LengthUnit.Kilometer, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Kiloparsec, q => q.ToUnit(LengthUnit.Kiloparsec)); - unitConverter.SetConversionFunction(LengthUnit.Kiloparsec, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.LightYear, q => q.ToUnit(LengthUnit.LightYear)); - unitConverter.SetConversionFunction(LengthUnit.LightYear, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.MegalightYear, q => q.ToUnit(LengthUnit.MegalightYear)); - unitConverter.SetConversionFunction(LengthUnit.MegalightYear, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Megaparsec, q => q.ToUnit(LengthUnit.Megaparsec)); - unitConverter.SetConversionFunction(LengthUnit.Megaparsec, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, Length.BaseUnit, q => q); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Microinch, q => q.ToUnit(LengthUnit.Microinch)); - unitConverter.SetConversionFunction(LengthUnit.Microinch, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Micrometer, q => q.ToUnit(LengthUnit.Micrometer)); - unitConverter.SetConversionFunction(LengthUnit.Micrometer, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Mil, q => q.ToUnit(LengthUnit.Mil)); - unitConverter.SetConversionFunction(LengthUnit.Mil, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Mile, q => q.ToUnit(LengthUnit.Mile)); - unitConverter.SetConversionFunction(LengthUnit.Mile, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Millimeter, q => q.ToUnit(LengthUnit.Millimeter)); - unitConverter.SetConversionFunction(LengthUnit.Millimeter, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Nanometer, q => q.ToUnit(LengthUnit.Nanometer)); - unitConverter.SetConversionFunction(LengthUnit.Nanometer, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.NauticalMile, q => q.ToUnit(LengthUnit.NauticalMile)); - unitConverter.SetConversionFunction(LengthUnit.NauticalMile, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Parsec, q => q.ToUnit(LengthUnit.Parsec)); - unitConverter.SetConversionFunction(LengthUnit.Parsec, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.PrinterPica, q => q.ToUnit(LengthUnit.PrinterPica)); - unitConverter.SetConversionFunction(LengthUnit.PrinterPica, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.PrinterPoint, q => q.ToUnit(LengthUnit.PrinterPoint)); - unitConverter.SetConversionFunction(LengthUnit.PrinterPoint, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Shackle, q => q.ToUnit(LengthUnit.Shackle)); - unitConverter.SetConversionFunction(LengthUnit.Shackle, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.SolarRadius, q => q.ToUnit(LengthUnit.SolarRadius)); - unitConverter.SetConversionFunction(LengthUnit.SolarRadius, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Twip, q => q.ToUnit(LengthUnit.Twip)); - unitConverter.SetConversionFunction(LengthUnit.Twip, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.UsSurveyFoot, q => q.ToUnit(LengthUnit.UsSurveyFoot)); - unitConverter.SetConversionFunction(LengthUnit.UsSurveyFoot, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Length.BaseUnit, LengthUnit.Yard, q => q.ToUnit(LengthUnit.Yard)); - unitConverter.SetConversionFunction(LengthUnit.Yard, Length.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Level.BaseUnit, Level.BaseUnit, q => q); - unitConverter.SetConversionFunction(Level.BaseUnit, LevelUnit.Neper, q => q.ToUnit(LevelUnit.Neper)); - unitConverter.SetConversionFunction(LevelUnit.Neper, Level.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(LinearDensity.BaseUnit, LinearDensityUnit.GramPerMeter, q => q.ToUnit(LinearDensityUnit.GramPerMeter)); - unitConverter.SetConversionFunction(LinearDensityUnit.GramPerMeter, LinearDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(LinearDensity.BaseUnit, LinearDensity.BaseUnit, q => q); - unitConverter.SetConversionFunction(LinearDensity.BaseUnit, LinearDensityUnit.PoundPerFoot, q => q.ToUnit(LinearDensityUnit.PoundPerFoot)); - unitConverter.SetConversionFunction(LinearDensityUnit.PoundPerFoot, LinearDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Luminosity.BaseUnit, LuminosityUnit.Decawatt, q => q.ToUnit(LuminosityUnit.Decawatt)); - unitConverter.SetConversionFunction(LuminosityUnit.Decawatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Luminosity.BaseUnit, LuminosityUnit.Deciwatt, q => q.ToUnit(LuminosityUnit.Deciwatt)); - unitConverter.SetConversionFunction(LuminosityUnit.Deciwatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Luminosity.BaseUnit, LuminosityUnit.Femtowatt, q => q.ToUnit(LuminosityUnit.Femtowatt)); - unitConverter.SetConversionFunction(LuminosityUnit.Femtowatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Luminosity.BaseUnit, LuminosityUnit.Gigawatt, q => q.ToUnit(LuminosityUnit.Gigawatt)); - unitConverter.SetConversionFunction(LuminosityUnit.Gigawatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Luminosity.BaseUnit, LuminosityUnit.Kilowatt, q => q.ToUnit(LuminosityUnit.Kilowatt)); - unitConverter.SetConversionFunction(LuminosityUnit.Kilowatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Luminosity.BaseUnit, LuminosityUnit.Megawatt, q => q.ToUnit(LuminosityUnit.Megawatt)); - unitConverter.SetConversionFunction(LuminosityUnit.Megawatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Luminosity.BaseUnit, LuminosityUnit.Microwatt, q => q.ToUnit(LuminosityUnit.Microwatt)); - unitConverter.SetConversionFunction(LuminosityUnit.Microwatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Luminosity.BaseUnit, LuminosityUnit.Milliwatt, q => q.ToUnit(LuminosityUnit.Milliwatt)); - unitConverter.SetConversionFunction(LuminosityUnit.Milliwatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Luminosity.BaseUnit, LuminosityUnit.Nanowatt, q => q.ToUnit(LuminosityUnit.Nanowatt)); - unitConverter.SetConversionFunction(LuminosityUnit.Nanowatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Luminosity.BaseUnit, LuminosityUnit.Petawatt, q => q.ToUnit(LuminosityUnit.Petawatt)); - unitConverter.SetConversionFunction(LuminosityUnit.Petawatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Luminosity.BaseUnit, LuminosityUnit.Picowatt, q => q.ToUnit(LuminosityUnit.Picowatt)); - unitConverter.SetConversionFunction(LuminosityUnit.Picowatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Luminosity.BaseUnit, LuminosityUnit.SolarLuminosity, q => q.ToUnit(LuminosityUnit.SolarLuminosity)); - unitConverter.SetConversionFunction(LuminosityUnit.SolarLuminosity, Luminosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Luminosity.BaseUnit, LuminosityUnit.Terawatt, q => q.ToUnit(LuminosityUnit.Terawatt)); - unitConverter.SetConversionFunction(LuminosityUnit.Terawatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Luminosity.BaseUnit, Luminosity.BaseUnit, q => q); - unitConverter.SetConversionFunction(LuminousFlux.BaseUnit, LuminousFlux.BaseUnit, q => q); - unitConverter.SetConversionFunction(LuminousIntensity.BaseUnit, LuminousIntensity.BaseUnit, q => q); - unitConverter.SetConversionFunction(MagneticField.BaseUnit, MagneticFieldUnit.Microtesla, q => q.ToUnit(MagneticFieldUnit.Microtesla)); - unitConverter.SetConversionFunction(MagneticFieldUnit.Microtesla, MagneticField.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MagneticField.BaseUnit, MagneticFieldUnit.Millitesla, q => q.ToUnit(MagneticFieldUnit.Millitesla)); - unitConverter.SetConversionFunction(MagneticFieldUnit.Millitesla, MagneticField.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MagneticField.BaseUnit, MagneticFieldUnit.Nanotesla, q => q.ToUnit(MagneticFieldUnit.Nanotesla)); - unitConverter.SetConversionFunction(MagneticFieldUnit.Nanotesla, MagneticField.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MagneticField.BaseUnit, MagneticField.BaseUnit, q => q); - unitConverter.SetConversionFunction(MagneticFlux.BaseUnit, MagneticFlux.BaseUnit, q => q); - unitConverter.SetConversionFunction(Magnetization.BaseUnit, Magnetization.BaseUnit, q => q); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Centigram, q => q.ToUnit(MassUnit.Centigram)); - unitConverter.SetConversionFunction(MassUnit.Centigram, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Decagram, q => q.ToUnit(MassUnit.Decagram)); - unitConverter.SetConversionFunction(MassUnit.Decagram, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Decigram, q => q.ToUnit(MassUnit.Decigram)); - unitConverter.SetConversionFunction(MassUnit.Decigram, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.EarthMass, q => q.ToUnit(MassUnit.EarthMass)); - unitConverter.SetConversionFunction(MassUnit.EarthMass, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Grain, q => q.ToUnit(MassUnit.Grain)); - unitConverter.SetConversionFunction(MassUnit.Grain, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Gram, q => q.ToUnit(MassUnit.Gram)); - unitConverter.SetConversionFunction(MassUnit.Gram, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Hectogram, q => q.ToUnit(MassUnit.Hectogram)); - unitConverter.SetConversionFunction(MassUnit.Hectogram, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, Mass.BaseUnit, q => q); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Kilopound, q => q.ToUnit(MassUnit.Kilopound)); - unitConverter.SetConversionFunction(MassUnit.Kilopound, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Kilotonne, q => q.ToUnit(MassUnit.Kilotonne)); - unitConverter.SetConversionFunction(MassUnit.Kilotonne, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.LongHundredweight, q => q.ToUnit(MassUnit.LongHundredweight)); - unitConverter.SetConversionFunction(MassUnit.LongHundredweight, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.LongTon, q => q.ToUnit(MassUnit.LongTon)); - unitConverter.SetConversionFunction(MassUnit.LongTon, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Megapound, q => q.ToUnit(MassUnit.Megapound)); - unitConverter.SetConversionFunction(MassUnit.Megapound, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Megatonne, q => q.ToUnit(MassUnit.Megatonne)); - unitConverter.SetConversionFunction(MassUnit.Megatonne, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Microgram, q => q.ToUnit(MassUnit.Microgram)); - unitConverter.SetConversionFunction(MassUnit.Microgram, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Milligram, q => q.ToUnit(MassUnit.Milligram)); - unitConverter.SetConversionFunction(MassUnit.Milligram, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Nanogram, q => q.ToUnit(MassUnit.Nanogram)); - unitConverter.SetConversionFunction(MassUnit.Nanogram, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Ounce, q => q.ToUnit(MassUnit.Ounce)); - unitConverter.SetConversionFunction(MassUnit.Ounce, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Pound, q => q.ToUnit(MassUnit.Pound)); - unitConverter.SetConversionFunction(MassUnit.Pound, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.ShortHundredweight, q => q.ToUnit(MassUnit.ShortHundredweight)); - unitConverter.SetConversionFunction(MassUnit.ShortHundredweight, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.ShortTon, q => q.ToUnit(MassUnit.ShortTon)); - unitConverter.SetConversionFunction(MassUnit.ShortTon, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Slug, q => q.ToUnit(MassUnit.Slug)); - unitConverter.SetConversionFunction(MassUnit.Slug, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.SolarMass, q => q.ToUnit(MassUnit.SolarMass)); - unitConverter.SetConversionFunction(MassUnit.SolarMass, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Stone, q => q.ToUnit(MassUnit.Stone)); - unitConverter.SetConversionFunction(MassUnit.Stone, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Mass.BaseUnit, MassUnit.Tonne, q => q.ToUnit(MassUnit.Tonne)); - unitConverter.SetConversionFunction(MassUnit.Tonne, Mass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.CentigramPerDeciliter, q => q.ToUnit(MassConcentrationUnit.CentigramPerDeciliter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.CentigramPerDeciliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.CentigramPerLiter, q => q.ToUnit(MassConcentrationUnit.CentigramPerLiter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.CentigramPerLiter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.CentigramPerMilliliter, q => q.ToUnit(MassConcentrationUnit.CentigramPerMilliliter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.CentigramPerMilliliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.DecigramPerDeciliter, q => q.ToUnit(MassConcentrationUnit.DecigramPerDeciliter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.DecigramPerDeciliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.DecigramPerLiter, q => q.ToUnit(MassConcentrationUnit.DecigramPerLiter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.DecigramPerLiter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.DecigramPerMilliliter, q => q.ToUnit(MassConcentrationUnit.DecigramPerMilliliter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.DecigramPerMilliliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.GramPerCubicCentimeter, q => q.ToUnit(MassConcentrationUnit.GramPerCubicCentimeter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.GramPerCubicCentimeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.GramPerCubicMeter, q => q.ToUnit(MassConcentrationUnit.GramPerCubicMeter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.GramPerCubicMeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.GramPerCubicMillimeter, q => q.ToUnit(MassConcentrationUnit.GramPerCubicMillimeter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.GramPerCubicMillimeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.GramPerDeciliter, q => q.ToUnit(MassConcentrationUnit.GramPerDeciliter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.GramPerDeciliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.GramPerLiter, q => q.ToUnit(MassConcentrationUnit.GramPerLiter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.GramPerLiter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.GramPerMilliliter, q => q.ToUnit(MassConcentrationUnit.GramPerMilliliter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.GramPerMilliliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.KilogramPerCubicCentimeter, q => q.ToUnit(MassConcentrationUnit.KilogramPerCubicCentimeter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.KilogramPerCubicCentimeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentration.BaseUnit, q => q); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.KilogramPerCubicMillimeter, q => q.ToUnit(MassConcentrationUnit.KilogramPerCubicMillimeter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.KilogramPerCubicMillimeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.KilogramPerLiter, q => q.ToUnit(MassConcentrationUnit.KilogramPerLiter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.KilogramPerLiter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.KilopoundPerCubicFoot, q => q.ToUnit(MassConcentrationUnit.KilopoundPerCubicFoot)); - unitConverter.SetConversionFunction(MassConcentrationUnit.KilopoundPerCubicFoot, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.KilopoundPerCubicInch, q => q.ToUnit(MassConcentrationUnit.KilopoundPerCubicInch)); - unitConverter.SetConversionFunction(MassConcentrationUnit.KilopoundPerCubicInch, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.MicrogramPerCubicMeter, q => q.ToUnit(MassConcentrationUnit.MicrogramPerCubicMeter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.MicrogramPerCubicMeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.MicrogramPerDeciliter, q => q.ToUnit(MassConcentrationUnit.MicrogramPerDeciliter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.MicrogramPerDeciliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.MicrogramPerLiter, q => q.ToUnit(MassConcentrationUnit.MicrogramPerLiter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.MicrogramPerLiter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.MicrogramPerMilliliter, q => q.ToUnit(MassConcentrationUnit.MicrogramPerMilliliter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.MicrogramPerMilliliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.MilligramPerCubicMeter, q => q.ToUnit(MassConcentrationUnit.MilligramPerCubicMeter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.MilligramPerCubicMeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.MilligramPerDeciliter, q => q.ToUnit(MassConcentrationUnit.MilligramPerDeciliter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.MilligramPerDeciliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.MilligramPerLiter, q => q.ToUnit(MassConcentrationUnit.MilligramPerLiter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.MilligramPerLiter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.MilligramPerMilliliter, q => q.ToUnit(MassConcentrationUnit.MilligramPerMilliliter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.MilligramPerMilliliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.NanogramPerDeciliter, q => q.ToUnit(MassConcentrationUnit.NanogramPerDeciliter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.NanogramPerDeciliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.NanogramPerLiter, q => q.ToUnit(MassConcentrationUnit.NanogramPerLiter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.NanogramPerLiter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.NanogramPerMilliliter, q => q.ToUnit(MassConcentrationUnit.NanogramPerMilliliter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.NanogramPerMilliliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.PicogramPerDeciliter, q => q.ToUnit(MassConcentrationUnit.PicogramPerDeciliter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.PicogramPerDeciliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.PicogramPerLiter, q => q.ToUnit(MassConcentrationUnit.PicogramPerLiter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.PicogramPerLiter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.PicogramPerMilliliter, q => q.ToUnit(MassConcentrationUnit.PicogramPerMilliliter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.PicogramPerMilliliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.PoundPerCubicFoot, q => q.ToUnit(MassConcentrationUnit.PoundPerCubicFoot)); - unitConverter.SetConversionFunction(MassConcentrationUnit.PoundPerCubicFoot, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.PoundPerCubicInch, q => q.ToUnit(MassConcentrationUnit.PoundPerCubicInch)); - unitConverter.SetConversionFunction(MassConcentrationUnit.PoundPerCubicInch, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.PoundPerImperialGallon, q => q.ToUnit(MassConcentrationUnit.PoundPerImperialGallon)); - unitConverter.SetConversionFunction(MassConcentrationUnit.PoundPerImperialGallon, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.PoundPerUSGallon, q => q.ToUnit(MassConcentrationUnit.PoundPerUSGallon)); - unitConverter.SetConversionFunction(MassConcentrationUnit.PoundPerUSGallon, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.SlugPerCubicFoot, q => q.ToUnit(MassConcentrationUnit.SlugPerCubicFoot)); - unitConverter.SetConversionFunction(MassConcentrationUnit.SlugPerCubicFoot, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.TonnePerCubicCentimeter, q => q.ToUnit(MassConcentrationUnit.TonnePerCubicCentimeter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.TonnePerCubicCentimeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.TonnePerCubicMeter, q => q.ToUnit(MassConcentrationUnit.TonnePerCubicMeter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.TonnePerCubicMeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassConcentration.BaseUnit, MassConcentrationUnit.TonnePerCubicMillimeter, q => q.ToUnit(MassConcentrationUnit.TonnePerCubicMillimeter)); - unitConverter.SetConversionFunction(MassConcentrationUnit.TonnePerCubicMillimeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.CentigramPerDay, q => q.ToUnit(MassFlowUnit.CentigramPerDay)); - unitConverter.SetConversionFunction(MassFlowUnit.CentigramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.CentigramPerSecond, q => q.ToUnit(MassFlowUnit.CentigramPerSecond)); - unitConverter.SetConversionFunction(MassFlowUnit.CentigramPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.DecagramPerDay, q => q.ToUnit(MassFlowUnit.DecagramPerDay)); - unitConverter.SetConversionFunction(MassFlowUnit.DecagramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.DecagramPerSecond, q => q.ToUnit(MassFlowUnit.DecagramPerSecond)); - unitConverter.SetConversionFunction(MassFlowUnit.DecagramPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.DecigramPerDay, q => q.ToUnit(MassFlowUnit.DecigramPerDay)); - unitConverter.SetConversionFunction(MassFlowUnit.DecigramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.DecigramPerSecond, q => q.ToUnit(MassFlowUnit.DecigramPerSecond)); - unitConverter.SetConversionFunction(MassFlowUnit.DecigramPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.GramPerDay, q => q.ToUnit(MassFlowUnit.GramPerDay)); - unitConverter.SetConversionFunction(MassFlowUnit.GramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.GramPerHour, q => q.ToUnit(MassFlowUnit.GramPerHour)); - unitConverter.SetConversionFunction(MassFlowUnit.GramPerHour, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlow.BaseUnit, q => q); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.HectogramPerDay, q => q.ToUnit(MassFlowUnit.HectogramPerDay)); - unitConverter.SetConversionFunction(MassFlowUnit.HectogramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.HectogramPerSecond, q => q.ToUnit(MassFlowUnit.HectogramPerSecond)); - unitConverter.SetConversionFunction(MassFlowUnit.HectogramPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.KilogramPerDay, q => q.ToUnit(MassFlowUnit.KilogramPerDay)); - unitConverter.SetConversionFunction(MassFlowUnit.KilogramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.KilogramPerHour, q => q.ToUnit(MassFlowUnit.KilogramPerHour)); - unitConverter.SetConversionFunction(MassFlowUnit.KilogramPerHour, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.KilogramPerMinute, q => q.ToUnit(MassFlowUnit.KilogramPerMinute)); - unitConverter.SetConversionFunction(MassFlowUnit.KilogramPerMinute, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.KilogramPerSecond, q => q.ToUnit(MassFlowUnit.KilogramPerSecond)); - unitConverter.SetConversionFunction(MassFlowUnit.KilogramPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.MegagramPerDay, q => q.ToUnit(MassFlowUnit.MegagramPerDay)); - unitConverter.SetConversionFunction(MassFlowUnit.MegagramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.MegapoundPerDay, q => q.ToUnit(MassFlowUnit.MegapoundPerDay)); - unitConverter.SetConversionFunction(MassFlowUnit.MegapoundPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.MegapoundPerHour, q => q.ToUnit(MassFlowUnit.MegapoundPerHour)); - unitConverter.SetConversionFunction(MassFlowUnit.MegapoundPerHour, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.MegapoundPerMinute, q => q.ToUnit(MassFlowUnit.MegapoundPerMinute)); - unitConverter.SetConversionFunction(MassFlowUnit.MegapoundPerMinute, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.MegapoundPerSecond, q => q.ToUnit(MassFlowUnit.MegapoundPerSecond)); - unitConverter.SetConversionFunction(MassFlowUnit.MegapoundPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.MicrogramPerDay, q => q.ToUnit(MassFlowUnit.MicrogramPerDay)); - unitConverter.SetConversionFunction(MassFlowUnit.MicrogramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.MicrogramPerSecond, q => q.ToUnit(MassFlowUnit.MicrogramPerSecond)); - unitConverter.SetConversionFunction(MassFlowUnit.MicrogramPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.MilligramPerDay, q => q.ToUnit(MassFlowUnit.MilligramPerDay)); - unitConverter.SetConversionFunction(MassFlowUnit.MilligramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.MilligramPerSecond, q => q.ToUnit(MassFlowUnit.MilligramPerSecond)); - unitConverter.SetConversionFunction(MassFlowUnit.MilligramPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.NanogramPerDay, q => q.ToUnit(MassFlowUnit.NanogramPerDay)); - unitConverter.SetConversionFunction(MassFlowUnit.NanogramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.NanogramPerSecond, q => q.ToUnit(MassFlowUnit.NanogramPerSecond)); - unitConverter.SetConversionFunction(MassFlowUnit.NanogramPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.PoundPerDay, q => q.ToUnit(MassFlowUnit.PoundPerDay)); - unitConverter.SetConversionFunction(MassFlowUnit.PoundPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.PoundPerHour, q => q.ToUnit(MassFlowUnit.PoundPerHour)); - unitConverter.SetConversionFunction(MassFlowUnit.PoundPerHour, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.PoundPerMinute, q => q.ToUnit(MassFlowUnit.PoundPerMinute)); - unitConverter.SetConversionFunction(MassFlowUnit.PoundPerMinute, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.PoundPerSecond, q => q.ToUnit(MassFlowUnit.PoundPerSecond)); - unitConverter.SetConversionFunction(MassFlowUnit.PoundPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.ShortTonPerHour, q => q.ToUnit(MassFlowUnit.ShortTonPerHour)); - unitConverter.SetConversionFunction(MassFlowUnit.ShortTonPerHour, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.TonnePerDay, q => q.ToUnit(MassFlowUnit.TonnePerDay)); - unitConverter.SetConversionFunction(MassFlowUnit.TonnePerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlow.BaseUnit, MassFlowUnit.TonnePerHour, q => q.ToUnit(MassFlowUnit.TonnePerHour)); - unitConverter.SetConversionFunction(MassFlowUnit.TonnePerHour, MassFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlux.BaseUnit, MassFluxUnit.GramPerSecondPerSquareMeter, q => q.ToUnit(MassFluxUnit.GramPerSecondPerSquareMeter)); - unitConverter.SetConversionFunction(MassFluxUnit.GramPerSecondPerSquareMeter, MassFlux.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFlux.BaseUnit, MassFlux.BaseUnit, q => q); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.CentigramPerGram, q => q.ToUnit(MassFractionUnit.CentigramPerGram)); - unitConverter.SetConversionFunction(MassFractionUnit.CentigramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.CentigramPerKilogram, q => q.ToUnit(MassFractionUnit.CentigramPerKilogram)); - unitConverter.SetConversionFunction(MassFractionUnit.CentigramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.DecagramPerGram, q => q.ToUnit(MassFractionUnit.DecagramPerGram)); - unitConverter.SetConversionFunction(MassFractionUnit.DecagramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.DecagramPerKilogram, q => q.ToUnit(MassFractionUnit.DecagramPerKilogram)); - unitConverter.SetConversionFunction(MassFractionUnit.DecagramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.DecigramPerGram, q => q.ToUnit(MassFractionUnit.DecigramPerGram)); - unitConverter.SetConversionFunction(MassFractionUnit.DecigramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.DecigramPerKilogram, q => q.ToUnit(MassFractionUnit.DecigramPerKilogram)); - unitConverter.SetConversionFunction(MassFractionUnit.DecigramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFraction.BaseUnit, q => q); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.GramPerGram, q => q.ToUnit(MassFractionUnit.GramPerGram)); - unitConverter.SetConversionFunction(MassFractionUnit.GramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.GramPerKilogram, q => q.ToUnit(MassFractionUnit.GramPerKilogram)); - unitConverter.SetConversionFunction(MassFractionUnit.GramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.HectogramPerGram, q => q.ToUnit(MassFractionUnit.HectogramPerGram)); - unitConverter.SetConversionFunction(MassFractionUnit.HectogramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.HectogramPerKilogram, q => q.ToUnit(MassFractionUnit.HectogramPerKilogram)); - unitConverter.SetConversionFunction(MassFractionUnit.HectogramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.KilogramPerGram, q => q.ToUnit(MassFractionUnit.KilogramPerGram)); - unitConverter.SetConversionFunction(MassFractionUnit.KilogramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.KilogramPerKilogram, q => q.ToUnit(MassFractionUnit.KilogramPerKilogram)); - unitConverter.SetConversionFunction(MassFractionUnit.KilogramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.MicrogramPerGram, q => q.ToUnit(MassFractionUnit.MicrogramPerGram)); - unitConverter.SetConversionFunction(MassFractionUnit.MicrogramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.MicrogramPerKilogram, q => q.ToUnit(MassFractionUnit.MicrogramPerKilogram)); - unitConverter.SetConversionFunction(MassFractionUnit.MicrogramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.MilligramPerGram, q => q.ToUnit(MassFractionUnit.MilligramPerGram)); - unitConverter.SetConversionFunction(MassFractionUnit.MilligramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.MilligramPerKilogram, q => q.ToUnit(MassFractionUnit.MilligramPerKilogram)); - unitConverter.SetConversionFunction(MassFractionUnit.MilligramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.NanogramPerGram, q => q.ToUnit(MassFractionUnit.NanogramPerGram)); - unitConverter.SetConversionFunction(MassFractionUnit.NanogramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.NanogramPerKilogram, q => q.ToUnit(MassFractionUnit.NanogramPerKilogram)); - unitConverter.SetConversionFunction(MassFractionUnit.NanogramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.PartPerBillion, q => q.ToUnit(MassFractionUnit.PartPerBillion)); - unitConverter.SetConversionFunction(MassFractionUnit.PartPerBillion, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.PartPerMillion, q => q.ToUnit(MassFractionUnit.PartPerMillion)); - unitConverter.SetConversionFunction(MassFractionUnit.PartPerMillion, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.PartPerThousand, q => q.ToUnit(MassFractionUnit.PartPerThousand)); - unitConverter.SetConversionFunction(MassFractionUnit.PartPerThousand, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.PartPerTrillion, q => q.ToUnit(MassFractionUnit.PartPerTrillion)); - unitConverter.SetConversionFunction(MassFractionUnit.PartPerTrillion, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassFraction.BaseUnit, MassFractionUnit.Percent, q => q.ToUnit(MassFractionUnit.Percent)); - unitConverter.SetConversionFunction(MassFractionUnit.Percent, MassFraction.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.GramSquareCentimeter, q => q.ToUnit(MassMomentOfInertiaUnit.GramSquareCentimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.GramSquareCentimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.GramSquareDecimeter, q => q.ToUnit(MassMomentOfInertiaUnit.GramSquareDecimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.GramSquareDecimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.GramSquareMeter, q => q.ToUnit(MassMomentOfInertiaUnit.GramSquareMeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.GramSquareMeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.GramSquareMillimeter, q => q.ToUnit(MassMomentOfInertiaUnit.GramSquareMillimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.GramSquareMillimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.KilogramSquareCentimeter, q => q.ToUnit(MassMomentOfInertiaUnit.KilogramSquareCentimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.KilogramSquareCentimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.KilogramSquareDecimeter, q => q.ToUnit(MassMomentOfInertiaUnit.KilogramSquareDecimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.KilogramSquareDecimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertia.BaseUnit, q => q); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.KilogramSquareMillimeter, q => q.ToUnit(MassMomentOfInertiaUnit.KilogramSquareMillimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.KilogramSquareMillimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.KilotonneSquareCentimeter, q => q.ToUnit(MassMomentOfInertiaUnit.KilotonneSquareCentimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.KilotonneSquareCentimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.KilotonneSquareDecimeter, q => q.ToUnit(MassMomentOfInertiaUnit.KilotonneSquareDecimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.KilotonneSquareDecimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.KilotonneSquareMeter, q => q.ToUnit(MassMomentOfInertiaUnit.KilotonneSquareMeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.KilotonneSquareMeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.KilotonneSquareMilimeter, q => q.ToUnit(MassMomentOfInertiaUnit.KilotonneSquareMilimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.KilotonneSquareMilimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.MegatonneSquareCentimeter, q => q.ToUnit(MassMomentOfInertiaUnit.MegatonneSquareCentimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.MegatonneSquareCentimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.MegatonneSquareDecimeter, q => q.ToUnit(MassMomentOfInertiaUnit.MegatonneSquareDecimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.MegatonneSquareDecimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.MegatonneSquareMeter, q => q.ToUnit(MassMomentOfInertiaUnit.MegatonneSquareMeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.MegatonneSquareMeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.MegatonneSquareMilimeter, q => q.ToUnit(MassMomentOfInertiaUnit.MegatonneSquareMilimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.MegatonneSquareMilimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.MilligramSquareCentimeter, q => q.ToUnit(MassMomentOfInertiaUnit.MilligramSquareCentimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.MilligramSquareCentimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.MilligramSquareDecimeter, q => q.ToUnit(MassMomentOfInertiaUnit.MilligramSquareDecimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.MilligramSquareDecimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.MilligramSquareMeter, q => q.ToUnit(MassMomentOfInertiaUnit.MilligramSquareMeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.MilligramSquareMeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.MilligramSquareMillimeter, q => q.ToUnit(MassMomentOfInertiaUnit.MilligramSquareMillimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.MilligramSquareMillimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.PoundSquareFoot, q => q.ToUnit(MassMomentOfInertiaUnit.PoundSquareFoot)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.PoundSquareFoot, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.PoundSquareInch, q => q.ToUnit(MassMomentOfInertiaUnit.PoundSquareInch)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.PoundSquareInch, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.SlugSquareFoot, q => q.ToUnit(MassMomentOfInertiaUnit.SlugSquareFoot)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.SlugSquareFoot, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.SlugSquareInch, q => q.ToUnit(MassMomentOfInertiaUnit.SlugSquareInch)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.SlugSquareInch, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.TonneSquareCentimeter, q => q.ToUnit(MassMomentOfInertiaUnit.TonneSquareCentimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.TonneSquareCentimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.TonneSquareDecimeter, q => q.ToUnit(MassMomentOfInertiaUnit.TonneSquareDecimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.TonneSquareDecimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.TonneSquareMeter, q => q.ToUnit(MassMomentOfInertiaUnit.TonneSquareMeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.TonneSquareMeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.TonneSquareMilimeter, q => q.ToUnit(MassMomentOfInertiaUnit.TonneSquareMilimeter)); - unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.TonneSquareMilimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MolarEnergy.BaseUnit, MolarEnergy.BaseUnit, q => q); - unitConverter.SetConversionFunction(MolarEnergy.BaseUnit, MolarEnergyUnit.KilojoulePerMole, q => q.ToUnit(MolarEnergyUnit.KilojoulePerMole)); - unitConverter.SetConversionFunction(MolarEnergyUnit.KilojoulePerMole, MolarEnergy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MolarEnergy.BaseUnit, MolarEnergyUnit.MegajoulePerMole, q => q.ToUnit(MolarEnergyUnit.MegajoulePerMole)); - unitConverter.SetConversionFunction(MolarEnergyUnit.MegajoulePerMole, MolarEnergy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MolarEntropy.BaseUnit, MolarEntropy.BaseUnit, q => q); - unitConverter.SetConversionFunction(MolarEntropy.BaseUnit, MolarEntropyUnit.KilojoulePerMoleKelvin, q => q.ToUnit(MolarEntropyUnit.KilojoulePerMoleKelvin)); - unitConverter.SetConversionFunction(MolarEntropyUnit.KilojoulePerMoleKelvin, MolarEntropy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MolarEntropy.BaseUnit, MolarEntropyUnit.MegajoulePerMoleKelvin, q => q.ToUnit(MolarEntropyUnit.MegajoulePerMoleKelvin)); - unitConverter.SetConversionFunction(MolarEntropyUnit.MegajoulePerMoleKelvin, MolarEntropy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Molarity.BaseUnit, MolarityUnit.CentimolesPerLiter, q => q.ToUnit(MolarityUnit.CentimolesPerLiter)); - unitConverter.SetConversionFunction(MolarityUnit.CentimolesPerLiter, Molarity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Molarity.BaseUnit, MolarityUnit.DecimolesPerLiter, q => q.ToUnit(MolarityUnit.DecimolesPerLiter)); - unitConverter.SetConversionFunction(MolarityUnit.DecimolesPerLiter, Molarity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Molarity.BaseUnit, MolarityUnit.MicromolesPerLiter, q => q.ToUnit(MolarityUnit.MicromolesPerLiter)); - unitConverter.SetConversionFunction(MolarityUnit.MicromolesPerLiter, Molarity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Molarity.BaseUnit, MolarityUnit.MillimolesPerLiter, q => q.ToUnit(MolarityUnit.MillimolesPerLiter)); - unitConverter.SetConversionFunction(MolarityUnit.MillimolesPerLiter, Molarity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Molarity.BaseUnit, Molarity.BaseUnit, q => q); - unitConverter.SetConversionFunction(Molarity.BaseUnit, MolarityUnit.MolesPerLiter, q => q.ToUnit(MolarityUnit.MolesPerLiter)); - unitConverter.SetConversionFunction(MolarityUnit.MolesPerLiter, Molarity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Molarity.BaseUnit, MolarityUnit.NanomolesPerLiter, q => q.ToUnit(MolarityUnit.NanomolesPerLiter)); - unitConverter.SetConversionFunction(MolarityUnit.NanomolesPerLiter, Molarity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Molarity.BaseUnit, MolarityUnit.PicomolesPerLiter, q => q.ToUnit(MolarityUnit.PicomolesPerLiter)); - unitConverter.SetConversionFunction(MolarityUnit.PicomolesPerLiter, Molarity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MolarMass.BaseUnit, MolarMassUnit.CentigramPerMole, q => q.ToUnit(MolarMassUnit.CentigramPerMole)); - unitConverter.SetConversionFunction(MolarMassUnit.CentigramPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MolarMass.BaseUnit, MolarMassUnit.DecagramPerMole, q => q.ToUnit(MolarMassUnit.DecagramPerMole)); - unitConverter.SetConversionFunction(MolarMassUnit.DecagramPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MolarMass.BaseUnit, MolarMassUnit.DecigramPerMole, q => q.ToUnit(MolarMassUnit.DecigramPerMole)); - unitConverter.SetConversionFunction(MolarMassUnit.DecigramPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MolarMass.BaseUnit, MolarMassUnit.GramPerMole, q => q.ToUnit(MolarMassUnit.GramPerMole)); - unitConverter.SetConversionFunction(MolarMassUnit.GramPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MolarMass.BaseUnit, MolarMassUnit.HectogramPerMole, q => q.ToUnit(MolarMassUnit.HectogramPerMole)); - unitConverter.SetConversionFunction(MolarMassUnit.HectogramPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MolarMass.BaseUnit, MolarMass.BaseUnit, q => q); - unitConverter.SetConversionFunction(MolarMass.BaseUnit, MolarMassUnit.KilopoundPerMole, q => q.ToUnit(MolarMassUnit.KilopoundPerMole)); - unitConverter.SetConversionFunction(MolarMassUnit.KilopoundPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MolarMass.BaseUnit, MolarMassUnit.MegapoundPerMole, q => q.ToUnit(MolarMassUnit.MegapoundPerMole)); - unitConverter.SetConversionFunction(MolarMassUnit.MegapoundPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MolarMass.BaseUnit, MolarMassUnit.MicrogramPerMole, q => q.ToUnit(MolarMassUnit.MicrogramPerMole)); - unitConverter.SetConversionFunction(MolarMassUnit.MicrogramPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MolarMass.BaseUnit, MolarMassUnit.MilligramPerMole, q => q.ToUnit(MolarMassUnit.MilligramPerMole)); - unitConverter.SetConversionFunction(MolarMassUnit.MilligramPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MolarMass.BaseUnit, MolarMassUnit.NanogramPerMole, q => q.ToUnit(MolarMassUnit.NanogramPerMole)); - unitConverter.SetConversionFunction(MolarMassUnit.NanogramPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(MolarMass.BaseUnit, MolarMassUnit.PoundPerMole, q => q.ToUnit(MolarMassUnit.PoundPerMole)); - unitConverter.SetConversionFunction(MolarMassUnit.PoundPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Permeability.BaseUnit, Permeability.BaseUnit, q => q); - unitConverter.SetConversionFunction(Permittivity.BaseUnit, Permittivity.BaseUnit, q => q); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.BoilerHorsepower, q => q.ToUnit(PowerUnit.BoilerHorsepower)); - unitConverter.SetConversionFunction(PowerUnit.BoilerHorsepower, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.BritishThermalUnitPerHour, q => q.ToUnit(PowerUnit.BritishThermalUnitPerHour)); - unitConverter.SetConversionFunction(PowerUnit.BritishThermalUnitPerHour, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.Decawatt, q => q.ToUnit(PowerUnit.Decawatt)); - unitConverter.SetConversionFunction(PowerUnit.Decawatt, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.Deciwatt, q => q.ToUnit(PowerUnit.Deciwatt)); - unitConverter.SetConversionFunction(PowerUnit.Deciwatt, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.ElectricalHorsepower, q => q.ToUnit(PowerUnit.ElectricalHorsepower)); - unitConverter.SetConversionFunction(PowerUnit.ElectricalHorsepower, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.Femtowatt, q => q.ToUnit(PowerUnit.Femtowatt)); - unitConverter.SetConversionFunction(PowerUnit.Femtowatt, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.Gigawatt, q => q.ToUnit(PowerUnit.Gigawatt)); - unitConverter.SetConversionFunction(PowerUnit.Gigawatt, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.HydraulicHorsepower, q => q.ToUnit(PowerUnit.HydraulicHorsepower)); - unitConverter.SetConversionFunction(PowerUnit.HydraulicHorsepower, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.KilobritishThermalUnitPerHour, q => q.ToUnit(PowerUnit.KilobritishThermalUnitPerHour)); - unitConverter.SetConversionFunction(PowerUnit.KilobritishThermalUnitPerHour, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.Kilowatt, q => q.ToUnit(PowerUnit.Kilowatt)); - unitConverter.SetConversionFunction(PowerUnit.Kilowatt, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.MechanicalHorsepower, q => q.ToUnit(PowerUnit.MechanicalHorsepower)); - unitConverter.SetConversionFunction(PowerUnit.MechanicalHorsepower, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.Megawatt, q => q.ToUnit(PowerUnit.Megawatt)); - unitConverter.SetConversionFunction(PowerUnit.Megawatt, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.MetricHorsepower, q => q.ToUnit(PowerUnit.MetricHorsepower)); - unitConverter.SetConversionFunction(PowerUnit.MetricHorsepower, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.Microwatt, q => q.ToUnit(PowerUnit.Microwatt)); - unitConverter.SetConversionFunction(PowerUnit.Microwatt, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.Milliwatt, q => q.ToUnit(PowerUnit.Milliwatt)); - unitConverter.SetConversionFunction(PowerUnit.Milliwatt, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.Nanowatt, q => q.ToUnit(PowerUnit.Nanowatt)); - unitConverter.SetConversionFunction(PowerUnit.Nanowatt, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.Petawatt, q => q.ToUnit(PowerUnit.Petawatt)); - unitConverter.SetConversionFunction(PowerUnit.Petawatt, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.Picowatt, q => q.ToUnit(PowerUnit.Picowatt)); - unitConverter.SetConversionFunction(PowerUnit.Picowatt, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, PowerUnit.Terawatt, q => q.ToUnit(PowerUnit.Terawatt)); - unitConverter.SetConversionFunction(PowerUnit.Terawatt, Power.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Power.BaseUnit, Power.BaseUnit, q => q); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.DecawattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.DecawattPerCubicFoot)); - unitConverter.SetConversionFunction(PowerDensityUnit.DecawattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.DecawattPerCubicInch, q => q.ToUnit(PowerDensityUnit.DecawattPerCubicInch)); - unitConverter.SetConversionFunction(PowerDensityUnit.DecawattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.DecawattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.DecawattPerCubicMeter)); - unitConverter.SetConversionFunction(PowerDensityUnit.DecawattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.DecawattPerLiter, q => q.ToUnit(PowerDensityUnit.DecawattPerLiter)); - unitConverter.SetConversionFunction(PowerDensityUnit.DecawattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.DeciwattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.DeciwattPerCubicFoot)); - unitConverter.SetConversionFunction(PowerDensityUnit.DeciwattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.DeciwattPerCubicInch, q => q.ToUnit(PowerDensityUnit.DeciwattPerCubicInch)); - unitConverter.SetConversionFunction(PowerDensityUnit.DeciwattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.DeciwattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.DeciwattPerCubicMeter)); - unitConverter.SetConversionFunction(PowerDensityUnit.DeciwattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.DeciwattPerLiter, q => q.ToUnit(PowerDensityUnit.DeciwattPerLiter)); - unitConverter.SetConversionFunction(PowerDensityUnit.DeciwattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.GigawattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.GigawattPerCubicFoot)); - unitConverter.SetConversionFunction(PowerDensityUnit.GigawattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.GigawattPerCubicInch, q => q.ToUnit(PowerDensityUnit.GigawattPerCubicInch)); - unitConverter.SetConversionFunction(PowerDensityUnit.GigawattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.GigawattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.GigawattPerCubicMeter)); - unitConverter.SetConversionFunction(PowerDensityUnit.GigawattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.GigawattPerLiter, q => q.ToUnit(PowerDensityUnit.GigawattPerLiter)); - unitConverter.SetConversionFunction(PowerDensityUnit.GigawattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.KilowattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.KilowattPerCubicFoot)); - unitConverter.SetConversionFunction(PowerDensityUnit.KilowattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.KilowattPerCubicInch, q => q.ToUnit(PowerDensityUnit.KilowattPerCubicInch)); - unitConverter.SetConversionFunction(PowerDensityUnit.KilowattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.KilowattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.KilowattPerCubicMeter)); - unitConverter.SetConversionFunction(PowerDensityUnit.KilowattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.KilowattPerLiter, q => q.ToUnit(PowerDensityUnit.KilowattPerLiter)); - unitConverter.SetConversionFunction(PowerDensityUnit.KilowattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.MegawattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.MegawattPerCubicFoot)); - unitConverter.SetConversionFunction(PowerDensityUnit.MegawattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.MegawattPerCubicInch, q => q.ToUnit(PowerDensityUnit.MegawattPerCubicInch)); - unitConverter.SetConversionFunction(PowerDensityUnit.MegawattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.MegawattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.MegawattPerCubicMeter)); - unitConverter.SetConversionFunction(PowerDensityUnit.MegawattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.MegawattPerLiter, q => q.ToUnit(PowerDensityUnit.MegawattPerLiter)); - unitConverter.SetConversionFunction(PowerDensityUnit.MegawattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.MicrowattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.MicrowattPerCubicFoot)); - unitConverter.SetConversionFunction(PowerDensityUnit.MicrowattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.MicrowattPerCubicInch, q => q.ToUnit(PowerDensityUnit.MicrowattPerCubicInch)); - unitConverter.SetConversionFunction(PowerDensityUnit.MicrowattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.MicrowattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.MicrowattPerCubicMeter)); - unitConverter.SetConversionFunction(PowerDensityUnit.MicrowattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.MicrowattPerLiter, q => q.ToUnit(PowerDensityUnit.MicrowattPerLiter)); - unitConverter.SetConversionFunction(PowerDensityUnit.MicrowattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.MilliwattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.MilliwattPerCubicFoot)); - unitConverter.SetConversionFunction(PowerDensityUnit.MilliwattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.MilliwattPerCubicInch, q => q.ToUnit(PowerDensityUnit.MilliwattPerCubicInch)); - unitConverter.SetConversionFunction(PowerDensityUnit.MilliwattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.MilliwattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.MilliwattPerCubicMeter)); - unitConverter.SetConversionFunction(PowerDensityUnit.MilliwattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.MilliwattPerLiter, q => q.ToUnit(PowerDensityUnit.MilliwattPerLiter)); - unitConverter.SetConversionFunction(PowerDensityUnit.MilliwattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.NanowattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.NanowattPerCubicFoot)); - unitConverter.SetConversionFunction(PowerDensityUnit.NanowattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.NanowattPerCubicInch, q => q.ToUnit(PowerDensityUnit.NanowattPerCubicInch)); - unitConverter.SetConversionFunction(PowerDensityUnit.NanowattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.NanowattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.NanowattPerCubicMeter)); - unitConverter.SetConversionFunction(PowerDensityUnit.NanowattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.NanowattPerLiter, q => q.ToUnit(PowerDensityUnit.NanowattPerLiter)); - unitConverter.SetConversionFunction(PowerDensityUnit.NanowattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.PicowattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.PicowattPerCubicFoot)); - unitConverter.SetConversionFunction(PowerDensityUnit.PicowattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.PicowattPerCubicInch, q => q.ToUnit(PowerDensityUnit.PicowattPerCubicInch)); - unitConverter.SetConversionFunction(PowerDensityUnit.PicowattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.PicowattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.PicowattPerCubicMeter)); - unitConverter.SetConversionFunction(PowerDensityUnit.PicowattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.PicowattPerLiter, q => q.ToUnit(PowerDensityUnit.PicowattPerLiter)); - unitConverter.SetConversionFunction(PowerDensityUnit.PicowattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.TerawattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.TerawattPerCubicFoot)); - unitConverter.SetConversionFunction(PowerDensityUnit.TerawattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.TerawattPerCubicInch, q => q.ToUnit(PowerDensityUnit.TerawattPerCubicInch)); - unitConverter.SetConversionFunction(PowerDensityUnit.TerawattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.TerawattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.TerawattPerCubicMeter)); - unitConverter.SetConversionFunction(PowerDensityUnit.TerawattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.TerawattPerLiter, q => q.ToUnit(PowerDensityUnit.TerawattPerLiter)); - unitConverter.SetConversionFunction(PowerDensityUnit.TerawattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.WattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.WattPerCubicFoot)); - unitConverter.SetConversionFunction(PowerDensityUnit.WattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.WattPerCubicInch, q => q.ToUnit(PowerDensityUnit.WattPerCubicInch)); - unitConverter.SetConversionFunction(PowerDensityUnit.WattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensity.BaseUnit, q => q); - unitConverter.SetConversionFunction(PowerDensity.BaseUnit, PowerDensityUnit.WattPerLiter, q => q.ToUnit(PowerDensityUnit.WattPerLiter)); - unitConverter.SetConversionFunction(PowerDensityUnit.WattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerRatio.BaseUnit, PowerRatioUnit.DecibelMilliwatt, q => q.ToUnit(PowerRatioUnit.DecibelMilliwatt)); - unitConverter.SetConversionFunction(PowerRatioUnit.DecibelMilliwatt, PowerRatio.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PowerRatio.BaseUnit, PowerRatio.BaseUnit, q => q); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.Atmosphere, q => q.ToUnit(PressureUnit.Atmosphere)); - unitConverter.SetConversionFunction(PressureUnit.Atmosphere, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.Bar, q => q.ToUnit(PressureUnit.Bar)); - unitConverter.SetConversionFunction(PressureUnit.Bar, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.Centibar, q => q.ToUnit(PressureUnit.Centibar)); - unitConverter.SetConversionFunction(PressureUnit.Centibar, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.Decapascal, q => q.ToUnit(PressureUnit.Decapascal)); - unitConverter.SetConversionFunction(PressureUnit.Decapascal, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.Decibar, q => q.ToUnit(PressureUnit.Decibar)); - unitConverter.SetConversionFunction(PressureUnit.Decibar, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.DynePerSquareCentimeter, q => q.ToUnit(PressureUnit.DynePerSquareCentimeter)); - unitConverter.SetConversionFunction(PressureUnit.DynePerSquareCentimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.FootOfHead, q => q.ToUnit(PressureUnit.FootOfHead)); - unitConverter.SetConversionFunction(PressureUnit.FootOfHead, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.Gigapascal, q => q.ToUnit(PressureUnit.Gigapascal)); - unitConverter.SetConversionFunction(PressureUnit.Gigapascal, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.Hectopascal, q => q.ToUnit(PressureUnit.Hectopascal)); - unitConverter.SetConversionFunction(PressureUnit.Hectopascal, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.InchOfMercury, q => q.ToUnit(PressureUnit.InchOfMercury)); - unitConverter.SetConversionFunction(PressureUnit.InchOfMercury, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.InchOfWaterColumn, q => q.ToUnit(PressureUnit.InchOfWaterColumn)); - unitConverter.SetConversionFunction(PressureUnit.InchOfWaterColumn, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.Kilobar, q => q.ToUnit(PressureUnit.Kilobar)); - unitConverter.SetConversionFunction(PressureUnit.Kilobar, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.KilogramForcePerSquareCentimeter, q => q.ToUnit(PressureUnit.KilogramForcePerSquareCentimeter)); - unitConverter.SetConversionFunction(PressureUnit.KilogramForcePerSquareCentimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.KilogramForcePerSquareMeter, q => q.ToUnit(PressureUnit.KilogramForcePerSquareMeter)); - unitConverter.SetConversionFunction(PressureUnit.KilogramForcePerSquareMeter, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.KilogramForcePerSquareMillimeter, q => q.ToUnit(PressureUnit.KilogramForcePerSquareMillimeter)); - unitConverter.SetConversionFunction(PressureUnit.KilogramForcePerSquareMillimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.KilonewtonPerSquareCentimeter, q => q.ToUnit(PressureUnit.KilonewtonPerSquareCentimeter)); - unitConverter.SetConversionFunction(PressureUnit.KilonewtonPerSquareCentimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.KilonewtonPerSquareMeter, q => q.ToUnit(PressureUnit.KilonewtonPerSquareMeter)); - unitConverter.SetConversionFunction(PressureUnit.KilonewtonPerSquareMeter, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.KilonewtonPerSquareMillimeter, q => q.ToUnit(PressureUnit.KilonewtonPerSquareMillimeter)); - unitConverter.SetConversionFunction(PressureUnit.KilonewtonPerSquareMillimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.Kilopascal, q => q.ToUnit(PressureUnit.Kilopascal)); - unitConverter.SetConversionFunction(PressureUnit.Kilopascal, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.KilopoundForcePerSquareFoot, q => q.ToUnit(PressureUnit.KilopoundForcePerSquareFoot)); - unitConverter.SetConversionFunction(PressureUnit.KilopoundForcePerSquareFoot, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.KilopoundForcePerSquareInch, q => q.ToUnit(PressureUnit.KilopoundForcePerSquareInch)); - unitConverter.SetConversionFunction(PressureUnit.KilopoundForcePerSquareInch, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.Megabar, q => q.ToUnit(PressureUnit.Megabar)); - unitConverter.SetConversionFunction(PressureUnit.Megabar, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.MeganewtonPerSquareMeter, q => q.ToUnit(PressureUnit.MeganewtonPerSquareMeter)); - unitConverter.SetConversionFunction(PressureUnit.MeganewtonPerSquareMeter, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.Megapascal, q => q.ToUnit(PressureUnit.Megapascal)); - unitConverter.SetConversionFunction(PressureUnit.Megapascal, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.MeterOfHead, q => q.ToUnit(PressureUnit.MeterOfHead)); - unitConverter.SetConversionFunction(PressureUnit.MeterOfHead, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.Microbar, q => q.ToUnit(PressureUnit.Microbar)); - unitConverter.SetConversionFunction(PressureUnit.Microbar, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.Micropascal, q => q.ToUnit(PressureUnit.Micropascal)); - unitConverter.SetConversionFunction(PressureUnit.Micropascal, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.Millibar, q => q.ToUnit(PressureUnit.Millibar)); - unitConverter.SetConversionFunction(PressureUnit.Millibar, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.MillimeterOfMercury, q => q.ToUnit(PressureUnit.MillimeterOfMercury)); - unitConverter.SetConversionFunction(PressureUnit.MillimeterOfMercury, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.Millipascal, q => q.ToUnit(PressureUnit.Millipascal)); - unitConverter.SetConversionFunction(PressureUnit.Millipascal, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.NewtonPerSquareCentimeter, q => q.ToUnit(PressureUnit.NewtonPerSquareCentimeter)); - unitConverter.SetConversionFunction(PressureUnit.NewtonPerSquareCentimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.NewtonPerSquareMeter, q => q.ToUnit(PressureUnit.NewtonPerSquareMeter)); - unitConverter.SetConversionFunction(PressureUnit.NewtonPerSquareMeter, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.NewtonPerSquareMillimeter, q => q.ToUnit(PressureUnit.NewtonPerSquareMillimeter)); - unitConverter.SetConversionFunction(PressureUnit.NewtonPerSquareMillimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, Pressure.BaseUnit, q => q); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.PoundForcePerSquareFoot, q => q.ToUnit(PressureUnit.PoundForcePerSquareFoot)); - unitConverter.SetConversionFunction(PressureUnit.PoundForcePerSquareFoot, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.PoundForcePerSquareInch, q => q.ToUnit(PressureUnit.PoundForcePerSquareInch)); - unitConverter.SetConversionFunction(PressureUnit.PoundForcePerSquareInch, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.PoundPerInchSecondSquared, q => q.ToUnit(PressureUnit.PoundPerInchSecondSquared)); - unitConverter.SetConversionFunction(PressureUnit.PoundPerInchSecondSquared, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.TechnicalAtmosphere, q => q.ToUnit(PressureUnit.TechnicalAtmosphere)); - unitConverter.SetConversionFunction(PressureUnit.TechnicalAtmosphere, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.TonneForcePerSquareCentimeter, q => q.ToUnit(PressureUnit.TonneForcePerSquareCentimeter)); - unitConverter.SetConversionFunction(PressureUnit.TonneForcePerSquareCentimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.TonneForcePerSquareMeter, q => q.ToUnit(PressureUnit.TonneForcePerSquareMeter)); - unitConverter.SetConversionFunction(PressureUnit.TonneForcePerSquareMeter, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.TonneForcePerSquareMillimeter, q => q.ToUnit(PressureUnit.TonneForcePerSquareMillimeter)); - unitConverter.SetConversionFunction(PressureUnit.TonneForcePerSquareMillimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Pressure.BaseUnit, PressureUnit.Torr, q => q.ToUnit(PressureUnit.Torr)); - unitConverter.SetConversionFunction(PressureUnit.Torr, Pressure.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PressureChangeRate.BaseUnit, PressureChangeRateUnit.AtmospherePerSecond, q => q.ToUnit(PressureChangeRateUnit.AtmospherePerSecond)); - unitConverter.SetConversionFunction(PressureChangeRateUnit.AtmospherePerSecond, PressureChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PressureChangeRate.BaseUnit, PressureChangeRateUnit.KilopascalPerMinute, q => q.ToUnit(PressureChangeRateUnit.KilopascalPerMinute)); - unitConverter.SetConversionFunction(PressureChangeRateUnit.KilopascalPerMinute, PressureChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PressureChangeRate.BaseUnit, PressureChangeRateUnit.KilopascalPerSecond, q => q.ToUnit(PressureChangeRateUnit.KilopascalPerSecond)); - unitConverter.SetConversionFunction(PressureChangeRateUnit.KilopascalPerSecond, PressureChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PressureChangeRate.BaseUnit, PressureChangeRateUnit.MegapascalPerMinute, q => q.ToUnit(PressureChangeRateUnit.MegapascalPerMinute)); - unitConverter.SetConversionFunction(PressureChangeRateUnit.MegapascalPerMinute, PressureChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PressureChangeRate.BaseUnit, PressureChangeRateUnit.MegapascalPerSecond, q => q.ToUnit(PressureChangeRateUnit.MegapascalPerSecond)); - unitConverter.SetConversionFunction(PressureChangeRateUnit.MegapascalPerSecond, PressureChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PressureChangeRate.BaseUnit, PressureChangeRateUnit.PascalPerMinute, q => q.ToUnit(PressureChangeRateUnit.PascalPerMinute)); - unitConverter.SetConversionFunction(PressureChangeRateUnit.PascalPerMinute, PressureChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(PressureChangeRate.BaseUnit, PressureChangeRate.BaseUnit, q => q); - unitConverter.SetConversionFunction(Ratio.BaseUnit, Ratio.BaseUnit, q => q); - unitConverter.SetConversionFunction(Ratio.BaseUnit, RatioUnit.PartPerBillion, q => q.ToUnit(RatioUnit.PartPerBillion)); - unitConverter.SetConversionFunction(RatioUnit.PartPerBillion, Ratio.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Ratio.BaseUnit, RatioUnit.PartPerMillion, q => q.ToUnit(RatioUnit.PartPerMillion)); - unitConverter.SetConversionFunction(RatioUnit.PartPerMillion, Ratio.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Ratio.BaseUnit, RatioUnit.PartPerThousand, q => q.ToUnit(RatioUnit.PartPerThousand)); - unitConverter.SetConversionFunction(RatioUnit.PartPerThousand, Ratio.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Ratio.BaseUnit, RatioUnit.PartPerTrillion, q => q.ToUnit(RatioUnit.PartPerTrillion)); - unitConverter.SetConversionFunction(RatioUnit.PartPerTrillion, Ratio.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Ratio.BaseUnit, RatioUnit.Percent, q => q.ToUnit(RatioUnit.Percent)); - unitConverter.SetConversionFunction(RatioUnit.Percent, Ratio.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RatioChangeRate.BaseUnit, RatioChangeRate.BaseUnit, q => q); - unitConverter.SetConversionFunction(RatioChangeRate.BaseUnit, RatioChangeRateUnit.PercentPerSecond, q => q.ToUnit(RatioChangeRateUnit.PercentPerSecond)); - unitConverter.SetConversionFunction(RatioChangeRateUnit.PercentPerSecond, RatioChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ReactiveEnergy.BaseUnit, ReactiveEnergyUnit.KilovoltampereReactiveHour, q => q.ToUnit(ReactiveEnergyUnit.KilovoltampereReactiveHour)); - unitConverter.SetConversionFunction(ReactiveEnergyUnit.KilovoltampereReactiveHour, ReactiveEnergy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ReactiveEnergy.BaseUnit, ReactiveEnergyUnit.MegavoltampereReactiveHour, q => q.ToUnit(ReactiveEnergyUnit.MegavoltampereReactiveHour)); - unitConverter.SetConversionFunction(ReactiveEnergyUnit.MegavoltampereReactiveHour, ReactiveEnergy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ReactiveEnergy.BaseUnit, ReactiveEnergy.BaseUnit, q => q); - unitConverter.SetConversionFunction(ReactivePower.BaseUnit, ReactivePowerUnit.GigavoltampereReactive, q => q.ToUnit(ReactivePowerUnit.GigavoltampereReactive)); - unitConverter.SetConversionFunction(ReactivePowerUnit.GigavoltampereReactive, ReactivePower.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ReactivePower.BaseUnit, ReactivePowerUnit.KilovoltampereReactive, q => q.ToUnit(ReactivePowerUnit.KilovoltampereReactive)); - unitConverter.SetConversionFunction(ReactivePowerUnit.KilovoltampereReactive, ReactivePower.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ReactivePower.BaseUnit, ReactivePowerUnit.MegavoltampereReactive, q => q.ToUnit(ReactivePowerUnit.MegavoltampereReactive)); - unitConverter.SetConversionFunction(ReactivePowerUnit.MegavoltampereReactive, ReactivePower.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ReactivePower.BaseUnit, ReactivePower.BaseUnit, q => q); - unitConverter.SetConversionFunction(RotationalAcceleration.BaseUnit, RotationalAccelerationUnit.DegreePerSecondSquared, q => q.ToUnit(RotationalAccelerationUnit.DegreePerSecondSquared)); - unitConverter.SetConversionFunction(RotationalAccelerationUnit.DegreePerSecondSquared, RotationalAcceleration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalAcceleration.BaseUnit, RotationalAcceleration.BaseUnit, q => q); - unitConverter.SetConversionFunction(RotationalAcceleration.BaseUnit, RotationalAccelerationUnit.RevolutionPerMinutePerSecond, q => q.ToUnit(RotationalAccelerationUnit.RevolutionPerMinutePerSecond)); - unitConverter.SetConversionFunction(RotationalAccelerationUnit.RevolutionPerMinutePerSecond, RotationalAcceleration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalAcceleration.BaseUnit, RotationalAccelerationUnit.RevolutionPerSecondSquared, q => q.ToUnit(RotationalAccelerationUnit.RevolutionPerSecondSquared)); - unitConverter.SetConversionFunction(RotationalAccelerationUnit.RevolutionPerSecondSquared, RotationalAcceleration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalSpeed.BaseUnit, RotationalSpeedUnit.CentiradianPerSecond, q => q.ToUnit(RotationalSpeedUnit.CentiradianPerSecond)); - unitConverter.SetConversionFunction(RotationalSpeedUnit.CentiradianPerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalSpeed.BaseUnit, RotationalSpeedUnit.DeciradianPerSecond, q => q.ToUnit(RotationalSpeedUnit.DeciradianPerSecond)); - unitConverter.SetConversionFunction(RotationalSpeedUnit.DeciradianPerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalSpeed.BaseUnit, RotationalSpeedUnit.DegreePerMinute, q => q.ToUnit(RotationalSpeedUnit.DegreePerMinute)); - unitConverter.SetConversionFunction(RotationalSpeedUnit.DegreePerMinute, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalSpeed.BaseUnit, RotationalSpeedUnit.DegreePerSecond, q => q.ToUnit(RotationalSpeedUnit.DegreePerSecond)); - unitConverter.SetConversionFunction(RotationalSpeedUnit.DegreePerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalSpeed.BaseUnit, RotationalSpeedUnit.MicrodegreePerSecond, q => q.ToUnit(RotationalSpeedUnit.MicrodegreePerSecond)); - unitConverter.SetConversionFunction(RotationalSpeedUnit.MicrodegreePerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalSpeed.BaseUnit, RotationalSpeedUnit.MicroradianPerSecond, q => q.ToUnit(RotationalSpeedUnit.MicroradianPerSecond)); - unitConverter.SetConversionFunction(RotationalSpeedUnit.MicroradianPerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalSpeed.BaseUnit, RotationalSpeedUnit.MillidegreePerSecond, q => q.ToUnit(RotationalSpeedUnit.MillidegreePerSecond)); - unitConverter.SetConversionFunction(RotationalSpeedUnit.MillidegreePerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalSpeed.BaseUnit, RotationalSpeedUnit.MilliradianPerSecond, q => q.ToUnit(RotationalSpeedUnit.MilliradianPerSecond)); - unitConverter.SetConversionFunction(RotationalSpeedUnit.MilliradianPerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalSpeed.BaseUnit, RotationalSpeedUnit.NanodegreePerSecond, q => q.ToUnit(RotationalSpeedUnit.NanodegreePerSecond)); - unitConverter.SetConversionFunction(RotationalSpeedUnit.NanodegreePerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalSpeed.BaseUnit, RotationalSpeedUnit.NanoradianPerSecond, q => q.ToUnit(RotationalSpeedUnit.NanoradianPerSecond)); - unitConverter.SetConversionFunction(RotationalSpeedUnit.NanoradianPerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalSpeed.BaseUnit, RotationalSpeed.BaseUnit, q => q); - unitConverter.SetConversionFunction(RotationalSpeed.BaseUnit, RotationalSpeedUnit.RevolutionPerMinute, q => q.ToUnit(RotationalSpeedUnit.RevolutionPerMinute)); - unitConverter.SetConversionFunction(RotationalSpeedUnit.RevolutionPerMinute, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalSpeed.BaseUnit, RotationalSpeedUnit.RevolutionPerSecond, q => q.ToUnit(RotationalSpeedUnit.RevolutionPerSecond)); - unitConverter.SetConversionFunction(RotationalSpeedUnit.RevolutionPerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalStiffness.BaseUnit, RotationalStiffnessUnit.KilonewtonMeterPerRadian, q => q.ToUnit(RotationalStiffnessUnit.KilonewtonMeterPerRadian)); - unitConverter.SetConversionFunction(RotationalStiffnessUnit.KilonewtonMeterPerRadian, RotationalStiffness.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalStiffness.BaseUnit, RotationalStiffnessUnit.MeganewtonMeterPerRadian, q => q.ToUnit(RotationalStiffnessUnit.MeganewtonMeterPerRadian)); - unitConverter.SetConversionFunction(RotationalStiffnessUnit.MeganewtonMeterPerRadian, RotationalStiffness.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalStiffness.BaseUnit, RotationalStiffness.BaseUnit, q => q); - unitConverter.SetConversionFunction(RotationalStiffnessPerLength.BaseUnit, RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter, q => q.ToUnit(RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter)); - unitConverter.SetConversionFunction(RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter, RotationalStiffnessPerLength.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalStiffnessPerLength.BaseUnit, RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter, q => q.ToUnit(RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter)); - unitConverter.SetConversionFunction(RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter, RotationalStiffnessPerLength.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(RotationalStiffnessPerLength.BaseUnit, RotationalStiffnessPerLength.BaseUnit, q => q); - unitConverter.SetConversionFunction(SolidAngle.BaseUnit, SolidAngle.BaseUnit, q => q); - unitConverter.SetConversionFunction(SpecificEnergy.BaseUnit, SpecificEnergyUnit.BtuPerPound, q => q.ToUnit(SpecificEnergyUnit.BtuPerPound)); - unitConverter.SetConversionFunction(SpecificEnergyUnit.BtuPerPound, SpecificEnergy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificEnergy.BaseUnit, SpecificEnergyUnit.CaloriePerGram, q => q.ToUnit(SpecificEnergyUnit.CaloriePerGram)); - unitConverter.SetConversionFunction(SpecificEnergyUnit.CaloriePerGram, SpecificEnergy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificEnergy.BaseUnit, SpecificEnergy.BaseUnit, q => q); - unitConverter.SetConversionFunction(SpecificEnergy.BaseUnit, SpecificEnergyUnit.KilocaloriePerGram, q => q.ToUnit(SpecificEnergyUnit.KilocaloriePerGram)); - unitConverter.SetConversionFunction(SpecificEnergyUnit.KilocaloriePerGram, SpecificEnergy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificEnergy.BaseUnit, SpecificEnergyUnit.KilojoulePerKilogram, q => q.ToUnit(SpecificEnergyUnit.KilojoulePerKilogram)); - unitConverter.SetConversionFunction(SpecificEnergyUnit.KilojoulePerKilogram, SpecificEnergy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificEnergy.BaseUnit, SpecificEnergyUnit.KilowattHourPerKilogram, q => q.ToUnit(SpecificEnergyUnit.KilowattHourPerKilogram)); - unitConverter.SetConversionFunction(SpecificEnergyUnit.KilowattHourPerKilogram, SpecificEnergy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificEnergy.BaseUnit, SpecificEnergyUnit.MegajoulePerKilogram, q => q.ToUnit(SpecificEnergyUnit.MegajoulePerKilogram)); - unitConverter.SetConversionFunction(SpecificEnergyUnit.MegajoulePerKilogram, SpecificEnergy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificEnergy.BaseUnit, SpecificEnergyUnit.MegawattHourPerKilogram, q => q.ToUnit(SpecificEnergyUnit.MegawattHourPerKilogram)); - unitConverter.SetConversionFunction(SpecificEnergyUnit.MegawattHourPerKilogram, SpecificEnergy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificEnergy.BaseUnit, SpecificEnergyUnit.WattHourPerKilogram, q => q.ToUnit(SpecificEnergyUnit.WattHourPerKilogram)); - unitConverter.SetConversionFunction(SpecificEnergyUnit.WattHourPerKilogram, SpecificEnergy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificEntropy.BaseUnit, SpecificEntropyUnit.BtuPerPoundFahrenheit, q => q.ToUnit(SpecificEntropyUnit.BtuPerPoundFahrenheit)); - unitConverter.SetConversionFunction(SpecificEntropyUnit.BtuPerPoundFahrenheit, SpecificEntropy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificEntropy.BaseUnit, SpecificEntropyUnit.CaloriePerGramKelvin, q => q.ToUnit(SpecificEntropyUnit.CaloriePerGramKelvin)); - unitConverter.SetConversionFunction(SpecificEntropyUnit.CaloriePerGramKelvin, SpecificEntropy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificEntropy.BaseUnit, SpecificEntropyUnit.JoulePerKilogramDegreeCelsius, q => q.ToUnit(SpecificEntropyUnit.JoulePerKilogramDegreeCelsius)); - unitConverter.SetConversionFunction(SpecificEntropyUnit.JoulePerKilogramDegreeCelsius, SpecificEntropy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificEntropy.BaseUnit, SpecificEntropy.BaseUnit, q => q); - unitConverter.SetConversionFunction(SpecificEntropy.BaseUnit, SpecificEntropyUnit.KilocaloriePerGramKelvin, q => q.ToUnit(SpecificEntropyUnit.KilocaloriePerGramKelvin)); - unitConverter.SetConversionFunction(SpecificEntropyUnit.KilocaloriePerGramKelvin, SpecificEntropy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificEntropy.BaseUnit, SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius, q => q.ToUnit(SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius)); - unitConverter.SetConversionFunction(SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius, SpecificEntropy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificEntropy.BaseUnit, SpecificEntropyUnit.KilojoulePerKilogramKelvin, q => q.ToUnit(SpecificEntropyUnit.KilojoulePerKilogramKelvin)); - unitConverter.SetConversionFunction(SpecificEntropyUnit.KilojoulePerKilogramKelvin, SpecificEntropy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificEntropy.BaseUnit, SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius, q => q.ToUnit(SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius)); - unitConverter.SetConversionFunction(SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius, SpecificEntropy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificEntropy.BaseUnit, SpecificEntropyUnit.MegajoulePerKilogramKelvin, q => q.ToUnit(SpecificEntropyUnit.MegajoulePerKilogramKelvin)); - unitConverter.SetConversionFunction(SpecificEntropyUnit.MegajoulePerKilogramKelvin, SpecificEntropy.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificVolume.BaseUnit, SpecificVolumeUnit.CubicFootPerPound, q => q.ToUnit(SpecificVolumeUnit.CubicFootPerPound)); - unitConverter.SetConversionFunction(SpecificVolumeUnit.CubicFootPerPound, SpecificVolume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificVolume.BaseUnit, SpecificVolume.BaseUnit, q => q); - unitConverter.SetConversionFunction(SpecificVolume.BaseUnit, SpecificVolumeUnit.MillicubicMeterPerKilogram, q => q.ToUnit(SpecificVolumeUnit.MillicubicMeterPerKilogram)); - unitConverter.SetConversionFunction(SpecificVolumeUnit.MillicubicMeterPerKilogram, SpecificVolume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeightUnit.KilogramForcePerCubicCentimeter, q => q.ToUnit(SpecificWeightUnit.KilogramForcePerCubicCentimeter)); - unitConverter.SetConversionFunction(SpecificWeightUnit.KilogramForcePerCubicCentimeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeightUnit.KilogramForcePerCubicMeter, q => q.ToUnit(SpecificWeightUnit.KilogramForcePerCubicMeter)); - unitConverter.SetConversionFunction(SpecificWeightUnit.KilogramForcePerCubicMeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeightUnit.KilogramForcePerCubicMillimeter, q => q.ToUnit(SpecificWeightUnit.KilogramForcePerCubicMillimeter)); - unitConverter.SetConversionFunction(SpecificWeightUnit.KilogramForcePerCubicMillimeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeightUnit.KilonewtonPerCubicCentimeter, q => q.ToUnit(SpecificWeightUnit.KilonewtonPerCubicCentimeter)); - unitConverter.SetConversionFunction(SpecificWeightUnit.KilonewtonPerCubicCentimeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeightUnit.KilonewtonPerCubicMeter, q => q.ToUnit(SpecificWeightUnit.KilonewtonPerCubicMeter)); - unitConverter.SetConversionFunction(SpecificWeightUnit.KilonewtonPerCubicMeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeightUnit.KilonewtonPerCubicMillimeter, q => q.ToUnit(SpecificWeightUnit.KilonewtonPerCubicMillimeter)); - unitConverter.SetConversionFunction(SpecificWeightUnit.KilonewtonPerCubicMillimeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeightUnit.KilopoundForcePerCubicFoot, q => q.ToUnit(SpecificWeightUnit.KilopoundForcePerCubicFoot)); - unitConverter.SetConversionFunction(SpecificWeightUnit.KilopoundForcePerCubicFoot, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeightUnit.KilopoundForcePerCubicInch, q => q.ToUnit(SpecificWeightUnit.KilopoundForcePerCubicInch)); - unitConverter.SetConversionFunction(SpecificWeightUnit.KilopoundForcePerCubicInch, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeightUnit.MeganewtonPerCubicMeter, q => q.ToUnit(SpecificWeightUnit.MeganewtonPerCubicMeter)); - unitConverter.SetConversionFunction(SpecificWeightUnit.MeganewtonPerCubicMeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeightUnit.NewtonPerCubicCentimeter, q => q.ToUnit(SpecificWeightUnit.NewtonPerCubicCentimeter)); - unitConverter.SetConversionFunction(SpecificWeightUnit.NewtonPerCubicCentimeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeight.BaseUnit, q => q); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeightUnit.NewtonPerCubicMillimeter, q => q.ToUnit(SpecificWeightUnit.NewtonPerCubicMillimeter)); - unitConverter.SetConversionFunction(SpecificWeightUnit.NewtonPerCubicMillimeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeightUnit.PoundForcePerCubicFoot, q => q.ToUnit(SpecificWeightUnit.PoundForcePerCubicFoot)); - unitConverter.SetConversionFunction(SpecificWeightUnit.PoundForcePerCubicFoot, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeightUnit.PoundForcePerCubicInch, q => q.ToUnit(SpecificWeightUnit.PoundForcePerCubicInch)); - unitConverter.SetConversionFunction(SpecificWeightUnit.PoundForcePerCubicInch, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeightUnit.TonneForcePerCubicCentimeter, q => q.ToUnit(SpecificWeightUnit.TonneForcePerCubicCentimeter)); - unitConverter.SetConversionFunction(SpecificWeightUnit.TonneForcePerCubicCentimeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeightUnit.TonneForcePerCubicMeter, q => q.ToUnit(SpecificWeightUnit.TonneForcePerCubicMeter)); - unitConverter.SetConversionFunction(SpecificWeightUnit.TonneForcePerCubicMeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(SpecificWeight.BaseUnit, SpecificWeightUnit.TonneForcePerCubicMillimeter, q => q.ToUnit(SpecificWeightUnit.TonneForcePerCubicMillimeter)); - unitConverter.SetConversionFunction(SpecificWeightUnit.TonneForcePerCubicMillimeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.CentimeterPerHour, q => q.ToUnit(SpeedUnit.CentimeterPerHour)); - unitConverter.SetConversionFunction(SpeedUnit.CentimeterPerHour, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.CentimeterPerMinute, q => q.ToUnit(SpeedUnit.CentimeterPerMinute)); - unitConverter.SetConversionFunction(SpeedUnit.CentimeterPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.CentimeterPerSecond, q => q.ToUnit(SpeedUnit.CentimeterPerSecond)); - unitConverter.SetConversionFunction(SpeedUnit.CentimeterPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.DecimeterPerMinute, q => q.ToUnit(SpeedUnit.DecimeterPerMinute)); - unitConverter.SetConversionFunction(SpeedUnit.DecimeterPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.DecimeterPerSecond, q => q.ToUnit(SpeedUnit.DecimeterPerSecond)); - unitConverter.SetConversionFunction(SpeedUnit.DecimeterPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.FootPerHour, q => q.ToUnit(SpeedUnit.FootPerHour)); - unitConverter.SetConversionFunction(SpeedUnit.FootPerHour, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.FootPerMinute, q => q.ToUnit(SpeedUnit.FootPerMinute)); - unitConverter.SetConversionFunction(SpeedUnit.FootPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.FootPerSecond, q => q.ToUnit(SpeedUnit.FootPerSecond)); - unitConverter.SetConversionFunction(SpeedUnit.FootPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.InchPerHour, q => q.ToUnit(SpeedUnit.InchPerHour)); - unitConverter.SetConversionFunction(SpeedUnit.InchPerHour, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.InchPerMinute, q => q.ToUnit(SpeedUnit.InchPerMinute)); - unitConverter.SetConversionFunction(SpeedUnit.InchPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.InchPerSecond, q => q.ToUnit(SpeedUnit.InchPerSecond)); - unitConverter.SetConversionFunction(SpeedUnit.InchPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.KilometerPerHour, q => q.ToUnit(SpeedUnit.KilometerPerHour)); - unitConverter.SetConversionFunction(SpeedUnit.KilometerPerHour, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.KilometerPerMinute, q => q.ToUnit(SpeedUnit.KilometerPerMinute)); - unitConverter.SetConversionFunction(SpeedUnit.KilometerPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.KilometerPerSecond, q => q.ToUnit(SpeedUnit.KilometerPerSecond)); - unitConverter.SetConversionFunction(SpeedUnit.KilometerPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.Knot, q => q.ToUnit(SpeedUnit.Knot)); - unitConverter.SetConversionFunction(SpeedUnit.Knot, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.MeterPerHour, q => q.ToUnit(SpeedUnit.MeterPerHour)); - unitConverter.SetConversionFunction(SpeedUnit.MeterPerHour, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.MeterPerMinute, q => q.ToUnit(SpeedUnit.MeterPerMinute)); - unitConverter.SetConversionFunction(SpeedUnit.MeterPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, Speed.BaseUnit, q => q); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.MicrometerPerMinute, q => q.ToUnit(SpeedUnit.MicrometerPerMinute)); - unitConverter.SetConversionFunction(SpeedUnit.MicrometerPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.MicrometerPerSecond, q => q.ToUnit(SpeedUnit.MicrometerPerSecond)); - unitConverter.SetConversionFunction(SpeedUnit.MicrometerPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.MilePerHour, q => q.ToUnit(SpeedUnit.MilePerHour)); - unitConverter.SetConversionFunction(SpeedUnit.MilePerHour, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.MillimeterPerHour, q => q.ToUnit(SpeedUnit.MillimeterPerHour)); - unitConverter.SetConversionFunction(SpeedUnit.MillimeterPerHour, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.MillimeterPerMinute, q => q.ToUnit(SpeedUnit.MillimeterPerMinute)); - unitConverter.SetConversionFunction(SpeedUnit.MillimeterPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.MillimeterPerSecond, q => q.ToUnit(SpeedUnit.MillimeterPerSecond)); - unitConverter.SetConversionFunction(SpeedUnit.MillimeterPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.NanometerPerMinute, q => q.ToUnit(SpeedUnit.NanometerPerMinute)); - unitConverter.SetConversionFunction(SpeedUnit.NanometerPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.NanometerPerSecond, q => q.ToUnit(SpeedUnit.NanometerPerSecond)); - unitConverter.SetConversionFunction(SpeedUnit.NanometerPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.UsSurveyFootPerHour, q => q.ToUnit(SpeedUnit.UsSurveyFootPerHour)); - unitConverter.SetConversionFunction(SpeedUnit.UsSurveyFootPerHour, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.UsSurveyFootPerMinute, q => q.ToUnit(SpeedUnit.UsSurveyFootPerMinute)); - unitConverter.SetConversionFunction(SpeedUnit.UsSurveyFootPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.UsSurveyFootPerSecond, q => q.ToUnit(SpeedUnit.UsSurveyFootPerSecond)); - unitConverter.SetConversionFunction(SpeedUnit.UsSurveyFootPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.YardPerHour, q => q.ToUnit(SpeedUnit.YardPerHour)); - unitConverter.SetConversionFunction(SpeedUnit.YardPerHour, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.YardPerMinute, q => q.ToUnit(SpeedUnit.YardPerMinute)); - unitConverter.SetConversionFunction(SpeedUnit.YardPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Speed.BaseUnit, SpeedUnit.YardPerSecond, q => q.ToUnit(SpeedUnit.YardPerSecond)); - unitConverter.SetConversionFunction(SpeedUnit.YardPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Temperature.BaseUnit, TemperatureUnit.DegreeCelsius, q => q.ToUnit(TemperatureUnit.DegreeCelsius)); - unitConverter.SetConversionFunction(TemperatureUnit.DegreeCelsius, Temperature.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Temperature.BaseUnit, TemperatureUnit.DegreeDelisle, q => q.ToUnit(TemperatureUnit.DegreeDelisle)); - unitConverter.SetConversionFunction(TemperatureUnit.DegreeDelisle, Temperature.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Temperature.BaseUnit, TemperatureUnit.DegreeFahrenheit, q => q.ToUnit(TemperatureUnit.DegreeFahrenheit)); - unitConverter.SetConversionFunction(TemperatureUnit.DegreeFahrenheit, Temperature.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Temperature.BaseUnit, TemperatureUnit.DegreeNewton, q => q.ToUnit(TemperatureUnit.DegreeNewton)); - unitConverter.SetConversionFunction(TemperatureUnit.DegreeNewton, Temperature.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Temperature.BaseUnit, TemperatureUnit.DegreeRankine, q => q.ToUnit(TemperatureUnit.DegreeRankine)); - unitConverter.SetConversionFunction(TemperatureUnit.DegreeRankine, Temperature.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Temperature.BaseUnit, TemperatureUnit.DegreeReaumur, q => q.ToUnit(TemperatureUnit.DegreeReaumur)); - unitConverter.SetConversionFunction(TemperatureUnit.DegreeReaumur, Temperature.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Temperature.BaseUnit, TemperatureUnit.DegreeRoemer, q => q.ToUnit(TemperatureUnit.DegreeRoemer)); - unitConverter.SetConversionFunction(TemperatureUnit.DegreeRoemer, Temperature.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Temperature.BaseUnit, Temperature.BaseUnit, q => q); - unitConverter.SetConversionFunction(Temperature.BaseUnit, TemperatureUnit.SolarTemperature, q => q.ToUnit(TemperatureUnit.SolarTemperature)); - unitConverter.SetConversionFunction(TemperatureUnit.SolarTemperature, Temperature.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond, q => q.ToUnit(TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond)); - unitConverter.SetConversionFunction(TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond, q => q.ToUnit(TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond)); - unitConverter.SetConversionFunction(TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond, q => q.ToUnit(TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond)); - unitConverter.SetConversionFunction(TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.DegreeCelsiusPerMinute, q => q.ToUnit(TemperatureChangeRateUnit.DegreeCelsiusPerMinute)); - unitConverter.SetConversionFunction(TemperatureChangeRateUnit.DegreeCelsiusPerMinute, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureChangeRate.BaseUnit, TemperatureChangeRate.BaseUnit, q => q); - unitConverter.SetConversionFunction(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond, q => q.ToUnit(TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond)); - unitConverter.SetConversionFunction(TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond, q => q.ToUnit(TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond)); - unitConverter.SetConversionFunction(TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond, q => q.ToUnit(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond)); - unitConverter.SetConversionFunction(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond, q => q.ToUnit(TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond)); - unitConverter.SetConversionFunction(TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond, q => q.ToUnit(TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond)); - unitConverter.SetConversionFunction(TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureDelta.BaseUnit, TemperatureDeltaUnit.DegreeCelsius, q => q.ToUnit(TemperatureDeltaUnit.DegreeCelsius)); - unitConverter.SetConversionFunction(TemperatureDeltaUnit.DegreeCelsius, TemperatureDelta.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureDelta.BaseUnit, TemperatureDeltaUnit.DegreeDelisle, q => q.ToUnit(TemperatureDeltaUnit.DegreeDelisle)); - unitConverter.SetConversionFunction(TemperatureDeltaUnit.DegreeDelisle, TemperatureDelta.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureDelta.BaseUnit, TemperatureDeltaUnit.DegreeFahrenheit, q => q.ToUnit(TemperatureDeltaUnit.DegreeFahrenheit)); - unitConverter.SetConversionFunction(TemperatureDeltaUnit.DegreeFahrenheit, TemperatureDelta.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureDelta.BaseUnit, TemperatureDeltaUnit.DegreeNewton, q => q.ToUnit(TemperatureDeltaUnit.DegreeNewton)); - unitConverter.SetConversionFunction(TemperatureDeltaUnit.DegreeNewton, TemperatureDelta.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureDelta.BaseUnit, TemperatureDeltaUnit.DegreeRankine, q => q.ToUnit(TemperatureDeltaUnit.DegreeRankine)); - unitConverter.SetConversionFunction(TemperatureDeltaUnit.DegreeRankine, TemperatureDelta.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureDelta.BaseUnit, TemperatureDeltaUnit.DegreeReaumur, q => q.ToUnit(TemperatureDeltaUnit.DegreeReaumur)); - unitConverter.SetConversionFunction(TemperatureDeltaUnit.DegreeReaumur, TemperatureDelta.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureDelta.BaseUnit, TemperatureDeltaUnit.DegreeRoemer, q => q.ToUnit(TemperatureDeltaUnit.DegreeRoemer)); - unitConverter.SetConversionFunction(TemperatureDeltaUnit.DegreeRoemer, TemperatureDelta.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(TemperatureDelta.BaseUnit, TemperatureDelta.BaseUnit, q => q); - unitConverter.SetConversionFunction(ThermalConductivity.BaseUnit, ThermalConductivityUnit.BtuPerHourFootFahrenheit, q => q.ToUnit(ThermalConductivityUnit.BtuPerHourFootFahrenheit)); - unitConverter.SetConversionFunction(ThermalConductivityUnit.BtuPerHourFootFahrenheit, ThermalConductivity.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ThermalConductivity.BaseUnit, ThermalConductivity.BaseUnit, q => q); - unitConverter.SetConversionFunction(ThermalResistance.BaseUnit, ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu, q => q.ToUnit(ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu)); - unitConverter.SetConversionFunction(ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu, ThermalResistance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ThermalResistance.BaseUnit, ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie, q => q.ToUnit(ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie)); - unitConverter.SetConversionFunction(ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie, ThermalResistance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ThermalResistance.BaseUnit, ThermalResistanceUnit.SquareCentimeterKelvinPerWatt, q => q.ToUnit(ThermalResistanceUnit.SquareCentimeterKelvinPerWatt)); - unitConverter.SetConversionFunction(ThermalResistanceUnit.SquareCentimeterKelvinPerWatt, ThermalResistance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ThermalResistance.BaseUnit, ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt, q => q.ToUnit(ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt)); - unitConverter.SetConversionFunction(ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt, ThermalResistance.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(ThermalResistance.BaseUnit, ThermalResistance.BaseUnit, q => q); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.KilogramForceCentimeter, q => q.ToUnit(TorqueUnit.KilogramForceCentimeter)); - unitConverter.SetConversionFunction(TorqueUnit.KilogramForceCentimeter, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.KilogramForceMeter, q => q.ToUnit(TorqueUnit.KilogramForceMeter)); - unitConverter.SetConversionFunction(TorqueUnit.KilogramForceMeter, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.KilogramForceMillimeter, q => q.ToUnit(TorqueUnit.KilogramForceMillimeter)); - unitConverter.SetConversionFunction(TorqueUnit.KilogramForceMillimeter, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.KilonewtonCentimeter, q => q.ToUnit(TorqueUnit.KilonewtonCentimeter)); - unitConverter.SetConversionFunction(TorqueUnit.KilonewtonCentimeter, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.KilonewtonMeter, q => q.ToUnit(TorqueUnit.KilonewtonMeter)); - unitConverter.SetConversionFunction(TorqueUnit.KilonewtonMeter, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.KilonewtonMillimeter, q => q.ToUnit(TorqueUnit.KilonewtonMillimeter)); - unitConverter.SetConversionFunction(TorqueUnit.KilonewtonMillimeter, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.KilopoundForceFoot, q => q.ToUnit(TorqueUnit.KilopoundForceFoot)); - unitConverter.SetConversionFunction(TorqueUnit.KilopoundForceFoot, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.KilopoundForceInch, q => q.ToUnit(TorqueUnit.KilopoundForceInch)); - unitConverter.SetConversionFunction(TorqueUnit.KilopoundForceInch, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.MeganewtonCentimeter, q => q.ToUnit(TorqueUnit.MeganewtonCentimeter)); - unitConverter.SetConversionFunction(TorqueUnit.MeganewtonCentimeter, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.MeganewtonMeter, q => q.ToUnit(TorqueUnit.MeganewtonMeter)); - unitConverter.SetConversionFunction(TorqueUnit.MeganewtonMeter, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.MeganewtonMillimeter, q => q.ToUnit(TorqueUnit.MeganewtonMillimeter)); - unitConverter.SetConversionFunction(TorqueUnit.MeganewtonMillimeter, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.MegapoundForceFoot, q => q.ToUnit(TorqueUnit.MegapoundForceFoot)); - unitConverter.SetConversionFunction(TorqueUnit.MegapoundForceFoot, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.MegapoundForceInch, q => q.ToUnit(TorqueUnit.MegapoundForceInch)); - unitConverter.SetConversionFunction(TorqueUnit.MegapoundForceInch, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.NewtonCentimeter, q => q.ToUnit(TorqueUnit.NewtonCentimeter)); - unitConverter.SetConversionFunction(TorqueUnit.NewtonCentimeter, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, Torque.BaseUnit, q => q); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.NewtonMillimeter, q => q.ToUnit(TorqueUnit.NewtonMillimeter)); - unitConverter.SetConversionFunction(TorqueUnit.NewtonMillimeter, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.PoundForceFoot, q => q.ToUnit(TorqueUnit.PoundForceFoot)); - unitConverter.SetConversionFunction(TorqueUnit.PoundForceFoot, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.PoundForceInch, q => q.ToUnit(TorqueUnit.PoundForceInch)); - unitConverter.SetConversionFunction(TorqueUnit.PoundForceInch, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.TonneForceCentimeter, q => q.ToUnit(TorqueUnit.TonneForceCentimeter)); - unitConverter.SetConversionFunction(TorqueUnit.TonneForceCentimeter, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.TonneForceMeter, q => q.ToUnit(TorqueUnit.TonneForceMeter)); - unitConverter.SetConversionFunction(TorqueUnit.TonneForceMeter, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Torque.BaseUnit, TorqueUnit.TonneForceMillimeter, q => q.ToUnit(TorqueUnit.TonneForceMillimeter)); - unitConverter.SetConversionFunction(TorqueUnit.TonneForceMillimeter, Torque.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VitaminA.BaseUnit, VitaminA.BaseUnit, q => q); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.AcreFoot, q => q.ToUnit(VolumeUnit.AcreFoot)); - unitConverter.SetConversionFunction(VolumeUnit.AcreFoot, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.AuTablespoon, q => q.ToUnit(VolumeUnit.AuTablespoon)); - unitConverter.SetConversionFunction(VolumeUnit.AuTablespoon, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.Centiliter, q => q.ToUnit(VolumeUnit.Centiliter)); - unitConverter.SetConversionFunction(VolumeUnit.Centiliter, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.CubicCentimeter, q => q.ToUnit(VolumeUnit.CubicCentimeter)); - unitConverter.SetConversionFunction(VolumeUnit.CubicCentimeter, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.CubicDecimeter, q => q.ToUnit(VolumeUnit.CubicDecimeter)); - unitConverter.SetConversionFunction(VolumeUnit.CubicDecimeter, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.CubicFoot, q => q.ToUnit(VolumeUnit.CubicFoot)); - unitConverter.SetConversionFunction(VolumeUnit.CubicFoot, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.CubicHectometer, q => q.ToUnit(VolumeUnit.CubicHectometer)); - unitConverter.SetConversionFunction(VolumeUnit.CubicHectometer, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.CubicInch, q => q.ToUnit(VolumeUnit.CubicInch)); - unitConverter.SetConversionFunction(VolumeUnit.CubicInch, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.CubicKilometer, q => q.ToUnit(VolumeUnit.CubicKilometer)); - unitConverter.SetConversionFunction(VolumeUnit.CubicKilometer, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, Volume.BaseUnit, q => q); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.CubicMicrometer, q => q.ToUnit(VolumeUnit.CubicMicrometer)); - unitConverter.SetConversionFunction(VolumeUnit.CubicMicrometer, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.CubicMile, q => q.ToUnit(VolumeUnit.CubicMile)); - unitConverter.SetConversionFunction(VolumeUnit.CubicMile, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.CubicMillimeter, q => q.ToUnit(VolumeUnit.CubicMillimeter)); - unitConverter.SetConversionFunction(VolumeUnit.CubicMillimeter, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.CubicYard, q => q.ToUnit(VolumeUnit.CubicYard)); - unitConverter.SetConversionFunction(VolumeUnit.CubicYard, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.Deciliter, q => q.ToUnit(VolumeUnit.Deciliter)); - unitConverter.SetConversionFunction(VolumeUnit.Deciliter, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.HectocubicFoot, q => q.ToUnit(VolumeUnit.HectocubicFoot)); - unitConverter.SetConversionFunction(VolumeUnit.HectocubicFoot, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.HectocubicMeter, q => q.ToUnit(VolumeUnit.HectocubicMeter)); - unitConverter.SetConversionFunction(VolumeUnit.HectocubicMeter, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.Hectoliter, q => q.ToUnit(VolumeUnit.Hectoliter)); - unitConverter.SetConversionFunction(VolumeUnit.Hectoliter, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.ImperialBeerBarrel, q => q.ToUnit(VolumeUnit.ImperialBeerBarrel)); - unitConverter.SetConversionFunction(VolumeUnit.ImperialBeerBarrel, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.ImperialGallon, q => q.ToUnit(VolumeUnit.ImperialGallon)); - unitConverter.SetConversionFunction(VolumeUnit.ImperialGallon, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.ImperialOunce, q => q.ToUnit(VolumeUnit.ImperialOunce)); - unitConverter.SetConversionFunction(VolumeUnit.ImperialOunce, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.ImperialPint, q => q.ToUnit(VolumeUnit.ImperialPint)); - unitConverter.SetConversionFunction(VolumeUnit.ImperialPint, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.KilocubicFoot, q => q.ToUnit(VolumeUnit.KilocubicFoot)); - unitConverter.SetConversionFunction(VolumeUnit.KilocubicFoot, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.KilocubicMeter, q => q.ToUnit(VolumeUnit.KilocubicMeter)); - unitConverter.SetConversionFunction(VolumeUnit.KilocubicMeter, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.KiloimperialGallon, q => q.ToUnit(VolumeUnit.KiloimperialGallon)); - unitConverter.SetConversionFunction(VolumeUnit.KiloimperialGallon, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.Kiloliter, q => q.ToUnit(VolumeUnit.Kiloliter)); - unitConverter.SetConversionFunction(VolumeUnit.Kiloliter, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.KilousGallon, q => q.ToUnit(VolumeUnit.KilousGallon)); - unitConverter.SetConversionFunction(VolumeUnit.KilousGallon, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.Liter, q => q.ToUnit(VolumeUnit.Liter)); - unitConverter.SetConversionFunction(VolumeUnit.Liter, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.MegacubicFoot, q => q.ToUnit(VolumeUnit.MegacubicFoot)); - unitConverter.SetConversionFunction(VolumeUnit.MegacubicFoot, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.MegaimperialGallon, q => q.ToUnit(VolumeUnit.MegaimperialGallon)); - unitConverter.SetConversionFunction(VolumeUnit.MegaimperialGallon, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.Megaliter, q => q.ToUnit(VolumeUnit.Megaliter)); - unitConverter.SetConversionFunction(VolumeUnit.Megaliter, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.MegausGallon, q => q.ToUnit(VolumeUnit.MegausGallon)); - unitConverter.SetConversionFunction(VolumeUnit.MegausGallon, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.MetricCup, q => q.ToUnit(VolumeUnit.MetricCup)); - unitConverter.SetConversionFunction(VolumeUnit.MetricCup, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.MetricTeaspoon, q => q.ToUnit(VolumeUnit.MetricTeaspoon)); - unitConverter.SetConversionFunction(VolumeUnit.MetricTeaspoon, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.Microliter, q => q.ToUnit(VolumeUnit.Microliter)); - unitConverter.SetConversionFunction(VolumeUnit.Microliter, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.Milliliter, q => q.ToUnit(VolumeUnit.Milliliter)); - unitConverter.SetConversionFunction(VolumeUnit.Milliliter, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.OilBarrel, q => q.ToUnit(VolumeUnit.OilBarrel)); - unitConverter.SetConversionFunction(VolumeUnit.OilBarrel, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.UkTablespoon, q => q.ToUnit(VolumeUnit.UkTablespoon)); - unitConverter.SetConversionFunction(VolumeUnit.UkTablespoon, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.UsBeerBarrel, q => q.ToUnit(VolumeUnit.UsBeerBarrel)); - unitConverter.SetConversionFunction(VolumeUnit.UsBeerBarrel, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.UsCustomaryCup, q => q.ToUnit(VolumeUnit.UsCustomaryCup)); - unitConverter.SetConversionFunction(VolumeUnit.UsCustomaryCup, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.UsGallon, q => q.ToUnit(VolumeUnit.UsGallon)); - unitConverter.SetConversionFunction(VolumeUnit.UsGallon, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.UsLegalCup, q => q.ToUnit(VolumeUnit.UsLegalCup)); - unitConverter.SetConversionFunction(VolumeUnit.UsLegalCup, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.UsOunce, q => q.ToUnit(VolumeUnit.UsOunce)); - unitConverter.SetConversionFunction(VolumeUnit.UsOunce, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.UsPint, q => q.ToUnit(VolumeUnit.UsPint)); - unitConverter.SetConversionFunction(VolumeUnit.UsPint, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.UsQuart, q => q.ToUnit(VolumeUnit.UsQuart)); - unitConverter.SetConversionFunction(VolumeUnit.UsQuart, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.UsTablespoon, q => q.ToUnit(VolumeUnit.UsTablespoon)); - unitConverter.SetConversionFunction(VolumeUnit.UsTablespoon, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.UsTeaspoon, q => q.ToUnit(VolumeUnit.UsTeaspoon)); - unitConverter.SetConversionFunction(VolumeUnit.UsTeaspoon, Volume.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.CentilitersPerLiter, q => q.ToUnit(VolumeConcentrationUnit.CentilitersPerLiter)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.CentilitersPerLiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.CentilitersPerMililiter, q => q.ToUnit(VolumeConcentrationUnit.CentilitersPerMililiter)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.CentilitersPerMililiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.DecilitersPerLiter, q => q.ToUnit(VolumeConcentrationUnit.DecilitersPerLiter)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.DecilitersPerLiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.DecilitersPerMililiter, q => q.ToUnit(VolumeConcentrationUnit.DecilitersPerMililiter)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.DecilitersPerMililiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentration.BaseUnit, q => q); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.LitersPerLiter, q => q.ToUnit(VolumeConcentrationUnit.LitersPerLiter)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.LitersPerLiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.LitersPerMililiter, q => q.ToUnit(VolumeConcentrationUnit.LitersPerMililiter)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.LitersPerMililiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.MicrolitersPerLiter, q => q.ToUnit(VolumeConcentrationUnit.MicrolitersPerLiter)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.MicrolitersPerLiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.MicrolitersPerMililiter, q => q.ToUnit(VolumeConcentrationUnit.MicrolitersPerMililiter)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.MicrolitersPerMililiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.MillilitersPerLiter, q => q.ToUnit(VolumeConcentrationUnit.MillilitersPerLiter)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.MillilitersPerLiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.MillilitersPerMililiter, q => q.ToUnit(VolumeConcentrationUnit.MillilitersPerMililiter)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.MillilitersPerMililiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.NanolitersPerLiter, q => q.ToUnit(VolumeConcentrationUnit.NanolitersPerLiter)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.NanolitersPerLiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.NanolitersPerMililiter, q => q.ToUnit(VolumeConcentrationUnit.NanolitersPerMililiter)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.NanolitersPerMililiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.PartPerBillion, q => q.ToUnit(VolumeConcentrationUnit.PartPerBillion)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.PartPerBillion, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.PartPerMillion, q => q.ToUnit(VolumeConcentrationUnit.PartPerMillion)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.PartPerMillion, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.PartPerThousand, q => q.ToUnit(VolumeConcentrationUnit.PartPerThousand)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.PartPerThousand, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.PartPerTrillion, q => q.ToUnit(VolumeConcentrationUnit.PartPerTrillion)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.PartPerTrillion, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.Percent, q => q.ToUnit(VolumeConcentrationUnit.Percent)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.Percent, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.PicolitersPerLiter, q => q.ToUnit(VolumeConcentrationUnit.PicolitersPerLiter)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.PicolitersPerLiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.PicolitersPerMililiter, q => q.ToUnit(VolumeConcentrationUnit.PicolitersPerMililiter)); - unitConverter.SetConversionFunction(VolumeConcentrationUnit.PicolitersPerMililiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.AcreFootPerDay, q => q.ToUnit(VolumeFlowUnit.AcreFootPerDay)); - unitConverter.SetConversionFunction(VolumeFlowUnit.AcreFootPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.AcreFootPerHour, q => q.ToUnit(VolumeFlowUnit.AcreFootPerHour)); - unitConverter.SetConversionFunction(VolumeFlowUnit.AcreFootPerHour, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.AcreFootPerMinute, q => q.ToUnit(VolumeFlowUnit.AcreFootPerMinute)); - unitConverter.SetConversionFunction(VolumeFlowUnit.AcreFootPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.AcreFootPerSecond, q => q.ToUnit(VolumeFlowUnit.AcreFootPerSecond)); - unitConverter.SetConversionFunction(VolumeFlowUnit.AcreFootPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.CentiliterPerDay, q => q.ToUnit(VolumeFlowUnit.CentiliterPerDay)); - unitConverter.SetConversionFunction(VolumeFlowUnit.CentiliterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.CentiliterPerMinute, q => q.ToUnit(VolumeFlowUnit.CentiliterPerMinute)); - unitConverter.SetConversionFunction(VolumeFlowUnit.CentiliterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicDecimeterPerMinute, q => q.ToUnit(VolumeFlowUnit.CubicDecimeterPerMinute)); - unitConverter.SetConversionFunction(VolumeFlowUnit.CubicDecimeterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicFootPerHour, q => q.ToUnit(VolumeFlowUnit.CubicFootPerHour)); - unitConverter.SetConversionFunction(VolumeFlowUnit.CubicFootPerHour, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicFootPerMinute, q => q.ToUnit(VolumeFlowUnit.CubicFootPerMinute)); - unitConverter.SetConversionFunction(VolumeFlowUnit.CubicFootPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicFootPerSecond, q => q.ToUnit(VolumeFlowUnit.CubicFootPerSecond)); - unitConverter.SetConversionFunction(VolumeFlowUnit.CubicFootPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicMeterPerDay, q => q.ToUnit(VolumeFlowUnit.CubicMeterPerDay)); - unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMeterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicMeterPerHour, q => q.ToUnit(VolumeFlowUnit.CubicMeterPerHour)); - unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMeterPerHour, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicMeterPerMinute, q => q.ToUnit(VolumeFlowUnit.CubicMeterPerMinute)); - unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMeterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlow.BaseUnit, q => q); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicMillimeterPerSecond, q => q.ToUnit(VolumeFlowUnit.CubicMillimeterPerSecond)); - unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMillimeterPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicYardPerDay, q => q.ToUnit(VolumeFlowUnit.CubicYardPerDay)); - unitConverter.SetConversionFunction(VolumeFlowUnit.CubicYardPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicYardPerHour, q => q.ToUnit(VolumeFlowUnit.CubicYardPerHour)); - unitConverter.SetConversionFunction(VolumeFlowUnit.CubicYardPerHour, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicYardPerMinute, q => q.ToUnit(VolumeFlowUnit.CubicYardPerMinute)); - unitConverter.SetConversionFunction(VolumeFlowUnit.CubicYardPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicYardPerSecond, q => q.ToUnit(VolumeFlowUnit.CubicYardPerSecond)); - unitConverter.SetConversionFunction(VolumeFlowUnit.CubicYardPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.DeciliterPerDay, q => q.ToUnit(VolumeFlowUnit.DeciliterPerDay)); - unitConverter.SetConversionFunction(VolumeFlowUnit.DeciliterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.DeciliterPerMinute, q => q.ToUnit(VolumeFlowUnit.DeciliterPerMinute)); - unitConverter.SetConversionFunction(VolumeFlowUnit.DeciliterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.KiloliterPerDay, q => q.ToUnit(VolumeFlowUnit.KiloliterPerDay)); - unitConverter.SetConversionFunction(VolumeFlowUnit.KiloliterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.KiloliterPerMinute, q => q.ToUnit(VolumeFlowUnit.KiloliterPerMinute)); - unitConverter.SetConversionFunction(VolumeFlowUnit.KiloliterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.KilousGallonPerMinute, q => q.ToUnit(VolumeFlowUnit.KilousGallonPerMinute)); - unitConverter.SetConversionFunction(VolumeFlowUnit.KilousGallonPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.LiterPerDay, q => q.ToUnit(VolumeFlowUnit.LiterPerDay)); - unitConverter.SetConversionFunction(VolumeFlowUnit.LiterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.LiterPerHour, q => q.ToUnit(VolumeFlowUnit.LiterPerHour)); - unitConverter.SetConversionFunction(VolumeFlowUnit.LiterPerHour, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.LiterPerMinute, q => q.ToUnit(VolumeFlowUnit.LiterPerMinute)); - unitConverter.SetConversionFunction(VolumeFlowUnit.LiterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.LiterPerSecond, q => q.ToUnit(VolumeFlowUnit.LiterPerSecond)); - unitConverter.SetConversionFunction(VolumeFlowUnit.LiterPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.MegaliterPerDay, q => q.ToUnit(VolumeFlowUnit.MegaliterPerDay)); - unitConverter.SetConversionFunction(VolumeFlowUnit.MegaliterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.MegaukGallonPerSecond, q => q.ToUnit(VolumeFlowUnit.MegaukGallonPerSecond)); - unitConverter.SetConversionFunction(VolumeFlowUnit.MegaukGallonPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.MicroliterPerDay, q => q.ToUnit(VolumeFlowUnit.MicroliterPerDay)); - unitConverter.SetConversionFunction(VolumeFlowUnit.MicroliterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.MicroliterPerMinute, q => q.ToUnit(VolumeFlowUnit.MicroliterPerMinute)); - unitConverter.SetConversionFunction(VolumeFlowUnit.MicroliterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.MilliliterPerDay, q => q.ToUnit(VolumeFlowUnit.MilliliterPerDay)); - unitConverter.SetConversionFunction(VolumeFlowUnit.MilliliterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.MilliliterPerMinute, q => q.ToUnit(VolumeFlowUnit.MilliliterPerMinute)); - unitConverter.SetConversionFunction(VolumeFlowUnit.MilliliterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.MillionUsGallonsPerDay, q => q.ToUnit(VolumeFlowUnit.MillionUsGallonsPerDay)); - unitConverter.SetConversionFunction(VolumeFlowUnit.MillionUsGallonsPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.NanoliterPerDay, q => q.ToUnit(VolumeFlowUnit.NanoliterPerDay)); - unitConverter.SetConversionFunction(VolumeFlowUnit.NanoliterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.NanoliterPerMinute, q => q.ToUnit(VolumeFlowUnit.NanoliterPerMinute)); - unitConverter.SetConversionFunction(VolumeFlowUnit.NanoliterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.OilBarrelPerDay, q => q.ToUnit(VolumeFlowUnit.OilBarrelPerDay)); - unitConverter.SetConversionFunction(VolumeFlowUnit.OilBarrelPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.OilBarrelPerHour, q => q.ToUnit(VolumeFlowUnit.OilBarrelPerHour)); - unitConverter.SetConversionFunction(VolumeFlowUnit.OilBarrelPerHour, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.OilBarrelPerMinute, q => q.ToUnit(VolumeFlowUnit.OilBarrelPerMinute)); - unitConverter.SetConversionFunction(VolumeFlowUnit.OilBarrelPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.OilBarrelPerSecond, q => q.ToUnit(VolumeFlowUnit.OilBarrelPerSecond)); - unitConverter.SetConversionFunction(VolumeFlowUnit.OilBarrelPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.UkGallonPerDay, q => q.ToUnit(VolumeFlowUnit.UkGallonPerDay)); - unitConverter.SetConversionFunction(VolumeFlowUnit.UkGallonPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.UkGallonPerHour, q => q.ToUnit(VolumeFlowUnit.UkGallonPerHour)); - unitConverter.SetConversionFunction(VolumeFlowUnit.UkGallonPerHour, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.UkGallonPerMinute, q => q.ToUnit(VolumeFlowUnit.UkGallonPerMinute)); - unitConverter.SetConversionFunction(VolumeFlowUnit.UkGallonPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.UkGallonPerSecond, q => q.ToUnit(VolumeFlowUnit.UkGallonPerSecond)); - unitConverter.SetConversionFunction(VolumeFlowUnit.UkGallonPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.UsGallonPerDay, q => q.ToUnit(VolumeFlowUnit.UsGallonPerDay)); - unitConverter.SetConversionFunction(VolumeFlowUnit.UsGallonPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.UsGallonPerHour, q => q.ToUnit(VolumeFlowUnit.UsGallonPerHour)); - unitConverter.SetConversionFunction(VolumeFlowUnit.UsGallonPerHour, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.UsGallonPerMinute, q => q.ToUnit(VolumeFlowUnit.UsGallonPerMinute)); - unitConverter.SetConversionFunction(VolumeFlowUnit.UsGallonPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumeFlow.BaseUnit, VolumeFlowUnit.UsGallonPerSecond, q => q.ToUnit(VolumeFlowUnit.UsGallonPerSecond)); - unitConverter.SetConversionFunction(VolumeFlowUnit.UsGallonPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumePerLength.BaseUnit, VolumePerLength.BaseUnit, q => q); - unitConverter.SetConversionFunction(VolumePerLength.BaseUnit, VolumePerLengthUnit.LiterPerMeter, q => q.ToUnit(VolumePerLengthUnit.LiterPerMeter)); - unitConverter.SetConversionFunction(VolumePerLengthUnit.LiterPerMeter, VolumePerLength.BaseUnit, q => q.ToBaseUnit()); - unitConverter.SetConversionFunction(VolumePerLength.BaseUnit, VolumePerLengthUnit.OilBarrelPerFoot, q => q.ToUnit(VolumePerLengthUnit.OilBarrelPerFoot)); - unitConverter.SetConversionFunction(VolumePerLengthUnit.OilBarrelPerFoot, VolumePerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Acceleration.BaseUnit, AccelerationUnit.CentimeterPerSecondSquared, q => q.ToUnit(AccelerationUnit.CentimeterPerSecondSquared)); + unitConverter.SetConversionFunction>(AccelerationUnit.CentimeterPerSecondSquared, Acceleration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Acceleration.BaseUnit, AccelerationUnit.DecimeterPerSecondSquared, q => q.ToUnit(AccelerationUnit.DecimeterPerSecondSquared)); + unitConverter.SetConversionFunction>(AccelerationUnit.DecimeterPerSecondSquared, Acceleration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Acceleration.BaseUnit, AccelerationUnit.FootPerSecondSquared, q => q.ToUnit(AccelerationUnit.FootPerSecondSquared)); + unitConverter.SetConversionFunction>(AccelerationUnit.FootPerSecondSquared, Acceleration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Acceleration.BaseUnit, AccelerationUnit.InchPerSecondSquared, q => q.ToUnit(AccelerationUnit.InchPerSecondSquared)); + unitConverter.SetConversionFunction>(AccelerationUnit.InchPerSecondSquared, Acceleration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Acceleration.BaseUnit, AccelerationUnit.KilometerPerSecondSquared, q => q.ToUnit(AccelerationUnit.KilometerPerSecondSquared)); + unitConverter.SetConversionFunction>(AccelerationUnit.KilometerPerSecondSquared, Acceleration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Acceleration.BaseUnit, AccelerationUnit.KnotPerHour, q => q.ToUnit(AccelerationUnit.KnotPerHour)); + unitConverter.SetConversionFunction>(AccelerationUnit.KnotPerHour, Acceleration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Acceleration.BaseUnit, AccelerationUnit.KnotPerMinute, q => q.ToUnit(AccelerationUnit.KnotPerMinute)); + unitConverter.SetConversionFunction>(AccelerationUnit.KnotPerMinute, Acceleration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Acceleration.BaseUnit, AccelerationUnit.KnotPerSecond, q => q.ToUnit(AccelerationUnit.KnotPerSecond)); + unitConverter.SetConversionFunction>(AccelerationUnit.KnotPerSecond, Acceleration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Acceleration.BaseUnit, Acceleration.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Acceleration.BaseUnit, AccelerationUnit.MicrometerPerSecondSquared, q => q.ToUnit(AccelerationUnit.MicrometerPerSecondSquared)); + unitConverter.SetConversionFunction>(AccelerationUnit.MicrometerPerSecondSquared, Acceleration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Acceleration.BaseUnit, AccelerationUnit.MillimeterPerSecondSquared, q => q.ToUnit(AccelerationUnit.MillimeterPerSecondSquared)); + unitConverter.SetConversionFunction>(AccelerationUnit.MillimeterPerSecondSquared, Acceleration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Acceleration.BaseUnit, AccelerationUnit.NanometerPerSecondSquared, q => q.ToUnit(AccelerationUnit.NanometerPerSecondSquared)); + unitConverter.SetConversionFunction>(AccelerationUnit.NanometerPerSecondSquared, Acceleration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Acceleration.BaseUnit, AccelerationUnit.StandardGravity, q => q.ToUnit(AccelerationUnit.StandardGravity)); + unitConverter.SetConversionFunction>(AccelerationUnit.StandardGravity, Acceleration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.Centimole, q => q.ToUnit(AmountOfSubstanceUnit.Centimole)); + unitConverter.SetConversionFunction>(AmountOfSubstanceUnit.Centimole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.CentipoundMole, q => q.ToUnit(AmountOfSubstanceUnit.CentipoundMole)); + unitConverter.SetConversionFunction>(AmountOfSubstanceUnit.CentipoundMole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.Decimole, q => q.ToUnit(AmountOfSubstanceUnit.Decimole)); + unitConverter.SetConversionFunction>(AmountOfSubstanceUnit.Decimole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.DecipoundMole, q => q.ToUnit(AmountOfSubstanceUnit.DecipoundMole)); + unitConverter.SetConversionFunction>(AmountOfSubstanceUnit.DecipoundMole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.Kilomole, q => q.ToUnit(AmountOfSubstanceUnit.Kilomole)); + unitConverter.SetConversionFunction>(AmountOfSubstanceUnit.Kilomole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.KilopoundMole, q => q.ToUnit(AmountOfSubstanceUnit.KilopoundMole)); + unitConverter.SetConversionFunction>(AmountOfSubstanceUnit.KilopoundMole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.Megamole, q => q.ToUnit(AmountOfSubstanceUnit.Megamole)); + unitConverter.SetConversionFunction>(AmountOfSubstanceUnit.Megamole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.Micromole, q => q.ToUnit(AmountOfSubstanceUnit.Micromole)); + unitConverter.SetConversionFunction>(AmountOfSubstanceUnit.Micromole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.MicropoundMole, q => q.ToUnit(AmountOfSubstanceUnit.MicropoundMole)); + unitConverter.SetConversionFunction>(AmountOfSubstanceUnit.MicropoundMole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.Millimole, q => q.ToUnit(AmountOfSubstanceUnit.Millimole)); + unitConverter.SetConversionFunction>(AmountOfSubstanceUnit.Millimole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.MillipoundMole, q => q.ToUnit(AmountOfSubstanceUnit.MillipoundMole)); + unitConverter.SetConversionFunction>(AmountOfSubstanceUnit.MillipoundMole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmountOfSubstance.BaseUnit, AmountOfSubstance.BaseUnit, q => q); + unitConverter.SetConversionFunction>(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.Nanomole, q => q.ToUnit(AmountOfSubstanceUnit.Nanomole)); + unitConverter.SetConversionFunction>(AmountOfSubstanceUnit.Nanomole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.NanopoundMole, q => q.ToUnit(AmountOfSubstanceUnit.NanopoundMole)); + unitConverter.SetConversionFunction>(AmountOfSubstanceUnit.NanopoundMole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmountOfSubstance.BaseUnit, AmountOfSubstanceUnit.PoundMole, q => q.ToUnit(AmountOfSubstanceUnit.PoundMole)); + unitConverter.SetConversionFunction>(AmountOfSubstanceUnit.PoundMole, AmountOfSubstance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmplitudeRatio.BaseUnit, AmplitudeRatioUnit.DecibelMicrovolt, q => q.ToUnit(AmplitudeRatioUnit.DecibelMicrovolt)); + unitConverter.SetConversionFunction>(AmplitudeRatioUnit.DecibelMicrovolt, AmplitudeRatio.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmplitudeRatio.BaseUnit, AmplitudeRatioUnit.DecibelMillivolt, q => q.ToUnit(AmplitudeRatioUnit.DecibelMillivolt)); + unitConverter.SetConversionFunction>(AmplitudeRatioUnit.DecibelMillivolt, AmplitudeRatio.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmplitudeRatio.BaseUnit, AmplitudeRatioUnit.DecibelUnloaded, q => q.ToUnit(AmplitudeRatioUnit.DecibelUnloaded)); + unitConverter.SetConversionFunction>(AmplitudeRatioUnit.DecibelUnloaded, AmplitudeRatio.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AmplitudeRatio.BaseUnit, AmplitudeRatio.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Angle.BaseUnit, AngleUnit.Arcminute, q => q.ToUnit(AngleUnit.Arcminute)); + unitConverter.SetConversionFunction>(AngleUnit.Arcminute, Angle.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Angle.BaseUnit, AngleUnit.Arcsecond, q => q.ToUnit(AngleUnit.Arcsecond)); + unitConverter.SetConversionFunction>(AngleUnit.Arcsecond, Angle.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Angle.BaseUnit, AngleUnit.Centiradian, q => q.ToUnit(AngleUnit.Centiradian)); + unitConverter.SetConversionFunction>(AngleUnit.Centiradian, Angle.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Angle.BaseUnit, AngleUnit.Deciradian, q => q.ToUnit(AngleUnit.Deciradian)); + unitConverter.SetConversionFunction>(AngleUnit.Deciradian, Angle.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Angle.BaseUnit, Angle.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Angle.BaseUnit, AngleUnit.Gradian, q => q.ToUnit(AngleUnit.Gradian)); + unitConverter.SetConversionFunction>(AngleUnit.Gradian, Angle.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Angle.BaseUnit, AngleUnit.Microdegree, q => q.ToUnit(AngleUnit.Microdegree)); + unitConverter.SetConversionFunction>(AngleUnit.Microdegree, Angle.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Angle.BaseUnit, AngleUnit.Microradian, q => q.ToUnit(AngleUnit.Microradian)); + unitConverter.SetConversionFunction>(AngleUnit.Microradian, Angle.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Angle.BaseUnit, AngleUnit.Millidegree, q => q.ToUnit(AngleUnit.Millidegree)); + unitConverter.SetConversionFunction>(AngleUnit.Millidegree, Angle.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Angle.BaseUnit, AngleUnit.Milliradian, q => q.ToUnit(AngleUnit.Milliradian)); + unitConverter.SetConversionFunction>(AngleUnit.Milliradian, Angle.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Angle.BaseUnit, AngleUnit.Nanodegree, q => q.ToUnit(AngleUnit.Nanodegree)); + unitConverter.SetConversionFunction>(AngleUnit.Nanodegree, Angle.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Angle.BaseUnit, AngleUnit.Nanoradian, q => q.ToUnit(AngleUnit.Nanoradian)); + unitConverter.SetConversionFunction>(AngleUnit.Nanoradian, Angle.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Angle.BaseUnit, AngleUnit.Radian, q => q.ToUnit(AngleUnit.Radian)); + unitConverter.SetConversionFunction>(AngleUnit.Radian, Angle.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Angle.BaseUnit, AngleUnit.Revolution, q => q.ToUnit(AngleUnit.Revolution)); + unitConverter.SetConversionFunction>(AngleUnit.Revolution, Angle.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ApparentEnergy.BaseUnit, ApparentEnergyUnit.KilovoltampereHour, q => q.ToUnit(ApparentEnergyUnit.KilovoltampereHour)); + unitConverter.SetConversionFunction>(ApparentEnergyUnit.KilovoltampereHour, ApparentEnergy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ApparentEnergy.BaseUnit, ApparentEnergyUnit.MegavoltampereHour, q => q.ToUnit(ApparentEnergyUnit.MegavoltampereHour)); + unitConverter.SetConversionFunction>(ApparentEnergyUnit.MegavoltampereHour, ApparentEnergy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ApparentEnergy.BaseUnit, ApparentEnergy.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ApparentPower.BaseUnit, ApparentPowerUnit.Gigavoltampere, q => q.ToUnit(ApparentPowerUnit.Gigavoltampere)); + unitConverter.SetConversionFunction>(ApparentPowerUnit.Gigavoltampere, ApparentPower.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ApparentPower.BaseUnit, ApparentPowerUnit.Kilovoltampere, q => q.ToUnit(ApparentPowerUnit.Kilovoltampere)); + unitConverter.SetConversionFunction>(ApparentPowerUnit.Kilovoltampere, ApparentPower.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ApparentPower.BaseUnit, ApparentPowerUnit.Megavoltampere, q => q.ToUnit(ApparentPowerUnit.Megavoltampere)); + unitConverter.SetConversionFunction>(ApparentPowerUnit.Megavoltampere, ApparentPower.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ApparentPower.BaseUnit, ApparentPower.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Area.BaseUnit, AreaUnit.Acre, q => q.ToUnit(AreaUnit.Acre)); + unitConverter.SetConversionFunction>(AreaUnit.Acre, Area.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Area.BaseUnit, AreaUnit.Hectare, q => q.ToUnit(AreaUnit.Hectare)); + unitConverter.SetConversionFunction>(AreaUnit.Hectare, Area.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Area.BaseUnit, AreaUnit.SquareCentimeter, q => q.ToUnit(AreaUnit.SquareCentimeter)); + unitConverter.SetConversionFunction>(AreaUnit.SquareCentimeter, Area.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Area.BaseUnit, AreaUnit.SquareDecimeter, q => q.ToUnit(AreaUnit.SquareDecimeter)); + unitConverter.SetConversionFunction>(AreaUnit.SquareDecimeter, Area.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Area.BaseUnit, AreaUnit.SquareFoot, q => q.ToUnit(AreaUnit.SquareFoot)); + unitConverter.SetConversionFunction>(AreaUnit.SquareFoot, Area.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Area.BaseUnit, AreaUnit.SquareInch, q => q.ToUnit(AreaUnit.SquareInch)); + unitConverter.SetConversionFunction>(AreaUnit.SquareInch, Area.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Area.BaseUnit, AreaUnit.SquareKilometer, q => q.ToUnit(AreaUnit.SquareKilometer)); + unitConverter.SetConversionFunction>(AreaUnit.SquareKilometer, Area.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Area.BaseUnit, Area.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Area.BaseUnit, AreaUnit.SquareMicrometer, q => q.ToUnit(AreaUnit.SquareMicrometer)); + unitConverter.SetConversionFunction>(AreaUnit.SquareMicrometer, Area.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Area.BaseUnit, AreaUnit.SquareMile, q => q.ToUnit(AreaUnit.SquareMile)); + unitConverter.SetConversionFunction>(AreaUnit.SquareMile, Area.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Area.BaseUnit, AreaUnit.SquareMillimeter, q => q.ToUnit(AreaUnit.SquareMillimeter)); + unitConverter.SetConversionFunction>(AreaUnit.SquareMillimeter, Area.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Area.BaseUnit, AreaUnit.SquareNauticalMile, q => q.ToUnit(AreaUnit.SquareNauticalMile)); + unitConverter.SetConversionFunction>(AreaUnit.SquareNauticalMile, Area.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Area.BaseUnit, AreaUnit.SquareYard, q => q.ToUnit(AreaUnit.SquareYard)); + unitConverter.SetConversionFunction>(AreaUnit.SquareYard, Area.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Area.BaseUnit, AreaUnit.UsSurveySquareFoot, q => q.ToUnit(AreaUnit.UsSurveySquareFoot)); + unitConverter.SetConversionFunction>(AreaUnit.UsSurveySquareFoot, Area.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AreaDensity.BaseUnit, AreaDensity.BaseUnit, q => q); + unitConverter.SetConversionFunction>(AreaMomentOfInertia.BaseUnit, AreaMomentOfInertiaUnit.CentimeterToTheFourth, q => q.ToUnit(AreaMomentOfInertiaUnit.CentimeterToTheFourth)); + unitConverter.SetConversionFunction>(AreaMomentOfInertiaUnit.CentimeterToTheFourth, AreaMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AreaMomentOfInertia.BaseUnit, AreaMomentOfInertiaUnit.DecimeterToTheFourth, q => q.ToUnit(AreaMomentOfInertiaUnit.DecimeterToTheFourth)); + unitConverter.SetConversionFunction>(AreaMomentOfInertiaUnit.DecimeterToTheFourth, AreaMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AreaMomentOfInertia.BaseUnit, AreaMomentOfInertiaUnit.FootToTheFourth, q => q.ToUnit(AreaMomentOfInertiaUnit.FootToTheFourth)); + unitConverter.SetConversionFunction>(AreaMomentOfInertiaUnit.FootToTheFourth, AreaMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AreaMomentOfInertia.BaseUnit, AreaMomentOfInertiaUnit.InchToTheFourth, q => q.ToUnit(AreaMomentOfInertiaUnit.InchToTheFourth)); + unitConverter.SetConversionFunction>(AreaMomentOfInertiaUnit.InchToTheFourth, AreaMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(AreaMomentOfInertia.BaseUnit, AreaMomentOfInertia.BaseUnit, q => q); + unitConverter.SetConversionFunction>(AreaMomentOfInertia.BaseUnit, AreaMomentOfInertiaUnit.MillimeterToTheFourth, q => q.ToUnit(AreaMomentOfInertiaUnit.MillimeterToTheFourth)); + unitConverter.SetConversionFunction>(AreaMomentOfInertiaUnit.MillimeterToTheFourth, AreaMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRate.BaseUnit, q => q); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.BytePerSecond, q => q.ToUnit(BitRateUnit.BytePerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.BytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.ExabitPerSecond, q => q.ToUnit(BitRateUnit.ExabitPerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.ExabitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.ExabytePerSecond, q => q.ToUnit(BitRateUnit.ExabytePerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.ExabytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.ExbibitPerSecond, q => q.ToUnit(BitRateUnit.ExbibitPerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.ExbibitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.ExbibytePerSecond, q => q.ToUnit(BitRateUnit.ExbibytePerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.ExbibytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.GibibitPerSecond, q => q.ToUnit(BitRateUnit.GibibitPerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.GibibitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.GibibytePerSecond, q => q.ToUnit(BitRateUnit.GibibytePerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.GibibytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.GigabitPerSecond, q => q.ToUnit(BitRateUnit.GigabitPerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.GigabitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.GigabytePerSecond, q => q.ToUnit(BitRateUnit.GigabytePerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.GigabytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.KibibitPerSecond, q => q.ToUnit(BitRateUnit.KibibitPerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.KibibitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.KibibytePerSecond, q => q.ToUnit(BitRateUnit.KibibytePerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.KibibytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.KilobitPerSecond, q => q.ToUnit(BitRateUnit.KilobitPerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.KilobitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.KilobytePerSecond, q => q.ToUnit(BitRateUnit.KilobytePerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.KilobytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.MebibitPerSecond, q => q.ToUnit(BitRateUnit.MebibitPerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.MebibitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.MebibytePerSecond, q => q.ToUnit(BitRateUnit.MebibytePerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.MebibytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.MegabitPerSecond, q => q.ToUnit(BitRateUnit.MegabitPerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.MegabitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.MegabytePerSecond, q => q.ToUnit(BitRateUnit.MegabytePerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.MegabytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.PebibitPerSecond, q => q.ToUnit(BitRateUnit.PebibitPerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.PebibitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.PebibytePerSecond, q => q.ToUnit(BitRateUnit.PebibytePerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.PebibytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.PetabitPerSecond, q => q.ToUnit(BitRateUnit.PetabitPerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.PetabitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.PetabytePerSecond, q => q.ToUnit(BitRateUnit.PetabytePerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.PetabytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.TebibitPerSecond, q => q.ToUnit(BitRateUnit.TebibitPerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.TebibitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.TebibytePerSecond, q => q.ToUnit(BitRateUnit.TebibytePerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.TebibytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.TerabitPerSecond, q => q.ToUnit(BitRateUnit.TerabitPerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.TerabitPerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BitRate.BaseUnit, BitRateUnit.TerabytePerSecond, q => q.ToUnit(BitRateUnit.TerabytePerSecond)); + unitConverter.SetConversionFunction>(BitRateUnit.TerabytePerSecond, BitRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BrakeSpecificFuelConsumption.BaseUnit, BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour, q => q.ToUnit(BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour)); + unitConverter.SetConversionFunction>(BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour, BrakeSpecificFuelConsumption.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(BrakeSpecificFuelConsumption.BaseUnit, BrakeSpecificFuelConsumption.BaseUnit, q => q); + unitConverter.SetConversionFunction>(BrakeSpecificFuelConsumption.BaseUnit, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour, q => q.ToUnit(BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour)); + unitConverter.SetConversionFunction>(BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour, BrakeSpecificFuelConsumption.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Capacitance.BaseUnit, Capacitance.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Capacitance.BaseUnit, CapacitanceUnit.Kilofarad, q => q.ToUnit(CapacitanceUnit.Kilofarad)); + unitConverter.SetConversionFunction>(CapacitanceUnit.Kilofarad, Capacitance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Capacitance.BaseUnit, CapacitanceUnit.Megafarad, q => q.ToUnit(CapacitanceUnit.Megafarad)); + unitConverter.SetConversionFunction>(CapacitanceUnit.Megafarad, Capacitance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Capacitance.BaseUnit, CapacitanceUnit.Microfarad, q => q.ToUnit(CapacitanceUnit.Microfarad)); + unitConverter.SetConversionFunction>(CapacitanceUnit.Microfarad, Capacitance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Capacitance.BaseUnit, CapacitanceUnit.Millifarad, q => q.ToUnit(CapacitanceUnit.Millifarad)); + unitConverter.SetConversionFunction>(CapacitanceUnit.Millifarad, Capacitance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Capacitance.BaseUnit, CapacitanceUnit.Nanofarad, q => q.ToUnit(CapacitanceUnit.Nanofarad)); + unitConverter.SetConversionFunction>(CapacitanceUnit.Nanofarad, Capacitance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Capacitance.BaseUnit, CapacitanceUnit.Picofarad, q => q.ToUnit(CapacitanceUnit.Picofarad)); + unitConverter.SetConversionFunction>(CapacitanceUnit.Picofarad, Capacitance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(CoefficientOfThermalExpansion.BaseUnit, CoefficientOfThermalExpansionUnit.InverseDegreeCelsius, q => q.ToUnit(CoefficientOfThermalExpansionUnit.InverseDegreeCelsius)); + unitConverter.SetConversionFunction>(CoefficientOfThermalExpansionUnit.InverseDegreeCelsius, CoefficientOfThermalExpansion.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(CoefficientOfThermalExpansion.BaseUnit, CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit, q => q.ToUnit(CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit)); + unitConverter.SetConversionFunction>(CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit, CoefficientOfThermalExpansion.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(CoefficientOfThermalExpansion.BaseUnit, CoefficientOfThermalExpansion.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.CentigramPerDeciliter, q => q.ToUnit(DensityUnit.CentigramPerDeciliter)); + unitConverter.SetConversionFunction>(DensityUnit.CentigramPerDeciliter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.CentigramPerLiter, q => q.ToUnit(DensityUnit.CentigramPerLiter)); + unitConverter.SetConversionFunction>(DensityUnit.CentigramPerLiter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.CentigramPerMilliliter, q => q.ToUnit(DensityUnit.CentigramPerMilliliter)); + unitConverter.SetConversionFunction>(DensityUnit.CentigramPerMilliliter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.DecigramPerDeciliter, q => q.ToUnit(DensityUnit.DecigramPerDeciliter)); + unitConverter.SetConversionFunction>(DensityUnit.DecigramPerDeciliter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.DecigramPerLiter, q => q.ToUnit(DensityUnit.DecigramPerLiter)); + unitConverter.SetConversionFunction>(DensityUnit.DecigramPerLiter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.DecigramPerMilliliter, q => q.ToUnit(DensityUnit.DecigramPerMilliliter)); + unitConverter.SetConversionFunction>(DensityUnit.DecigramPerMilliliter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.GramPerCubicCentimeter, q => q.ToUnit(DensityUnit.GramPerCubicCentimeter)); + unitConverter.SetConversionFunction>(DensityUnit.GramPerCubicCentimeter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.GramPerCubicMeter, q => q.ToUnit(DensityUnit.GramPerCubicMeter)); + unitConverter.SetConversionFunction>(DensityUnit.GramPerCubicMeter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.GramPerCubicMillimeter, q => q.ToUnit(DensityUnit.GramPerCubicMillimeter)); + unitConverter.SetConversionFunction>(DensityUnit.GramPerCubicMillimeter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.GramPerDeciliter, q => q.ToUnit(DensityUnit.GramPerDeciliter)); + unitConverter.SetConversionFunction>(DensityUnit.GramPerDeciliter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.GramPerLiter, q => q.ToUnit(DensityUnit.GramPerLiter)); + unitConverter.SetConversionFunction>(DensityUnit.GramPerLiter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.GramPerMilliliter, q => q.ToUnit(DensityUnit.GramPerMilliliter)); + unitConverter.SetConversionFunction>(DensityUnit.GramPerMilliliter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.KilogramPerCubicCentimeter, q => q.ToUnit(DensityUnit.KilogramPerCubicCentimeter)); + unitConverter.SetConversionFunction>(DensityUnit.KilogramPerCubicCentimeter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, Density.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.KilogramPerCubicMillimeter, q => q.ToUnit(DensityUnit.KilogramPerCubicMillimeter)); + unitConverter.SetConversionFunction>(DensityUnit.KilogramPerCubicMillimeter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.KilogramPerLiter, q => q.ToUnit(DensityUnit.KilogramPerLiter)); + unitConverter.SetConversionFunction>(DensityUnit.KilogramPerLiter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.KilopoundPerCubicFoot, q => q.ToUnit(DensityUnit.KilopoundPerCubicFoot)); + unitConverter.SetConversionFunction>(DensityUnit.KilopoundPerCubicFoot, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.KilopoundPerCubicInch, q => q.ToUnit(DensityUnit.KilopoundPerCubicInch)); + unitConverter.SetConversionFunction>(DensityUnit.KilopoundPerCubicInch, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.MicrogramPerCubicMeter, q => q.ToUnit(DensityUnit.MicrogramPerCubicMeter)); + unitConverter.SetConversionFunction>(DensityUnit.MicrogramPerCubicMeter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.MicrogramPerDeciliter, q => q.ToUnit(DensityUnit.MicrogramPerDeciliter)); + unitConverter.SetConversionFunction>(DensityUnit.MicrogramPerDeciliter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.MicrogramPerLiter, q => q.ToUnit(DensityUnit.MicrogramPerLiter)); + unitConverter.SetConversionFunction>(DensityUnit.MicrogramPerLiter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.MicrogramPerMilliliter, q => q.ToUnit(DensityUnit.MicrogramPerMilliliter)); + unitConverter.SetConversionFunction>(DensityUnit.MicrogramPerMilliliter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.MilligramPerCubicMeter, q => q.ToUnit(DensityUnit.MilligramPerCubicMeter)); + unitConverter.SetConversionFunction>(DensityUnit.MilligramPerCubicMeter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.MilligramPerDeciliter, q => q.ToUnit(DensityUnit.MilligramPerDeciliter)); + unitConverter.SetConversionFunction>(DensityUnit.MilligramPerDeciliter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.MilligramPerLiter, q => q.ToUnit(DensityUnit.MilligramPerLiter)); + unitConverter.SetConversionFunction>(DensityUnit.MilligramPerLiter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.MilligramPerMilliliter, q => q.ToUnit(DensityUnit.MilligramPerMilliliter)); + unitConverter.SetConversionFunction>(DensityUnit.MilligramPerMilliliter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.NanogramPerDeciliter, q => q.ToUnit(DensityUnit.NanogramPerDeciliter)); + unitConverter.SetConversionFunction>(DensityUnit.NanogramPerDeciliter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.NanogramPerLiter, q => q.ToUnit(DensityUnit.NanogramPerLiter)); + unitConverter.SetConversionFunction>(DensityUnit.NanogramPerLiter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.NanogramPerMilliliter, q => q.ToUnit(DensityUnit.NanogramPerMilliliter)); + unitConverter.SetConversionFunction>(DensityUnit.NanogramPerMilliliter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.PicogramPerDeciliter, q => q.ToUnit(DensityUnit.PicogramPerDeciliter)); + unitConverter.SetConversionFunction>(DensityUnit.PicogramPerDeciliter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.PicogramPerLiter, q => q.ToUnit(DensityUnit.PicogramPerLiter)); + unitConverter.SetConversionFunction>(DensityUnit.PicogramPerLiter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.PicogramPerMilliliter, q => q.ToUnit(DensityUnit.PicogramPerMilliliter)); + unitConverter.SetConversionFunction>(DensityUnit.PicogramPerMilliliter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.PoundPerCubicFoot, q => q.ToUnit(DensityUnit.PoundPerCubicFoot)); + unitConverter.SetConversionFunction>(DensityUnit.PoundPerCubicFoot, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.PoundPerCubicInch, q => q.ToUnit(DensityUnit.PoundPerCubicInch)); + unitConverter.SetConversionFunction>(DensityUnit.PoundPerCubicInch, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.PoundPerImperialGallon, q => q.ToUnit(DensityUnit.PoundPerImperialGallon)); + unitConverter.SetConversionFunction>(DensityUnit.PoundPerImperialGallon, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.PoundPerUSGallon, q => q.ToUnit(DensityUnit.PoundPerUSGallon)); + unitConverter.SetConversionFunction>(DensityUnit.PoundPerUSGallon, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.SlugPerCubicFoot, q => q.ToUnit(DensityUnit.SlugPerCubicFoot)); + unitConverter.SetConversionFunction>(DensityUnit.SlugPerCubicFoot, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.TonnePerCubicCentimeter, q => q.ToUnit(DensityUnit.TonnePerCubicCentimeter)); + unitConverter.SetConversionFunction>(DensityUnit.TonnePerCubicCentimeter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.TonnePerCubicMeter, q => q.ToUnit(DensityUnit.TonnePerCubicMeter)); + unitConverter.SetConversionFunction>(DensityUnit.TonnePerCubicMeter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Density.BaseUnit, DensityUnit.TonnePerCubicMillimeter, q => q.ToUnit(DensityUnit.TonnePerCubicMillimeter)); + unitConverter.SetConversionFunction>(DensityUnit.TonnePerCubicMillimeter, Density.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Duration.BaseUnit, DurationUnit.Day, q => q.ToUnit(DurationUnit.Day)); + unitConverter.SetConversionFunction>(DurationUnit.Day, Duration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Duration.BaseUnit, DurationUnit.Hour, q => q.ToUnit(DurationUnit.Hour)); + unitConverter.SetConversionFunction>(DurationUnit.Hour, Duration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Duration.BaseUnit, DurationUnit.Microsecond, q => q.ToUnit(DurationUnit.Microsecond)); + unitConverter.SetConversionFunction>(DurationUnit.Microsecond, Duration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Duration.BaseUnit, DurationUnit.Millisecond, q => q.ToUnit(DurationUnit.Millisecond)); + unitConverter.SetConversionFunction>(DurationUnit.Millisecond, Duration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Duration.BaseUnit, DurationUnit.Minute, q => q.ToUnit(DurationUnit.Minute)); + unitConverter.SetConversionFunction>(DurationUnit.Minute, Duration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Duration.BaseUnit, DurationUnit.Month30, q => q.ToUnit(DurationUnit.Month30)); + unitConverter.SetConversionFunction>(DurationUnit.Month30, Duration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Duration.BaseUnit, DurationUnit.Nanosecond, q => q.ToUnit(DurationUnit.Nanosecond)); + unitConverter.SetConversionFunction>(DurationUnit.Nanosecond, Duration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Duration.BaseUnit, Duration.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Duration.BaseUnit, DurationUnit.Week, q => q.ToUnit(DurationUnit.Week)); + unitConverter.SetConversionFunction>(DurationUnit.Week, Duration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Duration.BaseUnit, DurationUnit.Year365, q => q.ToUnit(DurationUnit.Year365)); + unitConverter.SetConversionFunction>(DurationUnit.Year365, Duration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(DynamicViscosity.BaseUnit, DynamicViscosityUnit.Centipoise, q => q.ToUnit(DynamicViscosityUnit.Centipoise)); + unitConverter.SetConversionFunction>(DynamicViscosityUnit.Centipoise, DynamicViscosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(DynamicViscosity.BaseUnit, DynamicViscosityUnit.MicropascalSecond, q => q.ToUnit(DynamicViscosityUnit.MicropascalSecond)); + unitConverter.SetConversionFunction>(DynamicViscosityUnit.MicropascalSecond, DynamicViscosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(DynamicViscosity.BaseUnit, DynamicViscosityUnit.MillipascalSecond, q => q.ToUnit(DynamicViscosityUnit.MillipascalSecond)); + unitConverter.SetConversionFunction>(DynamicViscosityUnit.MillipascalSecond, DynamicViscosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(DynamicViscosity.BaseUnit, DynamicViscosity.BaseUnit, q => q); + unitConverter.SetConversionFunction>(DynamicViscosity.BaseUnit, DynamicViscosityUnit.PascalSecond, q => q.ToUnit(DynamicViscosityUnit.PascalSecond)); + unitConverter.SetConversionFunction>(DynamicViscosityUnit.PascalSecond, DynamicViscosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(DynamicViscosity.BaseUnit, DynamicViscosityUnit.Poise, q => q.ToUnit(DynamicViscosityUnit.Poise)); + unitConverter.SetConversionFunction>(DynamicViscosityUnit.Poise, DynamicViscosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(DynamicViscosity.BaseUnit, DynamicViscosityUnit.PoundForceSecondPerSquareFoot, q => q.ToUnit(DynamicViscosityUnit.PoundForceSecondPerSquareFoot)); + unitConverter.SetConversionFunction>(DynamicViscosityUnit.PoundForceSecondPerSquareFoot, DynamicViscosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(DynamicViscosity.BaseUnit, DynamicViscosityUnit.PoundForceSecondPerSquareInch, q => q.ToUnit(DynamicViscosityUnit.PoundForceSecondPerSquareInch)); + unitConverter.SetConversionFunction>(DynamicViscosityUnit.PoundForceSecondPerSquareInch, DynamicViscosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(DynamicViscosity.BaseUnit, DynamicViscosityUnit.Reyn, q => q.ToUnit(DynamicViscosityUnit.Reyn)); + unitConverter.SetConversionFunction>(DynamicViscosityUnit.Reyn, DynamicViscosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricAdmittance.BaseUnit, ElectricAdmittanceUnit.Microsiemens, q => q.ToUnit(ElectricAdmittanceUnit.Microsiemens)); + unitConverter.SetConversionFunction>(ElectricAdmittanceUnit.Microsiemens, ElectricAdmittance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricAdmittance.BaseUnit, ElectricAdmittanceUnit.Millisiemens, q => q.ToUnit(ElectricAdmittanceUnit.Millisiemens)); + unitConverter.SetConversionFunction>(ElectricAdmittanceUnit.Millisiemens, ElectricAdmittance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricAdmittance.BaseUnit, ElectricAdmittanceUnit.Nanosiemens, q => q.ToUnit(ElectricAdmittanceUnit.Nanosiemens)); + unitConverter.SetConversionFunction>(ElectricAdmittanceUnit.Nanosiemens, ElectricAdmittance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricAdmittance.BaseUnit, ElectricAdmittance.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ElectricCharge.BaseUnit, ElectricChargeUnit.AmpereHour, q => q.ToUnit(ElectricChargeUnit.AmpereHour)); + unitConverter.SetConversionFunction>(ElectricChargeUnit.AmpereHour, ElectricCharge.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricCharge.BaseUnit, ElectricCharge.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ElectricCharge.BaseUnit, ElectricChargeUnit.KiloampereHour, q => q.ToUnit(ElectricChargeUnit.KiloampereHour)); + unitConverter.SetConversionFunction>(ElectricChargeUnit.KiloampereHour, ElectricCharge.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricCharge.BaseUnit, ElectricChargeUnit.MegaampereHour, q => q.ToUnit(ElectricChargeUnit.MegaampereHour)); + unitConverter.SetConversionFunction>(ElectricChargeUnit.MegaampereHour, ElectricCharge.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricCharge.BaseUnit, ElectricChargeUnit.MilliampereHour, q => q.ToUnit(ElectricChargeUnit.MilliampereHour)); + unitConverter.SetConversionFunction>(ElectricChargeUnit.MilliampereHour, ElectricCharge.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricChargeDensity.BaseUnit, ElectricChargeDensity.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ElectricConductance.BaseUnit, ElectricConductanceUnit.Microsiemens, q => q.ToUnit(ElectricConductanceUnit.Microsiemens)); + unitConverter.SetConversionFunction>(ElectricConductanceUnit.Microsiemens, ElectricConductance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricConductance.BaseUnit, ElectricConductanceUnit.Millisiemens, q => q.ToUnit(ElectricConductanceUnit.Millisiemens)); + unitConverter.SetConversionFunction>(ElectricConductanceUnit.Millisiemens, ElectricConductance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricConductance.BaseUnit, ElectricConductance.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ElectricConductivity.BaseUnit, ElectricConductivityUnit.SiemensPerFoot, q => q.ToUnit(ElectricConductivityUnit.SiemensPerFoot)); + unitConverter.SetConversionFunction>(ElectricConductivityUnit.SiemensPerFoot, ElectricConductivity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricConductivity.BaseUnit, ElectricConductivityUnit.SiemensPerInch, q => q.ToUnit(ElectricConductivityUnit.SiemensPerInch)); + unitConverter.SetConversionFunction>(ElectricConductivityUnit.SiemensPerInch, ElectricConductivity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricConductivity.BaseUnit, ElectricConductivity.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ElectricCurrent.BaseUnit, ElectricCurrent.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ElectricCurrent.BaseUnit, ElectricCurrentUnit.Centiampere, q => q.ToUnit(ElectricCurrentUnit.Centiampere)); + unitConverter.SetConversionFunction>(ElectricCurrentUnit.Centiampere, ElectricCurrent.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricCurrent.BaseUnit, ElectricCurrentUnit.Kiloampere, q => q.ToUnit(ElectricCurrentUnit.Kiloampere)); + unitConverter.SetConversionFunction>(ElectricCurrentUnit.Kiloampere, ElectricCurrent.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricCurrent.BaseUnit, ElectricCurrentUnit.Megaampere, q => q.ToUnit(ElectricCurrentUnit.Megaampere)); + unitConverter.SetConversionFunction>(ElectricCurrentUnit.Megaampere, ElectricCurrent.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricCurrent.BaseUnit, ElectricCurrentUnit.Microampere, q => q.ToUnit(ElectricCurrentUnit.Microampere)); + unitConverter.SetConversionFunction>(ElectricCurrentUnit.Microampere, ElectricCurrent.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricCurrent.BaseUnit, ElectricCurrentUnit.Milliampere, q => q.ToUnit(ElectricCurrentUnit.Milliampere)); + unitConverter.SetConversionFunction>(ElectricCurrentUnit.Milliampere, ElectricCurrent.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricCurrent.BaseUnit, ElectricCurrentUnit.Nanoampere, q => q.ToUnit(ElectricCurrentUnit.Nanoampere)); + unitConverter.SetConversionFunction>(ElectricCurrentUnit.Nanoampere, ElectricCurrent.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricCurrent.BaseUnit, ElectricCurrentUnit.Picoampere, q => q.ToUnit(ElectricCurrentUnit.Picoampere)); + unitConverter.SetConversionFunction>(ElectricCurrentUnit.Picoampere, ElectricCurrent.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricCurrentDensity.BaseUnit, ElectricCurrentDensityUnit.AmperePerSquareFoot, q => q.ToUnit(ElectricCurrentDensityUnit.AmperePerSquareFoot)); + unitConverter.SetConversionFunction>(ElectricCurrentDensityUnit.AmperePerSquareFoot, ElectricCurrentDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricCurrentDensity.BaseUnit, ElectricCurrentDensityUnit.AmperePerSquareInch, q => q.ToUnit(ElectricCurrentDensityUnit.AmperePerSquareInch)); + unitConverter.SetConversionFunction>(ElectricCurrentDensityUnit.AmperePerSquareInch, ElectricCurrentDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricCurrentDensity.BaseUnit, ElectricCurrentDensity.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ElectricCurrentGradient.BaseUnit, ElectricCurrentGradient.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ElectricField.BaseUnit, ElectricField.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ElectricInductance.BaseUnit, ElectricInductance.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ElectricInductance.BaseUnit, ElectricInductanceUnit.Microhenry, q => q.ToUnit(ElectricInductanceUnit.Microhenry)); + unitConverter.SetConversionFunction>(ElectricInductanceUnit.Microhenry, ElectricInductance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricInductance.BaseUnit, ElectricInductanceUnit.Millihenry, q => q.ToUnit(ElectricInductanceUnit.Millihenry)); + unitConverter.SetConversionFunction>(ElectricInductanceUnit.Millihenry, ElectricInductance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricInductance.BaseUnit, ElectricInductanceUnit.Nanohenry, q => q.ToUnit(ElectricInductanceUnit.Nanohenry)); + unitConverter.SetConversionFunction>(ElectricInductanceUnit.Nanohenry, ElectricInductance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricPotential.BaseUnit, ElectricPotentialUnit.Kilovolt, q => q.ToUnit(ElectricPotentialUnit.Kilovolt)); + unitConverter.SetConversionFunction>(ElectricPotentialUnit.Kilovolt, ElectricPotential.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricPotential.BaseUnit, ElectricPotentialUnit.Megavolt, q => q.ToUnit(ElectricPotentialUnit.Megavolt)); + unitConverter.SetConversionFunction>(ElectricPotentialUnit.Megavolt, ElectricPotential.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricPotential.BaseUnit, ElectricPotentialUnit.Microvolt, q => q.ToUnit(ElectricPotentialUnit.Microvolt)); + unitConverter.SetConversionFunction>(ElectricPotentialUnit.Microvolt, ElectricPotential.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricPotential.BaseUnit, ElectricPotentialUnit.Millivolt, q => q.ToUnit(ElectricPotentialUnit.Millivolt)); + unitConverter.SetConversionFunction>(ElectricPotentialUnit.Millivolt, ElectricPotential.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricPotential.BaseUnit, ElectricPotential.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ElectricPotentialAc.BaseUnit, ElectricPotentialAcUnit.KilovoltAc, q => q.ToUnit(ElectricPotentialAcUnit.KilovoltAc)); + unitConverter.SetConversionFunction>(ElectricPotentialAcUnit.KilovoltAc, ElectricPotentialAc.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricPotentialAc.BaseUnit, ElectricPotentialAcUnit.MegavoltAc, q => q.ToUnit(ElectricPotentialAcUnit.MegavoltAc)); + unitConverter.SetConversionFunction>(ElectricPotentialAcUnit.MegavoltAc, ElectricPotentialAc.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricPotentialAc.BaseUnit, ElectricPotentialAcUnit.MicrovoltAc, q => q.ToUnit(ElectricPotentialAcUnit.MicrovoltAc)); + unitConverter.SetConversionFunction>(ElectricPotentialAcUnit.MicrovoltAc, ElectricPotentialAc.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricPotentialAc.BaseUnit, ElectricPotentialAcUnit.MillivoltAc, q => q.ToUnit(ElectricPotentialAcUnit.MillivoltAc)); + unitConverter.SetConversionFunction>(ElectricPotentialAcUnit.MillivoltAc, ElectricPotentialAc.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricPotentialAc.BaseUnit, ElectricPotentialAc.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ElectricPotentialDc.BaseUnit, ElectricPotentialDcUnit.KilovoltDc, q => q.ToUnit(ElectricPotentialDcUnit.KilovoltDc)); + unitConverter.SetConversionFunction>(ElectricPotentialDcUnit.KilovoltDc, ElectricPotentialDc.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricPotentialDc.BaseUnit, ElectricPotentialDcUnit.MegavoltDc, q => q.ToUnit(ElectricPotentialDcUnit.MegavoltDc)); + unitConverter.SetConversionFunction>(ElectricPotentialDcUnit.MegavoltDc, ElectricPotentialDc.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricPotentialDc.BaseUnit, ElectricPotentialDcUnit.MicrovoltDc, q => q.ToUnit(ElectricPotentialDcUnit.MicrovoltDc)); + unitConverter.SetConversionFunction>(ElectricPotentialDcUnit.MicrovoltDc, ElectricPotentialDc.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricPotentialDc.BaseUnit, ElectricPotentialDcUnit.MillivoltDc, q => q.ToUnit(ElectricPotentialDcUnit.MillivoltDc)); + unitConverter.SetConversionFunction>(ElectricPotentialDcUnit.MillivoltDc, ElectricPotentialDc.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricPotentialDc.BaseUnit, ElectricPotentialDc.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ElectricResistance.BaseUnit, ElectricResistanceUnit.Gigaohm, q => q.ToUnit(ElectricResistanceUnit.Gigaohm)); + unitConverter.SetConversionFunction>(ElectricResistanceUnit.Gigaohm, ElectricResistance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricResistance.BaseUnit, ElectricResistanceUnit.Kiloohm, q => q.ToUnit(ElectricResistanceUnit.Kiloohm)); + unitConverter.SetConversionFunction>(ElectricResistanceUnit.Kiloohm, ElectricResistance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricResistance.BaseUnit, ElectricResistanceUnit.Megaohm, q => q.ToUnit(ElectricResistanceUnit.Megaohm)); + unitConverter.SetConversionFunction>(ElectricResistanceUnit.Megaohm, ElectricResistance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricResistance.BaseUnit, ElectricResistanceUnit.Milliohm, q => q.ToUnit(ElectricResistanceUnit.Milliohm)); + unitConverter.SetConversionFunction>(ElectricResistanceUnit.Milliohm, ElectricResistance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricResistance.BaseUnit, ElectricResistance.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ElectricResistivity.BaseUnit, ElectricResistivityUnit.KiloohmCentimeter, q => q.ToUnit(ElectricResistivityUnit.KiloohmCentimeter)); + unitConverter.SetConversionFunction>(ElectricResistivityUnit.KiloohmCentimeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricResistivity.BaseUnit, ElectricResistivityUnit.KiloohmMeter, q => q.ToUnit(ElectricResistivityUnit.KiloohmMeter)); + unitConverter.SetConversionFunction>(ElectricResistivityUnit.KiloohmMeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricResistivity.BaseUnit, ElectricResistivityUnit.MegaohmCentimeter, q => q.ToUnit(ElectricResistivityUnit.MegaohmCentimeter)); + unitConverter.SetConversionFunction>(ElectricResistivityUnit.MegaohmCentimeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricResistivity.BaseUnit, ElectricResistivityUnit.MegaohmMeter, q => q.ToUnit(ElectricResistivityUnit.MegaohmMeter)); + unitConverter.SetConversionFunction>(ElectricResistivityUnit.MegaohmMeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricResistivity.BaseUnit, ElectricResistivityUnit.MicroohmCentimeter, q => q.ToUnit(ElectricResistivityUnit.MicroohmCentimeter)); + unitConverter.SetConversionFunction>(ElectricResistivityUnit.MicroohmCentimeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricResistivity.BaseUnit, ElectricResistivityUnit.MicroohmMeter, q => q.ToUnit(ElectricResistivityUnit.MicroohmMeter)); + unitConverter.SetConversionFunction>(ElectricResistivityUnit.MicroohmMeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricResistivity.BaseUnit, ElectricResistivityUnit.MilliohmCentimeter, q => q.ToUnit(ElectricResistivityUnit.MilliohmCentimeter)); + unitConverter.SetConversionFunction>(ElectricResistivityUnit.MilliohmCentimeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricResistivity.BaseUnit, ElectricResistivityUnit.MilliohmMeter, q => q.ToUnit(ElectricResistivityUnit.MilliohmMeter)); + unitConverter.SetConversionFunction>(ElectricResistivityUnit.MilliohmMeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricResistivity.BaseUnit, ElectricResistivityUnit.NanoohmCentimeter, q => q.ToUnit(ElectricResistivityUnit.NanoohmCentimeter)); + unitConverter.SetConversionFunction>(ElectricResistivityUnit.NanoohmCentimeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricResistivity.BaseUnit, ElectricResistivityUnit.NanoohmMeter, q => q.ToUnit(ElectricResistivityUnit.NanoohmMeter)); + unitConverter.SetConversionFunction>(ElectricResistivityUnit.NanoohmMeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricResistivity.BaseUnit, ElectricResistivityUnit.OhmCentimeter, q => q.ToUnit(ElectricResistivityUnit.OhmCentimeter)); + unitConverter.SetConversionFunction>(ElectricResistivityUnit.OhmCentimeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricResistivity.BaseUnit, ElectricResistivity.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ElectricResistivity.BaseUnit, ElectricResistivityUnit.PicoohmCentimeter, q => q.ToUnit(ElectricResistivityUnit.PicoohmCentimeter)); + unitConverter.SetConversionFunction>(ElectricResistivityUnit.PicoohmCentimeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricResistivity.BaseUnit, ElectricResistivityUnit.PicoohmMeter, q => q.ToUnit(ElectricResistivityUnit.PicoohmMeter)); + unitConverter.SetConversionFunction>(ElectricResistivityUnit.PicoohmMeter, ElectricResistivity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricSurfaceChargeDensity.BaseUnit, ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter, q => q.ToUnit(ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter)); + unitConverter.SetConversionFunction>(ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter, ElectricSurfaceChargeDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricSurfaceChargeDensity.BaseUnit, ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch, q => q.ToUnit(ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch)); + unitConverter.SetConversionFunction>(ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch, ElectricSurfaceChargeDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ElectricSurfaceChargeDensity.BaseUnit, ElectricSurfaceChargeDensity.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.BritishThermalUnit, q => q.ToUnit(EnergyUnit.BritishThermalUnit)); + unitConverter.SetConversionFunction>(EnergyUnit.BritishThermalUnit, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.Calorie, q => q.ToUnit(EnergyUnit.Calorie)); + unitConverter.SetConversionFunction>(EnergyUnit.Calorie, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.DecathermEc, q => q.ToUnit(EnergyUnit.DecathermEc)); + unitConverter.SetConversionFunction>(EnergyUnit.DecathermEc, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.DecathermImperial, q => q.ToUnit(EnergyUnit.DecathermImperial)); + unitConverter.SetConversionFunction>(EnergyUnit.DecathermImperial, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.DecathermUs, q => q.ToUnit(EnergyUnit.DecathermUs)); + unitConverter.SetConversionFunction>(EnergyUnit.DecathermUs, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.ElectronVolt, q => q.ToUnit(EnergyUnit.ElectronVolt)); + unitConverter.SetConversionFunction>(EnergyUnit.ElectronVolt, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.Erg, q => q.ToUnit(EnergyUnit.Erg)); + unitConverter.SetConversionFunction>(EnergyUnit.Erg, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.FootPound, q => q.ToUnit(EnergyUnit.FootPound)); + unitConverter.SetConversionFunction>(EnergyUnit.FootPound, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.GigabritishThermalUnit, q => q.ToUnit(EnergyUnit.GigabritishThermalUnit)); + unitConverter.SetConversionFunction>(EnergyUnit.GigabritishThermalUnit, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.GigawattHour, q => q.ToUnit(EnergyUnit.GigawattHour)); + unitConverter.SetConversionFunction>(EnergyUnit.GigawattHour, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, Energy.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.KilobritishThermalUnit, q => q.ToUnit(EnergyUnit.KilobritishThermalUnit)); + unitConverter.SetConversionFunction>(EnergyUnit.KilobritishThermalUnit, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.Kilocalorie, q => q.ToUnit(EnergyUnit.Kilocalorie)); + unitConverter.SetConversionFunction>(EnergyUnit.Kilocalorie, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.Kilojoule, q => q.ToUnit(EnergyUnit.Kilojoule)); + unitConverter.SetConversionFunction>(EnergyUnit.Kilojoule, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.KilowattHour, q => q.ToUnit(EnergyUnit.KilowattHour)); + unitConverter.SetConversionFunction>(EnergyUnit.KilowattHour, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.MegabritishThermalUnit, q => q.ToUnit(EnergyUnit.MegabritishThermalUnit)); + unitConverter.SetConversionFunction>(EnergyUnit.MegabritishThermalUnit, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.Megajoule, q => q.ToUnit(EnergyUnit.Megajoule)); + unitConverter.SetConversionFunction>(EnergyUnit.Megajoule, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.MegawattHour, q => q.ToUnit(EnergyUnit.MegawattHour)); + unitConverter.SetConversionFunction>(EnergyUnit.MegawattHour, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.Millijoule, q => q.ToUnit(EnergyUnit.Millijoule)); + unitConverter.SetConversionFunction>(EnergyUnit.Millijoule, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.TerawattHour, q => q.ToUnit(EnergyUnit.TerawattHour)); + unitConverter.SetConversionFunction>(EnergyUnit.TerawattHour, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.ThermEc, q => q.ToUnit(EnergyUnit.ThermEc)); + unitConverter.SetConversionFunction>(EnergyUnit.ThermEc, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.ThermImperial, q => q.ToUnit(EnergyUnit.ThermImperial)); + unitConverter.SetConversionFunction>(EnergyUnit.ThermImperial, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.ThermUs, q => q.ToUnit(EnergyUnit.ThermUs)); + unitConverter.SetConversionFunction>(EnergyUnit.ThermUs, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Energy.BaseUnit, EnergyUnit.WattHour, q => q.ToUnit(EnergyUnit.WattHour)); + unitConverter.SetConversionFunction>(EnergyUnit.WattHour, Energy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Entropy.BaseUnit, EntropyUnit.CaloriePerKelvin, q => q.ToUnit(EntropyUnit.CaloriePerKelvin)); + unitConverter.SetConversionFunction>(EntropyUnit.CaloriePerKelvin, Entropy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Entropy.BaseUnit, EntropyUnit.JoulePerDegreeCelsius, q => q.ToUnit(EntropyUnit.JoulePerDegreeCelsius)); + unitConverter.SetConversionFunction>(EntropyUnit.JoulePerDegreeCelsius, Entropy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Entropy.BaseUnit, Entropy.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Entropy.BaseUnit, EntropyUnit.KilocaloriePerKelvin, q => q.ToUnit(EntropyUnit.KilocaloriePerKelvin)); + unitConverter.SetConversionFunction>(EntropyUnit.KilocaloriePerKelvin, Entropy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Entropy.BaseUnit, EntropyUnit.KilojoulePerDegreeCelsius, q => q.ToUnit(EntropyUnit.KilojoulePerDegreeCelsius)); + unitConverter.SetConversionFunction>(EntropyUnit.KilojoulePerDegreeCelsius, Entropy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Entropy.BaseUnit, EntropyUnit.KilojoulePerKelvin, q => q.ToUnit(EntropyUnit.KilojoulePerKelvin)); + unitConverter.SetConversionFunction>(EntropyUnit.KilojoulePerKelvin, Entropy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Entropy.BaseUnit, EntropyUnit.MegajoulePerKelvin, q => q.ToUnit(EntropyUnit.MegajoulePerKelvin)); + unitConverter.SetConversionFunction>(EntropyUnit.MegajoulePerKelvin, Entropy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Force.BaseUnit, ForceUnit.Decanewton, q => q.ToUnit(ForceUnit.Decanewton)); + unitConverter.SetConversionFunction>(ForceUnit.Decanewton, Force.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Force.BaseUnit, ForceUnit.Dyn, q => q.ToUnit(ForceUnit.Dyn)); + unitConverter.SetConversionFunction>(ForceUnit.Dyn, Force.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Force.BaseUnit, ForceUnit.KilogramForce, q => q.ToUnit(ForceUnit.KilogramForce)); + unitConverter.SetConversionFunction>(ForceUnit.KilogramForce, Force.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Force.BaseUnit, ForceUnit.Kilonewton, q => q.ToUnit(ForceUnit.Kilonewton)); + unitConverter.SetConversionFunction>(ForceUnit.Kilonewton, Force.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Force.BaseUnit, ForceUnit.KiloPond, q => q.ToUnit(ForceUnit.KiloPond)); + unitConverter.SetConversionFunction>(ForceUnit.KiloPond, Force.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Force.BaseUnit, ForceUnit.Meganewton, q => q.ToUnit(ForceUnit.Meganewton)); + unitConverter.SetConversionFunction>(ForceUnit.Meganewton, Force.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Force.BaseUnit, ForceUnit.Micronewton, q => q.ToUnit(ForceUnit.Micronewton)); + unitConverter.SetConversionFunction>(ForceUnit.Micronewton, Force.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Force.BaseUnit, ForceUnit.Millinewton, q => q.ToUnit(ForceUnit.Millinewton)); + unitConverter.SetConversionFunction>(ForceUnit.Millinewton, Force.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Force.BaseUnit, Force.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Force.BaseUnit, ForceUnit.OunceForce, q => q.ToUnit(ForceUnit.OunceForce)); + unitConverter.SetConversionFunction>(ForceUnit.OunceForce, Force.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Force.BaseUnit, ForceUnit.Poundal, q => q.ToUnit(ForceUnit.Poundal)); + unitConverter.SetConversionFunction>(ForceUnit.Poundal, Force.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Force.BaseUnit, ForceUnit.PoundForce, q => q.ToUnit(ForceUnit.PoundForce)); + unitConverter.SetConversionFunction>(ForceUnit.PoundForce, Force.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Force.BaseUnit, ForceUnit.TonneForce, q => q.ToUnit(ForceUnit.TonneForce)); + unitConverter.SetConversionFunction>(ForceUnit.TonneForce, Force.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForceChangeRate.BaseUnit, ForceChangeRateUnit.CentinewtonPerSecond, q => q.ToUnit(ForceChangeRateUnit.CentinewtonPerSecond)); + unitConverter.SetConversionFunction>(ForceChangeRateUnit.CentinewtonPerSecond, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForceChangeRate.BaseUnit, ForceChangeRateUnit.DecanewtonPerMinute, q => q.ToUnit(ForceChangeRateUnit.DecanewtonPerMinute)); + unitConverter.SetConversionFunction>(ForceChangeRateUnit.DecanewtonPerMinute, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForceChangeRate.BaseUnit, ForceChangeRateUnit.DecanewtonPerSecond, q => q.ToUnit(ForceChangeRateUnit.DecanewtonPerSecond)); + unitConverter.SetConversionFunction>(ForceChangeRateUnit.DecanewtonPerSecond, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForceChangeRate.BaseUnit, ForceChangeRateUnit.DecinewtonPerSecond, q => q.ToUnit(ForceChangeRateUnit.DecinewtonPerSecond)); + unitConverter.SetConversionFunction>(ForceChangeRateUnit.DecinewtonPerSecond, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForceChangeRate.BaseUnit, ForceChangeRateUnit.KilonewtonPerMinute, q => q.ToUnit(ForceChangeRateUnit.KilonewtonPerMinute)); + unitConverter.SetConversionFunction>(ForceChangeRateUnit.KilonewtonPerMinute, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForceChangeRate.BaseUnit, ForceChangeRateUnit.KilonewtonPerSecond, q => q.ToUnit(ForceChangeRateUnit.KilonewtonPerSecond)); + unitConverter.SetConversionFunction>(ForceChangeRateUnit.KilonewtonPerSecond, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForceChangeRate.BaseUnit, ForceChangeRateUnit.MicronewtonPerSecond, q => q.ToUnit(ForceChangeRateUnit.MicronewtonPerSecond)); + unitConverter.SetConversionFunction>(ForceChangeRateUnit.MicronewtonPerSecond, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForceChangeRate.BaseUnit, ForceChangeRateUnit.MillinewtonPerSecond, q => q.ToUnit(ForceChangeRateUnit.MillinewtonPerSecond)); + unitConverter.SetConversionFunction>(ForceChangeRateUnit.MillinewtonPerSecond, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForceChangeRate.BaseUnit, ForceChangeRateUnit.NanonewtonPerSecond, q => q.ToUnit(ForceChangeRateUnit.NanonewtonPerSecond)); + unitConverter.SetConversionFunction>(ForceChangeRateUnit.NanonewtonPerSecond, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForceChangeRate.BaseUnit, ForceChangeRateUnit.NewtonPerMinute, q => q.ToUnit(ForceChangeRateUnit.NewtonPerMinute)); + unitConverter.SetConversionFunction>(ForceChangeRateUnit.NewtonPerMinute, ForceChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForceChangeRate.BaseUnit, ForceChangeRate.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ForcePerLength.BaseUnit, ForcePerLengthUnit.CentinewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.CentinewtonPerMeter)); + unitConverter.SetConversionFunction>(ForcePerLengthUnit.CentinewtonPerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForcePerLength.BaseUnit, ForcePerLengthUnit.DecinewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.DecinewtonPerMeter)); + unitConverter.SetConversionFunction>(ForcePerLengthUnit.DecinewtonPerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForcePerLength.BaseUnit, ForcePerLengthUnit.KilogramForcePerMeter, q => q.ToUnit(ForcePerLengthUnit.KilogramForcePerMeter)); + unitConverter.SetConversionFunction>(ForcePerLengthUnit.KilogramForcePerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForcePerLength.BaseUnit, ForcePerLengthUnit.KilonewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.KilonewtonPerMeter)); + unitConverter.SetConversionFunction>(ForcePerLengthUnit.KilonewtonPerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForcePerLength.BaseUnit, ForcePerLengthUnit.MeganewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.MeganewtonPerMeter)); + unitConverter.SetConversionFunction>(ForcePerLengthUnit.MeganewtonPerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForcePerLength.BaseUnit, ForcePerLengthUnit.MicronewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.MicronewtonPerMeter)); + unitConverter.SetConversionFunction>(ForcePerLengthUnit.MicronewtonPerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForcePerLength.BaseUnit, ForcePerLengthUnit.MillinewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.MillinewtonPerMeter)); + unitConverter.SetConversionFunction>(ForcePerLengthUnit.MillinewtonPerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForcePerLength.BaseUnit, ForcePerLengthUnit.NanonewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.NanonewtonPerMeter)); + unitConverter.SetConversionFunction>(ForcePerLengthUnit.NanonewtonPerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForcePerLength.BaseUnit, ForcePerLength.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ForcePerLength.BaseUnit, ForcePerLengthUnit.PoundForcePerFoot, q => q.ToUnit(ForcePerLengthUnit.PoundForcePerFoot)); + unitConverter.SetConversionFunction>(ForcePerLengthUnit.PoundForcePerFoot, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForcePerLength.BaseUnit, ForcePerLengthUnit.PoundForcePerInch, q => q.ToUnit(ForcePerLengthUnit.PoundForcePerInch)); + unitConverter.SetConversionFunction>(ForcePerLengthUnit.PoundForcePerInch, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ForcePerLength.BaseUnit, ForcePerLengthUnit.PoundForcePerYard, q => q.ToUnit(ForcePerLengthUnit.PoundForcePerYard)); + unitConverter.SetConversionFunction>(ForcePerLengthUnit.PoundForcePerYard, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Frequency.BaseUnit, FrequencyUnit.BeatPerMinute, q => q.ToUnit(FrequencyUnit.BeatPerMinute)); + unitConverter.SetConversionFunction>(FrequencyUnit.BeatPerMinute, Frequency.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Frequency.BaseUnit, FrequencyUnit.CyclePerHour, q => q.ToUnit(FrequencyUnit.CyclePerHour)); + unitConverter.SetConversionFunction>(FrequencyUnit.CyclePerHour, Frequency.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Frequency.BaseUnit, FrequencyUnit.CyclePerMinute, q => q.ToUnit(FrequencyUnit.CyclePerMinute)); + unitConverter.SetConversionFunction>(FrequencyUnit.CyclePerMinute, Frequency.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Frequency.BaseUnit, FrequencyUnit.Gigahertz, q => q.ToUnit(FrequencyUnit.Gigahertz)); + unitConverter.SetConversionFunction>(FrequencyUnit.Gigahertz, Frequency.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Frequency.BaseUnit, Frequency.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Frequency.BaseUnit, FrequencyUnit.Kilohertz, q => q.ToUnit(FrequencyUnit.Kilohertz)); + unitConverter.SetConversionFunction>(FrequencyUnit.Kilohertz, Frequency.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Frequency.BaseUnit, FrequencyUnit.Megahertz, q => q.ToUnit(FrequencyUnit.Megahertz)); + unitConverter.SetConversionFunction>(FrequencyUnit.Megahertz, Frequency.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Frequency.BaseUnit, FrequencyUnit.RadianPerSecond, q => q.ToUnit(FrequencyUnit.RadianPerSecond)); + unitConverter.SetConversionFunction>(FrequencyUnit.RadianPerSecond, Frequency.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Frequency.BaseUnit, FrequencyUnit.Terahertz, q => q.ToUnit(FrequencyUnit.Terahertz)); + unitConverter.SetConversionFunction>(FrequencyUnit.Terahertz, Frequency.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(FuelEfficiency.BaseUnit, FuelEfficiencyUnit.KilometerPerLiter, q => q.ToUnit(FuelEfficiencyUnit.KilometerPerLiter)); + unitConverter.SetConversionFunction>(FuelEfficiencyUnit.KilometerPerLiter, FuelEfficiency.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(FuelEfficiency.BaseUnit, FuelEfficiency.BaseUnit, q => q); + unitConverter.SetConversionFunction>(FuelEfficiency.BaseUnit, FuelEfficiencyUnit.MilePerUkGallon, q => q.ToUnit(FuelEfficiencyUnit.MilePerUkGallon)); + unitConverter.SetConversionFunction>(FuelEfficiencyUnit.MilePerUkGallon, FuelEfficiency.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(FuelEfficiency.BaseUnit, FuelEfficiencyUnit.MilePerUsGallon, q => q.ToUnit(FuelEfficiencyUnit.MilePerUsGallon)); + unitConverter.SetConversionFunction>(FuelEfficiencyUnit.MilePerUsGallon, FuelEfficiency.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.BtuPerHourSquareFoot, q => q.ToUnit(HeatFluxUnit.BtuPerHourSquareFoot)); + unitConverter.SetConversionFunction>(HeatFluxUnit.BtuPerHourSquareFoot, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.BtuPerMinuteSquareFoot, q => q.ToUnit(HeatFluxUnit.BtuPerMinuteSquareFoot)); + unitConverter.SetConversionFunction>(HeatFluxUnit.BtuPerMinuteSquareFoot, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.BtuPerSecondSquareFoot, q => q.ToUnit(HeatFluxUnit.BtuPerSecondSquareFoot)); + unitConverter.SetConversionFunction>(HeatFluxUnit.BtuPerSecondSquareFoot, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.BtuPerSecondSquareInch, q => q.ToUnit(HeatFluxUnit.BtuPerSecondSquareInch)); + unitConverter.SetConversionFunction>(HeatFluxUnit.BtuPerSecondSquareInch, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.CaloriePerSecondSquareCentimeter, q => q.ToUnit(HeatFluxUnit.CaloriePerSecondSquareCentimeter)); + unitConverter.SetConversionFunction>(HeatFluxUnit.CaloriePerSecondSquareCentimeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.CentiwattPerSquareMeter, q => q.ToUnit(HeatFluxUnit.CentiwattPerSquareMeter)); + unitConverter.SetConversionFunction>(HeatFluxUnit.CentiwattPerSquareMeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.DeciwattPerSquareMeter, q => q.ToUnit(HeatFluxUnit.DeciwattPerSquareMeter)); + unitConverter.SetConversionFunction>(HeatFluxUnit.DeciwattPerSquareMeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.KilocaloriePerHourSquareMeter, q => q.ToUnit(HeatFluxUnit.KilocaloriePerHourSquareMeter)); + unitConverter.SetConversionFunction>(HeatFluxUnit.KilocaloriePerHourSquareMeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.KilocaloriePerSecondSquareCentimeter, q => q.ToUnit(HeatFluxUnit.KilocaloriePerSecondSquareCentimeter)); + unitConverter.SetConversionFunction>(HeatFluxUnit.KilocaloriePerSecondSquareCentimeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.KilowattPerSquareMeter, q => q.ToUnit(HeatFluxUnit.KilowattPerSquareMeter)); + unitConverter.SetConversionFunction>(HeatFluxUnit.KilowattPerSquareMeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.MicrowattPerSquareMeter, q => q.ToUnit(HeatFluxUnit.MicrowattPerSquareMeter)); + unitConverter.SetConversionFunction>(HeatFluxUnit.MicrowattPerSquareMeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.MilliwattPerSquareMeter, q => q.ToUnit(HeatFluxUnit.MilliwattPerSquareMeter)); + unitConverter.SetConversionFunction>(HeatFluxUnit.MilliwattPerSquareMeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.NanowattPerSquareMeter, q => q.ToUnit(HeatFluxUnit.NanowattPerSquareMeter)); + unitConverter.SetConversionFunction>(HeatFluxUnit.NanowattPerSquareMeter, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.PoundForcePerFootSecond, q => q.ToUnit(HeatFluxUnit.PoundForcePerFootSecond)); + unitConverter.SetConversionFunction>(HeatFluxUnit.PoundForcePerFootSecond, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.PoundPerSecondCubed, q => q.ToUnit(HeatFluxUnit.PoundPerSecondCubed)); + unitConverter.SetConversionFunction>(HeatFluxUnit.PoundPerSecondCubed, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.WattPerSquareFoot, q => q.ToUnit(HeatFluxUnit.WattPerSquareFoot)); + unitConverter.SetConversionFunction>(HeatFluxUnit.WattPerSquareFoot, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFluxUnit.WattPerSquareInch, q => q.ToUnit(HeatFluxUnit.WattPerSquareInch)); + unitConverter.SetConversionFunction>(HeatFluxUnit.WattPerSquareInch, HeatFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatFlux.BaseUnit, HeatFlux.BaseUnit, q => q); + unitConverter.SetConversionFunction>(HeatTransferCoefficient.BaseUnit, HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit, q => q.ToUnit(HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit)); + unitConverter.SetConversionFunction>(HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit, HeatTransferCoefficient.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatTransferCoefficient.BaseUnit, HeatTransferCoefficientUnit.WattPerSquareMeterCelsius, q => q.ToUnit(HeatTransferCoefficientUnit.WattPerSquareMeterCelsius)); + unitConverter.SetConversionFunction>(HeatTransferCoefficientUnit.WattPerSquareMeterCelsius, HeatTransferCoefficient.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(HeatTransferCoefficient.BaseUnit, HeatTransferCoefficient.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Illuminance.BaseUnit, IlluminanceUnit.Kilolux, q => q.ToUnit(IlluminanceUnit.Kilolux)); + unitConverter.SetConversionFunction>(IlluminanceUnit.Kilolux, Illuminance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Illuminance.BaseUnit, Illuminance.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Illuminance.BaseUnit, IlluminanceUnit.Megalux, q => q.ToUnit(IlluminanceUnit.Megalux)); + unitConverter.SetConversionFunction>(IlluminanceUnit.Megalux, Illuminance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Illuminance.BaseUnit, IlluminanceUnit.Millilux, q => q.ToUnit(IlluminanceUnit.Millilux)); + unitConverter.SetConversionFunction>(IlluminanceUnit.Millilux, Illuminance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, Information.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Byte, q => q.ToUnit(InformationUnit.Byte)); + unitConverter.SetConversionFunction>(InformationUnit.Byte, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Exabit, q => q.ToUnit(InformationUnit.Exabit)); + unitConverter.SetConversionFunction>(InformationUnit.Exabit, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Exabyte, q => q.ToUnit(InformationUnit.Exabyte)); + unitConverter.SetConversionFunction>(InformationUnit.Exabyte, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Exbibit, q => q.ToUnit(InformationUnit.Exbibit)); + unitConverter.SetConversionFunction>(InformationUnit.Exbibit, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Exbibyte, q => q.ToUnit(InformationUnit.Exbibyte)); + unitConverter.SetConversionFunction>(InformationUnit.Exbibyte, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Gibibit, q => q.ToUnit(InformationUnit.Gibibit)); + unitConverter.SetConversionFunction>(InformationUnit.Gibibit, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Gibibyte, q => q.ToUnit(InformationUnit.Gibibyte)); + unitConverter.SetConversionFunction>(InformationUnit.Gibibyte, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Gigabit, q => q.ToUnit(InformationUnit.Gigabit)); + unitConverter.SetConversionFunction>(InformationUnit.Gigabit, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Gigabyte, q => q.ToUnit(InformationUnit.Gigabyte)); + unitConverter.SetConversionFunction>(InformationUnit.Gigabyte, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Kibibit, q => q.ToUnit(InformationUnit.Kibibit)); + unitConverter.SetConversionFunction>(InformationUnit.Kibibit, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Kibibyte, q => q.ToUnit(InformationUnit.Kibibyte)); + unitConverter.SetConversionFunction>(InformationUnit.Kibibyte, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Kilobit, q => q.ToUnit(InformationUnit.Kilobit)); + unitConverter.SetConversionFunction>(InformationUnit.Kilobit, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Kilobyte, q => q.ToUnit(InformationUnit.Kilobyte)); + unitConverter.SetConversionFunction>(InformationUnit.Kilobyte, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Mebibit, q => q.ToUnit(InformationUnit.Mebibit)); + unitConverter.SetConversionFunction>(InformationUnit.Mebibit, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Mebibyte, q => q.ToUnit(InformationUnit.Mebibyte)); + unitConverter.SetConversionFunction>(InformationUnit.Mebibyte, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Megabit, q => q.ToUnit(InformationUnit.Megabit)); + unitConverter.SetConversionFunction>(InformationUnit.Megabit, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Megabyte, q => q.ToUnit(InformationUnit.Megabyte)); + unitConverter.SetConversionFunction>(InformationUnit.Megabyte, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Pebibit, q => q.ToUnit(InformationUnit.Pebibit)); + unitConverter.SetConversionFunction>(InformationUnit.Pebibit, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Pebibyte, q => q.ToUnit(InformationUnit.Pebibyte)); + unitConverter.SetConversionFunction>(InformationUnit.Pebibyte, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Petabit, q => q.ToUnit(InformationUnit.Petabit)); + unitConverter.SetConversionFunction>(InformationUnit.Petabit, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Petabyte, q => q.ToUnit(InformationUnit.Petabyte)); + unitConverter.SetConversionFunction>(InformationUnit.Petabyte, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Tebibit, q => q.ToUnit(InformationUnit.Tebibit)); + unitConverter.SetConversionFunction>(InformationUnit.Tebibit, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Tebibyte, q => q.ToUnit(InformationUnit.Tebibyte)); + unitConverter.SetConversionFunction>(InformationUnit.Tebibyte, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Terabit, q => q.ToUnit(InformationUnit.Terabit)); + unitConverter.SetConversionFunction>(InformationUnit.Terabit, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Information.BaseUnit, InformationUnit.Terabyte, q => q.ToUnit(InformationUnit.Terabyte)); + unitConverter.SetConversionFunction>(InformationUnit.Terabyte, Information.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiance.BaseUnit, IrradianceUnit.KilowattPerSquareCentimeter, q => q.ToUnit(IrradianceUnit.KilowattPerSquareCentimeter)); + unitConverter.SetConversionFunction>(IrradianceUnit.KilowattPerSquareCentimeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiance.BaseUnit, IrradianceUnit.KilowattPerSquareMeter, q => q.ToUnit(IrradianceUnit.KilowattPerSquareMeter)); + unitConverter.SetConversionFunction>(IrradianceUnit.KilowattPerSquareMeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiance.BaseUnit, IrradianceUnit.MegawattPerSquareCentimeter, q => q.ToUnit(IrradianceUnit.MegawattPerSquareCentimeter)); + unitConverter.SetConversionFunction>(IrradianceUnit.MegawattPerSquareCentimeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiance.BaseUnit, IrradianceUnit.MegawattPerSquareMeter, q => q.ToUnit(IrradianceUnit.MegawattPerSquareMeter)); + unitConverter.SetConversionFunction>(IrradianceUnit.MegawattPerSquareMeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiance.BaseUnit, IrradianceUnit.MicrowattPerSquareCentimeter, q => q.ToUnit(IrradianceUnit.MicrowattPerSquareCentimeter)); + unitConverter.SetConversionFunction>(IrradianceUnit.MicrowattPerSquareCentimeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiance.BaseUnit, IrradianceUnit.MicrowattPerSquareMeter, q => q.ToUnit(IrradianceUnit.MicrowattPerSquareMeter)); + unitConverter.SetConversionFunction>(IrradianceUnit.MicrowattPerSquareMeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiance.BaseUnit, IrradianceUnit.MilliwattPerSquareCentimeter, q => q.ToUnit(IrradianceUnit.MilliwattPerSquareCentimeter)); + unitConverter.SetConversionFunction>(IrradianceUnit.MilliwattPerSquareCentimeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiance.BaseUnit, IrradianceUnit.MilliwattPerSquareMeter, q => q.ToUnit(IrradianceUnit.MilliwattPerSquareMeter)); + unitConverter.SetConversionFunction>(IrradianceUnit.MilliwattPerSquareMeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiance.BaseUnit, IrradianceUnit.NanowattPerSquareCentimeter, q => q.ToUnit(IrradianceUnit.NanowattPerSquareCentimeter)); + unitConverter.SetConversionFunction>(IrradianceUnit.NanowattPerSquareCentimeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiance.BaseUnit, IrradianceUnit.NanowattPerSquareMeter, q => q.ToUnit(IrradianceUnit.NanowattPerSquareMeter)); + unitConverter.SetConversionFunction>(IrradianceUnit.NanowattPerSquareMeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiance.BaseUnit, IrradianceUnit.PicowattPerSquareCentimeter, q => q.ToUnit(IrradianceUnit.PicowattPerSquareCentimeter)); + unitConverter.SetConversionFunction>(IrradianceUnit.PicowattPerSquareCentimeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiance.BaseUnit, IrradianceUnit.PicowattPerSquareMeter, q => q.ToUnit(IrradianceUnit.PicowattPerSquareMeter)); + unitConverter.SetConversionFunction>(IrradianceUnit.PicowattPerSquareMeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiance.BaseUnit, IrradianceUnit.WattPerSquareCentimeter, q => q.ToUnit(IrradianceUnit.WattPerSquareCentimeter)); + unitConverter.SetConversionFunction>(IrradianceUnit.WattPerSquareCentimeter, Irradiance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiance.BaseUnit, Irradiance.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Irradiation.BaseUnit, IrradiationUnit.JoulePerSquareCentimeter, q => q.ToUnit(IrradiationUnit.JoulePerSquareCentimeter)); + unitConverter.SetConversionFunction>(IrradiationUnit.JoulePerSquareCentimeter, Irradiation.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiation.BaseUnit, Irradiation.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Irradiation.BaseUnit, IrradiationUnit.JoulePerSquareMillimeter, q => q.ToUnit(IrradiationUnit.JoulePerSquareMillimeter)); + unitConverter.SetConversionFunction>(IrradiationUnit.JoulePerSquareMillimeter, Irradiation.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiation.BaseUnit, IrradiationUnit.KilojoulePerSquareMeter, q => q.ToUnit(IrradiationUnit.KilojoulePerSquareMeter)); + unitConverter.SetConversionFunction>(IrradiationUnit.KilojoulePerSquareMeter, Irradiation.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiation.BaseUnit, IrradiationUnit.KilowattHourPerSquareMeter, q => q.ToUnit(IrradiationUnit.KilowattHourPerSquareMeter)); + unitConverter.SetConversionFunction>(IrradiationUnit.KilowattHourPerSquareMeter, Irradiation.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiation.BaseUnit, IrradiationUnit.MillijoulePerSquareCentimeter, q => q.ToUnit(IrradiationUnit.MillijoulePerSquareCentimeter)); + unitConverter.SetConversionFunction>(IrradiationUnit.MillijoulePerSquareCentimeter, Irradiation.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Irradiation.BaseUnit, IrradiationUnit.WattHourPerSquareMeter, q => q.ToUnit(IrradiationUnit.WattHourPerSquareMeter)); + unitConverter.SetConversionFunction>(IrradiationUnit.WattHourPerSquareMeter, Irradiation.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(KinematicViscosity.BaseUnit, KinematicViscosityUnit.Centistokes, q => q.ToUnit(KinematicViscosityUnit.Centistokes)); + unitConverter.SetConversionFunction>(KinematicViscosityUnit.Centistokes, KinematicViscosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(KinematicViscosity.BaseUnit, KinematicViscosityUnit.Decistokes, q => q.ToUnit(KinematicViscosityUnit.Decistokes)); + unitConverter.SetConversionFunction>(KinematicViscosityUnit.Decistokes, KinematicViscosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(KinematicViscosity.BaseUnit, KinematicViscosityUnit.Kilostokes, q => q.ToUnit(KinematicViscosityUnit.Kilostokes)); + unitConverter.SetConversionFunction>(KinematicViscosityUnit.Kilostokes, KinematicViscosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(KinematicViscosity.BaseUnit, KinematicViscosityUnit.Microstokes, q => q.ToUnit(KinematicViscosityUnit.Microstokes)); + unitConverter.SetConversionFunction>(KinematicViscosityUnit.Microstokes, KinematicViscosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(KinematicViscosity.BaseUnit, KinematicViscosityUnit.Millistokes, q => q.ToUnit(KinematicViscosityUnit.Millistokes)); + unitConverter.SetConversionFunction>(KinematicViscosityUnit.Millistokes, KinematicViscosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(KinematicViscosity.BaseUnit, KinematicViscosityUnit.Nanostokes, q => q.ToUnit(KinematicViscosityUnit.Nanostokes)); + unitConverter.SetConversionFunction>(KinematicViscosityUnit.Nanostokes, KinematicViscosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(KinematicViscosity.BaseUnit, KinematicViscosity.BaseUnit, q => q); + unitConverter.SetConversionFunction>(KinematicViscosity.BaseUnit, KinematicViscosityUnit.Stokes, q => q.ToUnit(KinematicViscosityUnit.Stokes)); + unitConverter.SetConversionFunction>(KinematicViscosityUnit.Stokes, KinematicViscosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(LapseRate.BaseUnit, LapseRate.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.AstronomicalUnit, q => q.ToUnit(LengthUnit.AstronomicalUnit)); + unitConverter.SetConversionFunction>(LengthUnit.AstronomicalUnit, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Centimeter, q => q.ToUnit(LengthUnit.Centimeter)); + unitConverter.SetConversionFunction>(LengthUnit.Centimeter, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Decimeter, q => q.ToUnit(LengthUnit.Decimeter)); + unitConverter.SetConversionFunction>(LengthUnit.Decimeter, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.DtpPica, q => q.ToUnit(LengthUnit.DtpPica)); + unitConverter.SetConversionFunction>(LengthUnit.DtpPica, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.DtpPoint, q => q.ToUnit(LengthUnit.DtpPoint)); + unitConverter.SetConversionFunction>(LengthUnit.DtpPoint, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Fathom, q => q.ToUnit(LengthUnit.Fathom)); + unitConverter.SetConversionFunction>(LengthUnit.Fathom, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Foot, q => q.ToUnit(LengthUnit.Foot)); + unitConverter.SetConversionFunction>(LengthUnit.Foot, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Hand, q => q.ToUnit(LengthUnit.Hand)); + unitConverter.SetConversionFunction>(LengthUnit.Hand, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Hectometer, q => q.ToUnit(LengthUnit.Hectometer)); + unitConverter.SetConversionFunction>(LengthUnit.Hectometer, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Inch, q => q.ToUnit(LengthUnit.Inch)); + unitConverter.SetConversionFunction>(LengthUnit.Inch, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.KilolightYear, q => q.ToUnit(LengthUnit.KilolightYear)); + unitConverter.SetConversionFunction>(LengthUnit.KilolightYear, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Kilometer, q => q.ToUnit(LengthUnit.Kilometer)); + unitConverter.SetConversionFunction>(LengthUnit.Kilometer, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Kiloparsec, q => q.ToUnit(LengthUnit.Kiloparsec)); + unitConverter.SetConversionFunction>(LengthUnit.Kiloparsec, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.LightYear, q => q.ToUnit(LengthUnit.LightYear)); + unitConverter.SetConversionFunction>(LengthUnit.LightYear, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.MegalightYear, q => q.ToUnit(LengthUnit.MegalightYear)); + unitConverter.SetConversionFunction>(LengthUnit.MegalightYear, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Megaparsec, q => q.ToUnit(LengthUnit.Megaparsec)); + unitConverter.SetConversionFunction>(LengthUnit.Megaparsec, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, Length.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Microinch, q => q.ToUnit(LengthUnit.Microinch)); + unitConverter.SetConversionFunction>(LengthUnit.Microinch, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Micrometer, q => q.ToUnit(LengthUnit.Micrometer)); + unitConverter.SetConversionFunction>(LengthUnit.Micrometer, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Mil, q => q.ToUnit(LengthUnit.Mil)); + unitConverter.SetConversionFunction>(LengthUnit.Mil, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Mile, q => q.ToUnit(LengthUnit.Mile)); + unitConverter.SetConversionFunction>(LengthUnit.Mile, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Millimeter, q => q.ToUnit(LengthUnit.Millimeter)); + unitConverter.SetConversionFunction>(LengthUnit.Millimeter, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Nanometer, q => q.ToUnit(LengthUnit.Nanometer)); + unitConverter.SetConversionFunction>(LengthUnit.Nanometer, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.NauticalMile, q => q.ToUnit(LengthUnit.NauticalMile)); + unitConverter.SetConversionFunction>(LengthUnit.NauticalMile, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Parsec, q => q.ToUnit(LengthUnit.Parsec)); + unitConverter.SetConversionFunction>(LengthUnit.Parsec, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.PrinterPica, q => q.ToUnit(LengthUnit.PrinterPica)); + unitConverter.SetConversionFunction>(LengthUnit.PrinterPica, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.PrinterPoint, q => q.ToUnit(LengthUnit.PrinterPoint)); + unitConverter.SetConversionFunction>(LengthUnit.PrinterPoint, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Shackle, q => q.ToUnit(LengthUnit.Shackle)); + unitConverter.SetConversionFunction>(LengthUnit.Shackle, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.SolarRadius, q => q.ToUnit(LengthUnit.SolarRadius)); + unitConverter.SetConversionFunction>(LengthUnit.SolarRadius, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Twip, q => q.ToUnit(LengthUnit.Twip)); + unitConverter.SetConversionFunction>(LengthUnit.Twip, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.UsSurveyFoot, q => q.ToUnit(LengthUnit.UsSurveyFoot)); + unitConverter.SetConversionFunction>(LengthUnit.UsSurveyFoot, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Length.BaseUnit, LengthUnit.Yard, q => q.ToUnit(LengthUnit.Yard)); + unitConverter.SetConversionFunction>(LengthUnit.Yard, Length.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Level.BaseUnit, Level.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Level.BaseUnit, LevelUnit.Neper, q => q.ToUnit(LevelUnit.Neper)); + unitConverter.SetConversionFunction>(LevelUnit.Neper, Level.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(LinearDensity.BaseUnit, LinearDensityUnit.GramPerMeter, q => q.ToUnit(LinearDensityUnit.GramPerMeter)); + unitConverter.SetConversionFunction>(LinearDensityUnit.GramPerMeter, LinearDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(LinearDensity.BaseUnit, LinearDensity.BaseUnit, q => q); + unitConverter.SetConversionFunction>(LinearDensity.BaseUnit, LinearDensityUnit.PoundPerFoot, q => q.ToUnit(LinearDensityUnit.PoundPerFoot)); + unitConverter.SetConversionFunction>(LinearDensityUnit.PoundPerFoot, LinearDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Luminosity.BaseUnit, LuminosityUnit.Decawatt, q => q.ToUnit(LuminosityUnit.Decawatt)); + unitConverter.SetConversionFunction>(LuminosityUnit.Decawatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Luminosity.BaseUnit, LuminosityUnit.Deciwatt, q => q.ToUnit(LuminosityUnit.Deciwatt)); + unitConverter.SetConversionFunction>(LuminosityUnit.Deciwatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Luminosity.BaseUnit, LuminosityUnit.Femtowatt, q => q.ToUnit(LuminosityUnit.Femtowatt)); + unitConverter.SetConversionFunction>(LuminosityUnit.Femtowatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Luminosity.BaseUnit, LuminosityUnit.Gigawatt, q => q.ToUnit(LuminosityUnit.Gigawatt)); + unitConverter.SetConversionFunction>(LuminosityUnit.Gigawatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Luminosity.BaseUnit, LuminosityUnit.Kilowatt, q => q.ToUnit(LuminosityUnit.Kilowatt)); + unitConverter.SetConversionFunction>(LuminosityUnit.Kilowatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Luminosity.BaseUnit, LuminosityUnit.Megawatt, q => q.ToUnit(LuminosityUnit.Megawatt)); + unitConverter.SetConversionFunction>(LuminosityUnit.Megawatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Luminosity.BaseUnit, LuminosityUnit.Microwatt, q => q.ToUnit(LuminosityUnit.Microwatt)); + unitConverter.SetConversionFunction>(LuminosityUnit.Microwatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Luminosity.BaseUnit, LuminosityUnit.Milliwatt, q => q.ToUnit(LuminosityUnit.Milliwatt)); + unitConverter.SetConversionFunction>(LuminosityUnit.Milliwatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Luminosity.BaseUnit, LuminosityUnit.Nanowatt, q => q.ToUnit(LuminosityUnit.Nanowatt)); + unitConverter.SetConversionFunction>(LuminosityUnit.Nanowatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Luminosity.BaseUnit, LuminosityUnit.Petawatt, q => q.ToUnit(LuminosityUnit.Petawatt)); + unitConverter.SetConversionFunction>(LuminosityUnit.Petawatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Luminosity.BaseUnit, LuminosityUnit.Picowatt, q => q.ToUnit(LuminosityUnit.Picowatt)); + unitConverter.SetConversionFunction>(LuminosityUnit.Picowatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Luminosity.BaseUnit, LuminosityUnit.SolarLuminosity, q => q.ToUnit(LuminosityUnit.SolarLuminosity)); + unitConverter.SetConversionFunction>(LuminosityUnit.SolarLuminosity, Luminosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Luminosity.BaseUnit, LuminosityUnit.Terawatt, q => q.ToUnit(LuminosityUnit.Terawatt)); + unitConverter.SetConversionFunction>(LuminosityUnit.Terawatt, Luminosity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Luminosity.BaseUnit, Luminosity.BaseUnit, q => q); + unitConverter.SetConversionFunction>(LuminousFlux.BaseUnit, LuminousFlux.BaseUnit, q => q); + unitConverter.SetConversionFunction>(LuminousIntensity.BaseUnit, LuminousIntensity.BaseUnit, q => q); + unitConverter.SetConversionFunction>(MagneticField.BaseUnit, MagneticFieldUnit.Microtesla, q => q.ToUnit(MagneticFieldUnit.Microtesla)); + unitConverter.SetConversionFunction>(MagneticFieldUnit.Microtesla, MagneticField.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MagneticField.BaseUnit, MagneticFieldUnit.Millitesla, q => q.ToUnit(MagneticFieldUnit.Millitesla)); + unitConverter.SetConversionFunction>(MagneticFieldUnit.Millitesla, MagneticField.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MagneticField.BaseUnit, MagneticFieldUnit.Nanotesla, q => q.ToUnit(MagneticFieldUnit.Nanotesla)); + unitConverter.SetConversionFunction>(MagneticFieldUnit.Nanotesla, MagneticField.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MagneticField.BaseUnit, MagneticField.BaseUnit, q => q); + unitConverter.SetConversionFunction>(MagneticFlux.BaseUnit, MagneticFlux.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Magnetization.BaseUnit, Magnetization.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Centigram, q => q.ToUnit(MassUnit.Centigram)); + unitConverter.SetConversionFunction>(MassUnit.Centigram, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Decagram, q => q.ToUnit(MassUnit.Decagram)); + unitConverter.SetConversionFunction>(MassUnit.Decagram, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Decigram, q => q.ToUnit(MassUnit.Decigram)); + unitConverter.SetConversionFunction>(MassUnit.Decigram, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.EarthMass, q => q.ToUnit(MassUnit.EarthMass)); + unitConverter.SetConversionFunction>(MassUnit.EarthMass, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Grain, q => q.ToUnit(MassUnit.Grain)); + unitConverter.SetConversionFunction>(MassUnit.Grain, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Gram, q => q.ToUnit(MassUnit.Gram)); + unitConverter.SetConversionFunction>(MassUnit.Gram, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Hectogram, q => q.ToUnit(MassUnit.Hectogram)); + unitConverter.SetConversionFunction>(MassUnit.Hectogram, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, Mass.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Kilopound, q => q.ToUnit(MassUnit.Kilopound)); + unitConverter.SetConversionFunction>(MassUnit.Kilopound, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Kilotonne, q => q.ToUnit(MassUnit.Kilotonne)); + unitConverter.SetConversionFunction>(MassUnit.Kilotonne, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.LongHundredweight, q => q.ToUnit(MassUnit.LongHundredweight)); + unitConverter.SetConversionFunction>(MassUnit.LongHundredweight, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.LongTon, q => q.ToUnit(MassUnit.LongTon)); + unitConverter.SetConversionFunction>(MassUnit.LongTon, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Megapound, q => q.ToUnit(MassUnit.Megapound)); + unitConverter.SetConversionFunction>(MassUnit.Megapound, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Megatonne, q => q.ToUnit(MassUnit.Megatonne)); + unitConverter.SetConversionFunction>(MassUnit.Megatonne, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Microgram, q => q.ToUnit(MassUnit.Microgram)); + unitConverter.SetConversionFunction>(MassUnit.Microgram, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Milligram, q => q.ToUnit(MassUnit.Milligram)); + unitConverter.SetConversionFunction>(MassUnit.Milligram, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Nanogram, q => q.ToUnit(MassUnit.Nanogram)); + unitConverter.SetConversionFunction>(MassUnit.Nanogram, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Ounce, q => q.ToUnit(MassUnit.Ounce)); + unitConverter.SetConversionFunction>(MassUnit.Ounce, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Pound, q => q.ToUnit(MassUnit.Pound)); + unitConverter.SetConversionFunction>(MassUnit.Pound, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.ShortHundredweight, q => q.ToUnit(MassUnit.ShortHundredweight)); + unitConverter.SetConversionFunction>(MassUnit.ShortHundredweight, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.ShortTon, q => q.ToUnit(MassUnit.ShortTon)); + unitConverter.SetConversionFunction>(MassUnit.ShortTon, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Slug, q => q.ToUnit(MassUnit.Slug)); + unitConverter.SetConversionFunction>(MassUnit.Slug, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.SolarMass, q => q.ToUnit(MassUnit.SolarMass)); + unitConverter.SetConversionFunction>(MassUnit.SolarMass, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Stone, q => q.ToUnit(MassUnit.Stone)); + unitConverter.SetConversionFunction>(MassUnit.Stone, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Mass.BaseUnit, MassUnit.Tonne, q => q.ToUnit(MassUnit.Tonne)); + unitConverter.SetConversionFunction>(MassUnit.Tonne, Mass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.CentigramPerDeciliter, q => q.ToUnit(MassConcentrationUnit.CentigramPerDeciliter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.CentigramPerDeciliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.CentigramPerLiter, q => q.ToUnit(MassConcentrationUnit.CentigramPerLiter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.CentigramPerLiter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.CentigramPerMilliliter, q => q.ToUnit(MassConcentrationUnit.CentigramPerMilliliter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.CentigramPerMilliliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.DecigramPerDeciliter, q => q.ToUnit(MassConcentrationUnit.DecigramPerDeciliter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.DecigramPerDeciliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.DecigramPerLiter, q => q.ToUnit(MassConcentrationUnit.DecigramPerLiter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.DecigramPerLiter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.DecigramPerMilliliter, q => q.ToUnit(MassConcentrationUnit.DecigramPerMilliliter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.DecigramPerMilliliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.GramPerCubicCentimeter, q => q.ToUnit(MassConcentrationUnit.GramPerCubicCentimeter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.GramPerCubicCentimeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.GramPerCubicMeter, q => q.ToUnit(MassConcentrationUnit.GramPerCubicMeter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.GramPerCubicMeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.GramPerCubicMillimeter, q => q.ToUnit(MassConcentrationUnit.GramPerCubicMillimeter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.GramPerCubicMillimeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.GramPerDeciliter, q => q.ToUnit(MassConcentrationUnit.GramPerDeciliter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.GramPerDeciliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.GramPerLiter, q => q.ToUnit(MassConcentrationUnit.GramPerLiter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.GramPerLiter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.GramPerMilliliter, q => q.ToUnit(MassConcentrationUnit.GramPerMilliliter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.GramPerMilliliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.KilogramPerCubicCentimeter, q => q.ToUnit(MassConcentrationUnit.KilogramPerCubicCentimeter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.KilogramPerCubicCentimeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentration.BaseUnit, q => q); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.KilogramPerCubicMillimeter, q => q.ToUnit(MassConcentrationUnit.KilogramPerCubicMillimeter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.KilogramPerCubicMillimeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.KilogramPerLiter, q => q.ToUnit(MassConcentrationUnit.KilogramPerLiter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.KilogramPerLiter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.KilopoundPerCubicFoot, q => q.ToUnit(MassConcentrationUnit.KilopoundPerCubicFoot)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.KilopoundPerCubicFoot, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.KilopoundPerCubicInch, q => q.ToUnit(MassConcentrationUnit.KilopoundPerCubicInch)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.KilopoundPerCubicInch, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.MicrogramPerCubicMeter, q => q.ToUnit(MassConcentrationUnit.MicrogramPerCubicMeter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.MicrogramPerCubicMeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.MicrogramPerDeciliter, q => q.ToUnit(MassConcentrationUnit.MicrogramPerDeciliter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.MicrogramPerDeciliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.MicrogramPerLiter, q => q.ToUnit(MassConcentrationUnit.MicrogramPerLiter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.MicrogramPerLiter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.MicrogramPerMilliliter, q => q.ToUnit(MassConcentrationUnit.MicrogramPerMilliliter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.MicrogramPerMilliliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.MilligramPerCubicMeter, q => q.ToUnit(MassConcentrationUnit.MilligramPerCubicMeter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.MilligramPerCubicMeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.MilligramPerDeciliter, q => q.ToUnit(MassConcentrationUnit.MilligramPerDeciliter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.MilligramPerDeciliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.MilligramPerLiter, q => q.ToUnit(MassConcentrationUnit.MilligramPerLiter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.MilligramPerLiter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.MilligramPerMilliliter, q => q.ToUnit(MassConcentrationUnit.MilligramPerMilliliter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.MilligramPerMilliliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.NanogramPerDeciliter, q => q.ToUnit(MassConcentrationUnit.NanogramPerDeciliter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.NanogramPerDeciliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.NanogramPerLiter, q => q.ToUnit(MassConcentrationUnit.NanogramPerLiter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.NanogramPerLiter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.NanogramPerMilliliter, q => q.ToUnit(MassConcentrationUnit.NanogramPerMilliliter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.NanogramPerMilliliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.PicogramPerDeciliter, q => q.ToUnit(MassConcentrationUnit.PicogramPerDeciliter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.PicogramPerDeciliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.PicogramPerLiter, q => q.ToUnit(MassConcentrationUnit.PicogramPerLiter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.PicogramPerLiter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.PicogramPerMilliliter, q => q.ToUnit(MassConcentrationUnit.PicogramPerMilliliter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.PicogramPerMilliliter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.PoundPerCubicFoot, q => q.ToUnit(MassConcentrationUnit.PoundPerCubicFoot)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.PoundPerCubicFoot, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.PoundPerCubicInch, q => q.ToUnit(MassConcentrationUnit.PoundPerCubicInch)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.PoundPerCubicInch, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.PoundPerImperialGallon, q => q.ToUnit(MassConcentrationUnit.PoundPerImperialGallon)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.PoundPerImperialGallon, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.PoundPerUSGallon, q => q.ToUnit(MassConcentrationUnit.PoundPerUSGallon)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.PoundPerUSGallon, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.SlugPerCubicFoot, q => q.ToUnit(MassConcentrationUnit.SlugPerCubicFoot)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.SlugPerCubicFoot, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.TonnePerCubicCentimeter, q => q.ToUnit(MassConcentrationUnit.TonnePerCubicCentimeter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.TonnePerCubicCentimeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.TonnePerCubicMeter, q => q.ToUnit(MassConcentrationUnit.TonnePerCubicMeter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.TonnePerCubicMeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassConcentration.BaseUnit, MassConcentrationUnit.TonnePerCubicMillimeter, q => q.ToUnit(MassConcentrationUnit.TonnePerCubicMillimeter)); + unitConverter.SetConversionFunction>(MassConcentrationUnit.TonnePerCubicMillimeter, MassConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.CentigramPerDay, q => q.ToUnit(MassFlowUnit.CentigramPerDay)); + unitConverter.SetConversionFunction>(MassFlowUnit.CentigramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.CentigramPerSecond, q => q.ToUnit(MassFlowUnit.CentigramPerSecond)); + unitConverter.SetConversionFunction>(MassFlowUnit.CentigramPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.DecagramPerDay, q => q.ToUnit(MassFlowUnit.DecagramPerDay)); + unitConverter.SetConversionFunction>(MassFlowUnit.DecagramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.DecagramPerSecond, q => q.ToUnit(MassFlowUnit.DecagramPerSecond)); + unitConverter.SetConversionFunction>(MassFlowUnit.DecagramPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.DecigramPerDay, q => q.ToUnit(MassFlowUnit.DecigramPerDay)); + unitConverter.SetConversionFunction>(MassFlowUnit.DecigramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.DecigramPerSecond, q => q.ToUnit(MassFlowUnit.DecigramPerSecond)); + unitConverter.SetConversionFunction>(MassFlowUnit.DecigramPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.GramPerDay, q => q.ToUnit(MassFlowUnit.GramPerDay)); + unitConverter.SetConversionFunction>(MassFlowUnit.GramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.GramPerHour, q => q.ToUnit(MassFlowUnit.GramPerHour)); + unitConverter.SetConversionFunction>(MassFlowUnit.GramPerHour, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlow.BaseUnit, q => q); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.HectogramPerDay, q => q.ToUnit(MassFlowUnit.HectogramPerDay)); + unitConverter.SetConversionFunction>(MassFlowUnit.HectogramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.HectogramPerSecond, q => q.ToUnit(MassFlowUnit.HectogramPerSecond)); + unitConverter.SetConversionFunction>(MassFlowUnit.HectogramPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.KilogramPerDay, q => q.ToUnit(MassFlowUnit.KilogramPerDay)); + unitConverter.SetConversionFunction>(MassFlowUnit.KilogramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.KilogramPerHour, q => q.ToUnit(MassFlowUnit.KilogramPerHour)); + unitConverter.SetConversionFunction>(MassFlowUnit.KilogramPerHour, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.KilogramPerMinute, q => q.ToUnit(MassFlowUnit.KilogramPerMinute)); + unitConverter.SetConversionFunction>(MassFlowUnit.KilogramPerMinute, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.KilogramPerSecond, q => q.ToUnit(MassFlowUnit.KilogramPerSecond)); + unitConverter.SetConversionFunction>(MassFlowUnit.KilogramPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.MegagramPerDay, q => q.ToUnit(MassFlowUnit.MegagramPerDay)); + unitConverter.SetConversionFunction>(MassFlowUnit.MegagramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.MegapoundPerDay, q => q.ToUnit(MassFlowUnit.MegapoundPerDay)); + unitConverter.SetConversionFunction>(MassFlowUnit.MegapoundPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.MegapoundPerHour, q => q.ToUnit(MassFlowUnit.MegapoundPerHour)); + unitConverter.SetConversionFunction>(MassFlowUnit.MegapoundPerHour, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.MegapoundPerMinute, q => q.ToUnit(MassFlowUnit.MegapoundPerMinute)); + unitConverter.SetConversionFunction>(MassFlowUnit.MegapoundPerMinute, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.MegapoundPerSecond, q => q.ToUnit(MassFlowUnit.MegapoundPerSecond)); + unitConverter.SetConversionFunction>(MassFlowUnit.MegapoundPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.MicrogramPerDay, q => q.ToUnit(MassFlowUnit.MicrogramPerDay)); + unitConverter.SetConversionFunction>(MassFlowUnit.MicrogramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.MicrogramPerSecond, q => q.ToUnit(MassFlowUnit.MicrogramPerSecond)); + unitConverter.SetConversionFunction>(MassFlowUnit.MicrogramPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.MilligramPerDay, q => q.ToUnit(MassFlowUnit.MilligramPerDay)); + unitConverter.SetConversionFunction>(MassFlowUnit.MilligramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.MilligramPerSecond, q => q.ToUnit(MassFlowUnit.MilligramPerSecond)); + unitConverter.SetConversionFunction>(MassFlowUnit.MilligramPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.NanogramPerDay, q => q.ToUnit(MassFlowUnit.NanogramPerDay)); + unitConverter.SetConversionFunction>(MassFlowUnit.NanogramPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.NanogramPerSecond, q => q.ToUnit(MassFlowUnit.NanogramPerSecond)); + unitConverter.SetConversionFunction>(MassFlowUnit.NanogramPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.PoundPerDay, q => q.ToUnit(MassFlowUnit.PoundPerDay)); + unitConverter.SetConversionFunction>(MassFlowUnit.PoundPerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.PoundPerHour, q => q.ToUnit(MassFlowUnit.PoundPerHour)); + unitConverter.SetConversionFunction>(MassFlowUnit.PoundPerHour, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.PoundPerMinute, q => q.ToUnit(MassFlowUnit.PoundPerMinute)); + unitConverter.SetConversionFunction>(MassFlowUnit.PoundPerMinute, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.PoundPerSecond, q => q.ToUnit(MassFlowUnit.PoundPerSecond)); + unitConverter.SetConversionFunction>(MassFlowUnit.PoundPerSecond, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.ShortTonPerHour, q => q.ToUnit(MassFlowUnit.ShortTonPerHour)); + unitConverter.SetConversionFunction>(MassFlowUnit.ShortTonPerHour, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.TonnePerDay, q => q.ToUnit(MassFlowUnit.TonnePerDay)); + unitConverter.SetConversionFunction>(MassFlowUnit.TonnePerDay, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlow.BaseUnit, MassFlowUnit.TonnePerHour, q => q.ToUnit(MassFlowUnit.TonnePerHour)); + unitConverter.SetConversionFunction>(MassFlowUnit.TonnePerHour, MassFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlux.BaseUnit, MassFluxUnit.GramPerSecondPerSquareMeter, q => q.ToUnit(MassFluxUnit.GramPerSecondPerSquareMeter)); + unitConverter.SetConversionFunction>(MassFluxUnit.GramPerSecondPerSquareMeter, MassFlux.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFlux.BaseUnit, MassFlux.BaseUnit, q => q); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.CentigramPerGram, q => q.ToUnit(MassFractionUnit.CentigramPerGram)); + unitConverter.SetConversionFunction>(MassFractionUnit.CentigramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.CentigramPerKilogram, q => q.ToUnit(MassFractionUnit.CentigramPerKilogram)); + unitConverter.SetConversionFunction>(MassFractionUnit.CentigramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.DecagramPerGram, q => q.ToUnit(MassFractionUnit.DecagramPerGram)); + unitConverter.SetConversionFunction>(MassFractionUnit.DecagramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.DecagramPerKilogram, q => q.ToUnit(MassFractionUnit.DecagramPerKilogram)); + unitConverter.SetConversionFunction>(MassFractionUnit.DecagramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.DecigramPerGram, q => q.ToUnit(MassFractionUnit.DecigramPerGram)); + unitConverter.SetConversionFunction>(MassFractionUnit.DecigramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.DecigramPerKilogram, q => q.ToUnit(MassFractionUnit.DecigramPerKilogram)); + unitConverter.SetConversionFunction>(MassFractionUnit.DecigramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFraction.BaseUnit, q => q); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.GramPerGram, q => q.ToUnit(MassFractionUnit.GramPerGram)); + unitConverter.SetConversionFunction>(MassFractionUnit.GramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.GramPerKilogram, q => q.ToUnit(MassFractionUnit.GramPerKilogram)); + unitConverter.SetConversionFunction>(MassFractionUnit.GramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.HectogramPerGram, q => q.ToUnit(MassFractionUnit.HectogramPerGram)); + unitConverter.SetConversionFunction>(MassFractionUnit.HectogramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.HectogramPerKilogram, q => q.ToUnit(MassFractionUnit.HectogramPerKilogram)); + unitConverter.SetConversionFunction>(MassFractionUnit.HectogramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.KilogramPerGram, q => q.ToUnit(MassFractionUnit.KilogramPerGram)); + unitConverter.SetConversionFunction>(MassFractionUnit.KilogramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.KilogramPerKilogram, q => q.ToUnit(MassFractionUnit.KilogramPerKilogram)); + unitConverter.SetConversionFunction>(MassFractionUnit.KilogramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.MicrogramPerGram, q => q.ToUnit(MassFractionUnit.MicrogramPerGram)); + unitConverter.SetConversionFunction>(MassFractionUnit.MicrogramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.MicrogramPerKilogram, q => q.ToUnit(MassFractionUnit.MicrogramPerKilogram)); + unitConverter.SetConversionFunction>(MassFractionUnit.MicrogramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.MilligramPerGram, q => q.ToUnit(MassFractionUnit.MilligramPerGram)); + unitConverter.SetConversionFunction>(MassFractionUnit.MilligramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.MilligramPerKilogram, q => q.ToUnit(MassFractionUnit.MilligramPerKilogram)); + unitConverter.SetConversionFunction>(MassFractionUnit.MilligramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.NanogramPerGram, q => q.ToUnit(MassFractionUnit.NanogramPerGram)); + unitConverter.SetConversionFunction>(MassFractionUnit.NanogramPerGram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.NanogramPerKilogram, q => q.ToUnit(MassFractionUnit.NanogramPerKilogram)); + unitConverter.SetConversionFunction>(MassFractionUnit.NanogramPerKilogram, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.PartPerBillion, q => q.ToUnit(MassFractionUnit.PartPerBillion)); + unitConverter.SetConversionFunction>(MassFractionUnit.PartPerBillion, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.PartPerMillion, q => q.ToUnit(MassFractionUnit.PartPerMillion)); + unitConverter.SetConversionFunction>(MassFractionUnit.PartPerMillion, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.PartPerThousand, q => q.ToUnit(MassFractionUnit.PartPerThousand)); + unitConverter.SetConversionFunction>(MassFractionUnit.PartPerThousand, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.PartPerTrillion, q => q.ToUnit(MassFractionUnit.PartPerTrillion)); + unitConverter.SetConversionFunction>(MassFractionUnit.PartPerTrillion, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassFraction.BaseUnit, MassFractionUnit.Percent, q => q.ToUnit(MassFractionUnit.Percent)); + unitConverter.SetConversionFunction>(MassFractionUnit.Percent, MassFraction.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.GramSquareCentimeter, q => q.ToUnit(MassMomentOfInertiaUnit.GramSquareCentimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.GramSquareCentimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.GramSquareDecimeter, q => q.ToUnit(MassMomentOfInertiaUnit.GramSquareDecimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.GramSquareDecimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.GramSquareMeter, q => q.ToUnit(MassMomentOfInertiaUnit.GramSquareMeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.GramSquareMeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.GramSquareMillimeter, q => q.ToUnit(MassMomentOfInertiaUnit.GramSquareMillimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.GramSquareMillimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.KilogramSquareCentimeter, q => q.ToUnit(MassMomentOfInertiaUnit.KilogramSquareCentimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.KilogramSquareCentimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.KilogramSquareDecimeter, q => q.ToUnit(MassMomentOfInertiaUnit.KilogramSquareDecimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.KilogramSquareDecimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertia.BaseUnit, q => q); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.KilogramSquareMillimeter, q => q.ToUnit(MassMomentOfInertiaUnit.KilogramSquareMillimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.KilogramSquareMillimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.KilotonneSquareCentimeter, q => q.ToUnit(MassMomentOfInertiaUnit.KilotonneSquareCentimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.KilotonneSquareCentimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.KilotonneSquareDecimeter, q => q.ToUnit(MassMomentOfInertiaUnit.KilotonneSquareDecimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.KilotonneSquareDecimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.KilotonneSquareMeter, q => q.ToUnit(MassMomentOfInertiaUnit.KilotonneSquareMeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.KilotonneSquareMeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.KilotonneSquareMilimeter, q => q.ToUnit(MassMomentOfInertiaUnit.KilotonneSquareMilimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.KilotonneSquareMilimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.MegatonneSquareCentimeter, q => q.ToUnit(MassMomentOfInertiaUnit.MegatonneSquareCentimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.MegatonneSquareCentimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.MegatonneSquareDecimeter, q => q.ToUnit(MassMomentOfInertiaUnit.MegatonneSquareDecimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.MegatonneSquareDecimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.MegatonneSquareMeter, q => q.ToUnit(MassMomentOfInertiaUnit.MegatonneSquareMeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.MegatonneSquareMeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.MegatonneSquareMilimeter, q => q.ToUnit(MassMomentOfInertiaUnit.MegatonneSquareMilimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.MegatonneSquareMilimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.MilligramSquareCentimeter, q => q.ToUnit(MassMomentOfInertiaUnit.MilligramSquareCentimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.MilligramSquareCentimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.MilligramSquareDecimeter, q => q.ToUnit(MassMomentOfInertiaUnit.MilligramSquareDecimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.MilligramSquareDecimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.MilligramSquareMeter, q => q.ToUnit(MassMomentOfInertiaUnit.MilligramSquareMeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.MilligramSquareMeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.MilligramSquareMillimeter, q => q.ToUnit(MassMomentOfInertiaUnit.MilligramSquareMillimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.MilligramSquareMillimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.PoundSquareFoot, q => q.ToUnit(MassMomentOfInertiaUnit.PoundSquareFoot)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.PoundSquareFoot, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.PoundSquareInch, q => q.ToUnit(MassMomentOfInertiaUnit.PoundSquareInch)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.PoundSquareInch, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.SlugSquareFoot, q => q.ToUnit(MassMomentOfInertiaUnit.SlugSquareFoot)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.SlugSquareFoot, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.SlugSquareInch, q => q.ToUnit(MassMomentOfInertiaUnit.SlugSquareInch)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.SlugSquareInch, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.TonneSquareCentimeter, q => q.ToUnit(MassMomentOfInertiaUnit.TonneSquareCentimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.TonneSquareCentimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.TonneSquareDecimeter, q => q.ToUnit(MassMomentOfInertiaUnit.TonneSquareDecimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.TonneSquareDecimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.TonneSquareMeter, q => q.ToUnit(MassMomentOfInertiaUnit.TonneSquareMeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.TonneSquareMeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MassMomentOfInertia.BaseUnit, MassMomentOfInertiaUnit.TonneSquareMilimeter, q => q.ToUnit(MassMomentOfInertiaUnit.TonneSquareMilimeter)); + unitConverter.SetConversionFunction>(MassMomentOfInertiaUnit.TonneSquareMilimeter, MassMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MolarEnergy.BaseUnit, MolarEnergy.BaseUnit, q => q); + unitConverter.SetConversionFunction>(MolarEnergy.BaseUnit, MolarEnergyUnit.KilojoulePerMole, q => q.ToUnit(MolarEnergyUnit.KilojoulePerMole)); + unitConverter.SetConversionFunction>(MolarEnergyUnit.KilojoulePerMole, MolarEnergy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MolarEnergy.BaseUnit, MolarEnergyUnit.MegajoulePerMole, q => q.ToUnit(MolarEnergyUnit.MegajoulePerMole)); + unitConverter.SetConversionFunction>(MolarEnergyUnit.MegajoulePerMole, MolarEnergy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MolarEntropy.BaseUnit, MolarEntropy.BaseUnit, q => q); + unitConverter.SetConversionFunction>(MolarEntropy.BaseUnit, MolarEntropyUnit.KilojoulePerMoleKelvin, q => q.ToUnit(MolarEntropyUnit.KilojoulePerMoleKelvin)); + unitConverter.SetConversionFunction>(MolarEntropyUnit.KilojoulePerMoleKelvin, MolarEntropy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MolarEntropy.BaseUnit, MolarEntropyUnit.MegajoulePerMoleKelvin, q => q.ToUnit(MolarEntropyUnit.MegajoulePerMoleKelvin)); + unitConverter.SetConversionFunction>(MolarEntropyUnit.MegajoulePerMoleKelvin, MolarEntropy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Molarity.BaseUnit, MolarityUnit.CentimolesPerLiter, q => q.ToUnit(MolarityUnit.CentimolesPerLiter)); + unitConverter.SetConversionFunction>(MolarityUnit.CentimolesPerLiter, Molarity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Molarity.BaseUnit, MolarityUnit.DecimolesPerLiter, q => q.ToUnit(MolarityUnit.DecimolesPerLiter)); + unitConverter.SetConversionFunction>(MolarityUnit.DecimolesPerLiter, Molarity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Molarity.BaseUnit, MolarityUnit.MicromolesPerLiter, q => q.ToUnit(MolarityUnit.MicromolesPerLiter)); + unitConverter.SetConversionFunction>(MolarityUnit.MicromolesPerLiter, Molarity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Molarity.BaseUnit, MolarityUnit.MillimolesPerLiter, q => q.ToUnit(MolarityUnit.MillimolesPerLiter)); + unitConverter.SetConversionFunction>(MolarityUnit.MillimolesPerLiter, Molarity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Molarity.BaseUnit, Molarity.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Molarity.BaseUnit, MolarityUnit.MolesPerLiter, q => q.ToUnit(MolarityUnit.MolesPerLiter)); + unitConverter.SetConversionFunction>(MolarityUnit.MolesPerLiter, Molarity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Molarity.BaseUnit, MolarityUnit.NanomolesPerLiter, q => q.ToUnit(MolarityUnit.NanomolesPerLiter)); + unitConverter.SetConversionFunction>(MolarityUnit.NanomolesPerLiter, Molarity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Molarity.BaseUnit, MolarityUnit.PicomolesPerLiter, q => q.ToUnit(MolarityUnit.PicomolesPerLiter)); + unitConverter.SetConversionFunction>(MolarityUnit.PicomolesPerLiter, Molarity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MolarMass.BaseUnit, MolarMassUnit.CentigramPerMole, q => q.ToUnit(MolarMassUnit.CentigramPerMole)); + unitConverter.SetConversionFunction>(MolarMassUnit.CentigramPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MolarMass.BaseUnit, MolarMassUnit.DecagramPerMole, q => q.ToUnit(MolarMassUnit.DecagramPerMole)); + unitConverter.SetConversionFunction>(MolarMassUnit.DecagramPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MolarMass.BaseUnit, MolarMassUnit.DecigramPerMole, q => q.ToUnit(MolarMassUnit.DecigramPerMole)); + unitConverter.SetConversionFunction>(MolarMassUnit.DecigramPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MolarMass.BaseUnit, MolarMassUnit.GramPerMole, q => q.ToUnit(MolarMassUnit.GramPerMole)); + unitConverter.SetConversionFunction>(MolarMassUnit.GramPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MolarMass.BaseUnit, MolarMassUnit.HectogramPerMole, q => q.ToUnit(MolarMassUnit.HectogramPerMole)); + unitConverter.SetConversionFunction>(MolarMassUnit.HectogramPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MolarMass.BaseUnit, MolarMass.BaseUnit, q => q); + unitConverter.SetConversionFunction>(MolarMass.BaseUnit, MolarMassUnit.KilopoundPerMole, q => q.ToUnit(MolarMassUnit.KilopoundPerMole)); + unitConverter.SetConversionFunction>(MolarMassUnit.KilopoundPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MolarMass.BaseUnit, MolarMassUnit.MegapoundPerMole, q => q.ToUnit(MolarMassUnit.MegapoundPerMole)); + unitConverter.SetConversionFunction>(MolarMassUnit.MegapoundPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MolarMass.BaseUnit, MolarMassUnit.MicrogramPerMole, q => q.ToUnit(MolarMassUnit.MicrogramPerMole)); + unitConverter.SetConversionFunction>(MolarMassUnit.MicrogramPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MolarMass.BaseUnit, MolarMassUnit.MilligramPerMole, q => q.ToUnit(MolarMassUnit.MilligramPerMole)); + unitConverter.SetConversionFunction>(MolarMassUnit.MilligramPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MolarMass.BaseUnit, MolarMassUnit.NanogramPerMole, q => q.ToUnit(MolarMassUnit.NanogramPerMole)); + unitConverter.SetConversionFunction>(MolarMassUnit.NanogramPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(MolarMass.BaseUnit, MolarMassUnit.PoundPerMole, q => q.ToUnit(MolarMassUnit.PoundPerMole)); + unitConverter.SetConversionFunction>(MolarMassUnit.PoundPerMole, MolarMass.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Permeability.BaseUnit, Permeability.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Permittivity.BaseUnit, Permittivity.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.BoilerHorsepower, q => q.ToUnit(PowerUnit.BoilerHorsepower)); + unitConverter.SetConversionFunction>(PowerUnit.BoilerHorsepower, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.BritishThermalUnitPerHour, q => q.ToUnit(PowerUnit.BritishThermalUnitPerHour)); + unitConverter.SetConversionFunction>(PowerUnit.BritishThermalUnitPerHour, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.Decawatt, q => q.ToUnit(PowerUnit.Decawatt)); + unitConverter.SetConversionFunction>(PowerUnit.Decawatt, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.Deciwatt, q => q.ToUnit(PowerUnit.Deciwatt)); + unitConverter.SetConversionFunction>(PowerUnit.Deciwatt, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.ElectricalHorsepower, q => q.ToUnit(PowerUnit.ElectricalHorsepower)); + unitConverter.SetConversionFunction>(PowerUnit.ElectricalHorsepower, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.Femtowatt, q => q.ToUnit(PowerUnit.Femtowatt)); + unitConverter.SetConversionFunction>(PowerUnit.Femtowatt, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.Gigawatt, q => q.ToUnit(PowerUnit.Gigawatt)); + unitConverter.SetConversionFunction>(PowerUnit.Gigawatt, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.HydraulicHorsepower, q => q.ToUnit(PowerUnit.HydraulicHorsepower)); + unitConverter.SetConversionFunction>(PowerUnit.HydraulicHorsepower, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.KilobritishThermalUnitPerHour, q => q.ToUnit(PowerUnit.KilobritishThermalUnitPerHour)); + unitConverter.SetConversionFunction>(PowerUnit.KilobritishThermalUnitPerHour, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.Kilowatt, q => q.ToUnit(PowerUnit.Kilowatt)); + unitConverter.SetConversionFunction>(PowerUnit.Kilowatt, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.MechanicalHorsepower, q => q.ToUnit(PowerUnit.MechanicalHorsepower)); + unitConverter.SetConversionFunction>(PowerUnit.MechanicalHorsepower, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.Megawatt, q => q.ToUnit(PowerUnit.Megawatt)); + unitConverter.SetConversionFunction>(PowerUnit.Megawatt, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.MetricHorsepower, q => q.ToUnit(PowerUnit.MetricHorsepower)); + unitConverter.SetConversionFunction>(PowerUnit.MetricHorsepower, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.Microwatt, q => q.ToUnit(PowerUnit.Microwatt)); + unitConverter.SetConversionFunction>(PowerUnit.Microwatt, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.Milliwatt, q => q.ToUnit(PowerUnit.Milliwatt)); + unitConverter.SetConversionFunction>(PowerUnit.Milliwatt, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.Nanowatt, q => q.ToUnit(PowerUnit.Nanowatt)); + unitConverter.SetConversionFunction>(PowerUnit.Nanowatt, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.Petawatt, q => q.ToUnit(PowerUnit.Petawatt)); + unitConverter.SetConversionFunction>(PowerUnit.Petawatt, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.Picowatt, q => q.ToUnit(PowerUnit.Picowatt)); + unitConverter.SetConversionFunction>(PowerUnit.Picowatt, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, PowerUnit.Terawatt, q => q.ToUnit(PowerUnit.Terawatt)); + unitConverter.SetConversionFunction>(PowerUnit.Terawatt, Power.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Power.BaseUnit, Power.BaseUnit, q => q); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.DecawattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.DecawattPerCubicFoot)); + unitConverter.SetConversionFunction>(PowerDensityUnit.DecawattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.DecawattPerCubicInch, q => q.ToUnit(PowerDensityUnit.DecawattPerCubicInch)); + unitConverter.SetConversionFunction>(PowerDensityUnit.DecawattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.DecawattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.DecawattPerCubicMeter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.DecawattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.DecawattPerLiter, q => q.ToUnit(PowerDensityUnit.DecawattPerLiter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.DecawattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.DeciwattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.DeciwattPerCubicFoot)); + unitConverter.SetConversionFunction>(PowerDensityUnit.DeciwattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.DeciwattPerCubicInch, q => q.ToUnit(PowerDensityUnit.DeciwattPerCubicInch)); + unitConverter.SetConversionFunction>(PowerDensityUnit.DeciwattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.DeciwattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.DeciwattPerCubicMeter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.DeciwattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.DeciwattPerLiter, q => q.ToUnit(PowerDensityUnit.DeciwattPerLiter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.DeciwattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.GigawattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.GigawattPerCubicFoot)); + unitConverter.SetConversionFunction>(PowerDensityUnit.GigawattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.GigawattPerCubicInch, q => q.ToUnit(PowerDensityUnit.GigawattPerCubicInch)); + unitConverter.SetConversionFunction>(PowerDensityUnit.GigawattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.GigawattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.GigawattPerCubicMeter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.GigawattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.GigawattPerLiter, q => q.ToUnit(PowerDensityUnit.GigawattPerLiter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.GigawattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.KilowattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.KilowattPerCubicFoot)); + unitConverter.SetConversionFunction>(PowerDensityUnit.KilowattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.KilowattPerCubicInch, q => q.ToUnit(PowerDensityUnit.KilowattPerCubicInch)); + unitConverter.SetConversionFunction>(PowerDensityUnit.KilowattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.KilowattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.KilowattPerCubicMeter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.KilowattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.KilowattPerLiter, q => q.ToUnit(PowerDensityUnit.KilowattPerLiter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.KilowattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.MegawattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.MegawattPerCubicFoot)); + unitConverter.SetConversionFunction>(PowerDensityUnit.MegawattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.MegawattPerCubicInch, q => q.ToUnit(PowerDensityUnit.MegawattPerCubicInch)); + unitConverter.SetConversionFunction>(PowerDensityUnit.MegawattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.MegawattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.MegawattPerCubicMeter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.MegawattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.MegawattPerLiter, q => q.ToUnit(PowerDensityUnit.MegawattPerLiter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.MegawattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.MicrowattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.MicrowattPerCubicFoot)); + unitConverter.SetConversionFunction>(PowerDensityUnit.MicrowattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.MicrowattPerCubicInch, q => q.ToUnit(PowerDensityUnit.MicrowattPerCubicInch)); + unitConverter.SetConversionFunction>(PowerDensityUnit.MicrowattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.MicrowattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.MicrowattPerCubicMeter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.MicrowattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.MicrowattPerLiter, q => q.ToUnit(PowerDensityUnit.MicrowattPerLiter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.MicrowattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.MilliwattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.MilliwattPerCubicFoot)); + unitConverter.SetConversionFunction>(PowerDensityUnit.MilliwattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.MilliwattPerCubicInch, q => q.ToUnit(PowerDensityUnit.MilliwattPerCubicInch)); + unitConverter.SetConversionFunction>(PowerDensityUnit.MilliwattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.MilliwattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.MilliwattPerCubicMeter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.MilliwattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.MilliwattPerLiter, q => q.ToUnit(PowerDensityUnit.MilliwattPerLiter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.MilliwattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.NanowattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.NanowattPerCubicFoot)); + unitConverter.SetConversionFunction>(PowerDensityUnit.NanowattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.NanowattPerCubicInch, q => q.ToUnit(PowerDensityUnit.NanowattPerCubicInch)); + unitConverter.SetConversionFunction>(PowerDensityUnit.NanowattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.NanowattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.NanowattPerCubicMeter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.NanowattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.NanowattPerLiter, q => q.ToUnit(PowerDensityUnit.NanowattPerLiter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.NanowattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.PicowattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.PicowattPerCubicFoot)); + unitConverter.SetConversionFunction>(PowerDensityUnit.PicowattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.PicowattPerCubicInch, q => q.ToUnit(PowerDensityUnit.PicowattPerCubicInch)); + unitConverter.SetConversionFunction>(PowerDensityUnit.PicowattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.PicowattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.PicowattPerCubicMeter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.PicowattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.PicowattPerLiter, q => q.ToUnit(PowerDensityUnit.PicowattPerLiter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.PicowattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.TerawattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.TerawattPerCubicFoot)); + unitConverter.SetConversionFunction>(PowerDensityUnit.TerawattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.TerawattPerCubicInch, q => q.ToUnit(PowerDensityUnit.TerawattPerCubicInch)); + unitConverter.SetConversionFunction>(PowerDensityUnit.TerawattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.TerawattPerCubicMeter, q => q.ToUnit(PowerDensityUnit.TerawattPerCubicMeter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.TerawattPerCubicMeter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.TerawattPerLiter, q => q.ToUnit(PowerDensityUnit.TerawattPerLiter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.TerawattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.WattPerCubicFoot, q => q.ToUnit(PowerDensityUnit.WattPerCubicFoot)); + unitConverter.SetConversionFunction>(PowerDensityUnit.WattPerCubicFoot, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.WattPerCubicInch, q => q.ToUnit(PowerDensityUnit.WattPerCubicInch)); + unitConverter.SetConversionFunction>(PowerDensityUnit.WattPerCubicInch, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensity.BaseUnit, q => q); + unitConverter.SetConversionFunction>(PowerDensity.BaseUnit, PowerDensityUnit.WattPerLiter, q => q.ToUnit(PowerDensityUnit.WattPerLiter)); + unitConverter.SetConversionFunction>(PowerDensityUnit.WattPerLiter, PowerDensity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerRatio.BaseUnit, PowerRatioUnit.DecibelMilliwatt, q => q.ToUnit(PowerRatioUnit.DecibelMilliwatt)); + unitConverter.SetConversionFunction>(PowerRatioUnit.DecibelMilliwatt, PowerRatio.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PowerRatio.BaseUnit, PowerRatio.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.Atmosphere, q => q.ToUnit(PressureUnit.Atmosphere)); + unitConverter.SetConversionFunction>(PressureUnit.Atmosphere, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.Bar, q => q.ToUnit(PressureUnit.Bar)); + unitConverter.SetConversionFunction>(PressureUnit.Bar, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.Centibar, q => q.ToUnit(PressureUnit.Centibar)); + unitConverter.SetConversionFunction>(PressureUnit.Centibar, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.Decapascal, q => q.ToUnit(PressureUnit.Decapascal)); + unitConverter.SetConversionFunction>(PressureUnit.Decapascal, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.Decibar, q => q.ToUnit(PressureUnit.Decibar)); + unitConverter.SetConversionFunction>(PressureUnit.Decibar, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.DynePerSquareCentimeter, q => q.ToUnit(PressureUnit.DynePerSquareCentimeter)); + unitConverter.SetConversionFunction>(PressureUnit.DynePerSquareCentimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.FootOfHead, q => q.ToUnit(PressureUnit.FootOfHead)); + unitConverter.SetConversionFunction>(PressureUnit.FootOfHead, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.Gigapascal, q => q.ToUnit(PressureUnit.Gigapascal)); + unitConverter.SetConversionFunction>(PressureUnit.Gigapascal, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.Hectopascal, q => q.ToUnit(PressureUnit.Hectopascal)); + unitConverter.SetConversionFunction>(PressureUnit.Hectopascal, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.InchOfMercury, q => q.ToUnit(PressureUnit.InchOfMercury)); + unitConverter.SetConversionFunction>(PressureUnit.InchOfMercury, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.InchOfWaterColumn, q => q.ToUnit(PressureUnit.InchOfWaterColumn)); + unitConverter.SetConversionFunction>(PressureUnit.InchOfWaterColumn, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.Kilobar, q => q.ToUnit(PressureUnit.Kilobar)); + unitConverter.SetConversionFunction>(PressureUnit.Kilobar, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.KilogramForcePerSquareCentimeter, q => q.ToUnit(PressureUnit.KilogramForcePerSquareCentimeter)); + unitConverter.SetConversionFunction>(PressureUnit.KilogramForcePerSquareCentimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.KilogramForcePerSquareMeter, q => q.ToUnit(PressureUnit.KilogramForcePerSquareMeter)); + unitConverter.SetConversionFunction>(PressureUnit.KilogramForcePerSquareMeter, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.KilogramForcePerSquareMillimeter, q => q.ToUnit(PressureUnit.KilogramForcePerSquareMillimeter)); + unitConverter.SetConversionFunction>(PressureUnit.KilogramForcePerSquareMillimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.KilonewtonPerSquareCentimeter, q => q.ToUnit(PressureUnit.KilonewtonPerSquareCentimeter)); + unitConverter.SetConversionFunction>(PressureUnit.KilonewtonPerSquareCentimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.KilonewtonPerSquareMeter, q => q.ToUnit(PressureUnit.KilonewtonPerSquareMeter)); + unitConverter.SetConversionFunction>(PressureUnit.KilonewtonPerSquareMeter, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.KilonewtonPerSquareMillimeter, q => q.ToUnit(PressureUnit.KilonewtonPerSquareMillimeter)); + unitConverter.SetConversionFunction>(PressureUnit.KilonewtonPerSquareMillimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.Kilopascal, q => q.ToUnit(PressureUnit.Kilopascal)); + unitConverter.SetConversionFunction>(PressureUnit.Kilopascal, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.KilopoundForcePerSquareFoot, q => q.ToUnit(PressureUnit.KilopoundForcePerSquareFoot)); + unitConverter.SetConversionFunction>(PressureUnit.KilopoundForcePerSquareFoot, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.KilopoundForcePerSquareInch, q => q.ToUnit(PressureUnit.KilopoundForcePerSquareInch)); + unitConverter.SetConversionFunction>(PressureUnit.KilopoundForcePerSquareInch, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.Megabar, q => q.ToUnit(PressureUnit.Megabar)); + unitConverter.SetConversionFunction>(PressureUnit.Megabar, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.MeganewtonPerSquareMeter, q => q.ToUnit(PressureUnit.MeganewtonPerSquareMeter)); + unitConverter.SetConversionFunction>(PressureUnit.MeganewtonPerSquareMeter, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.Megapascal, q => q.ToUnit(PressureUnit.Megapascal)); + unitConverter.SetConversionFunction>(PressureUnit.Megapascal, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.MeterOfHead, q => q.ToUnit(PressureUnit.MeterOfHead)); + unitConverter.SetConversionFunction>(PressureUnit.MeterOfHead, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.Microbar, q => q.ToUnit(PressureUnit.Microbar)); + unitConverter.SetConversionFunction>(PressureUnit.Microbar, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.Micropascal, q => q.ToUnit(PressureUnit.Micropascal)); + unitConverter.SetConversionFunction>(PressureUnit.Micropascal, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.Millibar, q => q.ToUnit(PressureUnit.Millibar)); + unitConverter.SetConversionFunction>(PressureUnit.Millibar, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.MillimeterOfMercury, q => q.ToUnit(PressureUnit.MillimeterOfMercury)); + unitConverter.SetConversionFunction>(PressureUnit.MillimeterOfMercury, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.Millipascal, q => q.ToUnit(PressureUnit.Millipascal)); + unitConverter.SetConversionFunction>(PressureUnit.Millipascal, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.NewtonPerSquareCentimeter, q => q.ToUnit(PressureUnit.NewtonPerSquareCentimeter)); + unitConverter.SetConversionFunction>(PressureUnit.NewtonPerSquareCentimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.NewtonPerSquareMeter, q => q.ToUnit(PressureUnit.NewtonPerSquareMeter)); + unitConverter.SetConversionFunction>(PressureUnit.NewtonPerSquareMeter, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.NewtonPerSquareMillimeter, q => q.ToUnit(PressureUnit.NewtonPerSquareMillimeter)); + unitConverter.SetConversionFunction>(PressureUnit.NewtonPerSquareMillimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, Pressure.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.PoundForcePerSquareFoot, q => q.ToUnit(PressureUnit.PoundForcePerSquareFoot)); + unitConverter.SetConversionFunction>(PressureUnit.PoundForcePerSquareFoot, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.PoundForcePerSquareInch, q => q.ToUnit(PressureUnit.PoundForcePerSquareInch)); + unitConverter.SetConversionFunction>(PressureUnit.PoundForcePerSquareInch, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.PoundPerInchSecondSquared, q => q.ToUnit(PressureUnit.PoundPerInchSecondSquared)); + unitConverter.SetConversionFunction>(PressureUnit.PoundPerInchSecondSquared, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.TechnicalAtmosphere, q => q.ToUnit(PressureUnit.TechnicalAtmosphere)); + unitConverter.SetConversionFunction>(PressureUnit.TechnicalAtmosphere, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.TonneForcePerSquareCentimeter, q => q.ToUnit(PressureUnit.TonneForcePerSquareCentimeter)); + unitConverter.SetConversionFunction>(PressureUnit.TonneForcePerSquareCentimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.TonneForcePerSquareMeter, q => q.ToUnit(PressureUnit.TonneForcePerSquareMeter)); + unitConverter.SetConversionFunction>(PressureUnit.TonneForcePerSquareMeter, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.TonneForcePerSquareMillimeter, q => q.ToUnit(PressureUnit.TonneForcePerSquareMillimeter)); + unitConverter.SetConversionFunction>(PressureUnit.TonneForcePerSquareMillimeter, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Pressure.BaseUnit, PressureUnit.Torr, q => q.ToUnit(PressureUnit.Torr)); + unitConverter.SetConversionFunction>(PressureUnit.Torr, Pressure.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PressureChangeRate.BaseUnit, PressureChangeRateUnit.AtmospherePerSecond, q => q.ToUnit(PressureChangeRateUnit.AtmospherePerSecond)); + unitConverter.SetConversionFunction>(PressureChangeRateUnit.AtmospherePerSecond, PressureChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PressureChangeRate.BaseUnit, PressureChangeRateUnit.KilopascalPerMinute, q => q.ToUnit(PressureChangeRateUnit.KilopascalPerMinute)); + unitConverter.SetConversionFunction>(PressureChangeRateUnit.KilopascalPerMinute, PressureChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PressureChangeRate.BaseUnit, PressureChangeRateUnit.KilopascalPerSecond, q => q.ToUnit(PressureChangeRateUnit.KilopascalPerSecond)); + unitConverter.SetConversionFunction>(PressureChangeRateUnit.KilopascalPerSecond, PressureChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PressureChangeRate.BaseUnit, PressureChangeRateUnit.MegapascalPerMinute, q => q.ToUnit(PressureChangeRateUnit.MegapascalPerMinute)); + unitConverter.SetConversionFunction>(PressureChangeRateUnit.MegapascalPerMinute, PressureChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PressureChangeRate.BaseUnit, PressureChangeRateUnit.MegapascalPerSecond, q => q.ToUnit(PressureChangeRateUnit.MegapascalPerSecond)); + unitConverter.SetConversionFunction>(PressureChangeRateUnit.MegapascalPerSecond, PressureChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PressureChangeRate.BaseUnit, PressureChangeRateUnit.PascalPerMinute, q => q.ToUnit(PressureChangeRateUnit.PascalPerMinute)); + unitConverter.SetConversionFunction>(PressureChangeRateUnit.PascalPerMinute, PressureChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(PressureChangeRate.BaseUnit, PressureChangeRate.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Ratio.BaseUnit, Ratio.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Ratio.BaseUnit, RatioUnit.PartPerBillion, q => q.ToUnit(RatioUnit.PartPerBillion)); + unitConverter.SetConversionFunction>(RatioUnit.PartPerBillion, Ratio.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Ratio.BaseUnit, RatioUnit.PartPerMillion, q => q.ToUnit(RatioUnit.PartPerMillion)); + unitConverter.SetConversionFunction>(RatioUnit.PartPerMillion, Ratio.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Ratio.BaseUnit, RatioUnit.PartPerThousand, q => q.ToUnit(RatioUnit.PartPerThousand)); + unitConverter.SetConversionFunction>(RatioUnit.PartPerThousand, Ratio.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Ratio.BaseUnit, RatioUnit.PartPerTrillion, q => q.ToUnit(RatioUnit.PartPerTrillion)); + unitConverter.SetConversionFunction>(RatioUnit.PartPerTrillion, Ratio.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Ratio.BaseUnit, RatioUnit.Percent, q => q.ToUnit(RatioUnit.Percent)); + unitConverter.SetConversionFunction>(RatioUnit.Percent, Ratio.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RatioChangeRate.BaseUnit, RatioChangeRate.BaseUnit, q => q); + unitConverter.SetConversionFunction>(RatioChangeRate.BaseUnit, RatioChangeRateUnit.PercentPerSecond, q => q.ToUnit(RatioChangeRateUnit.PercentPerSecond)); + unitConverter.SetConversionFunction>(RatioChangeRateUnit.PercentPerSecond, RatioChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ReactiveEnergy.BaseUnit, ReactiveEnergyUnit.KilovoltampereReactiveHour, q => q.ToUnit(ReactiveEnergyUnit.KilovoltampereReactiveHour)); + unitConverter.SetConversionFunction>(ReactiveEnergyUnit.KilovoltampereReactiveHour, ReactiveEnergy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ReactiveEnergy.BaseUnit, ReactiveEnergyUnit.MegavoltampereReactiveHour, q => q.ToUnit(ReactiveEnergyUnit.MegavoltampereReactiveHour)); + unitConverter.SetConversionFunction>(ReactiveEnergyUnit.MegavoltampereReactiveHour, ReactiveEnergy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ReactiveEnergy.BaseUnit, ReactiveEnergy.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ReactivePower.BaseUnit, ReactivePowerUnit.GigavoltampereReactive, q => q.ToUnit(ReactivePowerUnit.GigavoltampereReactive)); + unitConverter.SetConversionFunction>(ReactivePowerUnit.GigavoltampereReactive, ReactivePower.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ReactivePower.BaseUnit, ReactivePowerUnit.KilovoltampereReactive, q => q.ToUnit(ReactivePowerUnit.KilovoltampereReactive)); + unitConverter.SetConversionFunction>(ReactivePowerUnit.KilovoltampereReactive, ReactivePower.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ReactivePower.BaseUnit, ReactivePowerUnit.MegavoltampereReactive, q => q.ToUnit(ReactivePowerUnit.MegavoltampereReactive)); + unitConverter.SetConversionFunction>(ReactivePowerUnit.MegavoltampereReactive, ReactivePower.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ReactivePower.BaseUnit, ReactivePower.BaseUnit, q => q); + unitConverter.SetConversionFunction>(RotationalAcceleration.BaseUnit, RotationalAccelerationUnit.DegreePerSecondSquared, q => q.ToUnit(RotationalAccelerationUnit.DegreePerSecondSquared)); + unitConverter.SetConversionFunction>(RotationalAccelerationUnit.DegreePerSecondSquared, RotationalAcceleration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalAcceleration.BaseUnit, RotationalAcceleration.BaseUnit, q => q); + unitConverter.SetConversionFunction>(RotationalAcceleration.BaseUnit, RotationalAccelerationUnit.RevolutionPerMinutePerSecond, q => q.ToUnit(RotationalAccelerationUnit.RevolutionPerMinutePerSecond)); + unitConverter.SetConversionFunction>(RotationalAccelerationUnit.RevolutionPerMinutePerSecond, RotationalAcceleration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalAcceleration.BaseUnit, RotationalAccelerationUnit.RevolutionPerSecondSquared, q => q.ToUnit(RotationalAccelerationUnit.RevolutionPerSecondSquared)); + unitConverter.SetConversionFunction>(RotationalAccelerationUnit.RevolutionPerSecondSquared, RotationalAcceleration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalSpeed.BaseUnit, RotationalSpeedUnit.CentiradianPerSecond, q => q.ToUnit(RotationalSpeedUnit.CentiradianPerSecond)); + unitConverter.SetConversionFunction>(RotationalSpeedUnit.CentiradianPerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalSpeed.BaseUnit, RotationalSpeedUnit.DeciradianPerSecond, q => q.ToUnit(RotationalSpeedUnit.DeciradianPerSecond)); + unitConverter.SetConversionFunction>(RotationalSpeedUnit.DeciradianPerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalSpeed.BaseUnit, RotationalSpeedUnit.DegreePerMinute, q => q.ToUnit(RotationalSpeedUnit.DegreePerMinute)); + unitConverter.SetConversionFunction>(RotationalSpeedUnit.DegreePerMinute, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalSpeed.BaseUnit, RotationalSpeedUnit.DegreePerSecond, q => q.ToUnit(RotationalSpeedUnit.DegreePerSecond)); + unitConverter.SetConversionFunction>(RotationalSpeedUnit.DegreePerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalSpeed.BaseUnit, RotationalSpeedUnit.MicrodegreePerSecond, q => q.ToUnit(RotationalSpeedUnit.MicrodegreePerSecond)); + unitConverter.SetConversionFunction>(RotationalSpeedUnit.MicrodegreePerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalSpeed.BaseUnit, RotationalSpeedUnit.MicroradianPerSecond, q => q.ToUnit(RotationalSpeedUnit.MicroradianPerSecond)); + unitConverter.SetConversionFunction>(RotationalSpeedUnit.MicroradianPerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalSpeed.BaseUnit, RotationalSpeedUnit.MillidegreePerSecond, q => q.ToUnit(RotationalSpeedUnit.MillidegreePerSecond)); + unitConverter.SetConversionFunction>(RotationalSpeedUnit.MillidegreePerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalSpeed.BaseUnit, RotationalSpeedUnit.MilliradianPerSecond, q => q.ToUnit(RotationalSpeedUnit.MilliradianPerSecond)); + unitConverter.SetConversionFunction>(RotationalSpeedUnit.MilliradianPerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalSpeed.BaseUnit, RotationalSpeedUnit.NanodegreePerSecond, q => q.ToUnit(RotationalSpeedUnit.NanodegreePerSecond)); + unitConverter.SetConversionFunction>(RotationalSpeedUnit.NanodegreePerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalSpeed.BaseUnit, RotationalSpeedUnit.NanoradianPerSecond, q => q.ToUnit(RotationalSpeedUnit.NanoradianPerSecond)); + unitConverter.SetConversionFunction>(RotationalSpeedUnit.NanoradianPerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalSpeed.BaseUnit, RotationalSpeed.BaseUnit, q => q); + unitConverter.SetConversionFunction>(RotationalSpeed.BaseUnit, RotationalSpeedUnit.RevolutionPerMinute, q => q.ToUnit(RotationalSpeedUnit.RevolutionPerMinute)); + unitConverter.SetConversionFunction>(RotationalSpeedUnit.RevolutionPerMinute, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalSpeed.BaseUnit, RotationalSpeedUnit.RevolutionPerSecond, q => q.ToUnit(RotationalSpeedUnit.RevolutionPerSecond)); + unitConverter.SetConversionFunction>(RotationalSpeedUnit.RevolutionPerSecond, RotationalSpeed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalStiffness.BaseUnit, RotationalStiffnessUnit.KilonewtonMeterPerRadian, q => q.ToUnit(RotationalStiffnessUnit.KilonewtonMeterPerRadian)); + unitConverter.SetConversionFunction>(RotationalStiffnessUnit.KilonewtonMeterPerRadian, RotationalStiffness.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalStiffness.BaseUnit, RotationalStiffnessUnit.MeganewtonMeterPerRadian, q => q.ToUnit(RotationalStiffnessUnit.MeganewtonMeterPerRadian)); + unitConverter.SetConversionFunction>(RotationalStiffnessUnit.MeganewtonMeterPerRadian, RotationalStiffness.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalStiffness.BaseUnit, RotationalStiffness.BaseUnit, q => q); + unitConverter.SetConversionFunction>(RotationalStiffnessPerLength.BaseUnit, RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter, q => q.ToUnit(RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter)); + unitConverter.SetConversionFunction>(RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter, RotationalStiffnessPerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalStiffnessPerLength.BaseUnit, RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter, q => q.ToUnit(RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter)); + unitConverter.SetConversionFunction>(RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter, RotationalStiffnessPerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(RotationalStiffnessPerLength.BaseUnit, RotationalStiffnessPerLength.BaseUnit, q => q); + unitConverter.SetConversionFunction>(SolidAngle.BaseUnit, SolidAngle.BaseUnit, q => q); + unitConverter.SetConversionFunction>(SpecificEnergy.BaseUnit, SpecificEnergyUnit.BtuPerPound, q => q.ToUnit(SpecificEnergyUnit.BtuPerPound)); + unitConverter.SetConversionFunction>(SpecificEnergyUnit.BtuPerPound, SpecificEnergy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificEnergy.BaseUnit, SpecificEnergyUnit.CaloriePerGram, q => q.ToUnit(SpecificEnergyUnit.CaloriePerGram)); + unitConverter.SetConversionFunction>(SpecificEnergyUnit.CaloriePerGram, SpecificEnergy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificEnergy.BaseUnit, SpecificEnergy.BaseUnit, q => q); + unitConverter.SetConversionFunction>(SpecificEnergy.BaseUnit, SpecificEnergyUnit.KilocaloriePerGram, q => q.ToUnit(SpecificEnergyUnit.KilocaloriePerGram)); + unitConverter.SetConversionFunction>(SpecificEnergyUnit.KilocaloriePerGram, SpecificEnergy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificEnergy.BaseUnit, SpecificEnergyUnit.KilojoulePerKilogram, q => q.ToUnit(SpecificEnergyUnit.KilojoulePerKilogram)); + unitConverter.SetConversionFunction>(SpecificEnergyUnit.KilojoulePerKilogram, SpecificEnergy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificEnergy.BaseUnit, SpecificEnergyUnit.KilowattHourPerKilogram, q => q.ToUnit(SpecificEnergyUnit.KilowattHourPerKilogram)); + unitConverter.SetConversionFunction>(SpecificEnergyUnit.KilowattHourPerKilogram, SpecificEnergy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificEnergy.BaseUnit, SpecificEnergyUnit.MegajoulePerKilogram, q => q.ToUnit(SpecificEnergyUnit.MegajoulePerKilogram)); + unitConverter.SetConversionFunction>(SpecificEnergyUnit.MegajoulePerKilogram, SpecificEnergy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificEnergy.BaseUnit, SpecificEnergyUnit.MegawattHourPerKilogram, q => q.ToUnit(SpecificEnergyUnit.MegawattHourPerKilogram)); + unitConverter.SetConversionFunction>(SpecificEnergyUnit.MegawattHourPerKilogram, SpecificEnergy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificEnergy.BaseUnit, SpecificEnergyUnit.WattHourPerKilogram, q => q.ToUnit(SpecificEnergyUnit.WattHourPerKilogram)); + unitConverter.SetConversionFunction>(SpecificEnergyUnit.WattHourPerKilogram, SpecificEnergy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificEntropy.BaseUnit, SpecificEntropyUnit.BtuPerPoundFahrenheit, q => q.ToUnit(SpecificEntropyUnit.BtuPerPoundFahrenheit)); + unitConverter.SetConversionFunction>(SpecificEntropyUnit.BtuPerPoundFahrenheit, SpecificEntropy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificEntropy.BaseUnit, SpecificEntropyUnit.CaloriePerGramKelvin, q => q.ToUnit(SpecificEntropyUnit.CaloriePerGramKelvin)); + unitConverter.SetConversionFunction>(SpecificEntropyUnit.CaloriePerGramKelvin, SpecificEntropy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificEntropy.BaseUnit, SpecificEntropyUnit.JoulePerKilogramDegreeCelsius, q => q.ToUnit(SpecificEntropyUnit.JoulePerKilogramDegreeCelsius)); + unitConverter.SetConversionFunction>(SpecificEntropyUnit.JoulePerKilogramDegreeCelsius, SpecificEntropy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificEntropy.BaseUnit, SpecificEntropy.BaseUnit, q => q); + unitConverter.SetConversionFunction>(SpecificEntropy.BaseUnit, SpecificEntropyUnit.KilocaloriePerGramKelvin, q => q.ToUnit(SpecificEntropyUnit.KilocaloriePerGramKelvin)); + unitConverter.SetConversionFunction>(SpecificEntropyUnit.KilocaloriePerGramKelvin, SpecificEntropy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificEntropy.BaseUnit, SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius, q => q.ToUnit(SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius)); + unitConverter.SetConversionFunction>(SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius, SpecificEntropy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificEntropy.BaseUnit, SpecificEntropyUnit.KilojoulePerKilogramKelvin, q => q.ToUnit(SpecificEntropyUnit.KilojoulePerKilogramKelvin)); + unitConverter.SetConversionFunction>(SpecificEntropyUnit.KilojoulePerKilogramKelvin, SpecificEntropy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificEntropy.BaseUnit, SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius, q => q.ToUnit(SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius)); + unitConverter.SetConversionFunction>(SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius, SpecificEntropy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificEntropy.BaseUnit, SpecificEntropyUnit.MegajoulePerKilogramKelvin, q => q.ToUnit(SpecificEntropyUnit.MegajoulePerKilogramKelvin)); + unitConverter.SetConversionFunction>(SpecificEntropyUnit.MegajoulePerKilogramKelvin, SpecificEntropy.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificVolume.BaseUnit, SpecificVolumeUnit.CubicFootPerPound, q => q.ToUnit(SpecificVolumeUnit.CubicFootPerPound)); + unitConverter.SetConversionFunction>(SpecificVolumeUnit.CubicFootPerPound, SpecificVolume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificVolume.BaseUnit, SpecificVolume.BaseUnit, q => q); + unitConverter.SetConversionFunction>(SpecificVolume.BaseUnit, SpecificVolumeUnit.MillicubicMeterPerKilogram, q => q.ToUnit(SpecificVolumeUnit.MillicubicMeterPerKilogram)); + unitConverter.SetConversionFunction>(SpecificVolumeUnit.MillicubicMeterPerKilogram, SpecificVolume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeightUnit.KilogramForcePerCubicCentimeter, q => q.ToUnit(SpecificWeightUnit.KilogramForcePerCubicCentimeter)); + unitConverter.SetConversionFunction>(SpecificWeightUnit.KilogramForcePerCubicCentimeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeightUnit.KilogramForcePerCubicMeter, q => q.ToUnit(SpecificWeightUnit.KilogramForcePerCubicMeter)); + unitConverter.SetConversionFunction>(SpecificWeightUnit.KilogramForcePerCubicMeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeightUnit.KilogramForcePerCubicMillimeter, q => q.ToUnit(SpecificWeightUnit.KilogramForcePerCubicMillimeter)); + unitConverter.SetConversionFunction>(SpecificWeightUnit.KilogramForcePerCubicMillimeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeightUnit.KilonewtonPerCubicCentimeter, q => q.ToUnit(SpecificWeightUnit.KilonewtonPerCubicCentimeter)); + unitConverter.SetConversionFunction>(SpecificWeightUnit.KilonewtonPerCubicCentimeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeightUnit.KilonewtonPerCubicMeter, q => q.ToUnit(SpecificWeightUnit.KilonewtonPerCubicMeter)); + unitConverter.SetConversionFunction>(SpecificWeightUnit.KilonewtonPerCubicMeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeightUnit.KilonewtonPerCubicMillimeter, q => q.ToUnit(SpecificWeightUnit.KilonewtonPerCubicMillimeter)); + unitConverter.SetConversionFunction>(SpecificWeightUnit.KilonewtonPerCubicMillimeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeightUnit.KilopoundForcePerCubicFoot, q => q.ToUnit(SpecificWeightUnit.KilopoundForcePerCubicFoot)); + unitConverter.SetConversionFunction>(SpecificWeightUnit.KilopoundForcePerCubicFoot, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeightUnit.KilopoundForcePerCubicInch, q => q.ToUnit(SpecificWeightUnit.KilopoundForcePerCubicInch)); + unitConverter.SetConversionFunction>(SpecificWeightUnit.KilopoundForcePerCubicInch, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeightUnit.MeganewtonPerCubicMeter, q => q.ToUnit(SpecificWeightUnit.MeganewtonPerCubicMeter)); + unitConverter.SetConversionFunction>(SpecificWeightUnit.MeganewtonPerCubicMeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeightUnit.NewtonPerCubicCentimeter, q => q.ToUnit(SpecificWeightUnit.NewtonPerCubicCentimeter)); + unitConverter.SetConversionFunction>(SpecificWeightUnit.NewtonPerCubicCentimeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeight.BaseUnit, q => q); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeightUnit.NewtonPerCubicMillimeter, q => q.ToUnit(SpecificWeightUnit.NewtonPerCubicMillimeter)); + unitConverter.SetConversionFunction>(SpecificWeightUnit.NewtonPerCubicMillimeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeightUnit.PoundForcePerCubicFoot, q => q.ToUnit(SpecificWeightUnit.PoundForcePerCubicFoot)); + unitConverter.SetConversionFunction>(SpecificWeightUnit.PoundForcePerCubicFoot, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeightUnit.PoundForcePerCubicInch, q => q.ToUnit(SpecificWeightUnit.PoundForcePerCubicInch)); + unitConverter.SetConversionFunction>(SpecificWeightUnit.PoundForcePerCubicInch, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeightUnit.TonneForcePerCubicCentimeter, q => q.ToUnit(SpecificWeightUnit.TonneForcePerCubicCentimeter)); + unitConverter.SetConversionFunction>(SpecificWeightUnit.TonneForcePerCubicCentimeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeightUnit.TonneForcePerCubicMeter, q => q.ToUnit(SpecificWeightUnit.TonneForcePerCubicMeter)); + unitConverter.SetConversionFunction>(SpecificWeightUnit.TonneForcePerCubicMeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(SpecificWeight.BaseUnit, SpecificWeightUnit.TonneForcePerCubicMillimeter, q => q.ToUnit(SpecificWeightUnit.TonneForcePerCubicMillimeter)); + unitConverter.SetConversionFunction>(SpecificWeightUnit.TonneForcePerCubicMillimeter, SpecificWeight.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.CentimeterPerHour, q => q.ToUnit(SpeedUnit.CentimeterPerHour)); + unitConverter.SetConversionFunction>(SpeedUnit.CentimeterPerHour, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.CentimeterPerMinute, q => q.ToUnit(SpeedUnit.CentimeterPerMinute)); + unitConverter.SetConversionFunction>(SpeedUnit.CentimeterPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.CentimeterPerSecond, q => q.ToUnit(SpeedUnit.CentimeterPerSecond)); + unitConverter.SetConversionFunction>(SpeedUnit.CentimeterPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.DecimeterPerMinute, q => q.ToUnit(SpeedUnit.DecimeterPerMinute)); + unitConverter.SetConversionFunction>(SpeedUnit.DecimeterPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.DecimeterPerSecond, q => q.ToUnit(SpeedUnit.DecimeterPerSecond)); + unitConverter.SetConversionFunction>(SpeedUnit.DecimeterPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.FootPerHour, q => q.ToUnit(SpeedUnit.FootPerHour)); + unitConverter.SetConversionFunction>(SpeedUnit.FootPerHour, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.FootPerMinute, q => q.ToUnit(SpeedUnit.FootPerMinute)); + unitConverter.SetConversionFunction>(SpeedUnit.FootPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.FootPerSecond, q => q.ToUnit(SpeedUnit.FootPerSecond)); + unitConverter.SetConversionFunction>(SpeedUnit.FootPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.InchPerHour, q => q.ToUnit(SpeedUnit.InchPerHour)); + unitConverter.SetConversionFunction>(SpeedUnit.InchPerHour, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.InchPerMinute, q => q.ToUnit(SpeedUnit.InchPerMinute)); + unitConverter.SetConversionFunction>(SpeedUnit.InchPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.InchPerSecond, q => q.ToUnit(SpeedUnit.InchPerSecond)); + unitConverter.SetConversionFunction>(SpeedUnit.InchPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.KilometerPerHour, q => q.ToUnit(SpeedUnit.KilometerPerHour)); + unitConverter.SetConversionFunction>(SpeedUnit.KilometerPerHour, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.KilometerPerMinute, q => q.ToUnit(SpeedUnit.KilometerPerMinute)); + unitConverter.SetConversionFunction>(SpeedUnit.KilometerPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.KilometerPerSecond, q => q.ToUnit(SpeedUnit.KilometerPerSecond)); + unitConverter.SetConversionFunction>(SpeedUnit.KilometerPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.Knot, q => q.ToUnit(SpeedUnit.Knot)); + unitConverter.SetConversionFunction>(SpeedUnit.Knot, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.MeterPerHour, q => q.ToUnit(SpeedUnit.MeterPerHour)); + unitConverter.SetConversionFunction>(SpeedUnit.MeterPerHour, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.MeterPerMinute, q => q.ToUnit(SpeedUnit.MeterPerMinute)); + unitConverter.SetConversionFunction>(SpeedUnit.MeterPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, Speed.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.MicrometerPerMinute, q => q.ToUnit(SpeedUnit.MicrometerPerMinute)); + unitConverter.SetConversionFunction>(SpeedUnit.MicrometerPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.MicrometerPerSecond, q => q.ToUnit(SpeedUnit.MicrometerPerSecond)); + unitConverter.SetConversionFunction>(SpeedUnit.MicrometerPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.MilePerHour, q => q.ToUnit(SpeedUnit.MilePerHour)); + unitConverter.SetConversionFunction>(SpeedUnit.MilePerHour, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.MillimeterPerHour, q => q.ToUnit(SpeedUnit.MillimeterPerHour)); + unitConverter.SetConversionFunction>(SpeedUnit.MillimeterPerHour, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.MillimeterPerMinute, q => q.ToUnit(SpeedUnit.MillimeterPerMinute)); + unitConverter.SetConversionFunction>(SpeedUnit.MillimeterPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.MillimeterPerSecond, q => q.ToUnit(SpeedUnit.MillimeterPerSecond)); + unitConverter.SetConversionFunction>(SpeedUnit.MillimeterPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.NanometerPerMinute, q => q.ToUnit(SpeedUnit.NanometerPerMinute)); + unitConverter.SetConversionFunction>(SpeedUnit.NanometerPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.NanometerPerSecond, q => q.ToUnit(SpeedUnit.NanometerPerSecond)); + unitConverter.SetConversionFunction>(SpeedUnit.NanometerPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.UsSurveyFootPerHour, q => q.ToUnit(SpeedUnit.UsSurveyFootPerHour)); + unitConverter.SetConversionFunction>(SpeedUnit.UsSurveyFootPerHour, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.UsSurveyFootPerMinute, q => q.ToUnit(SpeedUnit.UsSurveyFootPerMinute)); + unitConverter.SetConversionFunction>(SpeedUnit.UsSurveyFootPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.UsSurveyFootPerSecond, q => q.ToUnit(SpeedUnit.UsSurveyFootPerSecond)); + unitConverter.SetConversionFunction>(SpeedUnit.UsSurveyFootPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.YardPerHour, q => q.ToUnit(SpeedUnit.YardPerHour)); + unitConverter.SetConversionFunction>(SpeedUnit.YardPerHour, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.YardPerMinute, q => q.ToUnit(SpeedUnit.YardPerMinute)); + unitConverter.SetConversionFunction>(SpeedUnit.YardPerMinute, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Speed.BaseUnit, SpeedUnit.YardPerSecond, q => q.ToUnit(SpeedUnit.YardPerSecond)); + unitConverter.SetConversionFunction>(SpeedUnit.YardPerSecond, Speed.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Temperature.BaseUnit, TemperatureUnit.DegreeCelsius, q => q.ToUnit(TemperatureUnit.DegreeCelsius)); + unitConverter.SetConversionFunction>(TemperatureUnit.DegreeCelsius, Temperature.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Temperature.BaseUnit, TemperatureUnit.DegreeDelisle, q => q.ToUnit(TemperatureUnit.DegreeDelisle)); + unitConverter.SetConversionFunction>(TemperatureUnit.DegreeDelisle, Temperature.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Temperature.BaseUnit, TemperatureUnit.DegreeFahrenheit, q => q.ToUnit(TemperatureUnit.DegreeFahrenheit)); + unitConverter.SetConversionFunction>(TemperatureUnit.DegreeFahrenheit, Temperature.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Temperature.BaseUnit, TemperatureUnit.DegreeNewton, q => q.ToUnit(TemperatureUnit.DegreeNewton)); + unitConverter.SetConversionFunction>(TemperatureUnit.DegreeNewton, Temperature.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Temperature.BaseUnit, TemperatureUnit.DegreeRankine, q => q.ToUnit(TemperatureUnit.DegreeRankine)); + unitConverter.SetConversionFunction>(TemperatureUnit.DegreeRankine, Temperature.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Temperature.BaseUnit, TemperatureUnit.DegreeReaumur, q => q.ToUnit(TemperatureUnit.DegreeReaumur)); + unitConverter.SetConversionFunction>(TemperatureUnit.DegreeReaumur, Temperature.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Temperature.BaseUnit, TemperatureUnit.DegreeRoemer, q => q.ToUnit(TemperatureUnit.DegreeRoemer)); + unitConverter.SetConversionFunction>(TemperatureUnit.DegreeRoemer, Temperature.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Temperature.BaseUnit, Temperature.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Temperature.BaseUnit, TemperatureUnit.SolarTemperature, q => q.ToUnit(TemperatureUnit.SolarTemperature)); + unitConverter.SetConversionFunction>(TemperatureUnit.SolarTemperature, Temperature.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond, q => q.ToUnit(TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond)); + unitConverter.SetConversionFunction>(TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond, q => q.ToUnit(TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond)); + unitConverter.SetConversionFunction>(TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond, q => q.ToUnit(TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond)); + unitConverter.SetConversionFunction>(TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.DegreeCelsiusPerMinute, q => q.ToUnit(TemperatureChangeRateUnit.DegreeCelsiusPerMinute)); + unitConverter.SetConversionFunction>(TemperatureChangeRateUnit.DegreeCelsiusPerMinute, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureChangeRate.BaseUnit, TemperatureChangeRate.BaseUnit, q => q); + unitConverter.SetConversionFunction>(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond, q => q.ToUnit(TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond)); + unitConverter.SetConversionFunction>(TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond, q => q.ToUnit(TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond)); + unitConverter.SetConversionFunction>(TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond, q => q.ToUnit(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond)); + unitConverter.SetConversionFunction>(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond, q => q.ToUnit(TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond)); + unitConverter.SetConversionFunction>(TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureChangeRate.BaseUnit, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond, q => q.ToUnit(TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond)); + unitConverter.SetConversionFunction>(TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond, TemperatureChangeRate.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureDelta.BaseUnit, TemperatureDeltaUnit.DegreeCelsius, q => q.ToUnit(TemperatureDeltaUnit.DegreeCelsius)); + unitConverter.SetConversionFunction>(TemperatureDeltaUnit.DegreeCelsius, TemperatureDelta.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureDelta.BaseUnit, TemperatureDeltaUnit.DegreeDelisle, q => q.ToUnit(TemperatureDeltaUnit.DegreeDelisle)); + unitConverter.SetConversionFunction>(TemperatureDeltaUnit.DegreeDelisle, TemperatureDelta.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureDelta.BaseUnit, TemperatureDeltaUnit.DegreeFahrenheit, q => q.ToUnit(TemperatureDeltaUnit.DegreeFahrenheit)); + unitConverter.SetConversionFunction>(TemperatureDeltaUnit.DegreeFahrenheit, TemperatureDelta.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureDelta.BaseUnit, TemperatureDeltaUnit.DegreeNewton, q => q.ToUnit(TemperatureDeltaUnit.DegreeNewton)); + unitConverter.SetConversionFunction>(TemperatureDeltaUnit.DegreeNewton, TemperatureDelta.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureDelta.BaseUnit, TemperatureDeltaUnit.DegreeRankine, q => q.ToUnit(TemperatureDeltaUnit.DegreeRankine)); + unitConverter.SetConversionFunction>(TemperatureDeltaUnit.DegreeRankine, TemperatureDelta.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureDelta.BaseUnit, TemperatureDeltaUnit.DegreeReaumur, q => q.ToUnit(TemperatureDeltaUnit.DegreeReaumur)); + unitConverter.SetConversionFunction>(TemperatureDeltaUnit.DegreeReaumur, TemperatureDelta.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureDelta.BaseUnit, TemperatureDeltaUnit.DegreeRoemer, q => q.ToUnit(TemperatureDeltaUnit.DegreeRoemer)); + unitConverter.SetConversionFunction>(TemperatureDeltaUnit.DegreeRoemer, TemperatureDelta.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(TemperatureDelta.BaseUnit, TemperatureDelta.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ThermalConductivity.BaseUnit, ThermalConductivityUnit.BtuPerHourFootFahrenheit, q => q.ToUnit(ThermalConductivityUnit.BtuPerHourFootFahrenheit)); + unitConverter.SetConversionFunction>(ThermalConductivityUnit.BtuPerHourFootFahrenheit, ThermalConductivity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ThermalConductivity.BaseUnit, ThermalConductivity.BaseUnit, q => q); + unitConverter.SetConversionFunction>(ThermalResistance.BaseUnit, ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu, q => q.ToUnit(ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu)); + unitConverter.SetConversionFunction>(ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu, ThermalResistance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ThermalResistance.BaseUnit, ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie, q => q.ToUnit(ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie)); + unitConverter.SetConversionFunction>(ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie, ThermalResistance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ThermalResistance.BaseUnit, ThermalResistanceUnit.SquareCentimeterKelvinPerWatt, q => q.ToUnit(ThermalResistanceUnit.SquareCentimeterKelvinPerWatt)); + unitConverter.SetConversionFunction>(ThermalResistanceUnit.SquareCentimeterKelvinPerWatt, ThermalResistance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ThermalResistance.BaseUnit, ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt, q => q.ToUnit(ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt)); + unitConverter.SetConversionFunction>(ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt, ThermalResistance.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(ThermalResistance.BaseUnit, ThermalResistance.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.KilogramForceCentimeter, q => q.ToUnit(TorqueUnit.KilogramForceCentimeter)); + unitConverter.SetConversionFunction>(TorqueUnit.KilogramForceCentimeter, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.KilogramForceMeter, q => q.ToUnit(TorqueUnit.KilogramForceMeter)); + unitConverter.SetConversionFunction>(TorqueUnit.KilogramForceMeter, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.KilogramForceMillimeter, q => q.ToUnit(TorqueUnit.KilogramForceMillimeter)); + unitConverter.SetConversionFunction>(TorqueUnit.KilogramForceMillimeter, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.KilonewtonCentimeter, q => q.ToUnit(TorqueUnit.KilonewtonCentimeter)); + unitConverter.SetConversionFunction>(TorqueUnit.KilonewtonCentimeter, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.KilonewtonMeter, q => q.ToUnit(TorqueUnit.KilonewtonMeter)); + unitConverter.SetConversionFunction>(TorqueUnit.KilonewtonMeter, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.KilonewtonMillimeter, q => q.ToUnit(TorqueUnit.KilonewtonMillimeter)); + unitConverter.SetConversionFunction>(TorqueUnit.KilonewtonMillimeter, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.KilopoundForceFoot, q => q.ToUnit(TorqueUnit.KilopoundForceFoot)); + unitConverter.SetConversionFunction>(TorqueUnit.KilopoundForceFoot, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.KilopoundForceInch, q => q.ToUnit(TorqueUnit.KilopoundForceInch)); + unitConverter.SetConversionFunction>(TorqueUnit.KilopoundForceInch, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.MeganewtonCentimeter, q => q.ToUnit(TorqueUnit.MeganewtonCentimeter)); + unitConverter.SetConversionFunction>(TorqueUnit.MeganewtonCentimeter, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.MeganewtonMeter, q => q.ToUnit(TorqueUnit.MeganewtonMeter)); + unitConverter.SetConversionFunction>(TorqueUnit.MeganewtonMeter, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.MeganewtonMillimeter, q => q.ToUnit(TorqueUnit.MeganewtonMillimeter)); + unitConverter.SetConversionFunction>(TorqueUnit.MeganewtonMillimeter, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.MegapoundForceFoot, q => q.ToUnit(TorqueUnit.MegapoundForceFoot)); + unitConverter.SetConversionFunction>(TorqueUnit.MegapoundForceFoot, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.MegapoundForceInch, q => q.ToUnit(TorqueUnit.MegapoundForceInch)); + unitConverter.SetConversionFunction>(TorqueUnit.MegapoundForceInch, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.NewtonCentimeter, q => q.ToUnit(TorqueUnit.NewtonCentimeter)); + unitConverter.SetConversionFunction>(TorqueUnit.NewtonCentimeter, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, Torque.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.NewtonMillimeter, q => q.ToUnit(TorqueUnit.NewtonMillimeter)); + unitConverter.SetConversionFunction>(TorqueUnit.NewtonMillimeter, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.PoundForceFoot, q => q.ToUnit(TorqueUnit.PoundForceFoot)); + unitConverter.SetConversionFunction>(TorqueUnit.PoundForceFoot, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.PoundForceInch, q => q.ToUnit(TorqueUnit.PoundForceInch)); + unitConverter.SetConversionFunction>(TorqueUnit.PoundForceInch, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.TonneForceCentimeter, q => q.ToUnit(TorqueUnit.TonneForceCentimeter)); + unitConverter.SetConversionFunction>(TorqueUnit.TonneForceCentimeter, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.TonneForceMeter, q => q.ToUnit(TorqueUnit.TonneForceMeter)); + unitConverter.SetConversionFunction>(TorqueUnit.TonneForceMeter, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Torque.BaseUnit, TorqueUnit.TonneForceMillimeter, q => q.ToUnit(TorqueUnit.TonneForceMillimeter)); + unitConverter.SetConversionFunction>(TorqueUnit.TonneForceMillimeter, Torque.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VitaminA.BaseUnit, VitaminA.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.AcreFoot, q => q.ToUnit(VolumeUnit.AcreFoot)); + unitConverter.SetConversionFunction>(VolumeUnit.AcreFoot, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.AuTablespoon, q => q.ToUnit(VolumeUnit.AuTablespoon)); + unitConverter.SetConversionFunction>(VolumeUnit.AuTablespoon, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.Centiliter, q => q.ToUnit(VolumeUnit.Centiliter)); + unitConverter.SetConversionFunction>(VolumeUnit.Centiliter, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.CubicCentimeter, q => q.ToUnit(VolumeUnit.CubicCentimeter)); + unitConverter.SetConversionFunction>(VolumeUnit.CubicCentimeter, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.CubicDecimeter, q => q.ToUnit(VolumeUnit.CubicDecimeter)); + unitConverter.SetConversionFunction>(VolumeUnit.CubicDecimeter, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.CubicFoot, q => q.ToUnit(VolumeUnit.CubicFoot)); + unitConverter.SetConversionFunction>(VolumeUnit.CubicFoot, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.CubicHectometer, q => q.ToUnit(VolumeUnit.CubicHectometer)); + unitConverter.SetConversionFunction>(VolumeUnit.CubicHectometer, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.CubicInch, q => q.ToUnit(VolumeUnit.CubicInch)); + unitConverter.SetConversionFunction>(VolumeUnit.CubicInch, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.CubicKilometer, q => q.ToUnit(VolumeUnit.CubicKilometer)); + unitConverter.SetConversionFunction>(VolumeUnit.CubicKilometer, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, Volume.BaseUnit, q => q); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.CubicMicrometer, q => q.ToUnit(VolumeUnit.CubicMicrometer)); + unitConverter.SetConversionFunction>(VolumeUnit.CubicMicrometer, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.CubicMile, q => q.ToUnit(VolumeUnit.CubicMile)); + unitConverter.SetConversionFunction>(VolumeUnit.CubicMile, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.CubicMillimeter, q => q.ToUnit(VolumeUnit.CubicMillimeter)); + unitConverter.SetConversionFunction>(VolumeUnit.CubicMillimeter, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.CubicYard, q => q.ToUnit(VolumeUnit.CubicYard)); + unitConverter.SetConversionFunction>(VolumeUnit.CubicYard, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.Deciliter, q => q.ToUnit(VolumeUnit.Deciliter)); + unitConverter.SetConversionFunction>(VolumeUnit.Deciliter, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.HectocubicFoot, q => q.ToUnit(VolumeUnit.HectocubicFoot)); + unitConverter.SetConversionFunction>(VolumeUnit.HectocubicFoot, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.HectocubicMeter, q => q.ToUnit(VolumeUnit.HectocubicMeter)); + unitConverter.SetConversionFunction>(VolumeUnit.HectocubicMeter, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.Hectoliter, q => q.ToUnit(VolumeUnit.Hectoliter)); + unitConverter.SetConversionFunction>(VolumeUnit.Hectoliter, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.ImperialBeerBarrel, q => q.ToUnit(VolumeUnit.ImperialBeerBarrel)); + unitConverter.SetConversionFunction>(VolumeUnit.ImperialBeerBarrel, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.ImperialGallon, q => q.ToUnit(VolumeUnit.ImperialGallon)); + unitConverter.SetConversionFunction>(VolumeUnit.ImperialGallon, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.ImperialOunce, q => q.ToUnit(VolumeUnit.ImperialOunce)); + unitConverter.SetConversionFunction>(VolumeUnit.ImperialOunce, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.ImperialPint, q => q.ToUnit(VolumeUnit.ImperialPint)); + unitConverter.SetConversionFunction>(VolumeUnit.ImperialPint, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.KilocubicFoot, q => q.ToUnit(VolumeUnit.KilocubicFoot)); + unitConverter.SetConversionFunction>(VolumeUnit.KilocubicFoot, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.KilocubicMeter, q => q.ToUnit(VolumeUnit.KilocubicMeter)); + unitConverter.SetConversionFunction>(VolumeUnit.KilocubicMeter, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.KiloimperialGallon, q => q.ToUnit(VolumeUnit.KiloimperialGallon)); + unitConverter.SetConversionFunction>(VolumeUnit.KiloimperialGallon, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.Kiloliter, q => q.ToUnit(VolumeUnit.Kiloliter)); + unitConverter.SetConversionFunction>(VolumeUnit.Kiloliter, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.KilousGallon, q => q.ToUnit(VolumeUnit.KilousGallon)); + unitConverter.SetConversionFunction>(VolumeUnit.KilousGallon, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.Liter, q => q.ToUnit(VolumeUnit.Liter)); + unitConverter.SetConversionFunction>(VolumeUnit.Liter, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.MegacubicFoot, q => q.ToUnit(VolumeUnit.MegacubicFoot)); + unitConverter.SetConversionFunction>(VolumeUnit.MegacubicFoot, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.MegaimperialGallon, q => q.ToUnit(VolumeUnit.MegaimperialGallon)); + unitConverter.SetConversionFunction>(VolumeUnit.MegaimperialGallon, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.Megaliter, q => q.ToUnit(VolumeUnit.Megaliter)); + unitConverter.SetConversionFunction>(VolumeUnit.Megaliter, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.MegausGallon, q => q.ToUnit(VolumeUnit.MegausGallon)); + unitConverter.SetConversionFunction>(VolumeUnit.MegausGallon, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.MetricCup, q => q.ToUnit(VolumeUnit.MetricCup)); + unitConverter.SetConversionFunction>(VolumeUnit.MetricCup, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.MetricTeaspoon, q => q.ToUnit(VolumeUnit.MetricTeaspoon)); + unitConverter.SetConversionFunction>(VolumeUnit.MetricTeaspoon, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.Microliter, q => q.ToUnit(VolumeUnit.Microliter)); + unitConverter.SetConversionFunction>(VolumeUnit.Microliter, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.Milliliter, q => q.ToUnit(VolumeUnit.Milliliter)); + unitConverter.SetConversionFunction>(VolumeUnit.Milliliter, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.OilBarrel, q => q.ToUnit(VolumeUnit.OilBarrel)); + unitConverter.SetConversionFunction>(VolumeUnit.OilBarrel, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.UkTablespoon, q => q.ToUnit(VolumeUnit.UkTablespoon)); + unitConverter.SetConversionFunction>(VolumeUnit.UkTablespoon, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.UsBeerBarrel, q => q.ToUnit(VolumeUnit.UsBeerBarrel)); + unitConverter.SetConversionFunction>(VolumeUnit.UsBeerBarrel, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.UsCustomaryCup, q => q.ToUnit(VolumeUnit.UsCustomaryCup)); + unitConverter.SetConversionFunction>(VolumeUnit.UsCustomaryCup, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.UsGallon, q => q.ToUnit(VolumeUnit.UsGallon)); + unitConverter.SetConversionFunction>(VolumeUnit.UsGallon, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.UsLegalCup, q => q.ToUnit(VolumeUnit.UsLegalCup)); + unitConverter.SetConversionFunction>(VolumeUnit.UsLegalCup, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.UsOunce, q => q.ToUnit(VolumeUnit.UsOunce)); + unitConverter.SetConversionFunction>(VolumeUnit.UsOunce, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.UsPint, q => q.ToUnit(VolumeUnit.UsPint)); + unitConverter.SetConversionFunction>(VolumeUnit.UsPint, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.UsQuart, q => q.ToUnit(VolumeUnit.UsQuart)); + unitConverter.SetConversionFunction>(VolumeUnit.UsQuart, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.UsTablespoon, q => q.ToUnit(VolumeUnit.UsTablespoon)); + unitConverter.SetConversionFunction>(VolumeUnit.UsTablespoon, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(Volume.BaseUnit, VolumeUnit.UsTeaspoon, q => q.ToUnit(VolumeUnit.UsTeaspoon)); + unitConverter.SetConversionFunction>(VolumeUnit.UsTeaspoon, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.CentilitersPerLiter, q => q.ToUnit(VolumeConcentrationUnit.CentilitersPerLiter)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.CentilitersPerLiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.CentilitersPerMililiter, q => q.ToUnit(VolumeConcentrationUnit.CentilitersPerMililiter)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.CentilitersPerMililiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.DecilitersPerLiter, q => q.ToUnit(VolumeConcentrationUnit.DecilitersPerLiter)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.DecilitersPerLiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.DecilitersPerMililiter, q => q.ToUnit(VolumeConcentrationUnit.DecilitersPerMililiter)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.DecilitersPerMililiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentration.BaseUnit, q => q); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.LitersPerLiter, q => q.ToUnit(VolumeConcentrationUnit.LitersPerLiter)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.LitersPerLiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.LitersPerMililiter, q => q.ToUnit(VolumeConcentrationUnit.LitersPerMililiter)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.LitersPerMililiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.MicrolitersPerLiter, q => q.ToUnit(VolumeConcentrationUnit.MicrolitersPerLiter)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.MicrolitersPerLiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.MicrolitersPerMililiter, q => q.ToUnit(VolumeConcentrationUnit.MicrolitersPerMililiter)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.MicrolitersPerMililiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.MillilitersPerLiter, q => q.ToUnit(VolumeConcentrationUnit.MillilitersPerLiter)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.MillilitersPerLiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.MillilitersPerMililiter, q => q.ToUnit(VolumeConcentrationUnit.MillilitersPerMililiter)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.MillilitersPerMililiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.NanolitersPerLiter, q => q.ToUnit(VolumeConcentrationUnit.NanolitersPerLiter)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.NanolitersPerLiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.NanolitersPerMililiter, q => q.ToUnit(VolumeConcentrationUnit.NanolitersPerMililiter)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.NanolitersPerMililiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.PartPerBillion, q => q.ToUnit(VolumeConcentrationUnit.PartPerBillion)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.PartPerBillion, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.PartPerMillion, q => q.ToUnit(VolumeConcentrationUnit.PartPerMillion)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.PartPerMillion, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.PartPerThousand, q => q.ToUnit(VolumeConcentrationUnit.PartPerThousand)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.PartPerThousand, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.PartPerTrillion, q => q.ToUnit(VolumeConcentrationUnit.PartPerTrillion)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.PartPerTrillion, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.Percent, q => q.ToUnit(VolumeConcentrationUnit.Percent)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.Percent, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.PicolitersPerLiter, q => q.ToUnit(VolumeConcentrationUnit.PicolitersPerLiter)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.PicolitersPerLiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeConcentration.BaseUnit, VolumeConcentrationUnit.PicolitersPerMililiter, q => q.ToUnit(VolumeConcentrationUnit.PicolitersPerMililiter)); + unitConverter.SetConversionFunction>(VolumeConcentrationUnit.PicolitersPerMililiter, VolumeConcentration.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.AcreFootPerDay, q => q.ToUnit(VolumeFlowUnit.AcreFootPerDay)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.AcreFootPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.AcreFootPerHour, q => q.ToUnit(VolumeFlowUnit.AcreFootPerHour)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.AcreFootPerHour, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.AcreFootPerMinute, q => q.ToUnit(VolumeFlowUnit.AcreFootPerMinute)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.AcreFootPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.AcreFootPerSecond, q => q.ToUnit(VolumeFlowUnit.AcreFootPerSecond)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.AcreFootPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.CentiliterPerDay, q => q.ToUnit(VolumeFlowUnit.CentiliterPerDay)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.CentiliterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.CentiliterPerMinute, q => q.ToUnit(VolumeFlowUnit.CentiliterPerMinute)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.CentiliterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicDecimeterPerMinute, q => q.ToUnit(VolumeFlowUnit.CubicDecimeterPerMinute)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.CubicDecimeterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicFootPerHour, q => q.ToUnit(VolumeFlowUnit.CubicFootPerHour)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.CubicFootPerHour, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicFootPerMinute, q => q.ToUnit(VolumeFlowUnit.CubicFootPerMinute)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.CubicFootPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicFootPerSecond, q => q.ToUnit(VolumeFlowUnit.CubicFootPerSecond)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.CubicFootPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicMeterPerDay, q => q.ToUnit(VolumeFlowUnit.CubicMeterPerDay)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.CubicMeterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicMeterPerHour, q => q.ToUnit(VolumeFlowUnit.CubicMeterPerHour)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.CubicMeterPerHour, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicMeterPerMinute, q => q.ToUnit(VolumeFlowUnit.CubicMeterPerMinute)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.CubicMeterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlow.BaseUnit, q => q); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicMillimeterPerSecond, q => q.ToUnit(VolumeFlowUnit.CubicMillimeterPerSecond)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.CubicMillimeterPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicYardPerDay, q => q.ToUnit(VolumeFlowUnit.CubicYardPerDay)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.CubicYardPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicYardPerHour, q => q.ToUnit(VolumeFlowUnit.CubicYardPerHour)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.CubicYardPerHour, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicYardPerMinute, q => q.ToUnit(VolumeFlowUnit.CubicYardPerMinute)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.CubicYardPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.CubicYardPerSecond, q => q.ToUnit(VolumeFlowUnit.CubicYardPerSecond)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.CubicYardPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.DeciliterPerDay, q => q.ToUnit(VolumeFlowUnit.DeciliterPerDay)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.DeciliterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.DeciliterPerMinute, q => q.ToUnit(VolumeFlowUnit.DeciliterPerMinute)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.DeciliterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.KiloliterPerDay, q => q.ToUnit(VolumeFlowUnit.KiloliterPerDay)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.KiloliterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.KiloliterPerMinute, q => q.ToUnit(VolumeFlowUnit.KiloliterPerMinute)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.KiloliterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.KilousGallonPerMinute, q => q.ToUnit(VolumeFlowUnit.KilousGallonPerMinute)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.KilousGallonPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.LiterPerDay, q => q.ToUnit(VolumeFlowUnit.LiterPerDay)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.LiterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.LiterPerHour, q => q.ToUnit(VolumeFlowUnit.LiterPerHour)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.LiterPerHour, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.LiterPerMinute, q => q.ToUnit(VolumeFlowUnit.LiterPerMinute)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.LiterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.LiterPerSecond, q => q.ToUnit(VolumeFlowUnit.LiterPerSecond)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.LiterPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.MegaliterPerDay, q => q.ToUnit(VolumeFlowUnit.MegaliterPerDay)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.MegaliterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.MegaukGallonPerSecond, q => q.ToUnit(VolumeFlowUnit.MegaukGallonPerSecond)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.MegaukGallonPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.MicroliterPerDay, q => q.ToUnit(VolumeFlowUnit.MicroliterPerDay)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.MicroliterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.MicroliterPerMinute, q => q.ToUnit(VolumeFlowUnit.MicroliterPerMinute)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.MicroliterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.MilliliterPerDay, q => q.ToUnit(VolumeFlowUnit.MilliliterPerDay)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.MilliliterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.MilliliterPerMinute, q => q.ToUnit(VolumeFlowUnit.MilliliterPerMinute)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.MilliliterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.MillionUsGallonsPerDay, q => q.ToUnit(VolumeFlowUnit.MillionUsGallonsPerDay)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.MillionUsGallonsPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.NanoliterPerDay, q => q.ToUnit(VolumeFlowUnit.NanoliterPerDay)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.NanoliterPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.NanoliterPerMinute, q => q.ToUnit(VolumeFlowUnit.NanoliterPerMinute)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.NanoliterPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.OilBarrelPerDay, q => q.ToUnit(VolumeFlowUnit.OilBarrelPerDay)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.OilBarrelPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.OilBarrelPerHour, q => q.ToUnit(VolumeFlowUnit.OilBarrelPerHour)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.OilBarrelPerHour, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.OilBarrelPerMinute, q => q.ToUnit(VolumeFlowUnit.OilBarrelPerMinute)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.OilBarrelPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.OilBarrelPerSecond, q => q.ToUnit(VolumeFlowUnit.OilBarrelPerSecond)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.OilBarrelPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.UkGallonPerDay, q => q.ToUnit(VolumeFlowUnit.UkGallonPerDay)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.UkGallonPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.UkGallonPerHour, q => q.ToUnit(VolumeFlowUnit.UkGallonPerHour)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.UkGallonPerHour, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.UkGallonPerMinute, q => q.ToUnit(VolumeFlowUnit.UkGallonPerMinute)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.UkGallonPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.UkGallonPerSecond, q => q.ToUnit(VolumeFlowUnit.UkGallonPerSecond)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.UkGallonPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.UsGallonPerDay, q => q.ToUnit(VolumeFlowUnit.UsGallonPerDay)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.UsGallonPerDay, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.UsGallonPerHour, q => q.ToUnit(VolumeFlowUnit.UsGallonPerHour)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.UsGallonPerHour, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.UsGallonPerMinute, q => q.ToUnit(VolumeFlowUnit.UsGallonPerMinute)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.UsGallonPerMinute, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumeFlow.BaseUnit, VolumeFlowUnit.UsGallonPerSecond, q => q.ToUnit(VolumeFlowUnit.UsGallonPerSecond)); + unitConverter.SetConversionFunction>(VolumeFlowUnit.UsGallonPerSecond, VolumeFlow.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumePerLength.BaseUnit, VolumePerLength.BaseUnit, q => q); + unitConverter.SetConversionFunction>(VolumePerLength.BaseUnit, VolumePerLengthUnit.LiterPerMeter, q => q.ToUnit(VolumePerLengthUnit.LiterPerMeter)); + unitConverter.SetConversionFunction>(VolumePerLengthUnit.LiterPerMeter, VolumePerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction>(VolumePerLength.BaseUnit, VolumePerLengthUnit.OilBarrelPerFoot, q => q.ToUnit(VolumePerLengthUnit.OilBarrelPerFoot)); + unitConverter.SetConversionFunction>(VolumePerLengthUnit.OilBarrelPerFoot, VolumePerLength.BaseUnit, q => q.ToBaseUnit()); } } } diff --git a/UnitsNet/IQuantity.cs b/UnitsNet/IQuantity.cs index 60f522e93f..a102e79217 100644 --- a/UnitsNet/IQuantity.cs +++ b/UnitsNet/IQuantity.cs @@ -31,7 +31,7 @@ public interface IQuantity : IFormattable /// /// Gets the value in the given unit. /// - /// The unit enum value. The unit must be compatible, so for you should provide a value. + /// The unit enum value. The unit must be compatible, so for you should provide a value. /// Value converted to the specified unit. /// Wrong unit enum type was given. double As(Enum unit); @@ -57,7 +57,7 @@ public interface IQuantity : IFormattable /// /// Converts to a quantity with the given unit representation, which affects things like . /// - /// The unit enum value. The unit must be compatible, so for you should provide a value. + /// The unit enum value. The unit must be compatible, so for you should provide a value. /// A new quantity with the given unit. IQuantity ToUnit(Enum unit); diff --git a/UnitsNet/QuantityInfo.cs b/UnitsNet/QuantityInfo.cs index 2dcdd4cb21..291db14583 100644 --- a/UnitsNet/QuantityInfo.cs +++ b/UnitsNet/QuantityInfo.cs @@ -23,7 +23,7 @@ public class QuantityInfo { private static readonly string UnitEnumNamespace = typeof(LengthUnit).Namespace; - private static readonly Type[] UnitEnumTypes = typeof(Length) + private static readonly Type[] UnitEnumTypes = typeof(Length) .Wrap() .Assembly .GetExportedTypes() @@ -106,7 +106,7 @@ public QuantityInfo(QuantityType quantityType, [NotNull] UnitInfo[] unitInfos, [ public Enum BaseUnit { get; } /// - /// Zero value of quantity, such as . + /// Zero value of quantity, such as . /// public IQuantity Zero { get; } @@ -116,7 +116,7 @@ public QuantityInfo(QuantityType quantityType, [NotNull] UnitInfo[] unitInfos, [ public Type UnitType { get; } /// - /// Quantity value type, such as or . + /// Quantity value type, such as or . /// public Type ValueType { get; } @@ -171,8 +171,8 @@ public IEnumerable GetUnitInfosFor(BaseUnits baseUnits) /// /// /// This is a specialization of , for when the unit type is known. - /// Typically you obtain this by looking it up statically from or - /// , or dynamically via . + /// Typically you obtain this by looking it up statically from or + /// , or dynamically via . /// /// The unit enum type, such as . public class QuantityInfo : QuantityInfo diff --git a/UnitsNet/QuantityNotFoundException.cs b/UnitsNet/QuantityNotFoundException.cs index 78ce500b9e..ec813e5103 100644 --- a/UnitsNet/QuantityNotFoundException.cs +++ b/UnitsNet/QuantityNotFoundException.cs @@ -7,7 +7,7 @@ namespace UnitsNet { /// /// Quantity type was not found. This is typically thrown for dynamic conversions, - /// such as . + /// such as . /// [Obsolete("")] public class QuantityNotFoundException : UnitsNetException diff --git a/UnitsNet/QuantityTypeConverter.cs b/UnitsNet/QuantityTypeConverter.cs index 63bb261d7e..5bb7951693 100644 --- a/UnitsNet/QuantityTypeConverter.cs +++ b/UnitsNet/QuantityTypeConverter.cs @@ -80,7 +80,7 @@ public DisplayAsUnitAttribute(object unitType, string format = "") : base(unitTy /// /// For basic understanding of TypeConverters consult the .NET documentation. /// - /// Quantity value type, such as or . + /// Quantity value type, such as or . /// /// /// When a string is converted a Quantity the unit given by the string is used. @@ -150,7 +150,7 @@ private static TAttribute GetAttribute(ITypeDescriptorContext contex QuantityType expected = default(TQuantity).Type; QuantityType actual = QuantityType.Undefined; - if (attribute.UnitType != null) actual = Quantity.From(1, attribute.UnitType).Type; + if (attribute.UnitType != null) actual = Quantity.From(1, attribute.UnitType).Type; if (actual != QuantityType.Undefined && expected != actual) { throw new ArgumentException($"The specified UnitType:'{attribute.UnitType}' dose not match QuantityType:'{expected}'"); @@ -180,11 +180,11 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c { DefaultUnitAttribute defaultUnit = GetAttribute(context) ?? new DefaultUnitAttribute(default(TQuantity).Unit); - result = Quantity.From(dvalue, defaultUnit.UnitType); + result = Quantity.From(dvalue, defaultUnit.UnitType); } else { - result = Quantity.Parse(culture, typeof(TQuantity), stringValue); + result = Quantity.Parse(culture, typeof(TQuantity), stringValue); } ConvertToUnitAttribute convertToUnit = GetAttribute(context); diff --git a/UnitsNet/UnitConverter.cs b/UnitsNet/UnitConverter.cs index b9641f03ce..4665bcb524 100644 --- a/UnitsNet/UnitConverter.cs +++ b/UnitsNet/UnitConverter.cs @@ -32,19 +32,19 @@ public delegate TQuantity ConversionFunction(TQuantity inputValue) /// Convert between units of a quantity, such as converting from meters to centimeters of a given length. /// [PublicAPI] - public sealed partial class UnitConverter + public sealed partial class UnitConverter { /// /// The static instance used by Units.NET to convert between units. Modify this to add/remove conversion functions at runtime, such /// as adding your own third-party units and quantities to convert between. /// - public static UnitConverter Default { get; } + public static UnitConverter Default { get; } private readonly Dictionary _conversionFunctions = new Dictionary(); static UnitConverter() { - Default = new UnitConverter(); + Default = new UnitConverter(); RegisterDefaultConversions(Default); } @@ -237,7 +237,7 @@ public bool TryGetConversionFunction(ConversionFunctionLookupKey lookupKey, out public static double Convert(QuantityValue fromValue, Enum fromUnitValue, Enum toUnitValue) { return Quantity - .From(fromValue, fromUnitValue) + .From( fromValue, fromUnitValue) .As(toUnitValue); } @@ -252,7 +252,7 @@ public static double Convert(QuantityValue fromValue, Enum fromUnitValue, Enum t public static bool TryConvert(QuantityValue fromValue, Enum fromUnitValue, Enum toUnitValue, out double convertedValue) { convertedValue = 0; - if (!Quantity.TryFrom(fromValue, fromUnitValue, out IQuantity fromQuantity)) return false; + if (!Quantity.TryFrom( fromValue, fromUnitValue, out IQuantity fromQuantity)) return false; try { @@ -431,7 +431,7 @@ public static double ConvertByAbbreviation(QuantityValue fromValue, string quant var cultureInfo = string.IsNullOrWhiteSpace(culture) ? CultureInfo.CurrentUICulture : new CultureInfo(culture); var fromUnit = UnitParser.Default.Parse(fromUnitAbbrev, unitType, cultureInfo); // ex: ("m", LengthUnit) => LengthUnit.Meter - var fromQuantity = Quantity.From(fromValue, fromUnit); + var fromQuantity = Quantity.From( fromValue, fromUnit); var toUnit = UnitParser.Default.Parse(toUnitAbbrev, unitType, cultureInfo); // ex:("cm", LengthUnit) => LengthUnit.Centimeter return fromQuantity.As(toUnit); @@ -513,7 +513,7 @@ public static bool TryConvertByAbbreviation(QuantityValue fromValue, string quan if (!UnitParser.Default.TryParse(toUnitAbbrev, unitType, cultureInfo, out Enum toUnit)) // ex:("cm", LengthUnit) => LengthUnit.Centimeter return false; - var fromQuantity = Quantity.From(fromValue, fromUnit); + var fromQuantity = Quantity.From( fromValue, fromUnit); result = fromQuantity.As(toUnit); return true; diff --git a/UnitsNet/UnitMath.cs b/UnitsNet/UnitMath.cs index 2d1eec758a..ddcebd7e99 100644 --- a/UnitsNet/UnitMath.cs +++ b/UnitsNet/UnitMath.cs @@ -19,10 +19,10 @@ public static class UnitMath /// /// source contains quantity types different from . /// - public static TQuantity Sum(this IEnumerable source, Enum unitType) + public static TQuantity Sum(this IEnumerable source, Enum unitType) where TQuantity : IQuantity { - return (TQuantity) Quantity.From(source.Sum(x => x.As(unitType)), unitType); + return (TQuantity) Quantity.From( source.Sum(x => x.As(unitType)), unitType); } /// @@ -34,6 +34,7 @@ public static TQuantity Sum(this IEnumerable source, Enum /// The desired unit type for the resulting quantity /// The type of the elements of source. /// The type of quantity that is produced by this operation + /// The type of the quantity value (float, double, decimal, etc.) /// The sum of the projected values, represented in the specified unit type. /// /// source or selector is null. @@ -41,10 +42,10 @@ public static TQuantity Sum(this IEnumerable source, Enum /// /// source contains quantity types different from . /// - public static TQuantity Sum(this IEnumerable source, Func selector, Enum unitType) + public static TQuantity Sum(this IEnumerable source, Func selector, Enum unitType) where TQuantity : IQuantity { - return source.Select(selector).Sum(unitType); + return source.Select(selector).Sum(unitType); } /// Computes the min of a sequence of values. @@ -58,10 +59,10 @@ public static TQuantity Sum(this IEnumerable source /// /// source contains quantity types different from . /// - public static TQuantity Min(this IEnumerable source, Enum unitType) + public static TQuantity Min(this IEnumerable source, Enum unitType) where TQuantity : IQuantity { - return (TQuantity) Quantity.From(source.Min(x => x.As(unitType)), unitType); + return (TQuantity) Quantity.From( source.Min(x => x.As(unitType)), unitType); } /// @@ -73,6 +74,7 @@ public static TQuantity Min(this IEnumerable source, Enum /// The desired unit type for the resulting quantity /// The type of the elements of source. /// The type of quantity that is produced by this operation + /// The type of the quantity value (float, double, decimal, etc.) /// The min of the projected values, represented in the specified unit type. /// /// source or selector is null. @@ -81,10 +83,10 @@ public static TQuantity Min(this IEnumerable source, Enum /// /// source contains quantity types different from . /// - public static TQuantity Min(this IEnumerable source, Func selector, Enum unitType) + public static TQuantity Min(this IEnumerable source, Func selector, Enum unitType) where TQuantity : IQuantity { - return source.Select(selector).Min(unitType); + return source.Select(selector).Min(unitType); } /// Computes the max of a sequence of values. @@ -98,10 +100,10 @@ public static TQuantity Min(this IEnumerable source /// /// source contains quantity types different from . /// - public static TQuantity Max(this IEnumerable source, Enum unitType) + public static TQuantity Max(this IEnumerable source, Enum unitType) where TQuantity : IQuantity { - return (TQuantity) Quantity.From(source.Max(x => x.As(unitType)), unitType); + return (TQuantity) Quantity.From( source.Max(x => x.As(unitType)), unitType); } /// @@ -113,6 +115,7 @@ public static TQuantity Max(this IEnumerable source, Enum /// The desired unit type for the resulting quantity /// The type of the elements of source. /// The type of quantity that is produced by this operation + /// The type of the quantity value (float, double, decimal, etc.) /// The max of the projected values, represented in the specified unit type. /// /// source or selector is null. @@ -121,10 +124,10 @@ public static TQuantity Max(this IEnumerable source, Enum /// /// source contains quantity types different from . /// - public static TQuantity Max(this IEnumerable source, Func selector, Enum unitType) + public static TQuantity Max(this IEnumerable source, Func selector, Enum unitType) where TQuantity : IQuantity { - return source.Select(selector).Max(unitType); + return source.Select(selector).Max(unitType); } /// Computes the average of a sequence of values. @@ -138,10 +141,10 @@ public static TQuantity Max(this IEnumerable source /// /// source contains quantity types different from . /// - public static TQuantity Average(this IEnumerable source, Enum unitType) + public static TQuantity Average(this IEnumerable source, Enum unitType) where TQuantity : IQuantity { - return (TQuantity) Quantity.From(source.Average(x => x.As(unitType)), unitType); + return (TQuantity) Quantity.From( source.Average(x => x.As(unitType)), unitType); } /// @@ -153,6 +156,7 @@ public static TQuantity Average(this IEnumerable source, E /// The desired unit type for the resulting quantity /// The type of the elements of source. /// The type of quantity that is produced by this operation + /// The type of the quantity value (float, double, decimal, etc.) /// The average of the projected values, represented in the specified unit type. /// /// source or selector is null. @@ -161,10 +165,10 @@ public static TQuantity Average(this IEnumerable source, E /// /// source contains quantity types different from . /// - public static TQuantity Average(this IEnumerable source, Func selector, Enum unitType) + public static TQuantity Average(this IEnumerable source, Func selector, Enum unitType) where TQuantity : IQuantity { - return source.Select(selector).Average(unitType); + return source.Select(selector).Average( unitType); } } } diff --git a/UnitsNet/UnitNotFoundException.cs b/UnitsNet/UnitNotFoundException.cs index 0a1001e273..e15c9a062c 100644 --- a/UnitsNet/UnitNotFoundException.cs +++ b/UnitsNet/UnitNotFoundException.cs @@ -1,4 +1,4 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. +// Licensed under MIT No Attribution, see LICENSE file at the root. // Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. using System; @@ -7,7 +7,7 @@ namespace UnitsNet { /// /// Unit was not found. This is typically thrown for dynamic conversions, - /// such as . + /// such as . /// public class UnitNotFoundException : UnitsNetException { From 3f0aaa1269f1476be6d05316faf1ce54f6265bd4 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 22 Oct 2019 16:01:34 -0400 Subject: [PATCH 09/13] Updating tests to generics --- .../IQuantityTestClassGenerator.cs | 10 +- .../UnitsNetGen/StaticQuantityGenerator.cs | 2 +- .../UnitsNetGen/UnitConverterGenerator.cs | 4 +- .../UnitsNetGen/UnitTestBaseClassGenerator.cs | 76 +- UnitsNet.Benchmark/Program.cs | 22 +- .../UnitsNetJsonConverterTests.cs | 54 +- .../UnitsNetJsonConverter.cs | 2 +- UnitsNet.Tests/AssemblyAttributeTests.cs | 4 +- UnitsNet.Tests/BaseDimensionsTests.cs | 44 +- .../CustomCode/AccelerationTests.cs | 4 +- .../CustomCode/AmountOfSubstanceTests.cs | 34 +- .../CustomCode/AmplitudeRatioTests.cs | 24 +- UnitsNet.Tests/CustomCode/AngleTests.cs | 8 +- .../CustomCode/AreaMomentOfInertiaTests.cs | 4 +- UnitsNet.Tests/CustomCode/AreaTests.cs | 26 +- .../BrakeSpecificFuelConsumptionTests.cs | 8 +- UnitsNet.Tests/CustomCode/DensityTests.cs | 20 +- UnitsNet.Tests/CustomCode/DurationTests.cs | 74 +- .../CustomCode/DynamicViscosityTests.cs | 4 +- UnitsNet.Tests/CustomCode/EnergyTests.cs | 6 +- .../CustomCode/ForcePerLengthTests.cs | 12 +- UnitsNet.Tests/CustomCode/ForceTests.cs | 32 +- UnitsNet.Tests/CustomCode/HeatFluxTests.cs | 12 +- UnitsNet.Tests/CustomCode/IQuantityTests.cs | 12 +- UnitsNet.Tests/CustomCode/InformationTests.cs | 6 +- .../CustomCode/KinematicViscosityTests.cs | 24 +- UnitsNet.Tests/CustomCode/LapseRateTests.cs | 16 +- .../CustomCode/LengthTests.FeetInches.cs | 10 +- UnitsNet.Tests/CustomCode/LengthTests.cs | 54 +- UnitsNet.Tests/CustomCode/LevelTests.cs | 10 +- .../CustomCode/MassConcentrationTests.cs | 22 +- UnitsNet.Tests/CustomCode/MassFlowTests.cs | 30 +- UnitsNet.Tests/CustomCode/MassFluxTests.cs | 12 +- .../CustomCode/MassFractionTests.cs | 14 +- UnitsNet.Tests/CustomCode/MassTests.cs | 30 +- UnitsNet.Tests/CustomCode/MolarityTests.cs | 24 +- UnitsNet.Tests/CustomCode/ParseTests.cs | 30 +- UnitsNet.Tests/CustomCode/PowerRatioTests.cs | 22 +- UnitsNet.Tests/CustomCode/PowerTests.cs | 38 +- UnitsNet.Tests/CustomCode/PressureTests.cs | 16 +- .../CustomCode/RotationalSpeedTests.cs | 16 +- .../CustomCode/SpecificEnergyTests.cs | 12 +- .../CustomCode/SpecificVolumeTests.cs | 8 +- .../CustomCode/SpecificWeightTests.cs | 12 +- UnitsNet.Tests/CustomCode/SpeedTests.cs | 48 +- UnitsNet.Tests/CustomCode/StonePoundsTests.cs | 8 +- .../CustomCode/TemperatureDeltaTests.cs | 4 +- UnitsNet.Tests/CustomCode/TemperatureTests.cs | 80 +- UnitsNet.Tests/CustomCode/TorqueTests.cs | 8 +- .../CustomCode/VolumeConcentrationTests.cs | 15 +- UnitsNet.Tests/CustomCode/VolumeFlowTests.cs | 24 +- UnitsNet.Tests/CustomCode/VolumeTests.cs | 22 +- UnitsNet.Tests/DecimalOverloadTests.cs | 4 +- .../GeneratedCode/AccelerationTestsBase.g.cs | 118 +-- .../AmountOfSubstanceTestsBase.g.cs | 128 +-- .../AmplitudeRatioTestsBase.g.cs | 80 +- .../GeneratedCode/AngleTestsBase.g.cs | 124 +-- .../ApparentEnergyTestsBase.g.cs | 80 +- .../GeneratedCode/ApparentPowerTestsBase.g.cs | 82 +- .../GeneratedCode/AreaDensityTestsBase.g.cs | 72 +- .../AreaMomentOfInertiaTestsBase.g.cs | 90 +- .../GeneratedCode/AreaTestsBase.g.cs | 122 +-- .../GeneratedCode/BitRateTestsBase.g.cs | 158 ++-- ...BrakeSpecificFuelConsumptionTestsBase.g.cs | 80 +- .../GeneratedCode/CapacitanceTestsBase.g.cs | 94 +-- ...oefficientOfThermalExpansionTestsBase.g.cs | 78 +- .../GeneratedCode/DensityTestsBase.g.cs | 228 ++--- .../GeneratedCode/DurationTestsBase.g.cs | 106 +-- .../DynamicViscosityTestsBase.g.cs | 102 +-- .../ElectricAdmittanceTestsBase.g.cs | 82 +- .../ElectricChargeDensityTestsBase.g.cs | 72 +- .../ElectricChargeTestsBase.g.cs | 86 +- .../ElectricConductanceTestsBase.g.cs | 78 +- .../ElectricConductivityTestsBase.g.cs | 78 +- .../ElectricCurrentDensityTestsBase.g.cs | 80 +- .../ElectricCurrentGradientTestsBase.g.cs | 70 +- .../ElectricCurrentTestsBase.g.cs | 98 +-- .../GeneratedCode/ElectricFieldTestsBase.g.cs | 70 +- .../ElectricInductanceTestsBase.g.cs | 82 +- .../ElectricPotentialAcTestsBase.g.cs | 86 +- .../ElectricPotentialDcTestsBase.g.cs | 86 +- .../ElectricPotentialTestsBase.g.cs | 88 +- .../ElectricResistanceTestsBase.g.cs | 86 +- .../ElectricResistivityTestsBase.g.cs | 122 +-- ...ElectricSurfaceChargeDensityTestsBase.g.cs | 80 +- .../GeneratedCode/EnergyTestsBase.g.cs | 164 ++-- .../GeneratedCode/EntropyTestsBase.g.cs | 94 +-- .../ForceChangeRateTestsBase.g.cs | 110 +-- .../ForcePerLengthTestsBase.g.cs | 114 +-- .../GeneratedCode/ForceTestsBase.g.cs | 118 +-- .../GeneratedCode/FrequencyTestsBase.g.cs | 102 +-- .../FuelEfficiencyTestsBase.g.cs | 82 +- .../GeneratedCode/HeatFluxTestsBase.g.cs | 138 +-- .../HeatTransferCoefficientTestsBase.g.cs | 78 +- .../GeneratedCode/IQuantityTests.g.cs | 784 +++++++++--------- .../GeneratedCode/IlluminanceTestsBase.g.cs | 82 +- .../GeneratedCode/InformationTestsBase.g.cs | 160 ++-- .../GeneratedCode/IrradianceTestsBase.g.cs | 122 +-- .../GeneratedCode/IrradiationTestsBase.g.cs | 94 +-- .../KinematicViscosityTestsBase.g.cs | 98 +-- .../GeneratedCode/LapseRateTestsBase.g.cs | 72 +- .../GeneratedCode/LengthTestsBase.g.cs | 194 ++--- .../GeneratedCode/LevelTestsBase.g.cs | 72 +- .../GeneratedCode/LinearDensityTestsBase.g.cs | 80 +- .../GeneratedCode/LuminosityTestsBase.g.cs | 122 +-- .../GeneratedCode/LuminousFluxTestsBase.g.cs | 70 +- .../LuminousIntensityTestsBase.g.cs | 70 +- .../GeneratedCode/MagneticFieldTestsBase.g.cs | 82 +- .../GeneratedCode/MagneticFluxTestsBase.g.cs | 70 +- .../GeneratedCode/MagnetizationTestsBase.g.cs | 70 +- .../MassConcentrationTestsBase.g.cs | 226 ++--- .../GeneratedCode/MassFlowTestsBase.g.cs | 200 ++--- .../GeneratedCode/MassFluxTestsBase.g.cs | 76 +- .../GeneratedCode/MassFractionTestsBase.g.cs | 162 ++-- .../MassMomentOfInertiaTestsBase.g.cs | 178 ++-- .../GeneratedCode/MassTestsBase.g.cs | 166 ++-- .../GeneratedCode/MolarEnergyTestsBase.g.cs | 80 +- .../GeneratedCode/MolarEntropyTestsBase.g.cs | 78 +- .../GeneratedCode/MolarMassTestsBase.g.cs | 114 +-- .../GeneratedCode/MolarityTestsBase.g.cs | 98 +-- .../GeneratedCode/PermeabilityTestsBase.g.cs | 70 +- .../GeneratedCode/PermittivityTestsBase.g.cs | 70 +- .../GeneratedCode/PowerDensityTestsBase.g.cs | 244 +++--- .../GeneratedCode/PowerRatioTestsBase.g.cs | 72 +- .../GeneratedCode/PowerTestsBase.g.cs | 134 +-- .../PressureChangeRateTestsBase.g.cs | 94 +-- .../GeneratedCode/PressureTestsBase.g.cs | 236 +++--- .../RatioChangeRateTestsBase.g.cs | 74 +- .../GeneratedCode/RatioTestsBase.g.cs | 90 +- .../ReactiveEnergyTestsBase.g.cs | 80 +- .../GeneratedCode/ReactivePowerTestsBase.g.cs | 82 +- .../RotationalAccelerationTestsBase.g.cs | 82 +- .../RotationalSpeedTestsBase.g.cs | 118 +-- ...RotationalStiffnessPerLengthTestsBase.g.cs | 78 +- .../RotationalStiffnessTestsBase.g.cs | 78 +- .../GeneratedCode/SolidAngleTestsBase.g.cs | 72 +- .../SpecificEnergyTestsBase.g.cs | 104 +-- .../SpecificEntropyTestsBase.g.cs | 102 +-- .../SpecificVolumeTestsBase.g.cs | 80 +- .../SpecificWeightTestsBase.g.cs | 134 +-- .../GeneratedCode/SpeedTestsBase.g.cs | 194 ++--- .../TemperatureChangeRateTestsBase.g.cs | 106 +-- .../TemperatureDeltaTestsBase.g.cs | 100 +-- .../GeneratedCode/TemperatureTestsBase.g.cs | 96 +-- .../ThermalConductivityTestsBase.g.cs | 74 +- .../ThermalResistanceTestsBase.g.cs | 86 +- .../GeneratedCode/TorqueTestsBase.g.cs | 152 ++-- .../GeneratedCode/VitaminATestsBase.g.cs | 70 +- .../VolumeConcentrationTestsBase.g.cs | 146 ++-- .../GeneratedCode/VolumeFlowTestsBase.g.cs | 264 +++--- .../VolumePerLengthTestsBase.g.cs | 78 +- .../GeneratedCode/VolumeTestsBase.g.cs | 256 +++--- UnitsNet.Tests/GeneratedQuantityCodeTests.cs | 8 +- UnitsNet.Tests/IntOverloadTests.cs | 4 +- UnitsNet.Tests/InterUnitConversionTests.cs | 8 +- UnitsNet.Tests/LongOverloadTests.cs | 4 +- UnitsNet.Tests/QuantityIConvertibleTests.cs | 20 +- UnitsNet.Tests/QuantityIFormattableTests.cs | 4 +- UnitsNet.Tests/QuantityInfoTest.cs | 40 +- UnitsNet.Tests/QuantityTest.cs | 64 +- UnitsNet.Tests/QuantityTests.Ctor.cs | 246 +++--- UnitsNet.Tests/QuantityTests.ToString.cs | 60 +- UnitsNet.Tests/QuantityTests.cs | 10 +- UnitsNet.Tests/QuantityTypeConverterTest.cs | 96 +-- UnitsNet.Tests/UnitAbbreviationsCacheTests.cs | 106 +-- UnitsNet.Tests/UnitConverterTest.cs | 88 +- UnitsNet.Tests/UnitMathTests.cs | 98 +-- UnitsNet.Tests/UnitParserTests.cs | 6 +- UnitsNet/GeneratedCode/Quantity.g.cs | 2 +- 169 files changed, 6701 insertions(+), 6702 deletions(-) diff --git a/CodeGen/Generators/UnitsNetGen/IQuantityTestClassGenerator.cs b/CodeGen/Generators/UnitsNetGen/IQuantityTestClassGenerator.cs index 5469bfc504..2fda7899f6 100644 --- a/CodeGen/Generators/UnitsNetGen/IQuantityTestClassGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/IQuantityTestClassGenerator.cs @@ -1,4 +1,4 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. +// Licensed under MIT No Attribution, see LICENSE file at the root. // Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. using System; @@ -45,7 +45,7 @@ void Assertion(int expectedValue, Enum expectedUnit, IQuantity quantity) // Example: LengthUnit.Centimeter var unitEnumNameAndValue = $"{quantity.Name}Unit.{lastUnit.SingularName}"; Writer.WL($@" - Assertion(3, {unitEnumNameAndValue}, Quantity.From(3, {unitEnumNameAndValue}));"); + Assertion(3, {unitEnumNameAndValue}, Quantity.From(3, {unitEnumNameAndValue}));"); } Writer.WL($@" }} @@ -56,7 +56,7 @@ public void QuantityInfo_IsSameAsStaticInfoProperty() void Assertion(QuantityInfo expected, IQuantity quantity) => Assert.Same(expected, quantity.QuantityInfo); "); foreach (var quantity in _quantities) Writer.WL($@" - Assertion({quantity.Name}.Info, {quantity.Name}.Zero);"); + Assertion({quantity.Name}.Info, {quantity.Name}.Zero);"); Writer.WL($@" }} @@ -66,7 +66,7 @@ public void Type_EqualsStaticQuantityTypeProperty() void Assertion(QuantityType expected, IQuantity quantity) => Assert.Equal(expected, quantity.Type); "); foreach (var quantity in _quantities) Writer.WL($@" - Assertion({quantity.Name}.QuantityType, {quantity.Name}.Zero);"); + Assertion({quantity.Name}.QuantityType, {quantity.Name}.Zero);" ); Writer.WL($@" }} @@ -76,7 +76,7 @@ public void Dimensions_IsSameAsStaticBaseDimensions() void Assertion(BaseDimensions expected, IQuantity quantity) => Assert.Equal(expected, quantity.Dimensions); "); foreach (var quantity in _quantities) Writer.WL($@" - Assertion({quantity.Name}.BaseDimensions, {quantity.Name}.Zero);"); + Assertion({quantity.Name}.BaseDimensions, {quantity.Name}.Zero);" ); Writer.WL($@" }} }} diff --git a/CodeGen/Generators/UnitsNetGen/StaticQuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/StaticQuantityGenerator.cs index a3b5d522ae..673623b9ea 100644 --- a/CodeGen/Generators/UnitsNetGen/StaticQuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/StaticQuantityGenerator.cs @@ -88,7 +88,7 @@ public static bool TryFrom(QuantityValue value, Enum unit, out IQuantity quan /// Try to dynamically parse a quantity string representation. /// /// The format provider to use for lookup. Defaults to if null. - /// Type of quantity, such as . + /// Type of quantity, such as . /// Quantity string representation, such as ""1.5 kg"". Must be compatible with given quantity type. /// The resulting quantity if successful, otherwise default. /// The parsed quantity. diff --git a/CodeGen/Generators/UnitsNetGen/UnitConverterGenerator.cs b/CodeGen/Generators/UnitsNetGen/UnitConverterGenerator.cs index 72346ae768..a54acfa1fd 100644 --- a/CodeGen/Generators/UnitsNetGen/UnitConverterGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/UnitConverterGenerator.cs @@ -29,9 +29,9 @@ namespace UnitsNet public sealed partial class UnitConverter {{ /// - /// Registers the default conversion functions in the given instance. + /// Registers the default conversion functions in the given instance. /// - /// The to register the default conversion functions in. + /// The to register the default conversion functions in. public static void RegisterDefaultConversions(UnitConverter unitConverter) {{" ); foreach (Quantity quantity in _quantities) diff --git a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs index 41f6edb63f..7036e2e1f5 100644 --- a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using CodeGen.JsonTypes; @@ -55,28 +55,28 @@ public abstract partial class {_quantity.Name}TestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() {{ - Assert.Throws(() => new {_quantity.Name}(({_quantity.BaseType})0.0, {_unitEnumName}.Undefined)); + Assert.Throws(() => new {_quantity.Name}(({_quantity.BaseType})0.0, {_unitEnumName}.Undefined)); }} "); if (_quantity.BaseType == "double") Writer.WL($@" [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() {{ - Assert.Throws(() => new {_quantity.Name}(double.PositiveInfinity, {_unitEnumName}.{_baseUnit.SingularName})); - Assert.Throws(() => new {_quantity.Name}(double.NegativeInfinity, {_unitEnumName}.{_baseUnit.SingularName})); + Assert.Throws(() => new {_quantity.Name}(double.PositiveInfinity, {_unitEnumName}.{_baseUnit.SingularName})); + Assert.Throws(() => new {_quantity.Name}(double.NegativeInfinity, {_unitEnumName}.{_baseUnit.SingularName})); }} [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() {{ - Assert.Throws(() => new {_quantity.Name}(double.NaN, {_unitEnumName}.{_baseUnit.SingularName})); + Assert.Throws(() => new {_quantity.Name}(double.NaN, {_unitEnumName}.{_baseUnit.SingularName})); }} "); Writer.WL($@" [Fact] public void {_baseUnit.SingularName}To{_quantity.Name}Units() {{ - {_quantity.Name} {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1);"); + {_quantity.Name} {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1);"); foreach (var unit in _quantity.Units) Writer.WL($@" AssertEx.EqualTolerance({unit.PluralName}InOne{_baseUnit.SingularName}, {baseUnitVariableName}.{unit.PluralName}, {unit.PluralName}Tolerance);"); @@ -87,7 +87,7 @@ public void Ctor_WithNaNValue_ThrowsArgumentException() public void FromValueAndUnit() {{"); foreach (var unit in _quantity.Units) Writer.WL($@" - AssertEx.EqualTolerance(1, {_quantity.Name}.From(1, {_unitEnumName}.{unit.SingularName}).{unit.PluralName}, {unit.PluralName}Tolerance);"); + AssertEx.EqualTolerance(1, {_quantity.Name}.From(1, {_unitEnumName}.{unit.SingularName}).{unit.PluralName}, {unit.PluralName}Tolerance);"); Writer.WL($@" }} "); @@ -95,21 +95,21 @@ public void FromValueAndUnit() [Fact] public void From{_baseUnit.PluralName}_WithInfinityValue_ThrowsArgumentException() {{ - Assert.Throws(() => {_quantity.Name}.From{_baseUnit.PluralName}(double.PositiveInfinity)); - Assert.Throws(() => {_quantity.Name}.From{_baseUnit.PluralName}(double.NegativeInfinity)); + Assert.Throws(() => {_quantity.Name}.From{_baseUnit.PluralName}(double.PositiveInfinity)); + Assert.Throws(() => {_quantity.Name}.From{_baseUnit.PluralName}(double.NegativeInfinity)); }} [Fact] public void From{_baseUnit.PluralName}_WithNanValue_ThrowsArgumentException() {{ - Assert.Throws(() => {_quantity.Name}.From{_baseUnit.PluralName}(double.NaN)); + Assert.Throws(() => {_quantity.Name}.From{_baseUnit.PluralName}(double.NaN)); }} "); Writer.WL($@" [Fact] public void As() {{ - var {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1);"); + var {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1);"); foreach (var unit in _quantity.Units) Writer.WL($@" AssertEx.EqualTolerance({unit.PluralName}InOne{_baseUnit.SingularName}, {baseUnitVariableName}.As({_unitEnumName}.{unit.SingularName}), {unit.PluralName}Tolerance);"); Writer.WL($@" @@ -118,7 +118,7 @@ public void As() [Fact] public void ToUnit() {{ - var {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1);"); + var {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1);"); foreach (var unit in _quantity.Units) { var asQuantityVariableName = $"{unit.SingularName.ToLowerInvariant()}Quantity"; @@ -135,9 +135,9 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() {{ - {_quantity.Name} {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1);"); + {_quantity.Name} {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1);"); foreach (var unit in _quantity.Units) Writer.WL($@" - AssertEx.EqualTolerance(1, {_quantity.Name}.From{unit.PluralName}({baseUnitVariableName}.{unit.PluralName}).{_baseUnit.PluralName}, {unit.PluralName}Tolerance);"); + AssertEx.EqualTolerance(1, {_quantity.Name}.From{unit.PluralName}({baseUnitVariableName}.{unit.PluralName}).{_baseUnit.PluralName}, {unit.PluralName}Tolerance);"); Writer.WL($@" }} "); @@ -148,14 +148,14 @@ public void ConversionRoundTrip() [Fact] public void LogarithmicArithmeticOperators() {{ - {_quantity.Name} v = {_quantity.Name}.From{_baseUnit.PluralName}(40); + {_quantity.Name} v = {_quantity.Name}.From{_baseUnit.PluralName}(40); AssertEx.EqualTolerance(-40, -v.{_baseUnit.PluralName}, {unit.PluralName}Tolerance); AssertLogarithmicAddition(); AssertLogarithmicSubtraction(); AssertEx.EqualTolerance(50, (v*10).{_baseUnit.PluralName}, {unit.PluralName}Tolerance); AssertEx.EqualTolerance(50, (10*v).{_baseUnit.PluralName}, {unit.PluralName}Tolerance); AssertEx.EqualTolerance(35, (v/5).{_baseUnit.PluralName}, {unit.PluralName}Tolerance); - AssertEx.EqualTolerance(35, v/{_quantity.Name}.From{_baseUnit.PluralName}(5), {unit.PluralName}Tolerance); + AssertEx.EqualTolerance(35, v/{_quantity.Name}.From{_baseUnit.PluralName}(5), {unit.PluralName}Tolerance); }} protected abstract void AssertLogarithmicAddition(); @@ -169,14 +169,14 @@ public void LogarithmicArithmeticOperators() [Fact] public void ArithmeticOperators() {{ - {_quantity.Name} v = {_quantity.Name}.From{_baseUnit.PluralName}(1); + {_quantity.Name} v = {_quantity.Name}.From{_baseUnit.PluralName}(1); AssertEx.EqualTolerance(-1, -v.{_baseUnit.PluralName}, {_baseUnit.PluralName}Tolerance); - AssertEx.EqualTolerance(2, ({_quantity.Name}.From{_baseUnit.PluralName}(3)-v).{_baseUnit.PluralName}, {_baseUnit.PluralName}Tolerance); + AssertEx.EqualTolerance(2, ({_quantity.Name}.From{_baseUnit.PluralName}(3)-v).{_baseUnit.PluralName}, {_baseUnit.PluralName}Tolerance); AssertEx.EqualTolerance(2, (v + v).{_baseUnit.PluralName}, {_baseUnit.PluralName}Tolerance); AssertEx.EqualTolerance(10, (v*10).{_baseUnit.PluralName}, {_baseUnit.PluralName}Tolerance); AssertEx.EqualTolerance(10, (10*v).{_baseUnit.PluralName}, {_baseUnit.PluralName}Tolerance); - AssertEx.EqualTolerance(2, ({_quantity.Name}.From{_baseUnit.PluralName}(10)/5).{_baseUnit.PluralName}, {_baseUnit.PluralName}Tolerance); - AssertEx.EqualTolerance(2, {_quantity.Name}.From{_baseUnit.PluralName}(10)/{_quantity.Name}.From{_baseUnit.PluralName}(5), {_baseUnit.PluralName}Tolerance); + AssertEx.EqualTolerance(2, ({_quantity.Name}.From{_baseUnit.PluralName}(10)/5).{_baseUnit.PluralName}, {_baseUnit.PluralName}Tolerance); + AssertEx.EqualTolerance(2, {_quantity.Name}.From{_baseUnit.PluralName}(10)/{_quantity.Name}.From{_baseUnit.PluralName}(5), {_baseUnit.PluralName}Tolerance); }} "); } @@ -189,8 +189,8 @@ public void ArithmeticOperators() [Fact] public void ComparisonOperators() {{ - {_quantity.Name} one{_baseUnit.SingularName} = {_quantity.Name}.From{_baseUnit.PluralName}(1); - {_quantity.Name} two{_baseUnit.PluralName} = {_quantity.Name}.From{_baseUnit.PluralName}(2); + {_quantity.Name} one{_baseUnit.SingularName} = {_quantity.Name}.From{_baseUnit.PluralName}(1); + {_quantity.Name} two{_baseUnit.PluralName} = {_quantity.Name}.From{_baseUnit.PluralName}(2); Assert.True(one{_baseUnit.SingularName} < two{_baseUnit.PluralName}); Assert.True(one{_baseUnit.SingularName} <= two{_baseUnit.PluralName}); @@ -206,31 +206,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() {{ - {_quantity.Name} {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1); + {_quantity.Name} {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1); Assert.Equal(0, {baseUnitVariableName}.CompareTo({baseUnitVariableName})); - Assert.True({baseUnitVariableName}.CompareTo({_quantity.Name}.Zero) > 0); - Assert.True({_quantity.Name}.Zero.CompareTo({baseUnitVariableName}) < 0); + Assert.True({baseUnitVariableName}.CompareTo({_quantity.Name}.Zero) > 0); + Assert.True({_quantity.Name}.Zero.CompareTo({baseUnitVariableName}) < 0); }} [Fact] public void CompareToThrowsOnTypeMismatch() {{ - {_quantity.Name} {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1); + {_quantity.Name} {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1); Assert.Throws(() => {baseUnitVariableName}.CompareTo(new object())); }} [Fact] public void CompareToThrowsOnNull() {{ - {_quantity.Name} {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1); + {_quantity.Name} {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1); Assert.Throws(() => {baseUnitVariableName}.CompareTo(null)); }} [Fact] public void EqualityOperators() {{ - var a = {_quantity.Name}.From{_baseUnit.PluralName}(1); - var b = {_quantity.Name}.From{_baseUnit.PluralName}(2); + var a = {_quantity.Name}.From{_baseUnit.PluralName}(1); + var b = {_quantity.Name}.From{_baseUnit.PluralName}(2); // ReSharper disable EqualExpressionComparison @@ -249,8 +249,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() {{ - var a = {_quantity.Name}.From{_baseUnit.PluralName}(1); - var b = {_quantity.Name}.From{_baseUnit.PluralName}(2); + var a = {_quantity.Name}.From{_baseUnit.PluralName}(1); + var b = {_quantity.Name}.From{_baseUnit.PluralName}(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -260,29 +260,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() {{ - var v = {_quantity.Name}.From{_baseUnit.PluralName}(1); - Assert.True(v.Equals({_quantity.Name}.From{_baseUnit.PluralName}(1), {_baseUnit.PluralName}Tolerance, ComparisonType.Relative)); - Assert.False(v.Equals({_quantity.Name}.Zero, {_baseUnit.PluralName}Tolerance, ComparisonType.Relative)); + var v = {_quantity.Name}.From{_baseUnit.PluralName}(1); + Assert.True(v.Equals({_quantity.Name}.From{_baseUnit.PluralName}(1), {_baseUnit.PluralName}Tolerance, ComparisonType.Relative)); + Assert.False(v.Equals({_quantity.Name}.Zero, {_baseUnit.PluralName}Tolerance, ComparisonType.Relative)); }} [Fact] public void EqualsReturnsFalseOnTypeMismatch() {{ - {_quantity.Name} {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1); + {_quantity.Name} {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1); Assert.False({baseUnitVariableName}.Equals(new object())); }} [Fact] public void EqualsReturnsFalseOnNull() {{ - {_quantity.Name} {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1); + {_quantity.Name} {baseUnitVariableName} = {_quantity.Name}.From{_baseUnit.PluralName}(1); Assert.False({baseUnitVariableName}.Equals(null)); }} [Fact] public void UnitsDoesNotContainUndefined() {{ - Assert.DoesNotContain({_unitEnumName}.Undefined, {_quantity.Name}.Units); + Assert.DoesNotContain({_unitEnumName}.Undefined, {_quantity.Name}.Units); }} [Fact] @@ -301,7 +301,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() {{ - Assert.False({_quantity.Name}.BaseDimensions is null); + Assert.False({_quantity.Name}.BaseDimensions is null); }} }} }}"); diff --git a/UnitsNet.Benchmark/Program.cs b/UnitsNet.Benchmark/Program.cs index d51d42b653..ef54d50b36 100644 --- a/UnitsNet.Benchmark/Program.cs +++ b/UnitsNet.Benchmark/Program.cs @@ -7,17 +7,17 @@ namespace UnitsNet.Benchmark [MemoryDiagnoser] public class UnitsNetBenchmarks { - private Length length = Length.FromMeters(3.0); - private IQuantity lengthIQuantity = Length.FromMeters(3.0); + private Length length = Length.FromMeters(3.0); + private IQuantity lengthIQuantity = Length.FromMeters(3.0); [Benchmark] - public Length Constructor() => new Length(3.0, LengthUnit.Meter); + public Length Constructor() => new Length( 3.0, LengthUnit.Meter); [Benchmark] - public Length Constructor_SI() => new Length(3.0, UnitSystem.SI); + public Length Constructor_SI() => new Length( 3.0, UnitSystem.SI); [Benchmark] - public Length FromMethod() => Length.FromMeters(3.0); + public Length FromMethod() => Length.FromMeters(3.0); [Benchmark] public double ToProperty() => length.Centimeters; @@ -29,25 +29,25 @@ public class UnitsNetBenchmarks public double As_SI() => length.As(UnitSystem.SI); [Benchmark] - public Length ToUnit() => length.ToUnit(LengthUnit.Centimeter); + public Length ToUnit() => length.ToUnit(LengthUnit.Centimeter); [Benchmark] - public Length ToUnit_SI() => length.ToUnit(UnitSystem.SI); + public Length ToUnit_SI() => length.ToUnit(UnitSystem.SI); [Benchmark] public string ToStringTest() => length.ToString(); [Benchmark] - public Length Parse() => Length.Parse("3.0 m"); + public Length Parse() => Length.Parse("3.0 m"); [Benchmark] - public bool TryParseValid() => Length.TryParse("3.0 m", out var l); + public bool TryParseValid() => Length.TryParse("3.0 m", out var l); [Benchmark] - public bool TryParseInvalid() => Length.TryParse("3.0 zoom", out var l); + public bool TryParseInvalid() => Length.TryParse("3.0 zoom", out var l); [Benchmark] - public IQuantity QuantityFrom() => Quantity.From(3.0, LengthUnit.Meter); + public IQuantity QuantityFrom() => Quantity.From( 3.0, LengthUnit.Meter); [Benchmark] public double IQuantity_As() => lengthIQuantity.As(LengthUnit.Centimeter); diff --git a/UnitsNet.Serialization.JsonNet.Tests/UnitsNetJsonConverterTests.cs b/UnitsNet.Serialization.JsonNet.Tests/UnitsNetJsonConverterTests.cs index 8e7f32f592..b7add15df3 100644 --- a/UnitsNet.Serialization.JsonNet.Tests/UnitsNetJsonConverterTests.cs +++ b/UnitsNet.Serialization.JsonNet.Tests/UnitsNetJsonConverterTests.cs @@ -32,7 +32,7 @@ public class Serialize : UnitsNetJsonConverterTests [Fact] public void Information_CanSerializeVeryLargeValues() { - Information i = Information.FromExabytes(1E+9); + Information i = Information.FromExabytes(1E+9); var expectedJson = "{\n \"Unit\": \"InformationUnit.Exabyte\",\n \"Value\": 1000000000.0\n}"; string json = SerializeObject(i); @@ -43,7 +43,7 @@ public void Information_CanSerializeVeryLargeValues() [Fact] public void Mass_ExpectConstructedValueAndUnit() { - Mass mass = Mass.FromPounds(200); + Mass mass = Mass.FromPounds(200); var expectedJson = "{\n \"Unit\": \"MassUnit.Pound\",\n \"Value\": 200.0\n}"; string json = SerializeObject(mass); @@ -54,7 +54,7 @@ public void Mass_ExpectConstructedValueAndUnit() [Fact] public void Information_ExpectConstructedValueAndUnit() { - Information quantity = Information.FromKilobytes(54); + Information quantity = Information.FromKilobytes(54); var expectedJson = "{\n \"Unit\": \"InformationUnit.Kilobyte\",\n \"Value\": 54.0\n}"; string json = SerializeObject(quantity); @@ -65,7 +65,7 @@ public void Information_ExpectConstructedValueAndUnit() [Fact] public void NonNullNullableValue_ExpectJsonUnaffected() { - Mass? nullableMass = Mass.FromKilograms(10); + Mass? nullableMass = Mass.FromKilograms(10); var expectedJson = "{\n \"Unit\": \"MassUnit.Kilogram\",\n \"Value\": 10.0\n}"; string json = SerializeObject(nullableMass); @@ -79,8 +79,8 @@ public void NonNullNullableValueNestedInObject_ExpectJsonUnaffected() { var testObj = new TestObj { - NullableFrequency = Frequency.FromHertz(10), - NonNullableFrequency = Frequency.FromHertz(10) + NullableFrequency = Frequency.FromHertz(10), + NonNullableFrequency = Frequency.FromHertz(10) }; // Ugly manually formatted JSON string is used because string literals with newlines are rendered differently // on the build server (i.e. the build server uses '\r' instead of '\n') @@ -110,7 +110,7 @@ public void NullValue_ExpectJsonContainsNullString() [Fact] public void Ratio_ExpectDecimalFractionsUsedAsBaseValueAndUnit() { - Ratio ratio = Ratio.FromPartsPerThousand(250); + Ratio ratio = Ratio.FromPartsPerThousand(250); var expectedJson = "{\n \"Unit\": \"RatioUnit.PartPerThousand\",\n \"Value\": 250.0\n}"; string json = SerializeObject(ratio); @@ -124,9 +124,9 @@ public class Deserialize : UnitsNetJsonConverterTests [Fact] public void Information_CanDeserializeVeryLargeValues() { - Information original = Information.FromExabytes(1E+9); + Information original = Information.FromExabytes(1E+9); string json = SerializeObject(original); - var deserialized = DeserializeObject(json); + var deserialized = DeserializeObject>(json); Assert.Equal(original, deserialized); } @@ -134,10 +134,10 @@ public void Information_CanDeserializeVeryLargeValues() [Fact] public void Mass_ExpectJsonCorrectlyDeserialized() { - Mass originalMass = Mass.FromKilograms(33.33); + Mass originalMass = Mass.FromKilograms(33.33); string json = SerializeObject(originalMass); - var deserializedMass = DeserializeObject(json); + var deserializedMass = DeserializeObject>(json); Assert.Equal(originalMass, deserializedMass); } @@ -145,10 +145,10 @@ public void Mass_ExpectJsonCorrectlyDeserialized() [Fact] public void NonNullNullableValue_ExpectValueDeserializedCorrectly() { - Mass? nullableMass = Mass.FromKilograms(10); + Mass? nullableMass = Mass.FromKilograms(10); string json = SerializeObject(nullableMass); - Mass? deserializedNullableMass = DeserializeObject(json); + Mass? deserializedNullableMass = DeserializeObject?>(json); Assert.Equal(nullableMass.Value, deserializedNullableMass); } @@ -158,8 +158,8 @@ public void NonNullNullableValueNestedInObject_ExpectValueDeserializedCorrectly( { var testObj = new TestObj { - NullableFrequency = Frequency.FromHertz(10), - NonNullableFrequency = Frequency.FromHertz(10) + NullableFrequency = Frequency.FromHertz(10), + NonNullableFrequency = Frequency.FromHertz(10) }; string json = SerializeObject(testObj); @@ -172,7 +172,7 @@ public void NonNullNullableValueNestedInObject_ExpectValueDeserializedCorrectly( public void NullValue_ExpectNullReturned() { string json = SerializeObject(null); - var deserializedNullMass = DeserializeObject(json); + var deserializedNullMass = DeserializeObject?>(json); Assert.Null(deserializedNullMass); } @@ -183,7 +183,7 @@ public void NullValueNestedInObject_ExpectValueDeserializedToNullCorrectly() var testObj = new TestObj { NullableFrequency = null, - NonNullableFrequency = Frequency.FromHertz(10) + NonNullableFrequency = Frequency.FromHertz(10) }; string json = SerializeObject(testObj); @@ -195,13 +195,13 @@ public void NullValueNestedInObject_ExpectValueDeserializedToNullCorrectly() [Fact] public void UnitEnumChangedAfterSerialization_ExpectUnitCorrectlyDeserialized() { - Mass originalMass = Mass.FromKilograms(33.33); + Mass originalMass = Mass.FromKilograms(33.33); string json = SerializeObject(originalMass); // Someone manually changed the serialized JSON string to 1000 grams. json = json.Replace("33.33", "1000"); json = json.Replace("MassUnit.Kilogram", "MassUnit.Gram"); - var deserializedMass = DeserializeObject(json); + var deserializedMass = DeserializeObject>(json); // The original value serialized was 33.33 kg, but someone edited the JSON to be 1000 g. We expect the JSON is // still deserializable, and the correct value of 1000 g is obtained. @@ -213,7 +213,7 @@ public void UnitInIComparable_ExpectUnitCorrectlyDeserialized() { TestObjWithIComparable testObjWithIComparable = new TestObjWithIComparable() { - Value = Power.FromWatts(10) + Value = Power.FromWatts(10) }; JsonSerializerSettings jsonSerializerSettings = CreateJsonSerializerSettings(); @@ -221,8 +221,8 @@ public void UnitInIComparable_ExpectUnitCorrectlyDeserialized() var deserializedTestObject = JsonConvert.DeserializeObject(json,jsonSerializerSettings); - Assert.Equal(typeof(Power), deserializedTestObject.Value.GetType()); - Assert.Equal(Power.FromWatts(10), (Power)deserializedTestObject.Value); + Assert.Equal(typeof(Power), deserializedTestObject.Value.GetType()); + Assert.Equal(Power.FromWatts(10), (Power)deserializedTestObject.Value); } [Fact] @@ -282,7 +282,7 @@ public void ThreeObjectsInIComparableWithDifferentValues_ExpectAllCorrectlyDeser TestObjWithThreeIComparable testObjWithIComparable = new TestObjWithThreeIComparable() { Value1 = 10.0, - Value2 = Power.FromWatts(19), + Value2 = Power.FromWatts(19), Value3 = new ComparableClass() { Value = 10 }, }; JsonSerializerSettings jsonSerializerSettings = CreateJsonSerializerSettings(); @@ -292,8 +292,8 @@ public void ThreeObjectsInIComparableWithDifferentValues_ExpectAllCorrectlyDeser Assert.Equal(typeof(double), deserializedTestObject.Value1.GetType()); Assert.Equal(10d, deserializedTestObject.Value1); - Assert.Equal(typeof(Power), deserializedTestObject.Value2.GetType()); - Assert.Equal(Power.FromWatts(19), deserializedTestObject.Value2); + Assert.Equal(typeof(Power), deserializedTestObject.Value2.GetType()); + Assert.Equal(Power.FromWatts(19), deserializedTestObject.Value2); Assert.Equal(typeof(ComparableClass), deserializedTestObject.Value3.GetType()); Assert.Equal(testObjWithIComparable.Value3, deserializedTestObject.Value3); } @@ -312,8 +312,8 @@ private static JsonSerializerSettings CreateJsonSerializerSettings() private class TestObj { - public Frequency? NullableFrequency { get; set; } - public Frequency NonNullableFrequency { get; set; } + public Frequency? NullableFrequency { get; set; } + public Frequency NonNullableFrequency { get; set; } } private class TestObjWithValueAndUnit : IComparable diff --git a/UnitsNet.Serialization.JsonNet/UnitsNetJsonConverter.cs b/UnitsNet.Serialization.JsonNet/UnitsNetJsonConverter.cs index 50de04d529..d9311e3f7d 100644 --- a/UnitsNet.Serialization.JsonNet/UnitsNetJsonConverter.cs +++ b/UnitsNet.Serialization.JsonNet/UnitsNetJsonConverter.cs @@ -63,7 +63,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist double value = vu.Value; Enum unitValue = (Enum)Enum.Parse(unitEnumType, unitEnumValue); // Ex: MassUnit.Kilogram - return Quantity.From(value, unitValue); + return Quantity.From(value, unitValue); } private static object TryDeserializeIComparable(JsonReader reader, JsonSerializer serializer) diff --git a/UnitsNet.Tests/AssemblyAttributeTests.cs b/UnitsNet.Tests/AssemblyAttributeTests.cs index 754846727d..d836dc0479 100644 --- a/UnitsNet.Tests/AssemblyAttributeTests.cs +++ b/UnitsNet.Tests/AssemblyAttributeTests.cs @@ -13,7 +13,7 @@ public class AssemblyAttributeTests [Fact] public static void AssemblyShouldBeClsCompliant() { - var assembly = typeof(Length).GetTypeInfo().Assembly; + var assembly = typeof(Length).GetTypeInfo().Assembly; var attributes = assembly.CustomAttributes.Select(x => x.AttributeType); Assert.Contains(typeof(CLSCompliantAttribute), attributes); @@ -22,7 +22,7 @@ public static void AssemblyShouldBeClsCompliant() [Fact] public static void AssemblyCopyrightShouldContain2013() { - var assembly = typeof(Length).GetTypeInfo().Assembly; + var assembly = typeof(Length).GetTypeInfo().Assembly; var copyrightAttribute = assembly .CustomAttributes diff --git a/UnitsNet.Tests/BaseDimensionsTests.cs b/UnitsNet.Tests/BaseDimensionsTests.cs index 9c0b593590..fa134d7d3b 100644 --- a/UnitsNet.Tests/BaseDimensionsTests.cs +++ b/UnitsNet.Tests/BaseDimensionsTests.cs @@ -379,35 +379,35 @@ public void LuminousIntensityDimensionsDivideCorrectly() [Fact] public void CheckBaseDimensionDivisionWithSpeedEqualsDistanceDividedByTimeOnStaticProperty() { - var calculatedDimensions = Length.BaseDimensions.Divide(Duration.BaseDimensions); - Assert.True(calculatedDimensions == Speed.BaseDimensions); + var calculatedDimensions = Length.BaseDimensions.Divide(Duration.BaseDimensions); + Assert.True(calculatedDimensions == Speed.BaseDimensions); } [Fact] public void CheckBaseDimensionDivisionWithSpeedEqualsDistanceDividedByTimeOnInstanceProperty() { - var length = Length.FromKilometers(100); - var duration = Duration.FromHours(1); + var length = Length.FromKilometers(100); + var duration = Duration.FromHours(1); var calculatedDimensions = length.Dimensions.Divide(duration.Dimensions); - Assert.True(calculatedDimensions == Speed.BaseDimensions); + Assert.True(calculatedDimensions == Speed.BaseDimensions); } [Fact] public void CheckBaseDimensionMultiplicationWithForceEqualsMassTimesAccelerationOnStaticProperty() { - var calculatedDimensions = Mass.BaseDimensions.Multiply(Acceleration.BaseDimensions); - Assert.True(calculatedDimensions == Force.BaseDimensions); + var calculatedDimensions = Mass.BaseDimensions.Multiply(Acceleration.BaseDimensions); + Assert.True(calculatedDimensions == Force.BaseDimensions); } [Fact] public void CheckBaseDimensionMultiplicationWithForceEqualsMassTimesAccelerationOnInstanceProperty() { - var mass = Mass.FromPounds(205); - var acceleration = Acceleration.FromMetersPerSecondSquared(9.8); + var mass = Mass.FromPounds(205); + var acceleration = Acceleration.FromMetersPerSecondSquared(9.8); var calculatedDimensions = mass.Dimensions.Multiply(acceleration.Dimensions); - Assert.True(calculatedDimensions == Force.BaseDimensions); + Assert.True(calculatedDimensions == Force.BaseDimensions); } [Fact] @@ -661,41 +661,41 @@ public void LuminousIntensityDimensionsDivideCorrectlyWithOperatorOverloads() [Fact] public void CheckBaseDimensionDivisionWithSpeedEqualsDistanceDividedByTimeOnStaticPropertyWithOperatorOverloads() { - var calculatedDimensions = Length.BaseDimensions / Duration.BaseDimensions; - Assert.True(calculatedDimensions == Speed.BaseDimensions); + var calculatedDimensions = Length.BaseDimensions / Duration.BaseDimensions; + Assert.True(calculatedDimensions == Speed.BaseDimensions); } [Fact] public void CheckBaseDimensionDivisionWithSpeedEqualsDistanceDividedByTimeOnInstancePropertyWithOperatorOverloads() { - var length = Length.FromKilometers(100); - var duration = Duration.FromHours(1); + var length = Length.FromKilometers(100); + var duration = Duration.FromHours(1); var calculatedDimensions = length.Dimensions / duration.Dimensions; - Assert.True(calculatedDimensions == Speed.BaseDimensions); + Assert.True(calculatedDimensions == Speed.BaseDimensions); } [Fact] public void CheckBaseDimensionMultiplicationWithForceEqualsMassTimesAccelerationOnStaticPropertyWithOperatorOverloads() { - var calculatedDimensions = Mass.BaseDimensions * Acceleration.BaseDimensions; - Assert.True(calculatedDimensions == Force.BaseDimensions); + var calculatedDimensions = Mass.BaseDimensions * Acceleration.BaseDimensions; + Assert.True(calculatedDimensions == Force.BaseDimensions); } [Fact] public void CheckBaseDimensionMultiplicationWithForceEqualsMassTimesAccelerationOnInstancePropertyWithOperatorOverloads() { - var mass = Mass.FromPounds(205); - var acceleration = Acceleration.FromMetersPerSecondSquared(9.8); + var mass = Mass.FromPounds(205); + var acceleration = Acceleration.FromMetersPerSecondSquared(9.8); var calculatedDimensions = mass.Dimensions * acceleration.Dimensions; - Assert.True(calculatedDimensions == Force.BaseDimensions); + Assert.True(calculatedDimensions == Force.BaseDimensions); } [Fact] public void CheckToStringUsingMolarEntropy() { - Assert.Equal("[Length]^2[Mass][Time]^-2[Temperature][Amount]", MolarEntropy.BaseDimensions.ToString()); + Assert.Equal("[Length]^2[Mass][Time]^-2[Temperature][Amount]", MolarEntropy.BaseDimensions.ToString()); } [Fact] @@ -736,7 +736,7 @@ public void IsDimensionlessMethodImplementedCorrectly() Assert.False(BaseDimensions.Dimensionless.IsDerivedQuantity()); // Example case - Assert.True(Level.BaseDimensions.IsDimensionless()); + Assert.True(Level.BaseDimensions.IsDimensionless()); } } } diff --git a/UnitsNet.Tests/CustomCode/AccelerationTests.cs b/UnitsNet.Tests/CustomCode/AccelerationTests.cs index 30d4aafca0..87eed6d293 100644 --- a/UnitsNet.Tests/CustomCode/AccelerationTests.cs +++ b/UnitsNet.Tests/CustomCode/AccelerationTests.cs @@ -36,8 +36,8 @@ public class AccelerationTests : AccelerationTestsBase [Fact] public void AccelerationTimesDensityEqualsSpecificWeight() { - SpecificWeight specificWeight = Acceleration.FromMetersPerSecondSquared(10) * Density.FromKilogramsPerCubicMeter(2); - Assert.Equal(SpecificWeight.FromNewtonsPerCubicMeter(20), specificWeight); + var specificWeight = Acceleration.FromMetersPerSecondSquared(10) * Density.FromKilogramsPerCubicMeter(2); + Assert.Equal(SpecificWeight.FromNewtonsPerCubicMeter(20), specificWeight); } } } diff --git a/UnitsNet.Tests/CustomCode/AmountOfSubstanceTests.cs b/UnitsNet.Tests/CustomCode/AmountOfSubstanceTests.cs index 61560c24ec..37de214417 100644 --- a/UnitsNet.Tests/CustomCode/AmountOfSubstanceTests.cs +++ b/UnitsNet.Tests/CustomCode/AmountOfSubstanceTests.cs @@ -47,17 +47,17 @@ public class AmountOfSubstanceTests : AmountOfSubstanceTestsBase [Fact] public void NumberOfParticlesInOneMoleEqualsAvogadroConstant() { - var oneMole = AmountOfSubstance.FromMoles(1); + var oneMole = AmountOfSubstance.FromMoles(1); var numberOfParticles = oneMole.NumberOfParticles(); - Assert.Equal(AmountOfSubstance.AvogadroConstant, numberOfParticles); + Assert.Equal(AmountOfSubstance.AvogadroConstant, numberOfParticles); } [Fact] public void NumberOfParticlesInTwoMolesIsDoubleAvogadroConstant() { - var twoMoles = AmountOfSubstance.FromMoles(2); + var twoMoles = AmountOfSubstance.FromMoles(2); var numberOfParticles = twoMoles.NumberOfParticles(); - Assert.Equal(AmountOfSubstance.AvogadroConstant * 2, numberOfParticles); + Assert.Equal(AmountOfSubstance.AvogadroConstant * 2, numberOfParticles); } [Theory] @@ -69,10 +69,10 @@ public void MassFromAmountOfSubstanceAndMolarMass( double molarMassValue, MolarMassUnit molarMassUnit, double expectedMass, MassUnit expectedMassUnit, double tolerence = 1e-5) { - AmountOfSubstance amountOfSubstance = new AmountOfSubstance(amountOfSubstanceValue, amountOfSubstanceUnit); - MolarMass molarMass = new MolarMass(molarMassValue, molarMassUnit); + var amountOfSubstance = new AmountOfSubstance(amountOfSubstanceValue, amountOfSubstanceUnit); + var molarMass = new MolarMass( molarMassValue, molarMassUnit); - Mass mass = amountOfSubstance * molarMass; + var mass = amountOfSubstance * molarMass; AssertEx.EqualTolerance(expectedMass, mass.As(expectedMassUnit), tolerence); } @@ -88,12 +88,12 @@ public void MolarityFromComponentMassAndSolutionVolume( double solutionVolumeValue, VolumeUnit solutionVolumeUnit, double expectedMolarityValue, MolarityUnit expectedMolarityUnit, double tolerence = 1e-5) { - var componentMass = new Mass(componentMassValue, componentMassUnit); - var componentMolarMass = new MolarMass(componentMolarMassValue, componentMolarMassUnit); - var volumeSolution = new Volume(solutionVolumeValue, solutionVolumeUnit); - AmountOfSubstance amountOfSubstance = componentMass / componentMolarMass; + var componentMass = new Mass(componentMassValue, componentMassUnit); + var componentMolarMass = new MolarMass( componentMolarMassValue, componentMolarMassUnit); + var volumeSolution = new Volume( solutionVolumeValue, solutionVolumeUnit); + var amountOfSubstance = componentMass / componentMolarMass; - Molarity molarity = amountOfSubstance / volumeSolution; + var molarity = amountOfSubstance / volumeSolution; AssertEx.EqualTolerance(expectedMolarityValue, molarity.As(expectedMolarityUnit), tolerence); } @@ -109,12 +109,12 @@ public void VolumeSolutionFromComponentMassAndDesiredConcentration( double desiredMolarityValue, MolarityUnit desiredMolarityUnit, double expectedSolutionVolumeValue, VolumeUnit expectedSolutionVolumeUnit, double tolerence = 1e-5) { - var componentMass = new Mass(componentMassValue, componentMassUnit); - var componentMolarMass = new MolarMass(componentMolarMassValue, componentMolarMassUnit); - var desiredMolarity = new Molarity(desiredMolarityValue, desiredMolarityUnit); - AmountOfSubstance amountOfSubstance = componentMass / componentMolarMass; + var componentMass = new Mass(componentMassValue, componentMassUnit); + var componentMolarMass = new MolarMass(componentMolarMassValue, componentMolarMassUnit); + var desiredMolarity = new Molarity( desiredMolarityValue, desiredMolarityUnit); + var amountOfSubstance = componentMass / componentMolarMass; - Volume volumeSolution = amountOfSubstance / desiredMolarity; + var volumeSolution = amountOfSubstance / desiredMolarity; AssertEx.EqualTolerance(expectedSolutionVolumeValue, volumeSolution.As(expectedSolutionVolumeUnit), tolerence); } diff --git a/UnitsNet.Tests/CustomCode/AmplitudeRatioTests.cs b/UnitsNet.Tests/CustomCode/AmplitudeRatioTests.cs index e51ce88b3c..6331f2465b 100644 --- a/UnitsNet.Tests/CustomCode/AmplitudeRatioTests.cs +++ b/UnitsNet.Tests/CustomCode/AmplitudeRatioTests.cs @@ -18,14 +18,14 @@ public class AmplitudeRatioTests : AmplitudeRatioTestsBase protected override void AssertLogarithmicAddition() { - AmplitudeRatio v = AmplitudeRatio.FromDecibelVolts(40); + var v = AmplitudeRatio.FromDecibelVolts(40); AssertEx.EqualTolerance(46.0205999133, (v + v).DecibelVolts, DecibelVoltsTolerance); } protected override void AssertLogarithmicSubtraction() { - AmplitudeRatio v = AmplitudeRatio.FromDecibelVolts(40); - AssertEx.EqualTolerance(46.6982292275, (AmplitudeRatio.FromDecibelVolts(50) - v).DecibelVolts, DecibelVoltsTolerance); + var v = AmplitudeRatio.FromDecibelVolts(40); + AssertEx.EqualTolerance(46.6982292275, (AmplitudeRatio.FromDecibelVolts(50) - v).DecibelVolts, DecibelVoltsTolerance); } [Theory] @@ -34,10 +34,10 @@ protected override void AssertLogarithmicSubtraction() [InlineData(-10)] public void InvalidVoltage_ExpectArgumentOutOfRangeException(double voltage) { - ElectricPotential invalidVoltage = ElectricPotential.FromVolts(voltage); + var invalidVoltage = ElectricPotential.FromVolts(voltage); // ReSharper disable once ObjectCreationAsStatement - Assert.Throws(() => new AmplitudeRatio(invalidVoltage)); + Assert.Throws(() => new AmplitudeRatio( invalidVoltage)); } [Theory] @@ -48,9 +48,9 @@ public void InvalidVoltage_ExpectArgumentOutOfRangeException(double voltage) public void ExpectVoltageConvertedToAmplitudeRatioCorrectly(double voltage, double expected) { // Amplitude ratio increases linearly by 20 dBV with power-of-10 increases of voltage. - ElectricPotential v = ElectricPotential.FromVolts(voltage); + var v = ElectricPotential.FromVolts(voltage); - double actual = AmplitudeRatio.FromElectricPotential(v).DecibelVolts; + double actual = AmplitudeRatio.FromElectricPotential(v).DecibelVolts; Assert.Equal(expected, actual); } @@ -63,7 +63,7 @@ public void ExpectVoltageConvertedToAmplitudeRatioCorrectly(double voltage, doub public void ExpectAmplitudeRatioConvertedToVoltageCorrectly(double amplitudeRatio, double expected) { // Voltage increases by powers of 10 for every 20 dBV increase in amplitude ratio. - AmplitudeRatio ar = AmplitudeRatio.FromDecibelVolts(amplitudeRatio); + var ar = AmplitudeRatio.FromDecibelVolts(amplitudeRatio); double actual = ar.ToElectricPotential().Volts; Assert.Equal(expected, actual); @@ -78,9 +78,9 @@ public void ExpectAmplitudeRatioConvertedToVoltageCorrectly(double amplitudeRati [InlineData(60, 13.01)] public void AmplitudeRatioToPowerRatio_50OhmImpedance(double dBmV, double expected) { - AmplitudeRatio ampRatio = AmplitudeRatio.FromDecibelMillivolts(dBmV); + var ampRatio = AmplitudeRatio.FromDecibelMillivolts(dBmV); - double actual = Math.Round(ampRatio.ToPowerRatio(ElectricResistance.FromOhms(50)).DecibelMilliwatts, 2); + double actual = Math.Round(ampRatio.ToPowerRatio(ElectricResistance.FromOhms(50)).DecibelMilliwatts, 2); Assert.Equal(expected, actual); } @@ -91,9 +91,9 @@ public void AmplitudeRatioToPowerRatio_50OhmImpedance(double dBmV, double expect [InlineData(60, 11.25)] public void AmplitudeRatioToPowerRatio_75OhmImpedance(double dBmV, double expected) { - AmplitudeRatio ampRatio = AmplitudeRatio.FromDecibelMillivolts(dBmV); + var ampRatio = AmplitudeRatio.FromDecibelMillivolts(dBmV); - double actual = Math.Round(ampRatio.ToPowerRatio(ElectricResistance.FromOhms(75)).DecibelMilliwatts, 2); + double actual = Math.Round(ampRatio.ToPowerRatio(ElectricResistance.FromOhms(75)).DecibelMilliwatts, 2); Assert.Equal(expected, actual); } } diff --git a/UnitsNet.Tests/CustomCode/AngleTests.cs b/UnitsNet.Tests/CustomCode/AngleTests.cs index 1641165cce..da8f262f76 100644 --- a/UnitsNet.Tests/CustomCode/AngleTests.cs +++ b/UnitsNet.Tests/CustomCode/AngleTests.cs @@ -39,15 +39,15 @@ public class AngleTests : AngleTestsBase [Fact] public void AngleDividedByDurationEqualsRotationalSpeed() { - RotationalSpeed rotationalSpeed = Angle.FromRadians(10) / Duration.FromSeconds(5); - Assert.Equal(rotationalSpeed, RotationalSpeed.FromRadiansPerSecond(2)); + var rotationalSpeed = Angle.FromRadians(10) / Duration.FromSeconds(5); + Assert.Equal(rotationalSpeed, RotationalSpeed.FromRadiansPerSecond(2)); } [Fact] public void AngleDividedByTimeSpanEqualsRotationalSpeed() { - RotationalSpeed rotationalSpeed = Angle.FromRadians(10) / TimeSpan.FromSeconds(5); - Assert.Equal(rotationalSpeed, RotationalSpeed.FromRadiansPerSecond(2)); + var rotationalSpeed = Angle.FromRadians(10) / TimeSpan.FromSeconds(5); + Assert.Equal(rotationalSpeed, RotationalSpeed.FromRadiansPerSecond(2)); } } } diff --git a/UnitsNet.Tests/CustomCode/AreaMomentOfInertiaTests.cs b/UnitsNet.Tests/CustomCode/AreaMomentOfInertiaTests.cs index e43027813d..2ee76d17dc 100644 --- a/UnitsNet.Tests/CustomCode/AreaMomentOfInertiaTests.cs +++ b/UnitsNet.Tests/CustomCode/AreaMomentOfInertiaTests.cs @@ -43,8 +43,8 @@ public class AreaMomentOfInertiaTests : AreaMomentOfInertiaTestsBase [Fact] public void AreaMomentOfInertiaDividedByLengthEqualsVolume() { - Volume volume = AreaMomentOfInertia.FromMetersToTheFourth(20) / Length.FromMeters(10); - Assert.Equal(Volume.FromCubicMeters(2), volume); + var volume = AreaMomentOfInertia.FromMetersToTheFourth(20) / Length.FromMeters(10); + Assert.Equal(Volume.FromCubicMeters(2), volume); } } } diff --git a/UnitsNet.Tests/CustomCode/AreaTests.cs b/UnitsNet.Tests/CustomCode/AreaTests.cs index d637cd18a9..1f065fc660 100644 --- a/UnitsNet.Tests/CustomCode/AreaTests.cs +++ b/UnitsNet.Tests/CustomCode/AreaTests.cs @@ -40,15 +40,15 @@ public class AreaTests : AreaTestsBase [Fact] public void AreaDividedByLengthEqualsLength() { - Length length = Area.FromSquareMeters(50)/Length.FromMeters(5); - Assert.Equal(length, Length.FromMeters(10)); + var length = Area.FromSquareMeters(50)/Length.FromMeters(5); + Assert.Equal(length, Length.FromMeters(10)); } [Fact] public void AreaTimesMassFluxEqualsMassFlow() { - MassFlow massFlow = Area.FromSquareMeters(20) * MassFlux.FromKilogramsPerSecondPerSquareMeter(2); - Assert.Equal(massFlow, MassFlow.FromKilogramsPerSecond(40)); + var massFlow = Area.FromSquareMeters(20) * MassFlux.FromKilogramsPerSecondPerSquareMeter(2); + Assert.Equal(massFlow, MassFlow.FromKilogramsPerSecond(40)); } [Theory] @@ -58,9 +58,9 @@ public void AreaTimesMassFluxEqualsMassFlow() [InlineData(2, 3.141592653589793)] public void AreaFromCicleDiameterCalculatedCorrectly(double diameterMeters, double expected) { - Length diameter = Length.FromMeters(diameterMeters); + var diameter = Length.FromMeters(diameterMeters); - double actual = Area.FromCircleDiameter(diameter).SquareMeters; + double actual = Area.FromCircleDiameter(diameter).SquareMeters; Assert.Equal(expected, actual); } @@ -72,9 +72,9 @@ public void AreaFromCicleDiameterCalculatedCorrectly(double diameterMeters, doub [InlineData(2, 12.566370614359173)] public void AreaFromCicleRadiusCalculatedCorrectly(double radiusMeters, double expected) { - Length radius = Length.FromMeters(radiusMeters); + var radius = Length.FromMeters(radiusMeters); - double actual = Area.FromCircleRadius(radius).SquareMeters; + double actual = Area.FromCircleRadius(radius).SquareMeters; Assert.Equal(expected, actual); } @@ -82,28 +82,28 @@ public void AreaFromCicleRadiusCalculatedCorrectly(double radiusMeters, double e [Fact] public void AreaTimesSpeedEqualsVolumeFlow() { - VolumeFlow volumeFlow = Area.FromSquareMeters(20) * Speed.FromMetersPerSecond(2); - Assert.Equal(VolumeFlow.FromCubicMetersPerSecond(40), volumeFlow); + var volumeFlow = Area.FromSquareMeters(20) * Speed.FromMetersPerSecond(2); + Assert.Equal(VolumeFlow.FromCubicMetersPerSecond(40), volumeFlow); } [Fact] public void Constructor_UnitSystemSI_AssignsSIUnit() { - var area = new Area(1.0, UnitSystem.SI); + var area = new Area(1.0, UnitSystem.SI); Assert.Equal(AreaUnit.SquareMeter, area.Unit); } [Fact] public void As_GivenSIUnitSystem_ReturnsSIValue() { - var squareInches = new Area(2.0, AreaUnit.SquareInch); + var squareInches = new Area(2.0, AreaUnit.SquareInch); Assert.Equal(0.00129032, squareInches.As(UnitSystem.SI)); } [Fact] public void ToUnit_GivenSIUnitSystem_ReturnsSIQuantity() { - var squareInches = new Area(2.0, AreaUnit.SquareInch); + var squareInches = new Area(2.0, AreaUnit.SquareInch); var inSI = squareInches.ToUnit(UnitSystem.SI); diff --git a/UnitsNet.Tests/CustomCode/BrakeSpecificFuelConsumptionTests.cs b/UnitsNet.Tests/CustomCode/BrakeSpecificFuelConsumptionTests.cs index ed637226a8..a02e9403a6 100644 --- a/UnitsNet.Tests/CustomCode/BrakeSpecificFuelConsumptionTests.cs +++ b/UnitsNet.Tests/CustomCode/BrakeSpecificFuelConsumptionTests.cs @@ -17,21 +17,21 @@ public class BrakeSpecificFuelConsumptionTests : BrakeSpecificFuelConsumptionTes [Fact] public void PowerTimesBrakeSpecificFuelConsumptionEqualsMassFlow() { - MassFlow massFlow = BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(180.0) * Power.FromKilowatts(20.0 / 24.0 * 1e6 / 180.0); + var massFlow = BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(180.0) * Power.FromKilowatts(20.0 / 24.0 * 1e6 / 180.0); AssertEx.EqualTolerance(20.0, massFlow.TonnesPerDay, 1e-11); } [Fact] public void DoubleDividedByBrakeSpecificFuelConsumptionEqualsSpecificEnergy() { - SpecificEnergy massFlow = 2.0 / BrakeSpecificFuelConsumption.FromKilogramsPerJoule(4.0); - Assert.Equal(SpecificEnergy.FromJoulesPerKilogram(0.5), massFlow); + var specificEnergy = 2.0 / BrakeSpecificFuelConsumption.FromKilogramsPerJoule(4.0); + Assert.Equal(SpecificEnergy.FromJoulesPerKilogram(0.5), specificEnergy); } [Fact] public void BrakeSpecificFuelConsumptionTimesSpecificEnergyEqualsEnergy() { - double value = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(20.0) * SpecificEnergy.FromJoulesPerKilogram(10.0); + double value = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(20.0) * SpecificEnergy.FromJoulesPerKilogram(10.0); Assert.Equal(200.0, value); } } diff --git a/UnitsNet.Tests/CustomCode/DensityTests.cs b/UnitsNet.Tests/CustomCode/DensityTests.cs index 6d70e059c2..7c6c1c58ba 100644 --- a/UnitsNet.Tests/CustomCode/DensityTests.cs +++ b/UnitsNet.Tests/CustomCode/DensityTests.cs @@ -90,36 +90,36 @@ public class DensityTests : DensityTestsBase [Fact] public static void DensityTimesVolumeEqualsMass() { - Mass mass = Density.FromKilogramsPerCubicMeter(2) * Volume.FromCubicMeters(3); - Assert.Equal(mass, Mass.FromKilograms(6)); + var mass = Density.FromKilogramsPerCubicMeter(2) * Volume.FromCubicMeters(3); + Assert.Equal(mass, Mass.FromKilograms(6)); } [Fact] public static void VolumeTimesDensityEqualsMass() { - Mass mass = Volume.FromCubicMeters(3) * Density.FromKilogramsPerCubicMeter(2); - Assert.Equal(mass, Mass.FromKilograms(6)); + var mass = Volume.FromCubicMeters(3) * Density.FromKilogramsPerCubicMeter(2); + Assert.Equal(mass, Mass.FromKilograms(6)); } [Fact] public static void DensityTimesKinematicViscosityEqualsDynamicViscosity() { - DynamicViscosity dynamicViscosity = Density.FromKilogramsPerCubicMeter(2) * KinematicViscosity.FromSquareMetersPerSecond(10); - Assert.Equal(dynamicViscosity, DynamicViscosity.FromNewtonSecondsPerMeterSquared(20)); + var dynamicViscosity = Density.FromKilogramsPerCubicMeter(2) * KinematicViscosity.FromSquareMetersPerSecond(10); + Assert.Equal(dynamicViscosity, DynamicViscosity.FromNewtonSecondsPerMeterSquared(20)); } [Fact] public void DensityTimesSpeedEqualsMassFlux() { - MassFlux massFlux = Density.FromKilogramsPerCubicMeter(20) * Speed.FromMetersPerSecond(2); - Assert.Equal(massFlux, MassFlux.FromKilogramsPerSecondPerSquareMeter(40)); + var massFlux = Density.FromKilogramsPerCubicMeter(20) * Speed.FromMetersPerSecond(2); + Assert.Equal(massFlux, MassFlux.FromKilogramsPerSecondPerSquareMeter(40)); } [Fact] public void DensityTimesAccelerationEqualsSpecificWeight() { - SpecificWeight specificWeight = Density.FromKilogramsPerCubicMeter(10) * Acceleration.FromMetersPerSecondSquared(2); - Assert.Equal(SpecificWeight.FromNewtonsPerCubicMeter(20), specificWeight); + var specificWeight = Density.FromKilogramsPerCubicMeter(10) * Acceleration.FromMetersPerSecondSquared(2); + Assert.Equal(SpecificWeight.FromNewtonsPerCubicMeter(20), specificWeight); } } } diff --git a/UnitsNet.Tests/CustomCode/DurationTests.cs b/UnitsNet.Tests/CustomCode/DurationTests.cs index 4facb8eab1..bd69085b6f 100644 --- a/UnitsNet.Tests/CustomCode/DurationTests.cs +++ b/UnitsNet.Tests/CustomCode/DurationTests.cs @@ -32,138 +32,138 @@ public class DurationTests : DurationTestsBase [Fact] public static void ToTimeSpanShouldThrowExceptionOnValuesLargerThanTimeSpanMax() { - Duration duration = Duration.FromSeconds(TimeSpan.MaxValue.TotalSeconds + 1); + var duration = Duration.FromSeconds(TimeSpan.MaxValue.TotalSeconds + 1); Assert.Throws(() => duration.ToTimeSpan()); } [Fact] public static void ToTimeSpanShouldThrowExceptionOnValuesSmallerThanTimeSpanMin() { - Duration duration = Duration.FromSeconds(TimeSpan.MinValue.TotalSeconds - 1); + var duration = Duration.FromSeconds(TimeSpan.MinValue.TotalSeconds - 1); Assert.Throws(() => duration.ToTimeSpan()); } [Fact] public static void ToTimeSpanShouldNotThrowExceptionOnValuesSlightlyLargerThanTimeSpanMin() { - Duration duration = Duration.FromSeconds(TimeSpan.MinValue.TotalSeconds + 1); - TimeSpan timeSpan = duration.ToTimeSpan(); + var duration = Duration.FromSeconds(TimeSpan.MinValue.TotalSeconds + 1); + var timeSpan = duration.ToTimeSpan(); AssertEx.EqualTolerance(duration.Seconds, timeSpan.TotalSeconds, 1e-3); } [Fact] public static void ToTimeSpanShouldNotThrowExceptionOnValuesSlightlySmallerThanTimeSpanMax() { - Duration duration = Duration.FromSeconds(TimeSpan.MaxValue.TotalSeconds - 1); - TimeSpan timeSpan = duration.ToTimeSpan(); + var duration = Duration.FromSeconds(TimeSpan.MaxValue.TotalSeconds - 1); + var timeSpan = duration.ToTimeSpan(); AssertEx.EqualTolerance(duration.Seconds, timeSpan.TotalSeconds, 1e-3); } [Fact] public static void ExplicitCastToTimeSpanShouldReturnSameValue() { - Duration duration = Duration.FromSeconds(60); - TimeSpan timeSpan = (TimeSpan)duration; + var duration = Duration.FromSeconds(60); + var timeSpan = (TimeSpan)duration; AssertEx.EqualTolerance(duration.Seconds, timeSpan.TotalSeconds, 1e-10); } [Fact] public static void ExplicitCastToDurationShouldReturnSameValue() { - TimeSpan timeSpan = TimeSpan.FromSeconds(60); - Duration duration = (Duration)timeSpan; + var timeSpan = TimeSpan.FromSeconds(60); + var duration = (Duration)timeSpan; AssertEx.EqualTolerance(timeSpan.TotalSeconds, duration.Seconds, 1e-10); } [Fact] public static void DateTimePlusDurationReturnsDateTime() { - DateTime dateTime = new DateTime(2016, 1, 1); - Duration oneDay = Duration.FromDays(1); - DateTime result = dateTime + oneDay; - DateTime expected = new DateTime(2016, 1, 2); + var dateTime = new DateTime(2016, 1, 1); + var oneDay = Duration.FromDays(1); + var result = dateTime + oneDay; + var expected = new DateTime(2016, 1, 2); Assert.Equal(expected, result); } [Fact] public static void DateTimeMinusDurationReturnsDateTime() { - DateTime dateTime = new DateTime(2016, 1, 2); - Duration oneDay = Duration.FromDays(1); - DateTime result = dateTime - oneDay; - DateTime expected = new DateTime(2016, 1, 1); + var dateTime = new DateTime(2016, 1, 2); + var oneDay = Duration.FromDays(1); + var result = dateTime - oneDay; + var expected = new DateTime(2016, 1, 1); Assert.Equal(expected, result); } [Fact] public static void TimeSpanLessThanDurationShouldReturnCorrectly() { - TimeSpan timeSpan = TimeSpan.FromHours(10); - Duration duration = Duration.FromHours(11); + var timeSpan = TimeSpan.FromHours(10); + var duration = Duration.FromHours(11); Assert.True(timeSpan < duration, "timeSpan should be less than duration"); } [Fact] public static void TimeSpanGreaterThanDurationShouldReturnCorrectly() { - TimeSpan timeSpan = TimeSpan.FromHours(12); - Duration duration = Duration.FromHours(11); + var timeSpan = TimeSpan.FromHours(12); + var duration = Duration.FromHours(11); Assert.True(timeSpan > duration, "timeSpan should be greater than duration"); } [Fact] public static void DurationLessThanTimeSpanShouldReturnCorrectly() { - TimeSpan timeSpan = TimeSpan.FromHours(11); - Duration duration = Duration.FromHours(10); + var timeSpan = TimeSpan.FromHours(11); + var duration = Duration.FromHours(10); Assert.True(duration < timeSpan, "duration should be less than timeSpan"); } [Fact] public static void DurationGreaterThanTimeSpanShouldReturnCorrectly() { - TimeSpan timeSpan = TimeSpan.FromHours(11); - Duration duration = Duration.FromHours(12); + var timeSpan = TimeSpan.FromHours(11); + var duration = Duration.FromHours(12); Assert.True(duration > timeSpan, "duration should be greater than timeSpan"); } [Fact] public static void TimeSpanLessOrEqualThanDurationShouldReturnCorrectly() { - TimeSpan timeSpan = TimeSpan.FromHours(10); - Duration duration = Duration.FromHours(11); + var timeSpan = TimeSpan.FromHours(10); + var duration = Duration.FromHours(11); Assert.True(timeSpan <= duration, "timeSpan should be less than duration"); } [Fact] public static void TimeSpanGreaterThanOrEqualDurationShouldReturnCorrectly() { - TimeSpan timeSpan = TimeSpan.FromHours(12); - Duration duration = Duration.FromHours(11); + var timeSpan = TimeSpan.FromHours(12); + var duration = Duration.FromHours(11); Assert.True(timeSpan >= duration, "timeSpan should be greater than duration"); } [Fact] public static void DurationLessThanOrEqualTimeSpanShouldReturnCorrectly() { - TimeSpan timeSpan = TimeSpan.FromHours(11); - Duration duration = Duration.FromHours(10); + var timeSpan = TimeSpan.FromHours(11); + var duration = Duration.FromHours(10); Assert.True(duration <= timeSpan, "duration should be less than timeSpan"); } [Fact] public static void DurationGreaterThanOrEqualTimeSpanShouldReturnCorrectly() { - TimeSpan timeSpan = TimeSpan.FromHours(11); - Duration duration = Duration.FromHours(12); + var timeSpan = TimeSpan.FromHours(11); + var duration = Duration.FromHours(12); Assert.True(duration >= timeSpan, "duration should be greater than timeSpan"); } [Fact] public void DurationTimesVolumeFlowEqualsVolume() { - Volume volume = Duration.FromSeconds(20) * VolumeFlow.FromCubicMetersPerSecond(2); - Assert.Equal(Volume.FromCubicMeters(40), volume); + var volume = Duration.FromSeconds(20) * VolumeFlow.FromCubicMetersPerSecond(2); + Assert.Equal(Volume.FromCubicMeters(40), volume); } [Theory] @@ -179,7 +179,7 @@ public void DurationFromStringUsingMultipleAbbreviationsParsedCorrectly(string t { var cultureInfo = culture == null ? null : new CultureInfo(culture); - AssertEx.EqualTolerance(expectedSeconds, Duration.Parse(textValue, cultureInfo).Seconds, SecondsTolerance); + AssertEx.EqualTolerance(expectedSeconds, Duration.Parse(textValue, cultureInfo).Seconds, SecondsTolerance); } } } diff --git a/UnitsNet.Tests/CustomCode/DynamicViscosityTests.cs b/UnitsNet.Tests/CustomCode/DynamicViscosityTests.cs index df79561f7f..83509fbf23 100644 --- a/UnitsNet.Tests/CustomCode/DynamicViscosityTests.cs +++ b/UnitsNet.Tests/CustomCode/DynamicViscosityTests.cs @@ -21,8 +21,8 @@ public class DynamicViscosityTests : DynamicViscosityTestsBase [Fact] public static void DynamicViscosityDividedByDensityEqualsKinematicViscosity() { - KinematicViscosity kinematicViscosity = DynamicViscosity.FromNewtonSecondsPerMeterSquared(10) / Density.FromKilogramsPerCubicMeter(2); - Assert.Equal(kinematicViscosity, KinematicViscosity.FromSquareMetersPerSecond(5)); + var kinematicViscosity = DynamicViscosity.FromNewtonSecondsPerMeterSquared(10) / Density.FromKilogramsPerCubicMeter(2); + Assert.Equal(kinematicViscosity, KinematicViscosity.FromSquareMetersPerSecond(5)); } } } diff --git a/UnitsNet.Tests/CustomCode/EnergyTests.cs b/UnitsNet.Tests/CustomCode/EnergyTests.cs index 12e7f58811..04a9296d7e 100644 --- a/UnitsNet.Tests/CustomCode/EnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/EnergyTests.cs @@ -59,21 +59,21 @@ public class EnergyTests : EnergyTestsBase [Fact] public void Constructor_UnitSystemSI_AssignsSIUnit() { - var energy = new Energy(1.0, UnitSystem.SI); + var energy = new Energy(1.0, UnitSystem.SI); Assert.Equal(EnergyUnit.Joule, energy.Unit); } [Fact] public void As_GivenSIUnitSystem_ReturnsSIValue() { - var btus = new Energy(2.0, EnergyUnit.BritishThermalUnit); + var btus = new Energy(2.0, EnergyUnit.BritishThermalUnit); Assert.Equal(2110.11170524, btus.As(UnitSystem.SI)); } [Fact] public void ToUnit_GivenSIUnitSystem_ReturnsSIQuantity() { - var btus = new Energy(2.0, EnergyUnit.BritishThermalUnit); + var btus = new Energy(2.0, EnergyUnit.BritishThermalUnit); var inSI = btus.ToUnit(UnitSystem.SI); diff --git a/UnitsNet.Tests/CustomCode/ForcePerLengthTests.cs b/UnitsNet.Tests/CustomCode/ForcePerLengthTests.cs index 4313f51ca8..ef1278f1e8 100644 --- a/UnitsNet.Tests/CustomCode/ForcePerLengthTests.cs +++ b/UnitsNet.Tests/CustomCode/ForcePerLengthTests.cs @@ -39,22 +39,22 @@ public class ForcePerLengthTests : ForcePerLengthTestsBase [Fact] public void ForcePerLengthDividedByLengthEqualsPressure() { - Pressure pressure = ForcePerLength.FromNewtonsPerMeter(90) / Length.FromMeters(9); - Assert.Equal(pressure, Pressure.FromNewtonsPerSquareMeter(10)); + var pressure = ForcePerLength.FromNewtonsPerMeter(90) / Length.FromMeters(9); + Assert.Equal(pressure, Pressure.FromNewtonsPerSquareMeter(10)); } [Fact] public void ForceDividedByForcePerLengthEqualsLength() { - Length length = Force.FromNewtons(10) / ForcePerLength.FromNewtonsPerMeter(2); - Assert.Equal(length, Length.FromMeters(5)); + var length = Force.FromNewtons(10) / ForcePerLength.FromNewtonsPerMeter(2); + Assert.Equal(length, Length.FromMeters(5)); } [Fact] public void ForcePerLenghTimesLengthEqualForce() { - Force force = ForcePerLength.FromNewtonsPerMeter(10) * Length.FromMeters(9); - Assert.Equal(force, Force.FromNewtons(90)); + var force = ForcePerLength.FromNewtonsPerMeter(10) * Length.FromMeters(9); + Assert.Equal(force, Force.FromNewtons(90)); } } } diff --git a/UnitsNet.Tests/CustomCode/ForceTests.cs b/UnitsNet.Tests/CustomCode/ForceTests.cs index 34b620ffb7..137448cd25 100644 --- a/UnitsNet.Tests/CustomCode/ForceTests.cs +++ b/UnitsNet.Tests/CustomCode/ForceTests.cs @@ -34,57 +34,57 @@ public class ForceTests : ForceTestsBase [Fact] public void ForceDividedByAreaEqualsPressure() { - Pressure pressure = Force.FromNewtons(90)/Area.FromSquareMeters(9); - Assert.Equal(pressure, Pressure.FromNewtonsPerSquareMeter(10)); + var pressure = Force.FromNewtons(90)/Area.FromSquareMeters(9); + Assert.Equal(pressure, Pressure.FromNewtonsPerSquareMeter(10)); } [Fact] public void PressureByAreaEqualsForce() { - Force force = Force.FromPressureByArea(Pressure.FromNewtonsPerSquareMeter(5), Area.FromSquareMeters(7)); - Assert.Equal(force, Force.FromNewtons(35)); + var force = Force.FromPressureByArea(Pressure.FromNewtonsPerSquareMeter(5), Area.FromSquareMeters(7)); + Assert.Equal(force, Force.FromNewtons(35)); } [Fact] public void ForceDividedByMassEqualsAcceleration() { - Acceleration acceleration = Force.FromNewtons(27)/Mass.FromKilograms(9); - Assert.Equal(acceleration, Acceleration.FromMetersPerSecondSquared(3)); + var acceleration = Force.FromNewtons(27)/Mass.FromKilograms(9); + Assert.Equal(acceleration, Acceleration.FromMetersPerSecondSquared(3)); } [Fact] public void ForceDividedByAccelerationEqualsMass() { - Mass acceleration = Force.FromNewtons(200)/Acceleration.FromMetersPerSecondSquared(50); - Assert.Equal(acceleration, Mass.FromKilograms(4)); + var mass = Force.FromNewtons(200)/Acceleration.FromMetersPerSecondSquared(50); + Assert.Equal(mass, Mass.FromKilograms(4)); } [Fact] public void ForceDividedByLengthEqualsForcePerLength() { - ForcePerLength forcePerLength = Force.FromNewtons(200) / Length.FromMeters(50); - Assert.Equal(forcePerLength, ForcePerLength.FromNewtonsPerMeter(4)); + var forcePerLength = Force.FromNewtons(200) / Length.FromMeters(50); + Assert.Equal(forcePerLength, ForcePerLength.FromNewtonsPerMeter(4)); } [Fact] public void MassByAccelerationEqualsForce() { - Force force = Force.FromMassByAcceleration(Mass.FromKilograms(85), Acceleration.FromMetersPerSecondSquared(-4)); - Assert.Equal(force, Force.FromNewtons(-340)); + var force = Force.FromMassByAcceleration(Mass.FromKilograms(85), Acceleration.FromMetersPerSecondSquared(-4)); + Assert.Equal(force, Force.FromNewtons(-340)); } [Fact] public void ForceTimesSpeedEqualsPower() { - Power power = Force.FromNewtons(27.0)*Speed.FromMetersPerSecond(10.0); - Assert.Equal(power, Power.FromWatts(270)); + var power = Force.FromNewtons(27.0)*Speed.FromMetersPerSecond(10.0); + Assert.Equal(power, Power.FromWatts(270)); } [Fact] public void SpeedTimesForceEqualsPower() { - Power power = Speed.FromMetersPerSecond(10.0)*Force.FromNewtons(27.0); - Assert.Equal(power, Power.FromWatts(270)); + var power = Speed.FromMetersPerSecond(10.0)*Force.FromNewtons(27.0); + Assert.Equal(power, Power.FromWatts(270)); } } } diff --git a/UnitsNet.Tests/CustomCode/HeatFluxTests.cs b/UnitsNet.Tests/CustomCode/HeatFluxTests.cs index ea7e2132d9..37e1f1a16d 100644 --- a/UnitsNet.Tests/CustomCode/HeatFluxTests.cs +++ b/UnitsNet.Tests/CustomCode/HeatFluxTests.cs @@ -50,22 +50,22 @@ public class HeatFluxTests : HeatFluxTestsBase [ Fact] public void PowerDividedByAreaEqualsHeatFlux() { - HeatFlux heatFlux = Power.FromWatts(12) / Area.FromSquareMeters(3); - Assert.Equal(heatFlux, HeatFlux.FromWattsPerSquareMeter(4)); + var heatFlux = Power.FromWatts(12) / Area.FromSquareMeters(3); + Assert.Equal(heatFlux, HeatFlux.FromWattsPerSquareMeter(4)); } [Fact] public void HeatFluxTimesAreaEqualsPower() { - Power power = HeatFlux.FromWattsPerSquareMeter(3) * Area.FromSquareMeters(4); - Assert.Equal(power, Power.FromWatts(12)); + var power = HeatFlux.FromWattsPerSquareMeter(3) * Area.FromSquareMeters(4); + Assert.Equal(power, Power.FromWatts(12)); } [Fact] public void PowerDividedByHeatFluxEqualsArea() { - Area area = Power.FromWatts(12) / HeatFlux.FromWattsPerSquareMeter(3); - Assert.Equal(area, Area.FromSquareMeters(4)); + var area = Power.FromWatts(12) / HeatFlux.FromWattsPerSquareMeter(3); + Assert.Equal(area, Area.FromSquareMeters(4)); } } } diff --git a/UnitsNet.Tests/CustomCode/IQuantityTests.cs b/UnitsNet.Tests/CustomCode/IQuantityTests.cs index 9eda6cd2e8..f934934b11 100644 --- a/UnitsNet.Tests/CustomCode/IQuantityTests.cs +++ b/UnitsNet.Tests/CustomCode/IQuantityTests.cs @@ -12,42 +12,42 @@ public partial class IQuantityTests [Fact] public void As_GivenWrongUnitType_ThrowsArgumentException() { - IQuantity length = Length.FromMeters(1.2345); + IQuantity length = Length.FromMeters(1.2345); Assert.Throws(() => length.As(MassUnit.Kilogram)); } [Fact] public void As_GivenNullUnitSystem_ThrowsArgumentNullException() { - IQuantity imperialLengthQuantity = new Length(2.0, LengthUnit.Inch); + IQuantity imperialLengthQuantity = new Length(2.0, LengthUnit.Inch); Assert.Throws(() => imperialLengthQuantity.As((UnitSystem)null)); } [Fact] public void As_GivenSIUnitSystem_ReturnsSIValue() { - IQuantity inches = new Length(2.0, LengthUnit.Inch); + IQuantity inches = new Length(2.0, LengthUnit.Inch); Assert.Equal(0.0508, inches.As(UnitSystem.SI)); } [Fact] public void ToUnit_GivenWrongUnitType_ThrowsArgumentException() { - IQuantity length = Length.FromMeters(1.2345); + IQuantity length = Length.FromMeters(1.2345); Assert.Throws(() => length.ToUnit(MassUnit.Kilogram)); } [Fact] public void ToUnit_GivenNullUnitSystem_ThrowsArgumentNullException() { - IQuantity imperialLengthQuantity = new Length(2.0, LengthUnit.Inch); + IQuantity imperialLengthQuantity = new Length(2.0, LengthUnit.Inch); Assert.Throws(() => imperialLengthQuantity.ToUnit((UnitSystem)null)); } [Fact] public void ToUnit_GivenSIUnitSystem_ReturnsSIQuantity() { - IQuantity inches = new Length(2.0, LengthUnit.Inch); + IQuantity inches = new Length(2.0, LengthUnit.Inch); IQuantity inSI = inches.ToUnit(UnitSystem.SI); diff --git a/UnitsNet.Tests/CustomCode/InformationTests.cs b/UnitsNet.Tests/CustomCode/InformationTests.cs index 2a7383e8cc..fae0128842 100644 --- a/UnitsNet.Tests/CustomCode/InformationTests.cs +++ b/UnitsNet.Tests/CustomCode/InformationTests.cs @@ -64,19 +64,19 @@ public class InformationTests : InformationTestsBase [Fact] public void OneKBHas1000Bytes() { - Assert.Equal(1000, Information.FromKilobytes(1).Bytes); + Assert.Equal(1000, Information.FromKilobytes(1).Bytes); } [Fact] public void MaxValueIsCorrectForUnitWithBaseTypeDecimal() { - Assert.Equal((double) decimal.MaxValue, Information.MaxValue.Bits); + Assert.Equal((double) decimal.MaxValue, Information.MaxValue.Bits); } [Fact] public void MinValueIsCorrectForUnitWithBaseTypeDecimal() { - Assert.Equal((double) decimal.MinValue, Information.MinValue.Bits); + Assert.Equal((double) decimal.MinValue, Information.MinValue.Bits); } } } diff --git a/UnitsNet.Tests/CustomCode/KinematicViscosityTests.cs b/UnitsNet.Tests/CustomCode/KinematicViscosityTests.cs index f41e2d5d54..a9a630e091 100644 --- a/UnitsNet.Tests/CustomCode/KinematicViscosityTests.cs +++ b/UnitsNet.Tests/CustomCode/KinematicViscosityTests.cs @@ -27,43 +27,43 @@ public class KinematicViscosityTests : KinematicViscosityTestsBase [Fact] public static void DurationTimesKinematicViscosityEqualsArea() { - Area area = Duration.FromSeconds(2)*KinematicViscosity.FromSquareMetersPerSecond(4); - Assert.Equal(area, Area.FromSquareMeters(8)); + var area = Duration.FromSeconds(2)*KinematicViscosity.FromSquareMetersPerSecond(4); + Assert.Equal(area, Area.FromSquareMeters(8)); } [Fact] public static void KinematicViscosityDividedByLengthEqualsSpeed() { - Speed speed = KinematicViscosity.FromSquareMetersPerSecond(4)/Length.FromMeters(2); - Assert.Equal(speed, Speed.FromMetersPerSecond(2)); + var speed = KinematicViscosity.FromSquareMetersPerSecond(4)/Length.FromMeters(2); + Assert.Equal(speed, Speed.FromMetersPerSecond(2)); } [Fact] public static void KinematicViscosityTimesDurationEqualsArea() { - Area area = KinematicViscosity.FromSquareMetersPerSecond(4)*Duration.FromSeconds(2); - Assert.Equal(area, Area.FromSquareMeters(8)); + var area = KinematicViscosity.FromSquareMetersPerSecond(4)*Duration.FromSeconds(2); + Assert.Equal(area, Area.FromSquareMeters(8)); } [Fact] public static void KinematicViscosityTimesTimeSpanEqualsArea() { - Area area = KinematicViscosity.FromSquareMetersPerSecond(4)*TimeSpan.FromSeconds(2); - Assert.Equal(area, Area.FromSquareMeters(8)); + var area = KinematicViscosity.FromSquareMetersPerSecond(4)*TimeSpan.FromSeconds(2); + Assert.Equal(area, Area.FromSquareMeters(8)); } [Fact] public static void TimeSpanTimesKinematicViscosityEqualsArea() { - Area area = TimeSpan.FromSeconds(2)*KinematicViscosity.FromSquareMetersPerSecond(4); - Assert.Equal(area, Area.FromSquareMeters(8)); + var area = TimeSpan.FromSeconds(2)*KinematicViscosity.FromSquareMetersPerSecond(4); + Assert.Equal(area, Area.FromSquareMeters(8)); } [Fact] public static void KinematicViscosityTimesDensityEqualsDynamicViscosity() { - DynamicViscosity dynamicViscosity = KinematicViscosity.FromSquareMetersPerSecond(10) * Density.FromKilogramsPerCubicMeter(2); - Assert.Equal(dynamicViscosity, DynamicViscosity.FromNewtonSecondsPerMeterSquared(20)); + var dynamicViscosity = KinematicViscosity.FromSquareMetersPerSecond(10) * Density.FromKilogramsPerCubicMeter(2); + Assert.Equal(dynamicViscosity, DynamicViscosity.FromNewtonSecondsPerMeterSquared(20)); } } } diff --git a/UnitsNet.Tests/CustomCode/LapseRateTests.cs b/UnitsNet.Tests/CustomCode/LapseRateTests.cs index 4dbfd650be..f9755dd81f 100644 --- a/UnitsNet.Tests/CustomCode/LapseRateTests.cs +++ b/UnitsNet.Tests/CustomCode/LapseRateTests.cs @@ -33,29 +33,29 @@ public class LapseRateTests : LapseRateTestsBase [Fact] public void TemperatureDeltaDividedByLapseRateEqualsLength() { - Length length = TemperatureDelta.FromDegreesCelsius(50) / LapseRate.FromDegreesCelciusPerKilometer(5); - Assert.Equal(length, Length.FromKilometers(10)); + var length = TemperatureDelta.FromDegreesCelsius(50) / LapseRate.FromDegreesCelciusPerKilometer(5); + Assert.Equal(length, Length.FromKilometers(10)); } [Fact] public void TemperatureDeltaDividedByLengthEqualsLapseRate() { - LapseRate lapseRate = TemperatureDelta.FromDegreesCelsius(50) / Length.FromKilometers(10); - Assert.Equal(lapseRate, LapseRate.FromDegreesCelciusPerKilometer(5)); + var lapseRate = TemperatureDelta.FromDegreesCelsius(50) / Length.FromKilometers(10); + Assert.Equal(lapseRate, LapseRate.FromDegreesCelciusPerKilometer(5)); } [Fact] public void LengthMultipliedByLapseRateEqualsTemperatureDelta() { - TemperatureDelta temperatureDelta = Length.FromKilometers(10) * LapseRate.FromDegreesCelciusPerKilometer(5); - Assert.Equal(temperatureDelta, TemperatureDelta.FromDegreesCelsius(50)); + var temperatureDelta = Length.FromKilometers(10) * LapseRate.FromDegreesCelciusPerKilometer(5); + Assert.Equal(temperatureDelta, TemperatureDelta.FromDegreesCelsius(50)); } [Fact] public void LapseRateMultipliedByLengthEqualsTemperatureDelta() { - TemperatureDelta temperatureDelta = LapseRate.FromDegreesCelciusPerKilometer(5) * Length.FromKilometers(10); - Assert.Equal(temperatureDelta, TemperatureDelta.FromDegreesCelsius(50)); + var temperatureDelta = LapseRate.FromDegreesCelciusPerKilometer(5) * Length.FromKilometers(10); + Assert.Equal(temperatureDelta, TemperatureDelta.FromDegreesCelsius(50)); } } } diff --git a/UnitsNet.Tests/CustomCode/LengthTests.FeetInches.cs b/UnitsNet.Tests/CustomCode/LengthTests.FeetInches.cs index c07c02af5f..85f6ce6d83 100644 --- a/UnitsNet.Tests/CustomCode/LengthTests.FeetInches.cs +++ b/UnitsNet.Tests/CustomCode/LengthTests.FeetInches.cs @@ -15,7 +15,7 @@ public class FeetInchesTests [Fact] public void FeetInchesFrom() { - Length meter = Length.FromFeetInches(2, 3); + var meter = Length.FromFeetInches(2, 3); double expectedMeters = 2/FeetInOneMeter + 3/InchesInOneMeter; AssertEx.EqualTolerance(expectedMeters, meter.Meters, FeetTolerance); } @@ -23,7 +23,7 @@ public void FeetInchesFrom() [Fact] public void FeetInchesRoundTrip() { - Length meter = Length.FromFeetInches(2, 3); + var meter = Length.FromFeetInches(2, 3); FeetInches feetInches = meter.FeetInches; AssertEx.EqualTolerance(2, feetInches.Feet, FeetTolerance); AssertEx.EqualTolerance(3, feetInches.Inches, InchesTolerance); @@ -62,7 +62,7 @@ public void FeetInchesRoundTrip() [InlineData("-1ft 1in", -1.08333333)] public void TryParseFeetInches(string str, double expectedFeet) { - Assert.True(Length.TryParseFeetInches(str, out Length result)); + Assert.True(Length.TryParseFeetInches(str, out Length result)); AssertEx.EqualTolerance(expectedFeet, result.Feet, 1e-5); } @@ -85,8 +85,8 @@ public void TryParseFeetInches(string str, double expectedFeet) [InlineData("1'1`")] public void TryParseFeetInches_GivenInvalidString_ReturnsFalseAndZeroOut(string str) { - Assert.False(Length.TryParseFeetInches(str, out Length result)); - Assert.Equal(Length.Zero, result); + Assert.False(Length.TryParseFeetInches(str, out Length result )); + Assert.Equal(Length.Zero, result); } } } diff --git a/UnitsNet.Tests/CustomCode/LengthTests.cs b/UnitsNet.Tests/CustomCode/LengthTests.cs index d5dc4f4d8e..a552707692 100644 --- a/UnitsNet.Tests/CustomCode/LengthTests.cs +++ b/UnitsNet.Tests/CustomCode/LengthTests.cs @@ -76,63 +76,63 @@ public class LengthTests : LengthTestsBase [ Fact] public void AreaTimesLengthEqualsVolume() { - Volume volume = Area.FromSquareMeters(10)*Length.FromMeters(3); - Assert.Equal(volume, Volume.FromCubicMeters(30)); + var volume = Area.FromSquareMeters(10)*Length.FromMeters(3); + Assert.Equal(volume, Volume.FromCubicMeters(30)); } [Fact] public void ForceTimesLengthEqualsTorque() { - Torque torque = Force.FromNewtons(1)*Length.FromMeters(3); - Assert.Equal(torque, Torque.FromNewtonMeters(3)); + var torque = Force.FromNewtons(1)*Length.FromMeters(3); + Assert.Equal(torque, Torque.FromNewtonMeters(3)); } [Fact] public void LengthTimesAreaEqualsVolume() { - Volume volume = Length.FromMeters(3)*Area.FromSquareMeters(9); - Assert.Equal(volume, Volume.FromCubicMeters(27)); + var volume = Length.FromMeters(3)*Area.FromSquareMeters(9); + Assert.Equal(volume, Volume.FromCubicMeters(27)); } [Fact] public void LengthTimesForceEqualsTorque() { - Torque torque = Length.FromMeters(3)*Force.FromNewtons(1); - Assert.Equal(torque, Torque.FromNewtonMeters(3)); + var torque = Length.FromMeters(3)*Force.FromNewtons(1); + Assert.Equal(torque, Torque.FromNewtonMeters(3)); } [Fact] public void LengthTimesLengthEqualsArea() { - Area area = Length.FromMeters(10)*Length.FromMeters(2); - Assert.Equal(area, Area.FromSquareMeters(20)); + var area = Length.FromMeters(10)*Length.FromMeters(2); + Assert.Equal(area, Area.FromSquareMeters(20)); } [Fact] public void LengthDividedBySpeedEqualsDuration() { - Duration duration = Length.FromMeters(20) / Speed.FromMetersPerSecond(2); - Assert.Equal(Duration.FromSeconds(10), duration); + var duration = Length.FromMeters(20) / Speed.FromMetersPerSecond(2); + Assert.Equal(Duration.FromSeconds(10), duration); } [Fact] public void LengthTimesSpeedEqualsKinematicViscosity() { - KinematicViscosity kinematicViscosity = Length.FromMeters(20) * Speed.FromMetersPerSecond(2); - Assert.Equal(KinematicViscosity.FromSquareMetersPerSecond(40), kinematicViscosity); + var kinematicViscosity = Length.FromMeters(20) * Speed.FromMetersPerSecond(2); + Assert.Equal(KinematicViscosity.FromSquareMetersPerSecond(40), kinematicViscosity); } [Fact] public void LengthTimesSpecificWeightEqualsPressure() { - Pressure pressure = Length.FromMeters(2) * SpecificWeight.FromNewtonsPerCubicMeter(10); - Assert.Equal(Pressure.FromPascals(20), pressure); + var pressure = Length.FromMeters(2) * SpecificWeight.FromNewtonsPerCubicMeter(10); + Assert.Equal(Pressure.FromPascals(20), pressure); } [Fact] public void ToStringReturnsCorrectNumberAndUnitWithDefaultUnitWhichIsMeter() { - var meter = Length.FromMeters(5); + var meter = Length.FromMeters(5); string meterString = meter.ToString(); Assert.Equal("5 m", meterString); } @@ -140,7 +140,7 @@ public void ToStringReturnsCorrectNumberAndUnitWithDefaultUnitWhichIsMeter() [Fact] public void ToStringReturnsCorrectNumberAndUnitWithCentimeterAsDefualtUnit() { - var value = Length.From(2, LengthUnit.Centimeter); + var value = Length.From(2, LengthUnit.Centimeter); string valueString = value.ToString(); Assert.Equal("2 cm", valueString); } @@ -148,25 +148,25 @@ public void ToStringReturnsCorrectNumberAndUnitWithCentimeterAsDefualtUnit() [Fact] public void MaxValueIsCorrectForUnitWithBaseTypeDouble() { - Assert.Equal(double.MaxValue, Length.MaxValue.Meters); + Assert.Equal(double.MaxValue, Length.MaxValue.Meters); } [Fact] public void MinValueIsCorrectForUnitWithBaseTypeDouble() { - Assert.Equal(double.MinValue, Length.MinValue.Meters); + Assert.Equal(double.MinValue, Length.MinValue.Meters); } [Fact] public void NegativeLengthToStonePoundsReturnsCorrectValues() { - var negativeLength = Length.FromInches(-1.0); + var negativeLength = Length.FromInches(-1.0); var feetInches = negativeLength.FeetInches; Assert.Equal(0, feetInches.Feet); Assert.Equal(-1.0, feetInches.Inches); - negativeLength = Length.FromInches(-25.0); + negativeLength = Length.FromInches(-25.0); feetInches = negativeLength.FeetInches; Assert.Equal(-2.0, feetInches.Feet); @@ -176,13 +176,13 @@ public void NegativeLengthToStonePoundsReturnsCorrectValues() [Fact] public void Constructor_UnitSystemNull_ThrowsArgumentNullException() { - Assert.Throws(() => new Length(1.0, (UnitSystem)null)); + Assert.Throws(() => new Length(1.0, (UnitSystem)null)); } [Fact] public void Constructor_UnitSystemSI_AssignsSIUnit() { - var length = new Length(1.0, UnitSystem.SI); + var length = new Length(1.0, UnitSystem.SI); Assert.Equal(LengthUnit.Meter, length.Unit); } @@ -190,20 +190,20 @@ public void Constructor_UnitSystemSI_AssignsSIUnit() public void Constructor_UnitSystemWithNoMatchingBaseUnits_ThrowsArgumentException() { // AmplitudeRatio is unitless. Can't have any matches :) - Assert.Throws(() => new AmplitudeRatio(1.0, UnitSystem.SI)); + Assert.Throws(() => new AmplitudeRatio( 1.0, UnitSystem.SI)); } [Fact] public void As_GivenSIUnitSystem_ReturnsSIValue() { - var inches = new Length(2.0, LengthUnit.Inch); + var inches = new Length(2.0, LengthUnit.Inch); Assert.Equal(0.0508, inches.As(UnitSystem.SI)); } [Fact] public void ToUnit_GivenSIUnitSystem_ReturnsSIQuantity() { - var inches = new Length(2.0, LengthUnit.Inch); + var inches = new Length(2.0, LengthUnit.Inch); var inSI = inches.ToUnit(UnitSystem.SI); diff --git a/UnitsNet.Tests/CustomCode/LevelTests.cs b/UnitsNet.Tests/CustomCode/LevelTests.cs index e5d81b2eb8..6bedd1d830 100644 --- a/UnitsNet.Tests/CustomCode/LevelTests.cs +++ b/UnitsNet.Tests/CustomCode/LevelTests.cs @@ -14,14 +14,14 @@ public class LevelTests : LevelTestsBase protected override void AssertLogarithmicAddition() { - Level v = Level.FromDecibels(40); + var v = Level.FromDecibels(40); AssertEx.EqualTolerance(43.0102999566, (v + v).Decibels, DecibelsTolerance); } protected override void AssertLogarithmicSubtraction() { - Level v = Level.FromDecibels(40); - AssertEx.EqualTolerance(49.5424250944, (Level.FromDecibels(50) - v).Decibels, DecibelsTolerance); + var v = Level.FromDecibels(40); + AssertEx.EqualTolerance(49.5424250944, (Level.FromDecibels(50) - v).Decibels, DecibelsTolerance); } [Theory] @@ -30,7 +30,7 @@ protected override void AssertLogarithmicSubtraction() public void InvalidQuantity_ExpectArgumentOutOfRangeException(double quantity, double reference) { // quantity can't be zero or less than zero if reference is positive. - Assert.Throws(() => new Level(quantity, reference)); + Assert.Throws(() => new Level(quantity, reference)); } [Theory] @@ -39,7 +39,7 @@ public void InvalidQuantity_ExpectArgumentOutOfRangeException(double quantity, d public void InvalidReference_ExpectArgumentOutOfRangeException(double quantity, double reference) { // reference can't be zero or less than zero if quantity is postive. - Assert.Throws(() => new Level(quantity, reference)); + Assert.Throws(() => new Level(quantity, reference)); } } } diff --git a/UnitsNet.Tests/CustomCode/MassConcentrationTests.cs b/UnitsNet.Tests/CustomCode/MassConcentrationTests.cs index b4fc2cb9fd..1b01766a32 100644 --- a/UnitsNet.Tests/CustomCode/MassConcentrationTests.cs +++ b/UnitsNet.Tests/CustomCode/MassConcentrationTests.cs @@ -81,10 +81,10 @@ public void MolarityFromMassConcentrationAndMolarMass( double molarMassValue, MolarMassUnit molarMassUnit, double expectedMolarityValue, MolarityUnit expectedMolarityUnit, double tolerance = 1e-5) { - var massConcentration = new MassConcentration(massConcValue, massConcUnit); - var molarMass = new MolarMass(molarMassValue, molarMassUnit); + var massConcentration = new MassConcentration( massConcValue, massConcUnit); + var molarMass = new MolarMass( molarMassValue, molarMassUnit); - Molarity molarity = massConcentration.ToMolarity(molarMass); // molarity / molarMass + var molarity = massConcentration.ToMolarity(molarMass); // molarity / molarMass AssertEx.EqualTolerance(expectedMolarityValue, molarity.As(expectedMolarityUnit), tolerance); } @@ -98,10 +98,10 @@ public void VolumeConcentrationFromMassConcentrationAndDensity( double massConcValue, MassConcentrationUnit masConcUnit, double expectedVolumeConcValue, VolumeConcentrationUnit expectedVolumeConcUnit, double tolerence = 1e-5) { - var density = new Density(componentDensityValue, componentDensityUnit); - var massConcentration = new MassConcentration(massConcValue, masConcUnit); + var density = new Density(componentDensityValue, componentDensityUnit); + var massConcentration = new MassConcentration( massConcValue, masConcUnit); - VolumeConcentration volumeConcentration = massConcentration.ToVolumeConcentration(density); // massConcentration / density; + var volumeConcentration = massConcentration.ToVolumeConcentration(density); // massConcentration / density; AssertEx.EqualTolerance(expectedVolumeConcValue, volumeConcentration.As(expectedVolumeConcUnit), tolerence); } @@ -115,10 +115,10 @@ public static void ComponentMassFromMassConcentrationAndSolutionVolume( double volumeValue, VolumeUnit volumeUnit, double expectedMassValue, MassUnit expectedMassUnit, double tolerance = 1e-5) { - var massConcentration = new MassConcentration(massConcValue, massConcUnit); - var volume = new Volume(volumeValue, volumeUnit); + var massConcentration = new MassConcentration( massConcValue, massConcUnit); + var volume = new Volume( volumeValue, volumeUnit); - Mass massComponent = massConcentration * volume; + var massComponent = massConcentration * volume; AssertEx.EqualTolerance(expectedMassValue, massComponent.As(expectedMassUnit), tolerance); } @@ -127,7 +127,7 @@ public static void ComponentMassFromMassConcentrationAndSolutionVolume( [Fact(Skip = "No BaseUnit defined: see https://github.com/angularsen/UnitsNet/issues/651")] public void DefaultSIUnitIsKgPerCubicMeter() { - var massConcentration = new MassConcentration(1, UnitSystem.SI); + var massConcentration = new MassConcentration( 1, UnitSystem.SI); Assert.Equal(MassConcentrationUnit.KilogramPerCubicMeter, massConcentration.Unit); // MassConcentration.BaseUnit = KilogramPerCubicMeter } @@ -138,7 +138,7 @@ public void DefaultUnitTypeRespectedForCustomUnitSystem() UnitSystem customSystem = new UnitSystem(new BaseUnits(LengthUnit.Millimeter, MassUnit.Gram, DurationUnit.Millisecond, ElectricCurrentUnit.Ampere, TemperatureUnit.DegreeCelsius, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)); - var massConcentration = new MassConcentration(1, customSystem); + var massConcentration = new MassConcentration( 1, customSystem); Assert.Equal(MassConcentrationUnit.GramPerCubicMillimeter, massConcentration.Unit); } diff --git a/UnitsNet.Tests/CustomCode/MassFlowTests.cs b/UnitsNet.Tests/CustomCode/MassFlowTests.cs index b407d74dfa..3f16cb354a 100644 --- a/UnitsNet.Tests/CustomCode/MassFlowTests.cs +++ b/UnitsNet.Tests/CustomCode/MassFlowTests.cs @@ -79,77 +79,77 @@ public class MassFlowTests : MassFlowTestsBase [Fact] public void DurationTimesMassFlowEqualsMass() { - Mass mass = Duration.FromSeconds(4.0) * MassFlow.FromKilogramsPerSecond(20.0); - Assert.Equal(mass, Mass.FromKilograms(80.0)); + var mass = Duration.FromSeconds(4.0) * MassFlow.FromKilogramsPerSecond(20.0); + Assert.Equal(mass, Mass.FromKilograms(80.0)); } [Fact] public void MassFlowTimesDurationEqualsMass() { - Mass mass = MassFlow.FromKilogramsPerSecond(20.0) * Duration.FromSeconds(4.0); - Assert.Equal(mass, Mass.FromKilograms(80.0)); + var mass = MassFlow.FromKilogramsPerSecond(20.0) * Duration.FromSeconds(4.0); + Assert.Equal(mass, Mass.FromKilograms(80.0)); } [Fact] public void MassFlowTimesTimeSpanEqualsMass() { - Mass mass = MassFlow.FromKilogramsPerSecond(20.0) * TimeSpan.FromSeconds(4.0); - Assert.Equal(mass, Mass.FromKilograms(80.0)); + var mass = MassFlow.FromKilogramsPerSecond(20.0) * TimeSpan.FromSeconds(4.0); + Assert.Equal(mass, Mass.FromKilograms(80.0)); } [Fact] public void TimeSpanTimesMassFlowEqualsMass() { - Mass mass = TimeSpan.FromSeconds(4.0) * MassFlow.FromKilogramsPerSecond(20.0); - Assert.Equal(mass, Mass.FromKilograms(80.0)); + var mass = TimeSpan.FromSeconds(4.0) * MassFlow.FromKilogramsPerSecond(20.0); + Assert.Equal(mass, Mass.FromKilograms(80.0)); } [Fact] public void MassFlowDividedByBrakeSpecificFuelConsumptionEqualsPower() { - Power power = MassFlow.FromTonnesPerDay(20) / BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(180.0); + var power = MassFlow.FromTonnesPerDay(20) / BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(180.0); Assert.Equal(20.0 / 24.0 * 1e6 / 180.0, power.Kilowatts); } [Fact] public void MassFlowDividedByPowerEqualsBrakeSpecificFuelConsumption() { - BrakeSpecificFuelConsumption bsfc = MassFlow.FromTonnesPerDay(20) / Power.FromKilowatts(20.0 / 24.0 * 1e6 / 180.0); + var bsfc = MassFlow.FromTonnesPerDay(20) / Power.FromKilowatts(20.0 / 24.0 * 1e6 / 180.0); AssertEx.EqualTolerance(180.0, bsfc.GramsPerKiloWattHour, 1e-11); } [Fact] public void MassFlowTimesSpecificEnergyEqualsPower() { - Power power = MassFlow.FromKilogramsPerSecond(20.0) * SpecificEnergy.FromJoulesPerKilogram(10.0); + var power = MassFlow.FromKilogramsPerSecond(20.0) * SpecificEnergy.FromJoulesPerKilogram(10.0); Assert.Equal(200, power.Watts); } [Fact] public void MassFlowDividedByAreaEqualsMassFlux() { - MassFlux massFlux = MassFlow.FromKilogramsPerSecond(20) / Area.FromSquareMeters(2); + var massFlux = MassFlow.FromKilogramsPerSecond(20) / Area.FromSquareMeters(2); Assert.Equal(10, massFlux.KilogramsPerSecondPerSquareMeter); } [Fact] public void MassFlowDividedByMassFluxEqualsArea() { - Area area = MassFlow.FromKilogramsPerSecond(20) / MassFlux.FromKilogramsPerSecondPerSquareMeter(2); + var area = MassFlow.FromKilogramsPerSecond(20) / MassFlux.FromKilogramsPerSecondPerSquareMeter(2); Assert.Equal(10, area.SquareMeters); } [Fact] public void MassFlowDividedByVolumeFlowEqualsDensity() { - Density density = MassFlow.FromKilogramsPerSecond(12) / VolumeFlow.FromCubicMetersPerSecond(3); + var density = MassFlow.FromKilogramsPerSecond(12) / VolumeFlow.FromCubicMetersPerSecond(3); Assert.Equal(4, density.KilogramsPerCubicMeter); } [Fact] public void MassFlowDividedByDensityEqualsVolumeFlow() { - VolumeFlow volumeFlow = MassFlow.FromKilogramsPerSecond(20) / Density.FromKilogramsPerCubicMeter(4); + var volumeFlow = MassFlow.FromKilogramsPerSecond(20) / Density.FromKilogramsPerCubicMeter(4); Assert.Equal(5, volumeFlow.CubicMetersPerSecond); } } diff --git a/UnitsNet.Tests/CustomCode/MassFluxTests.cs b/UnitsNet.Tests/CustomCode/MassFluxTests.cs index e2dfa88e2f..c828cc8c6b 100644 --- a/UnitsNet.Tests/CustomCode/MassFluxTests.cs +++ b/UnitsNet.Tests/CustomCode/MassFluxTests.cs @@ -33,22 +33,22 @@ public class MassFluxTests : MassFluxTestsBase [Fact] public void MassFluxDividedBySpeedEqualsDensity() { - Density density = MassFlux.FromKilogramsPerSecondPerSquareMeter(20) / Speed.FromMetersPerSecond(2); - Assert.Equal(density, Density.FromKilogramsPerCubicMeter(10)); + var density = MassFlux.FromKilogramsPerSecondPerSquareMeter(20) / Speed.FromMetersPerSecond(2); + Assert.Equal(density, Density.FromKilogramsPerCubicMeter(10)); } [Fact] public void MassFluxDividedByDensityEqualsSpeed() { - Speed speed = MassFlux.FromKilogramsPerSecondPerSquareMeter(20) / Density.FromKilogramsPerCubicMeter(2); - Assert.Equal(speed, Speed.FromMetersPerSecond(10)); + var speed = MassFlux.FromKilogramsPerSecondPerSquareMeter(20) / Density.FromKilogramsPerCubicMeter(2); + Assert.Equal(speed, Speed.FromMetersPerSecond(10)); } [Fact] public void MassFluxTimesAreaEqualsMassFlow() { - MassFlow massFlow = MassFlux.FromKilogramsPerSecondPerSquareMeter(20) * Area.FromSquareMeters(2); - Assert.Equal(massFlow, MassFlow.FromKilogramsPerSecond(40)); + var massFlow = MassFlux.FromKilogramsPerSecondPerSquareMeter(20) * Area.FromSquareMeters(2); + Assert.Equal(massFlow, MassFlow.FromKilogramsPerSecond(40)); } } } diff --git a/UnitsNet.Tests/CustomCode/MassFractionTests.cs b/UnitsNet.Tests/CustomCode/MassFractionTests.cs index 4f29919a7a..cb98e171b0 100644 --- a/UnitsNet.Tests/CustomCode/MassFractionTests.cs +++ b/UnitsNet.Tests/CustomCode/MassFractionTests.cs @@ -60,10 +60,10 @@ public class MassFractionTests : MassFractionTestsBase [Fact] public void MassFractionFromMassesConstructedCorrectly() { - var one_kg = Mass.FromKilograms(1); - var two_kg = Mass.FromKilograms(2); + var one_kg = Mass.FromKilograms(1); + var two_kg = Mass.FromKilograms(2); - var massFraction = MassFraction.FromMasses(one_kg, two_kg); + var massFraction = MassFraction.FromMasses(one_kg, two_kg); AssertEx.EqualTolerance(50, massFraction.Percent, PercentTolerance); } @@ -71,8 +71,8 @@ public void MassFractionFromMassesConstructedCorrectly() [Fact] public void TotalMassFromMassFraction() { - var componentMass = Mass.FromKilograms(1); - var massFraction = MassFraction.FromPercent(50); + var componentMass = Mass.FromKilograms(1); + var massFraction = MassFraction.FromPercent(50); var totalMass = massFraction.GetTotalMass(componentMass); @@ -82,8 +82,8 @@ public void TotalMassFromMassFraction() [Fact] public void ComponentMassFromMassFraction() { - var totalMass = Mass.FromKilograms(2); - var massFraction = MassFraction.FromPercent(50); + var totalMass = Mass.FromKilograms(2); + var massFraction = MassFraction.FromPercent(50); var componentMass = massFraction.GetComponentMass(totalMass); diff --git a/UnitsNet.Tests/CustomCode/MassTests.cs b/UnitsNet.Tests/CustomCode/MassTests.cs index 18cb904f33..aef66caf63 100644 --- a/UnitsNet.Tests/CustomCode/MassTests.cs +++ b/UnitsNet.Tests/CustomCode/MassTests.cs @@ -66,48 +66,48 @@ public class MassTests : MassTestsBase [Fact] public void AccelerationTimesMassEqualsForce() { - Force force = Acceleration.FromMetersPerSecondSquared(3)*Mass.FromKilograms(18); - Assert.Equal(force, Force.FromNewtons(54)); + var force = Acceleration.FromMetersPerSecondSquared(3)*Mass.FromKilograms(18); + Assert.Equal(force, Force.FromNewtons(54)); } [Fact] public void MassDividedByDurationEqualsMassFlow() { - MassFlow massFlow = Mass.FromKilograms(18.0)/Duration.FromSeconds(6); - Assert.Equal(massFlow, MassFlow.FromKilogramsPerSecond(3.0)); + var massFlow = Mass.FromKilograms(18.0)/Duration.FromSeconds(6); + Assert.Equal(massFlow, MassFlow.FromKilogramsPerSecond(3.0)); } [Fact] public void MassDividedByTimeSpanEqualsMassFlow() { - MassFlow massFlow = Mass.FromKilograms(18.0)/TimeSpan.FromSeconds(6); - Assert.Equal(massFlow, MassFlow.FromKilogramsPerSecond(3.0)); + var massFlow = Mass.FromKilograms(18.0)/TimeSpan.FromSeconds(6); + Assert.Equal(massFlow, MassFlow.FromKilogramsPerSecond(3.0)); } [Fact] public void MassDividedByVolumeEqualsDensity() { - Density density = Mass.FromKilograms(18)/Volume.FromCubicMeters(3); - Assert.Equal(density, Density.FromKilogramsPerCubicMeter(6)); + var density = Mass.FromKilograms(18)/Volume.FromCubicMeters(3); + Assert.Equal(density, Density.FromKilogramsPerCubicMeter(6)); } [Fact] public void MassTimesAccelerationEqualsForce() { - Force force = Mass.FromKilograms(18)*Acceleration.FromMetersPerSecondSquared(3); - Assert.Equal(force, Force.FromNewtons(54)); + var force = Mass.FromKilograms(18)*Acceleration.FromMetersPerSecondSquared(3); + Assert.Equal(force, Force.FromNewtons(54)); } [Fact] public void NegativeMassToStonePoundsReturnsCorrectValues() { - var negativeMass = Mass.FromPounds(-1.0); + var negativeMass = Mass.FromPounds(-1.0); var stonePounds = negativeMass.StonePounds; Assert.Equal(0, stonePounds.Stone); Assert.Equal(-1.0, stonePounds.Pounds); - negativeMass = Mass.FromPounds(-25.0); + negativeMass = Mass.FromPounds(-25.0); stonePounds = negativeMass.StonePounds; Assert.Equal(-1.0, stonePounds.Stone); @@ -123,10 +123,10 @@ public void AmountOfSubstanceFromMassAndMolarMass( double molarMassValue, MolarMassUnit molarMassUnit, double expectedAmountOfSubstanceValue, AmountOfSubstanceUnit expectedAmountOfSubstanceUnit, double tolerence = 1e-5) { - var mass = new Mass(massValue, massUnit); - var molarMass = new MolarMass(molarMassValue, molarMassUnit); + var mass = new Mass(massValue, massUnit); + var molarMass = new MolarMass(molarMassValue, molarMassUnit); - AmountOfSubstance amountOfSubstance = mass / molarMass; + var amountOfSubstance = mass / molarMass; AssertEx.EqualTolerance(expectedAmountOfSubstanceValue, amountOfSubstance.As(expectedAmountOfSubstanceUnit), tolerence); } diff --git a/UnitsNet.Tests/CustomCode/MolarityTests.cs b/UnitsNet.Tests/CustomCode/MolarityTests.cs index c7cfadd076..8c3550885c 100644 --- a/UnitsNet.Tests/CustomCode/MolarityTests.cs +++ b/UnitsNet.Tests/CustomCode/MolarityTests.cs @@ -51,11 +51,11 @@ public void VolumeConcentrationFromComponentDensityAndMolarity( double componentMolarMassValue, MolarMassUnit compontMolarMassUnit, double expectedVolumeConcValue, VolumeConcentrationUnit expectedVolumeConcUnit, double tolerence = 1e-5) { - var molarity = new Molarity(molarityValue, molarityUnit); - var componentDensity = new Density(componentDensityValue, componentDensityUnit); - var componentMolarMass = new MolarMass(componentMolarMassValue, compontMolarMassUnit); + var molarity = new Molarity( molarityValue, molarityUnit); + var componentDensity = new Density( componentDensityValue, componentDensityUnit); + var componentMolarMass = new MolarMass( componentMolarMassValue, compontMolarMassUnit); - VolumeConcentration volumeConcentration = molarity.ToVolumeConcentration(componentDensity, componentMolarMass); + var volumeConcentration = molarity.ToVolumeConcentration(componentDensity, componentMolarMass); AssertEx.EqualTolerance(expectedVolumeConcValue, volumeConcentration.As(expectedVolumeConcUnit), tolerence); } @@ -72,10 +72,10 @@ public void ExpectMolarityConvertedToMassConcentrationCorrectly( double componentMolarMassValue, MolarMassUnit compontMolarMassUnit, double expectedMassConcValue, MassConcentrationUnit expectedMassConcUnit, double tolerence = 1e-5) { - var molarity = new Molarity(molarityValue, molarityUnit); - var componentMolarMass = new MolarMass(componentMolarMassValue, compontMolarMassUnit); + var molarity = new Molarity(molarityValue, molarityUnit); + var componentMolarMass = new MolarMass( componentMolarMassValue, compontMolarMassUnit); - MassConcentration concentration = molarity.ToMassConcentration(componentMolarMass); // molarity * molarMass + var concentration = molarity.ToMassConcentration(componentMolarMass); // molarity * molarMass AssertEx.EqualTolerance(expectedMassConcValue, concentration.As(expectedMassConcUnit), tolerence); } @@ -89,10 +89,10 @@ public void MolarityFromDilutedSolution( double newConcentration, VolumeConcentrationUnit newConcentrationUnit, double expectedMolarityValue, MolarityUnit expectedMolarityUnit, double tolerence = 1e-5) { - var startingMolarity = new Molarity(startingMolarityValue, startingMolarityUnit); - var newVolumeConc = new VolumeConcentration(newConcentration, newConcentrationUnit); + var startingMolarity = new Molarity( startingMolarityValue, startingMolarityUnit); + var newVolumeConc = new VolumeConcentration( newConcentration, newConcentrationUnit); - Molarity dilutedMolarity = startingMolarity * newVolumeConc; + var dilutedMolarity = startingMolarity * newVolumeConc; AssertEx.EqualTolerance(expectedMolarityValue, dilutedMolarity.As(expectedMolarityUnit), tolerence); } @@ -100,13 +100,13 @@ public void MolarityFromDilutedSolution( [Fact] public void OneMolarFromStringParsedCorrectly() { - Assert.Equal(Molarity.Parse("1M"), Molarity.Parse("1 mol/L")); + Assert.Equal(Molarity.Parse("1M"), Molarity.Parse("1 mol/L")); } [Fact] public void OneMilliMolarFromStringParsedCorrectly() { - Assert.Equal(1, Molarity.Parse("1000 mM").MolesPerLiter); + Assert.Equal(1, Molarity.Parse("1000 mM").MolesPerLiter); } } diff --git a/UnitsNet.Tests/CustomCode/ParseTests.cs b/UnitsNet.Tests/CustomCode/ParseTests.cs index 06a1f7cdc9..e8ecd830c0 100644 --- a/UnitsNet.Tests/CustomCode/ParseTests.cs +++ b/UnitsNet.Tests/CustomCode/ParseTests.cs @@ -28,7 +28,7 @@ public class ParseTests public void ParseLengthToMetersUsEnglish(string s, double expected) { CultureInfo usEnglish = new CultureInfo("en-US"); - double actual = Length.Parse(s, usEnglish).Meters; + double actual = Length.Parse(s, usEnglish).Meters; Assert.Equal(expected, actual); } @@ -42,7 +42,7 @@ public void ParseLengthToMetersUsEnglish(string s, double expected) public void ParseLength_InvalidString_USEnglish_ThrowsException(string s, Type expectedExceptionType) { var usEnglish = new CultureInfo("en-US"); - Assert.Throws(expectedExceptionType, () => Length.Parse(s, usEnglish)); + Assert.Throws(expectedExceptionType, () => Length.Parse(s, usEnglish)); } /// Error parsing string. @@ -58,7 +58,7 @@ public void ParseWithCultureUsingSpaceAsThousandSeparators(string s, double expe numberFormat.NumberDecimalSeparator = "."; numberFormat.CurrencyDecimalSeparator = "."; - double actual = Length.Parse(s, numberFormat).Meters; + double actual = Length.Parse(s, numberFormat).Meters; Assert.Equal(expected, actual); } @@ -73,7 +73,7 @@ public void ParseWithCultureUsingSpaceAsThousandSeparators_ThrowsExceptionOnInva numberFormat.NumberDecimalSeparator = "."; numberFormat.CurrencyDecimalSeparator = "."; - Assert.Throws(expectedExceptionType, () => Length.Parse(s, numberFormat)); + Assert.Throws(expectedExceptionType, () => Length.Parse(s, numberFormat)); } /// Error parsing string. @@ -89,15 +89,15 @@ public void ParseWithCultureUsingDotAsThousandSeparators(string s, double expect numberFormat.NumberDecimalSeparator = ","; numberFormat.CurrencyDecimalSeparator = ","; - double actual = Length.Parse(s, numberFormat).Meters; + double actual = Length.Parse(s, numberFormat).Meters; Assert.Equal(expected, actual); } [Fact] public void ParseMultiWordAbbreviations() { - Assert.Equal(Mass.FromShortTons(333), Mass.Parse("333 short tn")); - Assert.Equal(Mass.FromLongTons(333), Mass.Parse("333 long tn")); + Assert.Equal(Mass.FromShortTons(333), Mass.Parse("333 short tn")); + Assert.Equal(Mass.FromLongTons(333), Mass.Parse("333 long tn")); } [Theory] @@ -110,7 +110,7 @@ public void ParseWithCultureUsingDotAsThousandSeparators_ThrowsExceptionOnInvali numberFormat.NumberDecimalSeparator = ","; numberFormat.CurrencyDecimalSeparator = ","; - Assert.Throws(expectedExceptionType, () => Length.Parse(s, numberFormat)); + Assert.Throws(expectedExceptionType, () => Length.Parse(s, numberFormat)); } [Theory] @@ -118,7 +118,7 @@ public void ParseWithCultureUsingDotAsThousandSeparators_ThrowsExceptionOnInvali public void ParseLengthUnitUsEnglish(string s, LengthUnit expected) { CultureInfo usEnglish = new CultureInfo("en-US"); - LengthUnit actual = Length.ParseUnit(s, usEnglish); + LengthUnit actual = Length.ParseUnit(s, usEnglish); Assert.Equal(expected, actual); } @@ -128,7 +128,7 @@ public void ParseLengthUnitUsEnglish(string s, LengthUnit expected) public void ParseLengthUnitUsEnglish_ThrowsExceptionOnInvalidString(string s, Type expectedExceptionType) { var usEnglish = new CultureInfo("en-US"); - Assert.Throws(expectedExceptionType, () => Length.ParseUnit(s, usEnglish)); + Assert.Throws(expectedExceptionType, () => Length.ParseUnit(s, usEnglish)); } [Theory] @@ -140,7 +140,7 @@ public void ParseLengthUnitUsEnglish_ThrowsExceptionOnInvalidString(string s, Ty public void TryParseLengthUnitUsEnglish(string s, bool expected) { CultureInfo usEnglish = new CultureInfo("en-US"); - bool actual = Length.TryParse(s, usEnglish, out Length _); + bool actual = Length.TryParse(s, usEnglish, out Length _ ); Assert.Equal(expected, actual); } @@ -153,7 +153,7 @@ public void TryParseLengthUnitUsEnglish(string s, bool expected) [InlineData("1 кг", "ru-RU", 1, MassUnit.Kilogram)] public void ParseMassWithPrefixUnits_GivenCulture_ReturnsQuantityWithSameUnitAndValue(string str, string cultureName, double expectedValue, Enum expectedUnit) { - var actual = Mass.Parse(str, new CultureInfo(cultureName)); + var actual = Mass.Parse(str, new CultureInfo(cultureName)); Assert.Equal(expectedUnit, actual.Unit); Assert.Equal(expectedValue, actual.Value); @@ -168,7 +168,7 @@ public void ParseMassWithPrefixUnits_GivenCulture_ReturnsQuantityWithSameUnitAnd [InlineData("1 км", "ru-RU", 1, LengthUnit.Kilometer)] public void ParseLengthWithPrefixUnits_GivenCulture_ReturnsQuantityWithSameUnitAndValue(string str, string cultureName, double expectedValue, Enum expectedUnit) { - var actual = Length.Parse(str, new CultureInfo(cultureName)); + var actual = Length.Parse(str, new CultureInfo(cultureName)); Assert.Equal(expectedUnit, actual.Unit); Assert.Equal(expectedValue, actual.Value); @@ -183,7 +183,7 @@ public void ParseLengthWithPrefixUnits_GivenCulture_ReturnsQuantityWithSameUnitA [InlineData("1 кН", "ru-RU", 1, ForceUnit.Kilonewton)] public void ParseForceWithPrefixUnits_GivenCulture_ReturnsQuantityWithSameUnitAndValue(string str, string cultureName, double expectedValue, Enum expectedUnit) { - var actual = Force.Parse(str, new CultureInfo(cultureName)); + var actual = Force.Parse(str, new CultureInfo(cultureName)); Assert.Equal(expectedUnit, actual.Unit); Assert.Equal(expectedValue, actual.Value); @@ -204,7 +204,7 @@ public void ParseForceWithPrefixUnits_GivenCulture_ReturnsQuantityWithSameUnitAn [InlineData("1 MiB", "ru-RU", 1, InformationUnit.Mebibyte)] public void ParseInformationWithPrefixUnits_GivenCulture_ReturnsQuantityWithSameUnitAndValue(string str, string cultureName, decimal expectedValue, Enum expectedUnit) { - var actual = Information.Parse(str, new CultureInfo(cultureName)); + var actual = Information.Parse(str, new CultureInfo(cultureName)); Assert.Equal(expectedUnit, actual.Unit); Assert.Equal(expectedValue, actual.Value); diff --git a/UnitsNet.Tests/CustomCode/PowerRatioTests.cs b/UnitsNet.Tests/CustomCode/PowerRatioTests.cs index 896c60b9bc..1ea68d71bb 100644 --- a/UnitsNet.Tests/CustomCode/PowerRatioTests.cs +++ b/UnitsNet.Tests/CustomCode/PowerRatioTests.cs @@ -14,14 +14,14 @@ public class PowerRatioTests : PowerRatioTestsBase protected override void AssertLogarithmicAddition() { - PowerRatio v = PowerRatio.FromDecibelWatts(40); + var v = PowerRatio.FromDecibelWatts(40); AssertEx.EqualTolerance(43.0102999566, (v + v).DecibelWatts, DecibelWattsTolerance); } protected override void AssertLogarithmicSubtraction() { - PowerRatio v = PowerRatio.FromDecibelWatts(40); - AssertEx.EqualTolerance(49.5424250944, (PowerRatio.FromDecibelWatts(50) - v).DecibelWatts, DecibelWattsTolerance); + var v = PowerRatio.FromDecibelWatts(40); + AssertEx.EqualTolerance(49.5424250944, (PowerRatio.FromDecibelWatts(50) - v).DecibelWatts, DecibelWattsTolerance); } [Theory] @@ -30,7 +30,7 @@ protected override void AssertLogarithmicSubtraction() [InlineData(-10)] public void InvalidPower_ExpectArgumentOutOfRangeException(double power) { - Assert.Throws(() => PowerRatio.FromPower(Power.FromWatts(power))); + Assert.Throws(() => PowerRatio.FromPower(Power.FromWatts(power))); } [Theory] @@ -39,8 +39,8 @@ public void InvalidPower_ExpectArgumentOutOfRangeException(double power) [InlineData(100, 20)] public void ExpectPowerConvertedCorrectly(double power, double expected) { - Power p = Power.FromWatts(power); - double actual = PowerRatio.FromPower(p).DecibelWatts; + var p = Power.FromWatts(power); + double actual = PowerRatio.FromPower(p).DecibelWatts; Assert.Equal(expected, actual); } @@ -52,7 +52,7 @@ public void ExpectPowerConvertedCorrectly(double power, double expected) [InlineData(20, 100)] public void ExpectPowerRatioConvertedCorrectly(double powerRatio, double expected) { - PowerRatio pr = PowerRatio.FromDecibelWatts(powerRatio); + var pr = PowerRatio.FromDecibelWatts(powerRatio); double actual = pr.ToPower().Watts; Assert.Equal(expected, actual); } @@ -66,9 +66,9 @@ public void ExpectPowerRatioConvertedCorrectly(double powerRatio, double expecte [InlineData(-6.99, 40)] public void PowerRatioToAmplitudeRatio_50OhmImpedance(double dBmW, double expected) { - PowerRatio powerRatio = PowerRatio.FromDecibelMilliwatts(dBmW); + var powerRatio = PowerRatio.FromDecibelMilliwatts(dBmW); - double actual = Math.Round(powerRatio.ToAmplitudeRatio(ElectricResistance.FromOhms(50)).DecibelMillivolts, 2); + double actual = Math.Round(powerRatio.ToAmplitudeRatio(ElectricResistance.FromOhms(50)).DecibelMillivolts, 2); Assert.Equal(expected, actual); } @@ -79,9 +79,9 @@ public void PowerRatioToAmplitudeRatio_50OhmImpedance(double dBmW, double expect [InlineData(-8.75, 40)] public void PowerRatioToAmplitudeRatio_75OhmImpedance(double dBmW, double expected) { - PowerRatio powerRatio = PowerRatio.FromDecibelMilliwatts(dBmW); + var powerRatio = PowerRatio.FromDecibelMilliwatts(dBmW); - double actual = Math.Round(powerRatio.ToAmplitudeRatio(ElectricResistance.FromOhms(75)).DecibelMillivolts, 2); + double actual = Math.Round(powerRatio.ToAmplitudeRatio(ElectricResistance.FromOhms(75)).DecibelMillivolts, 2); Assert.Equal(expected, actual); } } diff --git a/UnitsNet.Tests/CustomCode/PowerTests.cs b/UnitsNet.Tests/CustomCode/PowerTests.cs index 5afce66a84..acbbda2527 100644 --- a/UnitsNet.Tests/CustomCode/PowerTests.cs +++ b/UnitsNet.Tests/CustomCode/PowerTests.cs @@ -51,71 +51,71 @@ public class PowerTests : PowerTestsBase [Fact] public void DurationTimesPowerEqualsEnergy() { - Energy energy = Duration.FromSeconds(8.0) * Power.FromWatts(5.0); - Assert.Equal(energy, Energy.FromJoules(40.0)); + var energy = Duration.FromSeconds(8.0) * Power.FromWatts(5.0); + Assert.Equal(energy, Energy.FromJoules(40.0)); } [Fact] public void PowerDividedByRotationalSpeedEqualsForce() { - Torque torque = Power.FromWatts(15.0) / RotationalSpeed.FromRadiansPerSecond(3); - Assert.Equal(torque, Torque.FromNewtonMeters(5)); + var torque = Power.FromWatts(15.0) / RotationalSpeed.FromRadiansPerSecond(3); + Assert.Equal(torque, Torque.FromNewtonMeters(5)); } [Fact] public void PowerDividedBySpeedEqualsForce() { - Force force = Power.FromWatts(15.0) / Speed.FromMetersPerSecond(3); - Assert.Equal(force, Force.FromNewtons(5)); + var force = Power.FromWatts(15.0) / Speed.FromMetersPerSecond(3); + Assert.Equal(force, Force.FromNewtons(5)); } [Fact] public void PowerDividedByTorqueEqualsRotationalSpeed() { - RotationalSpeed rotationalSpeed = Power.FromWatts(15.0) / Torque.FromNewtonMeters(3); - Assert.Equal(rotationalSpeed, RotationalSpeed.FromRadiansPerSecond(5)); + var rotationalSpeed = Power.FromWatts(15.0) / Torque.FromNewtonMeters(3); + Assert.Equal(rotationalSpeed, RotationalSpeed.FromRadiansPerSecond(5)); } [Fact] public void PowerTimesDurationEqualsEnergy() { - Energy energy = Power.FromWatts(5.0) * Duration.FromSeconds(8.0); - Assert.Equal(energy, Energy.FromJoules(40.0)); + var energy = Power.FromWatts(5.0) * Duration.FromSeconds(8.0); + Assert.Equal(energy, Energy.FromJoules(40.0)); } [Fact] public void PowerTimesTimeSpanEqualsEnergy() { - Energy energy = Power.FromWatts(5.0) * TimeSpan.FromSeconds(8.0); - Assert.Equal(energy, Energy.FromJoules(40.0)); + var energy = Power.FromWatts(5.0) * TimeSpan.FromSeconds(8.0); + Assert.Equal(energy, Energy.FromJoules(40.0)); } [Fact] public void TimeSpanTimesPowerEqualsEnergy() { - Energy energy = TimeSpan.FromSeconds(8.0) * Power.FromWatts(5.0); - Assert.Equal(energy, Energy.FromJoules(40.0)); + var energy = TimeSpan.FromSeconds(8.0) * Power.FromWatts(5.0); + Assert.Equal(energy, Energy.FromJoules(40.0)); } [Fact] public void PowerTimesBrakeSpecificFuelConsumptionEqualsMassFlow() { - MassFlow massFlow = Power.FromKilowatts(20.0 / 24.0 * 1e6 / 180.0) * BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(180.0); + var massFlow = Power.FromKilowatts(20.0 / 24.0 * 1e6 / 180.0) * BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(180.0); AssertEx.EqualTolerance(massFlow.TonnesPerDay, 20.0, 1e-11); } [Fact] public void PowerDividedByMassFlowEqualsSpecificEnergy() { - SpecificEnergy specificEnergy = Power.FromWatts(15.0) / MassFlow.FromKilogramsPerSecond(3); - Assert.Equal(specificEnergy, SpecificEnergy.FromJoulesPerKilogram(5)); + var specificEnergy = Power.FromWatts(15.0) / MassFlow.FromKilogramsPerSecond(3); + Assert.Equal(specificEnergy, SpecificEnergy.FromJoulesPerKilogram(5)); } [Fact] public void PowerDividedBySpecificEnergyEqualsMassFlow() { - MassFlow massFlow = Power.FromWatts(15.0) / SpecificEnergy.FromJoulesPerKilogram(3); - Assert.Equal(massFlow, MassFlow.FromKilogramsPerSecond(5)); + var massFlow = Power.FromWatts(15.0) / SpecificEnergy.FromJoulesPerKilogram(3); + Assert.Equal(massFlow, MassFlow.FromKilogramsPerSecond(5)); } } } diff --git a/UnitsNet.Tests/CustomCode/PressureTests.cs b/UnitsNet.Tests/CustomCode/PressureTests.cs index 645501b341..24c28ba7dc 100644 --- a/UnitsNet.Tests/CustomCode/PressureTests.cs +++ b/UnitsNet.Tests/CustomCode/PressureTests.cs @@ -93,29 +93,29 @@ public class PressureTests : PressureTestsBase [Fact] public void AreaTimesPressureEqualsForce() { - Force force = Area.FromSquareMeters(3)*Pressure.FromPascals(20); - Assert.Equal(force, Force.FromNewtons(60)); + var force = Area.FromSquareMeters(3)*Pressure.FromPascals(20); + Assert.Equal(force, Force.FromNewtons(60)); } [Fact] public void PressureTimesAreaEqualsForce() { - Force force = Pressure.FromPascals(20)*Area.FromSquareMeters(3); - Assert.Equal(force, Force.FromNewtons(60)); + var force = Pressure.FromPascals(20)*Area.FromSquareMeters(3); + Assert.Equal(force, Force.FromNewtons(60)); } [Fact] public void PressureDividedBySpecificWeightEqualsLength() { - Length length = Pressure.FromPascals(20) / SpecificWeight.FromNewtonsPerCubicMeter(2); - Assert.Equal(Length.FromMeters(10), length); + var length = Pressure.FromPascals(20) / SpecificWeight.FromNewtonsPerCubicMeter(2); + Assert.Equal(Length.FromMeters(10), length); } [Fact] public void PressureDividedByLengthEqualsSpecificWeight() { - SpecificWeight specificWeight = Pressure.FromPascals(20) / Length.FromMeters(2); - Assert.Equal(SpecificWeight.FromNewtonsPerCubicMeter(10), specificWeight); + var specificWeight = Pressure.FromPascals(20) / Length.FromMeters(2); + Assert.Equal(SpecificWeight.FromNewtonsPerCubicMeter(10), specificWeight); } } } diff --git a/UnitsNet.Tests/CustomCode/RotationalSpeedTests.cs b/UnitsNet.Tests/CustomCode/RotationalSpeedTests.cs index e65f9f8f92..6acb05e6eb 100644 --- a/UnitsNet.Tests/CustomCode/RotationalSpeedTests.cs +++ b/UnitsNet.Tests/CustomCode/RotationalSpeedTests.cs @@ -37,29 +37,29 @@ public class RotationalSpeedTests : RotationalSpeedTestsBase [Fact] public void DurationTimesRotationalSpeedEqualsAngle() { - Angle angle = Duration.FromSeconds(9.0)*RotationalSpeed.FromRadiansPerSecond(10.0); - Assert.Equal(angle, Angle.FromRadians(90.0)); + var angle = Duration.FromSeconds(9.0)*RotationalSpeed.FromRadiansPerSecond(10.0); + Assert.Equal(angle, Angle.FromRadians(90.0)); } [Fact] public void RotationalSpeedTimesDurationEqualsAngle() { - Angle angle = RotationalSpeed.FromRadiansPerSecond(10.0)*Duration.FromSeconds(9.0); - Assert.Equal(angle, Angle.FromRadians(90.0)); + var angle = RotationalSpeed.FromRadiansPerSecond(10.0)*Duration.FromSeconds(9.0); + Assert.Equal(angle, Angle.FromRadians(90.0)); } [Fact] public void RotationalSpeedTimesTimeSpanEqualsAngle() { - Angle angle = RotationalSpeed.FromRadiansPerSecond(10.0)*TimeSpan.FromSeconds(9.0); - Assert.Equal(angle, Angle.FromRadians(90.0)); + var angle = RotationalSpeed.FromRadiansPerSecond(10.0)*TimeSpan.FromSeconds(9.0); + Assert.Equal(angle, Angle.FromRadians(90.0)); } [Fact] public void TimeSpanTimesRotationalSpeedEqualsAngle() { - Angle angle = TimeSpan.FromSeconds(9.0)*RotationalSpeed.FromRadiansPerSecond(10.0); - Assert.Equal(angle, Angle.FromRadians(90.0)); + var angle = TimeSpan.FromSeconds(9.0)*RotationalSpeed.FromRadiansPerSecond(10.0); + Assert.Equal(angle, Angle.FromRadians(90.0)); } } } diff --git a/UnitsNet.Tests/CustomCode/SpecificEnergyTests.cs b/UnitsNet.Tests/CustomCode/SpecificEnergyTests.cs index ce4904b089..c15bf9553c 100644 --- a/UnitsNet.Tests/CustomCode/SpecificEnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/SpecificEnergyTests.cs @@ -20,35 +20,35 @@ public class SpecificEnergyTests : SpecificEnergyTestsBase [Fact] public void MassTimesSpecificEnergyEqualsEnergy() { - Energy energy = Mass.FromKilograms(20.0)*SpecificEnergy.FromJoulesPerKilogram(10.0); + var energy = Mass.FromKilograms(20.0)*SpecificEnergy.FromJoulesPerKilogram(10.0); Assert.Equal(200d, energy.Joules); } [Fact] public void SpecificEnergyTimesMassEqualsEnergy() { - Energy energy = SpecificEnergy.FromJoulesPerKilogram(10.0)*Mass.FromKilograms(20.0); + var energy = SpecificEnergy.FromJoulesPerKilogram(10.0)*Mass.FromKilograms(20.0); Assert.Equal(200d, energy.Joules); } [Fact] public void DoubleDividedBySpecificEnergyEqualsBrakeSpecificFuelConsumption() { - BrakeSpecificFuelConsumption bsfc = 2.0 / SpecificEnergy.FromJoulesPerKilogram(4.0); - Assert.Equal(BrakeSpecificFuelConsumption.FromKilogramsPerJoule(0.5), bsfc); + var bsfc = 2.0 / SpecificEnergy.FromJoulesPerKilogram(4.0); + Assert.Equal(BrakeSpecificFuelConsumption.FromKilogramsPerJoule(0.5), bsfc); } [Fact] public void SpecificEnergyTimesMassFlowEqualsPower() { - Power power = SpecificEnergy.FromJoulesPerKilogram(10.0) * MassFlow.FromKilogramsPerSecond(20.0); + var power = SpecificEnergy.FromJoulesPerKilogram(10.0) * MassFlow.FromKilogramsPerSecond(20.0); Assert.Equal(200d, power.Watts); } [Fact] public void SpecificEnergyTimesBrakeSpecificFuelConsumptionEqualsEnergy() { - double value = SpecificEnergy.FromJoulesPerKilogram(10.0) * BrakeSpecificFuelConsumption.FromKilogramsPerJoule(20.0); + double value = SpecificEnergy.FromJoulesPerKilogram(10.0) * BrakeSpecificFuelConsumption.FromKilogramsPerJoule(20.0); Assert.Equal(200d, value); } } diff --git a/UnitsNet.Tests/CustomCode/SpecificVolumeTests.cs b/UnitsNet.Tests/CustomCode/SpecificVolumeTests.cs index 22fa0ff17e..36f4ff243f 100644 --- a/UnitsNet.Tests/CustomCode/SpecificVolumeTests.cs +++ b/UnitsNet.Tests/CustomCode/SpecificVolumeTests.cs @@ -35,15 +35,15 @@ public class SpecificVolumeTests : SpecificVolumeTestsBase [Fact] public static void SpecificVolumeTimesMassEqualsVolume() { - Volume volume = SpecificVolume.FromCubicMetersPerKilogram(5) * Mass.FromKilograms(10); - Assert.Equal(volume, Volume.FromCubicMeters(50)); + var volume = SpecificVolume.FromCubicMetersPerKilogram(5) * Mass.FromKilograms(10); + Assert.Equal(volume, Volume.FromCubicMeters(50)); } [Fact] public static void ConstantOverSpecificVolumeEqualsDensity() { - Density density = 5 / SpecificVolume.FromCubicMetersPerKilogram(20); - Assert.Equal(density, Density.FromKilogramsPerCubicMeter(0.25)); + var density = 5 / SpecificVolume.FromCubicMetersPerKilogram(20); + Assert.Equal(density, Density.FromKilogramsPerCubicMeter(0.25)); } } } diff --git a/UnitsNet.Tests/CustomCode/SpecificWeightTests.cs b/UnitsNet.Tests/CustomCode/SpecificWeightTests.cs index ca86cd7f5e..91dc963676 100644 --- a/UnitsNet.Tests/CustomCode/SpecificWeightTests.cs +++ b/UnitsNet.Tests/CustomCode/SpecificWeightTests.cs @@ -44,22 +44,22 @@ public class SpecificWeightTests : SpecificWeightTestsBase [Fact] public void SpecificWeightTimesLengthEqualsPressure() { - Pressure pressure = SpecificWeight.FromNewtonsPerCubicMeter(10) * Length.FromMeters(2); - Assert.Equal(Pressure.FromPascals(20), pressure); + var pressure = SpecificWeight.FromNewtonsPerCubicMeter(10) * Length.FromMeters(2); + Assert.Equal(Pressure.FromPascals(20), pressure); } [Fact] public void SpecificWeightDividedByDensityEqualsAcceleration() { - Acceleration acceleration = SpecificWeight.FromNewtonsPerCubicMeter(40) / Density.FromKilogramsPerCubicMeter(4); - Assert.Equal(Acceleration.FromMetersPerSecondSquared(10), acceleration); + var acceleration = SpecificWeight.FromNewtonsPerCubicMeter(40) / Density.FromKilogramsPerCubicMeter(4); + Assert.Equal(Acceleration.FromMetersPerSecondSquared(10), acceleration); } [Fact] public void SpecificWeightDividedByAccelerationEqualsDensity() { - Density density = SpecificWeight.FromNewtonsPerCubicMeter(20) / Acceleration.FromMetersPerSecondSquared(2); - Assert.Equal(Density.FromKilogramsPerCubicMeter(10), density); + var density = SpecificWeight.FromNewtonsPerCubicMeter(20) / Acceleration.FromMetersPerSecondSquared(2); + Assert.Equal(Density.FromKilogramsPerCubicMeter(10), density); } } } diff --git a/UnitsNet.Tests/CustomCode/SpeedTests.cs b/UnitsNet.Tests/CustomCode/SpeedTests.cs index cc96ce9c80..964cfc3710 100644 --- a/UnitsNet.Tests/CustomCode/SpeedTests.cs +++ b/UnitsNet.Tests/CustomCode/SpeedTests.cs @@ -75,86 +75,86 @@ public class SpeedTests : SpeedTestsBase [Fact] public void DurationSpeedTimesEqualsLength() { - Length length = Duration.FromSeconds(2)*Speed.FromMetersPerSecond(20); - Assert.Equal(length, Length.FromMeters(40)); + var length = Duration.FromSeconds(2)*Speed.FromMetersPerSecond(20); + Assert.Equal(length, Length.FromMeters(40)); } [Fact] public void LengthDividedByDurationEqualsSpeed() { - Speed speed = Length.FromMeters(20)/Duration.FromSeconds(2); - Assert.Equal(speed, Speed.FromMetersPerSecond(10)); + var speed = Length.FromMeters(20)/Duration.FromSeconds(2); + Assert.Equal(speed, Speed.FromMetersPerSecond(10)); } [Fact] public void LengthDividedByTimeSpanEqualsSpeed() { - Speed speed = Length.FromMeters(20)/TimeSpan.FromSeconds(2); - Assert.Equal(speed, Speed.FromMetersPerSecond(10)); + var speed = Length.FromMeters(20)/TimeSpan.FromSeconds(2); + Assert.Equal(speed, Speed.FromMetersPerSecond(10)); } [Fact] public void SpeedDividedByDurationEqualsAcceleration() { - Acceleration acceleration = Speed.FromMetersPerSecond(20)/Duration.FromSeconds(2); - Assert.Equal(acceleration, Acceleration.FromMetersPerSecondSquared(10)); + var acceleration = Speed.FromMetersPerSecond(20)/Duration.FromSeconds(2); + Assert.Equal(acceleration, Acceleration.FromMetersPerSecondSquared(10)); } [Fact] public void SpeedDividedByTimeSpanEqualsAcceleration() { - Acceleration acceleration = Speed.FromMetersPerSecond(20)/TimeSpan.FromSeconds(2); - Assert.Equal(acceleration, Acceleration.FromMetersPerSecondSquared(10)); + var acceleration = Speed.FromMetersPerSecond(20)/TimeSpan.FromSeconds(2); + Assert.Equal(acceleration, Acceleration.FromMetersPerSecondSquared(10)); } [Fact] public void SpeedTimesDurationEqualsLength() { - Length length = Speed.FromMetersPerSecond(20)*Duration.FromSeconds(2); - Assert.Equal(length, Length.FromMeters(40)); + var length = Speed.FromMetersPerSecond(20)*Duration.FromSeconds(2); + Assert.Equal(length, Length.FromMeters(40)); } [Fact] public void SpeedTimesTimeSpanEqualsLength() { - Length length = Speed.FromMetersPerSecond(20)*TimeSpan.FromSeconds(2); - Assert.Equal(length, Length.FromMeters(40)); + var length = Speed.FromMetersPerSecond(20)*TimeSpan.FromSeconds(2); + Assert.Equal(length, Length.FromMeters(40)); } [Fact] public void TimeSpanTimesSpeedEqualsLength() { - Length length = TimeSpan.FromSeconds(2)*Speed.FromMetersPerSecond(20); - Assert.Equal(length, Length.FromMeters(40)); + var length = TimeSpan.FromSeconds(2)*Speed.FromMetersPerSecond(20); + Assert.Equal(length, Length.FromMeters(40)); } [Fact] public void SpeedTimesLengthEqualsKinematicViscosity() { - KinematicViscosity kinematicViscosity = Length.FromMeters(20) * Speed.FromMetersPerSecond(2); - Assert.Equal(KinematicViscosity.FromSquareMetersPerSecond(40), kinematicViscosity); + var kinematicViscosity = Length.FromMeters(20) * Speed.FromMetersPerSecond(2); + Assert.Equal(KinematicViscosity.FromSquareMetersPerSecond(40), kinematicViscosity); } [Fact] public void SpeedTimesSpeedEqualsSpecificEnergy() { //m^2/s^2 = kg*m*m/(s^2*kg) = J/kg - SpecificEnergy length = Speed.FromMetersPerSecond(2) * Speed.FromMetersPerSecond(20); - Assert.Equal(length, SpecificEnergy.FromJoulesPerKilogram(40)); + var length = Speed.FromMetersPerSecond(2) * Speed.FromMetersPerSecond(20); + Assert.Equal(length, SpecificEnergy.FromJoulesPerKilogram(40)); } [Fact] public void SpeedTimesDensityEqualsMassFlux() { - MassFlux massFlux = Speed.FromMetersPerSecond(20) * Density.FromKilogramsPerCubicMeter(2); - Assert.Equal(massFlux, MassFlux.FromKilogramsPerSecondPerSquareMeter(40)); + var massFlux = Speed.FromMetersPerSecond(20) * Density.FromKilogramsPerCubicMeter(2); + Assert.Equal(massFlux, MassFlux.FromKilogramsPerSecondPerSquareMeter(40)); } [Fact] public void SpeedTimesAreaEqualsVolumeFlow() { - VolumeFlow volumeFlow = Speed.FromMetersPerSecond(2) * Area.FromSquareMeters(20); - Assert.Equal(VolumeFlow.FromCubicMetersPerSecond(40), volumeFlow); + var volumeFlow = Speed.FromMetersPerSecond(2) * Area.FromSquareMeters(20); + Assert.Equal(VolumeFlow.FromCubicMetersPerSecond(40), volumeFlow); } } } diff --git a/UnitsNet.Tests/CustomCode/StonePoundsTests.cs b/UnitsNet.Tests/CustomCode/StonePoundsTests.cs index b8cafbb920..f5dddb96bd 100644 --- a/UnitsNet.Tests/CustomCode/StonePoundsTests.cs +++ b/UnitsNet.Tests/CustomCode/StonePoundsTests.cs @@ -16,7 +16,7 @@ public class StonePoundsTests [Fact] public void StonePoundsFrom() { - Mass m = Mass.FromStonePounds(2, 3); + var m = Mass.FromStonePounds(2, 3); double expectedKg = 2/StoneInOneKilogram + 3/PoundsInOneKilogram; AssertEx.EqualTolerance(expectedKg, m.Kilograms, StoneTolerance); } @@ -24,7 +24,7 @@ public void StonePoundsFrom() [Fact] public void StonePoundsRoundTrip() { - Mass m = Mass.FromStonePounds(2, 3); + var m = Mass.FromStonePounds(2, 3); StonePounds stonePounds = m.StonePounds; AssertEx.EqualTolerance(2, stonePounds.Stone, StoneTolerance); AssertEx.EqualTolerance(3, stonePounds.Pounds, PoundsTolerance); @@ -33,7 +33,7 @@ public void StonePoundsRoundTrip() [Fact] public void StonePoundsToString_FormatsNumberInDefaultCulture() { - Mass m = Mass.FromStonePounds(3500, 1); + var m = Mass.FromStonePounds(3500, 1); StonePounds stonePounds = m.StonePounds; string numberInCurrentCulture = 3500.ToString("n0", CultureInfo.CurrentUICulture); // Varies between machines, can't hard code it @@ -47,7 +47,7 @@ public void StonePoundsToString_FormatsNumberInDefaultCulture() public void StonePoundsToString_GivenCultureWithThinSpaceDigitGroup_ReturnsNumberWithThinSpaceDigitGroup(string cultureName) { var formatProvider = new CultureInfo(cultureName); - Mass m = Mass.FromStonePounds(3500, 1); + var m = Mass.FromStonePounds(3500, 1); StonePounds stonePounds = m.StonePounds; Assert.Equal("3 500 st 1 lb", stonePounds.ToString(formatProvider)); diff --git a/UnitsNet.Tests/CustomCode/TemperatureDeltaTests.cs b/UnitsNet.Tests/CustomCode/TemperatureDeltaTests.cs index baa476a536..82d98297bf 100644 --- a/UnitsNet.Tests/CustomCode/TemperatureDeltaTests.cs +++ b/UnitsNet.Tests/CustomCode/TemperatureDeltaTests.cs @@ -38,8 +38,8 @@ public class TemperatureDeltaTests : TemperatureDeltaTestsBase [Fact] public void TemperatureDeltaTimesSpecificEntropyEqualsSpecificEnergy() { - SpecificEnergy specificEnergy = SpecificEntropy.FromJoulesPerKilogramKelvin(10) * TemperatureDelta.FromKelvins(6); - Assert.Equal(specificEnergy, SpecificEnergy.FromJoulesPerKilogram(60)); + var specificEnergy = SpecificEntropy.FromJoulesPerKilogramKelvin(10) * TemperatureDelta.FromKelvins(6); + Assert.Equal(specificEnergy, SpecificEnergy.FromJoulesPerKilogram(60)); } } } diff --git a/UnitsNet.Tests/CustomCode/TemperatureTests.cs b/UnitsNet.Tests/CustomCode/TemperatureTests.cs index 05b0cf511d..7c482e4c5e 100644 --- a/UnitsNet.Tests/CustomCode/TemperatureTests.cs +++ b/UnitsNet.Tests/CustomCode/TemperatureTests.cs @@ -30,101 +30,101 @@ public class TemperatureTests : TemperatureTestsBase public static IEnumerable DividedByTemperatureDeltaEqualsTemperatureData { get; } = new List { - new object[] { Temperature.FromDegreesCelsius(10), 1, Temperature.FromDegreesCelsius(10) }, - new object[] { Temperature.FromDegreesCelsius(10), 5, Temperature.FromDegreesCelsius(2) }, - new object[] { Temperature.FromDegreesCelsius(10), -10, Temperature.FromDegreesCelsius(-1) }, - new object[] { Temperature.FromDegreesFahrenheit(10), 1, Temperature.FromDegreesFahrenheit(10) }, - new object[] { Temperature.FromDegreesFahrenheit(10), 5, Temperature.FromDegreesFahrenheit(2) }, - new object[] { Temperature.FromDegreesFahrenheit(10), -10, Temperature.FromDegreesFahrenheit(-1) } + new object[] { Temperature.FromDegreesCelsius(10), 1, Temperature.FromDegreesCelsius(10) }, + new object[] { Temperature.FromDegreesCelsius(10), 5, Temperature.FromDegreesCelsius(2) }, + new object[] { Temperature.FromDegreesCelsius(10), -10, Temperature.FromDegreesCelsius(-1) }, + new object[] { Temperature.FromDegreesFahrenheit(10), 1, Temperature.FromDegreesFahrenheit(10) }, + new object[] { Temperature.FromDegreesFahrenheit(10), 5, Temperature.FromDegreesFahrenheit(2) }, + new object[] { Temperature.FromDegreesFahrenheit(10), -10, Temperature.FromDegreesFahrenheit(-1) } }; [SuppressMessage("ReSharper", "ImpureMethodCallOnReadonlyValueField", Justification = "R# incorrectly identifies method as impure, due to internal method calls.")] [Theory] [MemberData(nameof(DividedByTemperatureDeltaEqualsTemperatureData))] - public void DividedByTemperatureDeltaEqualsTemperature(Temperature temperature, int divisor, Temperature expected) + public void DividedByTemperatureDeltaEqualsTemperature(Temperature temperature, int divisor, Temperature expected ) { - Temperature resultTemp = temperature.Divide(divisor, temperature.Unit); + Temperature resultTemp = temperature.Divide(divisor, temperature.Unit); Assert.True(expected.Equals(resultTemp, 1e-5, ComparisonType.Absolute)); } public static IEnumerable MultiplyByTemperatureDeltaEqualsTemperatureData { get; } = new List { - new object[] { Temperature.FromDegreesCelsius(10), 0, Temperature.FromDegreesCelsius(0) }, - new object[] { Temperature.FromDegreesCelsius(10), 5, Temperature.FromDegreesCelsius(50) }, - new object[] { Temperature.FromDegreesCelsius(10), -5, Temperature.FromDegreesCelsius(-50) }, - new object[] { Temperature.FromDegreesFahrenheit(10), 0, Temperature.FromDegreesFahrenheit(0) }, - new object[] { Temperature.FromDegreesFahrenheit(10), 5, Temperature.FromDegreesFahrenheit(50) }, - new object[] { Temperature.FromDegreesFahrenheit(10), -5, Temperature.FromDegreesFahrenheit(-50) } + new object[] { Temperature.FromDegreesCelsius(10), 0, Temperature.FromDegreesCelsius(0) }, + new object[] { Temperature.FromDegreesCelsius(10), 5, Temperature.FromDegreesCelsius(50) }, + new object[] { Temperature.FromDegreesCelsius(10), -5, Temperature.FromDegreesCelsius(-50) }, + new object[] { Temperature.FromDegreesFahrenheit(10), 0, Temperature.FromDegreesFahrenheit(0) }, + new object[] { Temperature.FromDegreesFahrenheit(10), 5, Temperature.FromDegreesFahrenheit(50) }, + new object[] { Temperature.FromDegreesFahrenheit(10), -5, Temperature.FromDegreesFahrenheit(-50) } }; [SuppressMessage("ReSharper", "ImpureMethodCallOnReadonlyValueField", Justification = "R# incorrectly identifies method as impure, due to internal method calls.")] [Theory] [MemberData(nameof(MultiplyByTemperatureDeltaEqualsTemperatureData))] - public void MultiplyByTemperatureDeltaEqualsTemperature(Temperature temperature, int factor, Temperature expected) + public void MultiplyByTemperatureDeltaEqualsTemperature(Temperature temperature, int factor, Temperature expected ) { - Temperature resultTemp = temperature.Multiply(factor, temperature.Unit); + Temperature resultTemp = temperature.Multiply(factor, temperature.Unit); Assert.True(expected.Equals(resultTemp, 1e-5, ComparisonType.Absolute)); } public static IEnumerable TemperatureDeltaPlusTemperatureEqualsTemperatureData { get; } = new List { - new object[] { Temperature.FromDegreesCelsius(-10), TemperatureDelta.FromDegreesCelsius(0), Temperature.FromDegreesCelsius(-10) }, - new object[] { Temperature.FromDegreesCelsius(-10), TemperatureDelta.FromDegreesCelsius(10), Temperature.FromDegreesCelsius(0) }, - new object[] { Temperature.FromDegreesCelsius(-10), TemperatureDelta.FromDegreesCelsius(20), Temperature.FromDegreesCelsius(10) }, - new object[] { Temperature.FromDegreesFahrenheit(-10), TemperatureDelta.FromDegreesFahrenheit(0), Temperature.FromDegreesFahrenheit(-10) }, - new object[] { Temperature.FromDegreesFahrenheit(-10), TemperatureDelta.FromDegreesFahrenheit(10), Temperature.FromDegreesFahrenheit(0) }, - new object[] { Temperature.FromDegreesFahrenheit(-10), TemperatureDelta.FromDegreesFahrenheit(20), Temperature.FromDegreesFahrenheit(10) } + new object[] { Temperature.FromDegreesCelsius(-10), TemperatureDelta.FromDegreesCelsius(0), Temperature.FromDegreesCelsius(-10) }, + new object[] { Temperature.FromDegreesCelsius(-10), TemperatureDelta.FromDegreesCelsius(10), Temperature.FromDegreesCelsius(0) }, + new object[] { Temperature.FromDegreesCelsius(-10), TemperatureDelta.FromDegreesCelsius(20), Temperature.FromDegreesCelsius(10) }, + new object[] { Temperature.FromDegreesFahrenheit(-10), TemperatureDelta.FromDegreesFahrenheit(0), Temperature.FromDegreesFahrenheit(-10) }, + new object[] { Temperature.FromDegreesFahrenheit(-10), TemperatureDelta.FromDegreesFahrenheit(10), Temperature.FromDegreesFahrenheit(0) }, + new object[] { Temperature.FromDegreesFahrenheit(-10), TemperatureDelta.FromDegreesFahrenheit(20), Temperature.FromDegreesFahrenheit(10) } }; [Theory] [MemberData(nameof(TemperatureDeltaPlusTemperatureEqualsTemperatureData))] - public void TemperatureDeltaPlusTemperatureEqualsTemperature(Temperature temperature, TemperatureDelta delta, Temperature expected) + public void TemperatureDeltaPlusTemperatureEqualsTemperature(Temperature temperature, TemperatureDelta delta, Temperature expected ) { - Temperature resultTemp = delta + temperature; + var resultTemp = delta + temperature; Assert.True(expected.Equals(resultTemp, 1e-5, ComparisonType.Absolute)); } public static IEnumerable TemperatureMinusTemperatureDeltaEqualsTemperatureData { get; } = new List { - new object[] { Temperature.FromDegreesCelsius(20), TemperatureDelta.FromDegreesCelsius(10), Temperature.FromDegreesCelsius(10) }, - new object[] { Temperature.FromDegreesCelsius(20), TemperatureDelta.FromDegreesCelsius(20), Temperature.FromDegreesCelsius(0) }, - new object[] { Temperature.FromDegreesCelsius(20), TemperatureDelta.FromDegreesCelsius(30), Temperature.FromDegreesCelsius(-10) }, - new object[] { Temperature.FromDegreesFahrenheit(20), TemperatureDelta.FromDegreesFahrenheit(10), Temperature.FromDegreesFahrenheit(10) }, - new object[] { Temperature.FromDegreesFahrenheit(20), TemperatureDelta.FromDegreesFahrenheit(20), Temperature.FromDegreesFahrenheit(0) }, - new object[] { Temperature.FromDegreesFahrenheit(20), TemperatureDelta.FromDegreesFahrenheit(30), Temperature.FromDegreesFahrenheit(-10) } + new object[] { Temperature.FromDegreesCelsius(20), TemperatureDelta.FromDegreesCelsius(10), Temperature.FromDegreesCelsius(10) }, + new object[] { Temperature.FromDegreesCelsius(20), TemperatureDelta.FromDegreesCelsius(20), Temperature.FromDegreesCelsius(0) }, + new object[] { Temperature.FromDegreesCelsius(20), TemperatureDelta.FromDegreesCelsius(30), Temperature.FromDegreesCelsius(-10) }, + new object[] { Temperature.FromDegreesFahrenheit(20), TemperatureDelta.FromDegreesFahrenheit(10), Temperature.FromDegreesFahrenheit(10) }, + new object[] { Temperature.FromDegreesFahrenheit(20), TemperatureDelta.FromDegreesFahrenheit(20), Temperature.FromDegreesFahrenheit(0) }, + new object[] { Temperature.FromDegreesFahrenheit(20), TemperatureDelta.FromDegreesFahrenheit(30), Temperature.FromDegreesFahrenheit(-10) } }; [Theory] [MemberData(nameof(TemperatureMinusTemperatureDeltaEqualsTemperatureData))] - public void TemperatureMinusTemperatureDeltaEqualsTemperature(Temperature temperature, TemperatureDelta delta, Temperature expected) + public void TemperatureMinusTemperatureDeltaEqualsTemperature(Temperature temperature, TemperatureDelta delta, Temperature expected ) { - Temperature resultTemp = temperature - delta; + var resultTemp = temperature - delta; Assert.True(expected.Equals(resultTemp, 1e-5, ComparisonType.Absolute)); } public static IEnumerable TemperaturePlusTemperatureDeltaEqualsTemperatureData { get; } = new List { - new object[] { Temperature.FromDegreesCelsius(-10), TemperatureDelta.FromDegreesCelsius(0), Temperature.FromDegreesCelsius(-10) }, - new object[] { Temperature.FromDegreesCelsius(-10), TemperatureDelta.FromDegreesCelsius(10), Temperature.FromDegreesCelsius(0) }, - new object[] { Temperature.FromDegreesCelsius(-10), TemperatureDelta.FromDegreesCelsius(20), Temperature.FromDegreesCelsius(10) }, - new object[] { Temperature.FromDegreesFahrenheit(-10), TemperatureDelta.FromDegreesFahrenheit(0), Temperature.FromDegreesFahrenheit(-10) }, - new object[] { Temperature.FromDegreesFahrenheit(-10), TemperatureDelta.FromDegreesFahrenheit(10), Temperature.FromDegreesFahrenheit(0) }, - new object[] { Temperature.FromDegreesFahrenheit(-10), TemperatureDelta.FromDegreesFahrenheit(20), Temperature.FromDegreesFahrenheit(10) } + new object[] { Temperature.FromDegreesCelsius(-10), TemperatureDelta.FromDegreesCelsius(0), Temperature.FromDegreesCelsius(-10) }, + new object[] { Temperature.FromDegreesCelsius(-10), TemperatureDelta.FromDegreesCelsius(10), Temperature.FromDegreesCelsius(0) }, + new object[] { Temperature.FromDegreesCelsius(-10), TemperatureDelta.FromDegreesCelsius(20), Temperature.FromDegreesCelsius(10) }, + new object[] { Temperature.FromDegreesFahrenheit(-10), TemperatureDelta.FromDegreesFahrenheit(0), Temperature.FromDegreesFahrenheit(-10) }, + new object[] { Temperature.FromDegreesFahrenheit(-10), TemperatureDelta.FromDegreesFahrenheit(10), Temperature.FromDegreesFahrenheit(0) }, + new object[] { Temperature.FromDegreesFahrenheit(-10), TemperatureDelta.FromDegreesFahrenheit(20), Temperature.FromDegreesFahrenheit(10) } }; [Theory] [MemberData(nameof(TemperaturePlusTemperatureDeltaEqualsTemperatureData))] - public void TemperaturePlusTemperatureDeltaEqualsTemperature(Temperature temperature, TemperatureDelta delta, Temperature expected) + public void TemperaturePlusTemperatureDeltaEqualsTemperature(Temperature temperature, TemperatureDelta delta, Temperature expected ) { - Temperature resultTemp = temperature + delta; + var resultTemp = temperature + delta; Assert.True(expected.Equals(resultTemp, 1e-5, ComparisonType.Absolute)); } } diff --git a/UnitsNet.Tests/CustomCode/TorqueTests.cs b/UnitsNet.Tests/CustomCode/TorqueTests.cs index aef7961cb1..b454980bf4 100644 --- a/UnitsNet.Tests/CustomCode/TorqueTests.cs +++ b/UnitsNet.Tests/CustomCode/TorqueTests.cs @@ -52,15 +52,15 @@ public class TorqueTests : TorqueTestsBase [Fact] public void TorqueDividedByForceEqualsLength() { - Length length = Torque.FromNewtonMeters(4)/Force.FromNewtons(2); - Assert.Equal(length, Length.FromMeters(2)); + var length = Torque.FromNewtonMeters(4)/Force.FromNewtons(2); + Assert.Equal(length, Length.FromMeters(2)); } [Fact] public void TorqueDividedByLengthEqualsForce() { - Force force = Torque.FromNewtonMeters(4)/Length.FromMeters(2); - Assert.Equal(force, Force.FromNewtons(2)); + var force = Torque.FromNewtonMeters(4)/Length.FromMeters(2); + Assert.Equal(force, Force.FromNewtons(2)); } } } diff --git a/UnitsNet.Tests/CustomCode/VolumeConcentrationTests.cs b/UnitsNet.Tests/CustomCode/VolumeConcentrationTests.cs index 729517d139..876a236f9a 100644 --- a/UnitsNet.Tests/CustomCode/VolumeConcentrationTests.cs +++ b/UnitsNet.Tests/CustomCode/VolumeConcentrationTests.cs @@ -67,10 +67,10 @@ public void MassConcentrationFromVolumeConcentrationAndComponentDensity( double expectedMassConcValue, MassConcentrationUnit expectedMassConcUnit, double tolerence = 1e-5) { - var volumeConcentration = new VolumeConcentration(volumeConcValue, volumeConcUnit); - var componentDensity = new Density(componentDensityValue, componentDensityUnit); + var volumeConcentration = new VolumeConcentration(volumeConcValue, volumeConcUnit); + var componentDensity = new Density( componentDensityValue, componentDensityUnit); - MassConcentration massConcentration = volumeConcentration.ToMassConcentration(componentDensity); // volumeConcentration * density + var massConcentration = volumeConcentration.ToMassConcentration(componentDensity); // volumeConcentration * density AssertEx.EqualTolerance(expectedMassConcValue, massConcentration.As(expectedMassConcUnit), tolerence); } @@ -86,14 +86,13 @@ public void MolarityFromVolumeConcentrationAndComponentDensityAndMolarMass( double componentMolarMassValue, MolarMassUnit componentMolarMassUnit, double expectedMolarityValue, MolarityUnit expectedMolarityUnit, double tolerence = 1e-5) { - var volumeConcentration = new VolumeConcentration(volumeConcValue, volumeConcUnit); - var componentDensity = new Density(componentDensityValue, componetDensityUnit); - var componentMolarMass = new MolarMass(componentMolarMassValue, componentMolarMassUnit); + var volumeConcentration = new VolumeConcentration( volumeConcValue, volumeConcUnit); + var componentDensity = new Density( componentDensityValue, componetDensityUnit); + var componentMolarMass = new MolarMass( componentMolarMassValue, componentMolarMassUnit); - Molarity molarity = volumeConcentration.ToMolarity(componentDensity, componentMolarMass); // volumeConcentration * density / molarMass + var molarity = volumeConcentration.ToMolarity(componentDensity, componentMolarMass); // volumeConcentration * density / molarMass AssertEx.EqualTolerance(expectedMolarityValue, molarity.As(expectedMolarityUnit), tolerence); } - } } diff --git a/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs b/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs index 4a79bf98e5..48dc541f69 100644 --- a/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs +++ b/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs @@ -128,43 +128,43 @@ public class VolumeFlowTests : VolumeFlowTestsBase [InlineData(20, 62, 1240)] public void VolumeFlowTimesTimeSpanEqualsVolume(double cubicMetersPerSecond, double seconds, double expectedCubicMeters) { - Volume volume = VolumeFlow.FromCubicMetersPerSecond(cubicMetersPerSecond) * TimeSpan.FromSeconds(seconds); - Assert.Equal(Volume.FromCubicMeters(expectedCubicMeters), volume); + var volume = VolumeFlow.FromCubicMetersPerSecond(cubicMetersPerSecond) * TimeSpan.FromSeconds(seconds); + Assert.Equal(Volume.FromCubicMeters(expectedCubicMeters), volume); } [Fact] public void VolumeFlowTimesDurationEqualsVolume() { - Volume volume = VolumeFlow.FromCubicMetersPerSecond(20) * Duration.FromSeconds(2); - Assert.Equal(Volume.FromCubicMeters(40), volume); + var volume = VolumeFlow.FromCubicMetersPerSecond(20) * Duration.FromSeconds(2); + Assert.Equal(Volume.FromCubicMeters(40), volume); } [Fact] public void VolumeFlowDividedByAreaEqualsSpeed() { - Speed speed = VolumeFlow.FromCubicMetersPerSecond(40) / Area.FromSquareMeters(20); - Assert.Equal(Speed.FromMetersPerSecond(2), speed); + var speed = VolumeFlow.FromCubicMetersPerSecond(40) / Area.FromSquareMeters(20); + Assert.Equal(Speed.FromMetersPerSecond(2), speed); } [Fact] public void VolumeFlowDividedBySpeedEqualsArea() { - Area area = VolumeFlow.FromCubicMetersPerSecond(40) / Speed.FromMetersPerSecond(20); - Assert.Equal(Area.FromSquareMeters(2), area); + var area = VolumeFlow.FromCubicMetersPerSecond(40) / Speed.FromMetersPerSecond(20); + Assert.Equal(Area.FromSquareMeters(2), area); } [Fact] public void VolumeFlowTimesDensityEqualsMassFlow() { - MassFlow massFlow = VolumeFlow.FromCubicMetersPerSecond(2) * Density.FromKilogramsPerCubicMeter(3); - Assert.Equal(MassFlow.FromKilogramsPerSecond(6), massFlow); + var massFlow = VolumeFlow.FromCubicMetersPerSecond(2) * Density.FromKilogramsPerCubicMeter(3); + Assert.Equal(MassFlow.FromKilogramsPerSecond(6), massFlow); } [Fact] public void DensityTimesVolumeFlowEqualsMassFlow() { - MassFlow massFlow = Density.FromKilogramsPerCubicMeter(3) * VolumeFlow.FromCubicMetersPerSecond(7); - Assert.Equal(MassFlow.FromKilogramsPerSecond(21), massFlow); + var massFlow = Density.FromKilogramsPerCubicMeter(3) * VolumeFlow.FromCubicMetersPerSecond(7); + Assert.Equal(MassFlow.FromKilogramsPerSecond(21), massFlow); } } } diff --git a/UnitsNet.Tests/CustomCode/VolumeTests.cs b/UnitsNet.Tests/CustomCode/VolumeTests.cs index ad6c2dca04..4b33635e40 100644 --- a/UnitsNet.Tests/CustomCode/VolumeTests.cs +++ b/UnitsNet.Tests/CustomCode/VolumeTests.cs @@ -97,22 +97,22 @@ public class VolumeTests : VolumeTestsBase [ Fact] public void VolumeDividedByAreaEqualsLength() { - Length length = Volume.FromCubicMeters(15)/Area.FromSquareMeters(5); - Assert.Equal(length, Length.FromMeters(3)); + var length = Volume.FromCubicMeters(15)/Area.FromSquareMeters(5); + Assert.Equal(length, Length.FromMeters(3)); } [Fact] public void VolumeDividedByLengthEqualsArea() { - Area area = Volume.FromCubicMeters(15)/Length.FromMeters(5); - Assert.Equal(area, Area.FromSquareMeters(3)); + var area = Volume.FromCubicMeters(15)/Length.FromMeters(5); + Assert.Equal(area, Area.FromSquareMeters(3)); } [Fact] public void VolumeTimesDensityEqualsMass() { - Mass mass = Volume.FromCubicMeters(2)*Density.FromKilogramsPerCubicMeter(3); - Assert.Equal(mass, Mass.FromKilograms(6)); + var mass = Volume.FromCubicMeters(2)*Density.FromKilogramsPerCubicMeter(3); + Assert.Equal(mass, Mass.FromKilograms(6)); } [Theory] @@ -120,21 +120,21 @@ public void VolumeTimesDensityEqualsMass() [InlineData(20, 80, 0.25)] public void VolumeDividedByTimeSpanEqualsVolumeFlow(double cubicMeters, double seconds, double expectedCubicMetersPerSecond) { - VolumeFlow volumeFlow = Volume.FromCubicMeters(cubicMeters) / TimeSpan.FromSeconds(seconds); - Assert.Equal(VolumeFlow.FromCubicMetersPerSecond(expectedCubicMetersPerSecond), volumeFlow); + var volumeFlow = Volume.FromCubicMeters(cubicMeters) / TimeSpan.FromSeconds(seconds); + Assert.Equal(VolumeFlow.FromCubicMetersPerSecond(expectedCubicMetersPerSecond), volumeFlow); } [Fact] public void VolumeDividedByDurationEqualsVolumeFlow() { - VolumeFlow volumeFlow = Volume.FromCubicMeters(20) / Duration.FromSeconds(2); - Assert.Equal(VolumeFlow.FromCubicMetersPerSecond(10), volumeFlow); + var volumeFlow = Volume.FromCubicMeters(20) / Duration.FromSeconds(2); + Assert.Equal(VolumeFlow.FromCubicMetersPerSecond(10), volumeFlow); } [Fact] public void VolumeDividedByVolumeFlowEqualsTimeSpan() { - TimeSpan timeSpan = Volume.FromCubicMeters(20) / VolumeFlow.FromCubicMetersPerSecond(2); + var timeSpan = Volume.FromCubicMeters(20) / VolumeFlow.FromCubicMetersPerSecond(2); Assert.Equal(TimeSpan.FromSeconds(10), timeSpan); } } diff --git a/UnitsNet.Tests/DecimalOverloadTests.cs b/UnitsNet.Tests/DecimalOverloadTests.cs index 841c9b162b..d70c90d2bd 100644 --- a/UnitsNet.Tests/DecimalOverloadTests.cs +++ b/UnitsNet.Tests/DecimalOverloadTests.cs @@ -10,14 +10,14 @@ public class DecimalOverloadTests [Fact] public static void CreatingQuantityWithDoubleBackingFieldFromDecimalReturnsCorrectValue() { - Acceleration acceleration = Acceleration.FromMetersPerSecondSquared(1m); + var acceleration = Acceleration.FromMetersPerSecondSquared(1m); Assert.Equal(1.0, acceleration.MetersPerSecondSquared); } [Fact] public static void CreatingQuantityWithDecimalBackingFieldFromDecimalReturnsCorrectValue() { - Power power = Power.FromWatts(1m); + var power = Power.FromWatts(1m); Assert.Equal(1.0, power.Watts); } } diff --git a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs index 9ff56eff6f..489866d6d6 100644 --- a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs @@ -67,26 +67,26 @@ public abstract partial class AccelerationTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Acceleration((double)0.0, AccelerationUnit.Undefined)); + Assert.Throws(() => new Acceleration((double)0.0, AccelerationUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Acceleration(double.PositiveInfinity, AccelerationUnit.MeterPerSecondSquared)); - Assert.Throws(() => new Acceleration(double.NegativeInfinity, AccelerationUnit.MeterPerSecondSquared)); + Assert.Throws(() => new Acceleration(double.PositiveInfinity, AccelerationUnit.MeterPerSecondSquared)); + Assert.Throws(() => new Acceleration(double.NegativeInfinity, AccelerationUnit.MeterPerSecondSquared)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Acceleration(double.NaN, AccelerationUnit.MeterPerSecondSquared)); + Assert.Throws(() => new Acceleration(double.NaN, AccelerationUnit.MeterPerSecondSquared)); } [Fact] public void MeterPerSecondSquaredToAccelerationUnits() { - Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); + Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); AssertEx.EqualTolerance(CentimetersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.CentimetersPerSecondSquared, CentimetersPerSecondSquaredTolerance); AssertEx.EqualTolerance(DecimetersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.DecimetersPerSecondSquared, DecimetersPerSecondSquaredTolerance); AssertEx.EqualTolerance(FeetPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.FeetPerSecondSquared, FeetPerSecondSquaredTolerance); @@ -105,38 +105,38 @@ public void MeterPerSecondSquaredToAccelerationUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.CentimeterPerSecondSquared).CentimetersPerSecondSquared, CentimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.DecimeterPerSecondSquared).DecimetersPerSecondSquared, DecimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.FootPerSecondSquared).FeetPerSecondSquared, FeetPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.InchPerSecondSquared).InchesPerSecondSquared, InchesPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.KilometerPerSecondSquared).KilometersPerSecondSquared, KilometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.KnotPerHour).KnotsPerHour, KnotsPerHourTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.KnotPerMinute).KnotsPerMinute, KnotsPerMinuteTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.KnotPerSecond).KnotsPerSecond, KnotsPerSecondTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.MeterPerSecondSquared).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.MicrometerPerSecondSquared).MicrometersPerSecondSquared, MicrometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.MillimeterPerSecondSquared).MillimetersPerSecondSquared, MillimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.NanometerPerSecondSquared).NanometersPerSecondSquared, NanometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.StandardGravity).StandardGravity, StandardGravityTolerance); + AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.CentimeterPerSecondSquared).CentimetersPerSecondSquared, CentimetersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.DecimeterPerSecondSquared).DecimetersPerSecondSquared, DecimetersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.FootPerSecondSquared).FeetPerSecondSquared, FeetPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.InchPerSecondSquared).InchesPerSecondSquared, InchesPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.KilometerPerSecondSquared).KilometersPerSecondSquared, KilometersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.KnotPerHour).KnotsPerHour, KnotsPerHourTolerance); + AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.KnotPerMinute).KnotsPerMinute, KnotsPerMinuteTolerance); + AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.KnotPerSecond).KnotsPerSecond, KnotsPerSecondTolerance); + AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.MeterPerSecondSquared).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.MicrometerPerSecondSquared).MicrometersPerSecondSquared, MicrometersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.MillimeterPerSecondSquared).MillimetersPerSecondSquared, MillimetersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.NanometerPerSecondSquared).NanometersPerSecondSquared, NanometersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.StandardGravity).StandardGravity, StandardGravityTolerance); } [Fact] public void FromMetersPerSecondSquared_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.PositiveInfinity)); - Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.NegativeInfinity)); + Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.PositiveInfinity)); + Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.NegativeInfinity)); } [Fact] public void FromMetersPerSecondSquared_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.NaN)); + Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.NaN)); } [Fact] public void As() { - var meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); + var meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); AssertEx.EqualTolerance(CentimetersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.As(AccelerationUnit.CentimeterPerSecondSquared), CentimetersPerSecondSquaredTolerance); AssertEx.EqualTolerance(DecimetersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.As(AccelerationUnit.DecimeterPerSecondSquared), DecimetersPerSecondSquaredTolerance); AssertEx.EqualTolerance(FeetPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.As(AccelerationUnit.FootPerSecondSquared), FeetPerSecondSquaredTolerance); @@ -155,7 +155,7 @@ public void As() [Fact] public void ToUnit() { - var meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); + var meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); var centimeterpersecondsquaredQuantity = meterpersecondsquared.ToUnit(AccelerationUnit.CentimeterPerSecondSquared); AssertEx.EqualTolerance(CentimetersPerSecondSquaredInOneMeterPerSecondSquared, (double)centimeterpersecondsquaredQuantity.Value, CentimetersPerSecondSquaredTolerance); @@ -213,40 +213,40 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); - AssertEx.EqualTolerance(1, Acceleration.FromCentimetersPerSecondSquared(meterpersecondsquared.CentimetersPerSecondSquared).MetersPerSecondSquared, CentimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromDecimetersPerSecondSquared(meterpersecondsquared.DecimetersPerSecondSquared).MetersPerSecondSquared, DecimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromFeetPerSecondSquared(meterpersecondsquared.FeetPerSecondSquared).MetersPerSecondSquared, FeetPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromInchesPerSecondSquared(meterpersecondsquared.InchesPerSecondSquared).MetersPerSecondSquared, InchesPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromKilometersPerSecondSquared(meterpersecondsquared.KilometersPerSecondSquared).MetersPerSecondSquared, KilometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromKnotsPerHour(meterpersecondsquared.KnotsPerHour).MetersPerSecondSquared, KnotsPerHourTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromKnotsPerMinute(meterpersecondsquared.KnotsPerMinute).MetersPerSecondSquared, KnotsPerMinuteTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromKnotsPerSecond(meterpersecondsquared.KnotsPerSecond).MetersPerSecondSquared, KnotsPerSecondTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromMetersPerSecondSquared(meterpersecondsquared.MetersPerSecondSquared).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromMicrometersPerSecondSquared(meterpersecondsquared.MicrometersPerSecondSquared).MetersPerSecondSquared, MicrometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromMillimetersPerSecondSquared(meterpersecondsquared.MillimetersPerSecondSquared).MetersPerSecondSquared, MillimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromNanometersPerSecondSquared(meterpersecondsquared.NanometersPerSecondSquared).MetersPerSecondSquared, NanometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromStandardGravity(meterpersecondsquared.StandardGravity).MetersPerSecondSquared, StandardGravityTolerance); + Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); + AssertEx.EqualTolerance(1, Acceleration.FromCentimetersPerSecondSquared(meterpersecondsquared.CentimetersPerSecondSquared).MetersPerSecondSquared, CentimetersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.FromDecimetersPerSecondSquared(meterpersecondsquared.DecimetersPerSecondSquared).MetersPerSecondSquared, DecimetersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.FromFeetPerSecondSquared(meterpersecondsquared.FeetPerSecondSquared).MetersPerSecondSquared, FeetPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.FromInchesPerSecondSquared(meterpersecondsquared.InchesPerSecondSquared).MetersPerSecondSquared, InchesPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.FromKilometersPerSecondSquared(meterpersecondsquared.KilometersPerSecondSquared).MetersPerSecondSquared, KilometersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.FromKnotsPerHour(meterpersecondsquared.KnotsPerHour).MetersPerSecondSquared, KnotsPerHourTolerance); + AssertEx.EqualTolerance(1, Acceleration.FromKnotsPerMinute(meterpersecondsquared.KnotsPerMinute).MetersPerSecondSquared, KnotsPerMinuteTolerance); + AssertEx.EqualTolerance(1, Acceleration.FromKnotsPerSecond(meterpersecondsquared.KnotsPerSecond).MetersPerSecondSquared, KnotsPerSecondTolerance); + AssertEx.EqualTolerance(1, Acceleration.FromMetersPerSecondSquared(meterpersecondsquared.MetersPerSecondSquared).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.FromMicrometersPerSecondSquared(meterpersecondsquared.MicrometersPerSecondSquared).MetersPerSecondSquared, MicrometersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.FromMillimetersPerSecondSquared(meterpersecondsquared.MillimetersPerSecondSquared).MetersPerSecondSquared, MillimetersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.FromNanometersPerSecondSquared(meterpersecondsquared.NanometersPerSecondSquared).MetersPerSecondSquared, NanometersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Acceleration.FromStandardGravity(meterpersecondsquared.StandardGravity).MetersPerSecondSquared, StandardGravityTolerance); } [Fact] public void ArithmeticOperators() { - Acceleration v = Acceleration.FromMetersPerSecondSquared(1); + Acceleration v = Acceleration.FromMetersPerSecondSquared(1); AssertEx.EqualTolerance(-1, -v.MetersPerSecondSquared, MetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(2, (Acceleration.FromMetersPerSecondSquared(3)-v).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(2, (Acceleration.FromMetersPerSecondSquared(3)-v).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); AssertEx.EqualTolerance(2, (v + v).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); AssertEx.EqualTolerance(10, (v*10).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); AssertEx.EqualTolerance(10, (10*v).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(2, (Acceleration.FromMetersPerSecondSquared(10)/5).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(2, Acceleration.FromMetersPerSecondSquared(10)/Acceleration.FromMetersPerSecondSquared(5), MetersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(2, (Acceleration.FromMetersPerSecondSquared(10)/5).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); + AssertEx.EqualTolerance(2, Acceleration.FromMetersPerSecondSquared(10)/Acceleration.FromMetersPerSecondSquared(5), MetersPerSecondSquaredTolerance); } [Fact] public void ComparisonOperators() { - Acceleration oneMeterPerSecondSquared = Acceleration.FromMetersPerSecondSquared(1); - Acceleration twoMetersPerSecondSquared = Acceleration.FromMetersPerSecondSquared(2); + Acceleration oneMeterPerSecondSquared = Acceleration.FromMetersPerSecondSquared(1); + Acceleration twoMetersPerSecondSquared = Acceleration.FromMetersPerSecondSquared(2); Assert.True(oneMeterPerSecondSquared < twoMetersPerSecondSquared); Assert.True(oneMeterPerSecondSquared <= twoMetersPerSecondSquared); @@ -262,31 +262,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); + Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); Assert.Equal(0, meterpersecondsquared.CompareTo(meterpersecondsquared)); - Assert.True(meterpersecondsquared.CompareTo(Acceleration.Zero) > 0); - Assert.True(Acceleration.Zero.CompareTo(meterpersecondsquared) < 0); + Assert.True(meterpersecondsquared.CompareTo(Acceleration.Zero) > 0); + Assert.True(Acceleration.Zero.CompareTo(meterpersecondsquared) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); + Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); Assert.Throws(() => meterpersecondsquared.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); + Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); Assert.Throws(() => meterpersecondsquared.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Acceleration.FromMetersPerSecondSquared(1); - var b = Acceleration.FromMetersPerSecondSquared(2); + var a = Acceleration.FromMetersPerSecondSquared(1); + var b = Acceleration.FromMetersPerSecondSquared(2); // ReSharper disable EqualExpressionComparison @@ -305,8 +305,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Acceleration.FromMetersPerSecondSquared(1); - var b = Acceleration.FromMetersPerSecondSquared(2); + var a = Acceleration.FromMetersPerSecondSquared(1); + var b = Acceleration.FromMetersPerSecondSquared(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -316,29 +316,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Acceleration.FromMetersPerSecondSquared(1); - Assert.True(v.Equals(Acceleration.FromMetersPerSecondSquared(1), MetersPerSecondSquaredTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Acceleration.Zero, MetersPerSecondSquaredTolerance, ComparisonType.Relative)); + var v = Acceleration.FromMetersPerSecondSquared(1); + Assert.True(v.Equals(Acceleration.FromMetersPerSecondSquared(1), MetersPerSecondSquaredTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Acceleration.Zero, MetersPerSecondSquaredTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); + Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); Assert.False(meterpersecondsquared.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); + Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); Assert.False(meterpersecondsquared.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(AccelerationUnit.Undefined, Acceleration.Units); + Assert.DoesNotContain(AccelerationUnit.Undefined, Acceleration.Units); } [Fact] @@ -357,7 +357,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Acceleration.BaseDimensions is null); + Assert.False(Acceleration.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs index 1b4ce7d7dc..3a311ef153 100644 --- a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of AmountOfSubstance. + /// Test of AmountOfSubstance. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class AmountOfSubstanceTestsBase @@ -71,26 +71,26 @@ public abstract partial class AmountOfSubstanceTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new AmountOfSubstance((double)0.0, AmountOfSubstanceUnit.Undefined)); + Assert.Throws(() => new AmountOfSubstance((double)0.0, AmountOfSubstanceUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new AmountOfSubstance(double.PositiveInfinity, AmountOfSubstanceUnit.Mole)); - Assert.Throws(() => new AmountOfSubstance(double.NegativeInfinity, AmountOfSubstanceUnit.Mole)); + Assert.Throws(() => new AmountOfSubstance(double.PositiveInfinity, AmountOfSubstanceUnit.Mole)); + Assert.Throws(() => new AmountOfSubstance(double.NegativeInfinity, AmountOfSubstanceUnit.Mole)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new AmountOfSubstance(double.NaN, AmountOfSubstanceUnit.Mole)); + Assert.Throws(() => new AmountOfSubstance(double.NaN, AmountOfSubstanceUnit.Mole)); } [Fact] public void MoleToAmountOfSubstanceUnits() { - AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); + AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); AssertEx.EqualTolerance(CentimolesInOneMole, mole.Centimoles, CentimolesTolerance); AssertEx.EqualTolerance(CentipoundMolesInOneMole, mole.CentipoundMoles, CentipoundMolesTolerance); AssertEx.EqualTolerance(DecimolesInOneMole, mole.Decimoles, DecimolesTolerance); @@ -111,40 +111,40 @@ public void MoleToAmountOfSubstanceUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Centimole).Centimoles, CentimolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.CentipoundMole).CentipoundMoles, CentipoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Decimole).Decimoles, DecimolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.DecipoundMole).DecipoundMoles, DecipoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Kilomole).Kilomoles, KilomolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.KilopoundMole).KilopoundMoles, KilopoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Megamole).Megamoles, MegamolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Micromole).Micromoles, MicromolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.MicropoundMole).MicropoundMoles, MicropoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Millimole).Millimoles, MillimolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.MillipoundMole).MillipoundMoles, MillipoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Mole).Moles, MolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Nanomole).Nanomoles, NanomolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.NanopoundMole).NanopoundMoles, NanopoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.PoundMole).PoundMoles, PoundMolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Centimole).Centimoles, CentimolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.CentipoundMole).CentipoundMoles, CentipoundMolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Decimole).Decimoles, DecimolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.DecipoundMole).DecipoundMoles, DecipoundMolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Kilomole).Kilomoles, KilomolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.KilopoundMole).KilopoundMoles, KilopoundMolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Megamole).Megamoles, MegamolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Micromole).Micromoles, MicromolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.MicropoundMole).MicropoundMoles, MicropoundMolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Millimole).Millimoles, MillimolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.MillipoundMole).MillipoundMoles, MillipoundMolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Mole).Moles, MolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Nanomole).Nanomoles, NanomolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.NanopoundMole).NanopoundMoles, NanopoundMolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.PoundMole).PoundMoles, PoundMolesTolerance); } [Fact] public void FromMoles_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => AmountOfSubstance.FromMoles(double.PositiveInfinity)); - Assert.Throws(() => AmountOfSubstance.FromMoles(double.NegativeInfinity)); + Assert.Throws(() => AmountOfSubstance.FromMoles(double.PositiveInfinity)); + Assert.Throws(() => AmountOfSubstance.FromMoles(double.NegativeInfinity)); } [Fact] public void FromMoles_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => AmountOfSubstance.FromMoles(double.NaN)); + Assert.Throws(() => AmountOfSubstance.FromMoles(double.NaN)); } [Fact] public void As() { - var mole = AmountOfSubstance.FromMoles(1); + var mole = AmountOfSubstance.FromMoles(1); AssertEx.EqualTolerance(CentimolesInOneMole, mole.As(AmountOfSubstanceUnit.Centimole), CentimolesTolerance); AssertEx.EqualTolerance(CentipoundMolesInOneMole, mole.As(AmountOfSubstanceUnit.CentipoundMole), CentipoundMolesTolerance); AssertEx.EqualTolerance(DecimolesInOneMole, mole.As(AmountOfSubstanceUnit.Decimole), DecimolesTolerance); @@ -165,7 +165,7 @@ public void As() [Fact] public void ToUnit() { - var mole = AmountOfSubstance.FromMoles(1); + var mole = AmountOfSubstance.FromMoles(1); var centimoleQuantity = mole.ToUnit(AmountOfSubstanceUnit.Centimole); AssertEx.EqualTolerance(CentimolesInOneMole, (double)centimoleQuantity.Value, CentimolesTolerance); @@ -231,42 +231,42 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromCentimoles(mole.Centimoles).Moles, CentimolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromCentipoundMoles(mole.CentipoundMoles).Moles, CentipoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromDecimoles(mole.Decimoles).Moles, DecimolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromDecipoundMoles(mole.DecipoundMoles).Moles, DecipoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromKilomoles(mole.Kilomoles).Moles, KilomolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromKilopoundMoles(mole.KilopoundMoles).Moles, KilopoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromMegamoles(mole.Megamoles).Moles, MegamolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromMicromoles(mole.Micromoles).Moles, MicromolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromMicropoundMoles(mole.MicropoundMoles).Moles, MicropoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromMillimoles(mole.Millimoles).Moles, MillimolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromMillipoundMoles(mole.MillipoundMoles).Moles, MillipoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromMoles(mole.Moles).Moles, MolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromNanomoles(mole.Nanomoles).Moles, NanomolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromNanopoundMoles(mole.NanopoundMoles).Moles, NanopoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromPoundMoles(mole.PoundMoles).Moles, PoundMolesTolerance); + AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); + AssertEx.EqualTolerance(1, AmountOfSubstance.FromCentimoles(mole.Centimoles).Moles, CentimolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.FromCentipoundMoles(mole.CentipoundMoles).Moles, CentipoundMolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.FromDecimoles(mole.Decimoles).Moles, DecimolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.FromDecipoundMoles(mole.DecipoundMoles).Moles, DecipoundMolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.FromKilomoles(mole.Kilomoles).Moles, KilomolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.FromKilopoundMoles(mole.KilopoundMoles).Moles, KilopoundMolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.FromMegamoles(mole.Megamoles).Moles, MegamolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.FromMicromoles(mole.Micromoles).Moles, MicromolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.FromMicropoundMoles(mole.MicropoundMoles).Moles, MicropoundMolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.FromMillimoles(mole.Millimoles).Moles, MillimolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.FromMillipoundMoles(mole.MillipoundMoles).Moles, MillipoundMolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.FromMoles(mole.Moles).Moles, MolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.FromNanomoles(mole.Nanomoles).Moles, NanomolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.FromNanopoundMoles(mole.NanopoundMoles).Moles, NanopoundMolesTolerance); + AssertEx.EqualTolerance(1, AmountOfSubstance.FromPoundMoles(mole.PoundMoles).Moles, PoundMolesTolerance); } [Fact] public void ArithmeticOperators() { - AmountOfSubstance v = AmountOfSubstance.FromMoles(1); + AmountOfSubstance v = AmountOfSubstance.FromMoles(1); AssertEx.EqualTolerance(-1, -v.Moles, MolesTolerance); - AssertEx.EqualTolerance(2, (AmountOfSubstance.FromMoles(3)-v).Moles, MolesTolerance); + AssertEx.EqualTolerance(2, (AmountOfSubstance.FromMoles(3)-v).Moles, MolesTolerance); AssertEx.EqualTolerance(2, (v + v).Moles, MolesTolerance); AssertEx.EqualTolerance(10, (v*10).Moles, MolesTolerance); AssertEx.EqualTolerance(10, (10*v).Moles, MolesTolerance); - AssertEx.EqualTolerance(2, (AmountOfSubstance.FromMoles(10)/5).Moles, MolesTolerance); - AssertEx.EqualTolerance(2, AmountOfSubstance.FromMoles(10)/AmountOfSubstance.FromMoles(5), MolesTolerance); + AssertEx.EqualTolerance(2, (AmountOfSubstance.FromMoles(10)/5).Moles, MolesTolerance); + AssertEx.EqualTolerance(2, AmountOfSubstance.FromMoles(10)/AmountOfSubstance.FromMoles(5), MolesTolerance); } [Fact] public void ComparisonOperators() { - AmountOfSubstance oneMole = AmountOfSubstance.FromMoles(1); - AmountOfSubstance twoMoles = AmountOfSubstance.FromMoles(2); + AmountOfSubstance oneMole = AmountOfSubstance.FromMoles(1); + AmountOfSubstance twoMoles = AmountOfSubstance.FromMoles(2); Assert.True(oneMole < twoMoles); Assert.True(oneMole <= twoMoles); @@ -282,31 +282,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); + AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); Assert.Equal(0, mole.CompareTo(mole)); - Assert.True(mole.CompareTo(AmountOfSubstance.Zero) > 0); - Assert.True(AmountOfSubstance.Zero.CompareTo(mole) < 0); + Assert.True(mole.CompareTo(AmountOfSubstance.Zero) > 0); + Assert.True(AmountOfSubstance.Zero.CompareTo(mole) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); + AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); Assert.Throws(() => mole.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); + AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); Assert.Throws(() => mole.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = AmountOfSubstance.FromMoles(1); - var b = AmountOfSubstance.FromMoles(2); + var a = AmountOfSubstance.FromMoles(1); + var b = AmountOfSubstance.FromMoles(2); // ReSharper disable EqualExpressionComparison @@ -325,8 +325,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = AmountOfSubstance.FromMoles(1); - var b = AmountOfSubstance.FromMoles(2); + var a = AmountOfSubstance.FromMoles(1); + var b = AmountOfSubstance.FromMoles(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -336,29 +336,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = AmountOfSubstance.FromMoles(1); - Assert.True(v.Equals(AmountOfSubstance.FromMoles(1), MolesTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(AmountOfSubstance.Zero, MolesTolerance, ComparisonType.Relative)); + var v = AmountOfSubstance.FromMoles(1); + Assert.True(v.Equals(AmountOfSubstance.FromMoles(1), MolesTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(AmountOfSubstance.Zero, MolesTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); + AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); Assert.False(mole.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); + AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); Assert.False(mole.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(AmountOfSubstanceUnit.Undefined, AmountOfSubstance.Units); + Assert.DoesNotContain(AmountOfSubstanceUnit.Undefined, AmountOfSubstance.Units); } [Fact] @@ -377,7 +377,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(AmountOfSubstance.BaseDimensions is null); + Assert.False(AmountOfSubstance.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs index 2df18862fa..6be1ef240e 100644 --- a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of AmplitudeRatio. + /// Test of AmplitudeRatio. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class AmplitudeRatioTestsBase @@ -49,26 +49,26 @@ public abstract partial class AmplitudeRatioTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new AmplitudeRatio((double)0.0, AmplitudeRatioUnit.Undefined)); + Assert.Throws(() => new AmplitudeRatio((double)0.0, AmplitudeRatioUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new AmplitudeRatio(double.PositiveInfinity, AmplitudeRatioUnit.DecibelVolt)); - Assert.Throws(() => new AmplitudeRatio(double.NegativeInfinity, AmplitudeRatioUnit.DecibelVolt)); + Assert.Throws(() => new AmplitudeRatio(double.PositiveInfinity, AmplitudeRatioUnit.DecibelVolt)); + Assert.Throws(() => new AmplitudeRatio(double.NegativeInfinity, AmplitudeRatioUnit.DecibelVolt)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new AmplitudeRatio(double.NaN, AmplitudeRatioUnit.DecibelVolt)); + Assert.Throws(() => new AmplitudeRatio(double.NaN, AmplitudeRatioUnit.DecibelVolt)); } [Fact] public void DecibelVoltToAmplitudeRatioUnits() { - AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); + AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); AssertEx.EqualTolerance(DecibelMicrovoltsInOneDecibelVolt, decibelvolt.DecibelMicrovolts, DecibelMicrovoltsTolerance); AssertEx.EqualTolerance(DecibelMillivoltsInOneDecibelVolt, decibelvolt.DecibelMillivolts, DecibelMillivoltsTolerance); AssertEx.EqualTolerance(DecibelsUnloadedInOneDecibelVolt, decibelvolt.DecibelsUnloaded, DecibelsUnloadedTolerance); @@ -78,29 +78,29 @@ public void DecibelVoltToAmplitudeRatioUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, AmplitudeRatio.From(1, AmplitudeRatioUnit.DecibelMicrovolt).DecibelMicrovolts, DecibelMicrovoltsTolerance); - AssertEx.EqualTolerance(1, AmplitudeRatio.From(1, AmplitudeRatioUnit.DecibelMillivolt).DecibelMillivolts, DecibelMillivoltsTolerance); - AssertEx.EqualTolerance(1, AmplitudeRatio.From(1, AmplitudeRatioUnit.DecibelUnloaded).DecibelsUnloaded, DecibelsUnloadedTolerance); - AssertEx.EqualTolerance(1, AmplitudeRatio.From(1, AmplitudeRatioUnit.DecibelVolt).DecibelVolts, DecibelVoltsTolerance); + AssertEx.EqualTolerance(1, AmplitudeRatio.From(1, AmplitudeRatioUnit.DecibelMicrovolt).DecibelMicrovolts, DecibelMicrovoltsTolerance); + AssertEx.EqualTolerance(1, AmplitudeRatio.From(1, AmplitudeRatioUnit.DecibelMillivolt).DecibelMillivolts, DecibelMillivoltsTolerance); + AssertEx.EqualTolerance(1, AmplitudeRatio.From(1, AmplitudeRatioUnit.DecibelUnloaded).DecibelsUnloaded, DecibelsUnloadedTolerance); + AssertEx.EqualTolerance(1, AmplitudeRatio.From(1, AmplitudeRatioUnit.DecibelVolt).DecibelVolts, DecibelVoltsTolerance); } [Fact] public void FromDecibelVolts_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.PositiveInfinity)); - Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.NegativeInfinity)); + Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.PositiveInfinity)); + Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.NegativeInfinity)); } [Fact] public void FromDecibelVolts_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.NaN)); + Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.NaN)); } [Fact] public void As() { - var decibelvolt = AmplitudeRatio.FromDecibelVolts(1); + var decibelvolt = AmplitudeRatio.FromDecibelVolts(1); AssertEx.EqualTolerance(DecibelMicrovoltsInOneDecibelVolt, decibelvolt.As(AmplitudeRatioUnit.DecibelMicrovolt), DecibelMicrovoltsTolerance); AssertEx.EqualTolerance(DecibelMillivoltsInOneDecibelVolt, decibelvolt.As(AmplitudeRatioUnit.DecibelMillivolt), DecibelMillivoltsTolerance); AssertEx.EqualTolerance(DecibelsUnloadedInOneDecibelVolt, decibelvolt.As(AmplitudeRatioUnit.DecibelUnloaded), DecibelsUnloadedTolerance); @@ -110,7 +110,7 @@ public void As() [Fact] public void ToUnit() { - var decibelvolt = AmplitudeRatio.FromDecibelVolts(1); + var decibelvolt = AmplitudeRatio.FromDecibelVolts(1); var decibelmicrovoltQuantity = decibelvolt.ToUnit(AmplitudeRatioUnit.DecibelMicrovolt); AssertEx.EqualTolerance(DecibelMicrovoltsInOneDecibelVolt, (double)decibelmicrovoltQuantity.Value, DecibelMicrovoltsTolerance); @@ -132,24 +132,24 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); - AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelMicrovolts(decibelvolt.DecibelMicrovolts).DecibelVolts, DecibelMicrovoltsTolerance); - AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelMillivolts(decibelvolt.DecibelMillivolts).DecibelVolts, DecibelMillivoltsTolerance); - AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelsUnloaded(decibelvolt.DecibelsUnloaded).DecibelVolts, DecibelsUnloadedTolerance); - AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelVolts(decibelvolt.DecibelVolts).DecibelVolts, DecibelVoltsTolerance); + AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); + AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelMicrovolts(decibelvolt.DecibelMicrovolts).DecibelVolts, DecibelMicrovoltsTolerance); + AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelMillivolts(decibelvolt.DecibelMillivolts).DecibelVolts, DecibelMillivoltsTolerance); + AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelsUnloaded(decibelvolt.DecibelsUnloaded).DecibelVolts, DecibelsUnloadedTolerance); + AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelVolts(decibelvolt.DecibelVolts).DecibelVolts, DecibelVoltsTolerance); } [Fact] public void LogarithmicArithmeticOperators() { - AmplitudeRatio v = AmplitudeRatio.FromDecibelVolts(40); + AmplitudeRatio v = AmplitudeRatio.FromDecibelVolts(40); AssertEx.EqualTolerance(-40, -v.DecibelVolts, DecibelVoltsTolerance); AssertLogarithmicAddition(); AssertLogarithmicSubtraction(); AssertEx.EqualTolerance(50, (v*10).DecibelVolts, DecibelVoltsTolerance); AssertEx.EqualTolerance(50, (10*v).DecibelVolts, DecibelVoltsTolerance); AssertEx.EqualTolerance(35, (v/5).DecibelVolts, DecibelVoltsTolerance); - AssertEx.EqualTolerance(35, v/AmplitudeRatio.FromDecibelVolts(5), DecibelVoltsTolerance); + AssertEx.EqualTolerance(35, v/AmplitudeRatio.FromDecibelVolts(5), DecibelVoltsTolerance); } protected abstract void AssertLogarithmicAddition(); @@ -159,8 +159,8 @@ public void LogarithmicArithmeticOperators() [Fact] public void ComparisonOperators() { - AmplitudeRatio oneDecibelVolt = AmplitudeRatio.FromDecibelVolts(1); - AmplitudeRatio twoDecibelVolts = AmplitudeRatio.FromDecibelVolts(2); + AmplitudeRatio oneDecibelVolt = AmplitudeRatio.FromDecibelVolts(1); + AmplitudeRatio twoDecibelVolts = AmplitudeRatio.FromDecibelVolts(2); Assert.True(oneDecibelVolt < twoDecibelVolts); Assert.True(oneDecibelVolt <= twoDecibelVolts); @@ -176,31 +176,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); + AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); Assert.Equal(0, decibelvolt.CompareTo(decibelvolt)); - Assert.True(decibelvolt.CompareTo(AmplitudeRatio.Zero) > 0); - Assert.True(AmplitudeRatio.Zero.CompareTo(decibelvolt) < 0); + Assert.True(decibelvolt.CompareTo(AmplitudeRatio.Zero) > 0); + Assert.True(AmplitudeRatio.Zero.CompareTo(decibelvolt) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); + AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); Assert.Throws(() => decibelvolt.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); + AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); Assert.Throws(() => decibelvolt.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = AmplitudeRatio.FromDecibelVolts(1); - var b = AmplitudeRatio.FromDecibelVolts(2); + var a = AmplitudeRatio.FromDecibelVolts(1); + var b = AmplitudeRatio.FromDecibelVolts(2); // ReSharper disable EqualExpressionComparison @@ -219,8 +219,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = AmplitudeRatio.FromDecibelVolts(1); - var b = AmplitudeRatio.FromDecibelVolts(2); + var a = AmplitudeRatio.FromDecibelVolts(1); + var b = AmplitudeRatio.FromDecibelVolts(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -230,29 +230,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = AmplitudeRatio.FromDecibelVolts(1); - Assert.True(v.Equals(AmplitudeRatio.FromDecibelVolts(1), DecibelVoltsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(AmplitudeRatio.Zero, DecibelVoltsTolerance, ComparisonType.Relative)); + var v = AmplitudeRatio.FromDecibelVolts(1); + Assert.True(v.Equals(AmplitudeRatio.FromDecibelVolts(1), DecibelVoltsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(AmplitudeRatio.Zero, DecibelVoltsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); + AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); Assert.False(decibelvolt.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); + AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); Assert.False(decibelvolt.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(AmplitudeRatioUnit.Undefined, AmplitudeRatio.Units); + Assert.DoesNotContain(AmplitudeRatioUnit.Undefined, AmplitudeRatio.Units); } [Fact] @@ -271,7 +271,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(AmplitudeRatio.BaseDimensions is null); + Assert.False(AmplitudeRatio.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs index e21edca5c3..3beed0a7f1 100644 --- a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Angle. + /// Test of Angle. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class AngleTestsBase @@ -69,26 +69,26 @@ public abstract partial class AngleTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Angle((double)0.0, AngleUnit.Undefined)); + Assert.Throws(() => new Angle((double)0.0, AngleUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Angle(double.PositiveInfinity, AngleUnit.Degree)); - Assert.Throws(() => new Angle(double.NegativeInfinity, AngleUnit.Degree)); + Assert.Throws(() => new Angle(double.PositiveInfinity, AngleUnit.Degree)); + Assert.Throws(() => new Angle(double.NegativeInfinity, AngleUnit.Degree)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Angle(double.NaN, AngleUnit.Degree)); + Assert.Throws(() => new Angle(double.NaN, AngleUnit.Degree)); } [Fact] public void DegreeToAngleUnits() { - Angle degree = Angle.FromDegrees(1); + Angle degree = Angle.FromDegrees(1); AssertEx.EqualTolerance(ArcminutesInOneDegree, degree.Arcminutes, ArcminutesTolerance); AssertEx.EqualTolerance(ArcsecondsInOneDegree, degree.Arcseconds, ArcsecondsTolerance); AssertEx.EqualTolerance(CentiradiansInOneDegree, degree.Centiradians, CentiradiansTolerance); @@ -108,39 +108,39 @@ public void DegreeToAngleUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Arcminute).Arcminutes, ArcminutesTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Arcsecond).Arcseconds, ArcsecondsTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Centiradian).Centiradians, CentiradiansTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Deciradian).Deciradians, DeciradiansTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Degree).Degrees, DegreesTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Gradian).Gradians, GradiansTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Microdegree).Microdegrees, MicrodegreesTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Microradian).Microradians, MicroradiansTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Millidegree).Millidegrees, MillidegreesTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Milliradian).Milliradians, MilliradiansTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Nanodegree).Nanodegrees, NanodegreesTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Nanoradian).Nanoradians, NanoradiansTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Radian).Radians, RadiansTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Revolution).Revolutions, RevolutionsTolerance); + AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Arcminute).Arcminutes, ArcminutesTolerance); + AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Arcsecond).Arcseconds, ArcsecondsTolerance); + AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Centiradian).Centiradians, CentiradiansTolerance); + AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Deciradian).Deciradians, DeciradiansTolerance); + AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Degree).Degrees, DegreesTolerance); + AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Gradian).Gradians, GradiansTolerance); + AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Microdegree).Microdegrees, MicrodegreesTolerance); + AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Microradian).Microradians, MicroradiansTolerance); + AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Millidegree).Millidegrees, MillidegreesTolerance); + AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Milliradian).Milliradians, MilliradiansTolerance); + AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Nanodegree).Nanodegrees, NanodegreesTolerance); + AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Nanoradian).Nanoradians, NanoradiansTolerance); + AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Radian).Radians, RadiansTolerance); + AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Revolution).Revolutions, RevolutionsTolerance); } [Fact] public void FromDegrees_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Angle.FromDegrees(double.PositiveInfinity)); - Assert.Throws(() => Angle.FromDegrees(double.NegativeInfinity)); + Assert.Throws(() => Angle.FromDegrees(double.PositiveInfinity)); + Assert.Throws(() => Angle.FromDegrees(double.NegativeInfinity)); } [Fact] public void FromDegrees_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Angle.FromDegrees(double.NaN)); + Assert.Throws(() => Angle.FromDegrees(double.NaN)); } [Fact] public void As() { - var degree = Angle.FromDegrees(1); + var degree = Angle.FromDegrees(1); AssertEx.EqualTolerance(ArcminutesInOneDegree, degree.As(AngleUnit.Arcminute), ArcminutesTolerance); AssertEx.EqualTolerance(ArcsecondsInOneDegree, degree.As(AngleUnit.Arcsecond), ArcsecondsTolerance); AssertEx.EqualTolerance(CentiradiansInOneDegree, degree.As(AngleUnit.Centiradian), CentiradiansTolerance); @@ -160,7 +160,7 @@ public void As() [Fact] public void ToUnit() { - var degree = Angle.FromDegrees(1); + var degree = Angle.FromDegrees(1); var arcminuteQuantity = degree.ToUnit(AngleUnit.Arcminute); AssertEx.EqualTolerance(ArcminutesInOneDegree, (double)arcminuteQuantity.Value, ArcminutesTolerance); @@ -222,41 +222,41 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Angle degree = Angle.FromDegrees(1); - AssertEx.EqualTolerance(1, Angle.FromArcminutes(degree.Arcminutes).Degrees, ArcminutesTolerance); - AssertEx.EqualTolerance(1, Angle.FromArcseconds(degree.Arcseconds).Degrees, ArcsecondsTolerance); - AssertEx.EqualTolerance(1, Angle.FromCentiradians(degree.Centiradians).Degrees, CentiradiansTolerance); - AssertEx.EqualTolerance(1, Angle.FromDeciradians(degree.Deciradians).Degrees, DeciradiansTolerance); - AssertEx.EqualTolerance(1, Angle.FromDegrees(degree.Degrees).Degrees, DegreesTolerance); - AssertEx.EqualTolerance(1, Angle.FromGradians(degree.Gradians).Degrees, GradiansTolerance); - AssertEx.EqualTolerance(1, Angle.FromMicrodegrees(degree.Microdegrees).Degrees, MicrodegreesTolerance); - AssertEx.EqualTolerance(1, Angle.FromMicroradians(degree.Microradians).Degrees, MicroradiansTolerance); - AssertEx.EqualTolerance(1, Angle.FromMillidegrees(degree.Millidegrees).Degrees, MillidegreesTolerance); - AssertEx.EqualTolerance(1, Angle.FromMilliradians(degree.Milliradians).Degrees, MilliradiansTolerance); - AssertEx.EqualTolerance(1, Angle.FromNanodegrees(degree.Nanodegrees).Degrees, NanodegreesTolerance); - AssertEx.EqualTolerance(1, Angle.FromNanoradians(degree.Nanoradians).Degrees, NanoradiansTolerance); - AssertEx.EqualTolerance(1, Angle.FromRadians(degree.Radians).Degrees, RadiansTolerance); - AssertEx.EqualTolerance(1, Angle.FromRevolutions(degree.Revolutions).Degrees, RevolutionsTolerance); + Angle degree = Angle.FromDegrees(1); + AssertEx.EqualTolerance(1, Angle.FromArcminutes(degree.Arcminutes).Degrees, ArcminutesTolerance); + AssertEx.EqualTolerance(1, Angle.FromArcseconds(degree.Arcseconds).Degrees, ArcsecondsTolerance); + AssertEx.EqualTolerance(1, Angle.FromCentiradians(degree.Centiradians).Degrees, CentiradiansTolerance); + AssertEx.EqualTolerance(1, Angle.FromDeciradians(degree.Deciradians).Degrees, DeciradiansTolerance); + AssertEx.EqualTolerance(1, Angle.FromDegrees(degree.Degrees).Degrees, DegreesTolerance); + AssertEx.EqualTolerance(1, Angle.FromGradians(degree.Gradians).Degrees, GradiansTolerance); + AssertEx.EqualTolerance(1, Angle.FromMicrodegrees(degree.Microdegrees).Degrees, MicrodegreesTolerance); + AssertEx.EqualTolerance(1, Angle.FromMicroradians(degree.Microradians).Degrees, MicroradiansTolerance); + AssertEx.EqualTolerance(1, Angle.FromMillidegrees(degree.Millidegrees).Degrees, MillidegreesTolerance); + AssertEx.EqualTolerance(1, Angle.FromMilliradians(degree.Milliradians).Degrees, MilliradiansTolerance); + AssertEx.EqualTolerance(1, Angle.FromNanodegrees(degree.Nanodegrees).Degrees, NanodegreesTolerance); + AssertEx.EqualTolerance(1, Angle.FromNanoradians(degree.Nanoradians).Degrees, NanoradiansTolerance); + AssertEx.EqualTolerance(1, Angle.FromRadians(degree.Radians).Degrees, RadiansTolerance); + AssertEx.EqualTolerance(1, Angle.FromRevolutions(degree.Revolutions).Degrees, RevolutionsTolerance); } [Fact] public void ArithmeticOperators() { - Angle v = Angle.FromDegrees(1); + Angle v = Angle.FromDegrees(1); AssertEx.EqualTolerance(-1, -v.Degrees, DegreesTolerance); - AssertEx.EqualTolerance(2, (Angle.FromDegrees(3)-v).Degrees, DegreesTolerance); + AssertEx.EqualTolerance(2, (Angle.FromDegrees(3)-v).Degrees, DegreesTolerance); AssertEx.EqualTolerance(2, (v + v).Degrees, DegreesTolerance); AssertEx.EqualTolerance(10, (v*10).Degrees, DegreesTolerance); AssertEx.EqualTolerance(10, (10*v).Degrees, DegreesTolerance); - AssertEx.EqualTolerance(2, (Angle.FromDegrees(10)/5).Degrees, DegreesTolerance); - AssertEx.EqualTolerance(2, Angle.FromDegrees(10)/Angle.FromDegrees(5), DegreesTolerance); + AssertEx.EqualTolerance(2, (Angle.FromDegrees(10)/5).Degrees, DegreesTolerance); + AssertEx.EqualTolerance(2, Angle.FromDegrees(10)/Angle.FromDegrees(5), DegreesTolerance); } [Fact] public void ComparisonOperators() { - Angle oneDegree = Angle.FromDegrees(1); - Angle twoDegrees = Angle.FromDegrees(2); + Angle oneDegree = Angle.FromDegrees(1); + Angle twoDegrees = Angle.FromDegrees(2); Assert.True(oneDegree < twoDegrees); Assert.True(oneDegree <= twoDegrees); @@ -272,31 +272,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Angle degree = Angle.FromDegrees(1); + Angle degree = Angle.FromDegrees(1); Assert.Equal(0, degree.CompareTo(degree)); - Assert.True(degree.CompareTo(Angle.Zero) > 0); - Assert.True(Angle.Zero.CompareTo(degree) < 0); + Assert.True(degree.CompareTo(Angle.Zero) > 0); + Assert.True(Angle.Zero.CompareTo(degree) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Angle degree = Angle.FromDegrees(1); + Angle degree = Angle.FromDegrees(1); Assert.Throws(() => degree.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Angle degree = Angle.FromDegrees(1); + Angle degree = Angle.FromDegrees(1); Assert.Throws(() => degree.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Angle.FromDegrees(1); - var b = Angle.FromDegrees(2); + var a = Angle.FromDegrees(1); + var b = Angle.FromDegrees(2); // ReSharper disable EqualExpressionComparison @@ -315,8 +315,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Angle.FromDegrees(1); - var b = Angle.FromDegrees(2); + var a = Angle.FromDegrees(1); + var b = Angle.FromDegrees(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -326,29 +326,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Angle.FromDegrees(1); - Assert.True(v.Equals(Angle.FromDegrees(1), DegreesTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Angle.Zero, DegreesTolerance, ComparisonType.Relative)); + var v = Angle.FromDegrees(1); + Assert.True(v.Equals(Angle.FromDegrees(1), DegreesTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Angle.Zero, DegreesTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Angle degree = Angle.FromDegrees(1); + Angle degree = Angle.FromDegrees(1); Assert.False(degree.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Angle degree = Angle.FromDegrees(1); + Angle degree = Angle.FromDegrees(1); Assert.False(degree.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(AngleUnit.Undefined, Angle.Units); + Assert.DoesNotContain(AngleUnit.Undefined, Angle.Units); } [Fact] @@ -367,7 +367,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Angle.BaseDimensions is null); + Assert.False(Angle.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs index bc0e82f12a..2d22f35b23 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of ApparentEnergy. + /// Test of ApparentEnergy. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class ApparentEnergyTestsBase @@ -47,26 +47,26 @@ public abstract partial class ApparentEnergyTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ApparentEnergy((double)0.0, ApparentEnergyUnit.Undefined)); + Assert.Throws(() => new ApparentEnergy((double)0.0, ApparentEnergyUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ApparentEnergy(double.PositiveInfinity, ApparentEnergyUnit.VoltampereHour)); - Assert.Throws(() => new ApparentEnergy(double.NegativeInfinity, ApparentEnergyUnit.VoltampereHour)); + Assert.Throws(() => new ApparentEnergy(double.PositiveInfinity, ApparentEnergyUnit.VoltampereHour)); + Assert.Throws(() => new ApparentEnergy(double.NegativeInfinity, ApparentEnergyUnit.VoltampereHour)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ApparentEnergy(double.NaN, ApparentEnergyUnit.VoltampereHour)); + Assert.Throws(() => new ApparentEnergy(double.NaN, ApparentEnergyUnit.VoltampereHour)); } [Fact] public void VoltampereHourToApparentEnergyUnits() { - ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); + ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); AssertEx.EqualTolerance(KilovoltampereHoursInOneVoltampereHour, voltamperehour.KilovoltampereHours, KilovoltampereHoursTolerance); AssertEx.EqualTolerance(MegavoltampereHoursInOneVoltampereHour, voltamperehour.MegavoltampereHours, MegavoltampereHoursTolerance); AssertEx.EqualTolerance(VoltampereHoursInOneVoltampereHour, voltamperehour.VoltampereHours, VoltampereHoursTolerance); @@ -75,28 +75,28 @@ public void VoltampereHourToApparentEnergyUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ApparentEnergy.From(1, ApparentEnergyUnit.KilovoltampereHour).KilovoltampereHours, KilovoltampereHoursTolerance); - AssertEx.EqualTolerance(1, ApparentEnergy.From(1, ApparentEnergyUnit.MegavoltampereHour).MegavoltampereHours, MegavoltampereHoursTolerance); - AssertEx.EqualTolerance(1, ApparentEnergy.From(1, ApparentEnergyUnit.VoltampereHour).VoltampereHours, VoltampereHoursTolerance); + AssertEx.EqualTolerance(1, ApparentEnergy.From(1, ApparentEnergyUnit.KilovoltampereHour).KilovoltampereHours, KilovoltampereHoursTolerance); + AssertEx.EqualTolerance(1, ApparentEnergy.From(1, ApparentEnergyUnit.MegavoltampereHour).MegavoltampereHours, MegavoltampereHoursTolerance); + AssertEx.EqualTolerance(1, ApparentEnergy.From(1, ApparentEnergyUnit.VoltampereHour).VoltampereHours, VoltampereHoursTolerance); } [Fact] public void FromVoltampereHours_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.PositiveInfinity)); - Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.NegativeInfinity)); + Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.PositiveInfinity)); + Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.NegativeInfinity)); } [Fact] public void FromVoltampereHours_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.NaN)); + Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.NaN)); } [Fact] public void As() { - var voltamperehour = ApparentEnergy.FromVoltampereHours(1); + var voltamperehour = ApparentEnergy.FromVoltampereHours(1); AssertEx.EqualTolerance(KilovoltampereHoursInOneVoltampereHour, voltamperehour.As(ApparentEnergyUnit.KilovoltampereHour), KilovoltampereHoursTolerance); AssertEx.EqualTolerance(MegavoltampereHoursInOneVoltampereHour, voltamperehour.As(ApparentEnergyUnit.MegavoltampereHour), MegavoltampereHoursTolerance); AssertEx.EqualTolerance(VoltampereHoursInOneVoltampereHour, voltamperehour.As(ApparentEnergyUnit.VoltampereHour), VoltampereHoursTolerance); @@ -105,7 +105,7 @@ public void As() [Fact] public void ToUnit() { - var voltamperehour = ApparentEnergy.FromVoltampereHours(1); + var voltamperehour = ApparentEnergy.FromVoltampereHours(1); var kilovoltamperehourQuantity = voltamperehour.ToUnit(ApparentEnergyUnit.KilovoltampereHour); AssertEx.EqualTolerance(KilovoltampereHoursInOneVoltampereHour, (double)kilovoltamperehourQuantity.Value, KilovoltampereHoursTolerance); @@ -123,30 +123,30 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); - AssertEx.EqualTolerance(1, ApparentEnergy.FromKilovoltampereHours(voltamperehour.KilovoltampereHours).VoltampereHours, KilovoltampereHoursTolerance); - AssertEx.EqualTolerance(1, ApparentEnergy.FromMegavoltampereHours(voltamperehour.MegavoltampereHours).VoltampereHours, MegavoltampereHoursTolerance); - AssertEx.EqualTolerance(1, ApparentEnergy.FromVoltampereHours(voltamperehour.VoltampereHours).VoltampereHours, VoltampereHoursTolerance); + ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); + AssertEx.EqualTolerance(1, ApparentEnergy.FromKilovoltampereHours(voltamperehour.KilovoltampereHours).VoltampereHours, KilovoltampereHoursTolerance); + AssertEx.EqualTolerance(1, ApparentEnergy.FromMegavoltampereHours(voltamperehour.MegavoltampereHours).VoltampereHours, MegavoltampereHoursTolerance); + AssertEx.EqualTolerance(1, ApparentEnergy.FromVoltampereHours(voltamperehour.VoltampereHours).VoltampereHours, VoltampereHoursTolerance); } [Fact] public void ArithmeticOperators() { - ApparentEnergy v = ApparentEnergy.FromVoltampereHours(1); + ApparentEnergy v = ApparentEnergy.FromVoltampereHours(1); AssertEx.EqualTolerance(-1, -v.VoltampereHours, VoltampereHoursTolerance); - AssertEx.EqualTolerance(2, (ApparentEnergy.FromVoltampereHours(3)-v).VoltampereHours, VoltampereHoursTolerance); + AssertEx.EqualTolerance(2, (ApparentEnergy.FromVoltampereHours(3)-v).VoltampereHours, VoltampereHoursTolerance); AssertEx.EqualTolerance(2, (v + v).VoltampereHours, VoltampereHoursTolerance); AssertEx.EqualTolerance(10, (v*10).VoltampereHours, VoltampereHoursTolerance); AssertEx.EqualTolerance(10, (10*v).VoltampereHours, VoltampereHoursTolerance); - AssertEx.EqualTolerance(2, (ApparentEnergy.FromVoltampereHours(10)/5).VoltampereHours, VoltampereHoursTolerance); - AssertEx.EqualTolerance(2, ApparentEnergy.FromVoltampereHours(10)/ApparentEnergy.FromVoltampereHours(5), VoltampereHoursTolerance); + AssertEx.EqualTolerance(2, (ApparentEnergy.FromVoltampereHours(10)/5).VoltampereHours, VoltampereHoursTolerance); + AssertEx.EqualTolerance(2, ApparentEnergy.FromVoltampereHours(10)/ApparentEnergy.FromVoltampereHours(5), VoltampereHoursTolerance); } [Fact] public void ComparisonOperators() { - ApparentEnergy oneVoltampereHour = ApparentEnergy.FromVoltampereHours(1); - ApparentEnergy twoVoltampereHours = ApparentEnergy.FromVoltampereHours(2); + ApparentEnergy oneVoltampereHour = ApparentEnergy.FromVoltampereHours(1); + ApparentEnergy twoVoltampereHours = ApparentEnergy.FromVoltampereHours(2); Assert.True(oneVoltampereHour < twoVoltampereHours); Assert.True(oneVoltampereHour <= twoVoltampereHours); @@ -162,31 +162,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); + ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); Assert.Equal(0, voltamperehour.CompareTo(voltamperehour)); - Assert.True(voltamperehour.CompareTo(ApparentEnergy.Zero) > 0); - Assert.True(ApparentEnergy.Zero.CompareTo(voltamperehour) < 0); + Assert.True(voltamperehour.CompareTo(ApparentEnergy.Zero) > 0); + Assert.True(ApparentEnergy.Zero.CompareTo(voltamperehour) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); + ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); Assert.Throws(() => voltamperehour.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); + ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); Assert.Throws(() => voltamperehour.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ApparentEnergy.FromVoltampereHours(1); - var b = ApparentEnergy.FromVoltampereHours(2); + var a = ApparentEnergy.FromVoltampereHours(1); + var b = ApparentEnergy.FromVoltampereHours(2); // ReSharper disable EqualExpressionComparison @@ -205,8 +205,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ApparentEnergy.FromVoltampereHours(1); - var b = ApparentEnergy.FromVoltampereHours(2); + var a = ApparentEnergy.FromVoltampereHours(1); + var b = ApparentEnergy.FromVoltampereHours(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -216,29 +216,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ApparentEnergy.FromVoltampereHours(1); - Assert.True(v.Equals(ApparentEnergy.FromVoltampereHours(1), VoltampereHoursTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ApparentEnergy.Zero, VoltampereHoursTolerance, ComparisonType.Relative)); + var v = ApparentEnergy.FromVoltampereHours(1); + Assert.True(v.Equals(ApparentEnergy.FromVoltampereHours(1), VoltampereHoursTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ApparentEnergy.Zero, VoltampereHoursTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); + ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); Assert.False(voltamperehour.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); + ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); Assert.False(voltamperehour.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ApparentEnergyUnit.Undefined, ApparentEnergy.Units); + Assert.DoesNotContain(ApparentEnergyUnit.Undefined, ApparentEnergy.Units); } [Fact] @@ -257,7 +257,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ApparentEnergy.BaseDimensions is null); + Assert.False(ApparentEnergy.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs index 993117ae4b..a9ced1863e 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs @@ -49,26 +49,26 @@ public abstract partial class ApparentPowerTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ApparentPower((double)0.0, ApparentPowerUnit.Undefined)); + Assert.Throws(() => new ApparentPower((double)0.0, ApparentPowerUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ApparentPower(double.PositiveInfinity, ApparentPowerUnit.Voltampere)); - Assert.Throws(() => new ApparentPower(double.NegativeInfinity, ApparentPowerUnit.Voltampere)); + Assert.Throws(() => new ApparentPower(double.PositiveInfinity, ApparentPowerUnit.Voltampere)); + Assert.Throws(() => new ApparentPower(double.NegativeInfinity, ApparentPowerUnit.Voltampere)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ApparentPower(double.NaN, ApparentPowerUnit.Voltampere)); + Assert.Throws(() => new ApparentPower(double.NaN, ApparentPowerUnit.Voltampere)); } [Fact] public void VoltampereToApparentPowerUnits() { - ApparentPower voltampere = ApparentPower.FromVoltamperes(1); + ApparentPower voltampere = ApparentPower.FromVoltamperes(1); AssertEx.EqualTolerance(GigavoltamperesInOneVoltampere, voltampere.Gigavoltamperes, GigavoltamperesTolerance); AssertEx.EqualTolerance(KilovoltamperesInOneVoltampere, voltampere.Kilovoltamperes, KilovoltamperesTolerance); AssertEx.EqualTolerance(MegavoltamperesInOneVoltampere, voltampere.Megavoltamperes, MegavoltamperesTolerance); @@ -78,29 +78,29 @@ public void VoltampereToApparentPowerUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ApparentPower.From(1, ApparentPowerUnit.Gigavoltampere).Gigavoltamperes, GigavoltamperesTolerance); - AssertEx.EqualTolerance(1, ApparentPower.From(1, ApparentPowerUnit.Kilovoltampere).Kilovoltamperes, KilovoltamperesTolerance); - AssertEx.EqualTolerance(1, ApparentPower.From(1, ApparentPowerUnit.Megavoltampere).Megavoltamperes, MegavoltamperesTolerance); - AssertEx.EqualTolerance(1, ApparentPower.From(1, ApparentPowerUnit.Voltampere).Voltamperes, VoltamperesTolerance); + AssertEx.EqualTolerance(1, ApparentPower.From(1, ApparentPowerUnit.Gigavoltampere).Gigavoltamperes, GigavoltamperesTolerance); + AssertEx.EqualTolerance(1, ApparentPower.From(1, ApparentPowerUnit.Kilovoltampere).Kilovoltamperes, KilovoltamperesTolerance); + AssertEx.EqualTolerance(1, ApparentPower.From(1, ApparentPowerUnit.Megavoltampere).Megavoltamperes, MegavoltamperesTolerance); + AssertEx.EqualTolerance(1, ApparentPower.From(1, ApparentPowerUnit.Voltampere).Voltamperes, VoltamperesTolerance); } [Fact] public void FromVoltamperes_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ApparentPower.FromVoltamperes(double.PositiveInfinity)); - Assert.Throws(() => ApparentPower.FromVoltamperes(double.NegativeInfinity)); + Assert.Throws(() => ApparentPower.FromVoltamperes(double.PositiveInfinity)); + Assert.Throws(() => ApparentPower.FromVoltamperes(double.NegativeInfinity)); } [Fact] public void FromVoltamperes_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ApparentPower.FromVoltamperes(double.NaN)); + Assert.Throws(() => ApparentPower.FromVoltamperes(double.NaN)); } [Fact] public void As() { - var voltampere = ApparentPower.FromVoltamperes(1); + var voltampere = ApparentPower.FromVoltamperes(1); AssertEx.EqualTolerance(GigavoltamperesInOneVoltampere, voltampere.As(ApparentPowerUnit.Gigavoltampere), GigavoltamperesTolerance); AssertEx.EqualTolerance(KilovoltamperesInOneVoltampere, voltampere.As(ApparentPowerUnit.Kilovoltampere), KilovoltamperesTolerance); AssertEx.EqualTolerance(MegavoltamperesInOneVoltampere, voltampere.As(ApparentPowerUnit.Megavoltampere), MegavoltamperesTolerance); @@ -110,7 +110,7 @@ public void As() [Fact] public void ToUnit() { - var voltampere = ApparentPower.FromVoltamperes(1); + var voltampere = ApparentPower.FromVoltamperes(1); var gigavoltampereQuantity = voltampere.ToUnit(ApparentPowerUnit.Gigavoltampere); AssertEx.EqualTolerance(GigavoltamperesInOneVoltampere, (double)gigavoltampereQuantity.Value, GigavoltamperesTolerance); @@ -132,31 +132,31 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ApparentPower voltampere = ApparentPower.FromVoltamperes(1); - AssertEx.EqualTolerance(1, ApparentPower.FromGigavoltamperes(voltampere.Gigavoltamperes).Voltamperes, GigavoltamperesTolerance); - AssertEx.EqualTolerance(1, ApparentPower.FromKilovoltamperes(voltampere.Kilovoltamperes).Voltamperes, KilovoltamperesTolerance); - AssertEx.EqualTolerance(1, ApparentPower.FromMegavoltamperes(voltampere.Megavoltamperes).Voltamperes, MegavoltamperesTolerance); - AssertEx.EqualTolerance(1, ApparentPower.FromVoltamperes(voltampere.Voltamperes).Voltamperes, VoltamperesTolerance); + ApparentPower voltampere = ApparentPower.FromVoltamperes(1); + AssertEx.EqualTolerance(1, ApparentPower.FromGigavoltamperes(voltampere.Gigavoltamperes).Voltamperes, GigavoltamperesTolerance); + AssertEx.EqualTolerance(1, ApparentPower.FromKilovoltamperes(voltampere.Kilovoltamperes).Voltamperes, KilovoltamperesTolerance); + AssertEx.EqualTolerance(1, ApparentPower.FromMegavoltamperes(voltampere.Megavoltamperes).Voltamperes, MegavoltamperesTolerance); + AssertEx.EqualTolerance(1, ApparentPower.FromVoltamperes(voltampere.Voltamperes).Voltamperes, VoltamperesTolerance); } [Fact] public void ArithmeticOperators() { - ApparentPower v = ApparentPower.FromVoltamperes(1); + ApparentPower v = ApparentPower.FromVoltamperes(1); AssertEx.EqualTolerance(-1, -v.Voltamperes, VoltamperesTolerance); - AssertEx.EqualTolerance(2, (ApparentPower.FromVoltamperes(3)-v).Voltamperes, VoltamperesTolerance); + AssertEx.EqualTolerance(2, (ApparentPower.FromVoltamperes(3)-v).Voltamperes, VoltamperesTolerance); AssertEx.EqualTolerance(2, (v + v).Voltamperes, VoltamperesTolerance); AssertEx.EqualTolerance(10, (v*10).Voltamperes, VoltamperesTolerance); AssertEx.EqualTolerance(10, (10*v).Voltamperes, VoltamperesTolerance); - AssertEx.EqualTolerance(2, (ApparentPower.FromVoltamperes(10)/5).Voltamperes, VoltamperesTolerance); - AssertEx.EqualTolerance(2, ApparentPower.FromVoltamperes(10)/ApparentPower.FromVoltamperes(5), VoltamperesTolerance); + AssertEx.EqualTolerance(2, (ApparentPower.FromVoltamperes(10)/5).Voltamperes, VoltamperesTolerance); + AssertEx.EqualTolerance(2, ApparentPower.FromVoltamperes(10)/ApparentPower.FromVoltamperes(5), VoltamperesTolerance); } [Fact] public void ComparisonOperators() { - ApparentPower oneVoltampere = ApparentPower.FromVoltamperes(1); - ApparentPower twoVoltamperes = ApparentPower.FromVoltamperes(2); + ApparentPower oneVoltampere = ApparentPower.FromVoltamperes(1); + ApparentPower twoVoltamperes = ApparentPower.FromVoltamperes(2); Assert.True(oneVoltampere < twoVoltamperes); Assert.True(oneVoltampere <= twoVoltamperes); @@ -172,31 +172,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ApparentPower voltampere = ApparentPower.FromVoltamperes(1); + ApparentPower voltampere = ApparentPower.FromVoltamperes(1); Assert.Equal(0, voltampere.CompareTo(voltampere)); - Assert.True(voltampere.CompareTo(ApparentPower.Zero) > 0); - Assert.True(ApparentPower.Zero.CompareTo(voltampere) < 0); + Assert.True(voltampere.CompareTo(ApparentPower.Zero) > 0); + Assert.True(ApparentPower.Zero.CompareTo(voltampere) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ApparentPower voltampere = ApparentPower.FromVoltamperes(1); + ApparentPower voltampere = ApparentPower.FromVoltamperes(1); Assert.Throws(() => voltampere.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ApparentPower voltampere = ApparentPower.FromVoltamperes(1); + ApparentPower voltampere = ApparentPower.FromVoltamperes(1); Assert.Throws(() => voltampere.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ApparentPower.FromVoltamperes(1); - var b = ApparentPower.FromVoltamperes(2); + var a = ApparentPower.FromVoltamperes(1); + var b = ApparentPower.FromVoltamperes(2); // ReSharper disable EqualExpressionComparison @@ -215,8 +215,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ApparentPower.FromVoltamperes(1); - var b = ApparentPower.FromVoltamperes(2); + var a = ApparentPower.FromVoltamperes(1); + var b = ApparentPower.FromVoltamperes(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -226,29 +226,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ApparentPower.FromVoltamperes(1); - Assert.True(v.Equals(ApparentPower.FromVoltamperes(1), VoltamperesTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ApparentPower.Zero, VoltamperesTolerance, ComparisonType.Relative)); + var v = ApparentPower.FromVoltamperes(1); + Assert.True(v.Equals(ApparentPower.FromVoltamperes(1), VoltamperesTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ApparentPower.Zero, VoltamperesTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ApparentPower voltampere = ApparentPower.FromVoltamperes(1); + ApparentPower voltampere = ApparentPower.FromVoltamperes(1); Assert.False(voltampere.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ApparentPower voltampere = ApparentPower.FromVoltamperes(1); + ApparentPower voltampere = ApparentPower.FromVoltamperes(1); Assert.False(voltampere.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ApparentPowerUnit.Undefined, ApparentPower.Units); + Assert.DoesNotContain(ApparentPowerUnit.Undefined, ApparentPower.Units); } [Fact] @@ -267,7 +267,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ApparentPower.BaseDimensions is null); + Assert.False(ApparentPower.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs index 401545583b..b6d3680596 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of AreaDensity. + /// Test of AreaDensity. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class AreaDensityTestsBase @@ -43,59 +43,59 @@ public abstract partial class AreaDensityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new AreaDensity((double)0.0, AreaDensityUnit.Undefined)); + Assert.Throws(() => new AreaDensity((double)0.0, AreaDensityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new AreaDensity(double.PositiveInfinity, AreaDensityUnit.KilogramPerSquareMeter)); - Assert.Throws(() => new AreaDensity(double.NegativeInfinity, AreaDensityUnit.KilogramPerSquareMeter)); + Assert.Throws(() => new AreaDensity(double.PositiveInfinity, AreaDensityUnit.KilogramPerSquareMeter)); + Assert.Throws(() => new AreaDensity(double.NegativeInfinity, AreaDensityUnit.KilogramPerSquareMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new AreaDensity(double.NaN, AreaDensityUnit.KilogramPerSquareMeter)); + Assert.Throws(() => new AreaDensity(double.NaN, AreaDensityUnit.KilogramPerSquareMeter)); } [Fact] public void KilogramPerSquareMeterToAreaDensityUnits() { - AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); + AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); AssertEx.EqualTolerance(KilogramsPerSquareMeterInOneKilogramPerSquareMeter, kilogrampersquaremeter.KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); } [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, AreaDensity.From(1, AreaDensityUnit.KilogramPerSquareMeter).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, AreaDensity.From(1, AreaDensityUnit.KilogramPerSquareMeter).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); } [Fact] public void FromKilogramsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.NegativeInfinity)); + Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.NegativeInfinity)); } [Fact] public void FromKilogramsPerSquareMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.NaN)); + Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.NaN)); } [Fact] public void As() { - var kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); + var kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); AssertEx.EqualTolerance(KilogramsPerSquareMeterInOneKilogramPerSquareMeter, kilogrampersquaremeter.As(AreaDensityUnit.KilogramPerSquareMeter), KilogramsPerSquareMeterTolerance); } [Fact] public void ToUnit() { - var kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); + var kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); var kilogrampersquaremeterQuantity = kilogrampersquaremeter.ToUnit(AreaDensityUnit.KilogramPerSquareMeter); AssertEx.EqualTolerance(KilogramsPerSquareMeterInOneKilogramPerSquareMeter, (double)kilogrampersquaremeterQuantity.Value, KilogramsPerSquareMeterTolerance); @@ -105,28 +105,28 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); - AssertEx.EqualTolerance(1, AreaDensity.FromKilogramsPerSquareMeter(kilogrampersquaremeter.KilogramsPerSquareMeter).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); + AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); + AssertEx.EqualTolerance(1, AreaDensity.FromKilogramsPerSquareMeter(kilogrampersquaremeter.KilogramsPerSquareMeter).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); } [Fact] public void ArithmeticOperators() { - AreaDensity v = AreaDensity.FromKilogramsPerSquareMeter(1); + AreaDensity v = AreaDensity.FromKilogramsPerSquareMeter(1); AssertEx.EqualTolerance(-1, -v.KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (AreaDensity.FromKilogramsPerSquareMeter(3)-v).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, (AreaDensity.FromKilogramsPerSquareMeter(3)-v).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); AssertEx.EqualTolerance(2, (v + v).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); AssertEx.EqualTolerance(10, (v*10).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); AssertEx.EqualTolerance(10, (10*v).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (AreaDensity.FromKilogramsPerSquareMeter(10)/5).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, AreaDensity.FromKilogramsPerSquareMeter(10)/AreaDensity.FromKilogramsPerSquareMeter(5), KilogramsPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, (AreaDensity.FromKilogramsPerSquareMeter(10)/5).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, AreaDensity.FromKilogramsPerSquareMeter(10)/AreaDensity.FromKilogramsPerSquareMeter(5), KilogramsPerSquareMeterTolerance); } [Fact] public void ComparisonOperators() { - AreaDensity oneKilogramPerSquareMeter = AreaDensity.FromKilogramsPerSquareMeter(1); - AreaDensity twoKilogramsPerSquareMeter = AreaDensity.FromKilogramsPerSquareMeter(2); + AreaDensity oneKilogramPerSquareMeter = AreaDensity.FromKilogramsPerSquareMeter(1); + AreaDensity twoKilogramsPerSquareMeter = AreaDensity.FromKilogramsPerSquareMeter(2); Assert.True(oneKilogramPerSquareMeter < twoKilogramsPerSquareMeter); Assert.True(oneKilogramPerSquareMeter <= twoKilogramsPerSquareMeter); @@ -142,31 +142,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); + AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); Assert.Equal(0, kilogrampersquaremeter.CompareTo(kilogrampersquaremeter)); - Assert.True(kilogrampersquaremeter.CompareTo(AreaDensity.Zero) > 0); - Assert.True(AreaDensity.Zero.CompareTo(kilogrampersquaremeter) < 0); + Assert.True(kilogrampersquaremeter.CompareTo(AreaDensity.Zero) > 0); + Assert.True(AreaDensity.Zero.CompareTo(kilogrampersquaremeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); + AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); Assert.Throws(() => kilogrampersquaremeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); + AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); Assert.Throws(() => kilogrampersquaremeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = AreaDensity.FromKilogramsPerSquareMeter(1); - var b = AreaDensity.FromKilogramsPerSquareMeter(2); + var a = AreaDensity.FromKilogramsPerSquareMeter(1); + var b = AreaDensity.FromKilogramsPerSquareMeter(2); // ReSharper disable EqualExpressionComparison @@ -185,8 +185,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = AreaDensity.FromKilogramsPerSquareMeter(1); - var b = AreaDensity.FromKilogramsPerSquareMeter(2); + var a = AreaDensity.FromKilogramsPerSquareMeter(1); + var b = AreaDensity.FromKilogramsPerSquareMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -196,29 +196,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = AreaDensity.FromKilogramsPerSquareMeter(1); - Assert.True(v.Equals(AreaDensity.FromKilogramsPerSquareMeter(1), KilogramsPerSquareMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(AreaDensity.Zero, KilogramsPerSquareMeterTolerance, ComparisonType.Relative)); + var v = AreaDensity.FromKilogramsPerSquareMeter(1); + Assert.True(v.Equals(AreaDensity.FromKilogramsPerSquareMeter(1), KilogramsPerSquareMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(AreaDensity.Zero, KilogramsPerSquareMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); + AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); Assert.False(kilogrampersquaremeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); + AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); Assert.False(kilogrampersquaremeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(AreaDensityUnit.Undefined, AreaDensity.Units); + Assert.DoesNotContain(AreaDensityUnit.Undefined, AreaDensity.Units); } [Fact] @@ -237,7 +237,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(AreaDensity.BaseDimensions is null); + Assert.False(AreaDensity.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs index 3a8dded290..5a08937c96 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs @@ -53,26 +53,26 @@ public abstract partial class AreaMomentOfInertiaTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new AreaMomentOfInertia((double)0.0, AreaMomentOfInertiaUnit.Undefined)); + Assert.Throws(() => new AreaMomentOfInertia((double)0.0, AreaMomentOfInertiaUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new AreaMomentOfInertia(double.PositiveInfinity, AreaMomentOfInertiaUnit.MeterToTheFourth)); - Assert.Throws(() => new AreaMomentOfInertia(double.NegativeInfinity, AreaMomentOfInertiaUnit.MeterToTheFourth)); + Assert.Throws(() => new AreaMomentOfInertia(double.PositiveInfinity, AreaMomentOfInertiaUnit.MeterToTheFourth)); + Assert.Throws(() => new AreaMomentOfInertia(double.NegativeInfinity, AreaMomentOfInertiaUnit.MeterToTheFourth)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new AreaMomentOfInertia(double.NaN, AreaMomentOfInertiaUnit.MeterToTheFourth)); + Assert.Throws(() => new AreaMomentOfInertia(double.NaN, AreaMomentOfInertiaUnit.MeterToTheFourth)); } [Fact] public void MeterToTheFourthToAreaMomentOfInertiaUnits() { - AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); + AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); AssertEx.EqualTolerance(CentimetersToTheFourthInOneMeterToTheFourth, metertothefourth.CentimetersToTheFourth, CentimetersToTheFourthTolerance); AssertEx.EqualTolerance(DecimetersToTheFourthInOneMeterToTheFourth, metertothefourth.DecimetersToTheFourth, DecimetersToTheFourthTolerance); AssertEx.EqualTolerance(FeetToTheFourthInOneMeterToTheFourth, metertothefourth.FeetToTheFourth, FeetToTheFourthTolerance); @@ -84,31 +84,31 @@ public void MeterToTheFourthToAreaMomentOfInertiaUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.CentimeterToTheFourth).CentimetersToTheFourth, CentimetersToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.DecimeterToTheFourth).DecimetersToTheFourth, DecimetersToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.FootToTheFourth).FeetToTheFourth, FeetToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.InchToTheFourth).InchesToTheFourth, InchesToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.MeterToTheFourth).MetersToTheFourth, MetersToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.MillimeterToTheFourth).MillimetersToTheFourth, MillimetersToTheFourthTolerance); + AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.CentimeterToTheFourth).CentimetersToTheFourth, CentimetersToTheFourthTolerance); + AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.DecimeterToTheFourth).DecimetersToTheFourth, DecimetersToTheFourthTolerance); + AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.FootToTheFourth).FeetToTheFourth, FeetToTheFourthTolerance); + AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.InchToTheFourth).InchesToTheFourth, InchesToTheFourthTolerance); + AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.MeterToTheFourth).MetersToTheFourth, MetersToTheFourthTolerance); + AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.MillimeterToTheFourth).MillimetersToTheFourth, MillimetersToTheFourthTolerance); } [Fact] public void FromMetersToTheFourth_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.PositiveInfinity)); - Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.NegativeInfinity)); + Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.PositiveInfinity)); + Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.NegativeInfinity)); } [Fact] public void FromMetersToTheFourth_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.NaN)); + Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.NaN)); } [Fact] public void As() { - var metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); + var metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); AssertEx.EqualTolerance(CentimetersToTheFourthInOneMeterToTheFourth, metertothefourth.As(AreaMomentOfInertiaUnit.CentimeterToTheFourth), CentimetersToTheFourthTolerance); AssertEx.EqualTolerance(DecimetersToTheFourthInOneMeterToTheFourth, metertothefourth.As(AreaMomentOfInertiaUnit.DecimeterToTheFourth), DecimetersToTheFourthTolerance); AssertEx.EqualTolerance(FeetToTheFourthInOneMeterToTheFourth, metertothefourth.As(AreaMomentOfInertiaUnit.FootToTheFourth), FeetToTheFourthTolerance); @@ -120,7 +120,7 @@ public void As() [Fact] public void ToUnit() { - var metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); + var metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); var centimetertothefourthQuantity = metertothefourth.ToUnit(AreaMomentOfInertiaUnit.CentimeterToTheFourth); AssertEx.EqualTolerance(CentimetersToTheFourthInOneMeterToTheFourth, (double)centimetertothefourthQuantity.Value, CentimetersToTheFourthTolerance); @@ -150,33 +150,33 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromCentimetersToTheFourth(metertothefourth.CentimetersToTheFourth).MetersToTheFourth, CentimetersToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromDecimetersToTheFourth(metertothefourth.DecimetersToTheFourth).MetersToTheFourth, DecimetersToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromFeetToTheFourth(metertothefourth.FeetToTheFourth).MetersToTheFourth, FeetToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromInchesToTheFourth(metertothefourth.InchesToTheFourth).MetersToTheFourth, InchesToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromMetersToTheFourth(metertothefourth.MetersToTheFourth).MetersToTheFourth, MetersToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromMillimetersToTheFourth(metertothefourth.MillimetersToTheFourth).MetersToTheFourth, MillimetersToTheFourthTolerance); + AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); + AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromCentimetersToTheFourth(metertothefourth.CentimetersToTheFourth).MetersToTheFourth, CentimetersToTheFourthTolerance); + AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromDecimetersToTheFourth(metertothefourth.DecimetersToTheFourth).MetersToTheFourth, DecimetersToTheFourthTolerance); + AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromFeetToTheFourth(metertothefourth.FeetToTheFourth).MetersToTheFourth, FeetToTheFourthTolerance); + AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromInchesToTheFourth(metertothefourth.InchesToTheFourth).MetersToTheFourth, InchesToTheFourthTolerance); + AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromMetersToTheFourth(metertothefourth.MetersToTheFourth).MetersToTheFourth, MetersToTheFourthTolerance); + AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromMillimetersToTheFourth(metertothefourth.MillimetersToTheFourth).MetersToTheFourth, MillimetersToTheFourthTolerance); } [Fact] public void ArithmeticOperators() { - AreaMomentOfInertia v = AreaMomentOfInertia.FromMetersToTheFourth(1); + AreaMomentOfInertia v = AreaMomentOfInertia.FromMetersToTheFourth(1); AssertEx.EqualTolerance(-1, -v.MetersToTheFourth, MetersToTheFourthTolerance); - AssertEx.EqualTolerance(2, (AreaMomentOfInertia.FromMetersToTheFourth(3)-v).MetersToTheFourth, MetersToTheFourthTolerance); + AssertEx.EqualTolerance(2, (AreaMomentOfInertia.FromMetersToTheFourth(3)-v).MetersToTheFourth, MetersToTheFourthTolerance); AssertEx.EqualTolerance(2, (v + v).MetersToTheFourth, MetersToTheFourthTolerance); AssertEx.EqualTolerance(10, (v*10).MetersToTheFourth, MetersToTheFourthTolerance); AssertEx.EqualTolerance(10, (10*v).MetersToTheFourth, MetersToTheFourthTolerance); - AssertEx.EqualTolerance(2, (AreaMomentOfInertia.FromMetersToTheFourth(10)/5).MetersToTheFourth, MetersToTheFourthTolerance); - AssertEx.EqualTolerance(2, AreaMomentOfInertia.FromMetersToTheFourth(10)/AreaMomentOfInertia.FromMetersToTheFourth(5), MetersToTheFourthTolerance); + AssertEx.EqualTolerance(2, (AreaMomentOfInertia.FromMetersToTheFourth(10)/5).MetersToTheFourth, MetersToTheFourthTolerance); + AssertEx.EqualTolerance(2, AreaMomentOfInertia.FromMetersToTheFourth(10)/AreaMomentOfInertia.FromMetersToTheFourth(5), MetersToTheFourthTolerance); } [Fact] public void ComparisonOperators() { - AreaMomentOfInertia oneMeterToTheFourth = AreaMomentOfInertia.FromMetersToTheFourth(1); - AreaMomentOfInertia twoMetersToTheFourth = AreaMomentOfInertia.FromMetersToTheFourth(2); + AreaMomentOfInertia oneMeterToTheFourth = AreaMomentOfInertia.FromMetersToTheFourth(1); + AreaMomentOfInertia twoMetersToTheFourth = AreaMomentOfInertia.FromMetersToTheFourth(2); Assert.True(oneMeterToTheFourth < twoMetersToTheFourth); Assert.True(oneMeterToTheFourth <= twoMetersToTheFourth); @@ -192,31 +192,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); + AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); Assert.Equal(0, metertothefourth.CompareTo(metertothefourth)); - Assert.True(metertothefourth.CompareTo(AreaMomentOfInertia.Zero) > 0); - Assert.True(AreaMomentOfInertia.Zero.CompareTo(metertothefourth) < 0); + Assert.True(metertothefourth.CompareTo(AreaMomentOfInertia.Zero) > 0); + Assert.True(AreaMomentOfInertia.Zero.CompareTo(metertothefourth) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); + AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); Assert.Throws(() => metertothefourth.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); + AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); Assert.Throws(() => metertothefourth.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = AreaMomentOfInertia.FromMetersToTheFourth(1); - var b = AreaMomentOfInertia.FromMetersToTheFourth(2); + var a = AreaMomentOfInertia.FromMetersToTheFourth(1); + var b = AreaMomentOfInertia.FromMetersToTheFourth(2); // ReSharper disable EqualExpressionComparison @@ -235,8 +235,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = AreaMomentOfInertia.FromMetersToTheFourth(1); - var b = AreaMomentOfInertia.FromMetersToTheFourth(2); + var a = AreaMomentOfInertia.FromMetersToTheFourth(1); + var b = AreaMomentOfInertia.FromMetersToTheFourth(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -246,29 +246,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = AreaMomentOfInertia.FromMetersToTheFourth(1); - Assert.True(v.Equals(AreaMomentOfInertia.FromMetersToTheFourth(1), MetersToTheFourthTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(AreaMomentOfInertia.Zero, MetersToTheFourthTolerance, ComparisonType.Relative)); + var v = AreaMomentOfInertia.FromMetersToTheFourth(1); + Assert.True(v.Equals(AreaMomentOfInertia.FromMetersToTheFourth(1), MetersToTheFourthTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(AreaMomentOfInertia.Zero, MetersToTheFourthTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); + AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); Assert.False(metertothefourth.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); + AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); Assert.False(metertothefourth.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(AreaMomentOfInertiaUnit.Undefined, AreaMomentOfInertia.Units); + Assert.DoesNotContain(AreaMomentOfInertiaUnit.Undefined, AreaMomentOfInertia.Units); } [Fact] @@ -287,7 +287,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(AreaMomentOfInertia.BaseDimensions is null); + Assert.False(AreaMomentOfInertia.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs index 411bf18ab4..74e25d049a 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs @@ -69,26 +69,26 @@ public abstract partial class AreaTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Area((double)0.0, AreaUnit.Undefined)); + Assert.Throws(() => new Area((double)0.0, AreaUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Area(double.PositiveInfinity, AreaUnit.SquareMeter)); - Assert.Throws(() => new Area(double.NegativeInfinity, AreaUnit.SquareMeter)); + Assert.Throws(() => new Area(double.PositiveInfinity, AreaUnit.SquareMeter)); + Assert.Throws(() => new Area(double.NegativeInfinity, AreaUnit.SquareMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Area(double.NaN, AreaUnit.SquareMeter)); + Assert.Throws(() => new Area(double.NaN, AreaUnit.SquareMeter)); } [Fact] public void SquareMeterToAreaUnits() { - Area squaremeter = Area.FromSquareMeters(1); + Area squaremeter = Area.FromSquareMeters(1); AssertEx.EqualTolerance(AcresInOneSquareMeter, squaremeter.Acres, AcresTolerance); AssertEx.EqualTolerance(HectaresInOneSquareMeter, squaremeter.Hectares, HectaresTolerance); AssertEx.EqualTolerance(SquareCentimetersInOneSquareMeter, squaremeter.SquareCentimeters, SquareCentimetersTolerance); @@ -108,39 +108,39 @@ public void SquareMeterToAreaUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.Acre).Acres, AcresTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.Hectare).Hectares, HectaresTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareCentimeter).SquareCentimeters, SquareCentimetersTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareDecimeter).SquareDecimeters, SquareDecimetersTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareFoot).SquareFeet, SquareFeetTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareInch).SquareInches, SquareInchesTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareKilometer).SquareKilometers, SquareKilometersTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareMeter).SquareMeters, SquareMetersTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareMicrometer).SquareMicrometers, SquareMicrometersTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareMile).SquareMiles, SquareMilesTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareMillimeter).SquareMillimeters, SquareMillimetersTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareNauticalMile).SquareNauticalMiles, SquareNauticalMilesTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareYard).SquareYards, SquareYardsTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.UsSurveySquareFoot).UsSurveySquareFeet, UsSurveySquareFeetTolerance); + AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.Acre).Acres, AcresTolerance); + AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.Hectare).Hectares, HectaresTolerance); + AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareCentimeter).SquareCentimeters, SquareCentimetersTolerance); + AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareDecimeter).SquareDecimeters, SquareDecimetersTolerance); + AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareFoot).SquareFeet, SquareFeetTolerance); + AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareInch).SquareInches, SquareInchesTolerance); + AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareKilometer).SquareKilometers, SquareKilometersTolerance); + AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareMeter).SquareMeters, SquareMetersTolerance); + AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareMicrometer).SquareMicrometers, SquareMicrometersTolerance); + AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareMile).SquareMiles, SquareMilesTolerance); + AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareMillimeter).SquareMillimeters, SquareMillimetersTolerance); + AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareNauticalMile).SquareNauticalMiles, SquareNauticalMilesTolerance); + AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareYard).SquareYards, SquareYardsTolerance); + AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.UsSurveySquareFoot).UsSurveySquareFeet, UsSurveySquareFeetTolerance); } [Fact] public void FromSquareMeters_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Area.FromSquareMeters(double.PositiveInfinity)); - Assert.Throws(() => Area.FromSquareMeters(double.NegativeInfinity)); + Assert.Throws(() => Area.FromSquareMeters(double.PositiveInfinity)); + Assert.Throws(() => Area.FromSquareMeters(double.NegativeInfinity)); } [Fact] public void FromSquareMeters_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Area.FromSquareMeters(double.NaN)); + Assert.Throws(() => Area.FromSquareMeters(double.NaN)); } [Fact] public void As() { - var squaremeter = Area.FromSquareMeters(1); + var squaremeter = Area.FromSquareMeters(1); AssertEx.EqualTolerance(AcresInOneSquareMeter, squaremeter.As(AreaUnit.Acre), AcresTolerance); AssertEx.EqualTolerance(HectaresInOneSquareMeter, squaremeter.As(AreaUnit.Hectare), HectaresTolerance); AssertEx.EqualTolerance(SquareCentimetersInOneSquareMeter, squaremeter.As(AreaUnit.SquareCentimeter), SquareCentimetersTolerance); @@ -160,7 +160,7 @@ public void As() [Fact] public void ToUnit() { - var squaremeter = Area.FromSquareMeters(1); + var squaremeter = Area.FromSquareMeters(1); var acreQuantity = squaremeter.ToUnit(AreaUnit.Acre); AssertEx.EqualTolerance(AcresInOneSquareMeter, (double)acreQuantity.Value, AcresTolerance); @@ -222,41 +222,41 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Area squaremeter = Area.FromSquareMeters(1); - AssertEx.EqualTolerance(1, Area.FromAcres(squaremeter.Acres).SquareMeters, AcresTolerance); - AssertEx.EqualTolerance(1, Area.FromHectares(squaremeter.Hectares).SquareMeters, HectaresTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareCentimeters(squaremeter.SquareCentimeters).SquareMeters, SquareCentimetersTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareDecimeters(squaremeter.SquareDecimeters).SquareMeters, SquareDecimetersTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareFeet(squaremeter.SquareFeet).SquareMeters, SquareFeetTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareInches(squaremeter.SquareInches).SquareMeters, SquareInchesTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareKilometers(squaremeter.SquareKilometers).SquareMeters, SquareKilometersTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareMeters(squaremeter.SquareMeters).SquareMeters, SquareMetersTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareMicrometers(squaremeter.SquareMicrometers).SquareMeters, SquareMicrometersTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareMiles(squaremeter.SquareMiles).SquareMeters, SquareMilesTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareMillimeters(squaremeter.SquareMillimeters).SquareMeters, SquareMillimetersTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareNauticalMiles(squaremeter.SquareNauticalMiles).SquareMeters, SquareNauticalMilesTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareYards(squaremeter.SquareYards).SquareMeters, SquareYardsTolerance); - AssertEx.EqualTolerance(1, Area.FromUsSurveySquareFeet(squaremeter.UsSurveySquareFeet).SquareMeters, UsSurveySquareFeetTolerance); + Area squaremeter = Area.FromSquareMeters(1); + AssertEx.EqualTolerance(1, Area.FromAcres(squaremeter.Acres).SquareMeters, AcresTolerance); + AssertEx.EqualTolerance(1, Area.FromHectares(squaremeter.Hectares).SquareMeters, HectaresTolerance); + AssertEx.EqualTolerance(1, Area.FromSquareCentimeters(squaremeter.SquareCentimeters).SquareMeters, SquareCentimetersTolerance); + AssertEx.EqualTolerance(1, Area.FromSquareDecimeters(squaremeter.SquareDecimeters).SquareMeters, SquareDecimetersTolerance); + AssertEx.EqualTolerance(1, Area.FromSquareFeet(squaremeter.SquareFeet).SquareMeters, SquareFeetTolerance); + AssertEx.EqualTolerance(1, Area.FromSquareInches(squaremeter.SquareInches).SquareMeters, SquareInchesTolerance); + AssertEx.EqualTolerance(1, Area.FromSquareKilometers(squaremeter.SquareKilometers).SquareMeters, SquareKilometersTolerance); + AssertEx.EqualTolerance(1, Area.FromSquareMeters(squaremeter.SquareMeters).SquareMeters, SquareMetersTolerance); + AssertEx.EqualTolerance(1, Area.FromSquareMicrometers(squaremeter.SquareMicrometers).SquareMeters, SquareMicrometersTolerance); + AssertEx.EqualTolerance(1, Area.FromSquareMiles(squaremeter.SquareMiles).SquareMeters, SquareMilesTolerance); + AssertEx.EqualTolerance(1, Area.FromSquareMillimeters(squaremeter.SquareMillimeters).SquareMeters, SquareMillimetersTolerance); + AssertEx.EqualTolerance(1, Area.FromSquareNauticalMiles(squaremeter.SquareNauticalMiles).SquareMeters, SquareNauticalMilesTolerance); + AssertEx.EqualTolerance(1, Area.FromSquareYards(squaremeter.SquareYards).SquareMeters, SquareYardsTolerance); + AssertEx.EqualTolerance(1, Area.FromUsSurveySquareFeet(squaremeter.UsSurveySquareFeet).SquareMeters, UsSurveySquareFeetTolerance); } [Fact] public void ArithmeticOperators() { - Area v = Area.FromSquareMeters(1); + Area v = Area.FromSquareMeters(1); AssertEx.EqualTolerance(-1, -v.SquareMeters, SquareMetersTolerance); - AssertEx.EqualTolerance(2, (Area.FromSquareMeters(3)-v).SquareMeters, SquareMetersTolerance); + AssertEx.EqualTolerance(2, (Area.FromSquareMeters(3)-v).SquareMeters, SquareMetersTolerance); AssertEx.EqualTolerance(2, (v + v).SquareMeters, SquareMetersTolerance); AssertEx.EqualTolerance(10, (v*10).SquareMeters, SquareMetersTolerance); AssertEx.EqualTolerance(10, (10*v).SquareMeters, SquareMetersTolerance); - AssertEx.EqualTolerance(2, (Area.FromSquareMeters(10)/5).SquareMeters, SquareMetersTolerance); - AssertEx.EqualTolerance(2, Area.FromSquareMeters(10)/Area.FromSquareMeters(5), SquareMetersTolerance); + AssertEx.EqualTolerance(2, (Area.FromSquareMeters(10)/5).SquareMeters, SquareMetersTolerance); + AssertEx.EqualTolerance(2, Area.FromSquareMeters(10)/Area.FromSquareMeters(5), SquareMetersTolerance); } [Fact] public void ComparisonOperators() { - Area oneSquareMeter = Area.FromSquareMeters(1); - Area twoSquareMeters = Area.FromSquareMeters(2); + Area oneSquareMeter = Area.FromSquareMeters(1); + Area twoSquareMeters = Area.FromSquareMeters(2); Assert.True(oneSquareMeter < twoSquareMeters); Assert.True(oneSquareMeter <= twoSquareMeters); @@ -272,31 +272,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Area squaremeter = Area.FromSquareMeters(1); + Area squaremeter = Area.FromSquareMeters(1); Assert.Equal(0, squaremeter.CompareTo(squaremeter)); - Assert.True(squaremeter.CompareTo(Area.Zero) > 0); - Assert.True(Area.Zero.CompareTo(squaremeter) < 0); + Assert.True(squaremeter.CompareTo(Area.Zero) > 0); + Assert.True(Area.Zero.CompareTo(squaremeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Area squaremeter = Area.FromSquareMeters(1); + Area squaremeter = Area.FromSquareMeters(1); Assert.Throws(() => squaremeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Area squaremeter = Area.FromSquareMeters(1); + Area squaremeter = Area.FromSquareMeters(1); Assert.Throws(() => squaremeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Area.FromSquareMeters(1); - var b = Area.FromSquareMeters(2); + var a = Area.FromSquareMeters(1); + var b = Area.FromSquareMeters(2); // ReSharper disable EqualExpressionComparison @@ -315,8 +315,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Area.FromSquareMeters(1); - var b = Area.FromSquareMeters(2); + var a = Area.FromSquareMeters(1); + var b = Area.FromSquareMeters(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -326,29 +326,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Area.FromSquareMeters(1); - Assert.True(v.Equals(Area.FromSquareMeters(1), SquareMetersTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Area.Zero, SquareMetersTolerance, ComparisonType.Relative)); + var v = Area.FromSquareMeters(1); + Assert.True(v.Equals(Area.FromSquareMeters(1), SquareMetersTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Area.Zero, SquareMetersTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Area squaremeter = Area.FromSquareMeters(1); + Area squaremeter = Area.FromSquareMeters(1); Assert.False(squaremeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Area squaremeter = Area.FromSquareMeters(1); + Area squaremeter = Area.FromSquareMeters(1); Assert.False(squaremeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(AreaUnit.Undefined, Area.Units); + Assert.DoesNotContain(AreaUnit.Undefined, Area.Units); } [Fact] @@ -367,7 +367,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Area.BaseDimensions is null); + Assert.False(Area.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs index e142f48122..4a3f04498c 100644 --- a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs @@ -93,13 +93,13 @@ public abstract partial class BitRateTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new BitRate((decimal)0.0, BitRateUnit.Undefined)); + Assert.Throws(() => new BitRate((decimal)0.0, BitRateUnit.Undefined)); } [Fact] public void BitPerSecondToBitRateUnits() { - BitRate bitpersecond = BitRate.FromBitsPerSecond(1); + BitRate bitpersecond = BitRate.FromBitsPerSecond(1); AssertEx.EqualTolerance(BitsPerSecondInOneBitPerSecond, bitpersecond.BitsPerSecond, BitsPerSecondTolerance); AssertEx.EqualTolerance(BytesPerSecondInOneBitPerSecond, bitpersecond.BytesPerSecond, BytesPerSecondTolerance); AssertEx.EqualTolerance(ExabitsPerSecondInOneBitPerSecond, bitpersecond.ExabitsPerSecond, ExabitsPerSecondTolerance); @@ -131,38 +131,38 @@ public void BitPerSecondToBitRateUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.BitPerSecond).BitsPerSecond, BitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.BytePerSecond).BytesPerSecond, BytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.ExabitPerSecond).ExabitsPerSecond, ExabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.ExabytePerSecond).ExabytesPerSecond, ExabytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.ExbibitPerSecond).ExbibitsPerSecond, ExbibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.ExbibytePerSecond).ExbibytesPerSecond, ExbibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.GibibitPerSecond).GibibitsPerSecond, GibibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.GibibytePerSecond).GibibytesPerSecond, GibibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.GigabitPerSecond).GigabitsPerSecond, GigabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.GigabytePerSecond).GigabytesPerSecond, GigabytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.KibibitPerSecond).KibibitsPerSecond, KibibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.KibibytePerSecond).KibibytesPerSecond, KibibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.KilobitPerSecond).KilobitsPerSecond, KilobitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.KilobytePerSecond).KilobytesPerSecond, KilobytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.MebibitPerSecond).MebibitsPerSecond, MebibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.MebibytePerSecond).MebibytesPerSecond, MebibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.MegabitPerSecond).MegabitsPerSecond, MegabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.MegabytePerSecond).MegabytesPerSecond, MegabytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.PebibitPerSecond).PebibitsPerSecond, PebibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.PebibytePerSecond).PebibytesPerSecond, PebibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.PetabitPerSecond).PetabitsPerSecond, PetabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.PetabytePerSecond).PetabytesPerSecond, PetabytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TebibitPerSecond).TebibitsPerSecond, TebibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TebibytePerSecond).TebibytesPerSecond, TebibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TerabitPerSecond).TerabitsPerSecond, TerabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TerabytePerSecond).TerabytesPerSecond, TerabytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.BitPerSecond).BitsPerSecond, BitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.BytePerSecond).BytesPerSecond, BytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.ExabitPerSecond).ExabitsPerSecond, ExabitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.ExabytePerSecond).ExabytesPerSecond, ExabytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.ExbibitPerSecond).ExbibitsPerSecond, ExbibitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.ExbibytePerSecond).ExbibytesPerSecond, ExbibytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.GibibitPerSecond).GibibitsPerSecond, GibibitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.GibibytePerSecond).GibibytesPerSecond, GibibytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.GigabitPerSecond).GigabitsPerSecond, GigabitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.GigabytePerSecond).GigabytesPerSecond, GigabytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.KibibitPerSecond).KibibitsPerSecond, KibibitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.KibibytePerSecond).KibibytesPerSecond, KibibytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.KilobitPerSecond).KilobitsPerSecond, KilobitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.KilobytePerSecond).KilobytesPerSecond, KilobytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.MebibitPerSecond).MebibitsPerSecond, MebibitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.MebibytePerSecond).MebibytesPerSecond, MebibytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.MegabitPerSecond).MegabitsPerSecond, MegabitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.MegabytePerSecond).MegabytesPerSecond, MegabytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.PebibitPerSecond).PebibitsPerSecond, PebibitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.PebibytePerSecond).PebibytesPerSecond, PebibytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.PetabitPerSecond).PetabitsPerSecond, PetabitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.PetabytePerSecond).PetabytesPerSecond, PetabytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TebibitPerSecond).TebibitsPerSecond, TebibitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TebibytePerSecond).TebibytesPerSecond, TebibytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TerabitPerSecond).TerabitsPerSecond, TerabitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TerabytePerSecond).TerabytesPerSecond, TerabytesPerSecondTolerance); } [Fact] public void As() { - var bitpersecond = BitRate.FromBitsPerSecond(1); + var bitpersecond = BitRate.FromBitsPerSecond(1); AssertEx.EqualTolerance(BitsPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.BitPerSecond), BitsPerSecondTolerance); AssertEx.EqualTolerance(BytesPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.BytePerSecond), BytesPerSecondTolerance); AssertEx.EqualTolerance(ExabitsPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.ExabitPerSecond), ExabitsPerSecondTolerance); @@ -194,7 +194,7 @@ public void As() [Fact] public void ToUnit() { - var bitpersecond = BitRate.FromBitsPerSecond(1); + var bitpersecond = BitRate.FromBitsPerSecond(1); var bitpersecondQuantity = bitpersecond.ToUnit(BitRateUnit.BitPerSecond); AssertEx.EqualTolerance(BitsPerSecondInOneBitPerSecond, (double)bitpersecondQuantity.Value, BitsPerSecondTolerance); @@ -304,53 +304,53 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - BitRate bitpersecond = BitRate.FromBitsPerSecond(1); - AssertEx.EqualTolerance(1, BitRate.FromBitsPerSecond(bitpersecond.BitsPerSecond).BitsPerSecond, BitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromBytesPerSecond(bitpersecond.BytesPerSecond).BitsPerSecond, BytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromExabitsPerSecond(bitpersecond.ExabitsPerSecond).BitsPerSecond, ExabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromExabytesPerSecond(bitpersecond.ExabytesPerSecond).BitsPerSecond, ExabytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromExbibitsPerSecond(bitpersecond.ExbibitsPerSecond).BitsPerSecond, ExbibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromExbibytesPerSecond(bitpersecond.ExbibytesPerSecond).BitsPerSecond, ExbibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromGibibitsPerSecond(bitpersecond.GibibitsPerSecond).BitsPerSecond, GibibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromGibibytesPerSecond(bitpersecond.GibibytesPerSecond).BitsPerSecond, GibibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromGigabitsPerSecond(bitpersecond.GigabitsPerSecond).BitsPerSecond, GigabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromGigabytesPerSecond(bitpersecond.GigabytesPerSecond).BitsPerSecond, GigabytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromKibibitsPerSecond(bitpersecond.KibibitsPerSecond).BitsPerSecond, KibibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromKibibytesPerSecond(bitpersecond.KibibytesPerSecond).BitsPerSecond, KibibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromKilobitsPerSecond(bitpersecond.KilobitsPerSecond).BitsPerSecond, KilobitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromKilobytesPerSecond(bitpersecond.KilobytesPerSecond).BitsPerSecond, KilobytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromMebibitsPerSecond(bitpersecond.MebibitsPerSecond).BitsPerSecond, MebibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromMebibytesPerSecond(bitpersecond.MebibytesPerSecond).BitsPerSecond, MebibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromMegabitsPerSecond(bitpersecond.MegabitsPerSecond).BitsPerSecond, MegabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromMegabytesPerSecond(bitpersecond.MegabytesPerSecond).BitsPerSecond, MegabytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromPebibitsPerSecond(bitpersecond.PebibitsPerSecond).BitsPerSecond, PebibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromPebibytesPerSecond(bitpersecond.PebibytesPerSecond).BitsPerSecond, PebibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromPetabitsPerSecond(bitpersecond.PetabitsPerSecond).BitsPerSecond, PetabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromPetabytesPerSecond(bitpersecond.PetabytesPerSecond).BitsPerSecond, PetabytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromTebibitsPerSecond(bitpersecond.TebibitsPerSecond).BitsPerSecond, TebibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromTebibytesPerSecond(bitpersecond.TebibytesPerSecond).BitsPerSecond, TebibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromTerabitsPerSecond(bitpersecond.TerabitsPerSecond).BitsPerSecond, TerabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromTerabytesPerSecond(bitpersecond.TerabytesPerSecond).BitsPerSecond, TerabytesPerSecondTolerance); + BitRate bitpersecond = BitRate.FromBitsPerSecond(1); + AssertEx.EqualTolerance(1, BitRate.FromBitsPerSecond(bitpersecond.BitsPerSecond).BitsPerSecond, BitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromBytesPerSecond(bitpersecond.BytesPerSecond).BitsPerSecond, BytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromExabitsPerSecond(bitpersecond.ExabitsPerSecond).BitsPerSecond, ExabitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromExabytesPerSecond(bitpersecond.ExabytesPerSecond).BitsPerSecond, ExabytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromExbibitsPerSecond(bitpersecond.ExbibitsPerSecond).BitsPerSecond, ExbibitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromExbibytesPerSecond(bitpersecond.ExbibytesPerSecond).BitsPerSecond, ExbibytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromGibibitsPerSecond(bitpersecond.GibibitsPerSecond).BitsPerSecond, GibibitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromGibibytesPerSecond(bitpersecond.GibibytesPerSecond).BitsPerSecond, GibibytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromGigabitsPerSecond(bitpersecond.GigabitsPerSecond).BitsPerSecond, GigabitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromGigabytesPerSecond(bitpersecond.GigabytesPerSecond).BitsPerSecond, GigabytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromKibibitsPerSecond(bitpersecond.KibibitsPerSecond).BitsPerSecond, KibibitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromKibibytesPerSecond(bitpersecond.KibibytesPerSecond).BitsPerSecond, KibibytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromKilobitsPerSecond(bitpersecond.KilobitsPerSecond).BitsPerSecond, KilobitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromKilobytesPerSecond(bitpersecond.KilobytesPerSecond).BitsPerSecond, KilobytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromMebibitsPerSecond(bitpersecond.MebibitsPerSecond).BitsPerSecond, MebibitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromMebibytesPerSecond(bitpersecond.MebibytesPerSecond).BitsPerSecond, MebibytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromMegabitsPerSecond(bitpersecond.MegabitsPerSecond).BitsPerSecond, MegabitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromMegabytesPerSecond(bitpersecond.MegabytesPerSecond).BitsPerSecond, MegabytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromPebibitsPerSecond(bitpersecond.PebibitsPerSecond).BitsPerSecond, PebibitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromPebibytesPerSecond(bitpersecond.PebibytesPerSecond).BitsPerSecond, PebibytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromPetabitsPerSecond(bitpersecond.PetabitsPerSecond).BitsPerSecond, PetabitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromPetabytesPerSecond(bitpersecond.PetabytesPerSecond).BitsPerSecond, PetabytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromTebibitsPerSecond(bitpersecond.TebibitsPerSecond).BitsPerSecond, TebibitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromTebibytesPerSecond(bitpersecond.TebibytesPerSecond).BitsPerSecond, TebibytesPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromTerabitsPerSecond(bitpersecond.TerabitsPerSecond).BitsPerSecond, TerabitsPerSecondTolerance); + AssertEx.EqualTolerance(1, BitRate.FromTerabytesPerSecond(bitpersecond.TerabytesPerSecond).BitsPerSecond, TerabytesPerSecondTolerance); } [Fact] public void ArithmeticOperators() { - BitRate v = BitRate.FromBitsPerSecond(1); + BitRate v = BitRate.FromBitsPerSecond(1); AssertEx.EqualTolerance(-1, -v.BitsPerSecond, BitsPerSecondTolerance); - AssertEx.EqualTolerance(2, (BitRate.FromBitsPerSecond(3)-v).BitsPerSecond, BitsPerSecondTolerance); + AssertEx.EqualTolerance(2, (BitRate.FromBitsPerSecond(3)-v).BitsPerSecond, BitsPerSecondTolerance); AssertEx.EqualTolerance(2, (v + v).BitsPerSecond, BitsPerSecondTolerance); AssertEx.EqualTolerance(10, (v*10).BitsPerSecond, BitsPerSecondTolerance); AssertEx.EqualTolerance(10, (10*v).BitsPerSecond, BitsPerSecondTolerance); - AssertEx.EqualTolerance(2, (BitRate.FromBitsPerSecond(10)/5).BitsPerSecond, BitsPerSecondTolerance); - AssertEx.EqualTolerance(2, BitRate.FromBitsPerSecond(10)/BitRate.FromBitsPerSecond(5), BitsPerSecondTolerance); + AssertEx.EqualTolerance(2, (BitRate.FromBitsPerSecond(10)/5).BitsPerSecond, BitsPerSecondTolerance); + AssertEx.EqualTolerance(2, BitRate.FromBitsPerSecond(10)/BitRate.FromBitsPerSecond(5), BitsPerSecondTolerance); } [Fact] public void ComparisonOperators() { - BitRate oneBitPerSecond = BitRate.FromBitsPerSecond(1); - BitRate twoBitsPerSecond = BitRate.FromBitsPerSecond(2); + BitRate oneBitPerSecond = BitRate.FromBitsPerSecond(1); + BitRate twoBitsPerSecond = BitRate.FromBitsPerSecond(2); Assert.True(oneBitPerSecond < twoBitsPerSecond); Assert.True(oneBitPerSecond <= twoBitsPerSecond); @@ -366,31 +366,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - BitRate bitpersecond = BitRate.FromBitsPerSecond(1); + BitRate bitpersecond = BitRate.FromBitsPerSecond(1); Assert.Equal(0, bitpersecond.CompareTo(bitpersecond)); - Assert.True(bitpersecond.CompareTo(BitRate.Zero) > 0); - Assert.True(BitRate.Zero.CompareTo(bitpersecond) < 0); + Assert.True(bitpersecond.CompareTo(BitRate.Zero) > 0); + Assert.True(BitRate.Zero.CompareTo(bitpersecond) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - BitRate bitpersecond = BitRate.FromBitsPerSecond(1); + BitRate bitpersecond = BitRate.FromBitsPerSecond(1); Assert.Throws(() => bitpersecond.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - BitRate bitpersecond = BitRate.FromBitsPerSecond(1); + BitRate bitpersecond = BitRate.FromBitsPerSecond(1); Assert.Throws(() => bitpersecond.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = BitRate.FromBitsPerSecond(1); - var b = BitRate.FromBitsPerSecond(2); + var a = BitRate.FromBitsPerSecond(1); + var b = BitRate.FromBitsPerSecond(2); // ReSharper disable EqualExpressionComparison @@ -409,8 +409,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = BitRate.FromBitsPerSecond(1); - var b = BitRate.FromBitsPerSecond(2); + var a = BitRate.FromBitsPerSecond(1); + var b = BitRate.FromBitsPerSecond(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -420,29 +420,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = BitRate.FromBitsPerSecond(1); - Assert.True(v.Equals(BitRate.FromBitsPerSecond(1), BitsPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(BitRate.Zero, BitsPerSecondTolerance, ComparisonType.Relative)); + var v = BitRate.FromBitsPerSecond(1); + Assert.True(v.Equals(BitRate.FromBitsPerSecond(1), BitsPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(BitRate.Zero, BitsPerSecondTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - BitRate bitpersecond = BitRate.FromBitsPerSecond(1); + BitRate bitpersecond = BitRate.FromBitsPerSecond(1); Assert.False(bitpersecond.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - BitRate bitpersecond = BitRate.FromBitsPerSecond(1); + BitRate bitpersecond = BitRate.FromBitsPerSecond(1); Assert.False(bitpersecond.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(BitRateUnit.Undefined, BitRate.Units); + Assert.DoesNotContain(BitRateUnit.Undefined, BitRate.Units); } [Fact] @@ -461,7 +461,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(BitRate.BaseDimensions is null); + Assert.False(BitRate.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs index d7e0f5dbf9..bbbf11a979 100644 --- a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of BrakeSpecificFuelConsumption. + /// Test of BrakeSpecificFuelConsumption. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class BrakeSpecificFuelConsumptionTestsBase @@ -47,26 +47,26 @@ public abstract partial class BrakeSpecificFuelConsumptionTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new BrakeSpecificFuelConsumption((double)0.0, BrakeSpecificFuelConsumptionUnit.Undefined)); + Assert.Throws(() => new BrakeSpecificFuelConsumption((double)0.0, BrakeSpecificFuelConsumptionUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new BrakeSpecificFuelConsumption(double.PositiveInfinity, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); - Assert.Throws(() => new BrakeSpecificFuelConsumption(double.NegativeInfinity, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); + Assert.Throws(() => new BrakeSpecificFuelConsumption(double.PositiveInfinity, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); + Assert.Throws(() => new BrakeSpecificFuelConsumption(double.NegativeInfinity, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new BrakeSpecificFuelConsumption(double.NaN, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); + Assert.Throws(() => new BrakeSpecificFuelConsumption(double.NaN, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); } [Fact] public void KilogramPerJouleToBrakeSpecificFuelConsumptionUnits() { - BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); + BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); AssertEx.EqualTolerance(GramsPerKiloWattHourInOneKilogramPerJoule, kilogramperjoule.GramsPerKiloWattHour, GramsPerKiloWattHourTolerance); AssertEx.EqualTolerance(KilogramsPerJouleInOneKilogramPerJoule, kilogramperjoule.KilogramsPerJoule, KilogramsPerJouleTolerance); AssertEx.EqualTolerance(PoundsPerMechanicalHorsepowerHourInOneKilogramPerJoule, kilogramperjoule.PoundsPerMechanicalHorsepowerHour, PoundsPerMechanicalHorsepowerHourTolerance); @@ -75,28 +75,28 @@ public void KilogramPerJouleToBrakeSpecificFuelConsumptionUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.From(1, BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour).GramsPerKiloWattHour, GramsPerKiloWattHourTolerance); - AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.From(1, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule).KilogramsPerJoule, KilogramsPerJouleTolerance); - AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.From(1, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour).PoundsPerMechanicalHorsepowerHour, PoundsPerMechanicalHorsepowerHourTolerance); + AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.From(1, BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour).GramsPerKiloWattHour, GramsPerKiloWattHourTolerance); + AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.From(1, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule).KilogramsPerJoule, KilogramsPerJouleTolerance); + AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.From(1, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour).PoundsPerMechanicalHorsepowerHour, PoundsPerMechanicalHorsepowerHourTolerance); } [Fact] public void FromKilogramsPerJoule_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.PositiveInfinity)); - Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.NegativeInfinity)); + Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.PositiveInfinity)); + Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.NegativeInfinity)); } [Fact] public void FromKilogramsPerJoule_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.NaN)); + Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.NaN)); } [Fact] public void As() { - var kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); + var kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); AssertEx.EqualTolerance(GramsPerKiloWattHourInOneKilogramPerJoule, kilogramperjoule.As(BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour), GramsPerKiloWattHourTolerance); AssertEx.EqualTolerance(KilogramsPerJouleInOneKilogramPerJoule, kilogramperjoule.As(BrakeSpecificFuelConsumptionUnit.KilogramPerJoule), KilogramsPerJouleTolerance); AssertEx.EqualTolerance(PoundsPerMechanicalHorsepowerHourInOneKilogramPerJoule, kilogramperjoule.As(BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour), PoundsPerMechanicalHorsepowerHourTolerance); @@ -105,7 +105,7 @@ public void As() [Fact] public void ToUnit() { - var kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); + var kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); var gramperkilowatthourQuantity = kilogramperjoule.ToUnit(BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour); AssertEx.EqualTolerance(GramsPerKiloWattHourInOneKilogramPerJoule, (double)gramperkilowatthourQuantity.Value, GramsPerKiloWattHourTolerance); @@ -123,30 +123,30 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(kilogramperjoule.GramsPerKiloWattHour).KilogramsPerJoule, GramsPerKiloWattHourTolerance); - AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.FromKilogramsPerJoule(kilogramperjoule.KilogramsPerJoule).KilogramsPerJoule, KilogramsPerJouleTolerance); - AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.FromPoundsPerMechanicalHorsepowerHour(kilogramperjoule.PoundsPerMechanicalHorsepowerHour).KilogramsPerJoule, PoundsPerMechanicalHorsepowerHourTolerance); + BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); + AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(kilogramperjoule.GramsPerKiloWattHour).KilogramsPerJoule, GramsPerKiloWattHourTolerance); + AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.FromKilogramsPerJoule(kilogramperjoule.KilogramsPerJoule).KilogramsPerJoule, KilogramsPerJouleTolerance); + AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.FromPoundsPerMechanicalHorsepowerHour(kilogramperjoule.PoundsPerMechanicalHorsepowerHour).KilogramsPerJoule, PoundsPerMechanicalHorsepowerHourTolerance); } [Fact] public void ArithmeticOperators() { - BrakeSpecificFuelConsumption v = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); + BrakeSpecificFuelConsumption v = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); AssertEx.EqualTolerance(-1, -v.KilogramsPerJoule, KilogramsPerJouleTolerance); - AssertEx.EqualTolerance(2, (BrakeSpecificFuelConsumption.FromKilogramsPerJoule(3)-v).KilogramsPerJoule, KilogramsPerJouleTolerance); + AssertEx.EqualTolerance(2, (BrakeSpecificFuelConsumption.FromKilogramsPerJoule(3)-v).KilogramsPerJoule, KilogramsPerJouleTolerance); AssertEx.EqualTolerance(2, (v + v).KilogramsPerJoule, KilogramsPerJouleTolerance); AssertEx.EqualTolerance(10, (v*10).KilogramsPerJoule, KilogramsPerJouleTolerance); AssertEx.EqualTolerance(10, (10*v).KilogramsPerJoule, KilogramsPerJouleTolerance); - AssertEx.EqualTolerance(2, (BrakeSpecificFuelConsumption.FromKilogramsPerJoule(10)/5).KilogramsPerJoule, KilogramsPerJouleTolerance); - AssertEx.EqualTolerance(2, BrakeSpecificFuelConsumption.FromKilogramsPerJoule(10)/BrakeSpecificFuelConsumption.FromKilogramsPerJoule(5), KilogramsPerJouleTolerance); + AssertEx.EqualTolerance(2, (BrakeSpecificFuelConsumption.FromKilogramsPerJoule(10)/5).KilogramsPerJoule, KilogramsPerJouleTolerance); + AssertEx.EqualTolerance(2, BrakeSpecificFuelConsumption.FromKilogramsPerJoule(10)/BrakeSpecificFuelConsumption.FromKilogramsPerJoule(5), KilogramsPerJouleTolerance); } [Fact] public void ComparisonOperators() { - BrakeSpecificFuelConsumption oneKilogramPerJoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - BrakeSpecificFuelConsumption twoKilogramsPerJoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(2); + BrakeSpecificFuelConsumption oneKilogramPerJoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); + BrakeSpecificFuelConsumption twoKilogramsPerJoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(2); Assert.True(oneKilogramPerJoule < twoKilogramsPerJoule); Assert.True(oneKilogramPerJoule <= twoKilogramsPerJoule); @@ -162,31 +162,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); + BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); Assert.Equal(0, kilogramperjoule.CompareTo(kilogramperjoule)); - Assert.True(kilogramperjoule.CompareTo(BrakeSpecificFuelConsumption.Zero) > 0); - Assert.True(BrakeSpecificFuelConsumption.Zero.CompareTo(kilogramperjoule) < 0); + Assert.True(kilogramperjoule.CompareTo(BrakeSpecificFuelConsumption.Zero) > 0); + Assert.True(BrakeSpecificFuelConsumption.Zero.CompareTo(kilogramperjoule) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); + BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); Assert.Throws(() => kilogramperjoule.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); + BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); Assert.Throws(() => kilogramperjoule.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - var b = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(2); + var a = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); + var b = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(2); // ReSharper disable EqualExpressionComparison @@ -205,8 +205,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - var b = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(2); + var a = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); + var b = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -216,29 +216,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - Assert.True(v.Equals(BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1), KilogramsPerJouleTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(BrakeSpecificFuelConsumption.Zero, KilogramsPerJouleTolerance, ComparisonType.Relative)); + var v = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); + Assert.True(v.Equals(BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1), KilogramsPerJouleTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(BrakeSpecificFuelConsumption.Zero, KilogramsPerJouleTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); + BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); Assert.False(kilogramperjoule.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); + BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); Assert.False(kilogramperjoule.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(BrakeSpecificFuelConsumptionUnit.Undefined, BrakeSpecificFuelConsumption.Units); + Assert.DoesNotContain(BrakeSpecificFuelConsumptionUnit.Undefined, BrakeSpecificFuelConsumption.Units); } [Fact] @@ -257,7 +257,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(BrakeSpecificFuelConsumption.BaseDimensions is null); + Assert.False(BrakeSpecificFuelConsumption.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs index 48762353e5..da71fa5223 100644 --- a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs @@ -55,26 +55,26 @@ public abstract partial class CapacitanceTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Capacitance((double)0.0, CapacitanceUnit.Undefined)); + Assert.Throws(() => new Capacitance((double)0.0, CapacitanceUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Capacitance(double.PositiveInfinity, CapacitanceUnit.Farad)); - Assert.Throws(() => new Capacitance(double.NegativeInfinity, CapacitanceUnit.Farad)); + Assert.Throws(() => new Capacitance(double.PositiveInfinity, CapacitanceUnit.Farad)); + Assert.Throws(() => new Capacitance(double.NegativeInfinity, CapacitanceUnit.Farad)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Capacitance(double.NaN, CapacitanceUnit.Farad)); + Assert.Throws(() => new Capacitance(double.NaN, CapacitanceUnit.Farad)); } [Fact] public void FaradToCapacitanceUnits() { - Capacitance farad = Capacitance.FromFarads(1); + Capacitance farad = Capacitance.FromFarads(1); AssertEx.EqualTolerance(FaradsInOneFarad, farad.Farads, FaradsTolerance); AssertEx.EqualTolerance(KilofaradsInOneFarad, farad.Kilofarads, KilofaradsTolerance); AssertEx.EqualTolerance(MegafaradsInOneFarad, farad.Megafarads, MegafaradsTolerance); @@ -87,32 +87,32 @@ public void FaradToCapacitanceUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Farad).Farads, FaradsTolerance); - AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Kilofarad).Kilofarads, KilofaradsTolerance); - AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Megafarad).Megafarads, MegafaradsTolerance); - AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Microfarad).Microfarads, MicrofaradsTolerance); - AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Millifarad).Millifarads, MillifaradsTolerance); - AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Nanofarad).Nanofarads, NanofaradsTolerance); - AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Picofarad).Picofarads, PicofaradsTolerance); + AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Farad).Farads, FaradsTolerance); + AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Kilofarad).Kilofarads, KilofaradsTolerance); + AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Megafarad).Megafarads, MegafaradsTolerance); + AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Microfarad).Microfarads, MicrofaradsTolerance); + AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Millifarad).Millifarads, MillifaradsTolerance); + AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Nanofarad).Nanofarads, NanofaradsTolerance); + AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Picofarad).Picofarads, PicofaradsTolerance); } [Fact] public void FromFarads_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Capacitance.FromFarads(double.PositiveInfinity)); - Assert.Throws(() => Capacitance.FromFarads(double.NegativeInfinity)); + Assert.Throws(() => Capacitance.FromFarads(double.PositiveInfinity)); + Assert.Throws(() => Capacitance.FromFarads(double.NegativeInfinity)); } [Fact] public void FromFarads_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Capacitance.FromFarads(double.NaN)); + Assert.Throws(() => Capacitance.FromFarads(double.NaN)); } [Fact] public void As() { - var farad = Capacitance.FromFarads(1); + var farad = Capacitance.FromFarads(1); AssertEx.EqualTolerance(FaradsInOneFarad, farad.As(CapacitanceUnit.Farad), FaradsTolerance); AssertEx.EqualTolerance(KilofaradsInOneFarad, farad.As(CapacitanceUnit.Kilofarad), KilofaradsTolerance); AssertEx.EqualTolerance(MegafaradsInOneFarad, farad.As(CapacitanceUnit.Megafarad), MegafaradsTolerance); @@ -125,7 +125,7 @@ public void As() [Fact] public void ToUnit() { - var farad = Capacitance.FromFarads(1); + var farad = Capacitance.FromFarads(1); var faradQuantity = farad.ToUnit(CapacitanceUnit.Farad); AssertEx.EqualTolerance(FaradsInOneFarad, (double)faradQuantity.Value, FaradsTolerance); @@ -159,34 +159,34 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Capacitance farad = Capacitance.FromFarads(1); - AssertEx.EqualTolerance(1, Capacitance.FromFarads(farad.Farads).Farads, FaradsTolerance); - AssertEx.EqualTolerance(1, Capacitance.FromKilofarads(farad.Kilofarads).Farads, KilofaradsTolerance); - AssertEx.EqualTolerance(1, Capacitance.FromMegafarads(farad.Megafarads).Farads, MegafaradsTolerance); - AssertEx.EqualTolerance(1, Capacitance.FromMicrofarads(farad.Microfarads).Farads, MicrofaradsTolerance); - AssertEx.EqualTolerance(1, Capacitance.FromMillifarads(farad.Millifarads).Farads, MillifaradsTolerance); - AssertEx.EqualTolerance(1, Capacitance.FromNanofarads(farad.Nanofarads).Farads, NanofaradsTolerance); - AssertEx.EqualTolerance(1, Capacitance.FromPicofarads(farad.Picofarads).Farads, PicofaradsTolerance); + Capacitance farad = Capacitance.FromFarads(1); + AssertEx.EqualTolerance(1, Capacitance.FromFarads(farad.Farads).Farads, FaradsTolerance); + AssertEx.EqualTolerance(1, Capacitance.FromKilofarads(farad.Kilofarads).Farads, KilofaradsTolerance); + AssertEx.EqualTolerance(1, Capacitance.FromMegafarads(farad.Megafarads).Farads, MegafaradsTolerance); + AssertEx.EqualTolerance(1, Capacitance.FromMicrofarads(farad.Microfarads).Farads, MicrofaradsTolerance); + AssertEx.EqualTolerance(1, Capacitance.FromMillifarads(farad.Millifarads).Farads, MillifaradsTolerance); + AssertEx.EqualTolerance(1, Capacitance.FromNanofarads(farad.Nanofarads).Farads, NanofaradsTolerance); + AssertEx.EqualTolerance(1, Capacitance.FromPicofarads(farad.Picofarads).Farads, PicofaradsTolerance); } [Fact] public void ArithmeticOperators() { - Capacitance v = Capacitance.FromFarads(1); + Capacitance v = Capacitance.FromFarads(1); AssertEx.EqualTolerance(-1, -v.Farads, FaradsTolerance); - AssertEx.EqualTolerance(2, (Capacitance.FromFarads(3)-v).Farads, FaradsTolerance); + AssertEx.EqualTolerance(2, (Capacitance.FromFarads(3)-v).Farads, FaradsTolerance); AssertEx.EqualTolerance(2, (v + v).Farads, FaradsTolerance); AssertEx.EqualTolerance(10, (v*10).Farads, FaradsTolerance); AssertEx.EqualTolerance(10, (10*v).Farads, FaradsTolerance); - AssertEx.EqualTolerance(2, (Capacitance.FromFarads(10)/5).Farads, FaradsTolerance); - AssertEx.EqualTolerance(2, Capacitance.FromFarads(10)/Capacitance.FromFarads(5), FaradsTolerance); + AssertEx.EqualTolerance(2, (Capacitance.FromFarads(10)/5).Farads, FaradsTolerance); + AssertEx.EqualTolerance(2, Capacitance.FromFarads(10)/Capacitance.FromFarads(5), FaradsTolerance); } [Fact] public void ComparisonOperators() { - Capacitance oneFarad = Capacitance.FromFarads(1); - Capacitance twoFarads = Capacitance.FromFarads(2); + Capacitance oneFarad = Capacitance.FromFarads(1); + Capacitance twoFarads = Capacitance.FromFarads(2); Assert.True(oneFarad < twoFarads); Assert.True(oneFarad <= twoFarads); @@ -202,31 +202,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Capacitance farad = Capacitance.FromFarads(1); + Capacitance farad = Capacitance.FromFarads(1); Assert.Equal(0, farad.CompareTo(farad)); - Assert.True(farad.CompareTo(Capacitance.Zero) > 0); - Assert.True(Capacitance.Zero.CompareTo(farad) < 0); + Assert.True(farad.CompareTo(Capacitance.Zero) > 0); + Assert.True(Capacitance.Zero.CompareTo(farad) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Capacitance farad = Capacitance.FromFarads(1); + Capacitance farad = Capacitance.FromFarads(1); Assert.Throws(() => farad.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Capacitance farad = Capacitance.FromFarads(1); + Capacitance farad = Capacitance.FromFarads(1); Assert.Throws(() => farad.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Capacitance.FromFarads(1); - var b = Capacitance.FromFarads(2); + var a = Capacitance.FromFarads(1); + var b = Capacitance.FromFarads(2); // ReSharper disable EqualExpressionComparison @@ -245,8 +245,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Capacitance.FromFarads(1); - var b = Capacitance.FromFarads(2); + var a = Capacitance.FromFarads(1); + var b = Capacitance.FromFarads(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -256,29 +256,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Capacitance.FromFarads(1); - Assert.True(v.Equals(Capacitance.FromFarads(1), FaradsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Capacitance.Zero, FaradsTolerance, ComparisonType.Relative)); + var v = Capacitance.FromFarads(1); + Assert.True(v.Equals(Capacitance.FromFarads(1), FaradsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Capacitance.Zero, FaradsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Capacitance farad = Capacitance.FromFarads(1); + Capacitance farad = Capacitance.FromFarads(1); Assert.False(farad.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Capacitance farad = Capacitance.FromFarads(1); + Capacitance farad = Capacitance.FromFarads(1); Assert.False(farad.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(CapacitanceUnit.Undefined, Capacitance.Units); + Assert.DoesNotContain(CapacitanceUnit.Undefined, Capacitance.Units); } [Fact] @@ -297,7 +297,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Capacitance.BaseDimensions is null); + Assert.False(Capacitance.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/CoefficientOfThermalExpansionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/CoefficientOfThermalExpansionTestsBase.g.cs index a643296dd8..ff51c828e2 100644 --- a/UnitsNet.Tests/GeneratedCode/CoefficientOfThermalExpansionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/CoefficientOfThermalExpansionTestsBase.g.cs @@ -47,26 +47,26 @@ public abstract partial class CoefficientOfThermalExpansionTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new CoefficientOfThermalExpansion((double)0.0, CoefficientOfThermalExpansionUnit.Undefined)); + Assert.Throws(() => new CoefficientOfThermalExpansion((double)0.0, CoefficientOfThermalExpansionUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new CoefficientOfThermalExpansion(double.PositiveInfinity, CoefficientOfThermalExpansionUnit.InverseKelvin)); - Assert.Throws(() => new CoefficientOfThermalExpansion(double.NegativeInfinity, CoefficientOfThermalExpansionUnit.InverseKelvin)); + Assert.Throws(() => new CoefficientOfThermalExpansion(double.PositiveInfinity, CoefficientOfThermalExpansionUnit.InverseKelvin)); + Assert.Throws(() => new CoefficientOfThermalExpansion(double.NegativeInfinity, CoefficientOfThermalExpansionUnit.InverseKelvin)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new CoefficientOfThermalExpansion(double.NaN, CoefficientOfThermalExpansionUnit.InverseKelvin)); + Assert.Throws(() => new CoefficientOfThermalExpansion(double.NaN, CoefficientOfThermalExpansionUnit.InverseKelvin)); } [Fact] public void InverseKelvinToCoefficientOfThermalExpansionUnits() { - CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); + CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); AssertEx.EqualTolerance(InverseDegreeCelsiusInOneInverseKelvin, inversekelvin.InverseDegreeCelsius, InverseDegreeCelsiusTolerance); AssertEx.EqualTolerance(InverseDegreeFahrenheitInOneInverseKelvin, inversekelvin.InverseDegreeFahrenheit, InverseDegreeFahrenheitTolerance); AssertEx.EqualTolerance(InverseKelvinInOneInverseKelvin, inversekelvin.InverseKelvin, InverseKelvinTolerance); @@ -75,28 +75,28 @@ public void InverseKelvinToCoefficientOfThermalExpansionUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, CoefficientOfThermalExpansion.From(1, CoefficientOfThermalExpansionUnit.InverseDegreeCelsius).InverseDegreeCelsius, InverseDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, CoefficientOfThermalExpansion.From(1, CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit).InverseDegreeFahrenheit, InverseDegreeFahrenheitTolerance); - AssertEx.EqualTolerance(1, CoefficientOfThermalExpansion.From(1, CoefficientOfThermalExpansionUnit.InverseKelvin).InverseKelvin, InverseKelvinTolerance); + AssertEx.EqualTolerance(1, CoefficientOfThermalExpansion.From(1, CoefficientOfThermalExpansionUnit.InverseDegreeCelsius).InverseDegreeCelsius, InverseDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, CoefficientOfThermalExpansion.From(1, CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit).InverseDegreeFahrenheit, InverseDegreeFahrenheitTolerance); + AssertEx.EqualTolerance(1, CoefficientOfThermalExpansion.From(1, CoefficientOfThermalExpansionUnit.InverseKelvin).InverseKelvin, InverseKelvinTolerance); } [Fact] public void FromInverseKelvin_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => CoefficientOfThermalExpansion.FromInverseKelvin(double.PositiveInfinity)); - Assert.Throws(() => CoefficientOfThermalExpansion.FromInverseKelvin(double.NegativeInfinity)); + Assert.Throws(() => CoefficientOfThermalExpansion.FromInverseKelvin(double.PositiveInfinity)); + Assert.Throws(() => CoefficientOfThermalExpansion.FromInverseKelvin(double.NegativeInfinity)); } [Fact] public void FromInverseKelvin_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => CoefficientOfThermalExpansion.FromInverseKelvin(double.NaN)); + Assert.Throws(() => CoefficientOfThermalExpansion.FromInverseKelvin(double.NaN)); } [Fact] public void As() { - var inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); + var inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); AssertEx.EqualTolerance(InverseDegreeCelsiusInOneInverseKelvin, inversekelvin.As(CoefficientOfThermalExpansionUnit.InverseDegreeCelsius), InverseDegreeCelsiusTolerance); AssertEx.EqualTolerance(InverseDegreeFahrenheitInOneInverseKelvin, inversekelvin.As(CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit), InverseDegreeFahrenheitTolerance); AssertEx.EqualTolerance(InverseKelvinInOneInverseKelvin, inversekelvin.As(CoefficientOfThermalExpansionUnit.InverseKelvin), InverseKelvinTolerance); @@ -105,7 +105,7 @@ public void As() [Fact] public void ToUnit() { - var inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); + var inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); var inversedegreecelsiusQuantity = inversekelvin.ToUnit(CoefficientOfThermalExpansionUnit.InverseDegreeCelsius); AssertEx.EqualTolerance(InverseDegreeCelsiusInOneInverseKelvin, (double)inversedegreecelsiusQuantity.Value, InverseDegreeCelsiusTolerance); @@ -123,30 +123,30 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); - AssertEx.EqualTolerance(1, CoefficientOfThermalExpansion.FromInverseDegreeCelsius(inversekelvin.InverseDegreeCelsius).InverseKelvin, InverseDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, CoefficientOfThermalExpansion.FromInverseDegreeFahrenheit(inversekelvin.InverseDegreeFahrenheit).InverseKelvin, InverseDegreeFahrenheitTolerance); - AssertEx.EqualTolerance(1, CoefficientOfThermalExpansion.FromInverseKelvin(inversekelvin.InverseKelvin).InverseKelvin, InverseKelvinTolerance); + CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); + AssertEx.EqualTolerance(1, CoefficientOfThermalExpansion.FromInverseDegreeCelsius(inversekelvin.InverseDegreeCelsius).InverseKelvin, InverseDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, CoefficientOfThermalExpansion.FromInverseDegreeFahrenheit(inversekelvin.InverseDegreeFahrenheit).InverseKelvin, InverseDegreeFahrenheitTolerance); + AssertEx.EqualTolerance(1, CoefficientOfThermalExpansion.FromInverseKelvin(inversekelvin.InverseKelvin).InverseKelvin, InverseKelvinTolerance); } [Fact] public void ArithmeticOperators() { - CoefficientOfThermalExpansion v = CoefficientOfThermalExpansion.FromInverseKelvin(1); + CoefficientOfThermalExpansion v = CoefficientOfThermalExpansion.FromInverseKelvin(1); AssertEx.EqualTolerance(-1, -v.InverseKelvin, InverseKelvinTolerance); - AssertEx.EqualTolerance(2, (CoefficientOfThermalExpansion.FromInverseKelvin(3)-v).InverseKelvin, InverseKelvinTolerance); + AssertEx.EqualTolerance(2, (CoefficientOfThermalExpansion.FromInverseKelvin(3)-v).InverseKelvin, InverseKelvinTolerance); AssertEx.EqualTolerance(2, (v + v).InverseKelvin, InverseKelvinTolerance); AssertEx.EqualTolerance(10, (v*10).InverseKelvin, InverseKelvinTolerance); AssertEx.EqualTolerance(10, (10*v).InverseKelvin, InverseKelvinTolerance); - AssertEx.EqualTolerance(2, (CoefficientOfThermalExpansion.FromInverseKelvin(10)/5).InverseKelvin, InverseKelvinTolerance); - AssertEx.EqualTolerance(2, CoefficientOfThermalExpansion.FromInverseKelvin(10)/CoefficientOfThermalExpansion.FromInverseKelvin(5), InverseKelvinTolerance); + AssertEx.EqualTolerance(2, (CoefficientOfThermalExpansion.FromInverseKelvin(10)/5).InverseKelvin, InverseKelvinTolerance); + AssertEx.EqualTolerance(2, CoefficientOfThermalExpansion.FromInverseKelvin(10)/CoefficientOfThermalExpansion.FromInverseKelvin(5), InverseKelvinTolerance); } [Fact] public void ComparisonOperators() { - CoefficientOfThermalExpansion oneInverseKelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); - CoefficientOfThermalExpansion twoInverseKelvin = CoefficientOfThermalExpansion.FromInverseKelvin(2); + CoefficientOfThermalExpansion oneInverseKelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); + CoefficientOfThermalExpansion twoInverseKelvin = CoefficientOfThermalExpansion.FromInverseKelvin(2); Assert.True(oneInverseKelvin < twoInverseKelvin); Assert.True(oneInverseKelvin <= twoInverseKelvin); @@ -162,31 +162,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); + CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); Assert.Equal(0, inversekelvin.CompareTo(inversekelvin)); - Assert.True(inversekelvin.CompareTo(CoefficientOfThermalExpansion.Zero) > 0); - Assert.True(CoefficientOfThermalExpansion.Zero.CompareTo(inversekelvin) < 0); + Assert.True(inversekelvin.CompareTo(CoefficientOfThermalExpansion.Zero) > 0); + Assert.True(CoefficientOfThermalExpansion.Zero.CompareTo(inversekelvin) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); + CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); Assert.Throws(() => inversekelvin.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); + CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); Assert.Throws(() => inversekelvin.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = CoefficientOfThermalExpansion.FromInverseKelvin(1); - var b = CoefficientOfThermalExpansion.FromInverseKelvin(2); + var a = CoefficientOfThermalExpansion.FromInverseKelvin(1); + var b = CoefficientOfThermalExpansion.FromInverseKelvin(2); // ReSharper disable EqualExpressionComparison @@ -205,8 +205,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = CoefficientOfThermalExpansion.FromInverseKelvin(1); - var b = CoefficientOfThermalExpansion.FromInverseKelvin(2); + var a = CoefficientOfThermalExpansion.FromInverseKelvin(1); + var b = CoefficientOfThermalExpansion.FromInverseKelvin(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -216,29 +216,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = CoefficientOfThermalExpansion.FromInverseKelvin(1); - Assert.True(v.Equals(CoefficientOfThermalExpansion.FromInverseKelvin(1), InverseKelvinTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(CoefficientOfThermalExpansion.Zero, InverseKelvinTolerance, ComparisonType.Relative)); + var v = CoefficientOfThermalExpansion.FromInverseKelvin(1); + Assert.True(v.Equals(CoefficientOfThermalExpansion.FromInverseKelvin(1), InverseKelvinTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(CoefficientOfThermalExpansion.Zero, InverseKelvinTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); + CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); Assert.False(inversekelvin.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); + CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); Assert.False(inversekelvin.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(CoefficientOfThermalExpansionUnit.Undefined, CoefficientOfThermalExpansion.Units); + Assert.DoesNotContain(CoefficientOfThermalExpansionUnit.Undefined, CoefficientOfThermalExpansion.Units); } [Fact] @@ -257,7 +257,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(CoefficientOfThermalExpansion.BaseDimensions is null); + Assert.False(CoefficientOfThermalExpansion.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs index 721422b912..5f8209ba2f 100644 --- a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Density. + /// Test of Density. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class DensityTestsBase @@ -121,26 +121,26 @@ public abstract partial class DensityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Density((double)0.0, DensityUnit.Undefined)); + Assert.Throws(() => new Density((double)0.0, DensityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Density(double.PositiveInfinity, DensityUnit.KilogramPerCubicMeter)); - Assert.Throws(() => new Density(double.NegativeInfinity, DensityUnit.KilogramPerCubicMeter)); + Assert.Throws(() => new Density(double.PositiveInfinity, DensityUnit.KilogramPerCubicMeter)); + Assert.Throws(() => new Density(double.NegativeInfinity, DensityUnit.KilogramPerCubicMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Density(double.NaN, DensityUnit.KilogramPerCubicMeter)); + Assert.Throws(() => new Density(double.NaN, DensityUnit.KilogramPerCubicMeter)); } [Fact] public void KilogramPerCubicMeterToDensityUnits() { - Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); + Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); AssertEx.EqualTolerance(CentigramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.CentigramsPerDeciLiter, CentigramsPerDeciLiterTolerance); AssertEx.EqualTolerance(CentigramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.CentigramsPerLiter, CentigramsPerLiterTolerance); AssertEx.EqualTolerance(CentigramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.CentigramsPerMilliliter, CentigramsPerMilliliterTolerance); @@ -186,65 +186,65 @@ public void KilogramPerCubicMeterToDensityUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.CentigramPerDeciliter).CentigramsPerDeciLiter, CentigramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.CentigramPerLiter).CentigramsPerLiter, CentigramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.CentigramPerMilliliter).CentigramsPerMilliliter, CentigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.DecigramPerDeciliter).DecigramsPerDeciLiter, DecigramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.DecigramPerLiter).DecigramsPerLiter, DecigramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.DecigramPerMilliliter).DecigramsPerMilliliter, DecigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerCubicCentimeter).GramsPerCubicCentimeter, GramsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerCubicMeter).GramsPerCubicMeter, GramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerCubicMillimeter).GramsPerCubicMillimeter, GramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerDeciliter).GramsPerDeciLiter, GramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerLiter).GramsPerLiter, GramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerMilliliter).GramsPerMilliliter, GramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilogramPerCubicCentimeter).KilogramsPerCubicCentimeter, KilogramsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilogramPerCubicMeter).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilogramPerCubicMillimeter).KilogramsPerCubicMillimeter, KilogramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilogramPerLiter).KilogramsPerLiter, KilogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilopoundPerCubicFoot).KilopoundsPerCubicFoot, KilopoundsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilopoundPerCubicInch).KilopoundsPerCubicInch, KilopoundsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MicrogramPerCubicMeter).MicrogramsPerCubicMeter, MicrogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MicrogramPerDeciliter).MicrogramsPerDeciLiter, MicrogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MicrogramPerLiter).MicrogramsPerLiter, MicrogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MicrogramPerMilliliter).MicrogramsPerMilliliter, MicrogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MilligramPerCubicMeter).MilligramsPerCubicMeter, MilligramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MilligramPerDeciliter).MilligramsPerDeciLiter, MilligramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MilligramPerLiter).MilligramsPerLiter, MilligramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MilligramPerMilliliter).MilligramsPerMilliliter, MilligramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.NanogramPerDeciliter).NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.NanogramPerLiter).NanogramsPerLiter, NanogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.NanogramPerMilliliter).NanogramsPerMilliliter, NanogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PicogramPerDeciliter).PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PicogramPerLiter).PicogramsPerLiter, PicogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PicogramPerMilliliter).PicogramsPerMilliliter, PicogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PoundPerCubicFoot).PoundsPerCubicFoot, PoundsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PoundPerCubicInch).PoundsPerCubicInch, PoundsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PoundPerImperialGallon).PoundsPerImperialGallon, PoundsPerImperialGallonTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PoundPerUSGallon).PoundsPerUSGallon, PoundsPerUSGallonTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.SlugPerCubicFoot).SlugsPerCubicFoot, SlugsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.TonnePerCubicCentimeter).TonnesPerCubicCentimeter, TonnesPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.TonnePerCubicMeter).TonnesPerCubicMeter, TonnesPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.TonnePerCubicMillimeter).TonnesPerCubicMillimeter, TonnesPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.CentigramPerDeciliter).CentigramsPerDeciLiter, CentigramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.CentigramPerLiter).CentigramsPerLiter, CentigramsPerLiterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.CentigramPerMilliliter).CentigramsPerMilliliter, CentigramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.DecigramPerDeciliter).DecigramsPerDeciLiter, DecigramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.DecigramPerLiter).DecigramsPerLiter, DecigramsPerLiterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.DecigramPerMilliliter).DecigramsPerMilliliter, DecigramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerCubicCentimeter).GramsPerCubicCentimeter, GramsPerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerCubicMeter).GramsPerCubicMeter, GramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerCubicMillimeter).GramsPerCubicMillimeter, GramsPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerDeciliter).GramsPerDeciLiter, GramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerLiter).GramsPerLiter, GramsPerLiterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerMilliliter).GramsPerMilliliter, GramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilogramPerCubicCentimeter).KilogramsPerCubicCentimeter, KilogramsPerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilogramPerCubicMeter).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilogramPerCubicMillimeter).KilogramsPerCubicMillimeter, KilogramsPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilogramPerLiter).KilogramsPerLiter, KilogramsPerLiterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilopoundPerCubicFoot).KilopoundsPerCubicFoot, KilopoundsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilopoundPerCubicInch).KilopoundsPerCubicInch, KilopoundsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MicrogramPerCubicMeter).MicrogramsPerCubicMeter, MicrogramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MicrogramPerDeciliter).MicrogramsPerDeciLiter, MicrogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MicrogramPerLiter).MicrogramsPerLiter, MicrogramsPerLiterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MicrogramPerMilliliter).MicrogramsPerMilliliter, MicrogramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MilligramPerCubicMeter).MilligramsPerCubicMeter, MilligramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MilligramPerDeciliter).MilligramsPerDeciLiter, MilligramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MilligramPerLiter).MilligramsPerLiter, MilligramsPerLiterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MilligramPerMilliliter).MilligramsPerMilliliter, MilligramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.NanogramPerDeciliter).NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.NanogramPerLiter).NanogramsPerLiter, NanogramsPerLiterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.NanogramPerMilliliter).NanogramsPerMilliliter, NanogramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PicogramPerDeciliter).PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PicogramPerLiter).PicogramsPerLiter, PicogramsPerLiterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PicogramPerMilliliter).PicogramsPerMilliliter, PicogramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PoundPerCubicFoot).PoundsPerCubicFoot, PoundsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PoundPerCubicInch).PoundsPerCubicInch, PoundsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PoundPerImperialGallon).PoundsPerImperialGallon, PoundsPerImperialGallonTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PoundPerUSGallon).PoundsPerUSGallon, PoundsPerUSGallonTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.SlugPerCubicFoot).SlugsPerCubicFoot, SlugsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.TonnePerCubicCentimeter).TonnesPerCubicCentimeter, TonnesPerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.TonnePerCubicMeter).TonnesPerCubicMeter, TonnesPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.TonnePerCubicMillimeter).TonnesPerCubicMillimeter, TonnesPerCubicMillimeterTolerance); } [Fact] public void FromKilogramsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.NegativeInfinity)); + Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.PositiveInfinity)); + Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.NegativeInfinity)); } [Fact] public void FromKilogramsPerCubicMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.NaN)); + Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.NaN)); } [Fact] public void As() { - var kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); + var kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); AssertEx.EqualTolerance(CentigramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.CentigramPerDeciliter), CentigramsPerDeciLiterTolerance); AssertEx.EqualTolerance(CentigramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.CentigramPerLiter), CentigramsPerLiterTolerance); AssertEx.EqualTolerance(CentigramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.CentigramPerMilliliter), CentigramsPerMilliliterTolerance); @@ -290,7 +290,7 @@ public void As() [Fact] public void ToUnit() { - var kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); + var kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); var centigramperdeciliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.CentigramPerDeciliter); AssertEx.EqualTolerance(CentigramsPerDeciLiterInOneKilogramPerCubicMeter, (double)centigramperdeciliterQuantity.Value, CentigramsPerDeciLiterTolerance); @@ -456,67 +456,67 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); - AssertEx.EqualTolerance(1, Density.FromCentigramsPerDeciLiter(kilogrampercubicmeter.CentigramsPerDeciLiter).KilogramsPerCubicMeter, CentigramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromCentigramsPerLiter(kilogrampercubicmeter.CentigramsPerLiter).KilogramsPerCubicMeter, CentigramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromCentigramsPerMilliliter(kilogrampercubicmeter.CentigramsPerMilliliter).KilogramsPerCubicMeter, CentigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromDecigramsPerDeciLiter(kilogrampercubicmeter.DecigramsPerDeciLiter).KilogramsPerCubicMeter, DecigramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromDecigramsPerLiter(kilogrampercubicmeter.DecigramsPerLiter).KilogramsPerCubicMeter, DecigramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromDecigramsPerMilliliter(kilogrampercubicmeter.DecigramsPerMilliliter).KilogramsPerCubicMeter, DecigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromGramsPerCubicCentimeter(kilogrampercubicmeter.GramsPerCubicCentimeter).KilogramsPerCubicMeter, GramsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, Density.FromGramsPerCubicMeter(kilogrampercubicmeter.GramsPerCubicMeter).KilogramsPerCubicMeter, GramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.FromGramsPerCubicMillimeter(kilogrampercubicmeter.GramsPerCubicMillimeter).KilogramsPerCubicMeter, GramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, Density.FromGramsPerDeciLiter(kilogrampercubicmeter.GramsPerDeciLiter).KilogramsPerCubicMeter, GramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromGramsPerLiter(kilogrampercubicmeter.GramsPerLiter).KilogramsPerCubicMeter, GramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromGramsPerMilliliter(kilogrampercubicmeter.GramsPerMilliliter).KilogramsPerCubicMeter, GramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromKilogramsPerCubicCentimeter(kilogrampercubicmeter.KilogramsPerCubicCentimeter).KilogramsPerCubicMeter, KilogramsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, Density.FromKilogramsPerCubicMeter(kilogrampercubicmeter.KilogramsPerCubicMeter).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.FromKilogramsPerCubicMillimeter(kilogrampercubicmeter.KilogramsPerCubicMillimeter).KilogramsPerCubicMeter, KilogramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, Density.FromKilogramsPerLiter(kilogrampercubicmeter.KilogramsPerLiter).KilogramsPerCubicMeter, KilogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromKilopoundsPerCubicFoot(kilogrampercubicmeter.KilopoundsPerCubicFoot).KilogramsPerCubicMeter, KilopoundsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, Density.FromKilopoundsPerCubicInch(kilogrampercubicmeter.KilopoundsPerCubicInch).KilogramsPerCubicMeter, KilopoundsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, Density.FromMicrogramsPerCubicMeter(kilogrampercubicmeter.MicrogramsPerCubicMeter).KilogramsPerCubicMeter, MicrogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.FromMicrogramsPerDeciLiter(kilogrampercubicmeter.MicrogramsPerDeciLiter).KilogramsPerCubicMeter, MicrogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromMicrogramsPerLiter(kilogrampercubicmeter.MicrogramsPerLiter).KilogramsPerCubicMeter, MicrogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromMicrogramsPerMilliliter(kilogrampercubicmeter.MicrogramsPerMilliliter).KilogramsPerCubicMeter, MicrogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromMilligramsPerCubicMeter(kilogrampercubicmeter.MilligramsPerCubicMeter).KilogramsPerCubicMeter, MilligramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.FromMilligramsPerDeciLiter(kilogrampercubicmeter.MilligramsPerDeciLiter).KilogramsPerCubicMeter, MilligramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromMilligramsPerLiter(kilogrampercubicmeter.MilligramsPerLiter).KilogramsPerCubicMeter, MilligramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromMilligramsPerMilliliter(kilogrampercubicmeter.MilligramsPerMilliliter).KilogramsPerCubicMeter, MilligramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromNanogramsPerDeciLiter(kilogrampercubicmeter.NanogramsPerDeciLiter).KilogramsPerCubicMeter, NanogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromNanogramsPerLiter(kilogrampercubicmeter.NanogramsPerLiter).KilogramsPerCubicMeter, NanogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromNanogramsPerMilliliter(kilogrampercubicmeter.NanogramsPerMilliliter).KilogramsPerCubicMeter, NanogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromPicogramsPerDeciLiter(kilogrampercubicmeter.PicogramsPerDeciLiter).KilogramsPerCubicMeter, PicogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromPicogramsPerLiter(kilogrampercubicmeter.PicogramsPerLiter).KilogramsPerCubicMeter, PicogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromPicogramsPerMilliliter(kilogrampercubicmeter.PicogramsPerMilliliter).KilogramsPerCubicMeter, PicogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromPoundsPerCubicFoot(kilogrampercubicmeter.PoundsPerCubicFoot).KilogramsPerCubicMeter, PoundsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, Density.FromPoundsPerCubicInch(kilogrampercubicmeter.PoundsPerCubicInch).KilogramsPerCubicMeter, PoundsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, Density.FromPoundsPerImperialGallon(kilogrampercubicmeter.PoundsPerImperialGallon).KilogramsPerCubicMeter, PoundsPerImperialGallonTolerance); - AssertEx.EqualTolerance(1, Density.FromPoundsPerUSGallon(kilogrampercubicmeter.PoundsPerUSGallon).KilogramsPerCubicMeter, PoundsPerUSGallonTolerance); - AssertEx.EqualTolerance(1, Density.FromSlugsPerCubicFoot(kilogrampercubicmeter.SlugsPerCubicFoot).KilogramsPerCubicMeter, SlugsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, Density.FromTonnesPerCubicCentimeter(kilogrampercubicmeter.TonnesPerCubicCentimeter).KilogramsPerCubicMeter, TonnesPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, Density.FromTonnesPerCubicMeter(kilogrampercubicmeter.TonnesPerCubicMeter).KilogramsPerCubicMeter, TonnesPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.FromTonnesPerCubicMillimeter(kilogrampercubicmeter.TonnesPerCubicMillimeter).KilogramsPerCubicMeter, TonnesPerCubicMillimeterTolerance); + Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); + AssertEx.EqualTolerance(1, Density.FromCentigramsPerDeciLiter(kilogrampercubicmeter.CentigramsPerDeciLiter).KilogramsPerCubicMeter, CentigramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromCentigramsPerLiter(kilogrampercubicmeter.CentigramsPerLiter).KilogramsPerCubicMeter, CentigramsPerLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromCentigramsPerMilliliter(kilogrampercubicmeter.CentigramsPerMilliliter).KilogramsPerCubicMeter, CentigramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, Density.FromDecigramsPerDeciLiter(kilogrampercubicmeter.DecigramsPerDeciLiter).KilogramsPerCubicMeter, DecigramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromDecigramsPerLiter(kilogrampercubicmeter.DecigramsPerLiter).KilogramsPerCubicMeter, DecigramsPerLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromDecigramsPerMilliliter(kilogrampercubicmeter.DecigramsPerMilliliter).KilogramsPerCubicMeter, DecigramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, Density.FromGramsPerCubicCentimeter(kilogrampercubicmeter.GramsPerCubicCentimeter).KilogramsPerCubicMeter, GramsPerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, Density.FromGramsPerCubicMeter(kilogrampercubicmeter.GramsPerCubicMeter).KilogramsPerCubicMeter, GramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, Density.FromGramsPerCubicMillimeter(kilogrampercubicmeter.GramsPerCubicMillimeter).KilogramsPerCubicMeter, GramsPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, Density.FromGramsPerDeciLiter(kilogrampercubicmeter.GramsPerDeciLiter).KilogramsPerCubicMeter, GramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromGramsPerLiter(kilogrampercubicmeter.GramsPerLiter).KilogramsPerCubicMeter, GramsPerLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromGramsPerMilliliter(kilogrampercubicmeter.GramsPerMilliliter).KilogramsPerCubicMeter, GramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, Density.FromKilogramsPerCubicCentimeter(kilogrampercubicmeter.KilogramsPerCubicCentimeter).KilogramsPerCubicMeter, KilogramsPerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, Density.FromKilogramsPerCubicMeter(kilogrampercubicmeter.KilogramsPerCubicMeter).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, Density.FromKilogramsPerCubicMillimeter(kilogrampercubicmeter.KilogramsPerCubicMillimeter).KilogramsPerCubicMeter, KilogramsPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, Density.FromKilogramsPerLiter(kilogrampercubicmeter.KilogramsPerLiter).KilogramsPerCubicMeter, KilogramsPerLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromKilopoundsPerCubicFoot(kilogrampercubicmeter.KilopoundsPerCubicFoot).KilogramsPerCubicMeter, KilopoundsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, Density.FromKilopoundsPerCubicInch(kilogrampercubicmeter.KilopoundsPerCubicInch).KilogramsPerCubicMeter, KilopoundsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, Density.FromMicrogramsPerCubicMeter(kilogrampercubicmeter.MicrogramsPerCubicMeter).KilogramsPerCubicMeter, MicrogramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, Density.FromMicrogramsPerDeciLiter(kilogrampercubicmeter.MicrogramsPerDeciLiter).KilogramsPerCubicMeter, MicrogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromMicrogramsPerLiter(kilogrampercubicmeter.MicrogramsPerLiter).KilogramsPerCubicMeter, MicrogramsPerLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromMicrogramsPerMilliliter(kilogrampercubicmeter.MicrogramsPerMilliliter).KilogramsPerCubicMeter, MicrogramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, Density.FromMilligramsPerCubicMeter(kilogrampercubicmeter.MilligramsPerCubicMeter).KilogramsPerCubicMeter, MilligramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, Density.FromMilligramsPerDeciLiter(kilogrampercubicmeter.MilligramsPerDeciLiter).KilogramsPerCubicMeter, MilligramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromMilligramsPerLiter(kilogrampercubicmeter.MilligramsPerLiter).KilogramsPerCubicMeter, MilligramsPerLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromMilligramsPerMilliliter(kilogrampercubicmeter.MilligramsPerMilliliter).KilogramsPerCubicMeter, MilligramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, Density.FromNanogramsPerDeciLiter(kilogrampercubicmeter.NanogramsPerDeciLiter).KilogramsPerCubicMeter, NanogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromNanogramsPerLiter(kilogrampercubicmeter.NanogramsPerLiter).KilogramsPerCubicMeter, NanogramsPerLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromNanogramsPerMilliliter(kilogrampercubicmeter.NanogramsPerMilliliter).KilogramsPerCubicMeter, NanogramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, Density.FromPicogramsPerDeciLiter(kilogrampercubicmeter.PicogramsPerDeciLiter).KilogramsPerCubicMeter, PicogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromPicogramsPerLiter(kilogrampercubicmeter.PicogramsPerLiter).KilogramsPerCubicMeter, PicogramsPerLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromPicogramsPerMilliliter(kilogrampercubicmeter.PicogramsPerMilliliter).KilogramsPerCubicMeter, PicogramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, Density.FromPoundsPerCubicFoot(kilogrampercubicmeter.PoundsPerCubicFoot).KilogramsPerCubicMeter, PoundsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, Density.FromPoundsPerCubicInch(kilogrampercubicmeter.PoundsPerCubicInch).KilogramsPerCubicMeter, PoundsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, Density.FromPoundsPerImperialGallon(kilogrampercubicmeter.PoundsPerImperialGallon).KilogramsPerCubicMeter, PoundsPerImperialGallonTolerance); + AssertEx.EqualTolerance(1, Density.FromPoundsPerUSGallon(kilogrampercubicmeter.PoundsPerUSGallon).KilogramsPerCubicMeter, PoundsPerUSGallonTolerance); + AssertEx.EqualTolerance(1, Density.FromSlugsPerCubicFoot(kilogrampercubicmeter.SlugsPerCubicFoot).KilogramsPerCubicMeter, SlugsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, Density.FromTonnesPerCubicCentimeter(kilogrampercubicmeter.TonnesPerCubicCentimeter).KilogramsPerCubicMeter, TonnesPerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, Density.FromTonnesPerCubicMeter(kilogrampercubicmeter.TonnesPerCubicMeter).KilogramsPerCubicMeter, TonnesPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, Density.FromTonnesPerCubicMillimeter(kilogrampercubicmeter.TonnesPerCubicMillimeter).KilogramsPerCubicMeter, TonnesPerCubicMillimeterTolerance); } [Fact] public void ArithmeticOperators() { - Density v = Density.FromKilogramsPerCubicMeter(1); + Density v = Density.FromKilogramsPerCubicMeter(1); AssertEx.EqualTolerance(-1, -v.KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (Density.FromKilogramsPerCubicMeter(3)-v).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, (Density.FromKilogramsPerCubicMeter(3)-v).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); AssertEx.EqualTolerance(2, (v + v).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); AssertEx.EqualTolerance(10, (v*10).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); AssertEx.EqualTolerance(10, (10*v).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (Density.FromKilogramsPerCubicMeter(10)/5).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, Density.FromKilogramsPerCubicMeter(10)/Density.FromKilogramsPerCubicMeter(5), KilogramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, (Density.FromKilogramsPerCubicMeter(10)/5).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, Density.FromKilogramsPerCubicMeter(10)/Density.FromKilogramsPerCubicMeter(5), KilogramsPerCubicMeterTolerance); } [Fact] public void ComparisonOperators() { - Density oneKilogramPerCubicMeter = Density.FromKilogramsPerCubicMeter(1); - Density twoKilogramsPerCubicMeter = Density.FromKilogramsPerCubicMeter(2); + Density oneKilogramPerCubicMeter = Density.FromKilogramsPerCubicMeter(1); + Density twoKilogramsPerCubicMeter = Density.FromKilogramsPerCubicMeter(2); Assert.True(oneKilogramPerCubicMeter < twoKilogramsPerCubicMeter); Assert.True(oneKilogramPerCubicMeter <= twoKilogramsPerCubicMeter); @@ -532,31 +532,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); + Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); Assert.Equal(0, kilogrampercubicmeter.CompareTo(kilogrampercubicmeter)); - Assert.True(kilogrampercubicmeter.CompareTo(Density.Zero) > 0); - Assert.True(Density.Zero.CompareTo(kilogrampercubicmeter) < 0); + Assert.True(kilogrampercubicmeter.CompareTo(Density.Zero) > 0); + Assert.True(Density.Zero.CompareTo(kilogrampercubicmeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); + Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); Assert.Throws(() => kilogrampercubicmeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); + Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); Assert.Throws(() => kilogrampercubicmeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Density.FromKilogramsPerCubicMeter(1); - var b = Density.FromKilogramsPerCubicMeter(2); + var a = Density.FromKilogramsPerCubicMeter(1); + var b = Density.FromKilogramsPerCubicMeter(2); // ReSharper disable EqualExpressionComparison @@ -575,8 +575,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Density.FromKilogramsPerCubicMeter(1); - var b = Density.FromKilogramsPerCubicMeter(2); + var a = Density.FromKilogramsPerCubicMeter(1); + var b = Density.FromKilogramsPerCubicMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -586,29 +586,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Density.FromKilogramsPerCubicMeter(1); - Assert.True(v.Equals(Density.FromKilogramsPerCubicMeter(1), KilogramsPerCubicMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Density.Zero, KilogramsPerCubicMeterTolerance, ComparisonType.Relative)); + var v = Density.FromKilogramsPerCubicMeter(1); + Assert.True(v.Equals(Density.FromKilogramsPerCubicMeter(1), KilogramsPerCubicMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Density.Zero, KilogramsPerCubicMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); + Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); Assert.False(kilogrampercubicmeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); + Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); Assert.False(kilogrampercubicmeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(DensityUnit.Undefined, Density.Units); + Assert.DoesNotContain(DensityUnit.Undefined, Density.Units); } [Fact] @@ -627,7 +627,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Density.BaseDimensions is null); + Assert.False(Density.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs index 5f1aa7f428..08e111ca92 100644 --- a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs @@ -61,26 +61,26 @@ public abstract partial class DurationTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Duration((double)0.0, DurationUnit.Undefined)); + Assert.Throws(() => new Duration((double)0.0, DurationUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Duration(double.PositiveInfinity, DurationUnit.Second)); - Assert.Throws(() => new Duration(double.NegativeInfinity, DurationUnit.Second)); + Assert.Throws(() => new Duration(double.PositiveInfinity, DurationUnit.Second)); + Assert.Throws(() => new Duration(double.NegativeInfinity, DurationUnit.Second)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Duration(double.NaN, DurationUnit.Second)); + Assert.Throws(() => new Duration(double.NaN, DurationUnit.Second)); } [Fact] public void SecondToDurationUnits() { - Duration second = Duration.FromSeconds(1); + Duration second = Duration.FromSeconds(1); AssertEx.EqualTolerance(DaysInOneSecond, second.Days, DaysTolerance); AssertEx.EqualTolerance(HoursInOneSecond, second.Hours, HoursTolerance); AssertEx.EqualTolerance(MicrosecondsInOneSecond, second.Microseconds, MicrosecondsTolerance); @@ -96,35 +96,35 @@ public void SecondToDurationUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Day).Days, DaysTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Hour).Hours, HoursTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Microsecond).Microseconds, MicrosecondsTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Millisecond).Milliseconds, MillisecondsTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Minute).Minutes, MinutesTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Month30).Months30, Months30Tolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Nanosecond).Nanoseconds, NanosecondsTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Second).Seconds, SecondsTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Week).Weeks, WeeksTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Year365).Years365, Years365Tolerance); + AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Day).Days, DaysTolerance); + AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Hour).Hours, HoursTolerance); + AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Microsecond).Microseconds, MicrosecondsTolerance); + AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Millisecond).Milliseconds, MillisecondsTolerance); + AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Minute).Minutes, MinutesTolerance); + AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Month30).Months30, Months30Tolerance); + AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Nanosecond).Nanoseconds, NanosecondsTolerance); + AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Second).Seconds, SecondsTolerance); + AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Week).Weeks, WeeksTolerance); + AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Year365).Years365, Years365Tolerance); } [Fact] public void FromSeconds_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Duration.FromSeconds(double.PositiveInfinity)); - Assert.Throws(() => Duration.FromSeconds(double.NegativeInfinity)); + Assert.Throws(() => Duration.FromSeconds(double.PositiveInfinity)); + Assert.Throws(() => Duration.FromSeconds(double.NegativeInfinity)); } [Fact] public void FromSeconds_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Duration.FromSeconds(double.NaN)); + Assert.Throws(() => Duration.FromSeconds(double.NaN)); } [Fact] public void As() { - var second = Duration.FromSeconds(1); + var second = Duration.FromSeconds(1); AssertEx.EqualTolerance(DaysInOneSecond, second.As(DurationUnit.Day), DaysTolerance); AssertEx.EqualTolerance(HoursInOneSecond, second.As(DurationUnit.Hour), HoursTolerance); AssertEx.EqualTolerance(MicrosecondsInOneSecond, second.As(DurationUnit.Microsecond), MicrosecondsTolerance); @@ -140,7 +140,7 @@ public void As() [Fact] public void ToUnit() { - var second = Duration.FromSeconds(1); + var second = Duration.FromSeconds(1); var dayQuantity = second.ToUnit(DurationUnit.Day); AssertEx.EqualTolerance(DaysInOneSecond, (double)dayQuantity.Value, DaysTolerance); @@ -186,37 +186,37 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Duration second = Duration.FromSeconds(1); - AssertEx.EqualTolerance(1, Duration.FromDays(second.Days).Seconds, DaysTolerance); - AssertEx.EqualTolerance(1, Duration.FromHours(second.Hours).Seconds, HoursTolerance); - AssertEx.EqualTolerance(1, Duration.FromMicroseconds(second.Microseconds).Seconds, MicrosecondsTolerance); - AssertEx.EqualTolerance(1, Duration.FromMilliseconds(second.Milliseconds).Seconds, MillisecondsTolerance); - AssertEx.EqualTolerance(1, Duration.FromMinutes(second.Minutes).Seconds, MinutesTolerance); - AssertEx.EqualTolerance(1, Duration.FromMonths30(second.Months30).Seconds, Months30Tolerance); - AssertEx.EqualTolerance(1, Duration.FromNanoseconds(second.Nanoseconds).Seconds, NanosecondsTolerance); - AssertEx.EqualTolerance(1, Duration.FromSeconds(second.Seconds).Seconds, SecondsTolerance); - AssertEx.EqualTolerance(1, Duration.FromWeeks(second.Weeks).Seconds, WeeksTolerance); - AssertEx.EqualTolerance(1, Duration.FromYears365(second.Years365).Seconds, Years365Tolerance); + Duration second = Duration.FromSeconds(1); + AssertEx.EqualTolerance(1, Duration.FromDays(second.Days).Seconds, DaysTolerance); + AssertEx.EqualTolerance(1, Duration.FromHours(second.Hours).Seconds, HoursTolerance); + AssertEx.EqualTolerance(1, Duration.FromMicroseconds(second.Microseconds).Seconds, MicrosecondsTolerance); + AssertEx.EqualTolerance(1, Duration.FromMilliseconds(second.Milliseconds).Seconds, MillisecondsTolerance); + AssertEx.EqualTolerance(1, Duration.FromMinutes(second.Minutes).Seconds, MinutesTolerance); + AssertEx.EqualTolerance(1, Duration.FromMonths30(second.Months30).Seconds, Months30Tolerance); + AssertEx.EqualTolerance(1, Duration.FromNanoseconds(second.Nanoseconds).Seconds, NanosecondsTolerance); + AssertEx.EqualTolerance(1, Duration.FromSeconds(second.Seconds).Seconds, SecondsTolerance); + AssertEx.EqualTolerance(1, Duration.FromWeeks(second.Weeks).Seconds, WeeksTolerance); + AssertEx.EqualTolerance(1, Duration.FromYears365(second.Years365).Seconds, Years365Tolerance); } [Fact] public void ArithmeticOperators() { - Duration v = Duration.FromSeconds(1); + Duration v = Duration.FromSeconds(1); AssertEx.EqualTolerance(-1, -v.Seconds, SecondsTolerance); - AssertEx.EqualTolerance(2, (Duration.FromSeconds(3)-v).Seconds, SecondsTolerance); + AssertEx.EqualTolerance(2, (Duration.FromSeconds(3)-v).Seconds, SecondsTolerance); AssertEx.EqualTolerance(2, (v + v).Seconds, SecondsTolerance); AssertEx.EqualTolerance(10, (v*10).Seconds, SecondsTolerance); AssertEx.EqualTolerance(10, (10*v).Seconds, SecondsTolerance); - AssertEx.EqualTolerance(2, (Duration.FromSeconds(10)/5).Seconds, SecondsTolerance); - AssertEx.EqualTolerance(2, Duration.FromSeconds(10)/Duration.FromSeconds(5), SecondsTolerance); + AssertEx.EqualTolerance(2, (Duration.FromSeconds(10)/5).Seconds, SecondsTolerance); + AssertEx.EqualTolerance(2, Duration.FromSeconds(10)/Duration.FromSeconds(5), SecondsTolerance); } [Fact] public void ComparisonOperators() { - Duration oneSecond = Duration.FromSeconds(1); - Duration twoSeconds = Duration.FromSeconds(2); + Duration oneSecond = Duration.FromSeconds(1); + Duration twoSeconds = Duration.FromSeconds(2); Assert.True(oneSecond < twoSeconds); Assert.True(oneSecond <= twoSeconds); @@ -232,31 +232,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Duration second = Duration.FromSeconds(1); + Duration second = Duration.FromSeconds(1); Assert.Equal(0, second.CompareTo(second)); - Assert.True(second.CompareTo(Duration.Zero) > 0); - Assert.True(Duration.Zero.CompareTo(second) < 0); + Assert.True(second.CompareTo(Duration.Zero) > 0); + Assert.True(Duration.Zero.CompareTo(second) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Duration second = Duration.FromSeconds(1); + Duration second = Duration.FromSeconds(1); Assert.Throws(() => second.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Duration second = Duration.FromSeconds(1); + Duration second = Duration.FromSeconds(1); Assert.Throws(() => second.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Duration.FromSeconds(1); - var b = Duration.FromSeconds(2); + var a = Duration.FromSeconds(1); + var b = Duration.FromSeconds(2); // ReSharper disable EqualExpressionComparison @@ -275,8 +275,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Duration.FromSeconds(1); - var b = Duration.FromSeconds(2); + var a = Duration.FromSeconds(1); + var b = Duration.FromSeconds(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -286,29 +286,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Duration.FromSeconds(1); - Assert.True(v.Equals(Duration.FromSeconds(1), SecondsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Duration.Zero, SecondsTolerance, ComparisonType.Relative)); + var v = Duration.FromSeconds(1); + Assert.True(v.Equals(Duration.FromSeconds(1), SecondsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Duration.Zero, SecondsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Duration second = Duration.FromSeconds(1); + Duration second = Duration.FromSeconds(1); Assert.False(second.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Duration second = Duration.FromSeconds(1); + Duration second = Duration.FromSeconds(1); Assert.False(second.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(DurationUnit.Undefined, Duration.Units); + Assert.DoesNotContain(DurationUnit.Undefined, Duration.Units); } [Fact] @@ -327,7 +327,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Duration.BaseDimensions is null); + Assert.False(Duration.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs index 36c5b8f6ca..db8d0c5af3 100644 --- a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs @@ -59,26 +59,26 @@ public abstract partial class DynamicViscosityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new DynamicViscosity((double)0.0, DynamicViscosityUnit.Undefined)); + Assert.Throws(() => new DynamicViscosity((double)0.0, DynamicViscosityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new DynamicViscosity(double.PositiveInfinity, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); - Assert.Throws(() => new DynamicViscosity(double.NegativeInfinity, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); + Assert.Throws(() => new DynamicViscosity(double.PositiveInfinity, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); + Assert.Throws(() => new DynamicViscosity(double.NegativeInfinity, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new DynamicViscosity(double.NaN, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); + Assert.Throws(() => new DynamicViscosity(double.NaN, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); } [Fact] public void NewtonSecondPerMeterSquaredToDynamicViscosityUnits() { - DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); + DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); AssertEx.EqualTolerance(CentipoiseInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.Centipoise, CentipoiseTolerance); AssertEx.EqualTolerance(MicropascalSecondsInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.MicropascalSeconds, MicropascalSecondsTolerance); AssertEx.EqualTolerance(MillipascalSecondsInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.MillipascalSeconds, MillipascalSecondsTolerance); @@ -93,34 +93,34 @@ public void NewtonSecondPerMeterSquaredToDynamicViscosityUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.Centipoise).Centipoise, CentipoiseTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.MicropascalSecond).MicropascalSeconds, MicropascalSecondsTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.MillipascalSecond).MillipascalSeconds, MillipascalSecondsTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.NewtonSecondPerMeterSquared).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.PascalSecond).PascalSeconds, PascalSecondsTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.Poise).Poise, PoiseTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.PoundForceSecondPerSquareFoot).PoundsForceSecondPerSquareFoot, PoundsForceSecondPerSquareFootTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.PoundForceSecondPerSquareInch).PoundsForceSecondPerSquareInch, PoundsForceSecondPerSquareInchTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.Reyn).Reyns, ReynsTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.Centipoise).Centipoise, CentipoiseTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.MicropascalSecond).MicropascalSeconds, MicropascalSecondsTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.MillipascalSecond).MillipascalSeconds, MillipascalSecondsTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.NewtonSecondPerMeterSquared).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.PascalSecond).PascalSeconds, PascalSecondsTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.Poise).Poise, PoiseTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.PoundForceSecondPerSquareFoot).PoundsForceSecondPerSquareFoot, PoundsForceSecondPerSquareFootTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.PoundForceSecondPerSquareInch).PoundsForceSecondPerSquareInch, PoundsForceSecondPerSquareInchTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.Reyn).Reyns, ReynsTolerance); } [Fact] public void FromNewtonSecondsPerMeterSquared_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.PositiveInfinity)); - Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.NegativeInfinity)); + Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.PositiveInfinity)); + Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.NegativeInfinity)); } [Fact] public void FromNewtonSecondsPerMeterSquared_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.NaN)); + Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.NaN)); } [Fact] public void As() { - var newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); + var newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); AssertEx.EqualTolerance(CentipoiseInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.As(DynamicViscosityUnit.Centipoise), CentipoiseTolerance); AssertEx.EqualTolerance(MicropascalSecondsInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.As(DynamicViscosityUnit.MicropascalSecond), MicropascalSecondsTolerance); AssertEx.EqualTolerance(MillipascalSecondsInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.As(DynamicViscosityUnit.MillipascalSecond), MillipascalSecondsTolerance); @@ -135,7 +135,7 @@ public void As() [Fact] public void ToUnit() { - var newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); + var newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); var centipoiseQuantity = newtonsecondpermetersquared.ToUnit(DynamicViscosityUnit.Centipoise); AssertEx.EqualTolerance(CentipoiseInOneNewtonSecondPerMeterSquared, (double)centipoiseQuantity.Value, CentipoiseTolerance); @@ -177,36 +177,36 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - AssertEx.EqualTolerance(1, DynamicViscosity.FromCentipoise(newtonsecondpermetersquared.Centipoise).NewtonSecondsPerMeterSquared, CentipoiseTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.FromMicropascalSeconds(newtonsecondpermetersquared.MicropascalSeconds).NewtonSecondsPerMeterSquared, MicropascalSecondsTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.FromMillipascalSeconds(newtonsecondpermetersquared.MillipascalSeconds).NewtonSecondsPerMeterSquared, MillipascalSecondsTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.FromNewtonSecondsPerMeterSquared(newtonsecondpermetersquared.NewtonSecondsPerMeterSquared).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.FromPascalSeconds(newtonsecondpermetersquared.PascalSeconds).NewtonSecondsPerMeterSquared, PascalSecondsTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.FromPoise(newtonsecondpermetersquared.Poise).NewtonSecondsPerMeterSquared, PoiseTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.FromPoundsForceSecondPerSquareFoot(newtonsecondpermetersquared.PoundsForceSecondPerSquareFoot).NewtonSecondsPerMeterSquared, PoundsForceSecondPerSquareFootTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.FromPoundsForceSecondPerSquareInch(newtonsecondpermetersquared.PoundsForceSecondPerSquareInch).NewtonSecondsPerMeterSquared, PoundsForceSecondPerSquareInchTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.FromReyns(newtonsecondpermetersquared.Reyns).NewtonSecondsPerMeterSquared, ReynsTolerance); + DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); + AssertEx.EqualTolerance(1, DynamicViscosity.FromCentipoise(newtonsecondpermetersquared.Centipoise).NewtonSecondsPerMeterSquared, CentipoiseTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.FromMicropascalSeconds(newtonsecondpermetersquared.MicropascalSeconds).NewtonSecondsPerMeterSquared, MicropascalSecondsTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.FromMillipascalSeconds(newtonsecondpermetersquared.MillipascalSeconds).NewtonSecondsPerMeterSquared, MillipascalSecondsTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.FromNewtonSecondsPerMeterSquared(newtonsecondpermetersquared.NewtonSecondsPerMeterSquared).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.FromPascalSeconds(newtonsecondpermetersquared.PascalSeconds).NewtonSecondsPerMeterSquared, PascalSecondsTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.FromPoise(newtonsecondpermetersquared.Poise).NewtonSecondsPerMeterSquared, PoiseTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.FromPoundsForceSecondPerSquareFoot(newtonsecondpermetersquared.PoundsForceSecondPerSquareFoot).NewtonSecondsPerMeterSquared, PoundsForceSecondPerSquareFootTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.FromPoundsForceSecondPerSquareInch(newtonsecondpermetersquared.PoundsForceSecondPerSquareInch).NewtonSecondsPerMeterSquared, PoundsForceSecondPerSquareInchTolerance); + AssertEx.EqualTolerance(1, DynamicViscosity.FromReyns(newtonsecondpermetersquared.Reyns).NewtonSecondsPerMeterSquared, ReynsTolerance); } [Fact] public void ArithmeticOperators() { - DynamicViscosity v = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); + DynamicViscosity v = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); AssertEx.EqualTolerance(-1, -v.NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); - AssertEx.EqualTolerance(2, (DynamicViscosity.FromNewtonSecondsPerMeterSquared(3)-v).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); + AssertEx.EqualTolerance(2, (DynamicViscosity.FromNewtonSecondsPerMeterSquared(3)-v).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); AssertEx.EqualTolerance(2, (v + v).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); AssertEx.EqualTolerance(10, (v*10).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); AssertEx.EqualTolerance(10, (10*v).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); - AssertEx.EqualTolerance(2, (DynamicViscosity.FromNewtonSecondsPerMeterSquared(10)/5).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); - AssertEx.EqualTolerance(2, DynamicViscosity.FromNewtonSecondsPerMeterSquared(10)/DynamicViscosity.FromNewtonSecondsPerMeterSquared(5), NewtonSecondsPerMeterSquaredTolerance); + AssertEx.EqualTolerance(2, (DynamicViscosity.FromNewtonSecondsPerMeterSquared(10)/5).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); + AssertEx.EqualTolerance(2, DynamicViscosity.FromNewtonSecondsPerMeterSquared(10)/DynamicViscosity.FromNewtonSecondsPerMeterSquared(5), NewtonSecondsPerMeterSquaredTolerance); } [Fact] public void ComparisonOperators() { - DynamicViscosity oneNewtonSecondPerMeterSquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - DynamicViscosity twoNewtonSecondsPerMeterSquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(2); + DynamicViscosity oneNewtonSecondPerMeterSquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); + DynamicViscosity twoNewtonSecondsPerMeterSquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(2); Assert.True(oneNewtonSecondPerMeterSquared < twoNewtonSecondsPerMeterSquared); Assert.True(oneNewtonSecondPerMeterSquared <= twoNewtonSecondsPerMeterSquared); @@ -222,31 +222,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); + DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); Assert.Equal(0, newtonsecondpermetersquared.CompareTo(newtonsecondpermetersquared)); - Assert.True(newtonsecondpermetersquared.CompareTo(DynamicViscosity.Zero) > 0); - Assert.True(DynamicViscosity.Zero.CompareTo(newtonsecondpermetersquared) < 0); + Assert.True(newtonsecondpermetersquared.CompareTo(DynamicViscosity.Zero) > 0); + Assert.True(DynamicViscosity.Zero.CompareTo(newtonsecondpermetersquared) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); + DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); Assert.Throws(() => newtonsecondpermetersquared.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); + DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); Assert.Throws(() => newtonsecondpermetersquared.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - var b = DynamicViscosity.FromNewtonSecondsPerMeterSquared(2); + var a = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); + var b = DynamicViscosity.FromNewtonSecondsPerMeterSquared(2); // ReSharper disable EqualExpressionComparison @@ -265,8 +265,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - var b = DynamicViscosity.FromNewtonSecondsPerMeterSquared(2); + var a = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); + var b = DynamicViscosity.FromNewtonSecondsPerMeterSquared(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -276,29 +276,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - Assert.True(v.Equals(DynamicViscosity.FromNewtonSecondsPerMeterSquared(1), NewtonSecondsPerMeterSquaredTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(DynamicViscosity.Zero, NewtonSecondsPerMeterSquaredTolerance, ComparisonType.Relative)); + var v = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); + Assert.True(v.Equals(DynamicViscosity.FromNewtonSecondsPerMeterSquared(1), NewtonSecondsPerMeterSquaredTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(DynamicViscosity.Zero, NewtonSecondsPerMeterSquaredTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); + DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); Assert.False(newtonsecondpermetersquared.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); + DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); Assert.False(newtonsecondpermetersquared.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(DynamicViscosityUnit.Undefined, DynamicViscosity.Units); + Assert.DoesNotContain(DynamicViscosityUnit.Undefined, DynamicViscosity.Units); } [Fact] @@ -317,7 +317,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(DynamicViscosity.BaseDimensions is null); + Assert.False(DynamicViscosity.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs index fc02a5095f..647c58f719 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs @@ -49,26 +49,26 @@ public abstract partial class ElectricAdmittanceTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ElectricAdmittance((double)0.0, ElectricAdmittanceUnit.Undefined)); + Assert.Throws(() => new ElectricAdmittance((double)0.0, ElectricAdmittanceUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricAdmittance(double.PositiveInfinity, ElectricAdmittanceUnit.Siemens)); - Assert.Throws(() => new ElectricAdmittance(double.NegativeInfinity, ElectricAdmittanceUnit.Siemens)); + Assert.Throws(() => new ElectricAdmittance(double.PositiveInfinity, ElectricAdmittanceUnit.Siemens)); + Assert.Throws(() => new ElectricAdmittance(double.NegativeInfinity, ElectricAdmittanceUnit.Siemens)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricAdmittance(double.NaN, ElectricAdmittanceUnit.Siemens)); + Assert.Throws(() => new ElectricAdmittance(double.NaN, ElectricAdmittanceUnit.Siemens)); } [Fact] public void SiemensToElectricAdmittanceUnits() { - ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); + ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); AssertEx.EqualTolerance(MicrosiemensInOneSiemens, siemens.Microsiemens, MicrosiemensTolerance); AssertEx.EqualTolerance(MillisiemensInOneSiemens, siemens.Millisiemens, MillisiemensTolerance); AssertEx.EqualTolerance(NanosiemensInOneSiemens, siemens.Nanosiemens, NanosiemensTolerance); @@ -78,29 +78,29 @@ public void SiemensToElectricAdmittanceUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ElectricAdmittance.From(1, ElectricAdmittanceUnit.Microsiemens).Microsiemens, MicrosiemensTolerance); - AssertEx.EqualTolerance(1, ElectricAdmittance.From(1, ElectricAdmittanceUnit.Millisiemens).Millisiemens, MillisiemensTolerance); - AssertEx.EqualTolerance(1, ElectricAdmittance.From(1, ElectricAdmittanceUnit.Nanosiemens).Nanosiemens, NanosiemensTolerance); - AssertEx.EqualTolerance(1, ElectricAdmittance.From(1, ElectricAdmittanceUnit.Siemens).Siemens, SiemensTolerance); + AssertEx.EqualTolerance(1, ElectricAdmittance.From(1, ElectricAdmittanceUnit.Microsiemens).Microsiemens, MicrosiemensTolerance); + AssertEx.EqualTolerance(1, ElectricAdmittance.From(1, ElectricAdmittanceUnit.Millisiemens).Millisiemens, MillisiemensTolerance); + AssertEx.EqualTolerance(1, ElectricAdmittance.From(1, ElectricAdmittanceUnit.Nanosiemens).Nanosiemens, NanosiemensTolerance); + AssertEx.EqualTolerance(1, ElectricAdmittance.From(1, ElectricAdmittanceUnit.Siemens).Siemens, SiemensTolerance); } [Fact] public void FromSiemens_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricAdmittance.FromSiemens(double.PositiveInfinity)); - Assert.Throws(() => ElectricAdmittance.FromSiemens(double.NegativeInfinity)); + Assert.Throws(() => ElectricAdmittance.FromSiemens(double.PositiveInfinity)); + Assert.Throws(() => ElectricAdmittance.FromSiemens(double.NegativeInfinity)); } [Fact] public void FromSiemens_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricAdmittance.FromSiemens(double.NaN)); + Assert.Throws(() => ElectricAdmittance.FromSiemens(double.NaN)); } [Fact] public void As() { - var siemens = ElectricAdmittance.FromSiemens(1); + var siemens = ElectricAdmittance.FromSiemens(1); AssertEx.EqualTolerance(MicrosiemensInOneSiemens, siemens.As(ElectricAdmittanceUnit.Microsiemens), MicrosiemensTolerance); AssertEx.EqualTolerance(MillisiemensInOneSiemens, siemens.As(ElectricAdmittanceUnit.Millisiemens), MillisiemensTolerance); AssertEx.EqualTolerance(NanosiemensInOneSiemens, siemens.As(ElectricAdmittanceUnit.Nanosiemens), NanosiemensTolerance); @@ -110,7 +110,7 @@ public void As() [Fact] public void ToUnit() { - var siemens = ElectricAdmittance.FromSiemens(1); + var siemens = ElectricAdmittance.FromSiemens(1); var microsiemensQuantity = siemens.ToUnit(ElectricAdmittanceUnit.Microsiemens); AssertEx.EqualTolerance(MicrosiemensInOneSiemens, (double)microsiemensQuantity.Value, MicrosiemensTolerance); @@ -132,31 +132,31 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); - AssertEx.EqualTolerance(1, ElectricAdmittance.FromMicrosiemens(siemens.Microsiemens).Siemens, MicrosiemensTolerance); - AssertEx.EqualTolerance(1, ElectricAdmittance.FromMillisiemens(siemens.Millisiemens).Siemens, MillisiemensTolerance); - AssertEx.EqualTolerance(1, ElectricAdmittance.FromNanosiemens(siemens.Nanosiemens).Siemens, NanosiemensTolerance); - AssertEx.EqualTolerance(1, ElectricAdmittance.FromSiemens(siemens.Siemens).Siemens, SiemensTolerance); + ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); + AssertEx.EqualTolerance(1, ElectricAdmittance.FromMicrosiemens(siemens.Microsiemens).Siemens, MicrosiemensTolerance); + AssertEx.EqualTolerance(1, ElectricAdmittance.FromMillisiemens(siemens.Millisiemens).Siemens, MillisiemensTolerance); + AssertEx.EqualTolerance(1, ElectricAdmittance.FromNanosiemens(siemens.Nanosiemens).Siemens, NanosiemensTolerance); + AssertEx.EqualTolerance(1, ElectricAdmittance.FromSiemens(siemens.Siemens).Siemens, SiemensTolerance); } [Fact] public void ArithmeticOperators() { - ElectricAdmittance v = ElectricAdmittance.FromSiemens(1); + ElectricAdmittance v = ElectricAdmittance.FromSiemens(1); AssertEx.EqualTolerance(-1, -v.Siemens, SiemensTolerance); - AssertEx.EqualTolerance(2, (ElectricAdmittance.FromSiemens(3)-v).Siemens, SiemensTolerance); + AssertEx.EqualTolerance(2, (ElectricAdmittance.FromSiemens(3)-v).Siemens, SiemensTolerance); AssertEx.EqualTolerance(2, (v + v).Siemens, SiemensTolerance); AssertEx.EqualTolerance(10, (v*10).Siemens, SiemensTolerance); AssertEx.EqualTolerance(10, (10*v).Siemens, SiemensTolerance); - AssertEx.EqualTolerance(2, (ElectricAdmittance.FromSiemens(10)/5).Siemens, SiemensTolerance); - AssertEx.EqualTolerance(2, ElectricAdmittance.FromSiemens(10)/ElectricAdmittance.FromSiemens(5), SiemensTolerance); + AssertEx.EqualTolerance(2, (ElectricAdmittance.FromSiemens(10)/5).Siemens, SiemensTolerance); + AssertEx.EqualTolerance(2, ElectricAdmittance.FromSiemens(10)/ElectricAdmittance.FromSiemens(5), SiemensTolerance); } [Fact] public void ComparisonOperators() { - ElectricAdmittance oneSiemens = ElectricAdmittance.FromSiemens(1); - ElectricAdmittance twoSiemens = ElectricAdmittance.FromSiemens(2); + ElectricAdmittance oneSiemens = ElectricAdmittance.FromSiemens(1); + ElectricAdmittance twoSiemens = ElectricAdmittance.FromSiemens(2); Assert.True(oneSiemens < twoSiemens); Assert.True(oneSiemens <= twoSiemens); @@ -172,31 +172,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); + ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); Assert.Equal(0, siemens.CompareTo(siemens)); - Assert.True(siemens.CompareTo(ElectricAdmittance.Zero) > 0); - Assert.True(ElectricAdmittance.Zero.CompareTo(siemens) < 0); + Assert.True(siemens.CompareTo(ElectricAdmittance.Zero) > 0); + Assert.True(ElectricAdmittance.Zero.CompareTo(siemens) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); + ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); Assert.Throws(() => siemens.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); + ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); Assert.Throws(() => siemens.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ElectricAdmittance.FromSiemens(1); - var b = ElectricAdmittance.FromSiemens(2); + var a = ElectricAdmittance.FromSiemens(1); + var b = ElectricAdmittance.FromSiemens(2); // ReSharper disable EqualExpressionComparison @@ -215,8 +215,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ElectricAdmittance.FromSiemens(1); - var b = ElectricAdmittance.FromSiemens(2); + var a = ElectricAdmittance.FromSiemens(1); + var b = ElectricAdmittance.FromSiemens(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -226,29 +226,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ElectricAdmittance.FromSiemens(1); - Assert.True(v.Equals(ElectricAdmittance.FromSiemens(1), SiemensTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricAdmittance.Zero, SiemensTolerance, ComparisonType.Relative)); + var v = ElectricAdmittance.FromSiemens(1); + Assert.True(v.Equals(ElectricAdmittance.FromSiemens(1), SiemensTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricAdmittance.Zero, SiemensTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); + ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); Assert.False(siemens.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); + ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); Assert.False(siemens.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ElectricAdmittanceUnit.Undefined, ElectricAdmittance.Units); + Assert.DoesNotContain(ElectricAdmittanceUnit.Undefined, ElectricAdmittance.Units); } [Fact] @@ -267,7 +267,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ElectricAdmittance.BaseDimensions is null); + Assert.False(ElectricAdmittance.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs index cd0145e26e..1a5e381e1f 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of ElectricChargeDensity. + /// Test of ElectricChargeDensity. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class ElectricChargeDensityTestsBase @@ -43,59 +43,59 @@ public abstract partial class ElectricChargeDensityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ElectricChargeDensity((double)0.0, ElectricChargeDensityUnit.Undefined)); + Assert.Throws(() => new ElectricChargeDensity((double)0.0, ElectricChargeDensityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricChargeDensity(double.PositiveInfinity, ElectricChargeDensityUnit.CoulombPerCubicMeter)); - Assert.Throws(() => new ElectricChargeDensity(double.NegativeInfinity, ElectricChargeDensityUnit.CoulombPerCubicMeter)); + Assert.Throws(() => new ElectricChargeDensity(double.PositiveInfinity, ElectricChargeDensityUnit.CoulombPerCubicMeter)); + Assert.Throws(() => new ElectricChargeDensity(double.NegativeInfinity, ElectricChargeDensityUnit.CoulombPerCubicMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricChargeDensity(double.NaN, ElectricChargeDensityUnit.CoulombPerCubicMeter)); + Assert.Throws(() => new ElectricChargeDensity(double.NaN, ElectricChargeDensityUnit.CoulombPerCubicMeter)); } [Fact] public void CoulombPerCubicMeterToElectricChargeDensityUnits() { - ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); + ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); AssertEx.EqualTolerance(CoulombsPerCubicMeterInOneCoulombPerCubicMeter, coulombpercubicmeter.CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); } [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ElectricChargeDensity.From(1, ElectricChargeDensityUnit.CoulombPerCubicMeter).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, ElectricChargeDensity.From(1, ElectricChargeDensityUnit.CoulombPerCubicMeter).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); } [Fact] public void FromCoulombsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.NegativeInfinity)); + Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.PositiveInfinity)); + Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.NegativeInfinity)); } [Fact] public void FromCoulombsPerCubicMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.NaN)); + Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.NaN)); } [Fact] public void As() { - var coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); + var coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); AssertEx.EqualTolerance(CoulombsPerCubicMeterInOneCoulombPerCubicMeter, coulombpercubicmeter.As(ElectricChargeDensityUnit.CoulombPerCubicMeter), CoulombsPerCubicMeterTolerance); } [Fact] public void ToUnit() { - var coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); + var coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); var coulombpercubicmeterQuantity = coulombpercubicmeter.ToUnit(ElectricChargeDensityUnit.CoulombPerCubicMeter); AssertEx.EqualTolerance(CoulombsPerCubicMeterInOneCoulombPerCubicMeter, (double)coulombpercubicmeterQuantity.Value, CoulombsPerCubicMeterTolerance); @@ -105,28 +105,28 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - AssertEx.EqualTolerance(1, ElectricChargeDensity.FromCoulombsPerCubicMeter(coulombpercubicmeter.CoulombsPerCubicMeter).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); + ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); + AssertEx.EqualTolerance(1, ElectricChargeDensity.FromCoulombsPerCubicMeter(coulombpercubicmeter.CoulombsPerCubicMeter).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); } [Fact] public void ArithmeticOperators() { - ElectricChargeDensity v = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); + ElectricChargeDensity v = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); AssertEx.EqualTolerance(-1, -v.CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricChargeDensity.FromCoulombsPerCubicMeter(3)-v).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, (ElectricChargeDensity.FromCoulombsPerCubicMeter(3)-v).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); AssertEx.EqualTolerance(2, (v + v).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); AssertEx.EqualTolerance(10, (v*10).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); AssertEx.EqualTolerance(10, (10*v).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricChargeDensity.FromCoulombsPerCubicMeter(10)/5).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, ElectricChargeDensity.FromCoulombsPerCubicMeter(10)/ElectricChargeDensity.FromCoulombsPerCubicMeter(5), CoulombsPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, (ElectricChargeDensity.FromCoulombsPerCubicMeter(10)/5).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, ElectricChargeDensity.FromCoulombsPerCubicMeter(10)/ElectricChargeDensity.FromCoulombsPerCubicMeter(5), CoulombsPerCubicMeterTolerance); } [Fact] public void ComparisonOperators() { - ElectricChargeDensity oneCoulombPerCubicMeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - ElectricChargeDensity twoCoulombsPerCubicMeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(2); + ElectricChargeDensity oneCoulombPerCubicMeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); + ElectricChargeDensity twoCoulombsPerCubicMeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(2); Assert.True(oneCoulombPerCubicMeter < twoCoulombsPerCubicMeter); Assert.True(oneCoulombPerCubicMeter <= twoCoulombsPerCubicMeter); @@ -142,31 +142,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); + ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); Assert.Equal(0, coulombpercubicmeter.CompareTo(coulombpercubicmeter)); - Assert.True(coulombpercubicmeter.CompareTo(ElectricChargeDensity.Zero) > 0); - Assert.True(ElectricChargeDensity.Zero.CompareTo(coulombpercubicmeter) < 0); + Assert.True(coulombpercubicmeter.CompareTo(ElectricChargeDensity.Zero) > 0); + Assert.True(ElectricChargeDensity.Zero.CompareTo(coulombpercubicmeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); + ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); Assert.Throws(() => coulombpercubicmeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); + ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); Assert.Throws(() => coulombpercubicmeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - var b = ElectricChargeDensity.FromCoulombsPerCubicMeter(2); + var a = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); + var b = ElectricChargeDensity.FromCoulombsPerCubicMeter(2); // ReSharper disable EqualExpressionComparison @@ -185,8 +185,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - var b = ElectricChargeDensity.FromCoulombsPerCubicMeter(2); + var a = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); + var b = ElectricChargeDensity.FromCoulombsPerCubicMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -196,29 +196,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - Assert.True(v.Equals(ElectricChargeDensity.FromCoulombsPerCubicMeter(1), CoulombsPerCubicMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricChargeDensity.Zero, CoulombsPerCubicMeterTolerance, ComparisonType.Relative)); + var v = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); + Assert.True(v.Equals(ElectricChargeDensity.FromCoulombsPerCubicMeter(1), CoulombsPerCubicMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricChargeDensity.Zero, CoulombsPerCubicMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); + ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); Assert.False(coulombpercubicmeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); + ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); Assert.False(coulombpercubicmeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ElectricChargeDensityUnit.Undefined, ElectricChargeDensity.Units); + Assert.DoesNotContain(ElectricChargeDensityUnit.Undefined, ElectricChargeDensity.Units); } [Fact] @@ -237,7 +237,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ElectricChargeDensity.BaseDimensions is null); + Assert.False(ElectricChargeDensity.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs index b6e81d3b77..3631a32bf6 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs @@ -51,26 +51,26 @@ public abstract partial class ElectricChargeTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ElectricCharge((double)0.0, ElectricChargeUnit.Undefined)); + Assert.Throws(() => new ElectricCharge((double)0.0, ElectricChargeUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricCharge(double.PositiveInfinity, ElectricChargeUnit.Coulomb)); - Assert.Throws(() => new ElectricCharge(double.NegativeInfinity, ElectricChargeUnit.Coulomb)); + Assert.Throws(() => new ElectricCharge(double.PositiveInfinity, ElectricChargeUnit.Coulomb)); + Assert.Throws(() => new ElectricCharge(double.NegativeInfinity, ElectricChargeUnit.Coulomb)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricCharge(double.NaN, ElectricChargeUnit.Coulomb)); + Assert.Throws(() => new ElectricCharge(double.NaN, ElectricChargeUnit.Coulomb)); } [Fact] public void CoulombToElectricChargeUnits() { - ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); + ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); AssertEx.EqualTolerance(AmpereHoursInOneCoulomb, coulomb.AmpereHours, AmpereHoursTolerance); AssertEx.EqualTolerance(CoulombsInOneCoulomb, coulomb.Coulombs, CoulombsTolerance); AssertEx.EqualTolerance(KiloampereHoursInOneCoulomb, coulomb.KiloampereHours, KiloampereHoursTolerance); @@ -81,30 +81,30 @@ public void CoulombToElectricChargeUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ElectricCharge.From(1, ElectricChargeUnit.AmpereHour).AmpereHours, AmpereHoursTolerance); - AssertEx.EqualTolerance(1, ElectricCharge.From(1, ElectricChargeUnit.Coulomb).Coulombs, CoulombsTolerance); - AssertEx.EqualTolerance(1, ElectricCharge.From(1, ElectricChargeUnit.KiloampereHour).KiloampereHours, KiloampereHoursTolerance); - AssertEx.EqualTolerance(1, ElectricCharge.From(1, ElectricChargeUnit.MegaampereHour).MegaampereHours, MegaampereHoursTolerance); - AssertEx.EqualTolerance(1, ElectricCharge.From(1, ElectricChargeUnit.MilliampereHour).MilliampereHours, MilliampereHoursTolerance); + AssertEx.EqualTolerance(1, ElectricCharge.From(1, ElectricChargeUnit.AmpereHour).AmpereHours, AmpereHoursTolerance); + AssertEx.EqualTolerance(1, ElectricCharge.From(1, ElectricChargeUnit.Coulomb).Coulombs, CoulombsTolerance); + AssertEx.EqualTolerance(1, ElectricCharge.From(1, ElectricChargeUnit.KiloampereHour).KiloampereHours, KiloampereHoursTolerance); + AssertEx.EqualTolerance(1, ElectricCharge.From(1, ElectricChargeUnit.MegaampereHour).MegaampereHours, MegaampereHoursTolerance); + AssertEx.EqualTolerance(1, ElectricCharge.From(1, ElectricChargeUnit.MilliampereHour).MilliampereHours, MilliampereHoursTolerance); } [Fact] public void FromCoulombs_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricCharge.FromCoulombs(double.PositiveInfinity)); - Assert.Throws(() => ElectricCharge.FromCoulombs(double.NegativeInfinity)); + Assert.Throws(() => ElectricCharge.FromCoulombs(double.PositiveInfinity)); + Assert.Throws(() => ElectricCharge.FromCoulombs(double.NegativeInfinity)); } [Fact] public void FromCoulombs_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricCharge.FromCoulombs(double.NaN)); + Assert.Throws(() => ElectricCharge.FromCoulombs(double.NaN)); } [Fact] public void As() { - var coulomb = ElectricCharge.FromCoulombs(1); + var coulomb = ElectricCharge.FromCoulombs(1); AssertEx.EqualTolerance(AmpereHoursInOneCoulomb, coulomb.As(ElectricChargeUnit.AmpereHour), AmpereHoursTolerance); AssertEx.EqualTolerance(CoulombsInOneCoulomb, coulomb.As(ElectricChargeUnit.Coulomb), CoulombsTolerance); AssertEx.EqualTolerance(KiloampereHoursInOneCoulomb, coulomb.As(ElectricChargeUnit.KiloampereHour), KiloampereHoursTolerance); @@ -115,7 +115,7 @@ public void As() [Fact] public void ToUnit() { - var coulomb = ElectricCharge.FromCoulombs(1); + var coulomb = ElectricCharge.FromCoulombs(1); var amperehourQuantity = coulomb.ToUnit(ElectricChargeUnit.AmpereHour); AssertEx.EqualTolerance(AmpereHoursInOneCoulomb, (double)amperehourQuantity.Value, AmpereHoursTolerance); @@ -141,32 +141,32 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); - AssertEx.EqualTolerance(1, ElectricCharge.FromAmpereHours(coulomb.AmpereHours).Coulombs, AmpereHoursTolerance); - AssertEx.EqualTolerance(1, ElectricCharge.FromCoulombs(coulomb.Coulombs).Coulombs, CoulombsTolerance); - AssertEx.EqualTolerance(1, ElectricCharge.FromKiloampereHours(coulomb.KiloampereHours).Coulombs, KiloampereHoursTolerance); - AssertEx.EqualTolerance(1, ElectricCharge.FromMegaampereHours(coulomb.MegaampereHours).Coulombs, MegaampereHoursTolerance); - AssertEx.EqualTolerance(1, ElectricCharge.FromMilliampereHours(coulomb.MilliampereHours).Coulombs, MilliampereHoursTolerance); + ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); + AssertEx.EqualTolerance(1, ElectricCharge.FromAmpereHours(coulomb.AmpereHours).Coulombs, AmpereHoursTolerance); + AssertEx.EqualTolerance(1, ElectricCharge.FromCoulombs(coulomb.Coulombs).Coulombs, CoulombsTolerance); + AssertEx.EqualTolerance(1, ElectricCharge.FromKiloampereHours(coulomb.KiloampereHours).Coulombs, KiloampereHoursTolerance); + AssertEx.EqualTolerance(1, ElectricCharge.FromMegaampereHours(coulomb.MegaampereHours).Coulombs, MegaampereHoursTolerance); + AssertEx.EqualTolerance(1, ElectricCharge.FromMilliampereHours(coulomb.MilliampereHours).Coulombs, MilliampereHoursTolerance); } [Fact] public void ArithmeticOperators() { - ElectricCharge v = ElectricCharge.FromCoulombs(1); + ElectricCharge v = ElectricCharge.FromCoulombs(1); AssertEx.EqualTolerance(-1, -v.Coulombs, CoulombsTolerance); - AssertEx.EqualTolerance(2, (ElectricCharge.FromCoulombs(3)-v).Coulombs, CoulombsTolerance); + AssertEx.EqualTolerance(2, (ElectricCharge.FromCoulombs(3)-v).Coulombs, CoulombsTolerance); AssertEx.EqualTolerance(2, (v + v).Coulombs, CoulombsTolerance); AssertEx.EqualTolerance(10, (v*10).Coulombs, CoulombsTolerance); AssertEx.EqualTolerance(10, (10*v).Coulombs, CoulombsTolerance); - AssertEx.EqualTolerance(2, (ElectricCharge.FromCoulombs(10)/5).Coulombs, CoulombsTolerance); - AssertEx.EqualTolerance(2, ElectricCharge.FromCoulombs(10)/ElectricCharge.FromCoulombs(5), CoulombsTolerance); + AssertEx.EqualTolerance(2, (ElectricCharge.FromCoulombs(10)/5).Coulombs, CoulombsTolerance); + AssertEx.EqualTolerance(2, ElectricCharge.FromCoulombs(10)/ElectricCharge.FromCoulombs(5), CoulombsTolerance); } [Fact] public void ComparisonOperators() { - ElectricCharge oneCoulomb = ElectricCharge.FromCoulombs(1); - ElectricCharge twoCoulombs = ElectricCharge.FromCoulombs(2); + ElectricCharge oneCoulomb = ElectricCharge.FromCoulombs(1); + ElectricCharge twoCoulombs = ElectricCharge.FromCoulombs(2); Assert.True(oneCoulomb < twoCoulombs); Assert.True(oneCoulomb <= twoCoulombs); @@ -182,31 +182,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); + ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); Assert.Equal(0, coulomb.CompareTo(coulomb)); - Assert.True(coulomb.CompareTo(ElectricCharge.Zero) > 0); - Assert.True(ElectricCharge.Zero.CompareTo(coulomb) < 0); + Assert.True(coulomb.CompareTo(ElectricCharge.Zero) > 0); + Assert.True(ElectricCharge.Zero.CompareTo(coulomb) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); + ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); Assert.Throws(() => coulomb.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); + ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); Assert.Throws(() => coulomb.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ElectricCharge.FromCoulombs(1); - var b = ElectricCharge.FromCoulombs(2); + var a = ElectricCharge.FromCoulombs(1); + var b = ElectricCharge.FromCoulombs(2); // ReSharper disable EqualExpressionComparison @@ -225,8 +225,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ElectricCharge.FromCoulombs(1); - var b = ElectricCharge.FromCoulombs(2); + var a = ElectricCharge.FromCoulombs(1); + var b = ElectricCharge.FromCoulombs(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -236,29 +236,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ElectricCharge.FromCoulombs(1); - Assert.True(v.Equals(ElectricCharge.FromCoulombs(1), CoulombsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricCharge.Zero, CoulombsTolerance, ComparisonType.Relative)); + var v = ElectricCharge.FromCoulombs(1); + Assert.True(v.Equals(ElectricCharge.FromCoulombs(1), CoulombsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricCharge.Zero, CoulombsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); + ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); Assert.False(coulomb.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); + ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); Assert.False(coulomb.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ElectricChargeUnit.Undefined, ElectricCharge.Units); + Assert.DoesNotContain(ElectricChargeUnit.Undefined, ElectricCharge.Units); } [Fact] @@ -277,7 +277,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ElectricCharge.BaseDimensions is null); + Assert.False(ElectricCharge.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs index d818fedfc8..e318176632 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs @@ -47,26 +47,26 @@ public abstract partial class ElectricConductanceTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ElectricConductance((double)0.0, ElectricConductanceUnit.Undefined)); + Assert.Throws(() => new ElectricConductance((double)0.0, ElectricConductanceUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricConductance(double.PositiveInfinity, ElectricConductanceUnit.Siemens)); - Assert.Throws(() => new ElectricConductance(double.NegativeInfinity, ElectricConductanceUnit.Siemens)); + Assert.Throws(() => new ElectricConductance(double.PositiveInfinity, ElectricConductanceUnit.Siemens)); + Assert.Throws(() => new ElectricConductance(double.NegativeInfinity, ElectricConductanceUnit.Siemens)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricConductance(double.NaN, ElectricConductanceUnit.Siemens)); + Assert.Throws(() => new ElectricConductance(double.NaN, ElectricConductanceUnit.Siemens)); } [Fact] public void SiemensToElectricConductanceUnits() { - ElectricConductance siemens = ElectricConductance.FromSiemens(1); + ElectricConductance siemens = ElectricConductance.FromSiemens(1); AssertEx.EqualTolerance(MicrosiemensInOneSiemens, siemens.Microsiemens, MicrosiemensTolerance); AssertEx.EqualTolerance(MillisiemensInOneSiemens, siemens.Millisiemens, MillisiemensTolerance); AssertEx.EqualTolerance(SiemensInOneSiemens, siemens.Siemens, SiemensTolerance); @@ -75,28 +75,28 @@ public void SiemensToElectricConductanceUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ElectricConductance.From(1, ElectricConductanceUnit.Microsiemens).Microsiemens, MicrosiemensTolerance); - AssertEx.EqualTolerance(1, ElectricConductance.From(1, ElectricConductanceUnit.Millisiemens).Millisiemens, MillisiemensTolerance); - AssertEx.EqualTolerance(1, ElectricConductance.From(1, ElectricConductanceUnit.Siemens).Siemens, SiemensTolerance); + AssertEx.EqualTolerance(1, ElectricConductance.From(1, ElectricConductanceUnit.Microsiemens).Microsiemens, MicrosiemensTolerance); + AssertEx.EqualTolerance(1, ElectricConductance.From(1, ElectricConductanceUnit.Millisiemens).Millisiemens, MillisiemensTolerance); + AssertEx.EqualTolerance(1, ElectricConductance.From(1, ElectricConductanceUnit.Siemens).Siemens, SiemensTolerance); } [Fact] public void FromSiemens_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricConductance.FromSiemens(double.PositiveInfinity)); - Assert.Throws(() => ElectricConductance.FromSiemens(double.NegativeInfinity)); + Assert.Throws(() => ElectricConductance.FromSiemens(double.PositiveInfinity)); + Assert.Throws(() => ElectricConductance.FromSiemens(double.NegativeInfinity)); } [Fact] public void FromSiemens_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricConductance.FromSiemens(double.NaN)); + Assert.Throws(() => ElectricConductance.FromSiemens(double.NaN)); } [Fact] public void As() { - var siemens = ElectricConductance.FromSiemens(1); + var siemens = ElectricConductance.FromSiemens(1); AssertEx.EqualTolerance(MicrosiemensInOneSiemens, siemens.As(ElectricConductanceUnit.Microsiemens), MicrosiemensTolerance); AssertEx.EqualTolerance(MillisiemensInOneSiemens, siemens.As(ElectricConductanceUnit.Millisiemens), MillisiemensTolerance); AssertEx.EqualTolerance(SiemensInOneSiemens, siemens.As(ElectricConductanceUnit.Siemens), SiemensTolerance); @@ -105,7 +105,7 @@ public void As() [Fact] public void ToUnit() { - var siemens = ElectricConductance.FromSiemens(1); + var siemens = ElectricConductance.FromSiemens(1); var microsiemensQuantity = siemens.ToUnit(ElectricConductanceUnit.Microsiemens); AssertEx.EqualTolerance(MicrosiemensInOneSiemens, (double)microsiemensQuantity.Value, MicrosiemensTolerance); @@ -123,30 +123,30 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ElectricConductance siemens = ElectricConductance.FromSiemens(1); - AssertEx.EqualTolerance(1, ElectricConductance.FromMicrosiemens(siemens.Microsiemens).Siemens, MicrosiemensTolerance); - AssertEx.EqualTolerance(1, ElectricConductance.FromMillisiemens(siemens.Millisiemens).Siemens, MillisiemensTolerance); - AssertEx.EqualTolerance(1, ElectricConductance.FromSiemens(siemens.Siemens).Siemens, SiemensTolerance); + ElectricConductance siemens = ElectricConductance.FromSiemens(1); + AssertEx.EqualTolerance(1, ElectricConductance.FromMicrosiemens(siemens.Microsiemens).Siemens, MicrosiemensTolerance); + AssertEx.EqualTolerance(1, ElectricConductance.FromMillisiemens(siemens.Millisiemens).Siemens, MillisiemensTolerance); + AssertEx.EqualTolerance(1, ElectricConductance.FromSiemens(siemens.Siemens).Siemens, SiemensTolerance); } [Fact] public void ArithmeticOperators() { - ElectricConductance v = ElectricConductance.FromSiemens(1); + ElectricConductance v = ElectricConductance.FromSiemens(1); AssertEx.EqualTolerance(-1, -v.Siemens, SiemensTolerance); - AssertEx.EqualTolerance(2, (ElectricConductance.FromSiemens(3)-v).Siemens, SiemensTolerance); + AssertEx.EqualTolerance(2, (ElectricConductance.FromSiemens(3)-v).Siemens, SiemensTolerance); AssertEx.EqualTolerance(2, (v + v).Siemens, SiemensTolerance); AssertEx.EqualTolerance(10, (v*10).Siemens, SiemensTolerance); AssertEx.EqualTolerance(10, (10*v).Siemens, SiemensTolerance); - AssertEx.EqualTolerance(2, (ElectricConductance.FromSiemens(10)/5).Siemens, SiemensTolerance); - AssertEx.EqualTolerance(2, ElectricConductance.FromSiemens(10)/ElectricConductance.FromSiemens(5), SiemensTolerance); + AssertEx.EqualTolerance(2, (ElectricConductance.FromSiemens(10)/5).Siemens, SiemensTolerance); + AssertEx.EqualTolerance(2, ElectricConductance.FromSiemens(10)/ElectricConductance.FromSiemens(5), SiemensTolerance); } [Fact] public void ComparisonOperators() { - ElectricConductance oneSiemens = ElectricConductance.FromSiemens(1); - ElectricConductance twoSiemens = ElectricConductance.FromSiemens(2); + ElectricConductance oneSiemens = ElectricConductance.FromSiemens(1); + ElectricConductance twoSiemens = ElectricConductance.FromSiemens(2); Assert.True(oneSiemens < twoSiemens); Assert.True(oneSiemens <= twoSiemens); @@ -162,31 +162,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ElectricConductance siemens = ElectricConductance.FromSiemens(1); + ElectricConductance siemens = ElectricConductance.FromSiemens(1); Assert.Equal(0, siemens.CompareTo(siemens)); - Assert.True(siemens.CompareTo(ElectricConductance.Zero) > 0); - Assert.True(ElectricConductance.Zero.CompareTo(siemens) < 0); + Assert.True(siemens.CompareTo(ElectricConductance.Zero) > 0); + Assert.True(ElectricConductance.Zero.CompareTo(siemens) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricConductance siemens = ElectricConductance.FromSiemens(1); + ElectricConductance siemens = ElectricConductance.FromSiemens(1); Assert.Throws(() => siemens.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricConductance siemens = ElectricConductance.FromSiemens(1); + ElectricConductance siemens = ElectricConductance.FromSiemens(1); Assert.Throws(() => siemens.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ElectricConductance.FromSiemens(1); - var b = ElectricConductance.FromSiemens(2); + var a = ElectricConductance.FromSiemens(1); + var b = ElectricConductance.FromSiemens(2); // ReSharper disable EqualExpressionComparison @@ -205,8 +205,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ElectricConductance.FromSiemens(1); - var b = ElectricConductance.FromSiemens(2); + var a = ElectricConductance.FromSiemens(1); + var b = ElectricConductance.FromSiemens(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -216,29 +216,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ElectricConductance.FromSiemens(1); - Assert.True(v.Equals(ElectricConductance.FromSiemens(1), SiemensTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricConductance.Zero, SiemensTolerance, ComparisonType.Relative)); + var v = ElectricConductance.FromSiemens(1); + Assert.True(v.Equals(ElectricConductance.FromSiemens(1), SiemensTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricConductance.Zero, SiemensTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricConductance siemens = ElectricConductance.FromSiemens(1); + ElectricConductance siemens = ElectricConductance.FromSiemens(1); Assert.False(siemens.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricConductance siemens = ElectricConductance.FromSiemens(1); + ElectricConductance siemens = ElectricConductance.FromSiemens(1); Assert.False(siemens.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ElectricConductanceUnit.Undefined, ElectricConductance.Units); + Assert.DoesNotContain(ElectricConductanceUnit.Undefined, ElectricConductance.Units); } [Fact] @@ -257,7 +257,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ElectricConductance.BaseDimensions is null); + Assert.False(ElectricConductance.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs index 2cb0d6932d..0876b151ac 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs @@ -47,26 +47,26 @@ public abstract partial class ElectricConductivityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ElectricConductivity((double)0.0, ElectricConductivityUnit.Undefined)); + Assert.Throws(() => new ElectricConductivity((double)0.0, ElectricConductivityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricConductivity(double.PositiveInfinity, ElectricConductivityUnit.SiemensPerMeter)); - Assert.Throws(() => new ElectricConductivity(double.NegativeInfinity, ElectricConductivityUnit.SiemensPerMeter)); + Assert.Throws(() => new ElectricConductivity(double.PositiveInfinity, ElectricConductivityUnit.SiemensPerMeter)); + Assert.Throws(() => new ElectricConductivity(double.NegativeInfinity, ElectricConductivityUnit.SiemensPerMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricConductivity(double.NaN, ElectricConductivityUnit.SiemensPerMeter)); + Assert.Throws(() => new ElectricConductivity(double.NaN, ElectricConductivityUnit.SiemensPerMeter)); } [Fact] public void SiemensPerMeterToElectricConductivityUnits() { - ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); + ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); AssertEx.EqualTolerance(SiemensPerFootInOneSiemensPerMeter, siemenspermeter.SiemensPerFoot, SiemensPerFootTolerance); AssertEx.EqualTolerance(SiemensPerInchInOneSiemensPerMeter, siemenspermeter.SiemensPerInch, SiemensPerInchTolerance); AssertEx.EqualTolerance(SiemensPerMeterInOneSiemensPerMeter, siemenspermeter.SiemensPerMeter, SiemensPerMeterTolerance); @@ -75,28 +75,28 @@ public void SiemensPerMeterToElectricConductivityUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ElectricConductivity.From(1, ElectricConductivityUnit.SiemensPerFoot).SiemensPerFoot, SiemensPerFootTolerance); - AssertEx.EqualTolerance(1, ElectricConductivity.From(1, ElectricConductivityUnit.SiemensPerInch).SiemensPerInch, SiemensPerInchTolerance); - AssertEx.EqualTolerance(1, ElectricConductivity.From(1, ElectricConductivityUnit.SiemensPerMeter).SiemensPerMeter, SiemensPerMeterTolerance); + AssertEx.EqualTolerance(1, ElectricConductivity.From(1, ElectricConductivityUnit.SiemensPerFoot).SiemensPerFoot, SiemensPerFootTolerance); + AssertEx.EqualTolerance(1, ElectricConductivity.From(1, ElectricConductivityUnit.SiemensPerInch).SiemensPerInch, SiemensPerInchTolerance); + AssertEx.EqualTolerance(1, ElectricConductivity.From(1, ElectricConductivityUnit.SiemensPerMeter).SiemensPerMeter, SiemensPerMeterTolerance); } [Fact] public void FromSiemensPerMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.PositiveInfinity)); - Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.NegativeInfinity)); + Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.PositiveInfinity)); + Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.NegativeInfinity)); } [Fact] public void FromSiemensPerMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.NaN)); + Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.NaN)); } [Fact] public void As() { - var siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); + var siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); AssertEx.EqualTolerance(SiemensPerFootInOneSiemensPerMeter, siemenspermeter.As(ElectricConductivityUnit.SiemensPerFoot), SiemensPerFootTolerance); AssertEx.EqualTolerance(SiemensPerInchInOneSiemensPerMeter, siemenspermeter.As(ElectricConductivityUnit.SiemensPerInch), SiemensPerInchTolerance); AssertEx.EqualTolerance(SiemensPerMeterInOneSiemensPerMeter, siemenspermeter.As(ElectricConductivityUnit.SiemensPerMeter), SiemensPerMeterTolerance); @@ -105,7 +105,7 @@ public void As() [Fact] public void ToUnit() { - var siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); + var siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); var siemensperfootQuantity = siemenspermeter.ToUnit(ElectricConductivityUnit.SiemensPerFoot); AssertEx.EqualTolerance(SiemensPerFootInOneSiemensPerMeter, (double)siemensperfootQuantity.Value, SiemensPerFootTolerance); @@ -123,30 +123,30 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); - AssertEx.EqualTolerance(1, ElectricConductivity.FromSiemensPerFoot(siemenspermeter.SiemensPerFoot).SiemensPerMeter, SiemensPerFootTolerance); - AssertEx.EqualTolerance(1, ElectricConductivity.FromSiemensPerInch(siemenspermeter.SiemensPerInch).SiemensPerMeter, SiemensPerInchTolerance); - AssertEx.EqualTolerance(1, ElectricConductivity.FromSiemensPerMeter(siemenspermeter.SiemensPerMeter).SiemensPerMeter, SiemensPerMeterTolerance); + ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); + AssertEx.EqualTolerance(1, ElectricConductivity.FromSiemensPerFoot(siemenspermeter.SiemensPerFoot).SiemensPerMeter, SiemensPerFootTolerance); + AssertEx.EqualTolerance(1, ElectricConductivity.FromSiemensPerInch(siemenspermeter.SiemensPerInch).SiemensPerMeter, SiemensPerInchTolerance); + AssertEx.EqualTolerance(1, ElectricConductivity.FromSiemensPerMeter(siemenspermeter.SiemensPerMeter).SiemensPerMeter, SiemensPerMeterTolerance); } [Fact] public void ArithmeticOperators() { - ElectricConductivity v = ElectricConductivity.FromSiemensPerMeter(1); + ElectricConductivity v = ElectricConductivity.FromSiemensPerMeter(1); AssertEx.EqualTolerance(-1, -v.SiemensPerMeter, SiemensPerMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricConductivity.FromSiemensPerMeter(3)-v).SiemensPerMeter, SiemensPerMeterTolerance); + AssertEx.EqualTolerance(2, (ElectricConductivity.FromSiemensPerMeter(3)-v).SiemensPerMeter, SiemensPerMeterTolerance); AssertEx.EqualTolerance(2, (v + v).SiemensPerMeter, SiemensPerMeterTolerance); AssertEx.EqualTolerance(10, (v*10).SiemensPerMeter, SiemensPerMeterTolerance); AssertEx.EqualTolerance(10, (10*v).SiemensPerMeter, SiemensPerMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricConductivity.FromSiemensPerMeter(10)/5).SiemensPerMeter, SiemensPerMeterTolerance); - AssertEx.EqualTolerance(2, ElectricConductivity.FromSiemensPerMeter(10)/ElectricConductivity.FromSiemensPerMeter(5), SiemensPerMeterTolerance); + AssertEx.EqualTolerance(2, (ElectricConductivity.FromSiemensPerMeter(10)/5).SiemensPerMeter, SiemensPerMeterTolerance); + AssertEx.EqualTolerance(2, ElectricConductivity.FromSiemensPerMeter(10)/ElectricConductivity.FromSiemensPerMeter(5), SiemensPerMeterTolerance); } [Fact] public void ComparisonOperators() { - ElectricConductivity oneSiemensPerMeter = ElectricConductivity.FromSiemensPerMeter(1); - ElectricConductivity twoSiemensPerMeter = ElectricConductivity.FromSiemensPerMeter(2); + ElectricConductivity oneSiemensPerMeter = ElectricConductivity.FromSiemensPerMeter(1); + ElectricConductivity twoSiemensPerMeter = ElectricConductivity.FromSiemensPerMeter(2); Assert.True(oneSiemensPerMeter < twoSiemensPerMeter); Assert.True(oneSiemensPerMeter <= twoSiemensPerMeter); @@ -162,31 +162,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); + ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); Assert.Equal(0, siemenspermeter.CompareTo(siemenspermeter)); - Assert.True(siemenspermeter.CompareTo(ElectricConductivity.Zero) > 0); - Assert.True(ElectricConductivity.Zero.CompareTo(siemenspermeter) < 0); + Assert.True(siemenspermeter.CompareTo(ElectricConductivity.Zero) > 0); + Assert.True(ElectricConductivity.Zero.CompareTo(siemenspermeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); + ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); Assert.Throws(() => siemenspermeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); + ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); Assert.Throws(() => siemenspermeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ElectricConductivity.FromSiemensPerMeter(1); - var b = ElectricConductivity.FromSiemensPerMeter(2); + var a = ElectricConductivity.FromSiemensPerMeter(1); + var b = ElectricConductivity.FromSiemensPerMeter(2); // ReSharper disable EqualExpressionComparison @@ -205,8 +205,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ElectricConductivity.FromSiemensPerMeter(1); - var b = ElectricConductivity.FromSiemensPerMeter(2); + var a = ElectricConductivity.FromSiemensPerMeter(1); + var b = ElectricConductivity.FromSiemensPerMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -216,29 +216,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ElectricConductivity.FromSiemensPerMeter(1); - Assert.True(v.Equals(ElectricConductivity.FromSiemensPerMeter(1), SiemensPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricConductivity.Zero, SiemensPerMeterTolerance, ComparisonType.Relative)); + var v = ElectricConductivity.FromSiemensPerMeter(1); + Assert.True(v.Equals(ElectricConductivity.FromSiemensPerMeter(1), SiemensPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricConductivity.Zero, SiemensPerMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); + ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); Assert.False(siemenspermeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); + ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); Assert.False(siemenspermeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ElectricConductivityUnit.Undefined, ElectricConductivity.Units); + Assert.DoesNotContain(ElectricConductivityUnit.Undefined, ElectricConductivity.Units); } [Fact] @@ -257,7 +257,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ElectricConductivity.BaseDimensions is null); + Assert.False(ElectricConductivity.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs index fa3f73e78e..f8c4c7f4cd 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of ElectricCurrentDensity. + /// Test of ElectricCurrentDensity. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class ElectricCurrentDensityTestsBase @@ -47,26 +47,26 @@ public abstract partial class ElectricCurrentDensityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ElectricCurrentDensity((double)0.0, ElectricCurrentDensityUnit.Undefined)); + Assert.Throws(() => new ElectricCurrentDensity((double)0.0, ElectricCurrentDensityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricCurrentDensity(double.PositiveInfinity, ElectricCurrentDensityUnit.AmperePerSquareMeter)); - Assert.Throws(() => new ElectricCurrentDensity(double.NegativeInfinity, ElectricCurrentDensityUnit.AmperePerSquareMeter)); + Assert.Throws(() => new ElectricCurrentDensity(double.PositiveInfinity, ElectricCurrentDensityUnit.AmperePerSquareMeter)); + Assert.Throws(() => new ElectricCurrentDensity(double.NegativeInfinity, ElectricCurrentDensityUnit.AmperePerSquareMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricCurrentDensity(double.NaN, ElectricCurrentDensityUnit.AmperePerSquareMeter)); + Assert.Throws(() => new ElectricCurrentDensity(double.NaN, ElectricCurrentDensityUnit.AmperePerSquareMeter)); } [Fact] public void AmperePerSquareMeterToElectricCurrentDensityUnits() { - ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); + ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); AssertEx.EqualTolerance(AmperesPerSquareFootInOneAmperePerSquareMeter, amperepersquaremeter.AmperesPerSquareFoot, AmperesPerSquareFootTolerance); AssertEx.EqualTolerance(AmperesPerSquareInchInOneAmperePerSquareMeter, amperepersquaremeter.AmperesPerSquareInch, AmperesPerSquareInchTolerance); AssertEx.EqualTolerance(AmperesPerSquareMeterInOneAmperePerSquareMeter, amperepersquaremeter.AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); @@ -75,28 +75,28 @@ public void AmperePerSquareMeterToElectricCurrentDensityUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ElectricCurrentDensity.From(1, ElectricCurrentDensityUnit.AmperePerSquareFoot).AmperesPerSquareFoot, AmperesPerSquareFootTolerance); - AssertEx.EqualTolerance(1, ElectricCurrentDensity.From(1, ElectricCurrentDensityUnit.AmperePerSquareInch).AmperesPerSquareInch, AmperesPerSquareInchTolerance); - AssertEx.EqualTolerance(1, ElectricCurrentDensity.From(1, ElectricCurrentDensityUnit.AmperePerSquareMeter).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, ElectricCurrentDensity.From(1, ElectricCurrentDensityUnit.AmperePerSquareFoot).AmperesPerSquareFoot, AmperesPerSquareFootTolerance); + AssertEx.EqualTolerance(1, ElectricCurrentDensity.From(1, ElectricCurrentDensityUnit.AmperePerSquareInch).AmperesPerSquareInch, AmperesPerSquareInchTolerance); + AssertEx.EqualTolerance(1, ElectricCurrentDensity.From(1, ElectricCurrentDensityUnit.AmperePerSquareMeter).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); } [Fact] public void FromAmperesPerSquareMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.NegativeInfinity)); + Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.NegativeInfinity)); } [Fact] public void FromAmperesPerSquareMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.NaN)); + Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.NaN)); } [Fact] public void As() { - var amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); + var amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); AssertEx.EqualTolerance(AmperesPerSquareFootInOneAmperePerSquareMeter, amperepersquaremeter.As(ElectricCurrentDensityUnit.AmperePerSquareFoot), AmperesPerSquareFootTolerance); AssertEx.EqualTolerance(AmperesPerSquareInchInOneAmperePerSquareMeter, amperepersquaremeter.As(ElectricCurrentDensityUnit.AmperePerSquareInch), AmperesPerSquareInchTolerance); AssertEx.EqualTolerance(AmperesPerSquareMeterInOneAmperePerSquareMeter, amperepersquaremeter.As(ElectricCurrentDensityUnit.AmperePerSquareMeter), AmperesPerSquareMeterTolerance); @@ -105,7 +105,7 @@ public void As() [Fact] public void ToUnit() { - var amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); + var amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); var amperepersquarefootQuantity = amperepersquaremeter.ToUnit(ElectricCurrentDensityUnit.AmperePerSquareFoot); AssertEx.EqualTolerance(AmperesPerSquareFootInOneAmperePerSquareMeter, (double)amperepersquarefootQuantity.Value, AmperesPerSquareFootTolerance); @@ -123,30 +123,30 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - AssertEx.EqualTolerance(1, ElectricCurrentDensity.FromAmperesPerSquareFoot(amperepersquaremeter.AmperesPerSquareFoot).AmperesPerSquareMeter, AmperesPerSquareFootTolerance); - AssertEx.EqualTolerance(1, ElectricCurrentDensity.FromAmperesPerSquareInch(amperepersquaremeter.AmperesPerSquareInch).AmperesPerSquareMeter, AmperesPerSquareInchTolerance); - AssertEx.EqualTolerance(1, ElectricCurrentDensity.FromAmperesPerSquareMeter(amperepersquaremeter.AmperesPerSquareMeter).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); + ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); + AssertEx.EqualTolerance(1, ElectricCurrentDensity.FromAmperesPerSquareFoot(amperepersquaremeter.AmperesPerSquareFoot).AmperesPerSquareMeter, AmperesPerSquareFootTolerance); + AssertEx.EqualTolerance(1, ElectricCurrentDensity.FromAmperesPerSquareInch(amperepersquaremeter.AmperesPerSquareInch).AmperesPerSquareMeter, AmperesPerSquareInchTolerance); + AssertEx.EqualTolerance(1, ElectricCurrentDensity.FromAmperesPerSquareMeter(amperepersquaremeter.AmperesPerSquareMeter).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); } [Fact] public void ArithmeticOperators() { - ElectricCurrentDensity v = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); + ElectricCurrentDensity v = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); AssertEx.EqualTolerance(-1, -v.AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricCurrentDensity.FromAmperesPerSquareMeter(3)-v).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, (ElectricCurrentDensity.FromAmperesPerSquareMeter(3)-v).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); AssertEx.EqualTolerance(2, (v + v).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); AssertEx.EqualTolerance(10, (v*10).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); AssertEx.EqualTolerance(10, (10*v).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricCurrentDensity.FromAmperesPerSquareMeter(10)/5).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, ElectricCurrentDensity.FromAmperesPerSquareMeter(10)/ElectricCurrentDensity.FromAmperesPerSquareMeter(5), AmperesPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, (ElectricCurrentDensity.FromAmperesPerSquareMeter(10)/5).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, ElectricCurrentDensity.FromAmperesPerSquareMeter(10)/ElectricCurrentDensity.FromAmperesPerSquareMeter(5), AmperesPerSquareMeterTolerance); } [Fact] public void ComparisonOperators() { - ElectricCurrentDensity oneAmperePerSquareMeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - ElectricCurrentDensity twoAmperesPerSquareMeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(2); + ElectricCurrentDensity oneAmperePerSquareMeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); + ElectricCurrentDensity twoAmperesPerSquareMeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(2); Assert.True(oneAmperePerSquareMeter < twoAmperesPerSquareMeter); Assert.True(oneAmperePerSquareMeter <= twoAmperesPerSquareMeter); @@ -162,31 +162,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); + ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); Assert.Equal(0, amperepersquaremeter.CompareTo(amperepersquaremeter)); - Assert.True(amperepersquaremeter.CompareTo(ElectricCurrentDensity.Zero) > 0); - Assert.True(ElectricCurrentDensity.Zero.CompareTo(amperepersquaremeter) < 0); + Assert.True(amperepersquaremeter.CompareTo(ElectricCurrentDensity.Zero) > 0); + Assert.True(ElectricCurrentDensity.Zero.CompareTo(amperepersquaremeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); + ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); Assert.Throws(() => amperepersquaremeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); + ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); Assert.Throws(() => amperepersquaremeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - var b = ElectricCurrentDensity.FromAmperesPerSquareMeter(2); + var a = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); + var b = ElectricCurrentDensity.FromAmperesPerSquareMeter(2); // ReSharper disable EqualExpressionComparison @@ -205,8 +205,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - var b = ElectricCurrentDensity.FromAmperesPerSquareMeter(2); + var a = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); + var b = ElectricCurrentDensity.FromAmperesPerSquareMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -216,29 +216,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - Assert.True(v.Equals(ElectricCurrentDensity.FromAmperesPerSquareMeter(1), AmperesPerSquareMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricCurrentDensity.Zero, AmperesPerSquareMeterTolerance, ComparisonType.Relative)); + var v = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); + Assert.True(v.Equals(ElectricCurrentDensity.FromAmperesPerSquareMeter(1), AmperesPerSquareMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricCurrentDensity.Zero, AmperesPerSquareMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); + ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); Assert.False(amperepersquaremeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); + ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); Assert.False(amperepersquaremeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ElectricCurrentDensityUnit.Undefined, ElectricCurrentDensity.Units); + Assert.DoesNotContain(ElectricCurrentDensityUnit.Undefined, ElectricCurrentDensity.Units); } [Fact] @@ -257,7 +257,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ElectricCurrentDensity.BaseDimensions is null); + Assert.False(ElectricCurrentDensity.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs index 509538a253..b972687008 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs @@ -43,59 +43,59 @@ public abstract partial class ElectricCurrentGradientTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ElectricCurrentGradient((double)0.0, ElectricCurrentGradientUnit.Undefined)); + Assert.Throws(() => new ElectricCurrentGradient((double)0.0, ElectricCurrentGradientUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricCurrentGradient(double.PositiveInfinity, ElectricCurrentGradientUnit.AmperePerSecond)); - Assert.Throws(() => new ElectricCurrentGradient(double.NegativeInfinity, ElectricCurrentGradientUnit.AmperePerSecond)); + Assert.Throws(() => new ElectricCurrentGradient(double.PositiveInfinity, ElectricCurrentGradientUnit.AmperePerSecond)); + Assert.Throws(() => new ElectricCurrentGradient(double.NegativeInfinity, ElectricCurrentGradientUnit.AmperePerSecond)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricCurrentGradient(double.NaN, ElectricCurrentGradientUnit.AmperePerSecond)); + Assert.Throws(() => new ElectricCurrentGradient(double.NaN, ElectricCurrentGradientUnit.AmperePerSecond)); } [Fact] public void AmperePerSecondToElectricCurrentGradientUnits() { - ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); + ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); AssertEx.EqualTolerance(AmperesPerSecondInOneAmperePerSecond, amperepersecond.AmperesPerSecond, AmperesPerSecondTolerance); } [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ElectricCurrentGradient.From(1, ElectricCurrentGradientUnit.AmperePerSecond).AmperesPerSecond, AmperesPerSecondTolerance); + AssertEx.EqualTolerance(1, ElectricCurrentGradient.From(1, ElectricCurrentGradientUnit.AmperePerSecond).AmperesPerSecond, AmperesPerSecondTolerance); } [Fact] public void FromAmperesPerSecond_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.PositiveInfinity)); - Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.NegativeInfinity)); + Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.PositiveInfinity)); + Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.NegativeInfinity)); } [Fact] public void FromAmperesPerSecond_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.NaN)); + Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.NaN)); } [Fact] public void As() { - var amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); + var amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); AssertEx.EqualTolerance(AmperesPerSecondInOneAmperePerSecond, amperepersecond.As(ElectricCurrentGradientUnit.AmperePerSecond), AmperesPerSecondTolerance); } [Fact] public void ToUnit() { - var amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); + var amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); var amperepersecondQuantity = amperepersecond.ToUnit(ElectricCurrentGradientUnit.AmperePerSecond); AssertEx.EqualTolerance(AmperesPerSecondInOneAmperePerSecond, (double)amperepersecondQuantity.Value, AmperesPerSecondTolerance); @@ -105,28 +105,28 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); - AssertEx.EqualTolerance(1, ElectricCurrentGradient.FromAmperesPerSecond(amperepersecond.AmperesPerSecond).AmperesPerSecond, AmperesPerSecondTolerance); + ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); + AssertEx.EqualTolerance(1, ElectricCurrentGradient.FromAmperesPerSecond(amperepersecond.AmperesPerSecond).AmperesPerSecond, AmperesPerSecondTolerance); } [Fact] public void ArithmeticOperators() { - ElectricCurrentGradient v = ElectricCurrentGradient.FromAmperesPerSecond(1); + ElectricCurrentGradient v = ElectricCurrentGradient.FromAmperesPerSecond(1); AssertEx.EqualTolerance(-1, -v.AmperesPerSecond, AmperesPerSecondTolerance); - AssertEx.EqualTolerance(2, (ElectricCurrentGradient.FromAmperesPerSecond(3)-v).AmperesPerSecond, AmperesPerSecondTolerance); + AssertEx.EqualTolerance(2, (ElectricCurrentGradient.FromAmperesPerSecond(3)-v).AmperesPerSecond, AmperesPerSecondTolerance); AssertEx.EqualTolerance(2, (v + v).AmperesPerSecond, AmperesPerSecondTolerance); AssertEx.EqualTolerance(10, (v*10).AmperesPerSecond, AmperesPerSecondTolerance); AssertEx.EqualTolerance(10, (10*v).AmperesPerSecond, AmperesPerSecondTolerance); - AssertEx.EqualTolerance(2, (ElectricCurrentGradient.FromAmperesPerSecond(10)/5).AmperesPerSecond, AmperesPerSecondTolerance); - AssertEx.EqualTolerance(2, ElectricCurrentGradient.FromAmperesPerSecond(10)/ElectricCurrentGradient.FromAmperesPerSecond(5), AmperesPerSecondTolerance); + AssertEx.EqualTolerance(2, (ElectricCurrentGradient.FromAmperesPerSecond(10)/5).AmperesPerSecond, AmperesPerSecondTolerance); + AssertEx.EqualTolerance(2, ElectricCurrentGradient.FromAmperesPerSecond(10)/ElectricCurrentGradient.FromAmperesPerSecond(5), AmperesPerSecondTolerance); } [Fact] public void ComparisonOperators() { - ElectricCurrentGradient oneAmperePerSecond = ElectricCurrentGradient.FromAmperesPerSecond(1); - ElectricCurrentGradient twoAmperesPerSecond = ElectricCurrentGradient.FromAmperesPerSecond(2); + ElectricCurrentGradient oneAmperePerSecond = ElectricCurrentGradient.FromAmperesPerSecond(1); + ElectricCurrentGradient twoAmperesPerSecond = ElectricCurrentGradient.FromAmperesPerSecond(2); Assert.True(oneAmperePerSecond < twoAmperesPerSecond); Assert.True(oneAmperePerSecond <= twoAmperesPerSecond); @@ -142,31 +142,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); + ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); Assert.Equal(0, amperepersecond.CompareTo(amperepersecond)); - Assert.True(amperepersecond.CompareTo(ElectricCurrentGradient.Zero) > 0); - Assert.True(ElectricCurrentGradient.Zero.CompareTo(amperepersecond) < 0); + Assert.True(amperepersecond.CompareTo(ElectricCurrentGradient.Zero) > 0); + Assert.True(ElectricCurrentGradient.Zero.CompareTo(amperepersecond) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); + ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); Assert.Throws(() => amperepersecond.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); + ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); Assert.Throws(() => amperepersecond.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ElectricCurrentGradient.FromAmperesPerSecond(1); - var b = ElectricCurrentGradient.FromAmperesPerSecond(2); + var a = ElectricCurrentGradient.FromAmperesPerSecond(1); + var b = ElectricCurrentGradient.FromAmperesPerSecond(2); // ReSharper disable EqualExpressionComparison @@ -185,8 +185,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ElectricCurrentGradient.FromAmperesPerSecond(1); - var b = ElectricCurrentGradient.FromAmperesPerSecond(2); + var a = ElectricCurrentGradient.FromAmperesPerSecond(1); + var b = ElectricCurrentGradient.FromAmperesPerSecond(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -196,29 +196,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ElectricCurrentGradient.FromAmperesPerSecond(1); - Assert.True(v.Equals(ElectricCurrentGradient.FromAmperesPerSecond(1), AmperesPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricCurrentGradient.Zero, AmperesPerSecondTolerance, ComparisonType.Relative)); + var v = ElectricCurrentGradient.FromAmperesPerSecond(1); + Assert.True(v.Equals(ElectricCurrentGradient.FromAmperesPerSecond(1), AmperesPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricCurrentGradient.Zero, AmperesPerSecondTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); + ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); Assert.False(amperepersecond.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); + ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); Assert.False(amperepersecond.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ElectricCurrentGradientUnit.Undefined, ElectricCurrentGradient.Units); + Assert.DoesNotContain(ElectricCurrentGradientUnit.Undefined, ElectricCurrentGradient.Units); } [Fact] @@ -237,7 +237,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ElectricCurrentGradient.BaseDimensions is null); + Assert.False(ElectricCurrentGradient.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs index 68da583188..4cc1204b03 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs @@ -57,26 +57,26 @@ public abstract partial class ElectricCurrentTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ElectricCurrent((double)0.0, ElectricCurrentUnit.Undefined)); + Assert.Throws(() => new ElectricCurrent((double)0.0, ElectricCurrentUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricCurrent(double.PositiveInfinity, ElectricCurrentUnit.Ampere)); - Assert.Throws(() => new ElectricCurrent(double.NegativeInfinity, ElectricCurrentUnit.Ampere)); + Assert.Throws(() => new ElectricCurrent(double.PositiveInfinity, ElectricCurrentUnit.Ampere)); + Assert.Throws(() => new ElectricCurrent(double.NegativeInfinity, ElectricCurrentUnit.Ampere)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricCurrent(double.NaN, ElectricCurrentUnit.Ampere)); + Assert.Throws(() => new ElectricCurrent(double.NaN, ElectricCurrentUnit.Ampere)); } [Fact] public void AmpereToElectricCurrentUnits() { - ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); + ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); AssertEx.EqualTolerance(AmperesInOneAmpere, ampere.Amperes, AmperesTolerance); AssertEx.EqualTolerance(CentiamperesInOneAmpere, ampere.Centiamperes, CentiamperesTolerance); AssertEx.EqualTolerance(KiloamperesInOneAmpere, ampere.Kiloamperes, KiloamperesTolerance); @@ -90,33 +90,33 @@ public void AmpereToElectricCurrentUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Ampere).Amperes, AmperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Centiampere).Centiamperes, CentiamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Kiloampere).Kiloamperes, KiloamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Megaampere).Megaamperes, MegaamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Microampere).Microamperes, MicroamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Milliampere).Milliamperes, MilliamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Nanoampere).Nanoamperes, NanoamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Picoampere).Picoamperes, PicoamperesTolerance); + AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Ampere).Amperes, AmperesTolerance); + AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Centiampere).Centiamperes, CentiamperesTolerance); + AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Kiloampere).Kiloamperes, KiloamperesTolerance); + AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Megaampere).Megaamperes, MegaamperesTolerance); + AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Microampere).Microamperes, MicroamperesTolerance); + AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Milliampere).Milliamperes, MilliamperesTolerance); + AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Nanoampere).Nanoamperes, NanoamperesTolerance); + AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Picoampere).Picoamperes, PicoamperesTolerance); } [Fact] public void FromAmperes_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricCurrent.FromAmperes(double.PositiveInfinity)); - Assert.Throws(() => ElectricCurrent.FromAmperes(double.NegativeInfinity)); + Assert.Throws(() => ElectricCurrent.FromAmperes(double.PositiveInfinity)); + Assert.Throws(() => ElectricCurrent.FromAmperes(double.NegativeInfinity)); } [Fact] public void FromAmperes_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricCurrent.FromAmperes(double.NaN)); + Assert.Throws(() => ElectricCurrent.FromAmperes(double.NaN)); } [Fact] public void As() { - var ampere = ElectricCurrent.FromAmperes(1); + var ampere = ElectricCurrent.FromAmperes(1); AssertEx.EqualTolerance(AmperesInOneAmpere, ampere.As(ElectricCurrentUnit.Ampere), AmperesTolerance); AssertEx.EqualTolerance(CentiamperesInOneAmpere, ampere.As(ElectricCurrentUnit.Centiampere), CentiamperesTolerance); AssertEx.EqualTolerance(KiloamperesInOneAmpere, ampere.As(ElectricCurrentUnit.Kiloampere), KiloamperesTolerance); @@ -130,7 +130,7 @@ public void As() [Fact] public void ToUnit() { - var ampere = ElectricCurrent.FromAmperes(1); + var ampere = ElectricCurrent.FromAmperes(1); var ampereQuantity = ampere.ToUnit(ElectricCurrentUnit.Ampere); AssertEx.EqualTolerance(AmperesInOneAmpere, (double)ampereQuantity.Value, AmperesTolerance); @@ -168,35 +168,35 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); - AssertEx.EqualTolerance(1, ElectricCurrent.FromAmperes(ampere.Amperes).Amperes, AmperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.FromCentiamperes(ampere.Centiamperes).Amperes, CentiamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.FromKiloamperes(ampere.Kiloamperes).Amperes, KiloamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.FromMegaamperes(ampere.Megaamperes).Amperes, MegaamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.FromMicroamperes(ampere.Microamperes).Amperes, MicroamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.FromMilliamperes(ampere.Milliamperes).Amperes, MilliamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.FromNanoamperes(ampere.Nanoamperes).Amperes, NanoamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.FromPicoamperes(ampere.Picoamperes).Amperes, PicoamperesTolerance); + ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); + AssertEx.EqualTolerance(1, ElectricCurrent.FromAmperes(ampere.Amperes).Amperes, AmperesTolerance); + AssertEx.EqualTolerance(1, ElectricCurrent.FromCentiamperes(ampere.Centiamperes).Amperes, CentiamperesTolerance); + AssertEx.EqualTolerance(1, ElectricCurrent.FromKiloamperes(ampere.Kiloamperes).Amperes, KiloamperesTolerance); + AssertEx.EqualTolerance(1, ElectricCurrent.FromMegaamperes(ampere.Megaamperes).Amperes, MegaamperesTolerance); + AssertEx.EqualTolerance(1, ElectricCurrent.FromMicroamperes(ampere.Microamperes).Amperes, MicroamperesTolerance); + AssertEx.EqualTolerance(1, ElectricCurrent.FromMilliamperes(ampere.Milliamperes).Amperes, MilliamperesTolerance); + AssertEx.EqualTolerance(1, ElectricCurrent.FromNanoamperes(ampere.Nanoamperes).Amperes, NanoamperesTolerance); + AssertEx.EqualTolerance(1, ElectricCurrent.FromPicoamperes(ampere.Picoamperes).Amperes, PicoamperesTolerance); } [Fact] public void ArithmeticOperators() { - ElectricCurrent v = ElectricCurrent.FromAmperes(1); + ElectricCurrent v = ElectricCurrent.FromAmperes(1); AssertEx.EqualTolerance(-1, -v.Amperes, AmperesTolerance); - AssertEx.EqualTolerance(2, (ElectricCurrent.FromAmperes(3)-v).Amperes, AmperesTolerance); + AssertEx.EqualTolerance(2, (ElectricCurrent.FromAmperes(3)-v).Amperes, AmperesTolerance); AssertEx.EqualTolerance(2, (v + v).Amperes, AmperesTolerance); AssertEx.EqualTolerance(10, (v*10).Amperes, AmperesTolerance); AssertEx.EqualTolerance(10, (10*v).Amperes, AmperesTolerance); - AssertEx.EqualTolerance(2, (ElectricCurrent.FromAmperes(10)/5).Amperes, AmperesTolerance); - AssertEx.EqualTolerance(2, ElectricCurrent.FromAmperes(10)/ElectricCurrent.FromAmperes(5), AmperesTolerance); + AssertEx.EqualTolerance(2, (ElectricCurrent.FromAmperes(10)/5).Amperes, AmperesTolerance); + AssertEx.EqualTolerance(2, ElectricCurrent.FromAmperes(10)/ElectricCurrent.FromAmperes(5), AmperesTolerance); } [Fact] public void ComparisonOperators() { - ElectricCurrent oneAmpere = ElectricCurrent.FromAmperes(1); - ElectricCurrent twoAmperes = ElectricCurrent.FromAmperes(2); + ElectricCurrent oneAmpere = ElectricCurrent.FromAmperes(1); + ElectricCurrent twoAmperes = ElectricCurrent.FromAmperes(2); Assert.True(oneAmpere < twoAmperes); Assert.True(oneAmpere <= twoAmperes); @@ -212,31 +212,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); + ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); Assert.Equal(0, ampere.CompareTo(ampere)); - Assert.True(ampere.CompareTo(ElectricCurrent.Zero) > 0); - Assert.True(ElectricCurrent.Zero.CompareTo(ampere) < 0); + Assert.True(ampere.CompareTo(ElectricCurrent.Zero) > 0); + Assert.True(ElectricCurrent.Zero.CompareTo(ampere) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); + ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); Assert.Throws(() => ampere.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); + ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); Assert.Throws(() => ampere.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ElectricCurrent.FromAmperes(1); - var b = ElectricCurrent.FromAmperes(2); + var a = ElectricCurrent.FromAmperes(1); + var b = ElectricCurrent.FromAmperes(2); // ReSharper disable EqualExpressionComparison @@ -255,8 +255,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ElectricCurrent.FromAmperes(1); - var b = ElectricCurrent.FromAmperes(2); + var a = ElectricCurrent.FromAmperes(1); + var b = ElectricCurrent.FromAmperes(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -266,29 +266,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ElectricCurrent.FromAmperes(1); - Assert.True(v.Equals(ElectricCurrent.FromAmperes(1), AmperesTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricCurrent.Zero, AmperesTolerance, ComparisonType.Relative)); + var v = ElectricCurrent.FromAmperes(1); + Assert.True(v.Equals(ElectricCurrent.FromAmperes(1), AmperesTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricCurrent.Zero, AmperesTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); + ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); Assert.False(ampere.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); + ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); Assert.False(ampere.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ElectricCurrentUnit.Undefined, ElectricCurrent.Units); + Assert.DoesNotContain(ElectricCurrentUnit.Undefined, ElectricCurrent.Units); } [Fact] @@ -307,7 +307,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ElectricCurrent.BaseDimensions is null); + Assert.False(ElectricCurrent.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs index 5344b0a213..2ed2eb5dd3 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs @@ -43,59 +43,59 @@ public abstract partial class ElectricFieldTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ElectricField((double)0.0, ElectricFieldUnit.Undefined)); + Assert.Throws(() => new ElectricField((double)0.0, ElectricFieldUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricField(double.PositiveInfinity, ElectricFieldUnit.VoltPerMeter)); - Assert.Throws(() => new ElectricField(double.NegativeInfinity, ElectricFieldUnit.VoltPerMeter)); + Assert.Throws(() => new ElectricField(double.PositiveInfinity, ElectricFieldUnit.VoltPerMeter)); + Assert.Throws(() => new ElectricField(double.NegativeInfinity, ElectricFieldUnit.VoltPerMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricField(double.NaN, ElectricFieldUnit.VoltPerMeter)); + Assert.Throws(() => new ElectricField(double.NaN, ElectricFieldUnit.VoltPerMeter)); } [Fact] public void VoltPerMeterToElectricFieldUnits() { - ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); + ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); AssertEx.EqualTolerance(VoltsPerMeterInOneVoltPerMeter, voltpermeter.VoltsPerMeter, VoltsPerMeterTolerance); } [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ElectricField.From(1, ElectricFieldUnit.VoltPerMeter).VoltsPerMeter, VoltsPerMeterTolerance); + AssertEx.EqualTolerance(1, ElectricField.From(1, ElectricFieldUnit.VoltPerMeter).VoltsPerMeter, VoltsPerMeterTolerance); } [Fact] public void FromVoltsPerMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.PositiveInfinity)); - Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.NegativeInfinity)); + Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.PositiveInfinity)); + Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.NegativeInfinity)); } [Fact] public void FromVoltsPerMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.NaN)); + Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.NaN)); } [Fact] public void As() { - var voltpermeter = ElectricField.FromVoltsPerMeter(1); + var voltpermeter = ElectricField.FromVoltsPerMeter(1); AssertEx.EqualTolerance(VoltsPerMeterInOneVoltPerMeter, voltpermeter.As(ElectricFieldUnit.VoltPerMeter), VoltsPerMeterTolerance); } [Fact] public void ToUnit() { - var voltpermeter = ElectricField.FromVoltsPerMeter(1); + var voltpermeter = ElectricField.FromVoltsPerMeter(1); var voltpermeterQuantity = voltpermeter.ToUnit(ElectricFieldUnit.VoltPerMeter); AssertEx.EqualTolerance(VoltsPerMeterInOneVoltPerMeter, (double)voltpermeterQuantity.Value, VoltsPerMeterTolerance); @@ -105,28 +105,28 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); - AssertEx.EqualTolerance(1, ElectricField.FromVoltsPerMeter(voltpermeter.VoltsPerMeter).VoltsPerMeter, VoltsPerMeterTolerance); + ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); + AssertEx.EqualTolerance(1, ElectricField.FromVoltsPerMeter(voltpermeter.VoltsPerMeter).VoltsPerMeter, VoltsPerMeterTolerance); } [Fact] public void ArithmeticOperators() { - ElectricField v = ElectricField.FromVoltsPerMeter(1); + ElectricField v = ElectricField.FromVoltsPerMeter(1); AssertEx.EqualTolerance(-1, -v.VoltsPerMeter, VoltsPerMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricField.FromVoltsPerMeter(3)-v).VoltsPerMeter, VoltsPerMeterTolerance); + AssertEx.EqualTolerance(2, (ElectricField.FromVoltsPerMeter(3)-v).VoltsPerMeter, VoltsPerMeterTolerance); AssertEx.EqualTolerance(2, (v + v).VoltsPerMeter, VoltsPerMeterTolerance); AssertEx.EqualTolerance(10, (v*10).VoltsPerMeter, VoltsPerMeterTolerance); AssertEx.EqualTolerance(10, (10*v).VoltsPerMeter, VoltsPerMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricField.FromVoltsPerMeter(10)/5).VoltsPerMeter, VoltsPerMeterTolerance); - AssertEx.EqualTolerance(2, ElectricField.FromVoltsPerMeter(10)/ElectricField.FromVoltsPerMeter(5), VoltsPerMeterTolerance); + AssertEx.EqualTolerance(2, (ElectricField.FromVoltsPerMeter(10)/5).VoltsPerMeter, VoltsPerMeterTolerance); + AssertEx.EqualTolerance(2, ElectricField.FromVoltsPerMeter(10)/ElectricField.FromVoltsPerMeter(5), VoltsPerMeterTolerance); } [Fact] public void ComparisonOperators() { - ElectricField oneVoltPerMeter = ElectricField.FromVoltsPerMeter(1); - ElectricField twoVoltsPerMeter = ElectricField.FromVoltsPerMeter(2); + ElectricField oneVoltPerMeter = ElectricField.FromVoltsPerMeter(1); + ElectricField twoVoltsPerMeter = ElectricField.FromVoltsPerMeter(2); Assert.True(oneVoltPerMeter < twoVoltsPerMeter); Assert.True(oneVoltPerMeter <= twoVoltsPerMeter); @@ -142,31 +142,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); + ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); Assert.Equal(0, voltpermeter.CompareTo(voltpermeter)); - Assert.True(voltpermeter.CompareTo(ElectricField.Zero) > 0); - Assert.True(ElectricField.Zero.CompareTo(voltpermeter) < 0); + Assert.True(voltpermeter.CompareTo(ElectricField.Zero) > 0); + Assert.True(ElectricField.Zero.CompareTo(voltpermeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); + ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); Assert.Throws(() => voltpermeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); + ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); Assert.Throws(() => voltpermeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ElectricField.FromVoltsPerMeter(1); - var b = ElectricField.FromVoltsPerMeter(2); + var a = ElectricField.FromVoltsPerMeter(1); + var b = ElectricField.FromVoltsPerMeter(2); // ReSharper disable EqualExpressionComparison @@ -185,8 +185,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ElectricField.FromVoltsPerMeter(1); - var b = ElectricField.FromVoltsPerMeter(2); + var a = ElectricField.FromVoltsPerMeter(1); + var b = ElectricField.FromVoltsPerMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -196,29 +196,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ElectricField.FromVoltsPerMeter(1); - Assert.True(v.Equals(ElectricField.FromVoltsPerMeter(1), VoltsPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricField.Zero, VoltsPerMeterTolerance, ComparisonType.Relative)); + var v = ElectricField.FromVoltsPerMeter(1); + Assert.True(v.Equals(ElectricField.FromVoltsPerMeter(1), VoltsPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricField.Zero, VoltsPerMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); + ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); Assert.False(voltpermeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); + ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); Assert.False(voltpermeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ElectricFieldUnit.Undefined, ElectricField.Units); + Assert.DoesNotContain(ElectricFieldUnit.Undefined, ElectricField.Units); } [Fact] @@ -237,7 +237,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ElectricField.BaseDimensions is null); + Assert.False(ElectricField.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs index e9e040c22b..f81ea5d4ba 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs @@ -49,26 +49,26 @@ public abstract partial class ElectricInductanceTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ElectricInductance((double)0.0, ElectricInductanceUnit.Undefined)); + Assert.Throws(() => new ElectricInductance((double)0.0, ElectricInductanceUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricInductance(double.PositiveInfinity, ElectricInductanceUnit.Henry)); - Assert.Throws(() => new ElectricInductance(double.NegativeInfinity, ElectricInductanceUnit.Henry)); + Assert.Throws(() => new ElectricInductance(double.PositiveInfinity, ElectricInductanceUnit.Henry)); + Assert.Throws(() => new ElectricInductance(double.NegativeInfinity, ElectricInductanceUnit.Henry)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricInductance(double.NaN, ElectricInductanceUnit.Henry)); + Assert.Throws(() => new ElectricInductance(double.NaN, ElectricInductanceUnit.Henry)); } [Fact] public void HenryToElectricInductanceUnits() { - ElectricInductance henry = ElectricInductance.FromHenries(1); + ElectricInductance henry = ElectricInductance.FromHenries(1); AssertEx.EqualTolerance(HenriesInOneHenry, henry.Henries, HenriesTolerance); AssertEx.EqualTolerance(MicrohenriesInOneHenry, henry.Microhenries, MicrohenriesTolerance); AssertEx.EqualTolerance(MillihenriesInOneHenry, henry.Millihenries, MillihenriesTolerance); @@ -78,29 +78,29 @@ public void HenryToElectricInductanceUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ElectricInductance.From(1, ElectricInductanceUnit.Henry).Henries, HenriesTolerance); - AssertEx.EqualTolerance(1, ElectricInductance.From(1, ElectricInductanceUnit.Microhenry).Microhenries, MicrohenriesTolerance); - AssertEx.EqualTolerance(1, ElectricInductance.From(1, ElectricInductanceUnit.Millihenry).Millihenries, MillihenriesTolerance); - AssertEx.EqualTolerance(1, ElectricInductance.From(1, ElectricInductanceUnit.Nanohenry).Nanohenries, NanohenriesTolerance); + AssertEx.EqualTolerance(1, ElectricInductance.From(1, ElectricInductanceUnit.Henry).Henries, HenriesTolerance); + AssertEx.EqualTolerance(1, ElectricInductance.From(1, ElectricInductanceUnit.Microhenry).Microhenries, MicrohenriesTolerance); + AssertEx.EqualTolerance(1, ElectricInductance.From(1, ElectricInductanceUnit.Millihenry).Millihenries, MillihenriesTolerance); + AssertEx.EqualTolerance(1, ElectricInductance.From(1, ElectricInductanceUnit.Nanohenry).Nanohenries, NanohenriesTolerance); } [Fact] public void FromHenries_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricInductance.FromHenries(double.PositiveInfinity)); - Assert.Throws(() => ElectricInductance.FromHenries(double.NegativeInfinity)); + Assert.Throws(() => ElectricInductance.FromHenries(double.PositiveInfinity)); + Assert.Throws(() => ElectricInductance.FromHenries(double.NegativeInfinity)); } [Fact] public void FromHenries_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricInductance.FromHenries(double.NaN)); + Assert.Throws(() => ElectricInductance.FromHenries(double.NaN)); } [Fact] public void As() { - var henry = ElectricInductance.FromHenries(1); + var henry = ElectricInductance.FromHenries(1); AssertEx.EqualTolerance(HenriesInOneHenry, henry.As(ElectricInductanceUnit.Henry), HenriesTolerance); AssertEx.EqualTolerance(MicrohenriesInOneHenry, henry.As(ElectricInductanceUnit.Microhenry), MicrohenriesTolerance); AssertEx.EqualTolerance(MillihenriesInOneHenry, henry.As(ElectricInductanceUnit.Millihenry), MillihenriesTolerance); @@ -110,7 +110,7 @@ public void As() [Fact] public void ToUnit() { - var henry = ElectricInductance.FromHenries(1); + var henry = ElectricInductance.FromHenries(1); var henryQuantity = henry.ToUnit(ElectricInductanceUnit.Henry); AssertEx.EqualTolerance(HenriesInOneHenry, (double)henryQuantity.Value, HenriesTolerance); @@ -132,31 +132,31 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ElectricInductance henry = ElectricInductance.FromHenries(1); - AssertEx.EqualTolerance(1, ElectricInductance.FromHenries(henry.Henries).Henries, HenriesTolerance); - AssertEx.EqualTolerance(1, ElectricInductance.FromMicrohenries(henry.Microhenries).Henries, MicrohenriesTolerance); - AssertEx.EqualTolerance(1, ElectricInductance.FromMillihenries(henry.Millihenries).Henries, MillihenriesTolerance); - AssertEx.EqualTolerance(1, ElectricInductance.FromNanohenries(henry.Nanohenries).Henries, NanohenriesTolerance); + ElectricInductance henry = ElectricInductance.FromHenries(1); + AssertEx.EqualTolerance(1, ElectricInductance.FromHenries(henry.Henries).Henries, HenriesTolerance); + AssertEx.EqualTolerance(1, ElectricInductance.FromMicrohenries(henry.Microhenries).Henries, MicrohenriesTolerance); + AssertEx.EqualTolerance(1, ElectricInductance.FromMillihenries(henry.Millihenries).Henries, MillihenriesTolerance); + AssertEx.EqualTolerance(1, ElectricInductance.FromNanohenries(henry.Nanohenries).Henries, NanohenriesTolerance); } [Fact] public void ArithmeticOperators() { - ElectricInductance v = ElectricInductance.FromHenries(1); + ElectricInductance v = ElectricInductance.FromHenries(1); AssertEx.EqualTolerance(-1, -v.Henries, HenriesTolerance); - AssertEx.EqualTolerance(2, (ElectricInductance.FromHenries(3)-v).Henries, HenriesTolerance); + AssertEx.EqualTolerance(2, (ElectricInductance.FromHenries(3)-v).Henries, HenriesTolerance); AssertEx.EqualTolerance(2, (v + v).Henries, HenriesTolerance); AssertEx.EqualTolerance(10, (v*10).Henries, HenriesTolerance); AssertEx.EqualTolerance(10, (10*v).Henries, HenriesTolerance); - AssertEx.EqualTolerance(2, (ElectricInductance.FromHenries(10)/5).Henries, HenriesTolerance); - AssertEx.EqualTolerance(2, ElectricInductance.FromHenries(10)/ElectricInductance.FromHenries(5), HenriesTolerance); + AssertEx.EqualTolerance(2, (ElectricInductance.FromHenries(10)/5).Henries, HenriesTolerance); + AssertEx.EqualTolerance(2, ElectricInductance.FromHenries(10)/ElectricInductance.FromHenries(5), HenriesTolerance); } [Fact] public void ComparisonOperators() { - ElectricInductance oneHenry = ElectricInductance.FromHenries(1); - ElectricInductance twoHenries = ElectricInductance.FromHenries(2); + ElectricInductance oneHenry = ElectricInductance.FromHenries(1); + ElectricInductance twoHenries = ElectricInductance.FromHenries(2); Assert.True(oneHenry < twoHenries); Assert.True(oneHenry <= twoHenries); @@ -172,31 +172,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ElectricInductance henry = ElectricInductance.FromHenries(1); + ElectricInductance henry = ElectricInductance.FromHenries(1); Assert.Equal(0, henry.CompareTo(henry)); - Assert.True(henry.CompareTo(ElectricInductance.Zero) > 0); - Assert.True(ElectricInductance.Zero.CompareTo(henry) < 0); + Assert.True(henry.CompareTo(ElectricInductance.Zero) > 0); + Assert.True(ElectricInductance.Zero.CompareTo(henry) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricInductance henry = ElectricInductance.FromHenries(1); + ElectricInductance henry = ElectricInductance.FromHenries(1); Assert.Throws(() => henry.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricInductance henry = ElectricInductance.FromHenries(1); + ElectricInductance henry = ElectricInductance.FromHenries(1); Assert.Throws(() => henry.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ElectricInductance.FromHenries(1); - var b = ElectricInductance.FromHenries(2); + var a = ElectricInductance.FromHenries(1); + var b = ElectricInductance.FromHenries(2); // ReSharper disable EqualExpressionComparison @@ -215,8 +215,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ElectricInductance.FromHenries(1); - var b = ElectricInductance.FromHenries(2); + var a = ElectricInductance.FromHenries(1); + var b = ElectricInductance.FromHenries(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -226,29 +226,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ElectricInductance.FromHenries(1); - Assert.True(v.Equals(ElectricInductance.FromHenries(1), HenriesTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricInductance.Zero, HenriesTolerance, ComparisonType.Relative)); + var v = ElectricInductance.FromHenries(1); + Assert.True(v.Equals(ElectricInductance.FromHenries(1), HenriesTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricInductance.Zero, HenriesTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricInductance henry = ElectricInductance.FromHenries(1); + ElectricInductance henry = ElectricInductance.FromHenries(1); Assert.False(henry.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricInductance henry = ElectricInductance.FromHenries(1); + ElectricInductance henry = ElectricInductance.FromHenries(1); Assert.False(henry.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ElectricInductanceUnit.Undefined, ElectricInductance.Units); + Assert.DoesNotContain(ElectricInductanceUnit.Undefined, ElectricInductance.Units); } [Fact] @@ -267,7 +267,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ElectricInductance.BaseDimensions is null); + Assert.False(ElectricInductance.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs index a454836531..3ed8c586d2 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs @@ -51,26 +51,26 @@ public abstract partial class ElectricPotentialAcTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ElectricPotentialAc((double)0.0, ElectricPotentialAcUnit.Undefined)); + Assert.Throws(() => new ElectricPotentialAc((double)0.0, ElectricPotentialAcUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricPotentialAc(double.PositiveInfinity, ElectricPotentialAcUnit.VoltAc)); - Assert.Throws(() => new ElectricPotentialAc(double.NegativeInfinity, ElectricPotentialAcUnit.VoltAc)); + Assert.Throws(() => new ElectricPotentialAc(double.PositiveInfinity, ElectricPotentialAcUnit.VoltAc)); + Assert.Throws(() => new ElectricPotentialAc(double.NegativeInfinity, ElectricPotentialAcUnit.VoltAc)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricPotentialAc(double.NaN, ElectricPotentialAcUnit.VoltAc)); + Assert.Throws(() => new ElectricPotentialAc(double.NaN, ElectricPotentialAcUnit.VoltAc)); } [Fact] public void VoltAcToElectricPotentialAcUnits() { - ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); + ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); AssertEx.EqualTolerance(KilovoltsAcInOneVoltAc, voltac.KilovoltsAc, KilovoltsAcTolerance); AssertEx.EqualTolerance(MegavoltsAcInOneVoltAc, voltac.MegavoltsAc, MegavoltsAcTolerance); AssertEx.EqualTolerance(MicrovoltsAcInOneVoltAc, voltac.MicrovoltsAc, MicrovoltsAcTolerance); @@ -81,30 +81,30 @@ public void VoltAcToElectricPotentialAcUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.KilovoltAc).KilovoltsAc, KilovoltsAcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.MegavoltAc).MegavoltsAc, MegavoltsAcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.MicrovoltAc).MicrovoltsAc, MicrovoltsAcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.MillivoltAc).MillivoltsAc, MillivoltsAcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.VoltAc).VoltsAc, VoltsAcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.KilovoltAc).KilovoltsAc, KilovoltsAcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.MegavoltAc).MegavoltsAc, MegavoltsAcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.MicrovoltAc).MicrovoltsAc, MicrovoltsAcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.MillivoltAc).MillivoltsAc, MillivoltsAcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.VoltAc).VoltsAc, VoltsAcTolerance); } [Fact] public void FromVoltsAc_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.PositiveInfinity)); - Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.NegativeInfinity)); + Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.PositiveInfinity)); + Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.NegativeInfinity)); } [Fact] public void FromVoltsAc_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.NaN)); + Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.NaN)); } [Fact] public void As() { - var voltac = ElectricPotentialAc.FromVoltsAc(1); + var voltac = ElectricPotentialAc.FromVoltsAc(1); AssertEx.EqualTolerance(KilovoltsAcInOneVoltAc, voltac.As(ElectricPotentialAcUnit.KilovoltAc), KilovoltsAcTolerance); AssertEx.EqualTolerance(MegavoltsAcInOneVoltAc, voltac.As(ElectricPotentialAcUnit.MegavoltAc), MegavoltsAcTolerance); AssertEx.EqualTolerance(MicrovoltsAcInOneVoltAc, voltac.As(ElectricPotentialAcUnit.MicrovoltAc), MicrovoltsAcTolerance); @@ -115,7 +115,7 @@ public void As() [Fact] public void ToUnit() { - var voltac = ElectricPotentialAc.FromVoltsAc(1); + var voltac = ElectricPotentialAc.FromVoltsAc(1); var kilovoltacQuantity = voltac.ToUnit(ElectricPotentialAcUnit.KilovoltAc); AssertEx.EqualTolerance(KilovoltsAcInOneVoltAc, (double)kilovoltacQuantity.Value, KilovoltsAcTolerance); @@ -141,32 +141,32 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); - AssertEx.EqualTolerance(1, ElectricPotentialAc.FromKilovoltsAc(voltac.KilovoltsAc).VoltsAc, KilovoltsAcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialAc.FromMegavoltsAc(voltac.MegavoltsAc).VoltsAc, MegavoltsAcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialAc.FromMicrovoltsAc(voltac.MicrovoltsAc).VoltsAc, MicrovoltsAcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialAc.FromMillivoltsAc(voltac.MillivoltsAc).VoltsAc, MillivoltsAcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialAc.FromVoltsAc(voltac.VoltsAc).VoltsAc, VoltsAcTolerance); + ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); + AssertEx.EqualTolerance(1, ElectricPotentialAc.FromKilovoltsAc(voltac.KilovoltsAc).VoltsAc, KilovoltsAcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialAc.FromMegavoltsAc(voltac.MegavoltsAc).VoltsAc, MegavoltsAcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialAc.FromMicrovoltsAc(voltac.MicrovoltsAc).VoltsAc, MicrovoltsAcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialAc.FromMillivoltsAc(voltac.MillivoltsAc).VoltsAc, MillivoltsAcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialAc.FromVoltsAc(voltac.VoltsAc).VoltsAc, VoltsAcTolerance); } [Fact] public void ArithmeticOperators() { - ElectricPotentialAc v = ElectricPotentialAc.FromVoltsAc(1); + ElectricPotentialAc v = ElectricPotentialAc.FromVoltsAc(1); AssertEx.EqualTolerance(-1, -v.VoltsAc, VoltsAcTolerance); - AssertEx.EqualTolerance(2, (ElectricPotentialAc.FromVoltsAc(3)-v).VoltsAc, VoltsAcTolerance); + AssertEx.EqualTolerance(2, (ElectricPotentialAc.FromVoltsAc(3)-v).VoltsAc, VoltsAcTolerance); AssertEx.EqualTolerance(2, (v + v).VoltsAc, VoltsAcTolerance); AssertEx.EqualTolerance(10, (v*10).VoltsAc, VoltsAcTolerance); AssertEx.EqualTolerance(10, (10*v).VoltsAc, VoltsAcTolerance); - AssertEx.EqualTolerance(2, (ElectricPotentialAc.FromVoltsAc(10)/5).VoltsAc, VoltsAcTolerance); - AssertEx.EqualTolerance(2, ElectricPotentialAc.FromVoltsAc(10)/ElectricPotentialAc.FromVoltsAc(5), VoltsAcTolerance); + AssertEx.EqualTolerance(2, (ElectricPotentialAc.FromVoltsAc(10)/5).VoltsAc, VoltsAcTolerance); + AssertEx.EqualTolerance(2, ElectricPotentialAc.FromVoltsAc(10)/ElectricPotentialAc.FromVoltsAc(5), VoltsAcTolerance); } [Fact] public void ComparisonOperators() { - ElectricPotentialAc oneVoltAc = ElectricPotentialAc.FromVoltsAc(1); - ElectricPotentialAc twoVoltsAc = ElectricPotentialAc.FromVoltsAc(2); + ElectricPotentialAc oneVoltAc = ElectricPotentialAc.FromVoltsAc(1); + ElectricPotentialAc twoVoltsAc = ElectricPotentialAc.FromVoltsAc(2); Assert.True(oneVoltAc < twoVoltsAc); Assert.True(oneVoltAc <= twoVoltsAc); @@ -182,31 +182,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); + ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); Assert.Equal(0, voltac.CompareTo(voltac)); - Assert.True(voltac.CompareTo(ElectricPotentialAc.Zero) > 0); - Assert.True(ElectricPotentialAc.Zero.CompareTo(voltac) < 0); + Assert.True(voltac.CompareTo(ElectricPotentialAc.Zero) > 0); + Assert.True(ElectricPotentialAc.Zero.CompareTo(voltac) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); + ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); Assert.Throws(() => voltac.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); + ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); Assert.Throws(() => voltac.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ElectricPotentialAc.FromVoltsAc(1); - var b = ElectricPotentialAc.FromVoltsAc(2); + var a = ElectricPotentialAc.FromVoltsAc(1); + var b = ElectricPotentialAc.FromVoltsAc(2); // ReSharper disable EqualExpressionComparison @@ -225,8 +225,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ElectricPotentialAc.FromVoltsAc(1); - var b = ElectricPotentialAc.FromVoltsAc(2); + var a = ElectricPotentialAc.FromVoltsAc(1); + var b = ElectricPotentialAc.FromVoltsAc(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -236,29 +236,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ElectricPotentialAc.FromVoltsAc(1); - Assert.True(v.Equals(ElectricPotentialAc.FromVoltsAc(1), VoltsAcTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricPotentialAc.Zero, VoltsAcTolerance, ComparisonType.Relative)); + var v = ElectricPotentialAc.FromVoltsAc(1); + Assert.True(v.Equals(ElectricPotentialAc.FromVoltsAc(1), VoltsAcTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricPotentialAc.Zero, VoltsAcTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); + ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); Assert.False(voltac.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); + ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); Assert.False(voltac.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ElectricPotentialAcUnit.Undefined, ElectricPotentialAc.Units); + Assert.DoesNotContain(ElectricPotentialAcUnit.Undefined, ElectricPotentialAc.Units); } [Fact] @@ -277,7 +277,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ElectricPotentialAc.BaseDimensions is null); + Assert.False(ElectricPotentialAc.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs index 86c42526db..c3294f938b 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs @@ -51,26 +51,26 @@ public abstract partial class ElectricPotentialDcTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ElectricPotentialDc((double)0.0, ElectricPotentialDcUnit.Undefined)); + Assert.Throws(() => new ElectricPotentialDc((double)0.0, ElectricPotentialDcUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricPotentialDc(double.PositiveInfinity, ElectricPotentialDcUnit.VoltDc)); - Assert.Throws(() => new ElectricPotentialDc(double.NegativeInfinity, ElectricPotentialDcUnit.VoltDc)); + Assert.Throws(() => new ElectricPotentialDc(double.PositiveInfinity, ElectricPotentialDcUnit.VoltDc)); + Assert.Throws(() => new ElectricPotentialDc(double.NegativeInfinity, ElectricPotentialDcUnit.VoltDc)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricPotentialDc(double.NaN, ElectricPotentialDcUnit.VoltDc)); + Assert.Throws(() => new ElectricPotentialDc(double.NaN, ElectricPotentialDcUnit.VoltDc)); } [Fact] public void VoltDcToElectricPotentialDcUnits() { - ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); + ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); AssertEx.EqualTolerance(KilovoltsDcInOneVoltDc, voltdc.KilovoltsDc, KilovoltsDcTolerance); AssertEx.EqualTolerance(MegavoltsDcInOneVoltDc, voltdc.MegavoltsDc, MegavoltsDcTolerance); AssertEx.EqualTolerance(MicrovoltsDcInOneVoltDc, voltdc.MicrovoltsDc, MicrovoltsDcTolerance); @@ -81,30 +81,30 @@ public void VoltDcToElectricPotentialDcUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.KilovoltDc).KilovoltsDc, KilovoltsDcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.MegavoltDc).MegavoltsDc, MegavoltsDcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.MicrovoltDc).MicrovoltsDc, MicrovoltsDcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.MillivoltDc).MillivoltsDc, MillivoltsDcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.VoltDc).VoltsDc, VoltsDcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.KilovoltDc).KilovoltsDc, KilovoltsDcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.MegavoltDc).MegavoltsDc, MegavoltsDcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.MicrovoltDc).MicrovoltsDc, MicrovoltsDcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.MillivoltDc).MillivoltsDc, MillivoltsDcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.VoltDc).VoltsDc, VoltsDcTolerance); } [Fact] public void FromVoltsDc_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.PositiveInfinity)); - Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.NegativeInfinity)); + Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.PositiveInfinity)); + Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.NegativeInfinity)); } [Fact] public void FromVoltsDc_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.NaN)); + Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.NaN)); } [Fact] public void As() { - var voltdc = ElectricPotentialDc.FromVoltsDc(1); + var voltdc = ElectricPotentialDc.FromVoltsDc(1); AssertEx.EqualTolerance(KilovoltsDcInOneVoltDc, voltdc.As(ElectricPotentialDcUnit.KilovoltDc), KilovoltsDcTolerance); AssertEx.EqualTolerance(MegavoltsDcInOneVoltDc, voltdc.As(ElectricPotentialDcUnit.MegavoltDc), MegavoltsDcTolerance); AssertEx.EqualTolerance(MicrovoltsDcInOneVoltDc, voltdc.As(ElectricPotentialDcUnit.MicrovoltDc), MicrovoltsDcTolerance); @@ -115,7 +115,7 @@ public void As() [Fact] public void ToUnit() { - var voltdc = ElectricPotentialDc.FromVoltsDc(1); + var voltdc = ElectricPotentialDc.FromVoltsDc(1); var kilovoltdcQuantity = voltdc.ToUnit(ElectricPotentialDcUnit.KilovoltDc); AssertEx.EqualTolerance(KilovoltsDcInOneVoltDc, (double)kilovoltdcQuantity.Value, KilovoltsDcTolerance); @@ -141,32 +141,32 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); - AssertEx.EqualTolerance(1, ElectricPotentialDc.FromKilovoltsDc(voltdc.KilovoltsDc).VoltsDc, KilovoltsDcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialDc.FromMegavoltsDc(voltdc.MegavoltsDc).VoltsDc, MegavoltsDcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialDc.FromMicrovoltsDc(voltdc.MicrovoltsDc).VoltsDc, MicrovoltsDcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialDc.FromMillivoltsDc(voltdc.MillivoltsDc).VoltsDc, MillivoltsDcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialDc.FromVoltsDc(voltdc.VoltsDc).VoltsDc, VoltsDcTolerance); + ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); + AssertEx.EqualTolerance(1, ElectricPotentialDc.FromKilovoltsDc(voltdc.KilovoltsDc).VoltsDc, KilovoltsDcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialDc.FromMegavoltsDc(voltdc.MegavoltsDc).VoltsDc, MegavoltsDcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialDc.FromMicrovoltsDc(voltdc.MicrovoltsDc).VoltsDc, MicrovoltsDcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialDc.FromMillivoltsDc(voltdc.MillivoltsDc).VoltsDc, MillivoltsDcTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialDc.FromVoltsDc(voltdc.VoltsDc).VoltsDc, VoltsDcTolerance); } [Fact] public void ArithmeticOperators() { - ElectricPotentialDc v = ElectricPotentialDc.FromVoltsDc(1); + ElectricPotentialDc v = ElectricPotentialDc.FromVoltsDc(1); AssertEx.EqualTolerance(-1, -v.VoltsDc, VoltsDcTolerance); - AssertEx.EqualTolerance(2, (ElectricPotentialDc.FromVoltsDc(3)-v).VoltsDc, VoltsDcTolerance); + AssertEx.EqualTolerance(2, (ElectricPotentialDc.FromVoltsDc(3)-v).VoltsDc, VoltsDcTolerance); AssertEx.EqualTolerance(2, (v + v).VoltsDc, VoltsDcTolerance); AssertEx.EqualTolerance(10, (v*10).VoltsDc, VoltsDcTolerance); AssertEx.EqualTolerance(10, (10*v).VoltsDc, VoltsDcTolerance); - AssertEx.EqualTolerance(2, (ElectricPotentialDc.FromVoltsDc(10)/5).VoltsDc, VoltsDcTolerance); - AssertEx.EqualTolerance(2, ElectricPotentialDc.FromVoltsDc(10)/ElectricPotentialDc.FromVoltsDc(5), VoltsDcTolerance); + AssertEx.EqualTolerance(2, (ElectricPotentialDc.FromVoltsDc(10)/5).VoltsDc, VoltsDcTolerance); + AssertEx.EqualTolerance(2, ElectricPotentialDc.FromVoltsDc(10)/ElectricPotentialDc.FromVoltsDc(5), VoltsDcTolerance); } [Fact] public void ComparisonOperators() { - ElectricPotentialDc oneVoltDc = ElectricPotentialDc.FromVoltsDc(1); - ElectricPotentialDc twoVoltsDc = ElectricPotentialDc.FromVoltsDc(2); + ElectricPotentialDc oneVoltDc = ElectricPotentialDc.FromVoltsDc(1); + ElectricPotentialDc twoVoltsDc = ElectricPotentialDc.FromVoltsDc(2); Assert.True(oneVoltDc < twoVoltsDc); Assert.True(oneVoltDc <= twoVoltsDc); @@ -182,31 +182,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); + ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); Assert.Equal(0, voltdc.CompareTo(voltdc)); - Assert.True(voltdc.CompareTo(ElectricPotentialDc.Zero) > 0); - Assert.True(ElectricPotentialDc.Zero.CompareTo(voltdc) < 0); + Assert.True(voltdc.CompareTo(ElectricPotentialDc.Zero) > 0); + Assert.True(ElectricPotentialDc.Zero.CompareTo(voltdc) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); + ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); Assert.Throws(() => voltdc.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); + ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); Assert.Throws(() => voltdc.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ElectricPotentialDc.FromVoltsDc(1); - var b = ElectricPotentialDc.FromVoltsDc(2); + var a = ElectricPotentialDc.FromVoltsDc(1); + var b = ElectricPotentialDc.FromVoltsDc(2); // ReSharper disable EqualExpressionComparison @@ -225,8 +225,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ElectricPotentialDc.FromVoltsDc(1); - var b = ElectricPotentialDc.FromVoltsDc(2); + var a = ElectricPotentialDc.FromVoltsDc(1); + var b = ElectricPotentialDc.FromVoltsDc(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -236,29 +236,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ElectricPotentialDc.FromVoltsDc(1); - Assert.True(v.Equals(ElectricPotentialDc.FromVoltsDc(1), VoltsDcTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricPotentialDc.Zero, VoltsDcTolerance, ComparisonType.Relative)); + var v = ElectricPotentialDc.FromVoltsDc(1); + Assert.True(v.Equals(ElectricPotentialDc.FromVoltsDc(1), VoltsDcTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricPotentialDc.Zero, VoltsDcTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); + ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); Assert.False(voltdc.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); + ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); Assert.False(voltdc.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ElectricPotentialDcUnit.Undefined, ElectricPotentialDc.Units); + Assert.DoesNotContain(ElectricPotentialDcUnit.Undefined, ElectricPotentialDc.Units); } [Fact] @@ -277,7 +277,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ElectricPotentialDc.BaseDimensions is null); + Assert.False(ElectricPotentialDc.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs index c1bb50b9f5..31c15ac415 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of ElectricPotential. + /// Test of ElectricPotential. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class ElectricPotentialTestsBase @@ -51,26 +51,26 @@ public abstract partial class ElectricPotentialTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ElectricPotential((double)0.0, ElectricPotentialUnit.Undefined)); + Assert.Throws(() => new ElectricPotential((double)0.0, ElectricPotentialUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricPotential(double.PositiveInfinity, ElectricPotentialUnit.Volt)); - Assert.Throws(() => new ElectricPotential(double.NegativeInfinity, ElectricPotentialUnit.Volt)); + Assert.Throws(() => new ElectricPotential(double.PositiveInfinity, ElectricPotentialUnit.Volt)); + Assert.Throws(() => new ElectricPotential(double.NegativeInfinity, ElectricPotentialUnit.Volt)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricPotential(double.NaN, ElectricPotentialUnit.Volt)); + Assert.Throws(() => new ElectricPotential(double.NaN, ElectricPotentialUnit.Volt)); } [Fact] public void VoltToElectricPotentialUnits() { - ElectricPotential volt = ElectricPotential.FromVolts(1); + ElectricPotential volt = ElectricPotential.FromVolts(1); AssertEx.EqualTolerance(KilovoltsInOneVolt, volt.Kilovolts, KilovoltsTolerance); AssertEx.EqualTolerance(MegavoltsInOneVolt, volt.Megavolts, MegavoltsTolerance); AssertEx.EqualTolerance(MicrovoltsInOneVolt, volt.Microvolts, MicrovoltsTolerance); @@ -81,30 +81,30 @@ public void VoltToElectricPotentialUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Kilovolt).Kilovolts, KilovoltsTolerance); - AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Megavolt).Megavolts, MegavoltsTolerance); - AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Microvolt).Microvolts, MicrovoltsTolerance); - AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Millivolt).Millivolts, MillivoltsTolerance); - AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Volt).Volts, VoltsTolerance); + AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Kilovolt).Kilovolts, KilovoltsTolerance); + AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Megavolt).Megavolts, MegavoltsTolerance); + AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Microvolt).Microvolts, MicrovoltsTolerance); + AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Millivolt).Millivolts, MillivoltsTolerance); + AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Volt).Volts, VoltsTolerance); } [Fact] public void FromVolts_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricPotential.FromVolts(double.PositiveInfinity)); - Assert.Throws(() => ElectricPotential.FromVolts(double.NegativeInfinity)); + Assert.Throws(() => ElectricPotential.FromVolts(double.PositiveInfinity)); + Assert.Throws(() => ElectricPotential.FromVolts(double.NegativeInfinity)); } [Fact] public void FromVolts_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricPotential.FromVolts(double.NaN)); + Assert.Throws(() => ElectricPotential.FromVolts(double.NaN)); } [Fact] public void As() { - var volt = ElectricPotential.FromVolts(1); + var volt = ElectricPotential.FromVolts(1); AssertEx.EqualTolerance(KilovoltsInOneVolt, volt.As(ElectricPotentialUnit.Kilovolt), KilovoltsTolerance); AssertEx.EqualTolerance(MegavoltsInOneVolt, volt.As(ElectricPotentialUnit.Megavolt), MegavoltsTolerance); AssertEx.EqualTolerance(MicrovoltsInOneVolt, volt.As(ElectricPotentialUnit.Microvolt), MicrovoltsTolerance); @@ -115,7 +115,7 @@ public void As() [Fact] public void ToUnit() { - var volt = ElectricPotential.FromVolts(1); + var volt = ElectricPotential.FromVolts(1); var kilovoltQuantity = volt.ToUnit(ElectricPotentialUnit.Kilovolt); AssertEx.EqualTolerance(KilovoltsInOneVolt, (double)kilovoltQuantity.Value, KilovoltsTolerance); @@ -141,32 +141,32 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ElectricPotential volt = ElectricPotential.FromVolts(1); - AssertEx.EqualTolerance(1, ElectricPotential.FromKilovolts(volt.Kilovolts).Volts, KilovoltsTolerance); - AssertEx.EqualTolerance(1, ElectricPotential.FromMegavolts(volt.Megavolts).Volts, MegavoltsTolerance); - AssertEx.EqualTolerance(1, ElectricPotential.FromMicrovolts(volt.Microvolts).Volts, MicrovoltsTolerance); - AssertEx.EqualTolerance(1, ElectricPotential.FromMillivolts(volt.Millivolts).Volts, MillivoltsTolerance); - AssertEx.EqualTolerance(1, ElectricPotential.FromVolts(volt.Volts).Volts, VoltsTolerance); + ElectricPotential volt = ElectricPotential.FromVolts(1); + AssertEx.EqualTolerance(1, ElectricPotential.FromKilovolts(volt.Kilovolts).Volts, KilovoltsTolerance); + AssertEx.EqualTolerance(1, ElectricPotential.FromMegavolts(volt.Megavolts).Volts, MegavoltsTolerance); + AssertEx.EqualTolerance(1, ElectricPotential.FromMicrovolts(volt.Microvolts).Volts, MicrovoltsTolerance); + AssertEx.EqualTolerance(1, ElectricPotential.FromMillivolts(volt.Millivolts).Volts, MillivoltsTolerance); + AssertEx.EqualTolerance(1, ElectricPotential.FromVolts(volt.Volts).Volts, VoltsTolerance); } [Fact] public void ArithmeticOperators() { - ElectricPotential v = ElectricPotential.FromVolts(1); + ElectricPotential v = ElectricPotential.FromVolts(1); AssertEx.EqualTolerance(-1, -v.Volts, VoltsTolerance); - AssertEx.EqualTolerance(2, (ElectricPotential.FromVolts(3)-v).Volts, VoltsTolerance); + AssertEx.EqualTolerance(2, (ElectricPotential.FromVolts(3)-v).Volts, VoltsTolerance); AssertEx.EqualTolerance(2, (v + v).Volts, VoltsTolerance); AssertEx.EqualTolerance(10, (v*10).Volts, VoltsTolerance); AssertEx.EqualTolerance(10, (10*v).Volts, VoltsTolerance); - AssertEx.EqualTolerance(2, (ElectricPotential.FromVolts(10)/5).Volts, VoltsTolerance); - AssertEx.EqualTolerance(2, ElectricPotential.FromVolts(10)/ElectricPotential.FromVolts(5), VoltsTolerance); + AssertEx.EqualTolerance(2, (ElectricPotential.FromVolts(10)/5).Volts, VoltsTolerance); + AssertEx.EqualTolerance(2, ElectricPotential.FromVolts(10)/ElectricPotential.FromVolts(5), VoltsTolerance); } [Fact] public void ComparisonOperators() { - ElectricPotential oneVolt = ElectricPotential.FromVolts(1); - ElectricPotential twoVolts = ElectricPotential.FromVolts(2); + ElectricPotential oneVolt = ElectricPotential.FromVolts(1); + ElectricPotential twoVolts = ElectricPotential.FromVolts(2); Assert.True(oneVolt < twoVolts); Assert.True(oneVolt <= twoVolts); @@ -182,31 +182,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ElectricPotential volt = ElectricPotential.FromVolts(1); + ElectricPotential volt = ElectricPotential.FromVolts(1); Assert.Equal(0, volt.CompareTo(volt)); - Assert.True(volt.CompareTo(ElectricPotential.Zero) > 0); - Assert.True(ElectricPotential.Zero.CompareTo(volt) < 0); + Assert.True(volt.CompareTo(ElectricPotential.Zero) > 0); + Assert.True(ElectricPotential.Zero.CompareTo(volt) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricPotential volt = ElectricPotential.FromVolts(1); + ElectricPotential volt = ElectricPotential.FromVolts(1); Assert.Throws(() => volt.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricPotential volt = ElectricPotential.FromVolts(1); + ElectricPotential volt = ElectricPotential.FromVolts(1); Assert.Throws(() => volt.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ElectricPotential.FromVolts(1); - var b = ElectricPotential.FromVolts(2); + var a = ElectricPotential.FromVolts(1); + var b = ElectricPotential.FromVolts(2); // ReSharper disable EqualExpressionComparison @@ -225,8 +225,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ElectricPotential.FromVolts(1); - var b = ElectricPotential.FromVolts(2); + var a = ElectricPotential.FromVolts(1); + var b = ElectricPotential.FromVolts(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -236,29 +236,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ElectricPotential.FromVolts(1); - Assert.True(v.Equals(ElectricPotential.FromVolts(1), VoltsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricPotential.Zero, VoltsTolerance, ComparisonType.Relative)); + var v = ElectricPotential.FromVolts(1); + Assert.True(v.Equals(ElectricPotential.FromVolts(1), VoltsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricPotential.Zero, VoltsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricPotential volt = ElectricPotential.FromVolts(1); + ElectricPotential volt = ElectricPotential.FromVolts(1); Assert.False(volt.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricPotential volt = ElectricPotential.FromVolts(1); + ElectricPotential volt = ElectricPotential.FromVolts(1); Assert.False(volt.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ElectricPotentialUnit.Undefined, ElectricPotential.Units); + Assert.DoesNotContain(ElectricPotentialUnit.Undefined, ElectricPotential.Units); } [Fact] @@ -277,7 +277,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ElectricPotential.BaseDimensions is null); + Assert.False(ElectricPotential.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs index 14571d35fb..e413ea233d 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs @@ -51,26 +51,26 @@ public abstract partial class ElectricResistanceTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ElectricResistance((double)0.0, ElectricResistanceUnit.Undefined)); + Assert.Throws(() => new ElectricResistance((double)0.0, ElectricResistanceUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricResistance(double.PositiveInfinity, ElectricResistanceUnit.Ohm)); - Assert.Throws(() => new ElectricResistance(double.NegativeInfinity, ElectricResistanceUnit.Ohm)); + Assert.Throws(() => new ElectricResistance(double.PositiveInfinity, ElectricResistanceUnit.Ohm)); + Assert.Throws(() => new ElectricResistance(double.NegativeInfinity, ElectricResistanceUnit.Ohm)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricResistance(double.NaN, ElectricResistanceUnit.Ohm)); + Assert.Throws(() => new ElectricResistance(double.NaN, ElectricResistanceUnit.Ohm)); } [Fact] public void OhmToElectricResistanceUnits() { - ElectricResistance ohm = ElectricResistance.FromOhms(1); + ElectricResistance ohm = ElectricResistance.FromOhms(1); AssertEx.EqualTolerance(GigaohmsInOneOhm, ohm.Gigaohms, GigaohmsTolerance); AssertEx.EqualTolerance(KiloohmsInOneOhm, ohm.Kiloohms, KiloohmsTolerance); AssertEx.EqualTolerance(MegaohmsInOneOhm, ohm.Megaohms, MegaohmsTolerance); @@ -81,30 +81,30 @@ public void OhmToElectricResistanceUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Gigaohm).Gigaohms, GigaohmsTolerance); - AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Kiloohm).Kiloohms, KiloohmsTolerance); - AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Megaohm).Megaohms, MegaohmsTolerance); - AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Milliohm).Milliohms, MilliohmsTolerance); - AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Ohm).Ohms, OhmsTolerance); + AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Gigaohm).Gigaohms, GigaohmsTolerance); + AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Kiloohm).Kiloohms, KiloohmsTolerance); + AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Megaohm).Megaohms, MegaohmsTolerance); + AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Milliohm).Milliohms, MilliohmsTolerance); + AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Ohm).Ohms, OhmsTolerance); } [Fact] public void FromOhms_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricResistance.FromOhms(double.PositiveInfinity)); - Assert.Throws(() => ElectricResistance.FromOhms(double.NegativeInfinity)); + Assert.Throws(() => ElectricResistance.FromOhms(double.PositiveInfinity)); + Assert.Throws(() => ElectricResistance.FromOhms(double.NegativeInfinity)); } [Fact] public void FromOhms_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricResistance.FromOhms(double.NaN)); + Assert.Throws(() => ElectricResistance.FromOhms(double.NaN)); } [Fact] public void As() { - var ohm = ElectricResistance.FromOhms(1); + var ohm = ElectricResistance.FromOhms(1); AssertEx.EqualTolerance(GigaohmsInOneOhm, ohm.As(ElectricResistanceUnit.Gigaohm), GigaohmsTolerance); AssertEx.EqualTolerance(KiloohmsInOneOhm, ohm.As(ElectricResistanceUnit.Kiloohm), KiloohmsTolerance); AssertEx.EqualTolerance(MegaohmsInOneOhm, ohm.As(ElectricResistanceUnit.Megaohm), MegaohmsTolerance); @@ -115,7 +115,7 @@ public void As() [Fact] public void ToUnit() { - var ohm = ElectricResistance.FromOhms(1); + var ohm = ElectricResistance.FromOhms(1); var gigaohmQuantity = ohm.ToUnit(ElectricResistanceUnit.Gigaohm); AssertEx.EqualTolerance(GigaohmsInOneOhm, (double)gigaohmQuantity.Value, GigaohmsTolerance); @@ -141,32 +141,32 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ElectricResistance ohm = ElectricResistance.FromOhms(1); - AssertEx.EqualTolerance(1, ElectricResistance.FromGigaohms(ohm.Gigaohms).Ohms, GigaohmsTolerance); - AssertEx.EqualTolerance(1, ElectricResistance.FromKiloohms(ohm.Kiloohms).Ohms, KiloohmsTolerance); - AssertEx.EqualTolerance(1, ElectricResistance.FromMegaohms(ohm.Megaohms).Ohms, MegaohmsTolerance); - AssertEx.EqualTolerance(1, ElectricResistance.FromMilliohms(ohm.Milliohms).Ohms, MilliohmsTolerance); - AssertEx.EqualTolerance(1, ElectricResistance.FromOhms(ohm.Ohms).Ohms, OhmsTolerance); + ElectricResistance ohm = ElectricResistance.FromOhms(1); + AssertEx.EqualTolerance(1, ElectricResistance.FromGigaohms(ohm.Gigaohms).Ohms, GigaohmsTolerance); + AssertEx.EqualTolerance(1, ElectricResistance.FromKiloohms(ohm.Kiloohms).Ohms, KiloohmsTolerance); + AssertEx.EqualTolerance(1, ElectricResistance.FromMegaohms(ohm.Megaohms).Ohms, MegaohmsTolerance); + AssertEx.EqualTolerance(1, ElectricResistance.FromMilliohms(ohm.Milliohms).Ohms, MilliohmsTolerance); + AssertEx.EqualTolerance(1, ElectricResistance.FromOhms(ohm.Ohms).Ohms, OhmsTolerance); } [Fact] public void ArithmeticOperators() { - ElectricResistance v = ElectricResistance.FromOhms(1); + ElectricResistance v = ElectricResistance.FromOhms(1); AssertEx.EqualTolerance(-1, -v.Ohms, OhmsTolerance); - AssertEx.EqualTolerance(2, (ElectricResistance.FromOhms(3)-v).Ohms, OhmsTolerance); + AssertEx.EqualTolerance(2, (ElectricResistance.FromOhms(3)-v).Ohms, OhmsTolerance); AssertEx.EqualTolerance(2, (v + v).Ohms, OhmsTolerance); AssertEx.EqualTolerance(10, (v*10).Ohms, OhmsTolerance); AssertEx.EqualTolerance(10, (10*v).Ohms, OhmsTolerance); - AssertEx.EqualTolerance(2, (ElectricResistance.FromOhms(10)/5).Ohms, OhmsTolerance); - AssertEx.EqualTolerance(2, ElectricResistance.FromOhms(10)/ElectricResistance.FromOhms(5), OhmsTolerance); + AssertEx.EqualTolerance(2, (ElectricResistance.FromOhms(10)/5).Ohms, OhmsTolerance); + AssertEx.EqualTolerance(2, ElectricResistance.FromOhms(10)/ElectricResistance.FromOhms(5), OhmsTolerance); } [Fact] public void ComparisonOperators() { - ElectricResistance oneOhm = ElectricResistance.FromOhms(1); - ElectricResistance twoOhms = ElectricResistance.FromOhms(2); + ElectricResistance oneOhm = ElectricResistance.FromOhms(1); + ElectricResistance twoOhms = ElectricResistance.FromOhms(2); Assert.True(oneOhm < twoOhms); Assert.True(oneOhm <= twoOhms); @@ -182,31 +182,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ElectricResistance ohm = ElectricResistance.FromOhms(1); + ElectricResistance ohm = ElectricResistance.FromOhms(1); Assert.Equal(0, ohm.CompareTo(ohm)); - Assert.True(ohm.CompareTo(ElectricResistance.Zero) > 0); - Assert.True(ElectricResistance.Zero.CompareTo(ohm) < 0); + Assert.True(ohm.CompareTo(ElectricResistance.Zero) > 0); + Assert.True(ElectricResistance.Zero.CompareTo(ohm) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricResistance ohm = ElectricResistance.FromOhms(1); + ElectricResistance ohm = ElectricResistance.FromOhms(1); Assert.Throws(() => ohm.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricResistance ohm = ElectricResistance.FromOhms(1); + ElectricResistance ohm = ElectricResistance.FromOhms(1); Assert.Throws(() => ohm.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ElectricResistance.FromOhms(1); - var b = ElectricResistance.FromOhms(2); + var a = ElectricResistance.FromOhms(1); + var b = ElectricResistance.FromOhms(2); // ReSharper disable EqualExpressionComparison @@ -225,8 +225,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ElectricResistance.FromOhms(1); - var b = ElectricResistance.FromOhms(2); + var a = ElectricResistance.FromOhms(1); + var b = ElectricResistance.FromOhms(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -236,29 +236,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ElectricResistance.FromOhms(1); - Assert.True(v.Equals(ElectricResistance.FromOhms(1), OhmsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricResistance.Zero, OhmsTolerance, ComparisonType.Relative)); + var v = ElectricResistance.FromOhms(1); + Assert.True(v.Equals(ElectricResistance.FromOhms(1), OhmsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricResistance.Zero, OhmsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricResistance ohm = ElectricResistance.FromOhms(1); + ElectricResistance ohm = ElectricResistance.FromOhms(1); Assert.False(ohm.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricResistance ohm = ElectricResistance.FromOhms(1); + ElectricResistance ohm = ElectricResistance.FromOhms(1); Assert.False(ohm.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ElectricResistanceUnit.Undefined, ElectricResistance.Units); + Assert.DoesNotContain(ElectricResistanceUnit.Undefined, ElectricResistance.Units); } [Fact] @@ -277,7 +277,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ElectricResistance.BaseDimensions is null); + Assert.False(ElectricResistance.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs index 9ba41748af..07f992145c 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs @@ -69,26 +69,26 @@ public abstract partial class ElectricResistivityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ElectricResistivity((double)0.0, ElectricResistivityUnit.Undefined)); + Assert.Throws(() => new ElectricResistivity((double)0.0, ElectricResistivityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricResistivity(double.PositiveInfinity, ElectricResistivityUnit.OhmMeter)); - Assert.Throws(() => new ElectricResistivity(double.NegativeInfinity, ElectricResistivityUnit.OhmMeter)); + Assert.Throws(() => new ElectricResistivity(double.PositiveInfinity, ElectricResistivityUnit.OhmMeter)); + Assert.Throws(() => new ElectricResistivity(double.NegativeInfinity, ElectricResistivityUnit.OhmMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricResistivity(double.NaN, ElectricResistivityUnit.OhmMeter)); + Assert.Throws(() => new ElectricResistivity(double.NaN, ElectricResistivityUnit.OhmMeter)); } [Fact] public void OhmMeterToElectricResistivityUnits() { - ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); + ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); AssertEx.EqualTolerance(KiloohmsCentimeterInOneOhmMeter, ohmmeter.KiloohmsCentimeter, KiloohmsCentimeterTolerance); AssertEx.EqualTolerance(KiloohmMetersInOneOhmMeter, ohmmeter.KiloohmMeters, KiloohmMetersTolerance); AssertEx.EqualTolerance(MegaohmsCentimeterInOneOhmMeter, ohmmeter.MegaohmsCentimeter, MegaohmsCentimeterTolerance); @@ -108,39 +108,39 @@ public void OhmMeterToElectricResistivityUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.KiloohmCentimeter).KiloohmsCentimeter, KiloohmsCentimeterTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.KiloohmMeter).KiloohmMeters, KiloohmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.MegaohmCentimeter).MegaohmsCentimeter, MegaohmsCentimeterTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.MegaohmMeter).MegaohmMeters, MegaohmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.MicroohmCentimeter).MicroohmsCentimeter, MicroohmsCentimeterTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.MicroohmMeter).MicroohmMeters, MicroohmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.MilliohmCentimeter).MilliohmsCentimeter, MilliohmsCentimeterTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.MilliohmMeter).MilliohmMeters, MilliohmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.NanoohmCentimeter).NanoohmsCentimeter, NanoohmsCentimeterTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.NanoohmMeter).NanoohmMeters, NanoohmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.OhmCentimeter).OhmsCentimeter, OhmsCentimeterTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.OhmMeter).OhmMeters, OhmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.PicoohmCentimeter).PicoohmsCentimeter, PicoohmsCentimeterTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.PicoohmMeter).PicoohmMeters, PicoohmMetersTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.KiloohmCentimeter).KiloohmsCentimeter, KiloohmsCentimeterTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.KiloohmMeter).KiloohmMeters, KiloohmMetersTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.MegaohmCentimeter).MegaohmsCentimeter, MegaohmsCentimeterTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.MegaohmMeter).MegaohmMeters, MegaohmMetersTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.MicroohmCentimeter).MicroohmsCentimeter, MicroohmsCentimeterTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.MicroohmMeter).MicroohmMeters, MicroohmMetersTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.MilliohmCentimeter).MilliohmsCentimeter, MilliohmsCentimeterTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.MilliohmMeter).MilliohmMeters, MilliohmMetersTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.NanoohmCentimeter).NanoohmsCentimeter, NanoohmsCentimeterTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.NanoohmMeter).NanoohmMeters, NanoohmMetersTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.OhmCentimeter).OhmsCentimeter, OhmsCentimeterTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.OhmMeter).OhmMeters, OhmMetersTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.PicoohmCentimeter).PicoohmsCentimeter, PicoohmsCentimeterTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.PicoohmMeter).PicoohmMeters, PicoohmMetersTolerance); } [Fact] public void FromOhmMeters_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.PositiveInfinity)); - Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.NegativeInfinity)); + Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.PositiveInfinity)); + Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.NegativeInfinity)); } [Fact] public void FromOhmMeters_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.NaN)); + Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.NaN)); } [Fact] public void As() { - var ohmmeter = ElectricResistivity.FromOhmMeters(1); + var ohmmeter = ElectricResistivity.FromOhmMeters(1); AssertEx.EqualTolerance(KiloohmsCentimeterInOneOhmMeter, ohmmeter.As(ElectricResistivityUnit.KiloohmCentimeter), KiloohmsCentimeterTolerance); AssertEx.EqualTolerance(KiloohmMetersInOneOhmMeter, ohmmeter.As(ElectricResistivityUnit.KiloohmMeter), KiloohmMetersTolerance); AssertEx.EqualTolerance(MegaohmsCentimeterInOneOhmMeter, ohmmeter.As(ElectricResistivityUnit.MegaohmCentimeter), MegaohmsCentimeterTolerance); @@ -160,7 +160,7 @@ public void As() [Fact] public void ToUnit() { - var ohmmeter = ElectricResistivity.FromOhmMeters(1); + var ohmmeter = ElectricResistivity.FromOhmMeters(1); var kiloohmcentimeterQuantity = ohmmeter.ToUnit(ElectricResistivityUnit.KiloohmCentimeter); AssertEx.EqualTolerance(KiloohmsCentimeterInOneOhmMeter, (double)kiloohmcentimeterQuantity.Value, KiloohmsCentimeterTolerance); @@ -222,41 +222,41 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); - AssertEx.EqualTolerance(1, ElectricResistivity.FromKiloohmsCentimeter(ohmmeter.KiloohmsCentimeter).OhmMeters, KiloohmsCentimeterTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.FromKiloohmMeters(ohmmeter.KiloohmMeters).OhmMeters, KiloohmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.FromMegaohmsCentimeter(ohmmeter.MegaohmsCentimeter).OhmMeters, MegaohmsCentimeterTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.FromMegaohmMeters(ohmmeter.MegaohmMeters).OhmMeters, MegaohmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.FromMicroohmsCentimeter(ohmmeter.MicroohmsCentimeter).OhmMeters, MicroohmsCentimeterTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.FromMicroohmMeters(ohmmeter.MicroohmMeters).OhmMeters, MicroohmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.FromMilliohmsCentimeter(ohmmeter.MilliohmsCentimeter).OhmMeters, MilliohmsCentimeterTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.FromMilliohmMeters(ohmmeter.MilliohmMeters).OhmMeters, MilliohmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.FromNanoohmsCentimeter(ohmmeter.NanoohmsCentimeter).OhmMeters, NanoohmsCentimeterTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.FromNanoohmMeters(ohmmeter.NanoohmMeters).OhmMeters, NanoohmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.FromOhmsCentimeter(ohmmeter.OhmsCentimeter).OhmMeters, OhmsCentimeterTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.FromOhmMeters(ohmmeter.OhmMeters).OhmMeters, OhmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.FromPicoohmsCentimeter(ohmmeter.PicoohmsCentimeter).OhmMeters, PicoohmsCentimeterTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.FromPicoohmMeters(ohmmeter.PicoohmMeters).OhmMeters, PicoohmMetersTolerance); + ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); + AssertEx.EqualTolerance(1, ElectricResistivity.FromKiloohmsCentimeter(ohmmeter.KiloohmsCentimeter).OhmMeters, KiloohmsCentimeterTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.FromKiloohmMeters(ohmmeter.KiloohmMeters).OhmMeters, KiloohmMetersTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.FromMegaohmsCentimeter(ohmmeter.MegaohmsCentimeter).OhmMeters, MegaohmsCentimeterTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.FromMegaohmMeters(ohmmeter.MegaohmMeters).OhmMeters, MegaohmMetersTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.FromMicroohmsCentimeter(ohmmeter.MicroohmsCentimeter).OhmMeters, MicroohmsCentimeterTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.FromMicroohmMeters(ohmmeter.MicroohmMeters).OhmMeters, MicroohmMetersTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.FromMilliohmsCentimeter(ohmmeter.MilliohmsCentimeter).OhmMeters, MilliohmsCentimeterTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.FromMilliohmMeters(ohmmeter.MilliohmMeters).OhmMeters, MilliohmMetersTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.FromNanoohmsCentimeter(ohmmeter.NanoohmsCentimeter).OhmMeters, NanoohmsCentimeterTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.FromNanoohmMeters(ohmmeter.NanoohmMeters).OhmMeters, NanoohmMetersTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.FromOhmsCentimeter(ohmmeter.OhmsCentimeter).OhmMeters, OhmsCentimeterTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.FromOhmMeters(ohmmeter.OhmMeters).OhmMeters, OhmMetersTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.FromPicoohmsCentimeter(ohmmeter.PicoohmsCentimeter).OhmMeters, PicoohmsCentimeterTolerance); + AssertEx.EqualTolerance(1, ElectricResistivity.FromPicoohmMeters(ohmmeter.PicoohmMeters).OhmMeters, PicoohmMetersTolerance); } [Fact] public void ArithmeticOperators() { - ElectricResistivity v = ElectricResistivity.FromOhmMeters(1); + ElectricResistivity v = ElectricResistivity.FromOhmMeters(1); AssertEx.EqualTolerance(-1, -v.OhmMeters, OhmMetersTolerance); - AssertEx.EqualTolerance(2, (ElectricResistivity.FromOhmMeters(3)-v).OhmMeters, OhmMetersTolerance); + AssertEx.EqualTolerance(2, (ElectricResistivity.FromOhmMeters(3)-v).OhmMeters, OhmMetersTolerance); AssertEx.EqualTolerance(2, (v + v).OhmMeters, OhmMetersTolerance); AssertEx.EqualTolerance(10, (v*10).OhmMeters, OhmMetersTolerance); AssertEx.EqualTolerance(10, (10*v).OhmMeters, OhmMetersTolerance); - AssertEx.EqualTolerance(2, (ElectricResistivity.FromOhmMeters(10)/5).OhmMeters, OhmMetersTolerance); - AssertEx.EqualTolerance(2, ElectricResistivity.FromOhmMeters(10)/ElectricResistivity.FromOhmMeters(5), OhmMetersTolerance); + AssertEx.EqualTolerance(2, (ElectricResistivity.FromOhmMeters(10)/5).OhmMeters, OhmMetersTolerance); + AssertEx.EqualTolerance(2, ElectricResistivity.FromOhmMeters(10)/ElectricResistivity.FromOhmMeters(5), OhmMetersTolerance); } [Fact] public void ComparisonOperators() { - ElectricResistivity oneOhmMeter = ElectricResistivity.FromOhmMeters(1); - ElectricResistivity twoOhmMeters = ElectricResistivity.FromOhmMeters(2); + ElectricResistivity oneOhmMeter = ElectricResistivity.FromOhmMeters(1); + ElectricResistivity twoOhmMeters = ElectricResistivity.FromOhmMeters(2); Assert.True(oneOhmMeter < twoOhmMeters); Assert.True(oneOhmMeter <= twoOhmMeters); @@ -272,31 +272,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); + ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); Assert.Equal(0, ohmmeter.CompareTo(ohmmeter)); - Assert.True(ohmmeter.CompareTo(ElectricResistivity.Zero) > 0); - Assert.True(ElectricResistivity.Zero.CompareTo(ohmmeter) < 0); + Assert.True(ohmmeter.CompareTo(ElectricResistivity.Zero) > 0); + Assert.True(ElectricResistivity.Zero.CompareTo(ohmmeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); + ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); Assert.Throws(() => ohmmeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); + ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); Assert.Throws(() => ohmmeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ElectricResistivity.FromOhmMeters(1); - var b = ElectricResistivity.FromOhmMeters(2); + var a = ElectricResistivity.FromOhmMeters(1); + var b = ElectricResistivity.FromOhmMeters(2); // ReSharper disable EqualExpressionComparison @@ -315,8 +315,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ElectricResistivity.FromOhmMeters(1); - var b = ElectricResistivity.FromOhmMeters(2); + var a = ElectricResistivity.FromOhmMeters(1); + var b = ElectricResistivity.FromOhmMeters(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -326,29 +326,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ElectricResistivity.FromOhmMeters(1); - Assert.True(v.Equals(ElectricResistivity.FromOhmMeters(1), OhmMetersTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricResistivity.Zero, OhmMetersTolerance, ComparisonType.Relative)); + var v = ElectricResistivity.FromOhmMeters(1); + Assert.True(v.Equals(ElectricResistivity.FromOhmMeters(1), OhmMetersTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricResistivity.Zero, OhmMetersTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); + ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); Assert.False(ohmmeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); + ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); Assert.False(ohmmeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ElectricResistivityUnit.Undefined, ElectricResistivity.Units); + Assert.DoesNotContain(ElectricResistivityUnit.Undefined, ElectricResistivity.Units); } [Fact] @@ -367,7 +367,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ElectricResistivity.BaseDimensions is null); + Assert.False(ElectricResistivity.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricSurfaceChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricSurfaceChargeDensityTestsBase.g.cs index af386982a8..f804d851f2 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricSurfaceChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricSurfaceChargeDensityTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of ElectricSurfaceChargeDensity. + /// Test of ElectricSurfaceChargeDensity. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class ElectricSurfaceChargeDensityTestsBase @@ -47,26 +47,26 @@ public abstract partial class ElectricSurfaceChargeDensityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ElectricSurfaceChargeDensity((double)0.0, ElectricSurfaceChargeDensityUnit.Undefined)); + Assert.Throws(() => new ElectricSurfaceChargeDensity((double)0.0, ElectricSurfaceChargeDensityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricSurfaceChargeDensity(double.PositiveInfinity, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter)); - Assert.Throws(() => new ElectricSurfaceChargeDensity(double.NegativeInfinity, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter)); + Assert.Throws(() => new ElectricSurfaceChargeDensity(double.PositiveInfinity, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter)); + Assert.Throws(() => new ElectricSurfaceChargeDensity(double.NegativeInfinity, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ElectricSurfaceChargeDensity(double.NaN, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter)); + Assert.Throws(() => new ElectricSurfaceChargeDensity(double.NaN, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter)); } [Fact] public void CoulombPerSquareMeterToElectricSurfaceChargeDensityUnits() { - ElectricSurfaceChargeDensity coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); + ElectricSurfaceChargeDensity coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); AssertEx.EqualTolerance(CoulombsPerSquareCentimeterInOneCoulombPerSquareMeter, coulombpersquaremeter.CoulombsPerSquareCentimeter, CoulombsPerSquareCentimeterTolerance); AssertEx.EqualTolerance(CoulombsPerSquareInchInOneCoulombPerSquareMeter, coulombpersquaremeter.CoulombsPerSquareInch, CoulombsPerSquareInchTolerance); AssertEx.EqualTolerance(CoulombsPerSquareMeterInOneCoulombPerSquareMeter, coulombpersquaremeter.CoulombsPerSquareMeter, CoulombsPerSquareMeterTolerance); @@ -75,28 +75,28 @@ public void CoulombPerSquareMeterToElectricSurfaceChargeDensityUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ElectricSurfaceChargeDensity.From(1, ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter).CoulombsPerSquareCentimeter, CoulombsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, ElectricSurfaceChargeDensity.From(1, ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch).CoulombsPerSquareInch, CoulombsPerSquareInchTolerance); - AssertEx.EqualTolerance(1, ElectricSurfaceChargeDensity.From(1, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter).CoulombsPerSquareMeter, CoulombsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, ElectricSurfaceChargeDensity.From(1, ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter).CoulombsPerSquareCentimeter, CoulombsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, ElectricSurfaceChargeDensity.From(1, ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch).CoulombsPerSquareInch, CoulombsPerSquareInchTolerance); + AssertEx.EqualTolerance(1, ElectricSurfaceChargeDensity.From(1, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter).CoulombsPerSquareMeter, CoulombsPerSquareMeterTolerance); } [Fact] public void FromCoulombsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(double.NegativeInfinity)); + Assert.Throws(() => ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(double.NegativeInfinity)); } [Fact] public void FromCoulombsPerSquareMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(double.NaN)); + Assert.Throws(() => ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(double.NaN)); } [Fact] public void As() { - var coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); + var coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); AssertEx.EqualTolerance(CoulombsPerSquareCentimeterInOneCoulombPerSquareMeter, coulombpersquaremeter.As(ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter), CoulombsPerSquareCentimeterTolerance); AssertEx.EqualTolerance(CoulombsPerSquareInchInOneCoulombPerSquareMeter, coulombpersquaremeter.As(ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch), CoulombsPerSquareInchTolerance); AssertEx.EqualTolerance(CoulombsPerSquareMeterInOneCoulombPerSquareMeter, coulombpersquaremeter.As(ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter), CoulombsPerSquareMeterTolerance); @@ -105,7 +105,7 @@ public void As() [Fact] public void ToUnit() { - var coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); + var coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); var coulombpersquarecentimeterQuantity = coulombpersquaremeter.ToUnit(ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter); AssertEx.EqualTolerance(CoulombsPerSquareCentimeterInOneCoulombPerSquareMeter, (double)coulombpersquarecentimeterQuantity.Value, CoulombsPerSquareCentimeterTolerance); @@ -123,30 +123,30 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ElectricSurfaceChargeDensity coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); - AssertEx.EqualTolerance(1, ElectricSurfaceChargeDensity.FromCoulombsPerSquareCentimeter(coulombpersquaremeter.CoulombsPerSquareCentimeter).CoulombsPerSquareMeter, CoulombsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, ElectricSurfaceChargeDensity.FromCoulombsPerSquareInch(coulombpersquaremeter.CoulombsPerSquareInch).CoulombsPerSquareMeter, CoulombsPerSquareInchTolerance); - AssertEx.EqualTolerance(1, ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(coulombpersquaremeter.CoulombsPerSquareMeter).CoulombsPerSquareMeter, CoulombsPerSquareMeterTolerance); + ElectricSurfaceChargeDensity coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); + AssertEx.EqualTolerance(1, ElectricSurfaceChargeDensity.FromCoulombsPerSquareCentimeter(coulombpersquaremeter.CoulombsPerSquareCentimeter).CoulombsPerSquareMeter, CoulombsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, ElectricSurfaceChargeDensity.FromCoulombsPerSquareInch(coulombpersquaremeter.CoulombsPerSquareInch).CoulombsPerSquareMeter, CoulombsPerSquareInchTolerance); + AssertEx.EqualTolerance(1, ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(coulombpersquaremeter.CoulombsPerSquareMeter).CoulombsPerSquareMeter, CoulombsPerSquareMeterTolerance); } [Fact] public void ArithmeticOperators() { - ElectricSurfaceChargeDensity v = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); + ElectricSurfaceChargeDensity v = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); AssertEx.EqualTolerance(-1, -v.CoulombsPerSquareMeter, CoulombsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(3)-v).CoulombsPerSquareMeter, CoulombsPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, (ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(3)-v).CoulombsPerSquareMeter, CoulombsPerSquareMeterTolerance); AssertEx.EqualTolerance(2, (v + v).CoulombsPerSquareMeter, CoulombsPerSquareMeterTolerance); AssertEx.EqualTolerance(10, (v*10).CoulombsPerSquareMeter, CoulombsPerSquareMeterTolerance); AssertEx.EqualTolerance(10, (10*v).CoulombsPerSquareMeter, CoulombsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(10)/5).CoulombsPerSquareMeter, CoulombsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(10)/ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(5), CoulombsPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, (ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(10)/5).CoulombsPerSquareMeter, CoulombsPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(10)/ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(5), CoulombsPerSquareMeterTolerance); } [Fact] public void ComparisonOperators() { - ElectricSurfaceChargeDensity oneCoulombPerSquareMeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); - ElectricSurfaceChargeDensity twoCoulombsPerSquareMeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(2); + ElectricSurfaceChargeDensity oneCoulombPerSquareMeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); + ElectricSurfaceChargeDensity twoCoulombsPerSquareMeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(2); Assert.True(oneCoulombPerSquareMeter < twoCoulombsPerSquareMeter); Assert.True(oneCoulombPerSquareMeter <= twoCoulombsPerSquareMeter); @@ -162,31 +162,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ElectricSurfaceChargeDensity coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); + ElectricSurfaceChargeDensity coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); Assert.Equal(0, coulombpersquaremeter.CompareTo(coulombpersquaremeter)); - Assert.True(coulombpersquaremeter.CompareTo(ElectricSurfaceChargeDensity.Zero) > 0); - Assert.True(ElectricSurfaceChargeDensity.Zero.CompareTo(coulombpersquaremeter) < 0); + Assert.True(coulombpersquaremeter.CompareTo(ElectricSurfaceChargeDensity.Zero) > 0); + Assert.True(ElectricSurfaceChargeDensity.Zero.CompareTo(coulombpersquaremeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricSurfaceChargeDensity coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); + ElectricSurfaceChargeDensity coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); Assert.Throws(() => coulombpersquaremeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricSurfaceChargeDensity coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); + ElectricSurfaceChargeDensity coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); Assert.Throws(() => coulombpersquaremeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); - var b = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(2); + var a = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); + var b = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(2); // ReSharper disable EqualExpressionComparison @@ -205,8 +205,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); - var b = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(2); + var a = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); + var b = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -216,29 +216,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); - Assert.True(v.Equals(ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1), CoulombsPerSquareMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricSurfaceChargeDensity.Zero, CoulombsPerSquareMeterTolerance, ComparisonType.Relative)); + var v = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); + Assert.True(v.Equals(ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1), CoulombsPerSquareMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricSurfaceChargeDensity.Zero, CoulombsPerSquareMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricSurfaceChargeDensity coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); + ElectricSurfaceChargeDensity coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); Assert.False(coulombpersquaremeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricSurfaceChargeDensity coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); + ElectricSurfaceChargeDensity coulombpersquaremeter = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1); Assert.False(coulombpersquaremeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ElectricSurfaceChargeDensityUnit.Undefined, ElectricSurfaceChargeDensity.Units); + Assert.DoesNotContain(ElectricSurfaceChargeDensityUnit.Undefined, ElectricSurfaceChargeDensity.Units); } [Fact] @@ -257,7 +257,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ElectricSurfaceChargeDensity.BaseDimensions is null); + Assert.False(ElectricSurfaceChargeDensity.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs index dee467b483..0194b85dba 100644 --- a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Energy. + /// Test of Energy. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class EnergyTestsBase @@ -89,26 +89,26 @@ public abstract partial class EnergyTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Energy((double)0.0, EnergyUnit.Undefined)); + Assert.Throws(() => new Energy((double)0.0, EnergyUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Energy(double.PositiveInfinity, EnergyUnit.Joule)); - Assert.Throws(() => new Energy(double.NegativeInfinity, EnergyUnit.Joule)); + Assert.Throws(() => new Energy(double.PositiveInfinity, EnergyUnit.Joule)); + Assert.Throws(() => new Energy(double.NegativeInfinity, EnergyUnit.Joule)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Energy(double.NaN, EnergyUnit.Joule)); + Assert.Throws(() => new Energy(double.NaN, EnergyUnit.Joule)); } [Fact] public void JouleToEnergyUnits() { - Energy joule = Energy.FromJoules(1); + Energy joule = Energy.FromJoules(1); AssertEx.EqualTolerance(BritishThermalUnitsInOneJoule, joule.BritishThermalUnits, BritishThermalUnitsTolerance); AssertEx.EqualTolerance(CaloriesInOneJoule, joule.Calories, CaloriesTolerance); AssertEx.EqualTolerance(DecathermsEcInOneJoule, joule.DecathermsEc, DecathermsEcTolerance); @@ -138,49 +138,49 @@ public void JouleToEnergyUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.BritishThermalUnit).BritishThermalUnits, BritishThermalUnitsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Calorie).Calories, CaloriesTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecathermEc).DecathermsEc, DecathermsEcTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecathermImperial).DecathermsImperial, DecathermsImperialTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecathermUs).DecathermsUs, DecathermsUsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ElectronVolt).ElectronVolts, ElectronVoltsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Erg).Ergs, ErgsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.FootPound).FootPounds, FootPoundsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.GigabritishThermalUnit).GigabritishThermalUnits, GigabritishThermalUnitsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.GigawattHour).GigawattHours, GigawattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Joule).Joules, JoulesTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.KilobritishThermalUnit).KilobritishThermalUnits, KilobritishThermalUnitsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Kilocalorie).Kilocalories, KilocaloriesTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Kilojoule).Kilojoules, KilojoulesTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.KilowattHour).KilowattHours, KilowattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.MegabritishThermalUnit).MegabritishThermalUnits, MegabritishThermalUnitsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Megajoule).Megajoules, MegajoulesTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.MegawattHour).MegawattHours, MegawattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Millijoule).Millijoules, MillijoulesTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.TerawattHour).TerawattHours, TerawattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ThermEc).ThermsEc, ThermsEcTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ThermImperial).ThermsImperial, ThermsImperialTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ThermUs).ThermsUs, ThermsUsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.WattHour).WattHours, WattHoursTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.BritishThermalUnit).BritishThermalUnits, BritishThermalUnitsTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Calorie).Calories, CaloriesTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecathermEc).DecathermsEc, DecathermsEcTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecathermImperial).DecathermsImperial, DecathermsImperialTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecathermUs).DecathermsUs, DecathermsUsTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ElectronVolt).ElectronVolts, ElectronVoltsTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Erg).Ergs, ErgsTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.FootPound).FootPounds, FootPoundsTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.GigabritishThermalUnit).GigabritishThermalUnits, GigabritishThermalUnitsTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.GigawattHour).GigawattHours, GigawattHoursTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Joule).Joules, JoulesTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.KilobritishThermalUnit).KilobritishThermalUnits, KilobritishThermalUnitsTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Kilocalorie).Kilocalories, KilocaloriesTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Kilojoule).Kilojoules, KilojoulesTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.KilowattHour).KilowattHours, KilowattHoursTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.MegabritishThermalUnit).MegabritishThermalUnits, MegabritishThermalUnitsTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Megajoule).Megajoules, MegajoulesTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.MegawattHour).MegawattHours, MegawattHoursTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Millijoule).Millijoules, MillijoulesTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.TerawattHour).TerawattHours, TerawattHoursTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ThermEc).ThermsEc, ThermsEcTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ThermImperial).ThermsImperial, ThermsImperialTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ThermUs).ThermsUs, ThermsUsTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.WattHour).WattHours, WattHoursTolerance); } [Fact] public void FromJoules_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Energy.FromJoules(double.PositiveInfinity)); - Assert.Throws(() => Energy.FromJoules(double.NegativeInfinity)); + Assert.Throws(() => Energy.FromJoules(double.PositiveInfinity)); + Assert.Throws(() => Energy.FromJoules(double.NegativeInfinity)); } [Fact] public void FromJoules_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Energy.FromJoules(double.NaN)); + Assert.Throws(() => Energy.FromJoules(double.NaN)); } [Fact] public void As() { - var joule = Energy.FromJoules(1); + var joule = Energy.FromJoules(1); AssertEx.EqualTolerance(BritishThermalUnitsInOneJoule, joule.As(EnergyUnit.BritishThermalUnit), BritishThermalUnitsTolerance); AssertEx.EqualTolerance(CaloriesInOneJoule, joule.As(EnergyUnit.Calorie), CaloriesTolerance); AssertEx.EqualTolerance(DecathermsEcInOneJoule, joule.As(EnergyUnit.DecathermEc), DecathermsEcTolerance); @@ -210,7 +210,7 @@ public void As() [Fact] public void ToUnit() { - var joule = Energy.FromJoules(1); + var joule = Energy.FromJoules(1); var britishthermalunitQuantity = joule.ToUnit(EnergyUnit.BritishThermalUnit); AssertEx.EqualTolerance(BritishThermalUnitsInOneJoule, (double)britishthermalunitQuantity.Value, BritishThermalUnitsTolerance); @@ -312,51 +312,51 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Energy joule = Energy.FromJoules(1); - AssertEx.EqualTolerance(1, Energy.FromBritishThermalUnits(joule.BritishThermalUnits).Joules, BritishThermalUnitsTolerance); - AssertEx.EqualTolerance(1, Energy.FromCalories(joule.Calories).Joules, CaloriesTolerance); - AssertEx.EqualTolerance(1, Energy.FromDecathermsEc(joule.DecathermsEc).Joules, DecathermsEcTolerance); - AssertEx.EqualTolerance(1, Energy.FromDecathermsImperial(joule.DecathermsImperial).Joules, DecathermsImperialTolerance); - AssertEx.EqualTolerance(1, Energy.FromDecathermsUs(joule.DecathermsUs).Joules, DecathermsUsTolerance); - AssertEx.EqualTolerance(1, Energy.FromElectronVolts(joule.ElectronVolts).Joules, ElectronVoltsTolerance); - AssertEx.EqualTolerance(1, Energy.FromErgs(joule.Ergs).Joules, ErgsTolerance); - AssertEx.EqualTolerance(1, Energy.FromFootPounds(joule.FootPounds).Joules, FootPoundsTolerance); - AssertEx.EqualTolerance(1, Energy.FromGigabritishThermalUnits(joule.GigabritishThermalUnits).Joules, GigabritishThermalUnitsTolerance); - AssertEx.EqualTolerance(1, Energy.FromGigawattHours(joule.GigawattHours).Joules, GigawattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.FromJoules(joule.Joules).Joules, JoulesTolerance); - AssertEx.EqualTolerance(1, Energy.FromKilobritishThermalUnits(joule.KilobritishThermalUnits).Joules, KilobritishThermalUnitsTolerance); - AssertEx.EqualTolerance(1, Energy.FromKilocalories(joule.Kilocalories).Joules, KilocaloriesTolerance); - AssertEx.EqualTolerance(1, Energy.FromKilojoules(joule.Kilojoules).Joules, KilojoulesTolerance); - AssertEx.EqualTolerance(1, Energy.FromKilowattHours(joule.KilowattHours).Joules, KilowattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.FromMegabritishThermalUnits(joule.MegabritishThermalUnits).Joules, MegabritishThermalUnitsTolerance); - AssertEx.EqualTolerance(1, Energy.FromMegajoules(joule.Megajoules).Joules, MegajoulesTolerance); - AssertEx.EqualTolerance(1, Energy.FromMegawattHours(joule.MegawattHours).Joules, MegawattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.FromMillijoules(joule.Millijoules).Joules, MillijoulesTolerance); - AssertEx.EqualTolerance(1, Energy.FromTerawattHours(joule.TerawattHours).Joules, TerawattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.FromThermsEc(joule.ThermsEc).Joules, ThermsEcTolerance); - AssertEx.EqualTolerance(1, Energy.FromThermsImperial(joule.ThermsImperial).Joules, ThermsImperialTolerance); - AssertEx.EqualTolerance(1, Energy.FromThermsUs(joule.ThermsUs).Joules, ThermsUsTolerance); - AssertEx.EqualTolerance(1, Energy.FromWattHours(joule.WattHours).Joules, WattHoursTolerance); + Energy joule = Energy.FromJoules(1); + AssertEx.EqualTolerance(1, Energy.FromBritishThermalUnits(joule.BritishThermalUnits).Joules, BritishThermalUnitsTolerance); + AssertEx.EqualTolerance(1, Energy.FromCalories(joule.Calories).Joules, CaloriesTolerance); + AssertEx.EqualTolerance(1, Energy.FromDecathermsEc(joule.DecathermsEc).Joules, DecathermsEcTolerance); + AssertEx.EqualTolerance(1, Energy.FromDecathermsImperial(joule.DecathermsImperial).Joules, DecathermsImperialTolerance); + AssertEx.EqualTolerance(1, Energy.FromDecathermsUs(joule.DecathermsUs).Joules, DecathermsUsTolerance); + AssertEx.EqualTolerance(1, Energy.FromElectronVolts(joule.ElectronVolts).Joules, ElectronVoltsTolerance); + AssertEx.EqualTolerance(1, Energy.FromErgs(joule.Ergs).Joules, ErgsTolerance); + AssertEx.EqualTolerance(1, Energy.FromFootPounds(joule.FootPounds).Joules, FootPoundsTolerance); + AssertEx.EqualTolerance(1, Energy.FromGigabritishThermalUnits(joule.GigabritishThermalUnits).Joules, GigabritishThermalUnitsTolerance); + AssertEx.EqualTolerance(1, Energy.FromGigawattHours(joule.GigawattHours).Joules, GigawattHoursTolerance); + AssertEx.EqualTolerance(1, Energy.FromJoules(joule.Joules).Joules, JoulesTolerance); + AssertEx.EqualTolerance(1, Energy.FromKilobritishThermalUnits(joule.KilobritishThermalUnits).Joules, KilobritishThermalUnitsTolerance); + AssertEx.EqualTolerance(1, Energy.FromKilocalories(joule.Kilocalories).Joules, KilocaloriesTolerance); + AssertEx.EqualTolerance(1, Energy.FromKilojoules(joule.Kilojoules).Joules, KilojoulesTolerance); + AssertEx.EqualTolerance(1, Energy.FromKilowattHours(joule.KilowattHours).Joules, KilowattHoursTolerance); + AssertEx.EqualTolerance(1, Energy.FromMegabritishThermalUnits(joule.MegabritishThermalUnits).Joules, MegabritishThermalUnitsTolerance); + AssertEx.EqualTolerance(1, Energy.FromMegajoules(joule.Megajoules).Joules, MegajoulesTolerance); + AssertEx.EqualTolerance(1, Energy.FromMegawattHours(joule.MegawattHours).Joules, MegawattHoursTolerance); + AssertEx.EqualTolerance(1, Energy.FromMillijoules(joule.Millijoules).Joules, MillijoulesTolerance); + AssertEx.EqualTolerance(1, Energy.FromTerawattHours(joule.TerawattHours).Joules, TerawattHoursTolerance); + AssertEx.EqualTolerance(1, Energy.FromThermsEc(joule.ThermsEc).Joules, ThermsEcTolerance); + AssertEx.EqualTolerance(1, Energy.FromThermsImperial(joule.ThermsImperial).Joules, ThermsImperialTolerance); + AssertEx.EqualTolerance(1, Energy.FromThermsUs(joule.ThermsUs).Joules, ThermsUsTolerance); + AssertEx.EqualTolerance(1, Energy.FromWattHours(joule.WattHours).Joules, WattHoursTolerance); } [Fact] public void ArithmeticOperators() { - Energy v = Energy.FromJoules(1); + Energy v = Energy.FromJoules(1); AssertEx.EqualTolerance(-1, -v.Joules, JoulesTolerance); - AssertEx.EqualTolerance(2, (Energy.FromJoules(3)-v).Joules, JoulesTolerance); + AssertEx.EqualTolerance(2, (Energy.FromJoules(3)-v).Joules, JoulesTolerance); AssertEx.EqualTolerance(2, (v + v).Joules, JoulesTolerance); AssertEx.EqualTolerance(10, (v*10).Joules, JoulesTolerance); AssertEx.EqualTolerance(10, (10*v).Joules, JoulesTolerance); - AssertEx.EqualTolerance(2, (Energy.FromJoules(10)/5).Joules, JoulesTolerance); - AssertEx.EqualTolerance(2, Energy.FromJoules(10)/Energy.FromJoules(5), JoulesTolerance); + AssertEx.EqualTolerance(2, (Energy.FromJoules(10)/5).Joules, JoulesTolerance); + AssertEx.EqualTolerance(2, Energy.FromJoules(10)/Energy.FromJoules(5), JoulesTolerance); } [Fact] public void ComparisonOperators() { - Energy oneJoule = Energy.FromJoules(1); - Energy twoJoules = Energy.FromJoules(2); + Energy oneJoule = Energy.FromJoules(1); + Energy twoJoules = Energy.FromJoules(2); Assert.True(oneJoule < twoJoules); Assert.True(oneJoule <= twoJoules); @@ -372,31 +372,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Energy joule = Energy.FromJoules(1); + Energy joule = Energy.FromJoules(1); Assert.Equal(0, joule.CompareTo(joule)); - Assert.True(joule.CompareTo(Energy.Zero) > 0); - Assert.True(Energy.Zero.CompareTo(joule) < 0); + Assert.True(joule.CompareTo(Energy.Zero) > 0); + Assert.True(Energy.Zero.CompareTo(joule) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Energy joule = Energy.FromJoules(1); + Energy joule = Energy.FromJoules(1); Assert.Throws(() => joule.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Energy joule = Energy.FromJoules(1); + Energy joule = Energy.FromJoules(1); Assert.Throws(() => joule.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Energy.FromJoules(1); - var b = Energy.FromJoules(2); + var a = Energy.FromJoules(1); + var b = Energy.FromJoules(2); // ReSharper disable EqualExpressionComparison @@ -415,8 +415,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Energy.FromJoules(1); - var b = Energy.FromJoules(2); + var a = Energy.FromJoules(1); + var b = Energy.FromJoules(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -426,29 +426,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Energy.FromJoules(1); - Assert.True(v.Equals(Energy.FromJoules(1), JoulesTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Energy.Zero, JoulesTolerance, ComparisonType.Relative)); + var v = Energy.FromJoules(1); + Assert.True(v.Equals(Energy.FromJoules(1), JoulesTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Energy.Zero, JoulesTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Energy joule = Energy.FromJoules(1); + Energy joule = Energy.FromJoules(1); Assert.False(joule.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Energy joule = Energy.FromJoules(1); + Energy joule = Energy.FromJoules(1); Assert.False(joule.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(EnergyUnit.Undefined, Energy.Units); + Assert.DoesNotContain(EnergyUnit.Undefined, Energy.Units); } [Fact] @@ -467,7 +467,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Energy.BaseDimensions is null); + Assert.False(Energy.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs index c829f3cab4..1904d507f8 100644 --- a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs @@ -55,26 +55,26 @@ public abstract partial class EntropyTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Entropy((double)0.0, EntropyUnit.Undefined)); + Assert.Throws(() => new Entropy((double)0.0, EntropyUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Entropy(double.PositiveInfinity, EntropyUnit.JoulePerKelvin)); - Assert.Throws(() => new Entropy(double.NegativeInfinity, EntropyUnit.JoulePerKelvin)); + Assert.Throws(() => new Entropy(double.PositiveInfinity, EntropyUnit.JoulePerKelvin)); + Assert.Throws(() => new Entropy(double.NegativeInfinity, EntropyUnit.JoulePerKelvin)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Entropy(double.NaN, EntropyUnit.JoulePerKelvin)); + Assert.Throws(() => new Entropy(double.NaN, EntropyUnit.JoulePerKelvin)); } [Fact] public void JoulePerKelvinToEntropyUnits() { - Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); + Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); AssertEx.EqualTolerance(CaloriesPerKelvinInOneJoulePerKelvin, jouleperkelvin.CaloriesPerKelvin, CaloriesPerKelvinTolerance); AssertEx.EqualTolerance(JoulesPerDegreeCelsiusInOneJoulePerKelvin, jouleperkelvin.JoulesPerDegreeCelsius, JoulesPerDegreeCelsiusTolerance); AssertEx.EqualTolerance(JoulesPerKelvinInOneJoulePerKelvin, jouleperkelvin.JoulesPerKelvin, JoulesPerKelvinTolerance); @@ -87,32 +87,32 @@ public void JoulePerKelvinToEntropyUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.CaloriePerKelvin).CaloriesPerKelvin, CaloriesPerKelvinTolerance); - AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.JoulePerDegreeCelsius).JoulesPerDegreeCelsius, JoulesPerDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.JoulePerKelvin).JoulesPerKelvin, JoulesPerKelvinTolerance); - AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.KilocaloriePerKelvin).KilocaloriesPerKelvin, KilocaloriesPerKelvinTolerance); - AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.KilojoulePerDegreeCelsius).KilojoulesPerDegreeCelsius, KilojoulesPerDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.KilojoulePerKelvin).KilojoulesPerKelvin, KilojoulesPerKelvinTolerance); - AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.MegajoulePerKelvin).MegajoulesPerKelvin, MegajoulesPerKelvinTolerance); + AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.CaloriePerKelvin).CaloriesPerKelvin, CaloriesPerKelvinTolerance); + AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.JoulePerDegreeCelsius).JoulesPerDegreeCelsius, JoulesPerDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.JoulePerKelvin).JoulesPerKelvin, JoulesPerKelvinTolerance); + AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.KilocaloriePerKelvin).KilocaloriesPerKelvin, KilocaloriesPerKelvinTolerance); + AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.KilojoulePerDegreeCelsius).KilojoulesPerDegreeCelsius, KilojoulesPerDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.KilojoulePerKelvin).KilojoulesPerKelvin, KilojoulesPerKelvinTolerance); + AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.MegajoulePerKelvin).MegajoulesPerKelvin, MegajoulesPerKelvinTolerance); } [Fact] public void FromJoulesPerKelvin_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.PositiveInfinity)); - Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.NegativeInfinity)); + Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.PositiveInfinity)); + Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.NegativeInfinity)); } [Fact] public void FromJoulesPerKelvin_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.NaN)); + Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.NaN)); } [Fact] public void As() { - var jouleperkelvin = Entropy.FromJoulesPerKelvin(1); + var jouleperkelvin = Entropy.FromJoulesPerKelvin(1); AssertEx.EqualTolerance(CaloriesPerKelvinInOneJoulePerKelvin, jouleperkelvin.As(EntropyUnit.CaloriePerKelvin), CaloriesPerKelvinTolerance); AssertEx.EqualTolerance(JoulesPerDegreeCelsiusInOneJoulePerKelvin, jouleperkelvin.As(EntropyUnit.JoulePerDegreeCelsius), JoulesPerDegreeCelsiusTolerance); AssertEx.EqualTolerance(JoulesPerKelvinInOneJoulePerKelvin, jouleperkelvin.As(EntropyUnit.JoulePerKelvin), JoulesPerKelvinTolerance); @@ -125,7 +125,7 @@ public void As() [Fact] public void ToUnit() { - var jouleperkelvin = Entropy.FromJoulesPerKelvin(1); + var jouleperkelvin = Entropy.FromJoulesPerKelvin(1); var calorieperkelvinQuantity = jouleperkelvin.ToUnit(EntropyUnit.CaloriePerKelvin); AssertEx.EqualTolerance(CaloriesPerKelvinInOneJoulePerKelvin, (double)calorieperkelvinQuantity.Value, CaloriesPerKelvinTolerance); @@ -159,34 +159,34 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); - AssertEx.EqualTolerance(1, Entropy.FromCaloriesPerKelvin(jouleperkelvin.CaloriesPerKelvin).JoulesPerKelvin, CaloriesPerKelvinTolerance); - AssertEx.EqualTolerance(1, Entropy.FromJoulesPerDegreeCelsius(jouleperkelvin.JoulesPerDegreeCelsius).JoulesPerKelvin, JoulesPerDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, Entropy.FromJoulesPerKelvin(jouleperkelvin.JoulesPerKelvin).JoulesPerKelvin, JoulesPerKelvinTolerance); - AssertEx.EqualTolerance(1, Entropy.FromKilocaloriesPerKelvin(jouleperkelvin.KilocaloriesPerKelvin).JoulesPerKelvin, KilocaloriesPerKelvinTolerance); - AssertEx.EqualTolerance(1, Entropy.FromKilojoulesPerDegreeCelsius(jouleperkelvin.KilojoulesPerDegreeCelsius).JoulesPerKelvin, KilojoulesPerDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, Entropy.FromKilojoulesPerKelvin(jouleperkelvin.KilojoulesPerKelvin).JoulesPerKelvin, KilojoulesPerKelvinTolerance); - AssertEx.EqualTolerance(1, Entropy.FromMegajoulesPerKelvin(jouleperkelvin.MegajoulesPerKelvin).JoulesPerKelvin, MegajoulesPerKelvinTolerance); + Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); + AssertEx.EqualTolerance(1, Entropy.FromCaloriesPerKelvin(jouleperkelvin.CaloriesPerKelvin).JoulesPerKelvin, CaloriesPerKelvinTolerance); + AssertEx.EqualTolerance(1, Entropy.FromJoulesPerDegreeCelsius(jouleperkelvin.JoulesPerDegreeCelsius).JoulesPerKelvin, JoulesPerDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, Entropy.FromJoulesPerKelvin(jouleperkelvin.JoulesPerKelvin).JoulesPerKelvin, JoulesPerKelvinTolerance); + AssertEx.EqualTolerance(1, Entropy.FromKilocaloriesPerKelvin(jouleperkelvin.KilocaloriesPerKelvin).JoulesPerKelvin, KilocaloriesPerKelvinTolerance); + AssertEx.EqualTolerance(1, Entropy.FromKilojoulesPerDegreeCelsius(jouleperkelvin.KilojoulesPerDegreeCelsius).JoulesPerKelvin, KilojoulesPerDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, Entropy.FromKilojoulesPerKelvin(jouleperkelvin.KilojoulesPerKelvin).JoulesPerKelvin, KilojoulesPerKelvinTolerance); + AssertEx.EqualTolerance(1, Entropy.FromMegajoulesPerKelvin(jouleperkelvin.MegajoulesPerKelvin).JoulesPerKelvin, MegajoulesPerKelvinTolerance); } [Fact] public void ArithmeticOperators() { - Entropy v = Entropy.FromJoulesPerKelvin(1); + Entropy v = Entropy.FromJoulesPerKelvin(1); AssertEx.EqualTolerance(-1, -v.JoulesPerKelvin, JoulesPerKelvinTolerance); - AssertEx.EqualTolerance(2, (Entropy.FromJoulesPerKelvin(3)-v).JoulesPerKelvin, JoulesPerKelvinTolerance); + AssertEx.EqualTolerance(2, (Entropy.FromJoulesPerKelvin(3)-v).JoulesPerKelvin, JoulesPerKelvinTolerance); AssertEx.EqualTolerance(2, (v + v).JoulesPerKelvin, JoulesPerKelvinTolerance); AssertEx.EqualTolerance(10, (v*10).JoulesPerKelvin, JoulesPerKelvinTolerance); AssertEx.EqualTolerance(10, (10*v).JoulesPerKelvin, JoulesPerKelvinTolerance); - AssertEx.EqualTolerance(2, (Entropy.FromJoulesPerKelvin(10)/5).JoulesPerKelvin, JoulesPerKelvinTolerance); - AssertEx.EqualTolerance(2, Entropy.FromJoulesPerKelvin(10)/Entropy.FromJoulesPerKelvin(5), JoulesPerKelvinTolerance); + AssertEx.EqualTolerance(2, (Entropy.FromJoulesPerKelvin(10)/5).JoulesPerKelvin, JoulesPerKelvinTolerance); + AssertEx.EqualTolerance(2, Entropy.FromJoulesPerKelvin(10)/Entropy.FromJoulesPerKelvin(5), JoulesPerKelvinTolerance); } [Fact] public void ComparisonOperators() { - Entropy oneJoulePerKelvin = Entropy.FromJoulesPerKelvin(1); - Entropy twoJoulesPerKelvin = Entropy.FromJoulesPerKelvin(2); + Entropy oneJoulePerKelvin = Entropy.FromJoulesPerKelvin(1); + Entropy twoJoulesPerKelvin = Entropy.FromJoulesPerKelvin(2); Assert.True(oneJoulePerKelvin < twoJoulesPerKelvin); Assert.True(oneJoulePerKelvin <= twoJoulesPerKelvin); @@ -202,31 +202,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); + Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); Assert.Equal(0, jouleperkelvin.CompareTo(jouleperkelvin)); - Assert.True(jouleperkelvin.CompareTo(Entropy.Zero) > 0); - Assert.True(Entropy.Zero.CompareTo(jouleperkelvin) < 0); + Assert.True(jouleperkelvin.CompareTo(Entropy.Zero) > 0); + Assert.True(Entropy.Zero.CompareTo(jouleperkelvin) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); + Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); Assert.Throws(() => jouleperkelvin.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); + Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); Assert.Throws(() => jouleperkelvin.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Entropy.FromJoulesPerKelvin(1); - var b = Entropy.FromJoulesPerKelvin(2); + var a = Entropy.FromJoulesPerKelvin(1); + var b = Entropy.FromJoulesPerKelvin(2); // ReSharper disable EqualExpressionComparison @@ -245,8 +245,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Entropy.FromJoulesPerKelvin(1); - var b = Entropy.FromJoulesPerKelvin(2); + var a = Entropy.FromJoulesPerKelvin(1); + var b = Entropy.FromJoulesPerKelvin(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -256,29 +256,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Entropy.FromJoulesPerKelvin(1); - Assert.True(v.Equals(Entropy.FromJoulesPerKelvin(1), JoulesPerKelvinTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Entropy.Zero, JoulesPerKelvinTolerance, ComparisonType.Relative)); + var v = Entropy.FromJoulesPerKelvin(1); + Assert.True(v.Equals(Entropy.FromJoulesPerKelvin(1), JoulesPerKelvinTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Entropy.Zero, JoulesPerKelvinTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); + Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); Assert.False(jouleperkelvin.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); + Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); Assert.False(jouleperkelvin.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(EntropyUnit.Undefined, Entropy.Units); + Assert.DoesNotContain(EntropyUnit.Undefined, Entropy.Units); } [Fact] @@ -297,7 +297,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Entropy.BaseDimensions is null); + Assert.False(Entropy.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs index 72699d5913..a9451738ec 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs @@ -63,26 +63,26 @@ public abstract partial class ForceChangeRateTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ForceChangeRate((double)0.0, ForceChangeRateUnit.Undefined)); + Assert.Throws(() => new ForceChangeRate((double)0.0, ForceChangeRateUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ForceChangeRate(double.PositiveInfinity, ForceChangeRateUnit.NewtonPerSecond)); - Assert.Throws(() => new ForceChangeRate(double.NegativeInfinity, ForceChangeRateUnit.NewtonPerSecond)); + Assert.Throws(() => new ForceChangeRate(double.PositiveInfinity, ForceChangeRateUnit.NewtonPerSecond)); + Assert.Throws(() => new ForceChangeRate(double.NegativeInfinity, ForceChangeRateUnit.NewtonPerSecond)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ForceChangeRate(double.NaN, ForceChangeRateUnit.NewtonPerSecond)); + Assert.Throws(() => new ForceChangeRate(double.NaN, ForceChangeRateUnit.NewtonPerSecond)); } [Fact] public void NewtonPerSecondToForceChangeRateUnits() { - ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); + ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); AssertEx.EqualTolerance(CentinewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.CentinewtonsPerSecond, CentinewtonsPerSecondTolerance); AssertEx.EqualTolerance(DecanewtonsPerMinuteInOneNewtonPerSecond, newtonpersecond.DecanewtonsPerMinute, DecanewtonsPerMinuteTolerance); AssertEx.EqualTolerance(DecanewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.DecanewtonsPerSecond, DecanewtonsPerSecondTolerance); @@ -99,36 +99,36 @@ public void NewtonPerSecondToForceChangeRateUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.CentinewtonPerSecond).CentinewtonsPerSecond, CentinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.DecanewtonPerMinute).DecanewtonsPerMinute, DecanewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.DecanewtonPerSecond).DecanewtonsPerSecond, DecanewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.DecinewtonPerSecond).DecinewtonsPerSecond, DecinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.KilonewtonPerMinute).KilonewtonsPerMinute, KilonewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.KilonewtonPerSecond).KilonewtonsPerSecond, KilonewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.MicronewtonPerSecond).MicronewtonsPerSecond, MicronewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.MillinewtonPerSecond).MillinewtonsPerSecond, MillinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.NanonewtonPerSecond).NanonewtonsPerSecond, NanonewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.NewtonPerMinute).NewtonsPerMinute, NewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.NewtonPerSecond).NewtonsPerSecond, NewtonsPerSecondTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.CentinewtonPerSecond).CentinewtonsPerSecond, CentinewtonsPerSecondTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.DecanewtonPerMinute).DecanewtonsPerMinute, DecanewtonsPerMinuteTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.DecanewtonPerSecond).DecanewtonsPerSecond, DecanewtonsPerSecondTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.DecinewtonPerSecond).DecinewtonsPerSecond, DecinewtonsPerSecondTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.KilonewtonPerMinute).KilonewtonsPerMinute, KilonewtonsPerMinuteTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.KilonewtonPerSecond).KilonewtonsPerSecond, KilonewtonsPerSecondTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.MicronewtonPerSecond).MicronewtonsPerSecond, MicronewtonsPerSecondTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.MillinewtonPerSecond).MillinewtonsPerSecond, MillinewtonsPerSecondTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.NanonewtonPerSecond).NanonewtonsPerSecond, NanonewtonsPerSecondTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.NewtonPerMinute).NewtonsPerMinute, NewtonsPerMinuteTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.NewtonPerSecond).NewtonsPerSecond, NewtonsPerSecondTolerance); } [Fact] public void FromNewtonsPerSecond_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.PositiveInfinity)); - Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.NegativeInfinity)); + Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.PositiveInfinity)); + Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.NegativeInfinity)); } [Fact] public void FromNewtonsPerSecond_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.NaN)); + Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.NaN)); } [Fact] public void As() { - var newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); + var newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); AssertEx.EqualTolerance(CentinewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.As(ForceChangeRateUnit.CentinewtonPerSecond), CentinewtonsPerSecondTolerance); AssertEx.EqualTolerance(DecanewtonsPerMinuteInOneNewtonPerSecond, newtonpersecond.As(ForceChangeRateUnit.DecanewtonPerMinute), DecanewtonsPerMinuteTolerance); AssertEx.EqualTolerance(DecanewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.As(ForceChangeRateUnit.DecanewtonPerSecond), DecanewtonsPerSecondTolerance); @@ -145,7 +145,7 @@ public void As() [Fact] public void ToUnit() { - var newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); + var newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); var centinewtonpersecondQuantity = newtonpersecond.ToUnit(ForceChangeRateUnit.CentinewtonPerSecond); AssertEx.EqualTolerance(CentinewtonsPerSecondInOneNewtonPerSecond, (double)centinewtonpersecondQuantity.Value, CentinewtonsPerSecondTolerance); @@ -195,38 +195,38 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); - AssertEx.EqualTolerance(1, ForceChangeRate.FromCentinewtonsPerSecond(newtonpersecond.CentinewtonsPerSecond).NewtonsPerSecond, CentinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromDecanewtonsPerMinute(newtonpersecond.DecanewtonsPerMinute).NewtonsPerSecond, DecanewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromDecanewtonsPerSecond(newtonpersecond.DecanewtonsPerSecond).NewtonsPerSecond, DecanewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromDecinewtonsPerSecond(newtonpersecond.DecinewtonsPerSecond).NewtonsPerSecond, DecinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromKilonewtonsPerMinute(newtonpersecond.KilonewtonsPerMinute).NewtonsPerSecond, KilonewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromKilonewtonsPerSecond(newtonpersecond.KilonewtonsPerSecond).NewtonsPerSecond, KilonewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromMicronewtonsPerSecond(newtonpersecond.MicronewtonsPerSecond).NewtonsPerSecond, MicronewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromMillinewtonsPerSecond(newtonpersecond.MillinewtonsPerSecond).NewtonsPerSecond, MillinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromNanonewtonsPerSecond(newtonpersecond.NanonewtonsPerSecond).NewtonsPerSecond, NanonewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromNewtonsPerMinute(newtonpersecond.NewtonsPerMinute).NewtonsPerSecond, NewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromNewtonsPerSecond(newtonpersecond.NewtonsPerSecond).NewtonsPerSecond, NewtonsPerSecondTolerance); + ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); + AssertEx.EqualTolerance(1, ForceChangeRate.FromCentinewtonsPerSecond(newtonpersecond.CentinewtonsPerSecond).NewtonsPerSecond, CentinewtonsPerSecondTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.FromDecanewtonsPerMinute(newtonpersecond.DecanewtonsPerMinute).NewtonsPerSecond, DecanewtonsPerMinuteTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.FromDecanewtonsPerSecond(newtonpersecond.DecanewtonsPerSecond).NewtonsPerSecond, DecanewtonsPerSecondTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.FromDecinewtonsPerSecond(newtonpersecond.DecinewtonsPerSecond).NewtonsPerSecond, DecinewtonsPerSecondTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.FromKilonewtonsPerMinute(newtonpersecond.KilonewtonsPerMinute).NewtonsPerSecond, KilonewtonsPerMinuteTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.FromKilonewtonsPerSecond(newtonpersecond.KilonewtonsPerSecond).NewtonsPerSecond, KilonewtonsPerSecondTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.FromMicronewtonsPerSecond(newtonpersecond.MicronewtonsPerSecond).NewtonsPerSecond, MicronewtonsPerSecondTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.FromMillinewtonsPerSecond(newtonpersecond.MillinewtonsPerSecond).NewtonsPerSecond, MillinewtonsPerSecondTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.FromNanonewtonsPerSecond(newtonpersecond.NanonewtonsPerSecond).NewtonsPerSecond, NanonewtonsPerSecondTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.FromNewtonsPerMinute(newtonpersecond.NewtonsPerMinute).NewtonsPerSecond, NewtonsPerMinuteTolerance); + AssertEx.EqualTolerance(1, ForceChangeRate.FromNewtonsPerSecond(newtonpersecond.NewtonsPerSecond).NewtonsPerSecond, NewtonsPerSecondTolerance); } [Fact] public void ArithmeticOperators() { - ForceChangeRate v = ForceChangeRate.FromNewtonsPerSecond(1); + ForceChangeRate v = ForceChangeRate.FromNewtonsPerSecond(1); AssertEx.EqualTolerance(-1, -v.NewtonsPerSecond, NewtonsPerSecondTolerance); - AssertEx.EqualTolerance(2, (ForceChangeRate.FromNewtonsPerSecond(3)-v).NewtonsPerSecond, NewtonsPerSecondTolerance); + AssertEx.EqualTolerance(2, (ForceChangeRate.FromNewtonsPerSecond(3)-v).NewtonsPerSecond, NewtonsPerSecondTolerance); AssertEx.EqualTolerance(2, (v + v).NewtonsPerSecond, NewtonsPerSecondTolerance); AssertEx.EqualTolerance(10, (v*10).NewtonsPerSecond, NewtonsPerSecondTolerance); AssertEx.EqualTolerance(10, (10*v).NewtonsPerSecond, NewtonsPerSecondTolerance); - AssertEx.EqualTolerance(2, (ForceChangeRate.FromNewtonsPerSecond(10)/5).NewtonsPerSecond, NewtonsPerSecondTolerance); - AssertEx.EqualTolerance(2, ForceChangeRate.FromNewtonsPerSecond(10)/ForceChangeRate.FromNewtonsPerSecond(5), NewtonsPerSecondTolerance); + AssertEx.EqualTolerance(2, (ForceChangeRate.FromNewtonsPerSecond(10)/5).NewtonsPerSecond, NewtonsPerSecondTolerance); + AssertEx.EqualTolerance(2, ForceChangeRate.FromNewtonsPerSecond(10)/ForceChangeRate.FromNewtonsPerSecond(5), NewtonsPerSecondTolerance); } [Fact] public void ComparisonOperators() { - ForceChangeRate oneNewtonPerSecond = ForceChangeRate.FromNewtonsPerSecond(1); - ForceChangeRate twoNewtonsPerSecond = ForceChangeRate.FromNewtonsPerSecond(2); + ForceChangeRate oneNewtonPerSecond = ForceChangeRate.FromNewtonsPerSecond(1); + ForceChangeRate twoNewtonsPerSecond = ForceChangeRate.FromNewtonsPerSecond(2); Assert.True(oneNewtonPerSecond < twoNewtonsPerSecond); Assert.True(oneNewtonPerSecond <= twoNewtonsPerSecond); @@ -242,31 +242,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); + ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); Assert.Equal(0, newtonpersecond.CompareTo(newtonpersecond)); - Assert.True(newtonpersecond.CompareTo(ForceChangeRate.Zero) > 0); - Assert.True(ForceChangeRate.Zero.CompareTo(newtonpersecond) < 0); + Assert.True(newtonpersecond.CompareTo(ForceChangeRate.Zero) > 0); + Assert.True(ForceChangeRate.Zero.CompareTo(newtonpersecond) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); + ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); Assert.Throws(() => newtonpersecond.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); + ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); Assert.Throws(() => newtonpersecond.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ForceChangeRate.FromNewtonsPerSecond(1); - var b = ForceChangeRate.FromNewtonsPerSecond(2); + var a = ForceChangeRate.FromNewtonsPerSecond(1); + var b = ForceChangeRate.FromNewtonsPerSecond(2); // ReSharper disable EqualExpressionComparison @@ -285,8 +285,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ForceChangeRate.FromNewtonsPerSecond(1); - var b = ForceChangeRate.FromNewtonsPerSecond(2); + var a = ForceChangeRate.FromNewtonsPerSecond(1); + var b = ForceChangeRate.FromNewtonsPerSecond(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -296,29 +296,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ForceChangeRate.FromNewtonsPerSecond(1); - Assert.True(v.Equals(ForceChangeRate.FromNewtonsPerSecond(1), NewtonsPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ForceChangeRate.Zero, NewtonsPerSecondTolerance, ComparisonType.Relative)); + var v = ForceChangeRate.FromNewtonsPerSecond(1); + Assert.True(v.Equals(ForceChangeRate.FromNewtonsPerSecond(1), NewtonsPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ForceChangeRate.Zero, NewtonsPerSecondTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); + ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); Assert.False(newtonpersecond.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); + ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); Assert.False(newtonpersecond.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ForceChangeRateUnit.Undefined, ForceChangeRate.Units); + Assert.DoesNotContain(ForceChangeRateUnit.Undefined, ForceChangeRate.Units); } [Fact] @@ -337,7 +337,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ForceChangeRate.BaseDimensions is null); + Assert.False(ForceChangeRate.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs index b1739b7767..e505262677 100644 --- a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs @@ -65,26 +65,26 @@ public abstract partial class ForcePerLengthTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ForcePerLength((double)0.0, ForcePerLengthUnit.Undefined)); + Assert.Throws(() => new ForcePerLength((double)0.0, ForcePerLengthUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ForcePerLength(double.PositiveInfinity, ForcePerLengthUnit.NewtonPerMeter)); - Assert.Throws(() => new ForcePerLength(double.NegativeInfinity, ForcePerLengthUnit.NewtonPerMeter)); + Assert.Throws(() => new ForcePerLength(double.PositiveInfinity, ForcePerLengthUnit.NewtonPerMeter)); + Assert.Throws(() => new ForcePerLength(double.NegativeInfinity, ForcePerLengthUnit.NewtonPerMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ForcePerLength(double.NaN, ForcePerLengthUnit.NewtonPerMeter)); + Assert.Throws(() => new ForcePerLength(double.NaN, ForcePerLengthUnit.NewtonPerMeter)); } [Fact] public void NewtonPerMeterToForcePerLengthUnits() { - ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); + ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); AssertEx.EqualTolerance(CentinewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.CentinewtonsPerMeter, CentinewtonsPerMeterTolerance); AssertEx.EqualTolerance(DecinewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.DecinewtonsPerMeter, DecinewtonsPerMeterTolerance); AssertEx.EqualTolerance(KilogramsForcePerMeterInOneNewtonPerMeter, newtonpermeter.KilogramsForcePerMeter, KilogramsForcePerMeterTolerance); @@ -102,37 +102,37 @@ public void NewtonPerMeterToForcePerLengthUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.CentinewtonPerMeter).CentinewtonsPerMeter, CentinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.DecinewtonPerMeter).DecinewtonsPerMeter, DecinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.KilogramForcePerMeter).KilogramsForcePerMeter, KilogramsForcePerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.KilonewtonPerMeter).KilonewtonsPerMeter, KilonewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.MeganewtonPerMeter).MeganewtonsPerMeter, MeganewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.MicronewtonPerMeter).MicronewtonsPerMeter, MicronewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.MillinewtonPerMeter).MillinewtonsPerMeter, MillinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.NanonewtonPerMeter).NanonewtonsPerMeter, NanonewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.NewtonPerMeter).NewtonsPerMeter, NewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.PoundForcePerFoot).PoundsForcePerFoot, PoundsForcePerFootTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.PoundForcePerInch).PoundsForcePerInch, PoundsForcePerInchTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.PoundForcePerYard).PoundsForcePerYard, PoundsForcePerYardTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.CentinewtonPerMeter).CentinewtonsPerMeter, CentinewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.DecinewtonPerMeter).DecinewtonsPerMeter, DecinewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.KilogramForcePerMeter).KilogramsForcePerMeter, KilogramsForcePerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.KilonewtonPerMeter).KilonewtonsPerMeter, KilonewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.MeganewtonPerMeter).MeganewtonsPerMeter, MeganewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.MicronewtonPerMeter).MicronewtonsPerMeter, MicronewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.MillinewtonPerMeter).MillinewtonsPerMeter, MillinewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.NanonewtonPerMeter).NanonewtonsPerMeter, NanonewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.NewtonPerMeter).NewtonsPerMeter, NewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.PoundForcePerFoot).PoundsForcePerFoot, PoundsForcePerFootTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.PoundForcePerInch).PoundsForcePerInch, PoundsForcePerInchTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.PoundForcePerYard).PoundsForcePerYard, PoundsForcePerYardTolerance); } [Fact] public void FromNewtonsPerMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.PositiveInfinity)); - Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.NegativeInfinity)); + Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.PositiveInfinity)); + Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.NegativeInfinity)); } [Fact] public void FromNewtonsPerMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.NaN)); + Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.NaN)); } [Fact] public void As() { - var newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); + var newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); AssertEx.EqualTolerance(CentinewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.CentinewtonPerMeter), CentinewtonsPerMeterTolerance); AssertEx.EqualTolerance(DecinewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.DecinewtonPerMeter), DecinewtonsPerMeterTolerance); AssertEx.EqualTolerance(KilogramsForcePerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.KilogramForcePerMeter), KilogramsForcePerMeterTolerance); @@ -150,7 +150,7 @@ public void As() [Fact] public void ToUnit() { - var newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); + var newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); var centinewtonpermeterQuantity = newtonpermeter.ToUnit(ForcePerLengthUnit.CentinewtonPerMeter); AssertEx.EqualTolerance(CentinewtonsPerMeterInOneNewtonPerMeter, (double)centinewtonpermeterQuantity.Value, CentinewtonsPerMeterTolerance); @@ -204,39 +204,39 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); - AssertEx.EqualTolerance(1, ForcePerLength.FromCentinewtonsPerMeter(newtonpermeter.CentinewtonsPerMeter).NewtonsPerMeter, CentinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromDecinewtonsPerMeter(newtonpermeter.DecinewtonsPerMeter).NewtonsPerMeter, DecinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromKilogramsForcePerMeter(newtonpermeter.KilogramsForcePerMeter).NewtonsPerMeter, KilogramsForcePerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromKilonewtonsPerMeter(newtonpermeter.KilonewtonsPerMeter).NewtonsPerMeter, KilonewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromMeganewtonsPerMeter(newtonpermeter.MeganewtonsPerMeter).NewtonsPerMeter, MeganewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromMicronewtonsPerMeter(newtonpermeter.MicronewtonsPerMeter).NewtonsPerMeter, MicronewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromMillinewtonsPerMeter(newtonpermeter.MillinewtonsPerMeter).NewtonsPerMeter, MillinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromNanonewtonsPerMeter(newtonpermeter.NanonewtonsPerMeter).NewtonsPerMeter, NanonewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromNewtonsPerMeter(newtonpermeter.NewtonsPerMeter).NewtonsPerMeter, NewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromPoundsForcePerFoot(newtonpermeter.PoundsForcePerFoot).NewtonsPerMeter, PoundsForcePerFootTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromPoundsForcePerInch(newtonpermeter.PoundsForcePerInch).NewtonsPerMeter, PoundsForcePerInchTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromPoundsForcePerYard(newtonpermeter.PoundsForcePerYard).NewtonsPerMeter, PoundsForcePerYardTolerance); + ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); + AssertEx.EqualTolerance(1, ForcePerLength.FromCentinewtonsPerMeter(newtonpermeter.CentinewtonsPerMeter).NewtonsPerMeter, CentinewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.FromDecinewtonsPerMeter(newtonpermeter.DecinewtonsPerMeter).NewtonsPerMeter, DecinewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.FromKilogramsForcePerMeter(newtonpermeter.KilogramsForcePerMeter).NewtonsPerMeter, KilogramsForcePerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.FromKilonewtonsPerMeter(newtonpermeter.KilonewtonsPerMeter).NewtonsPerMeter, KilonewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.FromMeganewtonsPerMeter(newtonpermeter.MeganewtonsPerMeter).NewtonsPerMeter, MeganewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.FromMicronewtonsPerMeter(newtonpermeter.MicronewtonsPerMeter).NewtonsPerMeter, MicronewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.FromMillinewtonsPerMeter(newtonpermeter.MillinewtonsPerMeter).NewtonsPerMeter, MillinewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.FromNanonewtonsPerMeter(newtonpermeter.NanonewtonsPerMeter).NewtonsPerMeter, NanonewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.FromNewtonsPerMeter(newtonpermeter.NewtonsPerMeter).NewtonsPerMeter, NewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.FromPoundsForcePerFoot(newtonpermeter.PoundsForcePerFoot).NewtonsPerMeter, PoundsForcePerFootTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.FromPoundsForcePerInch(newtonpermeter.PoundsForcePerInch).NewtonsPerMeter, PoundsForcePerInchTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.FromPoundsForcePerYard(newtonpermeter.PoundsForcePerYard).NewtonsPerMeter, PoundsForcePerYardTolerance); } [Fact] public void ArithmeticOperators() { - ForcePerLength v = ForcePerLength.FromNewtonsPerMeter(1); + ForcePerLength v = ForcePerLength.FromNewtonsPerMeter(1); AssertEx.EqualTolerance(-1, -v.NewtonsPerMeter, NewtonsPerMeterTolerance); - AssertEx.EqualTolerance(2, (ForcePerLength.FromNewtonsPerMeter(3)-v).NewtonsPerMeter, NewtonsPerMeterTolerance); + AssertEx.EqualTolerance(2, (ForcePerLength.FromNewtonsPerMeter(3)-v).NewtonsPerMeter, NewtonsPerMeterTolerance); AssertEx.EqualTolerance(2, (v + v).NewtonsPerMeter, NewtonsPerMeterTolerance); AssertEx.EqualTolerance(10, (v*10).NewtonsPerMeter, NewtonsPerMeterTolerance); AssertEx.EqualTolerance(10, (10*v).NewtonsPerMeter, NewtonsPerMeterTolerance); - AssertEx.EqualTolerance(2, (ForcePerLength.FromNewtonsPerMeter(10)/5).NewtonsPerMeter, NewtonsPerMeterTolerance); - AssertEx.EqualTolerance(2, ForcePerLength.FromNewtonsPerMeter(10)/ForcePerLength.FromNewtonsPerMeter(5), NewtonsPerMeterTolerance); + AssertEx.EqualTolerance(2, (ForcePerLength.FromNewtonsPerMeter(10)/5).NewtonsPerMeter, NewtonsPerMeterTolerance); + AssertEx.EqualTolerance(2, ForcePerLength.FromNewtonsPerMeter(10)/ForcePerLength.FromNewtonsPerMeter(5), NewtonsPerMeterTolerance); } [Fact] public void ComparisonOperators() { - ForcePerLength oneNewtonPerMeter = ForcePerLength.FromNewtonsPerMeter(1); - ForcePerLength twoNewtonsPerMeter = ForcePerLength.FromNewtonsPerMeter(2); + ForcePerLength oneNewtonPerMeter = ForcePerLength.FromNewtonsPerMeter(1); + ForcePerLength twoNewtonsPerMeter = ForcePerLength.FromNewtonsPerMeter(2); Assert.True(oneNewtonPerMeter < twoNewtonsPerMeter); Assert.True(oneNewtonPerMeter <= twoNewtonsPerMeter); @@ -252,31 +252,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); + ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); Assert.Equal(0, newtonpermeter.CompareTo(newtonpermeter)); - Assert.True(newtonpermeter.CompareTo(ForcePerLength.Zero) > 0); - Assert.True(ForcePerLength.Zero.CompareTo(newtonpermeter) < 0); + Assert.True(newtonpermeter.CompareTo(ForcePerLength.Zero) > 0); + Assert.True(ForcePerLength.Zero.CompareTo(newtonpermeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); + ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); Assert.Throws(() => newtonpermeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); + ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); Assert.Throws(() => newtonpermeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ForcePerLength.FromNewtonsPerMeter(1); - var b = ForcePerLength.FromNewtonsPerMeter(2); + var a = ForcePerLength.FromNewtonsPerMeter(1); + var b = ForcePerLength.FromNewtonsPerMeter(2); // ReSharper disable EqualExpressionComparison @@ -295,8 +295,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ForcePerLength.FromNewtonsPerMeter(1); - var b = ForcePerLength.FromNewtonsPerMeter(2); + var a = ForcePerLength.FromNewtonsPerMeter(1); + var b = ForcePerLength.FromNewtonsPerMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -306,29 +306,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ForcePerLength.FromNewtonsPerMeter(1); - Assert.True(v.Equals(ForcePerLength.FromNewtonsPerMeter(1), NewtonsPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ForcePerLength.Zero, NewtonsPerMeterTolerance, ComparisonType.Relative)); + var v = ForcePerLength.FromNewtonsPerMeter(1); + Assert.True(v.Equals(ForcePerLength.FromNewtonsPerMeter(1), NewtonsPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ForcePerLength.Zero, NewtonsPerMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); + ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); Assert.False(newtonpermeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); + ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); Assert.False(newtonpermeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ForcePerLengthUnit.Undefined, ForcePerLength.Units); + Assert.DoesNotContain(ForcePerLengthUnit.Undefined, ForcePerLength.Units); } [Fact] @@ -347,7 +347,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ForcePerLength.BaseDimensions is null); + Assert.False(ForcePerLength.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs index 8b314406b7..a0a63418ac 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs @@ -67,26 +67,26 @@ public abstract partial class ForceTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Force((double)0.0, ForceUnit.Undefined)); + Assert.Throws(() => new Force((double)0.0, ForceUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Force(double.PositiveInfinity, ForceUnit.Newton)); - Assert.Throws(() => new Force(double.NegativeInfinity, ForceUnit.Newton)); + Assert.Throws(() => new Force(double.PositiveInfinity, ForceUnit.Newton)); + Assert.Throws(() => new Force(double.NegativeInfinity, ForceUnit.Newton)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Force(double.NaN, ForceUnit.Newton)); + Assert.Throws(() => new Force(double.NaN, ForceUnit.Newton)); } [Fact] public void NewtonToForceUnits() { - Force newton = Force.FromNewtons(1); + Force newton = Force.FromNewtons(1); AssertEx.EqualTolerance(DecanewtonsInOneNewton, newton.Decanewtons, DecanewtonsTolerance); AssertEx.EqualTolerance(DyneInOneNewton, newton.Dyne, DyneTolerance); AssertEx.EqualTolerance(KilogramsForceInOneNewton, newton.KilogramsForce, KilogramsForceTolerance); @@ -105,38 +105,38 @@ public void NewtonToForceUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Decanewton).Decanewtons, DecanewtonsTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Dyn).Dyne, DyneTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.KilogramForce).KilogramsForce, KilogramsForceTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Kilonewton).Kilonewtons, KilonewtonsTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.KiloPond).KiloPonds, KiloPondsTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Meganewton).Meganewtons, MeganewtonsTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Micronewton).Micronewtons, MicronewtonsTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Millinewton).Millinewtons, MillinewtonsTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Newton).Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.OunceForce).OunceForce, OunceForceTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Poundal).Poundals, PoundalsTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.PoundForce).PoundsForce, PoundsForceTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.TonneForce).TonnesForce, TonnesForceTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Decanewton).Decanewtons, DecanewtonsTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Dyn).Dyne, DyneTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.KilogramForce).KilogramsForce, KilogramsForceTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Kilonewton).Kilonewtons, KilonewtonsTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.KiloPond).KiloPonds, KiloPondsTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Meganewton).Meganewtons, MeganewtonsTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Micronewton).Micronewtons, MicronewtonsTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Millinewton).Millinewtons, MillinewtonsTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Newton).Newtons, NewtonsTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.OunceForce).OunceForce, OunceForceTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Poundal).Poundals, PoundalsTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.PoundForce).PoundsForce, PoundsForceTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.TonneForce).TonnesForce, TonnesForceTolerance); } [Fact] public void FromNewtons_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Force.FromNewtons(double.PositiveInfinity)); - Assert.Throws(() => Force.FromNewtons(double.NegativeInfinity)); + Assert.Throws(() => Force.FromNewtons(double.PositiveInfinity)); + Assert.Throws(() => Force.FromNewtons(double.NegativeInfinity)); } [Fact] public void FromNewtons_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Force.FromNewtons(double.NaN)); + Assert.Throws(() => Force.FromNewtons(double.NaN)); } [Fact] public void As() { - var newton = Force.FromNewtons(1); + var newton = Force.FromNewtons(1); AssertEx.EqualTolerance(DecanewtonsInOneNewton, newton.As(ForceUnit.Decanewton), DecanewtonsTolerance); AssertEx.EqualTolerance(DyneInOneNewton, newton.As(ForceUnit.Dyn), DyneTolerance); AssertEx.EqualTolerance(KilogramsForceInOneNewton, newton.As(ForceUnit.KilogramForce), KilogramsForceTolerance); @@ -155,7 +155,7 @@ public void As() [Fact] public void ToUnit() { - var newton = Force.FromNewtons(1); + var newton = Force.FromNewtons(1); var decanewtonQuantity = newton.ToUnit(ForceUnit.Decanewton); AssertEx.EqualTolerance(DecanewtonsInOneNewton, (double)decanewtonQuantity.Value, DecanewtonsTolerance); @@ -213,40 +213,40 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Force newton = Force.FromNewtons(1); - AssertEx.EqualTolerance(1, Force.FromDecanewtons(newton.Decanewtons).Newtons, DecanewtonsTolerance); - AssertEx.EqualTolerance(1, Force.FromDyne(newton.Dyne).Newtons, DyneTolerance); - AssertEx.EqualTolerance(1, Force.FromKilogramsForce(newton.KilogramsForce).Newtons, KilogramsForceTolerance); - AssertEx.EqualTolerance(1, Force.FromKilonewtons(newton.Kilonewtons).Newtons, KilonewtonsTolerance); - AssertEx.EqualTolerance(1, Force.FromKiloPonds(newton.KiloPonds).Newtons, KiloPondsTolerance); - AssertEx.EqualTolerance(1, Force.FromMeganewtons(newton.Meganewtons).Newtons, MeganewtonsTolerance); - AssertEx.EqualTolerance(1, Force.FromMicronewtons(newton.Micronewtons).Newtons, MicronewtonsTolerance); - AssertEx.EqualTolerance(1, Force.FromMillinewtons(newton.Millinewtons).Newtons, MillinewtonsTolerance); - AssertEx.EqualTolerance(1, Force.FromNewtons(newton.Newtons).Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(1, Force.FromOunceForce(newton.OunceForce).Newtons, OunceForceTolerance); - AssertEx.EqualTolerance(1, Force.FromPoundals(newton.Poundals).Newtons, PoundalsTolerance); - AssertEx.EqualTolerance(1, Force.FromPoundsForce(newton.PoundsForce).Newtons, PoundsForceTolerance); - AssertEx.EqualTolerance(1, Force.FromTonnesForce(newton.TonnesForce).Newtons, TonnesForceTolerance); + Force newton = Force.FromNewtons(1); + AssertEx.EqualTolerance(1, Force.FromDecanewtons(newton.Decanewtons).Newtons, DecanewtonsTolerance); + AssertEx.EqualTolerance(1, Force.FromDyne(newton.Dyne).Newtons, DyneTolerance); + AssertEx.EqualTolerance(1, Force.FromKilogramsForce(newton.KilogramsForce).Newtons, KilogramsForceTolerance); + AssertEx.EqualTolerance(1, Force.FromKilonewtons(newton.Kilonewtons).Newtons, KilonewtonsTolerance); + AssertEx.EqualTolerance(1, Force.FromKiloPonds(newton.KiloPonds).Newtons, KiloPondsTolerance); + AssertEx.EqualTolerance(1, Force.FromMeganewtons(newton.Meganewtons).Newtons, MeganewtonsTolerance); + AssertEx.EqualTolerance(1, Force.FromMicronewtons(newton.Micronewtons).Newtons, MicronewtonsTolerance); + AssertEx.EqualTolerance(1, Force.FromMillinewtons(newton.Millinewtons).Newtons, MillinewtonsTolerance); + AssertEx.EqualTolerance(1, Force.FromNewtons(newton.Newtons).Newtons, NewtonsTolerance); + AssertEx.EqualTolerance(1, Force.FromOunceForce(newton.OunceForce).Newtons, OunceForceTolerance); + AssertEx.EqualTolerance(1, Force.FromPoundals(newton.Poundals).Newtons, PoundalsTolerance); + AssertEx.EqualTolerance(1, Force.FromPoundsForce(newton.PoundsForce).Newtons, PoundsForceTolerance); + AssertEx.EqualTolerance(1, Force.FromTonnesForce(newton.TonnesForce).Newtons, TonnesForceTolerance); } [Fact] public void ArithmeticOperators() { - Force v = Force.FromNewtons(1); + Force v = Force.FromNewtons(1); AssertEx.EqualTolerance(-1, -v.Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(2, (Force.FromNewtons(3)-v).Newtons, NewtonsTolerance); + AssertEx.EqualTolerance(2, (Force.FromNewtons(3)-v).Newtons, NewtonsTolerance); AssertEx.EqualTolerance(2, (v + v).Newtons, NewtonsTolerance); AssertEx.EqualTolerance(10, (v*10).Newtons, NewtonsTolerance); AssertEx.EqualTolerance(10, (10*v).Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(2, (Force.FromNewtons(10)/5).Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(2, Force.FromNewtons(10)/Force.FromNewtons(5), NewtonsTolerance); + AssertEx.EqualTolerance(2, (Force.FromNewtons(10)/5).Newtons, NewtonsTolerance); + AssertEx.EqualTolerance(2, Force.FromNewtons(10)/Force.FromNewtons(5), NewtonsTolerance); } [Fact] public void ComparisonOperators() { - Force oneNewton = Force.FromNewtons(1); - Force twoNewtons = Force.FromNewtons(2); + Force oneNewton = Force.FromNewtons(1); + Force twoNewtons = Force.FromNewtons(2); Assert.True(oneNewton < twoNewtons); Assert.True(oneNewton <= twoNewtons); @@ -262,31 +262,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Force newton = Force.FromNewtons(1); + Force newton = Force.FromNewtons(1); Assert.Equal(0, newton.CompareTo(newton)); - Assert.True(newton.CompareTo(Force.Zero) > 0); - Assert.True(Force.Zero.CompareTo(newton) < 0); + Assert.True(newton.CompareTo(Force.Zero) > 0); + Assert.True(Force.Zero.CompareTo(newton) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Force newton = Force.FromNewtons(1); + Force newton = Force.FromNewtons(1); Assert.Throws(() => newton.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Force newton = Force.FromNewtons(1); + Force newton = Force.FromNewtons(1); Assert.Throws(() => newton.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Force.FromNewtons(1); - var b = Force.FromNewtons(2); + var a = Force.FromNewtons(1); + var b = Force.FromNewtons(2); // ReSharper disable EqualExpressionComparison @@ -305,8 +305,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Force.FromNewtons(1); - var b = Force.FromNewtons(2); + var a = Force.FromNewtons(1); + var b = Force.FromNewtons(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -316,29 +316,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Force.FromNewtons(1); - Assert.True(v.Equals(Force.FromNewtons(1), NewtonsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Force.Zero, NewtonsTolerance, ComparisonType.Relative)); + var v = Force.FromNewtons(1); + Assert.True(v.Equals(Force.FromNewtons(1), NewtonsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Force.Zero, NewtonsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Force newton = Force.FromNewtons(1); + Force newton = Force.FromNewtons(1); Assert.False(newton.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Force newton = Force.FromNewtons(1); + Force newton = Force.FromNewtons(1); Assert.False(newton.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ForceUnit.Undefined, Force.Units); + Assert.DoesNotContain(ForceUnit.Undefined, Force.Units); } [Fact] @@ -357,7 +357,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Force.BaseDimensions is null); + Assert.False(Force.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs index 2fe8362851..ac64205b6a 100644 --- a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs @@ -59,26 +59,26 @@ public abstract partial class FrequencyTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Frequency((double)0.0, FrequencyUnit.Undefined)); + Assert.Throws(() => new Frequency((double)0.0, FrequencyUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Frequency(double.PositiveInfinity, FrequencyUnit.Hertz)); - Assert.Throws(() => new Frequency(double.NegativeInfinity, FrequencyUnit.Hertz)); + Assert.Throws(() => new Frequency(double.PositiveInfinity, FrequencyUnit.Hertz)); + Assert.Throws(() => new Frequency(double.NegativeInfinity, FrequencyUnit.Hertz)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Frequency(double.NaN, FrequencyUnit.Hertz)); + Assert.Throws(() => new Frequency(double.NaN, FrequencyUnit.Hertz)); } [Fact] public void HertzToFrequencyUnits() { - Frequency hertz = Frequency.FromHertz(1); + Frequency hertz = Frequency.FromHertz(1); AssertEx.EqualTolerance(BeatsPerMinuteInOneHertz, hertz.BeatsPerMinute, BeatsPerMinuteTolerance); AssertEx.EqualTolerance(CyclesPerHourInOneHertz, hertz.CyclesPerHour, CyclesPerHourTolerance); AssertEx.EqualTolerance(CyclesPerMinuteInOneHertz, hertz.CyclesPerMinute, CyclesPerMinuteTolerance); @@ -93,34 +93,34 @@ public void HertzToFrequencyUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.BeatPerMinute).BeatsPerMinute, BeatsPerMinuteTolerance); - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.CyclePerHour).CyclesPerHour, CyclesPerHourTolerance); - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.CyclePerMinute).CyclesPerMinute, CyclesPerMinuteTolerance); - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Gigahertz).Gigahertz, GigahertzTolerance); - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Hertz).Hertz, HertzTolerance); - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Kilohertz).Kilohertz, KilohertzTolerance); - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Megahertz).Megahertz, MegahertzTolerance); - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.RadianPerSecond).RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Terahertz).Terahertz, TerahertzTolerance); + AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.BeatPerMinute).BeatsPerMinute, BeatsPerMinuteTolerance); + AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.CyclePerHour).CyclesPerHour, CyclesPerHourTolerance); + AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.CyclePerMinute).CyclesPerMinute, CyclesPerMinuteTolerance); + AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Gigahertz).Gigahertz, GigahertzTolerance); + AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Hertz).Hertz, HertzTolerance); + AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Kilohertz).Kilohertz, KilohertzTolerance); + AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Megahertz).Megahertz, MegahertzTolerance); + AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.RadianPerSecond).RadiansPerSecond, RadiansPerSecondTolerance); + AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Terahertz).Terahertz, TerahertzTolerance); } [Fact] public void FromHertz_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Frequency.FromHertz(double.PositiveInfinity)); - Assert.Throws(() => Frequency.FromHertz(double.NegativeInfinity)); + Assert.Throws(() => Frequency.FromHertz(double.PositiveInfinity)); + Assert.Throws(() => Frequency.FromHertz(double.NegativeInfinity)); } [Fact] public void FromHertz_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Frequency.FromHertz(double.NaN)); + Assert.Throws(() => Frequency.FromHertz(double.NaN)); } [Fact] public void As() { - var hertz = Frequency.FromHertz(1); + var hertz = Frequency.FromHertz(1); AssertEx.EqualTolerance(BeatsPerMinuteInOneHertz, hertz.As(FrequencyUnit.BeatPerMinute), BeatsPerMinuteTolerance); AssertEx.EqualTolerance(CyclesPerHourInOneHertz, hertz.As(FrequencyUnit.CyclePerHour), CyclesPerHourTolerance); AssertEx.EqualTolerance(CyclesPerMinuteInOneHertz, hertz.As(FrequencyUnit.CyclePerMinute), CyclesPerMinuteTolerance); @@ -135,7 +135,7 @@ public void As() [Fact] public void ToUnit() { - var hertz = Frequency.FromHertz(1); + var hertz = Frequency.FromHertz(1); var beatperminuteQuantity = hertz.ToUnit(FrequencyUnit.BeatPerMinute); AssertEx.EqualTolerance(BeatsPerMinuteInOneHertz, (double)beatperminuteQuantity.Value, BeatsPerMinuteTolerance); @@ -177,36 +177,36 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Frequency hertz = Frequency.FromHertz(1); - AssertEx.EqualTolerance(1, Frequency.FromBeatsPerMinute(hertz.BeatsPerMinute).Hertz, BeatsPerMinuteTolerance); - AssertEx.EqualTolerance(1, Frequency.FromCyclesPerHour(hertz.CyclesPerHour).Hertz, CyclesPerHourTolerance); - AssertEx.EqualTolerance(1, Frequency.FromCyclesPerMinute(hertz.CyclesPerMinute).Hertz, CyclesPerMinuteTolerance); - AssertEx.EqualTolerance(1, Frequency.FromGigahertz(hertz.Gigahertz).Hertz, GigahertzTolerance); - AssertEx.EqualTolerance(1, Frequency.FromHertz(hertz.Hertz).Hertz, HertzTolerance); - AssertEx.EqualTolerance(1, Frequency.FromKilohertz(hertz.Kilohertz).Hertz, KilohertzTolerance); - AssertEx.EqualTolerance(1, Frequency.FromMegahertz(hertz.Megahertz).Hertz, MegahertzTolerance); - AssertEx.EqualTolerance(1, Frequency.FromRadiansPerSecond(hertz.RadiansPerSecond).Hertz, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(1, Frequency.FromTerahertz(hertz.Terahertz).Hertz, TerahertzTolerance); + Frequency hertz = Frequency.FromHertz(1); + AssertEx.EqualTolerance(1, Frequency.FromBeatsPerMinute(hertz.BeatsPerMinute).Hertz, BeatsPerMinuteTolerance); + AssertEx.EqualTolerance(1, Frequency.FromCyclesPerHour(hertz.CyclesPerHour).Hertz, CyclesPerHourTolerance); + AssertEx.EqualTolerance(1, Frequency.FromCyclesPerMinute(hertz.CyclesPerMinute).Hertz, CyclesPerMinuteTolerance); + AssertEx.EqualTolerance(1, Frequency.FromGigahertz(hertz.Gigahertz).Hertz, GigahertzTolerance); + AssertEx.EqualTolerance(1, Frequency.FromHertz(hertz.Hertz).Hertz, HertzTolerance); + AssertEx.EqualTolerance(1, Frequency.FromKilohertz(hertz.Kilohertz).Hertz, KilohertzTolerance); + AssertEx.EqualTolerance(1, Frequency.FromMegahertz(hertz.Megahertz).Hertz, MegahertzTolerance); + AssertEx.EqualTolerance(1, Frequency.FromRadiansPerSecond(hertz.RadiansPerSecond).Hertz, RadiansPerSecondTolerance); + AssertEx.EqualTolerance(1, Frequency.FromTerahertz(hertz.Terahertz).Hertz, TerahertzTolerance); } [Fact] public void ArithmeticOperators() { - Frequency v = Frequency.FromHertz(1); + Frequency v = Frequency.FromHertz(1); AssertEx.EqualTolerance(-1, -v.Hertz, HertzTolerance); - AssertEx.EqualTolerance(2, (Frequency.FromHertz(3)-v).Hertz, HertzTolerance); + AssertEx.EqualTolerance(2, (Frequency.FromHertz(3)-v).Hertz, HertzTolerance); AssertEx.EqualTolerance(2, (v + v).Hertz, HertzTolerance); AssertEx.EqualTolerance(10, (v*10).Hertz, HertzTolerance); AssertEx.EqualTolerance(10, (10*v).Hertz, HertzTolerance); - AssertEx.EqualTolerance(2, (Frequency.FromHertz(10)/5).Hertz, HertzTolerance); - AssertEx.EqualTolerance(2, Frequency.FromHertz(10)/Frequency.FromHertz(5), HertzTolerance); + AssertEx.EqualTolerance(2, (Frequency.FromHertz(10)/5).Hertz, HertzTolerance); + AssertEx.EqualTolerance(2, Frequency.FromHertz(10)/Frequency.FromHertz(5), HertzTolerance); } [Fact] public void ComparisonOperators() { - Frequency oneHertz = Frequency.FromHertz(1); - Frequency twoHertz = Frequency.FromHertz(2); + Frequency oneHertz = Frequency.FromHertz(1); + Frequency twoHertz = Frequency.FromHertz(2); Assert.True(oneHertz < twoHertz); Assert.True(oneHertz <= twoHertz); @@ -222,31 +222,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Frequency hertz = Frequency.FromHertz(1); + Frequency hertz = Frequency.FromHertz(1); Assert.Equal(0, hertz.CompareTo(hertz)); - Assert.True(hertz.CompareTo(Frequency.Zero) > 0); - Assert.True(Frequency.Zero.CompareTo(hertz) < 0); + Assert.True(hertz.CompareTo(Frequency.Zero) > 0); + Assert.True(Frequency.Zero.CompareTo(hertz) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Frequency hertz = Frequency.FromHertz(1); + Frequency hertz = Frequency.FromHertz(1); Assert.Throws(() => hertz.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Frequency hertz = Frequency.FromHertz(1); + Frequency hertz = Frequency.FromHertz(1); Assert.Throws(() => hertz.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Frequency.FromHertz(1); - var b = Frequency.FromHertz(2); + var a = Frequency.FromHertz(1); + var b = Frequency.FromHertz(2); // ReSharper disable EqualExpressionComparison @@ -265,8 +265,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Frequency.FromHertz(1); - var b = Frequency.FromHertz(2); + var a = Frequency.FromHertz(1); + var b = Frequency.FromHertz(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -276,29 +276,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Frequency.FromHertz(1); - Assert.True(v.Equals(Frequency.FromHertz(1), HertzTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Frequency.Zero, HertzTolerance, ComparisonType.Relative)); + var v = Frequency.FromHertz(1); + Assert.True(v.Equals(Frequency.FromHertz(1), HertzTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Frequency.Zero, HertzTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Frequency hertz = Frequency.FromHertz(1); + Frequency hertz = Frequency.FromHertz(1); Assert.False(hertz.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Frequency hertz = Frequency.FromHertz(1); + Frequency hertz = Frequency.FromHertz(1); Assert.False(hertz.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(FrequencyUnit.Undefined, Frequency.Units); + Assert.DoesNotContain(FrequencyUnit.Undefined, Frequency.Units); } [Fact] @@ -317,7 +317,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Frequency.BaseDimensions is null); + Assert.False(Frequency.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/FuelEfficiencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/FuelEfficiencyTestsBase.g.cs index f66649fa35..3060eddcb3 100644 --- a/UnitsNet.Tests/GeneratedCode/FuelEfficiencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/FuelEfficiencyTestsBase.g.cs @@ -49,26 +49,26 @@ public abstract partial class FuelEfficiencyTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new FuelEfficiency((double)0.0, FuelEfficiencyUnit.Undefined)); + Assert.Throws(() => new FuelEfficiency((double)0.0, FuelEfficiencyUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new FuelEfficiency(double.PositiveInfinity, FuelEfficiencyUnit.LiterPer100Kilometers)); - Assert.Throws(() => new FuelEfficiency(double.NegativeInfinity, FuelEfficiencyUnit.LiterPer100Kilometers)); + Assert.Throws(() => new FuelEfficiency(double.PositiveInfinity, FuelEfficiencyUnit.LiterPer100Kilometers)); + Assert.Throws(() => new FuelEfficiency(double.NegativeInfinity, FuelEfficiencyUnit.LiterPer100Kilometers)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new FuelEfficiency(double.NaN, FuelEfficiencyUnit.LiterPer100Kilometers)); + Assert.Throws(() => new FuelEfficiency(double.NaN, FuelEfficiencyUnit.LiterPer100Kilometers)); } [Fact] public void LiterPer100KilometersToFuelEfficiencyUnits() { - FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); + FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); AssertEx.EqualTolerance(KilometersPerLitersInOneLiterPer100Kilometers, literper100kilometers.KilometersPerLiters, KilometersPerLitersTolerance); AssertEx.EqualTolerance(LitersPer100KilometersInOneLiterPer100Kilometers, literper100kilometers.LitersPer100Kilometers, LitersPer100KilometersTolerance); AssertEx.EqualTolerance(MilesPerUkGallonInOneLiterPer100Kilometers, literper100kilometers.MilesPerUkGallon, MilesPerUkGallonTolerance); @@ -78,29 +78,29 @@ public void LiterPer100KilometersToFuelEfficiencyUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, FuelEfficiency.From(1, FuelEfficiencyUnit.KilometerPerLiter).KilometersPerLiters, KilometersPerLitersTolerance); - AssertEx.EqualTolerance(1, FuelEfficiency.From(1, FuelEfficiencyUnit.LiterPer100Kilometers).LitersPer100Kilometers, LitersPer100KilometersTolerance); - AssertEx.EqualTolerance(1, FuelEfficiency.From(1, FuelEfficiencyUnit.MilePerUkGallon).MilesPerUkGallon, MilesPerUkGallonTolerance); - AssertEx.EqualTolerance(1, FuelEfficiency.From(1, FuelEfficiencyUnit.MilePerUsGallon).MilesPerUsGallon, MilesPerUsGallonTolerance); + AssertEx.EqualTolerance(1, FuelEfficiency.From(1, FuelEfficiencyUnit.KilometerPerLiter).KilometersPerLiters, KilometersPerLitersTolerance); + AssertEx.EqualTolerance(1, FuelEfficiency.From(1, FuelEfficiencyUnit.LiterPer100Kilometers).LitersPer100Kilometers, LitersPer100KilometersTolerance); + AssertEx.EqualTolerance(1, FuelEfficiency.From(1, FuelEfficiencyUnit.MilePerUkGallon).MilesPerUkGallon, MilesPerUkGallonTolerance); + AssertEx.EqualTolerance(1, FuelEfficiency.From(1, FuelEfficiencyUnit.MilePerUsGallon).MilesPerUsGallon, MilesPerUsGallonTolerance); } [Fact] public void FromLitersPer100Kilometers_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => FuelEfficiency.FromLitersPer100Kilometers(double.PositiveInfinity)); - Assert.Throws(() => FuelEfficiency.FromLitersPer100Kilometers(double.NegativeInfinity)); + Assert.Throws(() => FuelEfficiency.FromLitersPer100Kilometers(double.PositiveInfinity)); + Assert.Throws(() => FuelEfficiency.FromLitersPer100Kilometers(double.NegativeInfinity)); } [Fact] public void FromLitersPer100Kilometers_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => FuelEfficiency.FromLitersPer100Kilometers(double.NaN)); + Assert.Throws(() => FuelEfficiency.FromLitersPer100Kilometers(double.NaN)); } [Fact] public void As() { - var literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); + var literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); AssertEx.EqualTolerance(KilometersPerLitersInOneLiterPer100Kilometers, literper100kilometers.As(FuelEfficiencyUnit.KilometerPerLiter), KilometersPerLitersTolerance); AssertEx.EqualTolerance(LitersPer100KilometersInOneLiterPer100Kilometers, literper100kilometers.As(FuelEfficiencyUnit.LiterPer100Kilometers), LitersPer100KilometersTolerance); AssertEx.EqualTolerance(MilesPerUkGallonInOneLiterPer100Kilometers, literper100kilometers.As(FuelEfficiencyUnit.MilePerUkGallon), MilesPerUkGallonTolerance); @@ -110,7 +110,7 @@ public void As() [Fact] public void ToUnit() { - var literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); + var literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); var kilometerperliterQuantity = literper100kilometers.ToUnit(FuelEfficiencyUnit.KilometerPerLiter); AssertEx.EqualTolerance(KilometersPerLitersInOneLiterPer100Kilometers, (double)kilometerperliterQuantity.Value, KilometersPerLitersTolerance); @@ -132,31 +132,31 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); - AssertEx.EqualTolerance(1, FuelEfficiency.FromKilometersPerLiters(literper100kilometers.KilometersPerLiters).LitersPer100Kilometers, KilometersPerLitersTolerance); - AssertEx.EqualTolerance(1, FuelEfficiency.FromLitersPer100Kilometers(literper100kilometers.LitersPer100Kilometers).LitersPer100Kilometers, LitersPer100KilometersTolerance); - AssertEx.EqualTolerance(1, FuelEfficiency.FromMilesPerUkGallon(literper100kilometers.MilesPerUkGallon).LitersPer100Kilometers, MilesPerUkGallonTolerance); - AssertEx.EqualTolerance(1, FuelEfficiency.FromMilesPerUsGallon(literper100kilometers.MilesPerUsGallon).LitersPer100Kilometers, MilesPerUsGallonTolerance); + FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); + AssertEx.EqualTolerance(1, FuelEfficiency.FromKilometersPerLiters(literper100kilometers.KilometersPerLiters).LitersPer100Kilometers, KilometersPerLitersTolerance); + AssertEx.EqualTolerance(1, FuelEfficiency.FromLitersPer100Kilometers(literper100kilometers.LitersPer100Kilometers).LitersPer100Kilometers, LitersPer100KilometersTolerance); + AssertEx.EqualTolerance(1, FuelEfficiency.FromMilesPerUkGallon(literper100kilometers.MilesPerUkGallon).LitersPer100Kilometers, MilesPerUkGallonTolerance); + AssertEx.EqualTolerance(1, FuelEfficiency.FromMilesPerUsGallon(literper100kilometers.MilesPerUsGallon).LitersPer100Kilometers, MilesPerUsGallonTolerance); } [Fact] public void ArithmeticOperators() { - FuelEfficiency v = FuelEfficiency.FromLitersPer100Kilometers(1); + FuelEfficiency v = FuelEfficiency.FromLitersPer100Kilometers(1); AssertEx.EqualTolerance(-1, -v.LitersPer100Kilometers, LitersPer100KilometersTolerance); - AssertEx.EqualTolerance(2, (FuelEfficiency.FromLitersPer100Kilometers(3)-v).LitersPer100Kilometers, LitersPer100KilometersTolerance); + AssertEx.EqualTolerance(2, (FuelEfficiency.FromLitersPer100Kilometers(3)-v).LitersPer100Kilometers, LitersPer100KilometersTolerance); AssertEx.EqualTolerance(2, (v + v).LitersPer100Kilometers, LitersPer100KilometersTolerance); AssertEx.EqualTolerance(10, (v*10).LitersPer100Kilometers, LitersPer100KilometersTolerance); AssertEx.EqualTolerance(10, (10*v).LitersPer100Kilometers, LitersPer100KilometersTolerance); - AssertEx.EqualTolerance(2, (FuelEfficiency.FromLitersPer100Kilometers(10)/5).LitersPer100Kilometers, LitersPer100KilometersTolerance); - AssertEx.EqualTolerance(2, FuelEfficiency.FromLitersPer100Kilometers(10)/FuelEfficiency.FromLitersPer100Kilometers(5), LitersPer100KilometersTolerance); + AssertEx.EqualTolerance(2, (FuelEfficiency.FromLitersPer100Kilometers(10)/5).LitersPer100Kilometers, LitersPer100KilometersTolerance); + AssertEx.EqualTolerance(2, FuelEfficiency.FromLitersPer100Kilometers(10)/FuelEfficiency.FromLitersPer100Kilometers(5), LitersPer100KilometersTolerance); } [Fact] public void ComparisonOperators() { - FuelEfficiency oneLiterPer100Kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); - FuelEfficiency twoLitersPer100Kilometers = FuelEfficiency.FromLitersPer100Kilometers(2); + FuelEfficiency oneLiterPer100Kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); + FuelEfficiency twoLitersPer100Kilometers = FuelEfficiency.FromLitersPer100Kilometers(2); Assert.True(oneLiterPer100Kilometers < twoLitersPer100Kilometers); Assert.True(oneLiterPer100Kilometers <= twoLitersPer100Kilometers); @@ -172,31 +172,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); + FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); Assert.Equal(0, literper100kilometers.CompareTo(literper100kilometers)); - Assert.True(literper100kilometers.CompareTo(FuelEfficiency.Zero) > 0); - Assert.True(FuelEfficiency.Zero.CompareTo(literper100kilometers) < 0); + Assert.True(literper100kilometers.CompareTo(FuelEfficiency.Zero) > 0); + Assert.True(FuelEfficiency.Zero.CompareTo(literper100kilometers) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); + FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); Assert.Throws(() => literper100kilometers.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); + FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); Assert.Throws(() => literper100kilometers.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = FuelEfficiency.FromLitersPer100Kilometers(1); - var b = FuelEfficiency.FromLitersPer100Kilometers(2); + var a = FuelEfficiency.FromLitersPer100Kilometers(1); + var b = FuelEfficiency.FromLitersPer100Kilometers(2); // ReSharper disable EqualExpressionComparison @@ -215,8 +215,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = FuelEfficiency.FromLitersPer100Kilometers(1); - var b = FuelEfficiency.FromLitersPer100Kilometers(2); + var a = FuelEfficiency.FromLitersPer100Kilometers(1); + var b = FuelEfficiency.FromLitersPer100Kilometers(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -226,29 +226,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = FuelEfficiency.FromLitersPer100Kilometers(1); - Assert.True(v.Equals(FuelEfficiency.FromLitersPer100Kilometers(1), LitersPer100KilometersTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(FuelEfficiency.Zero, LitersPer100KilometersTolerance, ComparisonType.Relative)); + var v = FuelEfficiency.FromLitersPer100Kilometers(1); + Assert.True(v.Equals(FuelEfficiency.FromLitersPer100Kilometers(1), LitersPer100KilometersTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(FuelEfficiency.Zero, LitersPer100KilometersTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); + FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); Assert.False(literper100kilometers.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); + FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); Assert.False(literper100kilometers.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(FuelEfficiencyUnit.Undefined, FuelEfficiency.Units); + Assert.DoesNotContain(FuelEfficiencyUnit.Undefined, FuelEfficiency.Units); } [Fact] @@ -267,7 +267,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(FuelEfficiency.BaseDimensions is null); + Assert.False(FuelEfficiency.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs index a0c28d1b4b..024e5c5971 100644 --- a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs @@ -77,26 +77,26 @@ public abstract partial class HeatFluxTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new HeatFlux((double)0.0, HeatFluxUnit.Undefined)); + Assert.Throws(() => new HeatFlux((double)0.0, HeatFluxUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new HeatFlux(double.PositiveInfinity, HeatFluxUnit.WattPerSquareMeter)); - Assert.Throws(() => new HeatFlux(double.NegativeInfinity, HeatFluxUnit.WattPerSquareMeter)); + Assert.Throws(() => new HeatFlux(double.PositiveInfinity, HeatFluxUnit.WattPerSquareMeter)); + Assert.Throws(() => new HeatFlux(double.NegativeInfinity, HeatFluxUnit.WattPerSquareMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new HeatFlux(double.NaN, HeatFluxUnit.WattPerSquareMeter)); + Assert.Throws(() => new HeatFlux(double.NaN, HeatFluxUnit.WattPerSquareMeter)); } [Fact] public void WattPerSquareMeterToHeatFluxUnits() { - HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); + HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); AssertEx.EqualTolerance(BtusPerHourSquareFootInOneWattPerSquareMeter, wattpersquaremeter.BtusPerHourSquareFoot, BtusPerHourSquareFootTolerance); AssertEx.EqualTolerance(BtusPerMinuteSquareFootInOneWattPerSquareMeter, wattpersquaremeter.BtusPerMinuteSquareFoot, BtusPerMinuteSquareFootTolerance); AssertEx.EqualTolerance(BtusPerSecondSquareFootInOneWattPerSquareMeter, wattpersquaremeter.BtusPerSecondSquareFoot, BtusPerSecondSquareFootTolerance); @@ -120,43 +120,43 @@ public void WattPerSquareMeterToHeatFluxUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.BtuPerHourSquareFoot).BtusPerHourSquareFoot, BtusPerHourSquareFootTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.BtuPerMinuteSquareFoot).BtusPerMinuteSquareFoot, BtusPerMinuteSquareFootTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.BtuPerSecondSquareFoot).BtusPerSecondSquareFoot, BtusPerSecondSquareFootTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.BtuPerSecondSquareInch).BtusPerSecondSquareInch, BtusPerSecondSquareInchTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.CaloriePerSecondSquareCentimeter).CaloriesPerSecondSquareCentimeter, CaloriesPerSecondSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.CentiwattPerSquareMeter).CentiwattsPerSquareMeter, CentiwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.DeciwattPerSquareMeter).DeciwattsPerSquareMeter, DeciwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.KilocaloriePerHourSquareMeter).KilocaloriesPerHourSquareMeter, KilocaloriesPerHourSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.KilocaloriePerSecondSquareCentimeter).KilocaloriesPerSecondSquareCentimeter, KilocaloriesPerSecondSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.KilowattPerSquareMeter).KilowattsPerSquareMeter, KilowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.MicrowattPerSquareMeter).MicrowattsPerSquareMeter, MicrowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.MilliwattPerSquareMeter).MilliwattsPerSquareMeter, MilliwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.NanowattPerSquareMeter).NanowattsPerSquareMeter, NanowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.PoundForcePerFootSecond).PoundsForcePerFootSecond, PoundsForcePerFootSecondTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.PoundPerSecondCubed).PoundsPerSecondCubed, PoundsPerSecondCubedTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.WattPerSquareFoot).WattsPerSquareFoot, WattsPerSquareFootTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.WattPerSquareInch).WattsPerSquareInch, WattsPerSquareInchTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.WattPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.BtuPerHourSquareFoot).BtusPerHourSquareFoot, BtusPerHourSquareFootTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.BtuPerMinuteSquareFoot).BtusPerMinuteSquareFoot, BtusPerMinuteSquareFootTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.BtuPerSecondSquareFoot).BtusPerSecondSquareFoot, BtusPerSecondSquareFootTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.BtuPerSecondSquareInch).BtusPerSecondSquareInch, BtusPerSecondSquareInchTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.CaloriePerSecondSquareCentimeter).CaloriesPerSecondSquareCentimeter, CaloriesPerSecondSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.CentiwattPerSquareMeter).CentiwattsPerSquareMeter, CentiwattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.DeciwattPerSquareMeter).DeciwattsPerSquareMeter, DeciwattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.KilocaloriePerHourSquareMeter).KilocaloriesPerHourSquareMeter, KilocaloriesPerHourSquareMeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.KilocaloriePerSecondSquareCentimeter).KilocaloriesPerSecondSquareCentimeter, KilocaloriesPerSecondSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.KilowattPerSquareMeter).KilowattsPerSquareMeter, KilowattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.MicrowattPerSquareMeter).MicrowattsPerSquareMeter, MicrowattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.MilliwattPerSquareMeter).MilliwattsPerSquareMeter, MilliwattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.NanowattPerSquareMeter).NanowattsPerSquareMeter, NanowattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.PoundForcePerFootSecond).PoundsForcePerFootSecond, PoundsForcePerFootSecondTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.PoundPerSecondCubed).PoundsPerSecondCubed, PoundsPerSecondCubedTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.WattPerSquareFoot).WattsPerSquareFoot, WattsPerSquareFootTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.WattPerSquareInch).WattsPerSquareInch, WattsPerSquareInchTolerance); + AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.WattPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance); } [Fact] public void FromWattsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.NegativeInfinity)); + Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.NegativeInfinity)); } [Fact] public void FromWattsPerSquareMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.NaN)); + Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.NaN)); } [Fact] public void As() { - var wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); + var wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); AssertEx.EqualTolerance(BtusPerHourSquareFootInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.BtuPerHourSquareFoot), BtusPerHourSquareFootTolerance); AssertEx.EqualTolerance(BtusPerMinuteSquareFootInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.BtuPerMinuteSquareFoot), BtusPerMinuteSquareFootTolerance); AssertEx.EqualTolerance(BtusPerSecondSquareFootInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.BtuPerSecondSquareFoot), BtusPerSecondSquareFootTolerance); @@ -180,7 +180,7 @@ public void As() [Fact] public void ToUnit() { - var wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); + var wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); var btuperhoursquarefootQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.BtuPerHourSquareFoot); AssertEx.EqualTolerance(BtusPerHourSquareFootInOneWattPerSquareMeter, (double)btuperhoursquarefootQuantity.Value, BtusPerHourSquareFootTolerance); @@ -258,45 +258,45 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); - AssertEx.EqualTolerance(1, HeatFlux.FromBtusPerHourSquareFoot(wattpersquaremeter.BtusPerHourSquareFoot).WattsPerSquareMeter, BtusPerHourSquareFootTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromBtusPerMinuteSquareFoot(wattpersquaremeter.BtusPerMinuteSquareFoot).WattsPerSquareMeter, BtusPerMinuteSquareFootTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromBtusPerSecondSquareFoot(wattpersquaremeter.BtusPerSecondSquareFoot).WattsPerSquareMeter, BtusPerSecondSquareFootTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromBtusPerSecondSquareInch(wattpersquaremeter.BtusPerSecondSquareInch).WattsPerSquareMeter, BtusPerSecondSquareInchTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromCaloriesPerSecondSquareCentimeter(wattpersquaremeter.CaloriesPerSecondSquareCentimeter).WattsPerSquareMeter, CaloriesPerSecondSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromCentiwattsPerSquareMeter(wattpersquaremeter.CentiwattsPerSquareMeter).WattsPerSquareMeter, CentiwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromDeciwattsPerSquareMeter(wattpersquaremeter.DeciwattsPerSquareMeter).WattsPerSquareMeter, DeciwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromKilocaloriesPerHourSquareMeter(wattpersquaremeter.KilocaloriesPerHourSquareMeter).WattsPerSquareMeter, KilocaloriesPerHourSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromKilocaloriesPerSecondSquareCentimeter(wattpersquaremeter.KilocaloriesPerSecondSquareCentimeter).WattsPerSquareMeter, KilocaloriesPerSecondSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromKilowattsPerSquareMeter(wattpersquaremeter.KilowattsPerSquareMeter).WattsPerSquareMeter, KilowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromMicrowattsPerSquareMeter(wattpersquaremeter.MicrowattsPerSquareMeter).WattsPerSquareMeter, MicrowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromMilliwattsPerSquareMeter(wattpersquaremeter.MilliwattsPerSquareMeter).WattsPerSquareMeter, MilliwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromNanowattsPerSquareMeter(wattpersquaremeter.NanowattsPerSquareMeter).WattsPerSquareMeter, NanowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromPoundsForcePerFootSecond(wattpersquaremeter.PoundsForcePerFootSecond).WattsPerSquareMeter, PoundsForcePerFootSecondTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromPoundsPerSecondCubed(wattpersquaremeter.PoundsPerSecondCubed).WattsPerSquareMeter, PoundsPerSecondCubedTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromWattsPerSquareFoot(wattpersquaremeter.WattsPerSquareFoot).WattsPerSquareMeter, WattsPerSquareFootTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromWattsPerSquareInch(wattpersquaremeter.WattsPerSquareInch).WattsPerSquareMeter, WattsPerSquareInchTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromWattsPerSquareMeter(wattpersquaremeter.WattsPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance); + HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); + AssertEx.EqualTolerance(1, HeatFlux.FromBtusPerHourSquareFoot(wattpersquaremeter.BtusPerHourSquareFoot).WattsPerSquareMeter, BtusPerHourSquareFootTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromBtusPerMinuteSquareFoot(wattpersquaremeter.BtusPerMinuteSquareFoot).WattsPerSquareMeter, BtusPerMinuteSquareFootTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromBtusPerSecondSquareFoot(wattpersquaremeter.BtusPerSecondSquareFoot).WattsPerSquareMeter, BtusPerSecondSquareFootTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromBtusPerSecondSquareInch(wattpersquaremeter.BtusPerSecondSquareInch).WattsPerSquareMeter, BtusPerSecondSquareInchTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromCaloriesPerSecondSquareCentimeter(wattpersquaremeter.CaloriesPerSecondSquareCentimeter).WattsPerSquareMeter, CaloriesPerSecondSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromCentiwattsPerSquareMeter(wattpersquaremeter.CentiwattsPerSquareMeter).WattsPerSquareMeter, CentiwattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromDeciwattsPerSquareMeter(wattpersquaremeter.DeciwattsPerSquareMeter).WattsPerSquareMeter, DeciwattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromKilocaloriesPerHourSquareMeter(wattpersquaremeter.KilocaloriesPerHourSquareMeter).WattsPerSquareMeter, KilocaloriesPerHourSquareMeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromKilocaloriesPerSecondSquareCentimeter(wattpersquaremeter.KilocaloriesPerSecondSquareCentimeter).WattsPerSquareMeter, KilocaloriesPerSecondSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromKilowattsPerSquareMeter(wattpersquaremeter.KilowattsPerSquareMeter).WattsPerSquareMeter, KilowattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromMicrowattsPerSquareMeter(wattpersquaremeter.MicrowattsPerSquareMeter).WattsPerSquareMeter, MicrowattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromMilliwattsPerSquareMeter(wattpersquaremeter.MilliwattsPerSquareMeter).WattsPerSquareMeter, MilliwattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromNanowattsPerSquareMeter(wattpersquaremeter.NanowattsPerSquareMeter).WattsPerSquareMeter, NanowattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromPoundsForcePerFootSecond(wattpersquaremeter.PoundsForcePerFootSecond).WattsPerSquareMeter, PoundsForcePerFootSecondTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromPoundsPerSecondCubed(wattpersquaremeter.PoundsPerSecondCubed).WattsPerSquareMeter, PoundsPerSecondCubedTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromWattsPerSquareFoot(wattpersquaremeter.WattsPerSquareFoot).WattsPerSquareMeter, WattsPerSquareFootTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromWattsPerSquareInch(wattpersquaremeter.WattsPerSquareInch).WattsPerSquareMeter, WattsPerSquareInchTolerance); + AssertEx.EqualTolerance(1, HeatFlux.FromWattsPerSquareMeter(wattpersquaremeter.WattsPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance); } [Fact] public void ArithmeticOperators() { - HeatFlux v = HeatFlux.FromWattsPerSquareMeter(1); + HeatFlux v = HeatFlux.FromWattsPerSquareMeter(1); AssertEx.EqualTolerance(-1, -v.WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (HeatFlux.FromWattsPerSquareMeter(3)-v).WattsPerSquareMeter, WattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, (HeatFlux.FromWattsPerSquareMeter(3)-v).WattsPerSquareMeter, WattsPerSquareMeterTolerance); AssertEx.EqualTolerance(2, (v + v).WattsPerSquareMeter, WattsPerSquareMeterTolerance); AssertEx.EqualTolerance(10, (v*10).WattsPerSquareMeter, WattsPerSquareMeterTolerance); AssertEx.EqualTolerance(10, (10*v).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (HeatFlux.FromWattsPerSquareMeter(10)/5).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, HeatFlux.FromWattsPerSquareMeter(10)/HeatFlux.FromWattsPerSquareMeter(5), WattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, (HeatFlux.FromWattsPerSquareMeter(10)/5).WattsPerSquareMeter, WattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, HeatFlux.FromWattsPerSquareMeter(10)/HeatFlux.FromWattsPerSquareMeter(5), WattsPerSquareMeterTolerance); } [Fact] public void ComparisonOperators() { - HeatFlux oneWattPerSquareMeter = HeatFlux.FromWattsPerSquareMeter(1); - HeatFlux twoWattsPerSquareMeter = HeatFlux.FromWattsPerSquareMeter(2); + HeatFlux oneWattPerSquareMeter = HeatFlux.FromWattsPerSquareMeter(1); + HeatFlux twoWattsPerSquareMeter = HeatFlux.FromWattsPerSquareMeter(2); Assert.True(oneWattPerSquareMeter < twoWattsPerSquareMeter); Assert.True(oneWattPerSquareMeter <= twoWattsPerSquareMeter); @@ -312,31 +312,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); + HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); Assert.Equal(0, wattpersquaremeter.CompareTo(wattpersquaremeter)); - Assert.True(wattpersquaremeter.CompareTo(HeatFlux.Zero) > 0); - Assert.True(HeatFlux.Zero.CompareTo(wattpersquaremeter) < 0); + Assert.True(wattpersquaremeter.CompareTo(HeatFlux.Zero) > 0); + Assert.True(HeatFlux.Zero.CompareTo(wattpersquaremeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); + HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); Assert.Throws(() => wattpersquaremeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); + HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); Assert.Throws(() => wattpersquaremeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = HeatFlux.FromWattsPerSquareMeter(1); - var b = HeatFlux.FromWattsPerSquareMeter(2); + var a = HeatFlux.FromWattsPerSquareMeter(1); + var b = HeatFlux.FromWattsPerSquareMeter(2); // ReSharper disable EqualExpressionComparison @@ -355,8 +355,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = HeatFlux.FromWattsPerSquareMeter(1); - var b = HeatFlux.FromWattsPerSquareMeter(2); + var a = HeatFlux.FromWattsPerSquareMeter(1); + var b = HeatFlux.FromWattsPerSquareMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -366,29 +366,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = HeatFlux.FromWattsPerSquareMeter(1); - Assert.True(v.Equals(HeatFlux.FromWattsPerSquareMeter(1), WattsPerSquareMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(HeatFlux.Zero, WattsPerSquareMeterTolerance, ComparisonType.Relative)); + var v = HeatFlux.FromWattsPerSquareMeter(1); + Assert.True(v.Equals(HeatFlux.FromWattsPerSquareMeter(1), WattsPerSquareMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(HeatFlux.Zero, WattsPerSquareMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); + HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); Assert.False(wattpersquaremeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); + HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); Assert.False(wattpersquaremeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(HeatFluxUnit.Undefined, HeatFlux.Units); + Assert.DoesNotContain(HeatFluxUnit.Undefined, HeatFlux.Units); } [Fact] @@ -407,7 +407,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(HeatFlux.BaseDimensions is null); + Assert.False(HeatFlux.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs index 7114209e1d..ef09e22033 100644 --- a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs @@ -47,26 +47,26 @@ public abstract partial class HeatTransferCoefficientTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new HeatTransferCoefficient((double)0.0, HeatTransferCoefficientUnit.Undefined)); + Assert.Throws(() => new HeatTransferCoefficient((double)0.0, HeatTransferCoefficientUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new HeatTransferCoefficient(double.PositiveInfinity, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); - Assert.Throws(() => new HeatTransferCoefficient(double.NegativeInfinity, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); + Assert.Throws(() => new HeatTransferCoefficient(double.PositiveInfinity, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); + Assert.Throws(() => new HeatTransferCoefficient(double.NegativeInfinity, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new HeatTransferCoefficient(double.NaN, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); + Assert.Throws(() => new HeatTransferCoefficient(double.NaN, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); } [Fact] public void WattPerSquareMeterKelvinToHeatTransferCoefficientUnits() { - HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); + HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); AssertEx.EqualTolerance(BtusPerSquareFootDegreeFahrenheitInOneWattPerSquareMeterKelvin, wattpersquaremeterkelvin.BtusPerSquareFootDegreeFahrenheit, BtusPerSquareFootDegreeFahrenheitTolerance); AssertEx.EqualTolerance(WattsPerSquareMeterCelsiusInOneWattPerSquareMeterKelvin, wattpersquaremeterkelvin.WattsPerSquareMeterCelsius, WattsPerSquareMeterCelsiusTolerance); AssertEx.EqualTolerance(WattsPerSquareMeterKelvinInOneWattPerSquareMeterKelvin, wattpersquaremeterkelvin.WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); @@ -75,28 +75,28 @@ public void WattPerSquareMeterKelvinToHeatTransferCoefficientUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, HeatTransferCoefficient.From(1, HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit).BtusPerSquareFootDegreeFahrenheit, BtusPerSquareFootDegreeFahrenheitTolerance); - AssertEx.EqualTolerance(1, HeatTransferCoefficient.From(1, HeatTransferCoefficientUnit.WattPerSquareMeterCelsius).WattsPerSquareMeterCelsius, WattsPerSquareMeterCelsiusTolerance); - AssertEx.EqualTolerance(1, HeatTransferCoefficient.From(1, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); + AssertEx.EqualTolerance(1, HeatTransferCoefficient.From(1, HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit).BtusPerSquareFootDegreeFahrenheit, BtusPerSquareFootDegreeFahrenheitTolerance); + AssertEx.EqualTolerance(1, HeatTransferCoefficient.From(1, HeatTransferCoefficientUnit.WattPerSquareMeterCelsius).WattsPerSquareMeterCelsius, WattsPerSquareMeterCelsiusTolerance); + AssertEx.EqualTolerance(1, HeatTransferCoefficient.From(1, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); } [Fact] public void FromWattsPerSquareMeterKelvin_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.PositiveInfinity)); - Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.NegativeInfinity)); + Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.PositiveInfinity)); + Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.NegativeInfinity)); } [Fact] public void FromWattsPerSquareMeterKelvin_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.NaN)); + Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.NaN)); } [Fact] public void As() { - var wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); + var wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); AssertEx.EqualTolerance(BtusPerSquareFootDegreeFahrenheitInOneWattPerSquareMeterKelvin, wattpersquaremeterkelvin.As(HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit), BtusPerSquareFootDegreeFahrenheitTolerance); AssertEx.EqualTolerance(WattsPerSquareMeterCelsiusInOneWattPerSquareMeterKelvin, wattpersquaremeterkelvin.As(HeatTransferCoefficientUnit.WattPerSquareMeterCelsius), WattsPerSquareMeterCelsiusTolerance); AssertEx.EqualTolerance(WattsPerSquareMeterKelvinInOneWattPerSquareMeterKelvin, wattpersquaremeterkelvin.As(HeatTransferCoefficientUnit.WattPerSquareMeterKelvin), WattsPerSquareMeterKelvinTolerance); @@ -105,7 +105,7 @@ public void As() [Fact] public void ToUnit() { - var wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); + var wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); var btupersquarefootdegreefahrenheitQuantity = wattpersquaremeterkelvin.ToUnit(HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit); AssertEx.EqualTolerance(BtusPerSquareFootDegreeFahrenheitInOneWattPerSquareMeterKelvin, (double)btupersquarefootdegreefahrenheitQuantity.Value, BtusPerSquareFootDegreeFahrenheitTolerance); @@ -123,30 +123,30 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - AssertEx.EqualTolerance(1, HeatTransferCoefficient.FromBtusPerSquareFootDegreeFahrenheit(wattpersquaremeterkelvin.BtusPerSquareFootDegreeFahrenheit).WattsPerSquareMeterKelvin, BtusPerSquareFootDegreeFahrenheitTolerance); - AssertEx.EqualTolerance(1, HeatTransferCoefficient.FromWattsPerSquareMeterCelsius(wattpersquaremeterkelvin.WattsPerSquareMeterCelsius).WattsPerSquareMeterKelvin, WattsPerSquareMeterCelsiusTolerance); - AssertEx.EqualTolerance(1, HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(wattpersquaremeterkelvin.WattsPerSquareMeterKelvin).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); + HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); + AssertEx.EqualTolerance(1, HeatTransferCoefficient.FromBtusPerSquareFootDegreeFahrenheit(wattpersquaremeterkelvin.BtusPerSquareFootDegreeFahrenheit).WattsPerSquareMeterKelvin, BtusPerSquareFootDegreeFahrenheitTolerance); + AssertEx.EqualTolerance(1, HeatTransferCoefficient.FromWattsPerSquareMeterCelsius(wattpersquaremeterkelvin.WattsPerSquareMeterCelsius).WattsPerSquareMeterKelvin, WattsPerSquareMeterCelsiusTolerance); + AssertEx.EqualTolerance(1, HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(wattpersquaremeterkelvin.WattsPerSquareMeterKelvin).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); } [Fact] public void ArithmeticOperators() { - HeatTransferCoefficient v = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); + HeatTransferCoefficient v = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); AssertEx.EqualTolerance(-1, -v.WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); - AssertEx.EqualTolerance(2, (HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(3)-v).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); + AssertEx.EqualTolerance(2, (HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(3)-v).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); AssertEx.EqualTolerance(2, (v + v).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); AssertEx.EqualTolerance(10, (v*10).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); AssertEx.EqualTolerance(10, (10*v).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); - AssertEx.EqualTolerance(2, (HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(10)/5).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); - AssertEx.EqualTolerance(2, HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(10)/HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(5), WattsPerSquareMeterKelvinTolerance); + AssertEx.EqualTolerance(2, (HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(10)/5).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); + AssertEx.EqualTolerance(2, HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(10)/HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(5), WattsPerSquareMeterKelvinTolerance); } [Fact] public void ComparisonOperators() { - HeatTransferCoefficient oneWattPerSquareMeterKelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - HeatTransferCoefficient twoWattsPerSquareMeterKelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(2); + HeatTransferCoefficient oneWattPerSquareMeterKelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); + HeatTransferCoefficient twoWattsPerSquareMeterKelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(2); Assert.True(oneWattPerSquareMeterKelvin < twoWattsPerSquareMeterKelvin); Assert.True(oneWattPerSquareMeterKelvin <= twoWattsPerSquareMeterKelvin); @@ -162,31 +162,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); + HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); Assert.Equal(0, wattpersquaremeterkelvin.CompareTo(wattpersquaremeterkelvin)); - Assert.True(wattpersquaremeterkelvin.CompareTo(HeatTransferCoefficient.Zero) > 0); - Assert.True(HeatTransferCoefficient.Zero.CompareTo(wattpersquaremeterkelvin) < 0); + Assert.True(wattpersquaremeterkelvin.CompareTo(HeatTransferCoefficient.Zero) > 0); + Assert.True(HeatTransferCoefficient.Zero.CompareTo(wattpersquaremeterkelvin) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); + HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); Assert.Throws(() => wattpersquaremeterkelvin.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); + HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); Assert.Throws(() => wattpersquaremeterkelvin.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - var b = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(2); + var a = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); + var b = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(2); // ReSharper disable EqualExpressionComparison @@ -205,8 +205,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - var b = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(2); + var a = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); + var b = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -216,29 +216,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - Assert.True(v.Equals(HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1), WattsPerSquareMeterKelvinTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(HeatTransferCoefficient.Zero, WattsPerSquareMeterKelvinTolerance, ComparisonType.Relative)); + var v = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); + Assert.True(v.Equals(HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1), WattsPerSquareMeterKelvinTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(HeatTransferCoefficient.Zero, WattsPerSquareMeterKelvinTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); + HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); Assert.False(wattpersquaremeterkelvin.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); + HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); Assert.False(wattpersquaremeterkelvin.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(HeatTransferCoefficientUnit.Undefined, HeatTransferCoefficient.Units); + Assert.DoesNotContain(HeatTransferCoefficientUnit.Undefined, HeatTransferCoefficient.Units); } [Fact] @@ -257,7 +257,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(HeatTransferCoefficient.BaseDimensions is null); + Assert.False(HeatTransferCoefficient.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs b/UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs index d3c43d14bc..25cd7e1f17 100644 --- a/UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs @@ -34,104 +34,104 @@ void Assertion(int expectedValue, Enum expectedUnit, IQuantity quantity) Assert.Equal(expectedValue, quantity.Value); } - Assertion(3, AccelerationUnit.StandardGravity, Quantity.From(3, AccelerationUnit.StandardGravity)); - Assertion(3, AmountOfSubstanceUnit.PoundMole, Quantity.From(3, AmountOfSubstanceUnit.PoundMole)); - Assertion(3, AmplitudeRatioUnit.DecibelVolt, Quantity.From(3, AmplitudeRatioUnit.DecibelVolt)); - Assertion(3, AngleUnit.Revolution, Quantity.From(3, AngleUnit.Revolution)); - Assertion(3, ApparentEnergyUnit.VoltampereHour, Quantity.From(3, ApparentEnergyUnit.VoltampereHour)); - Assertion(3, ApparentPowerUnit.Voltampere, Quantity.From(3, ApparentPowerUnit.Voltampere)); - Assertion(3, AreaUnit.UsSurveySquareFoot, Quantity.From(3, AreaUnit.UsSurveySquareFoot)); - Assertion(3, AreaDensityUnit.KilogramPerSquareMeter, Quantity.From(3, AreaDensityUnit.KilogramPerSquareMeter)); - Assertion(3, AreaMomentOfInertiaUnit.MillimeterToTheFourth, Quantity.From(3, AreaMomentOfInertiaUnit.MillimeterToTheFourth)); - Assertion(3, BitRateUnit.TerabytePerSecond, Quantity.From(3, BitRateUnit.TerabytePerSecond)); - Assertion(3, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour, Quantity.From(3, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour)); - Assertion(3, CapacitanceUnit.Picofarad, Quantity.From(3, CapacitanceUnit.Picofarad)); - Assertion(3, CoefficientOfThermalExpansionUnit.InverseKelvin, Quantity.From(3, CoefficientOfThermalExpansionUnit.InverseKelvin)); - Assertion(3, DensityUnit.TonnePerCubicMillimeter, Quantity.From(3, DensityUnit.TonnePerCubicMillimeter)); - Assertion(3, DurationUnit.Year365, Quantity.From(3, DurationUnit.Year365)); - Assertion(3, DynamicViscosityUnit.Reyn, Quantity.From(3, DynamicViscosityUnit.Reyn)); - Assertion(3, ElectricAdmittanceUnit.Siemens, Quantity.From(3, ElectricAdmittanceUnit.Siemens)); - Assertion(3, ElectricChargeUnit.MilliampereHour, Quantity.From(3, ElectricChargeUnit.MilliampereHour)); - Assertion(3, ElectricChargeDensityUnit.CoulombPerCubicMeter, Quantity.From(3, ElectricChargeDensityUnit.CoulombPerCubicMeter)); - Assertion(3, ElectricConductanceUnit.Siemens, Quantity.From(3, ElectricConductanceUnit.Siemens)); - Assertion(3, ElectricConductivityUnit.SiemensPerMeter, Quantity.From(3, ElectricConductivityUnit.SiemensPerMeter)); - Assertion(3, ElectricCurrentUnit.Picoampere, Quantity.From(3, ElectricCurrentUnit.Picoampere)); - Assertion(3, ElectricCurrentDensityUnit.AmperePerSquareMeter, Quantity.From(3, ElectricCurrentDensityUnit.AmperePerSquareMeter)); - Assertion(3, ElectricCurrentGradientUnit.AmperePerSecond, Quantity.From(3, ElectricCurrentGradientUnit.AmperePerSecond)); - Assertion(3, ElectricFieldUnit.VoltPerMeter, Quantity.From(3, ElectricFieldUnit.VoltPerMeter)); - Assertion(3, ElectricInductanceUnit.Nanohenry, Quantity.From(3, ElectricInductanceUnit.Nanohenry)); - Assertion(3, ElectricPotentialUnit.Volt, Quantity.From(3, ElectricPotentialUnit.Volt)); - Assertion(3, ElectricPotentialAcUnit.VoltAc, Quantity.From(3, ElectricPotentialAcUnit.VoltAc)); - Assertion(3, ElectricPotentialDcUnit.VoltDc, Quantity.From(3, ElectricPotentialDcUnit.VoltDc)); - Assertion(3, ElectricResistanceUnit.Ohm, Quantity.From(3, ElectricResistanceUnit.Ohm)); - Assertion(3, ElectricResistivityUnit.PicoohmMeter, Quantity.From(3, ElectricResistivityUnit.PicoohmMeter)); - Assertion(3, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter, Quantity.From(3, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter)); - Assertion(3, EnergyUnit.WattHour, Quantity.From(3, EnergyUnit.WattHour)); - Assertion(3, EntropyUnit.MegajoulePerKelvin, Quantity.From(3, EntropyUnit.MegajoulePerKelvin)); - Assertion(3, ForceUnit.TonneForce, Quantity.From(3, ForceUnit.TonneForce)); - Assertion(3, ForceChangeRateUnit.NewtonPerSecond, Quantity.From(3, ForceChangeRateUnit.NewtonPerSecond)); - Assertion(3, ForcePerLengthUnit.PoundForcePerYard, Quantity.From(3, ForcePerLengthUnit.PoundForcePerYard)); - Assertion(3, FrequencyUnit.Terahertz, Quantity.From(3, FrequencyUnit.Terahertz)); - Assertion(3, FuelEfficiencyUnit.MilePerUsGallon, Quantity.From(3, FuelEfficiencyUnit.MilePerUsGallon)); - Assertion(3, HeatFluxUnit.WattPerSquareMeter, Quantity.From(3, HeatFluxUnit.WattPerSquareMeter)); - Assertion(3, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin, Quantity.From(3, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); - Assertion(3, IlluminanceUnit.Millilux, Quantity.From(3, IlluminanceUnit.Millilux)); - Assertion(3, InformationUnit.Terabyte, Quantity.From(3, InformationUnit.Terabyte)); - Assertion(3, IrradianceUnit.WattPerSquareMeter, Quantity.From(3, IrradianceUnit.WattPerSquareMeter)); - Assertion(3, IrradiationUnit.WattHourPerSquareMeter, Quantity.From(3, IrradiationUnit.WattHourPerSquareMeter)); - Assertion(3, KinematicViscosityUnit.Stokes, Quantity.From(3, KinematicViscosityUnit.Stokes)); - Assertion(3, LapseRateUnit.DegreeCelsiusPerKilometer, Quantity.From(3, LapseRateUnit.DegreeCelsiusPerKilometer)); - Assertion(3, LengthUnit.Yard, Quantity.From(3, LengthUnit.Yard)); - Assertion(3, LevelUnit.Neper, Quantity.From(3, LevelUnit.Neper)); - Assertion(3, LinearDensityUnit.PoundPerFoot, Quantity.From(3, LinearDensityUnit.PoundPerFoot)); - Assertion(3, LuminosityUnit.Watt, Quantity.From(3, LuminosityUnit.Watt)); - Assertion(3, LuminousFluxUnit.Lumen, Quantity.From(3, LuminousFluxUnit.Lumen)); - Assertion(3, LuminousIntensityUnit.Candela, Quantity.From(3, LuminousIntensityUnit.Candela)); - Assertion(3, MagneticFieldUnit.Tesla, Quantity.From(3, MagneticFieldUnit.Tesla)); - Assertion(3, MagneticFluxUnit.Weber, Quantity.From(3, MagneticFluxUnit.Weber)); - Assertion(3, MagnetizationUnit.AmperePerMeter, Quantity.From(3, MagnetizationUnit.AmperePerMeter)); - Assertion(3, MassUnit.Tonne, Quantity.From(3, MassUnit.Tonne)); - Assertion(3, MassConcentrationUnit.TonnePerCubicMillimeter, Quantity.From(3, MassConcentrationUnit.TonnePerCubicMillimeter)); - Assertion(3, MassFlowUnit.TonnePerHour, Quantity.From(3, MassFlowUnit.TonnePerHour)); - Assertion(3, MassFluxUnit.KilogramPerSecondPerSquareMeter, Quantity.From(3, MassFluxUnit.KilogramPerSecondPerSquareMeter)); - Assertion(3, MassFractionUnit.Percent, Quantity.From(3, MassFractionUnit.Percent)); - Assertion(3, MassMomentOfInertiaUnit.TonneSquareMilimeter, Quantity.From(3, MassMomentOfInertiaUnit.TonneSquareMilimeter)); - Assertion(3, MolarEnergyUnit.MegajoulePerMole, Quantity.From(3, MolarEnergyUnit.MegajoulePerMole)); - Assertion(3, MolarEntropyUnit.MegajoulePerMoleKelvin, Quantity.From(3, MolarEntropyUnit.MegajoulePerMoleKelvin)); - Assertion(3, MolarityUnit.PicomolesPerLiter, Quantity.From(3, MolarityUnit.PicomolesPerLiter)); - Assertion(3, MolarMassUnit.PoundPerMole, Quantity.From(3, MolarMassUnit.PoundPerMole)); - Assertion(3, PermeabilityUnit.HenryPerMeter, Quantity.From(3, PermeabilityUnit.HenryPerMeter)); - Assertion(3, PermittivityUnit.FaradPerMeter, Quantity.From(3, PermittivityUnit.FaradPerMeter)); - Assertion(3, PowerUnit.Watt, Quantity.From(3, PowerUnit.Watt)); - Assertion(3, PowerDensityUnit.WattPerLiter, Quantity.From(3, PowerDensityUnit.WattPerLiter)); - Assertion(3, PowerRatioUnit.DecibelWatt, Quantity.From(3, PowerRatioUnit.DecibelWatt)); - Assertion(3, PressureUnit.Torr, Quantity.From(3, PressureUnit.Torr)); - Assertion(3, PressureChangeRateUnit.PascalPerSecond, Quantity.From(3, PressureChangeRateUnit.PascalPerSecond)); - Assertion(3, RatioUnit.Percent, Quantity.From(3, RatioUnit.Percent)); - Assertion(3, RatioChangeRateUnit.PercentPerSecond, Quantity.From(3, RatioChangeRateUnit.PercentPerSecond)); - Assertion(3, ReactiveEnergyUnit.VoltampereReactiveHour, Quantity.From(3, ReactiveEnergyUnit.VoltampereReactiveHour)); - Assertion(3, ReactivePowerUnit.VoltampereReactive, Quantity.From(3, ReactivePowerUnit.VoltampereReactive)); - Assertion(3, RotationalAccelerationUnit.RevolutionPerSecondSquared, Quantity.From(3, RotationalAccelerationUnit.RevolutionPerSecondSquared)); - Assertion(3, RotationalSpeedUnit.RevolutionPerSecond, Quantity.From(3, RotationalSpeedUnit.RevolutionPerSecond)); - Assertion(3, RotationalStiffnessUnit.NewtonMeterPerRadian, Quantity.From(3, RotationalStiffnessUnit.NewtonMeterPerRadian)); - Assertion(3, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter, Quantity.From(3, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); - Assertion(3, SolidAngleUnit.Steradian, Quantity.From(3, SolidAngleUnit.Steradian)); - Assertion(3, SpecificEnergyUnit.WattHourPerKilogram, Quantity.From(3, SpecificEnergyUnit.WattHourPerKilogram)); - Assertion(3, SpecificEntropyUnit.MegajoulePerKilogramKelvin, Quantity.From(3, SpecificEntropyUnit.MegajoulePerKilogramKelvin)); - Assertion(3, SpecificVolumeUnit.MillicubicMeterPerKilogram, Quantity.From(3, SpecificVolumeUnit.MillicubicMeterPerKilogram)); - Assertion(3, SpecificWeightUnit.TonneForcePerCubicMillimeter, Quantity.From(3, SpecificWeightUnit.TonneForcePerCubicMillimeter)); - Assertion(3, SpeedUnit.YardPerSecond, Quantity.From(3, SpeedUnit.YardPerSecond)); - Assertion(3, TemperatureUnit.SolarTemperature, Quantity.From(3, TemperatureUnit.SolarTemperature)); - Assertion(3, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond, Quantity.From(3, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond)); - Assertion(3, TemperatureDeltaUnit.Kelvin, Quantity.From(3, TemperatureDeltaUnit.Kelvin)); - Assertion(3, ThermalConductivityUnit.WattPerMeterKelvin, Quantity.From(3, ThermalConductivityUnit.WattPerMeterKelvin)); - Assertion(3, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt, Quantity.From(3, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); - Assertion(3, TorqueUnit.TonneForceMillimeter, Quantity.From(3, TorqueUnit.TonneForceMillimeter)); - Assertion(3, VitaminAUnit.InternationalUnit, Quantity.From(3, VitaminAUnit.InternationalUnit)); - Assertion(3, VolumeUnit.UsTeaspoon, Quantity.From(3, VolumeUnit.UsTeaspoon)); - Assertion(3, VolumeConcentrationUnit.PicolitersPerMililiter, Quantity.From(3, VolumeConcentrationUnit.PicolitersPerMililiter)); - Assertion(3, VolumeFlowUnit.UsGallonPerSecond, Quantity.From(3, VolumeFlowUnit.UsGallonPerSecond)); - Assertion(3, VolumePerLengthUnit.OilBarrelPerFoot, Quantity.From(3, VolumePerLengthUnit.OilBarrelPerFoot)); + Assertion(3, AccelerationUnit.StandardGravity, Quantity.From(3, AccelerationUnit.StandardGravity)); + Assertion(3, AmountOfSubstanceUnit.PoundMole, Quantity.From(3, AmountOfSubstanceUnit.PoundMole)); + Assertion(3, AmplitudeRatioUnit.DecibelVolt, Quantity.From(3, AmplitudeRatioUnit.DecibelVolt)); + Assertion(3, AngleUnit.Revolution, Quantity.From(3, AngleUnit.Revolution)); + Assertion(3, ApparentEnergyUnit.VoltampereHour, Quantity.From(3, ApparentEnergyUnit.VoltampereHour)); + Assertion(3, ApparentPowerUnit.Voltampere, Quantity.From(3, ApparentPowerUnit.Voltampere)); + Assertion(3, AreaUnit.UsSurveySquareFoot, Quantity.From(3, AreaUnit.UsSurveySquareFoot)); + Assertion(3, AreaDensityUnit.KilogramPerSquareMeter, Quantity.From(3, AreaDensityUnit.KilogramPerSquareMeter)); + Assertion(3, AreaMomentOfInertiaUnit.MillimeterToTheFourth, Quantity.From(3, AreaMomentOfInertiaUnit.MillimeterToTheFourth)); + Assertion(3, BitRateUnit.TerabytePerSecond, Quantity.From(3, BitRateUnit.TerabytePerSecond)); + Assertion(3, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour, Quantity.From(3, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour)); + Assertion(3, CapacitanceUnit.Picofarad, Quantity.From(3, CapacitanceUnit.Picofarad)); + Assertion(3, CoefficientOfThermalExpansionUnit.InverseKelvin, Quantity.From(3, CoefficientOfThermalExpansionUnit.InverseKelvin)); + Assertion(3, DensityUnit.TonnePerCubicMillimeter, Quantity.From(3, DensityUnit.TonnePerCubicMillimeter)); + Assertion(3, DurationUnit.Year365, Quantity.From(3, DurationUnit.Year365)); + Assertion(3, DynamicViscosityUnit.Reyn, Quantity.From(3, DynamicViscosityUnit.Reyn)); + Assertion(3, ElectricAdmittanceUnit.Siemens, Quantity.From(3, ElectricAdmittanceUnit.Siemens)); + Assertion(3, ElectricChargeUnit.MilliampereHour, Quantity.From(3, ElectricChargeUnit.MilliampereHour)); + Assertion(3, ElectricChargeDensityUnit.CoulombPerCubicMeter, Quantity.From(3, ElectricChargeDensityUnit.CoulombPerCubicMeter)); + Assertion(3, ElectricConductanceUnit.Siemens, Quantity.From(3, ElectricConductanceUnit.Siemens)); + Assertion(3, ElectricConductivityUnit.SiemensPerMeter, Quantity.From(3, ElectricConductivityUnit.SiemensPerMeter)); + Assertion(3, ElectricCurrentUnit.Picoampere, Quantity.From(3, ElectricCurrentUnit.Picoampere)); + Assertion(3, ElectricCurrentDensityUnit.AmperePerSquareMeter, Quantity.From(3, ElectricCurrentDensityUnit.AmperePerSquareMeter)); + Assertion(3, ElectricCurrentGradientUnit.AmperePerSecond, Quantity.From(3, ElectricCurrentGradientUnit.AmperePerSecond)); + Assertion(3, ElectricFieldUnit.VoltPerMeter, Quantity.From(3, ElectricFieldUnit.VoltPerMeter)); + Assertion(3, ElectricInductanceUnit.Nanohenry, Quantity.From(3, ElectricInductanceUnit.Nanohenry)); + Assertion(3, ElectricPotentialUnit.Volt, Quantity.From(3, ElectricPotentialUnit.Volt)); + Assertion(3, ElectricPotentialAcUnit.VoltAc, Quantity.From(3, ElectricPotentialAcUnit.VoltAc)); + Assertion(3, ElectricPotentialDcUnit.VoltDc, Quantity.From(3, ElectricPotentialDcUnit.VoltDc)); + Assertion(3, ElectricResistanceUnit.Ohm, Quantity.From(3, ElectricResistanceUnit.Ohm)); + Assertion(3, ElectricResistivityUnit.PicoohmMeter, Quantity.From(3, ElectricResistivityUnit.PicoohmMeter)); + Assertion(3, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter, Quantity.From(3, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter)); + Assertion(3, EnergyUnit.WattHour, Quantity.From(3, EnergyUnit.WattHour)); + Assertion(3, EntropyUnit.MegajoulePerKelvin, Quantity.From(3, EntropyUnit.MegajoulePerKelvin)); + Assertion(3, ForceUnit.TonneForce, Quantity.From(3, ForceUnit.TonneForce)); + Assertion(3, ForceChangeRateUnit.NewtonPerSecond, Quantity.From(3, ForceChangeRateUnit.NewtonPerSecond)); + Assertion(3, ForcePerLengthUnit.PoundForcePerYard, Quantity.From(3, ForcePerLengthUnit.PoundForcePerYard)); + Assertion(3, FrequencyUnit.Terahertz, Quantity.From(3, FrequencyUnit.Terahertz)); + Assertion(3, FuelEfficiencyUnit.MilePerUsGallon, Quantity.From(3, FuelEfficiencyUnit.MilePerUsGallon)); + Assertion(3, HeatFluxUnit.WattPerSquareMeter, Quantity.From(3, HeatFluxUnit.WattPerSquareMeter)); + Assertion(3, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin, Quantity.From(3, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); + Assertion(3, IlluminanceUnit.Millilux, Quantity.From(3, IlluminanceUnit.Millilux)); + Assertion(3, InformationUnit.Terabyte, Quantity.From(3, InformationUnit.Terabyte)); + Assertion(3, IrradianceUnit.WattPerSquareMeter, Quantity.From(3, IrradianceUnit.WattPerSquareMeter)); + Assertion(3, IrradiationUnit.WattHourPerSquareMeter, Quantity.From(3, IrradiationUnit.WattHourPerSquareMeter)); + Assertion(3, KinematicViscosityUnit.Stokes, Quantity.From(3, KinematicViscosityUnit.Stokes)); + Assertion(3, LapseRateUnit.DegreeCelsiusPerKilometer, Quantity.From(3, LapseRateUnit.DegreeCelsiusPerKilometer)); + Assertion(3, LengthUnit.Yard, Quantity.From(3, LengthUnit.Yard)); + Assertion(3, LevelUnit.Neper, Quantity.From(3, LevelUnit.Neper)); + Assertion(3, LinearDensityUnit.PoundPerFoot, Quantity.From(3, LinearDensityUnit.PoundPerFoot)); + Assertion(3, LuminosityUnit.Watt, Quantity.From(3, LuminosityUnit.Watt)); + Assertion(3, LuminousFluxUnit.Lumen, Quantity.From(3, LuminousFluxUnit.Lumen)); + Assertion(3, LuminousIntensityUnit.Candela, Quantity.From(3, LuminousIntensityUnit.Candela)); + Assertion(3, MagneticFieldUnit.Tesla, Quantity.From(3, MagneticFieldUnit.Tesla)); + Assertion(3, MagneticFluxUnit.Weber, Quantity.From(3, MagneticFluxUnit.Weber)); + Assertion(3, MagnetizationUnit.AmperePerMeter, Quantity.From(3, MagnetizationUnit.AmperePerMeter)); + Assertion(3, MassUnit.Tonne, Quantity.From(3, MassUnit.Tonne)); + Assertion(3, MassConcentrationUnit.TonnePerCubicMillimeter, Quantity.From(3, MassConcentrationUnit.TonnePerCubicMillimeter)); + Assertion(3, MassFlowUnit.TonnePerHour, Quantity.From(3, MassFlowUnit.TonnePerHour)); + Assertion(3, MassFluxUnit.KilogramPerSecondPerSquareMeter, Quantity.From(3, MassFluxUnit.KilogramPerSecondPerSquareMeter)); + Assertion(3, MassFractionUnit.Percent, Quantity.From(3, MassFractionUnit.Percent)); + Assertion(3, MassMomentOfInertiaUnit.TonneSquareMilimeter, Quantity.From(3, MassMomentOfInertiaUnit.TonneSquareMilimeter)); + Assertion(3, MolarEnergyUnit.MegajoulePerMole, Quantity.From(3, MolarEnergyUnit.MegajoulePerMole)); + Assertion(3, MolarEntropyUnit.MegajoulePerMoleKelvin, Quantity.From(3, MolarEntropyUnit.MegajoulePerMoleKelvin)); + Assertion(3, MolarityUnit.PicomolesPerLiter, Quantity.From(3, MolarityUnit.PicomolesPerLiter)); + Assertion(3, MolarMassUnit.PoundPerMole, Quantity.From(3, MolarMassUnit.PoundPerMole)); + Assertion(3, PermeabilityUnit.HenryPerMeter, Quantity.From(3, PermeabilityUnit.HenryPerMeter)); + Assertion(3, PermittivityUnit.FaradPerMeter, Quantity.From(3, PermittivityUnit.FaradPerMeter)); + Assertion(3, PowerUnit.Watt, Quantity.From(3, PowerUnit.Watt)); + Assertion(3, PowerDensityUnit.WattPerLiter, Quantity.From(3, PowerDensityUnit.WattPerLiter)); + Assertion(3, PowerRatioUnit.DecibelWatt, Quantity.From(3, PowerRatioUnit.DecibelWatt)); + Assertion(3, PressureUnit.Torr, Quantity.From(3, PressureUnit.Torr)); + Assertion(3, PressureChangeRateUnit.PascalPerSecond, Quantity.From(3, PressureChangeRateUnit.PascalPerSecond)); + Assertion(3, RatioUnit.Percent, Quantity.From(3, RatioUnit.Percent)); + Assertion(3, RatioChangeRateUnit.PercentPerSecond, Quantity.From(3, RatioChangeRateUnit.PercentPerSecond)); + Assertion(3, ReactiveEnergyUnit.VoltampereReactiveHour, Quantity.From(3, ReactiveEnergyUnit.VoltampereReactiveHour)); + Assertion(3, ReactivePowerUnit.VoltampereReactive, Quantity.From(3, ReactivePowerUnit.VoltampereReactive)); + Assertion(3, RotationalAccelerationUnit.RevolutionPerSecondSquared, Quantity.From(3, RotationalAccelerationUnit.RevolutionPerSecondSquared)); + Assertion(3, RotationalSpeedUnit.RevolutionPerSecond, Quantity.From(3, RotationalSpeedUnit.RevolutionPerSecond)); + Assertion(3, RotationalStiffnessUnit.NewtonMeterPerRadian, Quantity.From(3, RotationalStiffnessUnit.NewtonMeterPerRadian)); + Assertion(3, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter, Quantity.From(3, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); + Assertion(3, SolidAngleUnit.Steradian, Quantity.From(3, SolidAngleUnit.Steradian)); + Assertion(3, SpecificEnergyUnit.WattHourPerKilogram, Quantity.From(3, SpecificEnergyUnit.WattHourPerKilogram)); + Assertion(3, SpecificEntropyUnit.MegajoulePerKilogramKelvin, Quantity.From(3, SpecificEntropyUnit.MegajoulePerKilogramKelvin)); + Assertion(3, SpecificVolumeUnit.MillicubicMeterPerKilogram, Quantity.From(3, SpecificVolumeUnit.MillicubicMeterPerKilogram)); + Assertion(3, SpecificWeightUnit.TonneForcePerCubicMillimeter, Quantity.From(3, SpecificWeightUnit.TonneForcePerCubicMillimeter)); + Assertion(3, SpeedUnit.YardPerSecond, Quantity.From(3, SpeedUnit.YardPerSecond)); + Assertion(3, TemperatureUnit.SolarTemperature, Quantity.From(3, TemperatureUnit.SolarTemperature)); + Assertion(3, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond, Quantity.From(3, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond)); + Assertion(3, TemperatureDeltaUnit.Kelvin, Quantity.From(3, TemperatureDeltaUnit.Kelvin)); + Assertion(3, ThermalConductivityUnit.WattPerMeterKelvin, Quantity.From(3, ThermalConductivityUnit.WattPerMeterKelvin)); + Assertion(3, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt, Quantity.From(3, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); + Assertion(3, TorqueUnit.TonneForceMillimeter, Quantity.From(3, TorqueUnit.TonneForceMillimeter)); + Assertion(3, VitaminAUnit.InternationalUnit, Quantity.From(3, VitaminAUnit.InternationalUnit)); + Assertion(3, VolumeUnit.UsTeaspoon, Quantity.From(3, VolumeUnit.UsTeaspoon)); + Assertion(3, VolumeConcentrationUnit.PicolitersPerMililiter, Quantity.From(3, VolumeConcentrationUnit.PicolitersPerMililiter)); + Assertion(3, VolumeFlowUnit.UsGallonPerSecond, Quantity.From(3, VolumeFlowUnit.UsGallonPerSecond)); + Assertion(3, VolumePerLengthUnit.OilBarrelPerFoot, Quantity.From(3, VolumePerLengthUnit.OilBarrelPerFoot)); } [Fact] @@ -139,104 +139,104 @@ public void QuantityInfo_IsSameAsStaticInfoProperty() { void Assertion(QuantityInfo expected, IQuantity quantity) => Assert.Same(expected, quantity.QuantityInfo); - Assertion(Acceleration.Info, Acceleration.Zero); - Assertion(AmountOfSubstance.Info, AmountOfSubstance.Zero); - Assertion(AmplitudeRatio.Info, AmplitudeRatio.Zero); - Assertion(Angle.Info, Angle.Zero); - Assertion(ApparentEnergy.Info, ApparentEnergy.Zero); - Assertion(ApparentPower.Info, ApparentPower.Zero); - Assertion(Area.Info, Area.Zero); - Assertion(AreaDensity.Info, AreaDensity.Zero); - Assertion(AreaMomentOfInertia.Info, AreaMomentOfInertia.Zero); - Assertion(BitRate.Info, BitRate.Zero); - Assertion(BrakeSpecificFuelConsumption.Info, BrakeSpecificFuelConsumption.Zero); - Assertion(Capacitance.Info, Capacitance.Zero); - Assertion(CoefficientOfThermalExpansion.Info, CoefficientOfThermalExpansion.Zero); - Assertion(Density.Info, Density.Zero); - Assertion(Duration.Info, Duration.Zero); - Assertion(DynamicViscosity.Info, DynamicViscosity.Zero); - Assertion(ElectricAdmittance.Info, ElectricAdmittance.Zero); - Assertion(ElectricCharge.Info, ElectricCharge.Zero); - Assertion(ElectricChargeDensity.Info, ElectricChargeDensity.Zero); - Assertion(ElectricConductance.Info, ElectricConductance.Zero); - Assertion(ElectricConductivity.Info, ElectricConductivity.Zero); - Assertion(ElectricCurrent.Info, ElectricCurrent.Zero); - Assertion(ElectricCurrentDensity.Info, ElectricCurrentDensity.Zero); - Assertion(ElectricCurrentGradient.Info, ElectricCurrentGradient.Zero); - Assertion(ElectricField.Info, ElectricField.Zero); - Assertion(ElectricInductance.Info, ElectricInductance.Zero); - Assertion(ElectricPotential.Info, ElectricPotential.Zero); - Assertion(ElectricPotentialAc.Info, ElectricPotentialAc.Zero); - Assertion(ElectricPotentialDc.Info, ElectricPotentialDc.Zero); - Assertion(ElectricResistance.Info, ElectricResistance.Zero); - Assertion(ElectricResistivity.Info, ElectricResistivity.Zero); - Assertion(ElectricSurfaceChargeDensity.Info, ElectricSurfaceChargeDensity.Zero); - Assertion(Energy.Info, Energy.Zero); - Assertion(Entropy.Info, Entropy.Zero); - Assertion(Force.Info, Force.Zero); - Assertion(ForceChangeRate.Info, ForceChangeRate.Zero); - Assertion(ForcePerLength.Info, ForcePerLength.Zero); - Assertion(Frequency.Info, Frequency.Zero); - Assertion(FuelEfficiency.Info, FuelEfficiency.Zero); - Assertion(HeatFlux.Info, HeatFlux.Zero); - Assertion(HeatTransferCoefficient.Info, HeatTransferCoefficient.Zero); - Assertion(Illuminance.Info, Illuminance.Zero); - Assertion(Information.Info, Information.Zero); - Assertion(Irradiance.Info, Irradiance.Zero); - Assertion(Irradiation.Info, Irradiation.Zero); - Assertion(KinematicViscosity.Info, KinematicViscosity.Zero); - Assertion(LapseRate.Info, LapseRate.Zero); - Assertion(Length.Info, Length.Zero); - Assertion(Level.Info, Level.Zero); - Assertion(LinearDensity.Info, LinearDensity.Zero); - Assertion(Luminosity.Info, Luminosity.Zero); - Assertion(LuminousFlux.Info, LuminousFlux.Zero); - Assertion(LuminousIntensity.Info, LuminousIntensity.Zero); - Assertion(MagneticField.Info, MagneticField.Zero); - Assertion(MagneticFlux.Info, MagneticFlux.Zero); - Assertion(Magnetization.Info, Magnetization.Zero); - Assertion(Mass.Info, Mass.Zero); - Assertion(MassConcentration.Info, MassConcentration.Zero); - Assertion(MassFlow.Info, MassFlow.Zero); - Assertion(MassFlux.Info, MassFlux.Zero); - Assertion(MassFraction.Info, MassFraction.Zero); - Assertion(MassMomentOfInertia.Info, MassMomentOfInertia.Zero); - Assertion(MolarEnergy.Info, MolarEnergy.Zero); - Assertion(MolarEntropy.Info, MolarEntropy.Zero); - Assertion(Molarity.Info, Molarity.Zero); - Assertion(MolarMass.Info, MolarMass.Zero); - Assertion(Permeability.Info, Permeability.Zero); - Assertion(Permittivity.Info, Permittivity.Zero); - Assertion(Power.Info, Power.Zero); - Assertion(PowerDensity.Info, PowerDensity.Zero); - Assertion(PowerRatio.Info, PowerRatio.Zero); - Assertion(Pressure.Info, Pressure.Zero); - Assertion(PressureChangeRate.Info, PressureChangeRate.Zero); - Assertion(Ratio.Info, Ratio.Zero); - Assertion(RatioChangeRate.Info, RatioChangeRate.Zero); - Assertion(ReactiveEnergy.Info, ReactiveEnergy.Zero); - Assertion(ReactivePower.Info, ReactivePower.Zero); - Assertion(RotationalAcceleration.Info, RotationalAcceleration.Zero); - Assertion(RotationalSpeed.Info, RotationalSpeed.Zero); - Assertion(RotationalStiffness.Info, RotationalStiffness.Zero); - Assertion(RotationalStiffnessPerLength.Info, RotationalStiffnessPerLength.Zero); - Assertion(SolidAngle.Info, SolidAngle.Zero); - Assertion(SpecificEnergy.Info, SpecificEnergy.Zero); - Assertion(SpecificEntropy.Info, SpecificEntropy.Zero); - Assertion(SpecificVolume.Info, SpecificVolume.Zero); - Assertion(SpecificWeight.Info, SpecificWeight.Zero); - Assertion(Speed.Info, Speed.Zero); - Assertion(Temperature.Info, Temperature.Zero); - Assertion(TemperatureChangeRate.Info, TemperatureChangeRate.Zero); - Assertion(TemperatureDelta.Info, TemperatureDelta.Zero); - Assertion(ThermalConductivity.Info, ThermalConductivity.Zero); - Assertion(ThermalResistance.Info, ThermalResistance.Zero); - Assertion(Torque.Info, Torque.Zero); - Assertion(VitaminA.Info, VitaminA.Zero); - Assertion(Volume.Info, Volume.Zero); - Assertion(VolumeConcentration.Info, VolumeConcentration.Zero); - Assertion(VolumeFlow.Info, VolumeFlow.Zero); - Assertion(VolumePerLength.Info, VolumePerLength.Zero); + Assertion(Acceleration.Info, Acceleration.Zero); + Assertion(AmountOfSubstance.Info, AmountOfSubstance.Zero); + Assertion(AmplitudeRatio.Info, AmplitudeRatio.Zero); + Assertion(Angle.Info, Angle.Zero); + Assertion(ApparentEnergy.Info, ApparentEnergy.Zero); + Assertion(ApparentPower.Info, ApparentPower.Zero); + Assertion(Area.Info, Area.Zero); + Assertion(AreaDensity.Info, AreaDensity.Zero); + Assertion(AreaMomentOfInertia.Info, AreaMomentOfInertia.Zero); + Assertion(BitRate.Info, BitRate.Zero); + Assertion(BrakeSpecificFuelConsumption.Info, BrakeSpecificFuelConsumption.Zero); + Assertion(Capacitance.Info, Capacitance.Zero); + Assertion(CoefficientOfThermalExpansion.Info, CoefficientOfThermalExpansion.Zero); + Assertion(Density.Info, Density.Zero); + Assertion(Duration.Info, Duration.Zero); + Assertion(DynamicViscosity.Info, DynamicViscosity.Zero); + Assertion(ElectricAdmittance.Info, ElectricAdmittance.Zero); + Assertion(ElectricCharge.Info, ElectricCharge.Zero); + Assertion(ElectricChargeDensity.Info, ElectricChargeDensity.Zero); + Assertion(ElectricConductance.Info, ElectricConductance.Zero); + Assertion(ElectricConductivity.Info, ElectricConductivity.Zero); + Assertion(ElectricCurrent.Info, ElectricCurrent.Zero); + Assertion(ElectricCurrentDensity.Info, ElectricCurrentDensity.Zero); + Assertion(ElectricCurrentGradient.Info, ElectricCurrentGradient.Zero); + Assertion(ElectricField.Info, ElectricField.Zero); + Assertion(ElectricInductance.Info, ElectricInductance.Zero); + Assertion(ElectricPotential.Info, ElectricPotential.Zero); + Assertion(ElectricPotentialAc.Info, ElectricPotentialAc.Zero); + Assertion(ElectricPotentialDc.Info, ElectricPotentialDc.Zero); + Assertion(ElectricResistance.Info, ElectricResistance.Zero); + Assertion(ElectricResistivity.Info, ElectricResistivity.Zero); + Assertion(ElectricSurfaceChargeDensity.Info, ElectricSurfaceChargeDensity.Zero); + Assertion(Energy.Info, Energy.Zero); + Assertion(Entropy.Info, Entropy.Zero); + Assertion(Force.Info, Force.Zero); + Assertion(ForceChangeRate.Info, ForceChangeRate.Zero); + Assertion(ForcePerLength.Info, ForcePerLength.Zero); + Assertion(Frequency.Info, Frequency.Zero); + Assertion(FuelEfficiency.Info, FuelEfficiency.Zero); + Assertion(HeatFlux.Info, HeatFlux.Zero); + Assertion(HeatTransferCoefficient.Info, HeatTransferCoefficient.Zero); + Assertion(Illuminance.Info, Illuminance.Zero); + Assertion(Information.Info, Information.Zero); + Assertion(Irradiance.Info, Irradiance.Zero); + Assertion(Irradiation.Info, Irradiation.Zero); + Assertion(KinematicViscosity.Info, KinematicViscosity.Zero); + Assertion(LapseRate.Info, LapseRate.Zero); + Assertion(Length.Info, Length.Zero); + Assertion(Level.Info, Level.Zero); + Assertion(LinearDensity.Info, LinearDensity.Zero); + Assertion(Luminosity.Info, Luminosity.Zero); + Assertion(LuminousFlux.Info, LuminousFlux.Zero); + Assertion(LuminousIntensity.Info, LuminousIntensity.Zero); + Assertion(MagneticField.Info, MagneticField.Zero); + Assertion(MagneticFlux.Info, MagneticFlux.Zero); + Assertion(Magnetization.Info, Magnetization.Zero); + Assertion(Mass.Info, Mass.Zero); + Assertion(MassConcentration.Info, MassConcentration.Zero); + Assertion(MassFlow.Info, MassFlow.Zero); + Assertion(MassFlux.Info, MassFlux.Zero); + Assertion(MassFraction.Info, MassFraction.Zero); + Assertion(MassMomentOfInertia.Info, MassMomentOfInertia.Zero); + Assertion(MolarEnergy.Info, MolarEnergy.Zero); + Assertion(MolarEntropy.Info, MolarEntropy.Zero); + Assertion(Molarity.Info, Molarity.Zero); + Assertion(MolarMass.Info, MolarMass.Zero); + Assertion(Permeability.Info, Permeability.Zero); + Assertion(Permittivity.Info, Permittivity.Zero); + Assertion(Power.Info, Power.Zero); + Assertion(PowerDensity.Info, PowerDensity.Zero); + Assertion(PowerRatio.Info, PowerRatio.Zero); + Assertion(Pressure.Info, Pressure.Zero); + Assertion(PressureChangeRate.Info, PressureChangeRate.Zero); + Assertion(Ratio.Info, Ratio.Zero); + Assertion(RatioChangeRate.Info, RatioChangeRate.Zero); + Assertion(ReactiveEnergy.Info, ReactiveEnergy.Zero); + Assertion(ReactivePower.Info, ReactivePower.Zero); + Assertion(RotationalAcceleration.Info, RotationalAcceleration.Zero); + Assertion(RotationalSpeed.Info, RotationalSpeed.Zero); + Assertion(RotationalStiffness.Info, RotationalStiffness.Zero); + Assertion(RotationalStiffnessPerLength.Info, RotationalStiffnessPerLength.Zero); + Assertion(SolidAngle.Info, SolidAngle.Zero); + Assertion(SpecificEnergy.Info, SpecificEnergy.Zero); + Assertion(SpecificEntropy.Info, SpecificEntropy.Zero); + Assertion(SpecificVolume.Info, SpecificVolume.Zero); + Assertion(SpecificWeight.Info, SpecificWeight.Zero); + Assertion(Speed.Info, Speed.Zero); + Assertion(Temperature.Info, Temperature.Zero); + Assertion(TemperatureChangeRate.Info, TemperatureChangeRate.Zero); + Assertion(TemperatureDelta.Info, TemperatureDelta.Zero); + Assertion(ThermalConductivity.Info, ThermalConductivity.Zero); + Assertion(ThermalResistance.Info, ThermalResistance.Zero); + Assertion(Torque.Info, Torque.Zero); + Assertion(VitaminA.Info, VitaminA.Zero); + Assertion(Volume.Info, Volume.Zero); + Assertion(VolumeConcentration.Info, VolumeConcentration.Zero); + Assertion(VolumeFlow.Info, VolumeFlow.Zero); + Assertion(VolumePerLength.Info, VolumePerLength.Zero); } [Fact] @@ -244,104 +244,104 @@ public void Type_EqualsStaticQuantityTypeProperty() { void Assertion(QuantityType expected, IQuantity quantity) => Assert.Equal(expected, quantity.Type); - Assertion(Acceleration.QuantityType, Acceleration.Zero); - Assertion(AmountOfSubstance.QuantityType, AmountOfSubstance.Zero); - Assertion(AmplitudeRatio.QuantityType, AmplitudeRatio.Zero); - Assertion(Angle.QuantityType, Angle.Zero); - Assertion(ApparentEnergy.QuantityType, ApparentEnergy.Zero); - Assertion(ApparentPower.QuantityType, ApparentPower.Zero); - Assertion(Area.QuantityType, Area.Zero); - Assertion(AreaDensity.QuantityType, AreaDensity.Zero); - Assertion(AreaMomentOfInertia.QuantityType, AreaMomentOfInertia.Zero); - Assertion(BitRate.QuantityType, BitRate.Zero); - Assertion(BrakeSpecificFuelConsumption.QuantityType, BrakeSpecificFuelConsumption.Zero); - Assertion(Capacitance.QuantityType, Capacitance.Zero); - Assertion(CoefficientOfThermalExpansion.QuantityType, CoefficientOfThermalExpansion.Zero); - Assertion(Density.QuantityType, Density.Zero); - Assertion(Duration.QuantityType, Duration.Zero); - Assertion(DynamicViscosity.QuantityType, DynamicViscosity.Zero); - Assertion(ElectricAdmittance.QuantityType, ElectricAdmittance.Zero); - Assertion(ElectricCharge.QuantityType, ElectricCharge.Zero); - Assertion(ElectricChargeDensity.QuantityType, ElectricChargeDensity.Zero); - Assertion(ElectricConductance.QuantityType, ElectricConductance.Zero); - Assertion(ElectricConductivity.QuantityType, ElectricConductivity.Zero); - Assertion(ElectricCurrent.QuantityType, ElectricCurrent.Zero); - Assertion(ElectricCurrentDensity.QuantityType, ElectricCurrentDensity.Zero); - Assertion(ElectricCurrentGradient.QuantityType, ElectricCurrentGradient.Zero); - Assertion(ElectricField.QuantityType, ElectricField.Zero); - Assertion(ElectricInductance.QuantityType, ElectricInductance.Zero); - Assertion(ElectricPotential.QuantityType, ElectricPotential.Zero); - Assertion(ElectricPotentialAc.QuantityType, ElectricPotentialAc.Zero); - Assertion(ElectricPotentialDc.QuantityType, ElectricPotentialDc.Zero); - Assertion(ElectricResistance.QuantityType, ElectricResistance.Zero); - Assertion(ElectricResistivity.QuantityType, ElectricResistivity.Zero); - Assertion(ElectricSurfaceChargeDensity.QuantityType, ElectricSurfaceChargeDensity.Zero); - Assertion(Energy.QuantityType, Energy.Zero); - Assertion(Entropy.QuantityType, Entropy.Zero); - Assertion(Force.QuantityType, Force.Zero); - Assertion(ForceChangeRate.QuantityType, ForceChangeRate.Zero); - Assertion(ForcePerLength.QuantityType, ForcePerLength.Zero); - Assertion(Frequency.QuantityType, Frequency.Zero); - Assertion(FuelEfficiency.QuantityType, FuelEfficiency.Zero); - Assertion(HeatFlux.QuantityType, HeatFlux.Zero); - Assertion(HeatTransferCoefficient.QuantityType, HeatTransferCoefficient.Zero); - Assertion(Illuminance.QuantityType, Illuminance.Zero); - Assertion(Information.QuantityType, Information.Zero); - Assertion(Irradiance.QuantityType, Irradiance.Zero); - Assertion(Irradiation.QuantityType, Irradiation.Zero); - Assertion(KinematicViscosity.QuantityType, KinematicViscosity.Zero); - Assertion(LapseRate.QuantityType, LapseRate.Zero); - Assertion(Length.QuantityType, Length.Zero); - Assertion(Level.QuantityType, Level.Zero); - Assertion(LinearDensity.QuantityType, LinearDensity.Zero); - Assertion(Luminosity.QuantityType, Luminosity.Zero); - Assertion(LuminousFlux.QuantityType, LuminousFlux.Zero); - Assertion(LuminousIntensity.QuantityType, LuminousIntensity.Zero); - Assertion(MagneticField.QuantityType, MagneticField.Zero); - Assertion(MagneticFlux.QuantityType, MagneticFlux.Zero); - Assertion(Magnetization.QuantityType, Magnetization.Zero); - Assertion(Mass.QuantityType, Mass.Zero); - Assertion(MassConcentration.QuantityType, MassConcentration.Zero); - Assertion(MassFlow.QuantityType, MassFlow.Zero); - Assertion(MassFlux.QuantityType, MassFlux.Zero); - Assertion(MassFraction.QuantityType, MassFraction.Zero); - Assertion(MassMomentOfInertia.QuantityType, MassMomentOfInertia.Zero); - Assertion(MolarEnergy.QuantityType, MolarEnergy.Zero); - Assertion(MolarEntropy.QuantityType, MolarEntropy.Zero); - Assertion(Molarity.QuantityType, Molarity.Zero); - Assertion(MolarMass.QuantityType, MolarMass.Zero); - Assertion(Permeability.QuantityType, Permeability.Zero); - Assertion(Permittivity.QuantityType, Permittivity.Zero); - Assertion(Power.QuantityType, Power.Zero); - Assertion(PowerDensity.QuantityType, PowerDensity.Zero); - Assertion(PowerRatio.QuantityType, PowerRatio.Zero); - Assertion(Pressure.QuantityType, Pressure.Zero); - Assertion(PressureChangeRate.QuantityType, PressureChangeRate.Zero); - Assertion(Ratio.QuantityType, Ratio.Zero); - Assertion(RatioChangeRate.QuantityType, RatioChangeRate.Zero); - Assertion(ReactiveEnergy.QuantityType, ReactiveEnergy.Zero); - Assertion(ReactivePower.QuantityType, ReactivePower.Zero); - Assertion(RotationalAcceleration.QuantityType, RotationalAcceleration.Zero); - Assertion(RotationalSpeed.QuantityType, RotationalSpeed.Zero); - Assertion(RotationalStiffness.QuantityType, RotationalStiffness.Zero); - Assertion(RotationalStiffnessPerLength.QuantityType, RotationalStiffnessPerLength.Zero); - Assertion(SolidAngle.QuantityType, SolidAngle.Zero); - Assertion(SpecificEnergy.QuantityType, SpecificEnergy.Zero); - Assertion(SpecificEntropy.QuantityType, SpecificEntropy.Zero); - Assertion(SpecificVolume.QuantityType, SpecificVolume.Zero); - Assertion(SpecificWeight.QuantityType, SpecificWeight.Zero); - Assertion(Speed.QuantityType, Speed.Zero); - Assertion(Temperature.QuantityType, Temperature.Zero); - Assertion(TemperatureChangeRate.QuantityType, TemperatureChangeRate.Zero); - Assertion(TemperatureDelta.QuantityType, TemperatureDelta.Zero); - Assertion(ThermalConductivity.QuantityType, ThermalConductivity.Zero); - Assertion(ThermalResistance.QuantityType, ThermalResistance.Zero); - Assertion(Torque.QuantityType, Torque.Zero); - Assertion(VitaminA.QuantityType, VitaminA.Zero); - Assertion(Volume.QuantityType, Volume.Zero); - Assertion(VolumeConcentration.QuantityType, VolumeConcentration.Zero); - Assertion(VolumeFlow.QuantityType, VolumeFlow.Zero); - Assertion(VolumePerLength.QuantityType, VolumePerLength.Zero); + Assertion(Acceleration.QuantityType, Acceleration.Zero); + Assertion(AmountOfSubstance.QuantityType, AmountOfSubstance.Zero); + Assertion(AmplitudeRatio.QuantityType, AmplitudeRatio.Zero); + Assertion(Angle.QuantityType, Angle.Zero); + Assertion(ApparentEnergy.QuantityType, ApparentEnergy.Zero); + Assertion(ApparentPower.QuantityType, ApparentPower.Zero); + Assertion(Area.QuantityType, Area.Zero); + Assertion(AreaDensity.QuantityType, AreaDensity.Zero); + Assertion(AreaMomentOfInertia.QuantityType, AreaMomentOfInertia.Zero); + Assertion(BitRate.QuantityType, BitRate.Zero); + Assertion(BrakeSpecificFuelConsumption.QuantityType, BrakeSpecificFuelConsumption.Zero); + Assertion(Capacitance.QuantityType, Capacitance.Zero); + Assertion(CoefficientOfThermalExpansion.QuantityType, CoefficientOfThermalExpansion.Zero); + Assertion(Density.QuantityType, Density.Zero); + Assertion(Duration.QuantityType, Duration.Zero); + Assertion(DynamicViscosity.QuantityType, DynamicViscosity.Zero); + Assertion(ElectricAdmittance.QuantityType, ElectricAdmittance.Zero); + Assertion(ElectricCharge.QuantityType, ElectricCharge.Zero); + Assertion(ElectricChargeDensity.QuantityType, ElectricChargeDensity.Zero); + Assertion(ElectricConductance.QuantityType, ElectricConductance.Zero); + Assertion(ElectricConductivity.QuantityType, ElectricConductivity.Zero); + Assertion(ElectricCurrent.QuantityType, ElectricCurrent.Zero); + Assertion(ElectricCurrentDensity.QuantityType, ElectricCurrentDensity.Zero); + Assertion(ElectricCurrentGradient.QuantityType, ElectricCurrentGradient.Zero); + Assertion(ElectricField.QuantityType, ElectricField.Zero); + Assertion(ElectricInductance.QuantityType, ElectricInductance.Zero); + Assertion(ElectricPotential.QuantityType, ElectricPotential.Zero); + Assertion(ElectricPotentialAc.QuantityType, ElectricPotentialAc.Zero); + Assertion(ElectricPotentialDc.QuantityType, ElectricPotentialDc.Zero); + Assertion(ElectricResistance.QuantityType, ElectricResistance.Zero); + Assertion(ElectricResistivity.QuantityType, ElectricResistivity.Zero); + Assertion(ElectricSurfaceChargeDensity.QuantityType, ElectricSurfaceChargeDensity.Zero); + Assertion(Energy.QuantityType, Energy.Zero); + Assertion(Entropy.QuantityType, Entropy.Zero); + Assertion(Force.QuantityType, Force.Zero); + Assertion(ForceChangeRate.QuantityType, ForceChangeRate.Zero); + Assertion(ForcePerLength.QuantityType, ForcePerLength.Zero); + Assertion(Frequency.QuantityType, Frequency.Zero); + Assertion(FuelEfficiency.QuantityType, FuelEfficiency.Zero); + Assertion(HeatFlux.QuantityType, HeatFlux.Zero); + Assertion(HeatTransferCoefficient.QuantityType, HeatTransferCoefficient.Zero); + Assertion(Illuminance.QuantityType, Illuminance.Zero); + Assertion(Information.QuantityType, Information.Zero); + Assertion(Irradiance.QuantityType, Irradiance.Zero); + Assertion(Irradiation.QuantityType, Irradiation.Zero); + Assertion(KinematicViscosity.QuantityType, KinematicViscosity.Zero); + Assertion(LapseRate.QuantityType, LapseRate.Zero); + Assertion(Length.QuantityType, Length.Zero); + Assertion(Level.QuantityType, Level.Zero); + Assertion(LinearDensity.QuantityType, LinearDensity.Zero); + Assertion(Luminosity.QuantityType, Luminosity.Zero); + Assertion(LuminousFlux.QuantityType, LuminousFlux.Zero); + Assertion(LuminousIntensity.QuantityType, LuminousIntensity.Zero); + Assertion(MagneticField.QuantityType, MagneticField.Zero); + Assertion(MagneticFlux.QuantityType, MagneticFlux.Zero); + Assertion(Magnetization.QuantityType, Magnetization.Zero); + Assertion(Mass.QuantityType, Mass.Zero); + Assertion(MassConcentration.QuantityType, MassConcentration.Zero); + Assertion(MassFlow.QuantityType, MassFlow.Zero); + Assertion(MassFlux.QuantityType, MassFlux.Zero); + Assertion(MassFraction.QuantityType, MassFraction.Zero); + Assertion(MassMomentOfInertia.QuantityType, MassMomentOfInertia.Zero); + Assertion(MolarEnergy.QuantityType, MolarEnergy.Zero); + Assertion(MolarEntropy.QuantityType, MolarEntropy.Zero); + Assertion(Molarity.QuantityType, Molarity.Zero); + Assertion(MolarMass.QuantityType, MolarMass.Zero); + Assertion(Permeability.QuantityType, Permeability.Zero); + Assertion(Permittivity.QuantityType, Permittivity.Zero); + Assertion(Power.QuantityType, Power.Zero); + Assertion(PowerDensity.QuantityType, PowerDensity.Zero); + Assertion(PowerRatio.QuantityType, PowerRatio.Zero); + Assertion(Pressure.QuantityType, Pressure.Zero); + Assertion(PressureChangeRate.QuantityType, PressureChangeRate.Zero); + Assertion(Ratio.QuantityType, Ratio.Zero); + Assertion(RatioChangeRate.QuantityType, RatioChangeRate.Zero); + Assertion(ReactiveEnergy.QuantityType, ReactiveEnergy.Zero); + Assertion(ReactivePower.QuantityType, ReactivePower.Zero); + Assertion(RotationalAcceleration.QuantityType, RotationalAcceleration.Zero); + Assertion(RotationalSpeed.QuantityType, RotationalSpeed.Zero); + Assertion(RotationalStiffness.QuantityType, RotationalStiffness.Zero); + Assertion(RotationalStiffnessPerLength.QuantityType, RotationalStiffnessPerLength.Zero); + Assertion(SolidAngle.QuantityType, SolidAngle.Zero); + Assertion(SpecificEnergy.QuantityType, SpecificEnergy.Zero); + Assertion(SpecificEntropy.QuantityType, SpecificEntropy.Zero); + Assertion(SpecificVolume.QuantityType, SpecificVolume.Zero); + Assertion(SpecificWeight.QuantityType, SpecificWeight.Zero); + Assertion(Speed.QuantityType, Speed.Zero); + Assertion(Temperature.QuantityType, Temperature.Zero); + Assertion(TemperatureChangeRate.QuantityType, TemperatureChangeRate.Zero); + Assertion(TemperatureDelta.QuantityType, TemperatureDelta.Zero); + Assertion(ThermalConductivity.QuantityType, ThermalConductivity.Zero); + Assertion(ThermalResistance.QuantityType, ThermalResistance.Zero); + Assertion(Torque.QuantityType, Torque.Zero); + Assertion(VitaminA.QuantityType, VitaminA.Zero); + Assertion(Volume.QuantityType, Volume.Zero); + Assertion(VolumeConcentration.QuantityType, VolumeConcentration.Zero); + Assertion(VolumeFlow.QuantityType, VolumeFlow.Zero); + Assertion(VolumePerLength.QuantityType, VolumePerLength.Zero); } [Fact] @@ -349,104 +349,104 @@ public void Dimensions_IsSameAsStaticBaseDimensions() { void Assertion(BaseDimensions expected, IQuantity quantity) => Assert.Equal(expected, quantity.Dimensions); - Assertion(Acceleration.BaseDimensions, Acceleration.Zero); - Assertion(AmountOfSubstance.BaseDimensions, AmountOfSubstance.Zero); - Assertion(AmplitudeRatio.BaseDimensions, AmplitudeRatio.Zero); - Assertion(Angle.BaseDimensions, Angle.Zero); - Assertion(ApparentEnergy.BaseDimensions, ApparentEnergy.Zero); - Assertion(ApparentPower.BaseDimensions, ApparentPower.Zero); - Assertion(Area.BaseDimensions, Area.Zero); - Assertion(AreaDensity.BaseDimensions, AreaDensity.Zero); - Assertion(AreaMomentOfInertia.BaseDimensions, AreaMomentOfInertia.Zero); - Assertion(BitRate.BaseDimensions, BitRate.Zero); - Assertion(BrakeSpecificFuelConsumption.BaseDimensions, BrakeSpecificFuelConsumption.Zero); - Assertion(Capacitance.BaseDimensions, Capacitance.Zero); - Assertion(CoefficientOfThermalExpansion.BaseDimensions, CoefficientOfThermalExpansion.Zero); - Assertion(Density.BaseDimensions, Density.Zero); - Assertion(Duration.BaseDimensions, Duration.Zero); - Assertion(DynamicViscosity.BaseDimensions, DynamicViscosity.Zero); - Assertion(ElectricAdmittance.BaseDimensions, ElectricAdmittance.Zero); - Assertion(ElectricCharge.BaseDimensions, ElectricCharge.Zero); - Assertion(ElectricChargeDensity.BaseDimensions, ElectricChargeDensity.Zero); - Assertion(ElectricConductance.BaseDimensions, ElectricConductance.Zero); - Assertion(ElectricConductivity.BaseDimensions, ElectricConductivity.Zero); - Assertion(ElectricCurrent.BaseDimensions, ElectricCurrent.Zero); - Assertion(ElectricCurrentDensity.BaseDimensions, ElectricCurrentDensity.Zero); - Assertion(ElectricCurrentGradient.BaseDimensions, ElectricCurrentGradient.Zero); - Assertion(ElectricField.BaseDimensions, ElectricField.Zero); - Assertion(ElectricInductance.BaseDimensions, ElectricInductance.Zero); - Assertion(ElectricPotential.BaseDimensions, ElectricPotential.Zero); - Assertion(ElectricPotentialAc.BaseDimensions, ElectricPotentialAc.Zero); - Assertion(ElectricPotentialDc.BaseDimensions, ElectricPotentialDc.Zero); - Assertion(ElectricResistance.BaseDimensions, ElectricResistance.Zero); - Assertion(ElectricResistivity.BaseDimensions, ElectricResistivity.Zero); - Assertion(ElectricSurfaceChargeDensity.BaseDimensions, ElectricSurfaceChargeDensity.Zero); - Assertion(Energy.BaseDimensions, Energy.Zero); - Assertion(Entropy.BaseDimensions, Entropy.Zero); - Assertion(Force.BaseDimensions, Force.Zero); - Assertion(ForceChangeRate.BaseDimensions, ForceChangeRate.Zero); - Assertion(ForcePerLength.BaseDimensions, ForcePerLength.Zero); - Assertion(Frequency.BaseDimensions, Frequency.Zero); - Assertion(FuelEfficiency.BaseDimensions, FuelEfficiency.Zero); - Assertion(HeatFlux.BaseDimensions, HeatFlux.Zero); - Assertion(HeatTransferCoefficient.BaseDimensions, HeatTransferCoefficient.Zero); - Assertion(Illuminance.BaseDimensions, Illuminance.Zero); - Assertion(Information.BaseDimensions, Information.Zero); - Assertion(Irradiance.BaseDimensions, Irradiance.Zero); - Assertion(Irradiation.BaseDimensions, Irradiation.Zero); - Assertion(KinematicViscosity.BaseDimensions, KinematicViscosity.Zero); - Assertion(LapseRate.BaseDimensions, LapseRate.Zero); - Assertion(Length.BaseDimensions, Length.Zero); - Assertion(Level.BaseDimensions, Level.Zero); - Assertion(LinearDensity.BaseDimensions, LinearDensity.Zero); - Assertion(Luminosity.BaseDimensions, Luminosity.Zero); - Assertion(LuminousFlux.BaseDimensions, LuminousFlux.Zero); - Assertion(LuminousIntensity.BaseDimensions, LuminousIntensity.Zero); - Assertion(MagneticField.BaseDimensions, MagneticField.Zero); - Assertion(MagneticFlux.BaseDimensions, MagneticFlux.Zero); - Assertion(Magnetization.BaseDimensions, Magnetization.Zero); - Assertion(Mass.BaseDimensions, Mass.Zero); - Assertion(MassConcentration.BaseDimensions, MassConcentration.Zero); - Assertion(MassFlow.BaseDimensions, MassFlow.Zero); - Assertion(MassFlux.BaseDimensions, MassFlux.Zero); - Assertion(MassFraction.BaseDimensions, MassFraction.Zero); - Assertion(MassMomentOfInertia.BaseDimensions, MassMomentOfInertia.Zero); - Assertion(MolarEnergy.BaseDimensions, MolarEnergy.Zero); - Assertion(MolarEntropy.BaseDimensions, MolarEntropy.Zero); - Assertion(Molarity.BaseDimensions, Molarity.Zero); - Assertion(MolarMass.BaseDimensions, MolarMass.Zero); - Assertion(Permeability.BaseDimensions, Permeability.Zero); - Assertion(Permittivity.BaseDimensions, Permittivity.Zero); - Assertion(Power.BaseDimensions, Power.Zero); - Assertion(PowerDensity.BaseDimensions, PowerDensity.Zero); - Assertion(PowerRatio.BaseDimensions, PowerRatio.Zero); - Assertion(Pressure.BaseDimensions, Pressure.Zero); - Assertion(PressureChangeRate.BaseDimensions, PressureChangeRate.Zero); - Assertion(Ratio.BaseDimensions, Ratio.Zero); - Assertion(RatioChangeRate.BaseDimensions, RatioChangeRate.Zero); - Assertion(ReactiveEnergy.BaseDimensions, ReactiveEnergy.Zero); - Assertion(ReactivePower.BaseDimensions, ReactivePower.Zero); - Assertion(RotationalAcceleration.BaseDimensions, RotationalAcceleration.Zero); - Assertion(RotationalSpeed.BaseDimensions, RotationalSpeed.Zero); - Assertion(RotationalStiffness.BaseDimensions, RotationalStiffness.Zero); - Assertion(RotationalStiffnessPerLength.BaseDimensions, RotationalStiffnessPerLength.Zero); - Assertion(SolidAngle.BaseDimensions, SolidAngle.Zero); - Assertion(SpecificEnergy.BaseDimensions, SpecificEnergy.Zero); - Assertion(SpecificEntropy.BaseDimensions, SpecificEntropy.Zero); - Assertion(SpecificVolume.BaseDimensions, SpecificVolume.Zero); - Assertion(SpecificWeight.BaseDimensions, SpecificWeight.Zero); - Assertion(Speed.BaseDimensions, Speed.Zero); - Assertion(Temperature.BaseDimensions, Temperature.Zero); - Assertion(TemperatureChangeRate.BaseDimensions, TemperatureChangeRate.Zero); - Assertion(TemperatureDelta.BaseDimensions, TemperatureDelta.Zero); - Assertion(ThermalConductivity.BaseDimensions, ThermalConductivity.Zero); - Assertion(ThermalResistance.BaseDimensions, ThermalResistance.Zero); - Assertion(Torque.BaseDimensions, Torque.Zero); - Assertion(VitaminA.BaseDimensions, VitaminA.Zero); - Assertion(Volume.BaseDimensions, Volume.Zero); - Assertion(VolumeConcentration.BaseDimensions, VolumeConcentration.Zero); - Assertion(VolumeFlow.BaseDimensions, VolumeFlow.Zero); - Assertion(VolumePerLength.BaseDimensions, VolumePerLength.Zero); + Assertion(Acceleration.BaseDimensions, Acceleration.Zero); + Assertion(AmountOfSubstance.BaseDimensions, AmountOfSubstance.Zero); + Assertion(AmplitudeRatio.BaseDimensions, AmplitudeRatio.Zero); + Assertion(Angle.BaseDimensions, Angle.Zero); + Assertion(ApparentEnergy.BaseDimensions, ApparentEnergy.Zero); + Assertion(ApparentPower.BaseDimensions, ApparentPower.Zero); + Assertion(Area.BaseDimensions, Area.Zero); + Assertion(AreaDensity.BaseDimensions, AreaDensity.Zero); + Assertion(AreaMomentOfInertia.BaseDimensions, AreaMomentOfInertia.Zero); + Assertion(BitRate.BaseDimensions, BitRate.Zero); + Assertion(BrakeSpecificFuelConsumption.BaseDimensions, BrakeSpecificFuelConsumption.Zero); + Assertion(Capacitance.BaseDimensions, Capacitance.Zero); + Assertion(CoefficientOfThermalExpansion.BaseDimensions, CoefficientOfThermalExpansion.Zero); + Assertion(Density.BaseDimensions, Density.Zero); + Assertion(Duration.BaseDimensions, Duration.Zero); + Assertion(DynamicViscosity.BaseDimensions, DynamicViscosity.Zero); + Assertion(ElectricAdmittance.BaseDimensions, ElectricAdmittance.Zero); + Assertion(ElectricCharge.BaseDimensions, ElectricCharge.Zero); + Assertion(ElectricChargeDensity.BaseDimensions, ElectricChargeDensity.Zero); + Assertion(ElectricConductance.BaseDimensions, ElectricConductance.Zero); + Assertion(ElectricConductivity.BaseDimensions, ElectricConductivity.Zero); + Assertion(ElectricCurrent.BaseDimensions, ElectricCurrent.Zero); + Assertion(ElectricCurrentDensity.BaseDimensions, ElectricCurrentDensity.Zero); + Assertion(ElectricCurrentGradient.BaseDimensions, ElectricCurrentGradient.Zero); + Assertion(ElectricField.BaseDimensions, ElectricField.Zero); + Assertion(ElectricInductance.BaseDimensions, ElectricInductance.Zero); + Assertion(ElectricPotential.BaseDimensions, ElectricPotential.Zero); + Assertion(ElectricPotentialAc.BaseDimensions, ElectricPotentialAc.Zero); + Assertion(ElectricPotentialDc.BaseDimensions, ElectricPotentialDc.Zero); + Assertion(ElectricResistance.BaseDimensions, ElectricResistance.Zero); + Assertion(ElectricResistivity.BaseDimensions, ElectricResistivity.Zero); + Assertion(ElectricSurfaceChargeDensity.BaseDimensions, ElectricSurfaceChargeDensity.Zero); + Assertion(Energy.BaseDimensions, Energy.Zero); + Assertion(Entropy.BaseDimensions, Entropy.Zero); + Assertion(Force.BaseDimensions, Force.Zero); + Assertion(ForceChangeRate.BaseDimensions, ForceChangeRate.Zero); + Assertion(ForcePerLength.BaseDimensions, ForcePerLength.Zero); + Assertion(Frequency.BaseDimensions, Frequency.Zero); + Assertion(FuelEfficiency.BaseDimensions, FuelEfficiency.Zero); + Assertion(HeatFlux.BaseDimensions, HeatFlux.Zero); + Assertion(HeatTransferCoefficient.BaseDimensions, HeatTransferCoefficient.Zero); + Assertion(Illuminance.BaseDimensions, Illuminance.Zero); + Assertion(Information.BaseDimensions, Information.Zero); + Assertion(Irradiance.BaseDimensions, Irradiance.Zero); + Assertion(Irradiation.BaseDimensions, Irradiation.Zero); + Assertion(KinematicViscosity.BaseDimensions, KinematicViscosity.Zero); + Assertion(LapseRate.BaseDimensions, LapseRate.Zero); + Assertion(Length.BaseDimensions, Length.Zero); + Assertion(Level.BaseDimensions, Level.Zero); + Assertion(LinearDensity.BaseDimensions, LinearDensity.Zero); + Assertion(Luminosity.BaseDimensions, Luminosity.Zero); + Assertion(LuminousFlux.BaseDimensions, LuminousFlux.Zero); + Assertion(LuminousIntensity.BaseDimensions, LuminousIntensity.Zero); + Assertion(MagneticField.BaseDimensions, MagneticField.Zero); + Assertion(MagneticFlux.BaseDimensions, MagneticFlux.Zero); + Assertion(Magnetization.BaseDimensions, Magnetization.Zero); + Assertion(Mass.BaseDimensions, Mass.Zero); + Assertion(MassConcentration.BaseDimensions, MassConcentration.Zero); + Assertion(MassFlow.BaseDimensions, MassFlow.Zero); + Assertion(MassFlux.BaseDimensions, MassFlux.Zero); + Assertion(MassFraction.BaseDimensions, MassFraction.Zero); + Assertion(MassMomentOfInertia.BaseDimensions, MassMomentOfInertia.Zero); + Assertion(MolarEnergy.BaseDimensions, MolarEnergy.Zero); + Assertion(MolarEntropy.BaseDimensions, MolarEntropy.Zero); + Assertion(Molarity.BaseDimensions, Molarity.Zero); + Assertion(MolarMass.BaseDimensions, MolarMass.Zero); + Assertion(Permeability.BaseDimensions, Permeability.Zero); + Assertion(Permittivity.BaseDimensions, Permittivity.Zero); + Assertion(Power.BaseDimensions, Power.Zero); + Assertion(PowerDensity.BaseDimensions, PowerDensity.Zero); + Assertion(PowerRatio.BaseDimensions, PowerRatio.Zero); + Assertion(Pressure.BaseDimensions, Pressure.Zero); + Assertion(PressureChangeRate.BaseDimensions, PressureChangeRate.Zero); + Assertion(Ratio.BaseDimensions, Ratio.Zero); + Assertion(RatioChangeRate.BaseDimensions, RatioChangeRate.Zero); + Assertion(ReactiveEnergy.BaseDimensions, ReactiveEnergy.Zero); + Assertion(ReactivePower.BaseDimensions, ReactivePower.Zero); + Assertion(RotationalAcceleration.BaseDimensions, RotationalAcceleration.Zero); + Assertion(RotationalSpeed.BaseDimensions, RotationalSpeed.Zero); + Assertion(RotationalStiffness.BaseDimensions, RotationalStiffness.Zero); + Assertion(RotationalStiffnessPerLength.BaseDimensions, RotationalStiffnessPerLength.Zero); + Assertion(SolidAngle.BaseDimensions, SolidAngle.Zero); + Assertion(SpecificEnergy.BaseDimensions, SpecificEnergy.Zero); + Assertion(SpecificEntropy.BaseDimensions, SpecificEntropy.Zero); + Assertion(SpecificVolume.BaseDimensions, SpecificVolume.Zero); + Assertion(SpecificWeight.BaseDimensions, SpecificWeight.Zero); + Assertion(Speed.BaseDimensions, Speed.Zero); + Assertion(Temperature.BaseDimensions, Temperature.Zero); + Assertion(TemperatureChangeRate.BaseDimensions, TemperatureChangeRate.Zero); + Assertion(TemperatureDelta.BaseDimensions, TemperatureDelta.Zero); + Assertion(ThermalConductivity.BaseDimensions, ThermalConductivity.Zero); + Assertion(ThermalResistance.BaseDimensions, ThermalResistance.Zero); + Assertion(Torque.BaseDimensions, Torque.Zero); + Assertion(VitaminA.BaseDimensions, VitaminA.Zero); + Assertion(Volume.BaseDimensions, Volume.Zero); + Assertion(VolumeConcentration.BaseDimensions, VolumeConcentration.Zero); + Assertion(VolumeFlow.BaseDimensions, VolumeFlow.Zero); + Assertion(VolumePerLength.BaseDimensions, VolumePerLength.Zero); } } } diff --git a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs index 50bcdb5acf..f35ce71806 100644 --- a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs @@ -49,26 +49,26 @@ public abstract partial class IlluminanceTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Illuminance((double)0.0, IlluminanceUnit.Undefined)); + Assert.Throws(() => new Illuminance((double)0.0, IlluminanceUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Illuminance(double.PositiveInfinity, IlluminanceUnit.Lux)); - Assert.Throws(() => new Illuminance(double.NegativeInfinity, IlluminanceUnit.Lux)); + Assert.Throws(() => new Illuminance(double.PositiveInfinity, IlluminanceUnit.Lux)); + Assert.Throws(() => new Illuminance(double.NegativeInfinity, IlluminanceUnit.Lux)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Illuminance(double.NaN, IlluminanceUnit.Lux)); + Assert.Throws(() => new Illuminance(double.NaN, IlluminanceUnit.Lux)); } [Fact] public void LuxToIlluminanceUnits() { - Illuminance lux = Illuminance.FromLux(1); + Illuminance lux = Illuminance.FromLux(1); AssertEx.EqualTolerance(KiloluxInOneLux, lux.Kilolux, KiloluxTolerance); AssertEx.EqualTolerance(LuxInOneLux, lux.Lux, LuxTolerance); AssertEx.EqualTolerance(MegaluxInOneLux, lux.Megalux, MegaluxTolerance); @@ -78,29 +78,29 @@ public void LuxToIlluminanceUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Illuminance.From(1, IlluminanceUnit.Kilolux).Kilolux, KiloluxTolerance); - AssertEx.EqualTolerance(1, Illuminance.From(1, IlluminanceUnit.Lux).Lux, LuxTolerance); - AssertEx.EqualTolerance(1, Illuminance.From(1, IlluminanceUnit.Megalux).Megalux, MegaluxTolerance); - AssertEx.EqualTolerance(1, Illuminance.From(1, IlluminanceUnit.Millilux).Millilux, MilliluxTolerance); + AssertEx.EqualTolerance(1, Illuminance.From(1, IlluminanceUnit.Kilolux).Kilolux, KiloluxTolerance); + AssertEx.EqualTolerance(1, Illuminance.From(1, IlluminanceUnit.Lux).Lux, LuxTolerance); + AssertEx.EqualTolerance(1, Illuminance.From(1, IlluminanceUnit.Megalux).Megalux, MegaluxTolerance); + AssertEx.EqualTolerance(1, Illuminance.From(1, IlluminanceUnit.Millilux).Millilux, MilliluxTolerance); } [Fact] public void FromLux_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Illuminance.FromLux(double.PositiveInfinity)); - Assert.Throws(() => Illuminance.FromLux(double.NegativeInfinity)); + Assert.Throws(() => Illuminance.FromLux(double.PositiveInfinity)); + Assert.Throws(() => Illuminance.FromLux(double.NegativeInfinity)); } [Fact] public void FromLux_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Illuminance.FromLux(double.NaN)); + Assert.Throws(() => Illuminance.FromLux(double.NaN)); } [Fact] public void As() { - var lux = Illuminance.FromLux(1); + var lux = Illuminance.FromLux(1); AssertEx.EqualTolerance(KiloluxInOneLux, lux.As(IlluminanceUnit.Kilolux), KiloluxTolerance); AssertEx.EqualTolerance(LuxInOneLux, lux.As(IlluminanceUnit.Lux), LuxTolerance); AssertEx.EqualTolerance(MegaluxInOneLux, lux.As(IlluminanceUnit.Megalux), MegaluxTolerance); @@ -110,7 +110,7 @@ public void As() [Fact] public void ToUnit() { - var lux = Illuminance.FromLux(1); + var lux = Illuminance.FromLux(1); var kiloluxQuantity = lux.ToUnit(IlluminanceUnit.Kilolux); AssertEx.EqualTolerance(KiloluxInOneLux, (double)kiloluxQuantity.Value, KiloluxTolerance); @@ -132,31 +132,31 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Illuminance lux = Illuminance.FromLux(1); - AssertEx.EqualTolerance(1, Illuminance.FromKilolux(lux.Kilolux).Lux, KiloluxTolerance); - AssertEx.EqualTolerance(1, Illuminance.FromLux(lux.Lux).Lux, LuxTolerance); - AssertEx.EqualTolerance(1, Illuminance.FromMegalux(lux.Megalux).Lux, MegaluxTolerance); - AssertEx.EqualTolerance(1, Illuminance.FromMillilux(lux.Millilux).Lux, MilliluxTolerance); + Illuminance lux = Illuminance.FromLux(1); + AssertEx.EqualTolerance(1, Illuminance.FromKilolux(lux.Kilolux).Lux, KiloluxTolerance); + AssertEx.EqualTolerance(1, Illuminance.FromLux(lux.Lux).Lux, LuxTolerance); + AssertEx.EqualTolerance(1, Illuminance.FromMegalux(lux.Megalux).Lux, MegaluxTolerance); + AssertEx.EqualTolerance(1, Illuminance.FromMillilux(lux.Millilux).Lux, MilliluxTolerance); } [Fact] public void ArithmeticOperators() { - Illuminance v = Illuminance.FromLux(1); + Illuminance v = Illuminance.FromLux(1); AssertEx.EqualTolerance(-1, -v.Lux, LuxTolerance); - AssertEx.EqualTolerance(2, (Illuminance.FromLux(3)-v).Lux, LuxTolerance); + AssertEx.EqualTolerance(2, (Illuminance.FromLux(3)-v).Lux, LuxTolerance); AssertEx.EqualTolerance(2, (v + v).Lux, LuxTolerance); AssertEx.EqualTolerance(10, (v*10).Lux, LuxTolerance); AssertEx.EqualTolerance(10, (10*v).Lux, LuxTolerance); - AssertEx.EqualTolerance(2, (Illuminance.FromLux(10)/5).Lux, LuxTolerance); - AssertEx.EqualTolerance(2, Illuminance.FromLux(10)/Illuminance.FromLux(5), LuxTolerance); + AssertEx.EqualTolerance(2, (Illuminance.FromLux(10)/5).Lux, LuxTolerance); + AssertEx.EqualTolerance(2, Illuminance.FromLux(10)/Illuminance.FromLux(5), LuxTolerance); } [Fact] public void ComparisonOperators() { - Illuminance oneLux = Illuminance.FromLux(1); - Illuminance twoLux = Illuminance.FromLux(2); + Illuminance oneLux = Illuminance.FromLux(1); + Illuminance twoLux = Illuminance.FromLux(2); Assert.True(oneLux < twoLux); Assert.True(oneLux <= twoLux); @@ -172,31 +172,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Illuminance lux = Illuminance.FromLux(1); + Illuminance lux = Illuminance.FromLux(1); Assert.Equal(0, lux.CompareTo(lux)); - Assert.True(lux.CompareTo(Illuminance.Zero) > 0); - Assert.True(Illuminance.Zero.CompareTo(lux) < 0); + Assert.True(lux.CompareTo(Illuminance.Zero) > 0); + Assert.True(Illuminance.Zero.CompareTo(lux) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Illuminance lux = Illuminance.FromLux(1); + Illuminance lux = Illuminance.FromLux(1); Assert.Throws(() => lux.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Illuminance lux = Illuminance.FromLux(1); + Illuminance lux = Illuminance.FromLux(1); Assert.Throws(() => lux.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Illuminance.FromLux(1); - var b = Illuminance.FromLux(2); + var a = Illuminance.FromLux(1); + var b = Illuminance.FromLux(2); // ReSharper disable EqualExpressionComparison @@ -215,8 +215,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Illuminance.FromLux(1); - var b = Illuminance.FromLux(2); + var a = Illuminance.FromLux(1); + var b = Illuminance.FromLux(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -226,29 +226,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Illuminance.FromLux(1); - Assert.True(v.Equals(Illuminance.FromLux(1), LuxTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Illuminance.Zero, LuxTolerance, ComparisonType.Relative)); + var v = Illuminance.FromLux(1); + Assert.True(v.Equals(Illuminance.FromLux(1), LuxTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Illuminance.Zero, LuxTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Illuminance lux = Illuminance.FromLux(1); + Illuminance lux = Illuminance.FromLux(1); Assert.False(lux.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Illuminance lux = Illuminance.FromLux(1); + Illuminance lux = Illuminance.FromLux(1); Assert.False(lux.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(IlluminanceUnit.Undefined, Illuminance.Units); + Assert.DoesNotContain(IlluminanceUnit.Undefined, Illuminance.Units); } [Fact] @@ -267,7 +267,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Illuminance.BaseDimensions is null); + Assert.False(Illuminance.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs index 9d1d4a362f..d1b3f05ddd 100644 --- a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Information. + /// Test of Information. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class InformationTestsBase @@ -93,13 +93,13 @@ public abstract partial class InformationTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Information((decimal)0.0, InformationUnit.Undefined)); + Assert.Throws(() => new Information((decimal)0.0, InformationUnit.Undefined)); } [Fact] public void BitToInformationUnits() { - Information bit = Information.FromBits(1); + Information bit = Information.FromBits(1); AssertEx.EqualTolerance(BitsInOneBit, bit.Bits, BitsTolerance); AssertEx.EqualTolerance(BytesInOneBit, bit.Bytes, BytesTolerance); AssertEx.EqualTolerance(ExabitsInOneBit, bit.Exabits, ExabitsTolerance); @@ -131,38 +131,38 @@ public void BitToInformationUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Bit).Bits, BitsTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Byte).Bytes, BytesTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Exabit).Exabits, ExabitsTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Exabyte).Exabytes, ExabytesTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Exbibit).Exbibits, ExbibitsTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Exbibyte).Exbibytes, ExbibytesTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Gibibit).Gibibits, GibibitsTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Gibibyte).Gibibytes, GibibytesTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Gigabit).Gigabits, GigabitsTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Gigabyte).Gigabytes, GigabytesTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Kibibit).Kibibits, KibibitsTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Kibibyte).Kibibytes, KibibytesTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Kilobit).Kilobits, KilobitsTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Kilobyte).Kilobytes, KilobytesTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Mebibit).Mebibits, MebibitsTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Mebibyte).Mebibytes, MebibytesTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Megabit).Megabits, MegabitsTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Megabyte).Megabytes, MegabytesTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Pebibit).Pebibits, PebibitsTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Pebibyte).Pebibytes, PebibytesTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Petabit).Petabits, PetabitsTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Petabyte).Petabytes, PetabytesTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Tebibit).Tebibits, TebibitsTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Tebibyte).Tebibytes, TebibytesTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Terabit).Terabits, TerabitsTolerance); - AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Terabyte).Terabytes, TerabytesTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Bit).Bits, BitsTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Byte).Bytes, BytesTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Exabit).Exabits, ExabitsTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Exabyte).Exabytes, ExabytesTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Exbibit).Exbibits, ExbibitsTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Exbibyte).Exbibytes, ExbibytesTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Gibibit).Gibibits, GibibitsTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Gibibyte).Gibibytes, GibibytesTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Gigabit).Gigabits, GigabitsTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Gigabyte).Gigabytes, GigabytesTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Kibibit).Kibibits, KibibitsTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Kibibyte).Kibibytes, KibibytesTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Kilobit).Kilobits, KilobitsTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Kilobyte).Kilobytes, KilobytesTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Mebibit).Mebibits, MebibitsTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Mebibyte).Mebibytes, MebibytesTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Megabit).Megabits, MegabitsTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Megabyte).Megabytes, MegabytesTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Pebibit).Pebibits, PebibitsTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Pebibyte).Pebibytes, PebibytesTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Petabit).Petabits, PetabitsTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Petabyte).Petabytes, PetabytesTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Tebibit).Tebibits, TebibitsTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Tebibyte).Tebibytes, TebibytesTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Terabit).Terabits, TerabitsTolerance); + AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Terabyte).Terabytes, TerabytesTolerance); } [Fact] public void As() { - var bit = Information.FromBits(1); + var bit = Information.FromBits(1); AssertEx.EqualTolerance(BitsInOneBit, bit.As(InformationUnit.Bit), BitsTolerance); AssertEx.EqualTolerance(BytesInOneBit, bit.As(InformationUnit.Byte), BytesTolerance); AssertEx.EqualTolerance(ExabitsInOneBit, bit.As(InformationUnit.Exabit), ExabitsTolerance); @@ -194,7 +194,7 @@ public void As() [Fact] public void ToUnit() { - var bit = Information.FromBits(1); + var bit = Information.FromBits(1); var bitQuantity = bit.ToUnit(InformationUnit.Bit); AssertEx.EqualTolerance(BitsInOneBit, (double)bitQuantity.Value, BitsTolerance); @@ -304,53 +304,53 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Information bit = Information.FromBits(1); - AssertEx.EqualTolerance(1, Information.FromBits(bit.Bits).Bits, BitsTolerance); - AssertEx.EqualTolerance(1, Information.FromBytes(bit.Bytes).Bits, BytesTolerance); - AssertEx.EqualTolerance(1, Information.FromExabits(bit.Exabits).Bits, ExabitsTolerance); - AssertEx.EqualTolerance(1, Information.FromExabytes(bit.Exabytes).Bits, ExabytesTolerance); - AssertEx.EqualTolerance(1, Information.FromExbibits(bit.Exbibits).Bits, ExbibitsTolerance); - AssertEx.EqualTolerance(1, Information.FromExbibytes(bit.Exbibytes).Bits, ExbibytesTolerance); - AssertEx.EqualTolerance(1, Information.FromGibibits(bit.Gibibits).Bits, GibibitsTolerance); - AssertEx.EqualTolerance(1, Information.FromGibibytes(bit.Gibibytes).Bits, GibibytesTolerance); - AssertEx.EqualTolerance(1, Information.FromGigabits(bit.Gigabits).Bits, GigabitsTolerance); - AssertEx.EqualTolerance(1, Information.FromGigabytes(bit.Gigabytes).Bits, GigabytesTolerance); - AssertEx.EqualTolerance(1, Information.FromKibibits(bit.Kibibits).Bits, KibibitsTolerance); - AssertEx.EqualTolerance(1, Information.FromKibibytes(bit.Kibibytes).Bits, KibibytesTolerance); - AssertEx.EqualTolerance(1, Information.FromKilobits(bit.Kilobits).Bits, KilobitsTolerance); - AssertEx.EqualTolerance(1, Information.FromKilobytes(bit.Kilobytes).Bits, KilobytesTolerance); - AssertEx.EqualTolerance(1, Information.FromMebibits(bit.Mebibits).Bits, MebibitsTolerance); - AssertEx.EqualTolerance(1, Information.FromMebibytes(bit.Mebibytes).Bits, MebibytesTolerance); - AssertEx.EqualTolerance(1, Information.FromMegabits(bit.Megabits).Bits, MegabitsTolerance); - AssertEx.EqualTolerance(1, Information.FromMegabytes(bit.Megabytes).Bits, MegabytesTolerance); - AssertEx.EqualTolerance(1, Information.FromPebibits(bit.Pebibits).Bits, PebibitsTolerance); - AssertEx.EqualTolerance(1, Information.FromPebibytes(bit.Pebibytes).Bits, PebibytesTolerance); - AssertEx.EqualTolerance(1, Information.FromPetabits(bit.Petabits).Bits, PetabitsTolerance); - AssertEx.EqualTolerance(1, Information.FromPetabytes(bit.Petabytes).Bits, PetabytesTolerance); - AssertEx.EqualTolerance(1, Information.FromTebibits(bit.Tebibits).Bits, TebibitsTolerance); - AssertEx.EqualTolerance(1, Information.FromTebibytes(bit.Tebibytes).Bits, TebibytesTolerance); - AssertEx.EqualTolerance(1, Information.FromTerabits(bit.Terabits).Bits, TerabitsTolerance); - AssertEx.EqualTolerance(1, Information.FromTerabytes(bit.Terabytes).Bits, TerabytesTolerance); + Information bit = Information.FromBits(1); + AssertEx.EqualTolerance(1, Information.FromBits(bit.Bits).Bits, BitsTolerance); + AssertEx.EqualTolerance(1, Information.FromBytes(bit.Bytes).Bits, BytesTolerance); + AssertEx.EqualTolerance(1, Information.FromExabits(bit.Exabits).Bits, ExabitsTolerance); + AssertEx.EqualTolerance(1, Information.FromExabytes(bit.Exabytes).Bits, ExabytesTolerance); + AssertEx.EqualTolerance(1, Information.FromExbibits(bit.Exbibits).Bits, ExbibitsTolerance); + AssertEx.EqualTolerance(1, Information.FromExbibytes(bit.Exbibytes).Bits, ExbibytesTolerance); + AssertEx.EqualTolerance(1, Information.FromGibibits(bit.Gibibits).Bits, GibibitsTolerance); + AssertEx.EqualTolerance(1, Information.FromGibibytes(bit.Gibibytes).Bits, GibibytesTolerance); + AssertEx.EqualTolerance(1, Information.FromGigabits(bit.Gigabits).Bits, GigabitsTolerance); + AssertEx.EqualTolerance(1, Information.FromGigabytes(bit.Gigabytes).Bits, GigabytesTolerance); + AssertEx.EqualTolerance(1, Information.FromKibibits(bit.Kibibits).Bits, KibibitsTolerance); + AssertEx.EqualTolerance(1, Information.FromKibibytes(bit.Kibibytes).Bits, KibibytesTolerance); + AssertEx.EqualTolerance(1, Information.FromKilobits(bit.Kilobits).Bits, KilobitsTolerance); + AssertEx.EqualTolerance(1, Information.FromKilobytes(bit.Kilobytes).Bits, KilobytesTolerance); + AssertEx.EqualTolerance(1, Information.FromMebibits(bit.Mebibits).Bits, MebibitsTolerance); + AssertEx.EqualTolerance(1, Information.FromMebibytes(bit.Mebibytes).Bits, MebibytesTolerance); + AssertEx.EqualTolerance(1, Information.FromMegabits(bit.Megabits).Bits, MegabitsTolerance); + AssertEx.EqualTolerance(1, Information.FromMegabytes(bit.Megabytes).Bits, MegabytesTolerance); + AssertEx.EqualTolerance(1, Information.FromPebibits(bit.Pebibits).Bits, PebibitsTolerance); + AssertEx.EqualTolerance(1, Information.FromPebibytes(bit.Pebibytes).Bits, PebibytesTolerance); + AssertEx.EqualTolerance(1, Information.FromPetabits(bit.Petabits).Bits, PetabitsTolerance); + AssertEx.EqualTolerance(1, Information.FromPetabytes(bit.Petabytes).Bits, PetabytesTolerance); + AssertEx.EqualTolerance(1, Information.FromTebibits(bit.Tebibits).Bits, TebibitsTolerance); + AssertEx.EqualTolerance(1, Information.FromTebibytes(bit.Tebibytes).Bits, TebibytesTolerance); + AssertEx.EqualTolerance(1, Information.FromTerabits(bit.Terabits).Bits, TerabitsTolerance); + AssertEx.EqualTolerance(1, Information.FromTerabytes(bit.Terabytes).Bits, TerabytesTolerance); } [Fact] public void ArithmeticOperators() { - Information v = Information.FromBits(1); + Information v = Information.FromBits(1); AssertEx.EqualTolerance(-1, -v.Bits, BitsTolerance); - AssertEx.EqualTolerance(2, (Information.FromBits(3)-v).Bits, BitsTolerance); + AssertEx.EqualTolerance(2, (Information.FromBits(3)-v).Bits, BitsTolerance); AssertEx.EqualTolerance(2, (v + v).Bits, BitsTolerance); AssertEx.EqualTolerance(10, (v*10).Bits, BitsTolerance); AssertEx.EqualTolerance(10, (10*v).Bits, BitsTolerance); - AssertEx.EqualTolerance(2, (Information.FromBits(10)/5).Bits, BitsTolerance); - AssertEx.EqualTolerance(2, Information.FromBits(10)/Information.FromBits(5), BitsTolerance); + AssertEx.EqualTolerance(2, (Information.FromBits(10)/5).Bits, BitsTolerance); + AssertEx.EqualTolerance(2, Information.FromBits(10)/Information.FromBits(5), BitsTolerance); } [Fact] public void ComparisonOperators() { - Information oneBit = Information.FromBits(1); - Information twoBits = Information.FromBits(2); + Information oneBit = Information.FromBits(1); + Information twoBits = Information.FromBits(2); Assert.True(oneBit < twoBits); Assert.True(oneBit <= twoBits); @@ -366,31 +366,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Information bit = Information.FromBits(1); + Information bit = Information.FromBits(1); Assert.Equal(0, bit.CompareTo(bit)); - Assert.True(bit.CompareTo(Information.Zero) > 0); - Assert.True(Information.Zero.CompareTo(bit) < 0); + Assert.True(bit.CompareTo(Information.Zero) > 0); + Assert.True(Information.Zero.CompareTo(bit) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Information bit = Information.FromBits(1); + Information bit = Information.FromBits(1); Assert.Throws(() => bit.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Information bit = Information.FromBits(1); + Information bit = Information.FromBits(1); Assert.Throws(() => bit.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Information.FromBits(1); - var b = Information.FromBits(2); + var a = Information.FromBits(1); + var b = Information.FromBits(2); // ReSharper disable EqualExpressionComparison @@ -409,8 +409,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Information.FromBits(1); - var b = Information.FromBits(2); + var a = Information.FromBits(1); + var b = Information.FromBits(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -420,29 +420,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Information.FromBits(1); - Assert.True(v.Equals(Information.FromBits(1), BitsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Information.Zero, BitsTolerance, ComparisonType.Relative)); + var v = Information.FromBits(1); + Assert.True(v.Equals(Information.FromBits(1), BitsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Information.Zero, BitsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Information bit = Information.FromBits(1); + Information bit = Information.FromBits(1); Assert.False(bit.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Information bit = Information.FromBits(1); + Information bit = Information.FromBits(1); Assert.False(bit.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(InformationUnit.Undefined, Information.Units); + Assert.DoesNotContain(InformationUnit.Undefined, Information.Units); } [Fact] @@ -461,7 +461,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Information.BaseDimensions is null); + Assert.False(Information.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs index 926ec90261..909aaa5a11 100644 --- a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs @@ -69,26 +69,26 @@ public abstract partial class IrradianceTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Irradiance((double)0.0, IrradianceUnit.Undefined)); + Assert.Throws(() => new Irradiance((double)0.0, IrradianceUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Irradiance(double.PositiveInfinity, IrradianceUnit.WattPerSquareMeter)); - Assert.Throws(() => new Irradiance(double.NegativeInfinity, IrradianceUnit.WattPerSquareMeter)); + Assert.Throws(() => new Irradiance(double.PositiveInfinity, IrradianceUnit.WattPerSquareMeter)); + Assert.Throws(() => new Irradiance(double.NegativeInfinity, IrradianceUnit.WattPerSquareMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Irradiance(double.NaN, IrradianceUnit.WattPerSquareMeter)); + Assert.Throws(() => new Irradiance(double.NaN, IrradianceUnit.WattPerSquareMeter)); } [Fact] public void WattPerSquareMeterToIrradianceUnits() { - Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); + Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); AssertEx.EqualTolerance(KilowattsPerSquareCentimeterInOneWattPerSquareMeter, wattpersquaremeter.KilowattsPerSquareCentimeter, KilowattsPerSquareCentimeterTolerance); AssertEx.EqualTolerance(KilowattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.KilowattsPerSquareMeter, KilowattsPerSquareMeterTolerance); AssertEx.EqualTolerance(MegawattsPerSquareCentimeterInOneWattPerSquareMeter, wattpersquaremeter.MegawattsPerSquareCentimeter, MegawattsPerSquareCentimeterTolerance); @@ -108,39 +108,39 @@ public void WattPerSquareMeterToIrradianceUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.KilowattPerSquareCentimeter).KilowattsPerSquareCentimeter, KilowattsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.KilowattPerSquareMeter).KilowattsPerSquareMeter, KilowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.MegawattPerSquareCentimeter).MegawattsPerSquareCentimeter, MegawattsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.MegawattPerSquareMeter).MegawattsPerSquareMeter, MegawattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.MicrowattPerSquareCentimeter).MicrowattsPerSquareCentimeter, MicrowattsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.MicrowattPerSquareMeter).MicrowattsPerSquareMeter, MicrowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.MilliwattPerSquareCentimeter).MilliwattsPerSquareCentimeter, MilliwattsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.MilliwattPerSquareMeter).MilliwattsPerSquareMeter, MilliwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.NanowattPerSquareCentimeter).NanowattsPerSquareCentimeter, NanowattsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.NanowattPerSquareMeter).NanowattsPerSquareMeter, NanowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.PicowattPerSquareCentimeter).PicowattsPerSquareCentimeter, PicowattsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.PicowattPerSquareMeter).PicowattsPerSquareMeter, PicowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.WattPerSquareCentimeter).WattsPerSquareCentimeter, WattsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.WattPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.KilowattPerSquareCentimeter).KilowattsPerSquareCentimeter, KilowattsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.KilowattPerSquareMeter).KilowattsPerSquareMeter, KilowattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.MegawattPerSquareCentimeter).MegawattsPerSquareCentimeter, MegawattsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.MegawattPerSquareMeter).MegawattsPerSquareMeter, MegawattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.MicrowattPerSquareCentimeter).MicrowattsPerSquareCentimeter, MicrowattsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.MicrowattPerSquareMeter).MicrowattsPerSquareMeter, MicrowattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.MilliwattPerSquareCentimeter).MilliwattsPerSquareCentimeter, MilliwattsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.MilliwattPerSquareMeter).MilliwattsPerSquareMeter, MilliwattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.NanowattPerSquareCentimeter).NanowattsPerSquareCentimeter, NanowattsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.NanowattPerSquareMeter).NanowattsPerSquareMeter, NanowattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.PicowattPerSquareCentimeter).PicowattsPerSquareCentimeter, PicowattsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.PicowattPerSquareMeter).PicowattsPerSquareMeter, PicowattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.WattPerSquareCentimeter).WattsPerSquareCentimeter, WattsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.WattPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance); } [Fact] public void FromWattsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.NegativeInfinity)); + Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.NegativeInfinity)); } [Fact] public void FromWattsPerSquareMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.NaN)); + Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.NaN)); } [Fact] public void As() { - var wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); + var wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); AssertEx.EqualTolerance(KilowattsPerSquareCentimeterInOneWattPerSquareMeter, wattpersquaremeter.As(IrradianceUnit.KilowattPerSquareCentimeter), KilowattsPerSquareCentimeterTolerance); AssertEx.EqualTolerance(KilowattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.As(IrradianceUnit.KilowattPerSquareMeter), KilowattsPerSquareMeterTolerance); AssertEx.EqualTolerance(MegawattsPerSquareCentimeterInOneWattPerSquareMeter, wattpersquaremeter.As(IrradianceUnit.MegawattPerSquareCentimeter), MegawattsPerSquareCentimeterTolerance); @@ -160,7 +160,7 @@ public void As() [Fact] public void ToUnit() { - var wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); + var wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); var kilowattpersquarecentimeterQuantity = wattpersquaremeter.ToUnit(IrradianceUnit.KilowattPerSquareCentimeter); AssertEx.EqualTolerance(KilowattsPerSquareCentimeterInOneWattPerSquareMeter, (double)kilowattpersquarecentimeterQuantity.Value, KilowattsPerSquareCentimeterTolerance); @@ -222,41 +222,41 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); - AssertEx.EqualTolerance(1, Irradiance.FromKilowattsPerSquareCentimeter(wattpersquaremeter.KilowattsPerSquareCentimeter).WattsPerSquareMeter, KilowattsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.FromKilowattsPerSquareMeter(wattpersquaremeter.KilowattsPerSquareMeter).WattsPerSquareMeter, KilowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.FromMegawattsPerSquareCentimeter(wattpersquaremeter.MegawattsPerSquareCentimeter).WattsPerSquareMeter, MegawattsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.FromMegawattsPerSquareMeter(wattpersquaremeter.MegawattsPerSquareMeter).WattsPerSquareMeter, MegawattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.FromMicrowattsPerSquareCentimeter(wattpersquaremeter.MicrowattsPerSquareCentimeter).WattsPerSquareMeter, MicrowattsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.FromMicrowattsPerSquareMeter(wattpersquaremeter.MicrowattsPerSquareMeter).WattsPerSquareMeter, MicrowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.FromMilliwattsPerSquareCentimeter(wattpersquaremeter.MilliwattsPerSquareCentimeter).WattsPerSquareMeter, MilliwattsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.FromMilliwattsPerSquareMeter(wattpersquaremeter.MilliwattsPerSquareMeter).WattsPerSquareMeter, MilliwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.FromNanowattsPerSquareCentimeter(wattpersquaremeter.NanowattsPerSquareCentimeter).WattsPerSquareMeter, NanowattsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.FromNanowattsPerSquareMeter(wattpersquaremeter.NanowattsPerSquareMeter).WattsPerSquareMeter, NanowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.FromPicowattsPerSquareCentimeter(wattpersquaremeter.PicowattsPerSquareCentimeter).WattsPerSquareMeter, PicowattsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.FromPicowattsPerSquareMeter(wattpersquaremeter.PicowattsPerSquareMeter).WattsPerSquareMeter, PicowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.FromWattsPerSquareCentimeter(wattpersquaremeter.WattsPerSquareCentimeter).WattsPerSquareMeter, WattsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.FromWattsPerSquareMeter(wattpersquaremeter.WattsPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance); + Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); + AssertEx.EqualTolerance(1, Irradiance.FromKilowattsPerSquareCentimeter(wattpersquaremeter.KilowattsPerSquareCentimeter).WattsPerSquareMeter, KilowattsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.FromKilowattsPerSquareMeter(wattpersquaremeter.KilowattsPerSquareMeter).WattsPerSquareMeter, KilowattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.FromMegawattsPerSquareCentimeter(wattpersquaremeter.MegawattsPerSquareCentimeter).WattsPerSquareMeter, MegawattsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.FromMegawattsPerSquareMeter(wattpersquaremeter.MegawattsPerSquareMeter).WattsPerSquareMeter, MegawattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.FromMicrowattsPerSquareCentimeter(wattpersquaremeter.MicrowattsPerSquareCentimeter).WattsPerSquareMeter, MicrowattsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.FromMicrowattsPerSquareMeter(wattpersquaremeter.MicrowattsPerSquareMeter).WattsPerSquareMeter, MicrowattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.FromMilliwattsPerSquareCentimeter(wattpersquaremeter.MilliwattsPerSquareCentimeter).WattsPerSquareMeter, MilliwattsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.FromMilliwattsPerSquareMeter(wattpersquaremeter.MilliwattsPerSquareMeter).WattsPerSquareMeter, MilliwattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.FromNanowattsPerSquareCentimeter(wattpersquaremeter.NanowattsPerSquareCentimeter).WattsPerSquareMeter, NanowattsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.FromNanowattsPerSquareMeter(wattpersquaremeter.NanowattsPerSquareMeter).WattsPerSquareMeter, NanowattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.FromPicowattsPerSquareCentimeter(wattpersquaremeter.PicowattsPerSquareCentimeter).WattsPerSquareMeter, PicowattsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.FromPicowattsPerSquareMeter(wattpersquaremeter.PicowattsPerSquareMeter).WattsPerSquareMeter, PicowattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.FromWattsPerSquareCentimeter(wattpersquaremeter.WattsPerSquareCentimeter).WattsPerSquareMeter, WattsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiance.FromWattsPerSquareMeter(wattpersquaremeter.WattsPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance); } [Fact] public void ArithmeticOperators() { - Irradiance v = Irradiance.FromWattsPerSquareMeter(1); + Irradiance v = Irradiance.FromWattsPerSquareMeter(1); AssertEx.EqualTolerance(-1, -v.WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (Irradiance.FromWattsPerSquareMeter(3)-v).WattsPerSquareMeter, WattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, (Irradiance.FromWattsPerSquareMeter(3)-v).WattsPerSquareMeter, WattsPerSquareMeterTolerance); AssertEx.EqualTolerance(2, (v + v).WattsPerSquareMeter, WattsPerSquareMeterTolerance); AssertEx.EqualTolerance(10, (v*10).WattsPerSquareMeter, WattsPerSquareMeterTolerance); AssertEx.EqualTolerance(10, (10*v).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (Irradiance.FromWattsPerSquareMeter(10)/5).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, Irradiance.FromWattsPerSquareMeter(10)/Irradiance.FromWattsPerSquareMeter(5), WattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, (Irradiance.FromWattsPerSquareMeter(10)/5).WattsPerSquareMeter, WattsPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, Irradiance.FromWattsPerSquareMeter(10)/Irradiance.FromWattsPerSquareMeter(5), WattsPerSquareMeterTolerance); } [Fact] public void ComparisonOperators() { - Irradiance oneWattPerSquareMeter = Irradiance.FromWattsPerSquareMeter(1); - Irradiance twoWattsPerSquareMeter = Irradiance.FromWattsPerSquareMeter(2); + Irradiance oneWattPerSquareMeter = Irradiance.FromWattsPerSquareMeter(1); + Irradiance twoWattsPerSquareMeter = Irradiance.FromWattsPerSquareMeter(2); Assert.True(oneWattPerSquareMeter < twoWattsPerSquareMeter); Assert.True(oneWattPerSquareMeter <= twoWattsPerSquareMeter); @@ -272,31 +272,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); + Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); Assert.Equal(0, wattpersquaremeter.CompareTo(wattpersquaremeter)); - Assert.True(wattpersquaremeter.CompareTo(Irradiance.Zero) > 0); - Assert.True(Irradiance.Zero.CompareTo(wattpersquaremeter) < 0); + Assert.True(wattpersquaremeter.CompareTo(Irradiance.Zero) > 0); + Assert.True(Irradiance.Zero.CompareTo(wattpersquaremeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); + Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); Assert.Throws(() => wattpersquaremeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); + Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); Assert.Throws(() => wattpersquaremeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Irradiance.FromWattsPerSquareMeter(1); - var b = Irradiance.FromWattsPerSquareMeter(2); + var a = Irradiance.FromWattsPerSquareMeter(1); + var b = Irradiance.FromWattsPerSquareMeter(2); // ReSharper disable EqualExpressionComparison @@ -315,8 +315,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Irradiance.FromWattsPerSquareMeter(1); - var b = Irradiance.FromWattsPerSquareMeter(2); + var a = Irradiance.FromWattsPerSquareMeter(1); + var b = Irradiance.FromWattsPerSquareMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -326,29 +326,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Irradiance.FromWattsPerSquareMeter(1); - Assert.True(v.Equals(Irradiance.FromWattsPerSquareMeter(1), WattsPerSquareMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Irradiance.Zero, WattsPerSquareMeterTolerance, ComparisonType.Relative)); + var v = Irradiance.FromWattsPerSquareMeter(1); + Assert.True(v.Equals(Irradiance.FromWattsPerSquareMeter(1), WattsPerSquareMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Irradiance.Zero, WattsPerSquareMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); + Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); Assert.False(wattpersquaremeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); + Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); Assert.False(wattpersquaremeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(IrradianceUnit.Undefined, Irradiance.Units); + Assert.DoesNotContain(IrradianceUnit.Undefined, Irradiance.Units); } [Fact] @@ -367,7 +367,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Irradiance.BaseDimensions is null); + Assert.False(Irradiance.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs index 992ca1aa4c..a0316873fb 100644 --- a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs @@ -55,26 +55,26 @@ public abstract partial class IrradiationTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Irradiation((double)0.0, IrradiationUnit.Undefined)); + Assert.Throws(() => new Irradiation((double)0.0, IrradiationUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Irradiation(double.PositiveInfinity, IrradiationUnit.JoulePerSquareMeter)); - Assert.Throws(() => new Irradiation(double.NegativeInfinity, IrradiationUnit.JoulePerSquareMeter)); + Assert.Throws(() => new Irradiation(double.PositiveInfinity, IrradiationUnit.JoulePerSquareMeter)); + Assert.Throws(() => new Irradiation(double.NegativeInfinity, IrradiationUnit.JoulePerSquareMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Irradiation(double.NaN, IrradiationUnit.JoulePerSquareMeter)); + Assert.Throws(() => new Irradiation(double.NaN, IrradiationUnit.JoulePerSquareMeter)); } [Fact] public void JoulePerSquareMeterToIrradiationUnits() { - Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); + Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); AssertEx.EqualTolerance(JoulesPerSquareCentimeterInOneJoulePerSquareMeter, joulepersquaremeter.JoulesPerSquareCentimeter, JoulesPerSquareCentimeterTolerance); AssertEx.EqualTolerance(JoulesPerSquareMeterInOneJoulePerSquareMeter, joulepersquaremeter.JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); AssertEx.EqualTolerance(JoulesPerSquareMillimeterInOneJoulePerSquareMeter, joulepersquaremeter.JoulesPerSquareMillimeter, JoulesPerSquareMillimeterTolerance); @@ -87,32 +87,32 @@ public void JoulePerSquareMeterToIrradiationUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.JoulePerSquareCentimeter).JoulesPerSquareCentimeter, JoulesPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.JoulePerSquareMeter).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.JoulePerSquareMillimeter).JoulesPerSquareMillimeter, JoulesPerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.KilojoulePerSquareMeter).KilojoulesPerSquareMeter, KilojoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.KilowattHourPerSquareMeter).KilowattHoursPerSquareMeter, KilowattHoursPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.MillijoulePerSquareCentimeter).MillijoulesPerSquareCentimeter, MillijoulesPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.WattHourPerSquareMeter).WattHoursPerSquareMeter, WattHoursPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.JoulePerSquareCentimeter).JoulesPerSquareCentimeter, JoulesPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.JoulePerSquareMeter).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.JoulePerSquareMillimeter).JoulesPerSquareMillimeter, JoulesPerSquareMillimeterTolerance); + AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.KilojoulePerSquareMeter).KilojoulesPerSquareMeter, KilojoulesPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.KilowattHourPerSquareMeter).KilowattHoursPerSquareMeter, KilowattHoursPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.MillijoulePerSquareCentimeter).MillijoulesPerSquareCentimeter, MillijoulesPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.WattHourPerSquareMeter).WattHoursPerSquareMeter, WattHoursPerSquareMeterTolerance); } [Fact] public void FromJoulesPerSquareMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.NegativeInfinity)); + Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.NegativeInfinity)); } [Fact] public void FromJoulesPerSquareMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.NaN)); + Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.NaN)); } [Fact] public void As() { - var joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); + var joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); AssertEx.EqualTolerance(JoulesPerSquareCentimeterInOneJoulePerSquareMeter, joulepersquaremeter.As(IrradiationUnit.JoulePerSquareCentimeter), JoulesPerSquareCentimeterTolerance); AssertEx.EqualTolerance(JoulesPerSquareMeterInOneJoulePerSquareMeter, joulepersquaremeter.As(IrradiationUnit.JoulePerSquareMeter), JoulesPerSquareMeterTolerance); AssertEx.EqualTolerance(JoulesPerSquareMillimeterInOneJoulePerSquareMeter, joulepersquaremeter.As(IrradiationUnit.JoulePerSquareMillimeter), JoulesPerSquareMillimeterTolerance); @@ -125,7 +125,7 @@ public void As() [Fact] public void ToUnit() { - var joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); + var joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); var joulepersquarecentimeterQuantity = joulepersquaremeter.ToUnit(IrradiationUnit.JoulePerSquareCentimeter); AssertEx.EqualTolerance(JoulesPerSquareCentimeterInOneJoulePerSquareMeter, (double)joulepersquarecentimeterQuantity.Value, JoulesPerSquareCentimeterTolerance); @@ -159,34 +159,34 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); - AssertEx.EqualTolerance(1, Irradiation.FromJoulesPerSquareCentimeter(joulepersquaremeter.JoulesPerSquareCentimeter).JoulesPerSquareMeter, JoulesPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiation.FromJoulesPerSquareMeter(joulepersquaremeter.JoulesPerSquareMeter).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiation.FromJoulesPerSquareMillimeter(joulepersquaremeter.JoulesPerSquareMillimeter).JoulesPerSquareMeter, JoulesPerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Irradiation.FromKilojoulesPerSquareMeter(joulepersquaremeter.KilojoulesPerSquareMeter).JoulesPerSquareMeter, KilojoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiation.FromKilowattHoursPerSquareMeter(joulepersquaremeter.KilowattHoursPerSquareMeter).JoulesPerSquareMeter, KilowattHoursPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiation.FromMillijoulesPerSquareCentimeter(joulepersquaremeter.MillijoulesPerSquareCentimeter).JoulesPerSquareMeter, MillijoulesPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Irradiation.FromWattHoursPerSquareMeter(joulepersquaremeter.WattHoursPerSquareMeter).JoulesPerSquareMeter, WattHoursPerSquareMeterTolerance); + Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); + AssertEx.EqualTolerance(1, Irradiation.FromJoulesPerSquareCentimeter(joulepersquaremeter.JoulesPerSquareCentimeter).JoulesPerSquareMeter, JoulesPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiation.FromJoulesPerSquareMeter(joulepersquaremeter.JoulesPerSquareMeter).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiation.FromJoulesPerSquareMillimeter(joulepersquaremeter.JoulesPerSquareMillimeter).JoulesPerSquareMeter, JoulesPerSquareMillimeterTolerance); + AssertEx.EqualTolerance(1, Irradiation.FromKilojoulesPerSquareMeter(joulepersquaremeter.KilojoulesPerSquareMeter).JoulesPerSquareMeter, KilojoulesPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiation.FromKilowattHoursPerSquareMeter(joulepersquaremeter.KilowattHoursPerSquareMeter).JoulesPerSquareMeter, KilowattHoursPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Irradiation.FromMillijoulesPerSquareCentimeter(joulepersquaremeter.MillijoulesPerSquareCentimeter).JoulesPerSquareMeter, MillijoulesPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Irradiation.FromWattHoursPerSquareMeter(joulepersquaremeter.WattHoursPerSquareMeter).JoulesPerSquareMeter, WattHoursPerSquareMeterTolerance); } [Fact] public void ArithmeticOperators() { - Irradiation v = Irradiation.FromJoulesPerSquareMeter(1); + Irradiation v = Irradiation.FromJoulesPerSquareMeter(1); AssertEx.EqualTolerance(-1, -v.JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (Irradiation.FromJoulesPerSquareMeter(3)-v).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, (Irradiation.FromJoulesPerSquareMeter(3)-v).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); AssertEx.EqualTolerance(2, (v + v).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); AssertEx.EqualTolerance(10, (v*10).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); AssertEx.EqualTolerance(10, (10*v).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (Irradiation.FromJoulesPerSquareMeter(10)/5).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, Irradiation.FromJoulesPerSquareMeter(10)/Irradiation.FromJoulesPerSquareMeter(5), JoulesPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, (Irradiation.FromJoulesPerSquareMeter(10)/5).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, Irradiation.FromJoulesPerSquareMeter(10)/Irradiation.FromJoulesPerSquareMeter(5), JoulesPerSquareMeterTolerance); } [Fact] public void ComparisonOperators() { - Irradiation oneJoulePerSquareMeter = Irradiation.FromJoulesPerSquareMeter(1); - Irradiation twoJoulesPerSquareMeter = Irradiation.FromJoulesPerSquareMeter(2); + Irradiation oneJoulePerSquareMeter = Irradiation.FromJoulesPerSquareMeter(1); + Irradiation twoJoulesPerSquareMeter = Irradiation.FromJoulesPerSquareMeter(2); Assert.True(oneJoulePerSquareMeter < twoJoulesPerSquareMeter); Assert.True(oneJoulePerSquareMeter <= twoJoulesPerSquareMeter); @@ -202,31 +202,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); + Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); Assert.Equal(0, joulepersquaremeter.CompareTo(joulepersquaremeter)); - Assert.True(joulepersquaremeter.CompareTo(Irradiation.Zero) > 0); - Assert.True(Irradiation.Zero.CompareTo(joulepersquaremeter) < 0); + Assert.True(joulepersquaremeter.CompareTo(Irradiation.Zero) > 0); + Assert.True(Irradiation.Zero.CompareTo(joulepersquaremeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); + Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); Assert.Throws(() => joulepersquaremeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); + Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); Assert.Throws(() => joulepersquaremeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Irradiation.FromJoulesPerSquareMeter(1); - var b = Irradiation.FromJoulesPerSquareMeter(2); + var a = Irradiation.FromJoulesPerSquareMeter(1); + var b = Irradiation.FromJoulesPerSquareMeter(2); // ReSharper disable EqualExpressionComparison @@ -245,8 +245,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Irradiation.FromJoulesPerSquareMeter(1); - var b = Irradiation.FromJoulesPerSquareMeter(2); + var a = Irradiation.FromJoulesPerSquareMeter(1); + var b = Irradiation.FromJoulesPerSquareMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -256,29 +256,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Irradiation.FromJoulesPerSquareMeter(1); - Assert.True(v.Equals(Irradiation.FromJoulesPerSquareMeter(1), JoulesPerSquareMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Irradiation.Zero, JoulesPerSquareMeterTolerance, ComparisonType.Relative)); + var v = Irradiation.FromJoulesPerSquareMeter(1); + Assert.True(v.Equals(Irradiation.FromJoulesPerSquareMeter(1), JoulesPerSquareMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Irradiation.Zero, JoulesPerSquareMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); + Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); Assert.False(joulepersquaremeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); + Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); Assert.False(joulepersquaremeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(IrradiationUnit.Undefined, Irradiation.Units); + Assert.DoesNotContain(IrradiationUnit.Undefined, Irradiation.Units); } [Fact] @@ -297,7 +297,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Irradiation.BaseDimensions is null); + Assert.False(Irradiation.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs index 82ded26699..87da61ec68 100644 --- a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs @@ -57,26 +57,26 @@ public abstract partial class KinematicViscosityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new KinematicViscosity((double)0.0, KinematicViscosityUnit.Undefined)); + Assert.Throws(() => new KinematicViscosity((double)0.0, KinematicViscosityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new KinematicViscosity(double.PositiveInfinity, KinematicViscosityUnit.SquareMeterPerSecond)); - Assert.Throws(() => new KinematicViscosity(double.NegativeInfinity, KinematicViscosityUnit.SquareMeterPerSecond)); + Assert.Throws(() => new KinematicViscosity(double.PositiveInfinity, KinematicViscosityUnit.SquareMeterPerSecond)); + Assert.Throws(() => new KinematicViscosity(double.NegativeInfinity, KinematicViscosityUnit.SquareMeterPerSecond)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new KinematicViscosity(double.NaN, KinematicViscosityUnit.SquareMeterPerSecond)); + Assert.Throws(() => new KinematicViscosity(double.NaN, KinematicViscosityUnit.SquareMeterPerSecond)); } [Fact] public void SquareMeterPerSecondToKinematicViscosityUnits() { - KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); + KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); AssertEx.EqualTolerance(CentistokesInOneSquareMeterPerSecond, squaremeterpersecond.Centistokes, CentistokesTolerance); AssertEx.EqualTolerance(DecistokesInOneSquareMeterPerSecond, squaremeterpersecond.Decistokes, DecistokesTolerance); AssertEx.EqualTolerance(KilostokesInOneSquareMeterPerSecond, squaremeterpersecond.Kilostokes, KilostokesTolerance); @@ -90,33 +90,33 @@ public void SquareMeterPerSecondToKinematicViscosityUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Centistokes).Centistokes, CentistokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Decistokes).Decistokes, DecistokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Kilostokes).Kilostokes, KilostokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Microstokes).Microstokes, MicrostokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Millistokes).Millistokes, MillistokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Nanostokes).Nanostokes, NanostokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.SquareMeterPerSecond).SquareMetersPerSecond, SquareMetersPerSecondTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Stokes).Stokes, StokesTolerance); + AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Centistokes).Centistokes, CentistokesTolerance); + AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Decistokes).Decistokes, DecistokesTolerance); + AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Kilostokes).Kilostokes, KilostokesTolerance); + AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Microstokes).Microstokes, MicrostokesTolerance); + AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Millistokes).Millistokes, MillistokesTolerance); + AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Nanostokes).Nanostokes, NanostokesTolerance); + AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.SquareMeterPerSecond).SquareMetersPerSecond, SquareMetersPerSecondTolerance); + AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Stokes).Stokes, StokesTolerance); } [Fact] public void FromSquareMetersPerSecond_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.PositiveInfinity)); - Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.NegativeInfinity)); + Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.PositiveInfinity)); + Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.NegativeInfinity)); } [Fact] public void FromSquareMetersPerSecond_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.NaN)); + Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.NaN)); } [Fact] public void As() { - var squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); + var squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); AssertEx.EqualTolerance(CentistokesInOneSquareMeterPerSecond, squaremeterpersecond.As(KinematicViscosityUnit.Centistokes), CentistokesTolerance); AssertEx.EqualTolerance(DecistokesInOneSquareMeterPerSecond, squaremeterpersecond.As(KinematicViscosityUnit.Decistokes), DecistokesTolerance); AssertEx.EqualTolerance(KilostokesInOneSquareMeterPerSecond, squaremeterpersecond.As(KinematicViscosityUnit.Kilostokes), KilostokesTolerance); @@ -130,7 +130,7 @@ public void As() [Fact] public void ToUnit() { - var squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); + var squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); var centistokesQuantity = squaremeterpersecond.ToUnit(KinematicViscosityUnit.Centistokes); AssertEx.EqualTolerance(CentistokesInOneSquareMeterPerSecond, (double)centistokesQuantity.Value, CentistokesTolerance); @@ -168,35 +168,35 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); - AssertEx.EqualTolerance(1, KinematicViscosity.FromCentistokes(squaremeterpersecond.Centistokes).SquareMetersPerSecond, CentistokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.FromDecistokes(squaremeterpersecond.Decistokes).SquareMetersPerSecond, DecistokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.FromKilostokes(squaremeterpersecond.Kilostokes).SquareMetersPerSecond, KilostokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.FromMicrostokes(squaremeterpersecond.Microstokes).SquareMetersPerSecond, MicrostokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.FromMillistokes(squaremeterpersecond.Millistokes).SquareMetersPerSecond, MillistokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.FromNanostokes(squaremeterpersecond.Nanostokes).SquareMetersPerSecond, NanostokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.FromSquareMetersPerSecond(squaremeterpersecond.SquareMetersPerSecond).SquareMetersPerSecond, SquareMetersPerSecondTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.FromStokes(squaremeterpersecond.Stokes).SquareMetersPerSecond, StokesTolerance); + KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); + AssertEx.EqualTolerance(1, KinematicViscosity.FromCentistokes(squaremeterpersecond.Centistokes).SquareMetersPerSecond, CentistokesTolerance); + AssertEx.EqualTolerance(1, KinematicViscosity.FromDecistokes(squaremeterpersecond.Decistokes).SquareMetersPerSecond, DecistokesTolerance); + AssertEx.EqualTolerance(1, KinematicViscosity.FromKilostokes(squaremeterpersecond.Kilostokes).SquareMetersPerSecond, KilostokesTolerance); + AssertEx.EqualTolerance(1, KinematicViscosity.FromMicrostokes(squaremeterpersecond.Microstokes).SquareMetersPerSecond, MicrostokesTolerance); + AssertEx.EqualTolerance(1, KinematicViscosity.FromMillistokes(squaremeterpersecond.Millistokes).SquareMetersPerSecond, MillistokesTolerance); + AssertEx.EqualTolerance(1, KinematicViscosity.FromNanostokes(squaremeterpersecond.Nanostokes).SquareMetersPerSecond, NanostokesTolerance); + AssertEx.EqualTolerance(1, KinematicViscosity.FromSquareMetersPerSecond(squaremeterpersecond.SquareMetersPerSecond).SquareMetersPerSecond, SquareMetersPerSecondTolerance); + AssertEx.EqualTolerance(1, KinematicViscosity.FromStokes(squaremeterpersecond.Stokes).SquareMetersPerSecond, StokesTolerance); } [Fact] public void ArithmeticOperators() { - KinematicViscosity v = KinematicViscosity.FromSquareMetersPerSecond(1); + KinematicViscosity v = KinematicViscosity.FromSquareMetersPerSecond(1); AssertEx.EqualTolerance(-1, -v.SquareMetersPerSecond, SquareMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (KinematicViscosity.FromSquareMetersPerSecond(3)-v).SquareMetersPerSecond, SquareMetersPerSecondTolerance); + AssertEx.EqualTolerance(2, (KinematicViscosity.FromSquareMetersPerSecond(3)-v).SquareMetersPerSecond, SquareMetersPerSecondTolerance); AssertEx.EqualTolerance(2, (v + v).SquareMetersPerSecond, SquareMetersPerSecondTolerance); AssertEx.EqualTolerance(10, (v*10).SquareMetersPerSecond, SquareMetersPerSecondTolerance); AssertEx.EqualTolerance(10, (10*v).SquareMetersPerSecond, SquareMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (KinematicViscosity.FromSquareMetersPerSecond(10)/5).SquareMetersPerSecond, SquareMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, KinematicViscosity.FromSquareMetersPerSecond(10)/KinematicViscosity.FromSquareMetersPerSecond(5), SquareMetersPerSecondTolerance); + AssertEx.EqualTolerance(2, (KinematicViscosity.FromSquareMetersPerSecond(10)/5).SquareMetersPerSecond, SquareMetersPerSecondTolerance); + AssertEx.EqualTolerance(2, KinematicViscosity.FromSquareMetersPerSecond(10)/KinematicViscosity.FromSquareMetersPerSecond(5), SquareMetersPerSecondTolerance); } [Fact] public void ComparisonOperators() { - KinematicViscosity oneSquareMeterPerSecond = KinematicViscosity.FromSquareMetersPerSecond(1); - KinematicViscosity twoSquareMetersPerSecond = KinematicViscosity.FromSquareMetersPerSecond(2); + KinematicViscosity oneSquareMeterPerSecond = KinematicViscosity.FromSquareMetersPerSecond(1); + KinematicViscosity twoSquareMetersPerSecond = KinematicViscosity.FromSquareMetersPerSecond(2); Assert.True(oneSquareMeterPerSecond < twoSquareMetersPerSecond); Assert.True(oneSquareMeterPerSecond <= twoSquareMetersPerSecond); @@ -212,31 +212,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); + KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); Assert.Equal(0, squaremeterpersecond.CompareTo(squaremeterpersecond)); - Assert.True(squaremeterpersecond.CompareTo(KinematicViscosity.Zero) > 0); - Assert.True(KinematicViscosity.Zero.CompareTo(squaremeterpersecond) < 0); + Assert.True(squaremeterpersecond.CompareTo(KinematicViscosity.Zero) > 0); + Assert.True(KinematicViscosity.Zero.CompareTo(squaremeterpersecond) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); + KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); Assert.Throws(() => squaremeterpersecond.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); + KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); Assert.Throws(() => squaremeterpersecond.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = KinematicViscosity.FromSquareMetersPerSecond(1); - var b = KinematicViscosity.FromSquareMetersPerSecond(2); + var a = KinematicViscosity.FromSquareMetersPerSecond(1); + var b = KinematicViscosity.FromSquareMetersPerSecond(2); // ReSharper disable EqualExpressionComparison @@ -255,8 +255,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = KinematicViscosity.FromSquareMetersPerSecond(1); - var b = KinematicViscosity.FromSquareMetersPerSecond(2); + var a = KinematicViscosity.FromSquareMetersPerSecond(1); + var b = KinematicViscosity.FromSquareMetersPerSecond(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -266,29 +266,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = KinematicViscosity.FromSquareMetersPerSecond(1); - Assert.True(v.Equals(KinematicViscosity.FromSquareMetersPerSecond(1), SquareMetersPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(KinematicViscosity.Zero, SquareMetersPerSecondTolerance, ComparisonType.Relative)); + var v = KinematicViscosity.FromSquareMetersPerSecond(1); + Assert.True(v.Equals(KinematicViscosity.FromSquareMetersPerSecond(1), SquareMetersPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(KinematicViscosity.Zero, SquareMetersPerSecondTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); + KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); Assert.False(squaremeterpersecond.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); + KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); Assert.False(squaremeterpersecond.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(KinematicViscosityUnit.Undefined, KinematicViscosity.Units); + Assert.DoesNotContain(KinematicViscosityUnit.Undefined, KinematicViscosity.Units); } [Fact] @@ -307,7 +307,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(KinematicViscosity.BaseDimensions is null); + Assert.False(KinematicViscosity.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs index 4e3d4eea39..7325512bbb 100644 --- a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of LapseRate. + /// Test of LapseRate. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class LapseRateTestsBase @@ -43,59 +43,59 @@ public abstract partial class LapseRateTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new LapseRate((double)0.0, LapseRateUnit.Undefined)); + Assert.Throws(() => new LapseRate((double)0.0, LapseRateUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new LapseRate(double.PositiveInfinity, LapseRateUnit.DegreeCelsiusPerKilometer)); - Assert.Throws(() => new LapseRate(double.NegativeInfinity, LapseRateUnit.DegreeCelsiusPerKilometer)); + Assert.Throws(() => new LapseRate(double.PositiveInfinity, LapseRateUnit.DegreeCelsiusPerKilometer)); + Assert.Throws(() => new LapseRate(double.NegativeInfinity, LapseRateUnit.DegreeCelsiusPerKilometer)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new LapseRate(double.NaN, LapseRateUnit.DegreeCelsiusPerKilometer)); + Assert.Throws(() => new LapseRate(double.NaN, LapseRateUnit.DegreeCelsiusPerKilometer)); } [Fact] public void DegreeCelsiusPerKilometerToLapseRateUnits() { - LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); + LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); AssertEx.EqualTolerance(DegreesCelciusPerKilometerInOneDegreeCelsiusPerKilometer, degreecelsiusperkilometer.DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); } [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, LapseRate.From(1, LapseRateUnit.DegreeCelsiusPerKilometer).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); + AssertEx.EqualTolerance(1, LapseRate.From(1, LapseRateUnit.DegreeCelsiusPerKilometer).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); } [Fact] public void FromDegreesCelciusPerKilometer_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => LapseRate.FromDegreesCelciusPerKilometer(double.PositiveInfinity)); - Assert.Throws(() => LapseRate.FromDegreesCelciusPerKilometer(double.NegativeInfinity)); + Assert.Throws(() => LapseRate.FromDegreesCelciusPerKilometer(double.PositiveInfinity)); + Assert.Throws(() => LapseRate.FromDegreesCelciusPerKilometer(double.NegativeInfinity)); } [Fact] public void FromDegreesCelciusPerKilometer_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => LapseRate.FromDegreesCelciusPerKilometer(double.NaN)); + Assert.Throws(() => LapseRate.FromDegreesCelciusPerKilometer(double.NaN)); } [Fact] public void As() { - var degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); + var degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); AssertEx.EqualTolerance(DegreesCelciusPerKilometerInOneDegreeCelsiusPerKilometer, degreecelsiusperkilometer.As(LapseRateUnit.DegreeCelsiusPerKilometer), DegreesCelciusPerKilometerTolerance); } [Fact] public void ToUnit() { - var degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); + var degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); var degreecelsiusperkilometerQuantity = degreecelsiusperkilometer.ToUnit(LapseRateUnit.DegreeCelsiusPerKilometer); AssertEx.EqualTolerance(DegreesCelciusPerKilometerInOneDegreeCelsiusPerKilometer, (double)degreecelsiusperkilometerQuantity.Value, DegreesCelciusPerKilometerTolerance); @@ -105,28 +105,28 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); - AssertEx.EqualTolerance(1, LapseRate.FromDegreesCelciusPerKilometer(degreecelsiusperkilometer.DegreesCelciusPerKilometer).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); + LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); + AssertEx.EqualTolerance(1, LapseRate.FromDegreesCelciusPerKilometer(degreecelsiusperkilometer.DegreesCelciusPerKilometer).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); } [Fact] public void ArithmeticOperators() { - LapseRate v = LapseRate.FromDegreesCelciusPerKilometer(1); + LapseRate v = LapseRate.FromDegreesCelciusPerKilometer(1); AssertEx.EqualTolerance(-1, -v.DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); - AssertEx.EqualTolerance(2, (LapseRate.FromDegreesCelciusPerKilometer(3)-v).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); + AssertEx.EqualTolerance(2, (LapseRate.FromDegreesCelciusPerKilometer(3)-v).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); AssertEx.EqualTolerance(2, (v + v).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); AssertEx.EqualTolerance(10, (v*10).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); AssertEx.EqualTolerance(10, (10*v).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); - AssertEx.EqualTolerance(2, (LapseRate.FromDegreesCelciusPerKilometer(10)/5).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); - AssertEx.EqualTolerance(2, LapseRate.FromDegreesCelciusPerKilometer(10)/LapseRate.FromDegreesCelciusPerKilometer(5), DegreesCelciusPerKilometerTolerance); + AssertEx.EqualTolerance(2, (LapseRate.FromDegreesCelciusPerKilometer(10)/5).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); + AssertEx.EqualTolerance(2, LapseRate.FromDegreesCelciusPerKilometer(10)/LapseRate.FromDegreesCelciusPerKilometer(5), DegreesCelciusPerKilometerTolerance); } [Fact] public void ComparisonOperators() { - LapseRate oneDegreeCelsiusPerKilometer = LapseRate.FromDegreesCelciusPerKilometer(1); - LapseRate twoDegreesCelciusPerKilometer = LapseRate.FromDegreesCelciusPerKilometer(2); + LapseRate oneDegreeCelsiusPerKilometer = LapseRate.FromDegreesCelciusPerKilometer(1); + LapseRate twoDegreesCelciusPerKilometer = LapseRate.FromDegreesCelciusPerKilometer(2); Assert.True(oneDegreeCelsiusPerKilometer < twoDegreesCelciusPerKilometer); Assert.True(oneDegreeCelsiusPerKilometer <= twoDegreesCelciusPerKilometer); @@ -142,31 +142,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); + LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); Assert.Equal(0, degreecelsiusperkilometer.CompareTo(degreecelsiusperkilometer)); - Assert.True(degreecelsiusperkilometer.CompareTo(LapseRate.Zero) > 0); - Assert.True(LapseRate.Zero.CompareTo(degreecelsiusperkilometer) < 0); + Assert.True(degreecelsiusperkilometer.CompareTo(LapseRate.Zero) > 0); + Assert.True(LapseRate.Zero.CompareTo(degreecelsiusperkilometer) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); + LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); Assert.Throws(() => degreecelsiusperkilometer.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); + LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); Assert.Throws(() => degreecelsiusperkilometer.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = LapseRate.FromDegreesCelciusPerKilometer(1); - var b = LapseRate.FromDegreesCelciusPerKilometer(2); + var a = LapseRate.FromDegreesCelciusPerKilometer(1); + var b = LapseRate.FromDegreesCelciusPerKilometer(2); // ReSharper disable EqualExpressionComparison @@ -185,8 +185,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = LapseRate.FromDegreesCelciusPerKilometer(1); - var b = LapseRate.FromDegreesCelciusPerKilometer(2); + var a = LapseRate.FromDegreesCelciusPerKilometer(1); + var b = LapseRate.FromDegreesCelciusPerKilometer(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -196,29 +196,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = LapseRate.FromDegreesCelciusPerKilometer(1); - Assert.True(v.Equals(LapseRate.FromDegreesCelciusPerKilometer(1), DegreesCelciusPerKilometerTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(LapseRate.Zero, DegreesCelciusPerKilometerTolerance, ComparisonType.Relative)); + var v = LapseRate.FromDegreesCelciusPerKilometer(1); + Assert.True(v.Equals(LapseRate.FromDegreesCelciusPerKilometer(1), DegreesCelciusPerKilometerTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(LapseRate.Zero, DegreesCelciusPerKilometerTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); + LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); Assert.False(degreecelsiusperkilometer.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); + LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); Assert.False(degreecelsiusperkilometer.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(LapseRateUnit.Undefined, LapseRate.Units); + Assert.DoesNotContain(LapseRateUnit.Undefined, LapseRate.Units); } [Fact] @@ -237,7 +237,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(LapseRate.BaseDimensions is null); + Assert.False(LapseRate.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs index 973c1fcafb..d64bf55b48 100644 --- a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs @@ -105,26 +105,26 @@ public abstract partial class LengthTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Length((double)0.0, LengthUnit.Undefined)); + Assert.Throws(() => new Length((double)0.0, LengthUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Length(double.PositiveInfinity, LengthUnit.Meter)); - Assert.Throws(() => new Length(double.NegativeInfinity, LengthUnit.Meter)); + Assert.Throws(() => new Length(double.PositiveInfinity, LengthUnit.Meter)); + Assert.Throws(() => new Length(double.NegativeInfinity, LengthUnit.Meter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Length(double.NaN, LengthUnit.Meter)); + Assert.Throws(() => new Length(double.NaN, LengthUnit.Meter)); } [Fact] public void MeterToLengthUnits() { - Length meter = Length.FromMeters(1); + Length meter = Length.FromMeters(1); AssertEx.EqualTolerance(AstronomicalUnitsInOneMeter, meter.AstronomicalUnits, AstronomicalUnitsTolerance); AssertEx.EqualTolerance(CentimetersInOneMeter, meter.Centimeters, CentimetersTolerance); AssertEx.EqualTolerance(DecimetersInOneMeter, meter.Decimeters, DecimetersTolerance); @@ -162,57 +162,57 @@ public void MeterToLengthUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.AstronomicalUnit).AstronomicalUnits, AstronomicalUnitsTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Centimeter).Centimeters, CentimetersTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Decimeter).Decimeters, DecimetersTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.DtpPica).DtpPicas, DtpPicasTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.DtpPoint).DtpPoints, DtpPointsTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Fathom).Fathoms, FathomsTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Foot).Feet, FeetTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Hand).Hands, HandsTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Hectometer).Hectometers, HectometersTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Inch).Inches, InchesTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.KilolightYear).KilolightYears, KilolightYearsTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Kilometer).Kilometers, KilometersTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Kiloparsec).Kiloparsecs, KiloparsecsTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.LightYear).LightYears, LightYearsTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.MegalightYear).MegalightYears, MegalightYearsTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Megaparsec).Megaparsecs, MegaparsecsTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Meter).Meters, MetersTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Microinch).Microinches, MicroinchesTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Micrometer).Micrometers, MicrometersTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Mil).Mils, MilsTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Mile).Miles, MilesTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Millimeter).Millimeters, MillimetersTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Nanometer).Nanometers, NanometersTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.NauticalMile).NauticalMiles, NauticalMilesTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Parsec).Parsecs, ParsecsTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.PrinterPica).PrinterPicas, PrinterPicasTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.PrinterPoint).PrinterPoints, PrinterPointsTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Shackle).Shackles, ShacklesTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.SolarRadius).SolarRadiuses, SolarRadiusesTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Twip).Twips, TwipsTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.UsSurveyFoot).UsSurveyFeet, UsSurveyFeetTolerance); - AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Yard).Yards, YardsTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.AstronomicalUnit).AstronomicalUnits, AstronomicalUnitsTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Centimeter).Centimeters, CentimetersTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Decimeter).Decimeters, DecimetersTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.DtpPica).DtpPicas, DtpPicasTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.DtpPoint).DtpPoints, DtpPointsTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Fathom).Fathoms, FathomsTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Foot).Feet, FeetTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Hand).Hands, HandsTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Hectometer).Hectometers, HectometersTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Inch).Inches, InchesTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.KilolightYear).KilolightYears, KilolightYearsTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Kilometer).Kilometers, KilometersTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Kiloparsec).Kiloparsecs, KiloparsecsTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.LightYear).LightYears, LightYearsTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.MegalightYear).MegalightYears, MegalightYearsTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Megaparsec).Megaparsecs, MegaparsecsTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Meter).Meters, MetersTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Microinch).Microinches, MicroinchesTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Micrometer).Micrometers, MicrometersTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Mil).Mils, MilsTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Mile).Miles, MilesTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Millimeter).Millimeters, MillimetersTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Nanometer).Nanometers, NanometersTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.NauticalMile).NauticalMiles, NauticalMilesTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Parsec).Parsecs, ParsecsTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.PrinterPica).PrinterPicas, PrinterPicasTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.PrinterPoint).PrinterPoints, PrinterPointsTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Shackle).Shackles, ShacklesTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.SolarRadius).SolarRadiuses, SolarRadiusesTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Twip).Twips, TwipsTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.UsSurveyFoot).UsSurveyFeet, UsSurveyFeetTolerance); + AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Yard).Yards, YardsTolerance); } [Fact] public void FromMeters_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Length.FromMeters(double.PositiveInfinity)); - Assert.Throws(() => Length.FromMeters(double.NegativeInfinity)); + Assert.Throws(() => Length.FromMeters(double.PositiveInfinity)); + Assert.Throws(() => Length.FromMeters(double.NegativeInfinity)); } [Fact] public void FromMeters_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Length.FromMeters(double.NaN)); + Assert.Throws(() => Length.FromMeters(double.NaN)); } [Fact] public void As() { - var meter = Length.FromMeters(1); + var meter = Length.FromMeters(1); AssertEx.EqualTolerance(AstronomicalUnitsInOneMeter, meter.As(LengthUnit.AstronomicalUnit), AstronomicalUnitsTolerance); AssertEx.EqualTolerance(CentimetersInOneMeter, meter.As(LengthUnit.Centimeter), CentimetersTolerance); AssertEx.EqualTolerance(DecimetersInOneMeter, meter.As(LengthUnit.Decimeter), DecimetersTolerance); @@ -250,7 +250,7 @@ public void As() [Fact] public void ToUnit() { - var meter = Length.FromMeters(1); + var meter = Length.FromMeters(1); var astronomicalunitQuantity = meter.ToUnit(LengthUnit.AstronomicalUnit); AssertEx.EqualTolerance(AstronomicalUnitsInOneMeter, (double)astronomicalunitQuantity.Value, AstronomicalUnitsTolerance); @@ -384,59 +384,59 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Length meter = Length.FromMeters(1); - AssertEx.EqualTolerance(1, Length.FromAstronomicalUnits(meter.AstronomicalUnits).Meters, AstronomicalUnitsTolerance); - AssertEx.EqualTolerance(1, Length.FromCentimeters(meter.Centimeters).Meters, CentimetersTolerance); - AssertEx.EqualTolerance(1, Length.FromDecimeters(meter.Decimeters).Meters, DecimetersTolerance); - AssertEx.EqualTolerance(1, Length.FromDtpPicas(meter.DtpPicas).Meters, DtpPicasTolerance); - AssertEx.EqualTolerance(1, Length.FromDtpPoints(meter.DtpPoints).Meters, DtpPointsTolerance); - AssertEx.EqualTolerance(1, Length.FromFathoms(meter.Fathoms).Meters, FathomsTolerance); - AssertEx.EqualTolerance(1, Length.FromFeet(meter.Feet).Meters, FeetTolerance); - AssertEx.EqualTolerance(1, Length.FromHands(meter.Hands).Meters, HandsTolerance); - AssertEx.EqualTolerance(1, Length.FromHectometers(meter.Hectometers).Meters, HectometersTolerance); - AssertEx.EqualTolerance(1, Length.FromInches(meter.Inches).Meters, InchesTolerance); - AssertEx.EqualTolerance(1, Length.FromKilolightYears(meter.KilolightYears).Meters, KilolightYearsTolerance); - AssertEx.EqualTolerance(1, Length.FromKilometers(meter.Kilometers).Meters, KilometersTolerance); - AssertEx.EqualTolerance(1, Length.FromKiloparsecs(meter.Kiloparsecs).Meters, KiloparsecsTolerance); - AssertEx.EqualTolerance(1, Length.FromLightYears(meter.LightYears).Meters, LightYearsTolerance); - AssertEx.EqualTolerance(1, Length.FromMegalightYears(meter.MegalightYears).Meters, MegalightYearsTolerance); - AssertEx.EqualTolerance(1, Length.FromMegaparsecs(meter.Megaparsecs).Meters, MegaparsecsTolerance); - AssertEx.EqualTolerance(1, Length.FromMeters(meter.Meters).Meters, MetersTolerance); - AssertEx.EqualTolerance(1, Length.FromMicroinches(meter.Microinches).Meters, MicroinchesTolerance); - AssertEx.EqualTolerance(1, Length.FromMicrometers(meter.Micrometers).Meters, MicrometersTolerance); - AssertEx.EqualTolerance(1, Length.FromMils(meter.Mils).Meters, MilsTolerance); - AssertEx.EqualTolerance(1, Length.FromMiles(meter.Miles).Meters, MilesTolerance); - AssertEx.EqualTolerance(1, Length.FromMillimeters(meter.Millimeters).Meters, MillimetersTolerance); - AssertEx.EqualTolerance(1, Length.FromNanometers(meter.Nanometers).Meters, NanometersTolerance); - AssertEx.EqualTolerance(1, Length.FromNauticalMiles(meter.NauticalMiles).Meters, NauticalMilesTolerance); - AssertEx.EqualTolerance(1, Length.FromParsecs(meter.Parsecs).Meters, ParsecsTolerance); - AssertEx.EqualTolerance(1, Length.FromPrinterPicas(meter.PrinterPicas).Meters, PrinterPicasTolerance); - AssertEx.EqualTolerance(1, Length.FromPrinterPoints(meter.PrinterPoints).Meters, PrinterPointsTolerance); - AssertEx.EqualTolerance(1, Length.FromShackles(meter.Shackles).Meters, ShacklesTolerance); - AssertEx.EqualTolerance(1, Length.FromSolarRadiuses(meter.SolarRadiuses).Meters, SolarRadiusesTolerance); - AssertEx.EqualTolerance(1, Length.FromTwips(meter.Twips).Meters, TwipsTolerance); - AssertEx.EqualTolerance(1, Length.FromUsSurveyFeet(meter.UsSurveyFeet).Meters, UsSurveyFeetTolerance); - AssertEx.EqualTolerance(1, Length.FromYards(meter.Yards).Meters, YardsTolerance); + Length meter = Length.FromMeters(1); + AssertEx.EqualTolerance(1, Length.FromAstronomicalUnits(meter.AstronomicalUnits).Meters, AstronomicalUnitsTolerance); + AssertEx.EqualTolerance(1, Length.FromCentimeters(meter.Centimeters).Meters, CentimetersTolerance); + AssertEx.EqualTolerance(1, Length.FromDecimeters(meter.Decimeters).Meters, DecimetersTolerance); + AssertEx.EqualTolerance(1, Length.FromDtpPicas(meter.DtpPicas).Meters, DtpPicasTolerance); + AssertEx.EqualTolerance(1, Length.FromDtpPoints(meter.DtpPoints).Meters, DtpPointsTolerance); + AssertEx.EqualTolerance(1, Length.FromFathoms(meter.Fathoms).Meters, FathomsTolerance); + AssertEx.EqualTolerance(1, Length.FromFeet(meter.Feet).Meters, FeetTolerance); + AssertEx.EqualTolerance(1, Length.FromHands(meter.Hands).Meters, HandsTolerance); + AssertEx.EqualTolerance(1, Length.FromHectometers(meter.Hectometers).Meters, HectometersTolerance); + AssertEx.EqualTolerance(1, Length.FromInches(meter.Inches).Meters, InchesTolerance); + AssertEx.EqualTolerance(1, Length.FromKilolightYears(meter.KilolightYears).Meters, KilolightYearsTolerance); + AssertEx.EqualTolerance(1, Length.FromKilometers(meter.Kilometers).Meters, KilometersTolerance); + AssertEx.EqualTolerance(1, Length.FromKiloparsecs(meter.Kiloparsecs).Meters, KiloparsecsTolerance); + AssertEx.EqualTolerance(1, Length.FromLightYears(meter.LightYears).Meters, LightYearsTolerance); + AssertEx.EqualTolerance(1, Length.FromMegalightYears(meter.MegalightYears).Meters, MegalightYearsTolerance); + AssertEx.EqualTolerance(1, Length.FromMegaparsecs(meter.Megaparsecs).Meters, MegaparsecsTolerance); + AssertEx.EqualTolerance(1, Length.FromMeters(meter.Meters).Meters, MetersTolerance); + AssertEx.EqualTolerance(1, Length.FromMicroinches(meter.Microinches).Meters, MicroinchesTolerance); + AssertEx.EqualTolerance(1, Length.FromMicrometers(meter.Micrometers).Meters, MicrometersTolerance); + AssertEx.EqualTolerance(1, Length.FromMils(meter.Mils).Meters, MilsTolerance); + AssertEx.EqualTolerance(1, Length.FromMiles(meter.Miles).Meters, MilesTolerance); + AssertEx.EqualTolerance(1, Length.FromMillimeters(meter.Millimeters).Meters, MillimetersTolerance); + AssertEx.EqualTolerance(1, Length.FromNanometers(meter.Nanometers).Meters, NanometersTolerance); + AssertEx.EqualTolerance(1, Length.FromNauticalMiles(meter.NauticalMiles).Meters, NauticalMilesTolerance); + AssertEx.EqualTolerance(1, Length.FromParsecs(meter.Parsecs).Meters, ParsecsTolerance); + AssertEx.EqualTolerance(1, Length.FromPrinterPicas(meter.PrinterPicas).Meters, PrinterPicasTolerance); + AssertEx.EqualTolerance(1, Length.FromPrinterPoints(meter.PrinterPoints).Meters, PrinterPointsTolerance); + AssertEx.EqualTolerance(1, Length.FromShackles(meter.Shackles).Meters, ShacklesTolerance); + AssertEx.EqualTolerance(1, Length.FromSolarRadiuses(meter.SolarRadiuses).Meters, SolarRadiusesTolerance); + AssertEx.EqualTolerance(1, Length.FromTwips(meter.Twips).Meters, TwipsTolerance); + AssertEx.EqualTolerance(1, Length.FromUsSurveyFeet(meter.UsSurveyFeet).Meters, UsSurveyFeetTolerance); + AssertEx.EqualTolerance(1, Length.FromYards(meter.Yards).Meters, YardsTolerance); } [Fact] public void ArithmeticOperators() { - Length v = Length.FromMeters(1); + Length v = Length.FromMeters(1); AssertEx.EqualTolerance(-1, -v.Meters, MetersTolerance); - AssertEx.EqualTolerance(2, (Length.FromMeters(3)-v).Meters, MetersTolerance); + AssertEx.EqualTolerance(2, (Length.FromMeters(3)-v).Meters, MetersTolerance); AssertEx.EqualTolerance(2, (v + v).Meters, MetersTolerance); AssertEx.EqualTolerance(10, (v*10).Meters, MetersTolerance); AssertEx.EqualTolerance(10, (10*v).Meters, MetersTolerance); - AssertEx.EqualTolerance(2, (Length.FromMeters(10)/5).Meters, MetersTolerance); - AssertEx.EqualTolerance(2, Length.FromMeters(10)/Length.FromMeters(5), MetersTolerance); + AssertEx.EqualTolerance(2, (Length.FromMeters(10)/5).Meters, MetersTolerance); + AssertEx.EqualTolerance(2, Length.FromMeters(10)/Length.FromMeters(5), MetersTolerance); } [Fact] public void ComparisonOperators() { - Length oneMeter = Length.FromMeters(1); - Length twoMeters = Length.FromMeters(2); + Length oneMeter = Length.FromMeters(1); + Length twoMeters = Length.FromMeters(2); Assert.True(oneMeter < twoMeters); Assert.True(oneMeter <= twoMeters); @@ -452,31 +452,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Length meter = Length.FromMeters(1); + Length meter = Length.FromMeters(1); Assert.Equal(0, meter.CompareTo(meter)); - Assert.True(meter.CompareTo(Length.Zero) > 0); - Assert.True(Length.Zero.CompareTo(meter) < 0); + Assert.True(meter.CompareTo(Length.Zero) > 0); + Assert.True(Length.Zero.CompareTo(meter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Length meter = Length.FromMeters(1); + Length meter = Length.FromMeters(1); Assert.Throws(() => meter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Length meter = Length.FromMeters(1); + Length meter = Length.FromMeters(1); Assert.Throws(() => meter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Length.FromMeters(1); - var b = Length.FromMeters(2); + var a = Length.FromMeters(1); + var b = Length.FromMeters(2); // ReSharper disable EqualExpressionComparison @@ -495,8 +495,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Length.FromMeters(1); - var b = Length.FromMeters(2); + var a = Length.FromMeters(1); + var b = Length.FromMeters(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -506,29 +506,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Length.FromMeters(1); - Assert.True(v.Equals(Length.FromMeters(1), MetersTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Length.Zero, MetersTolerance, ComparisonType.Relative)); + var v = Length.FromMeters(1); + Assert.True(v.Equals(Length.FromMeters(1), MetersTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Length.Zero, MetersTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Length meter = Length.FromMeters(1); + Length meter = Length.FromMeters(1); Assert.False(meter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Length meter = Length.FromMeters(1); + Length meter = Length.FromMeters(1); Assert.False(meter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(LengthUnit.Undefined, Length.Units); + Assert.DoesNotContain(LengthUnit.Undefined, Length.Units); } [Fact] @@ -547,7 +547,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Length.BaseDimensions is null); + Assert.False(Length.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs index a0bb62b88a..dc17386959 100644 --- a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Level. + /// Test of Level. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class LevelTestsBase @@ -45,26 +45,26 @@ public abstract partial class LevelTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Level((double)0.0, LevelUnit.Undefined)); + Assert.Throws(() => new Level((double)0.0, LevelUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Level(double.PositiveInfinity, LevelUnit.Decibel)); - Assert.Throws(() => new Level(double.NegativeInfinity, LevelUnit.Decibel)); + Assert.Throws(() => new Level(double.PositiveInfinity, LevelUnit.Decibel)); + Assert.Throws(() => new Level(double.NegativeInfinity, LevelUnit.Decibel)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Level(double.NaN, LevelUnit.Decibel)); + Assert.Throws(() => new Level(double.NaN, LevelUnit.Decibel)); } [Fact] public void DecibelToLevelUnits() { - Level decibel = Level.FromDecibels(1); + Level decibel = Level.FromDecibels(1); AssertEx.EqualTolerance(DecibelsInOneDecibel, decibel.Decibels, DecibelsTolerance); AssertEx.EqualTolerance(NepersInOneDecibel, decibel.Nepers, NepersTolerance); } @@ -72,27 +72,27 @@ public void DecibelToLevelUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Level.From(1, LevelUnit.Decibel).Decibels, DecibelsTolerance); - AssertEx.EqualTolerance(1, Level.From(1, LevelUnit.Neper).Nepers, NepersTolerance); + AssertEx.EqualTolerance(1, Level.From(1, LevelUnit.Decibel).Decibels, DecibelsTolerance); + AssertEx.EqualTolerance(1, Level.From(1, LevelUnit.Neper).Nepers, NepersTolerance); } [Fact] public void FromDecibels_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Level.FromDecibels(double.PositiveInfinity)); - Assert.Throws(() => Level.FromDecibels(double.NegativeInfinity)); + Assert.Throws(() => Level.FromDecibels(double.PositiveInfinity)); + Assert.Throws(() => Level.FromDecibels(double.NegativeInfinity)); } [Fact] public void FromDecibels_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Level.FromDecibels(double.NaN)); + Assert.Throws(() => Level.FromDecibels(double.NaN)); } [Fact] public void As() { - var decibel = Level.FromDecibels(1); + var decibel = Level.FromDecibels(1); AssertEx.EqualTolerance(DecibelsInOneDecibel, decibel.As(LevelUnit.Decibel), DecibelsTolerance); AssertEx.EqualTolerance(NepersInOneDecibel, decibel.As(LevelUnit.Neper), NepersTolerance); } @@ -100,7 +100,7 @@ public void As() [Fact] public void ToUnit() { - var decibel = Level.FromDecibels(1); + var decibel = Level.FromDecibels(1); var decibelQuantity = decibel.ToUnit(LevelUnit.Decibel); AssertEx.EqualTolerance(DecibelsInOneDecibel, (double)decibelQuantity.Value, DecibelsTolerance); @@ -114,22 +114,22 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Level decibel = Level.FromDecibels(1); - AssertEx.EqualTolerance(1, Level.FromDecibels(decibel.Decibels).Decibels, DecibelsTolerance); - AssertEx.EqualTolerance(1, Level.FromNepers(decibel.Nepers).Decibels, NepersTolerance); + Level decibel = Level.FromDecibels(1); + AssertEx.EqualTolerance(1, Level.FromDecibels(decibel.Decibels).Decibels, DecibelsTolerance); + AssertEx.EqualTolerance(1, Level.FromNepers(decibel.Nepers).Decibels, NepersTolerance); } [Fact] public void LogarithmicArithmeticOperators() { - Level v = Level.FromDecibels(40); + Level v = Level.FromDecibels(40); AssertEx.EqualTolerance(-40, -v.Decibels, NepersTolerance); AssertLogarithmicAddition(); AssertLogarithmicSubtraction(); AssertEx.EqualTolerance(50, (v*10).Decibels, NepersTolerance); AssertEx.EqualTolerance(50, (10*v).Decibels, NepersTolerance); AssertEx.EqualTolerance(35, (v/5).Decibels, NepersTolerance); - AssertEx.EqualTolerance(35, v/Level.FromDecibels(5), NepersTolerance); + AssertEx.EqualTolerance(35, v/Level.FromDecibels(5), NepersTolerance); } protected abstract void AssertLogarithmicAddition(); @@ -139,8 +139,8 @@ public void LogarithmicArithmeticOperators() [Fact] public void ComparisonOperators() { - Level oneDecibel = Level.FromDecibels(1); - Level twoDecibels = Level.FromDecibels(2); + Level oneDecibel = Level.FromDecibels(1); + Level twoDecibels = Level.FromDecibels(2); Assert.True(oneDecibel < twoDecibels); Assert.True(oneDecibel <= twoDecibels); @@ -156,31 +156,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Level decibel = Level.FromDecibels(1); + Level decibel = Level.FromDecibels(1); Assert.Equal(0, decibel.CompareTo(decibel)); - Assert.True(decibel.CompareTo(Level.Zero) > 0); - Assert.True(Level.Zero.CompareTo(decibel) < 0); + Assert.True(decibel.CompareTo(Level.Zero) > 0); + Assert.True(Level.Zero.CompareTo(decibel) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Level decibel = Level.FromDecibels(1); + Level decibel = Level.FromDecibels(1); Assert.Throws(() => decibel.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Level decibel = Level.FromDecibels(1); + Level decibel = Level.FromDecibels(1); Assert.Throws(() => decibel.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Level.FromDecibels(1); - var b = Level.FromDecibels(2); + var a = Level.FromDecibels(1); + var b = Level.FromDecibels(2); // ReSharper disable EqualExpressionComparison @@ -199,8 +199,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Level.FromDecibels(1); - var b = Level.FromDecibels(2); + var a = Level.FromDecibels(1); + var b = Level.FromDecibels(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -210,29 +210,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Level.FromDecibels(1); - Assert.True(v.Equals(Level.FromDecibels(1), DecibelsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Level.Zero, DecibelsTolerance, ComparisonType.Relative)); + var v = Level.FromDecibels(1); + Assert.True(v.Equals(Level.FromDecibels(1), DecibelsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Level.Zero, DecibelsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Level decibel = Level.FromDecibels(1); + Level decibel = Level.FromDecibels(1); Assert.False(decibel.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Level decibel = Level.FromDecibels(1); + Level decibel = Level.FromDecibels(1); Assert.False(decibel.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(LevelUnit.Undefined, Level.Units); + Assert.DoesNotContain(LevelUnit.Undefined, Level.Units); } [Fact] @@ -251,7 +251,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Level.BaseDimensions is null); + Assert.False(Level.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs index 025a7b033f..bc2b836994 100644 --- a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of LinearDensity. + /// Test of LinearDensity. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class LinearDensityTestsBase @@ -47,26 +47,26 @@ public abstract partial class LinearDensityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new LinearDensity((double)0.0, LinearDensityUnit.Undefined)); + Assert.Throws(() => new LinearDensity((double)0.0, LinearDensityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new LinearDensity(double.PositiveInfinity, LinearDensityUnit.KilogramPerMeter)); - Assert.Throws(() => new LinearDensity(double.NegativeInfinity, LinearDensityUnit.KilogramPerMeter)); + Assert.Throws(() => new LinearDensity(double.PositiveInfinity, LinearDensityUnit.KilogramPerMeter)); + Assert.Throws(() => new LinearDensity(double.NegativeInfinity, LinearDensityUnit.KilogramPerMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new LinearDensity(double.NaN, LinearDensityUnit.KilogramPerMeter)); + Assert.Throws(() => new LinearDensity(double.NaN, LinearDensityUnit.KilogramPerMeter)); } [Fact] public void KilogramPerMeterToLinearDensityUnits() { - LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); + LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); AssertEx.EqualTolerance(GramsPerMeterInOneKilogramPerMeter, kilogrampermeter.GramsPerMeter, GramsPerMeterTolerance); AssertEx.EqualTolerance(KilogramsPerMeterInOneKilogramPerMeter, kilogrampermeter.KilogramsPerMeter, KilogramsPerMeterTolerance); AssertEx.EqualTolerance(PoundsPerFootInOneKilogramPerMeter, kilogrampermeter.PoundsPerFoot, PoundsPerFootTolerance); @@ -75,28 +75,28 @@ public void KilogramPerMeterToLinearDensityUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, LinearDensity.From(1, LinearDensityUnit.GramPerMeter).GramsPerMeter, GramsPerMeterTolerance); - AssertEx.EqualTolerance(1, LinearDensity.From(1, LinearDensityUnit.KilogramPerMeter).KilogramsPerMeter, KilogramsPerMeterTolerance); - AssertEx.EqualTolerance(1, LinearDensity.From(1, LinearDensityUnit.PoundPerFoot).PoundsPerFoot, PoundsPerFootTolerance); + AssertEx.EqualTolerance(1, LinearDensity.From(1, LinearDensityUnit.GramPerMeter).GramsPerMeter, GramsPerMeterTolerance); + AssertEx.EqualTolerance(1, LinearDensity.From(1, LinearDensityUnit.KilogramPerMeter).KilogramsPerMeter, KilogramsPerMeterTolerance); + AssertEx.EqualTolerance(1, LinearDensity.From(1, LinearDensityUnit.PoundPerFoot).PoundsPerFoot, PoundsPerFootTolerance); } [Fact] public void FromKilogramsPerMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.PositiveInfinity)); - Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.NegativeInfinity)); + Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.PositiveInfinity)); + Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.NegativeInfinity)); } [Fact] public void FromKilogramsPerMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.NaN)); + Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.NaN)); } [Fact] public void As() { - var kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); + var kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); AssertEx.EqualTolerance(GramsPerMeterInOneKilogramPerMeter, kilogrampermeter.As(LinearDensityUnit.GramPerMeter), GramsPerMeterTolerance); AssertEx.EqualTolerance(KilogramsPerMeterInOneKilogramPerMeter, kilogrampermeter.As(LinearDensityUnit.KilogramPerMeter), KilogramsPerMeterTolerance); AssertEx.EqualTolerance(PoundsPerFootInOneKilogramPerMeter, kilogrampermeter.As(LinearDensityUnit.PoundPerFoot), PoundsPerFootTolerance); @@ -105,7 +105,7 @@ public void As() [Fact] public void ToUnit() { - var kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); + var kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); var grampermeterQuantity = kilogrampermeter.ToUnit(LinearDensityUnit.GramPerMeter); AssertEx.EqualTolerance(GramsPerMeterInOneKilogramPerMeter, (double)grampermeterQuantity.Value, GramsPerMeterTolerance); @@ -123,30 +123,30 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); - AssertEx.EqualTolerance(1, LinearDensity.FromGramsPerMeter(kilogrampermeter.GramsPerMeter).KilogramsPerMeter, GramsPerMeterTolerance); - AssertEx.EqualTolerance(1, LinearDensity.FromKilogramsPerMeter(kilogrampermeter.KilogramsPerMeter).KilogramsPerMeter, KilogramsPerMeterTolerance); - AssertEx.EqualTolerance(1, LinearDensity.FromPoundsPerFoot(kilogrampermeter.PoundsPerFoot).KilogramsPerMeter, PoundsPerFootTolerance); + LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); + AssertEx.EqualTolerance(1, LinearDensity.FromGramsPerMeter(kilogrampermeter.GramsPerMeter).KilogramsPerMeter, GramsPerMeterTolerance); + AssertEx.EqualTolerance(1, LinearDensity.FromKilogramsPerMeter(kilogrampermeter.KilogramsPerMeter).KilogramsPerMeter, KilogramsPerMeterTolerance); + AssertEx.EqualTolerance(1, LinearDensity.FromPoundsPerFoot(kilogrampermeter.PoundsPerFoot).KilogramsPerMeter, PoundsPerFootTolerance); } [Fact] public void ArithmeticOperators() { - LinearDensity v = LinearDensity.FromKilogramsPerMeter(1); + LinearDensity v = LinearDensity.FromKilogramsPerMeter(1); AssertEx.EqualTolerance(-1, -v.KilogramsPerMeter, KilogramsPerMeterTolerance); - AssertEx.EqualTolerance(2, (LinearDensity.FromKilogramsPerMeter(3)-v).KilogramsPerMeter, KilogramsPerMeterTolerance); + AssertEx.EqualTolerance(2, (LinearDensity.FromKilogramsPerMeter(3)-v).KilogramsPerMeter, KilogramsPerMeterTolerance); AssertEx.EqualTolerance(2, (v + v).KilogramsPerMeter, KilogramsPerMeterTolerance); AssertEx.EqualTolerance(10, (v*10).KilogramsPerMeter, KilogramsPerMeterTolerance); AssertEx.EqualTolerance(10, (10*v).KilogramsPerMeter, KilogramsPerMeterTolerance); - AssertEx.EqualTolerance(2, (LinearDensity.FromKilogramsPerMeter(10)/5).KilogramsPerMeter, KilogramsPerMeterTolerance); - AssertEx.EqualTolerance(2, LinearDensity.FromKilogramsPerMeter(10)/LinearDensity.FromKilogramsPerMeter(5), KilogramsPerMeterTolerance); + AssertEx.EqualTolerance(2, (LinearDensity.FromKilogramsPerMeter(10)/5).KilogramsPerMeter, KilogramsPerMeterTolerance); + AssertEx.EqualTolerance(2, LinearDensity.FromKilogramsPerMeter(10)/LinearDensity.FromKilogramsPerMeter(5), KilogramsPerMeterTolerance); } [Fact] public void ComparisonOperators() { - LinearDensity oneKilogramPerMeter = LinearDensity.FromKilogramsPerMeter(1); - LinearDensity twoKilogramsPerMeter = LinearDensity.FromKilogramsPerMeter(2); + LinearDensity oneKilogramPerMeter = LinearDensity.FromKilogramsPerMeter(1); + LinearDensity twoKilogramsPerMeter = LinearDensity.FromKilogramsPerMeter(2); Assert.True(oneKilogramPerMeter < twoKilogramsPerMeter); Assert.True(oneKilogramPerMeter <= twoKilogramsPerMeter); @@ -162,31 +162,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); + LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); Assert.Equal(0, kilogrampermeter.CompareTo(kilogrampermeter)); - Assert.True(kilogrampermeter.CompareTo(LinearDensity.Zero) > 0); - Assert.True(LinearDensity.Zero.CompareTo(kilogrampermeter) < 0); + Assert.True(kilogrampermeter.CompareTo(LinearDensity.Zero) > 0); + Assert.True(LinearDensity.Zero.CompareTo(kilogrampermeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); + LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); Assert.Throws(() => kilogrampermeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); + LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); Assert.Throws(() => kilogrampermeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = LinearDensity.FromKilogramsPerMeter(1); - var b = LinearDensity.FromKilogramsPerMeter(2); + var a = LinearDensity.FromKilogramsPerMeter(1); + var b = LinearDensity.FromKilogramsPerMeter(2); // ReSharper disable EqualExpressionComparison @@ -205,8 +205,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = LinearDensity.FromKilogramsPerMeter(1); - var b = LinearDensity.FromKilogramsPerMeter(2); + var a = LinearDensity.FromKilogramsPerMeter(1); + var b = LinearDensity.FromKilogramsPerMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -216,29 +216,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = LinearDensity.FromKilogramsPerMeter(1); - Assert.True(v.Equals(LinearDensity.FromKilogramsPerMeter(1), KilogramsPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(LinearDensity.Zero, KilogramsPerMeterTolerance, ComparisonType.Relative)); + var v = LinearDensity.FromKilogramsPerMeter(1); + Assert.True(v.Equals(LinearDensity.FromKilogramsPerMeter(1), KilogramsPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(LinearDensity.Zero, KilogramsPerMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); + LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); Assert.False(kilogrampermeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); + LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); Assert.False(kilogrampermeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(LinearDensityUnit.Undefined, LinearDensity.Units); + Assert.DoesNotContain(LinearDensityUnit.Undefined, LinearDensity.Units); } [Fact] @@ -257,7 +257,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(LinearDensity.BaseDimensions is null); + Assert.False(LinearDensity.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/LuminosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminosityTestsBase.g.cs index d179367255..7d52a193f9 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminosityTestsBase.g.cs @@ -69,26 +69,26 @@ public abstract partial class LuminosityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Luminosity((double)0.0, LuminosityUnit.Undefined)); + Assert.Throws(() => new Luminosity((double)0.0, LuminosityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Luminosity(double.PositiveInfinity, LuminosityUnit.Watt)); - Assert.Throws(() => new Luminosity(double.NegativeInfinity, LuminosityUnit.Watt)); + Assert.Throws(() => new Luminosity(double.PositiveInfinity, LuminosityUnit.Watt)); + Assert.Throws(() => new Luminosity(double.NegativeInfinity, LuminosityUnit.Watt)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Luminosity(double.NaN, LuminosityUnit.Watt)); + Assert.Throws(() => new Luminosity(double.NaN, LuminosityUnit.Watt)); } [Fact] public void WattToLuminosityUnits() { - Luminosity watt = Luminosity.FromWatts(1); + Luminosity watt = Luminosity.FromWatts(1); AssertEx.EqualTolerance(DecawattsInOneWatt, watt.Decawatts, DecawattsTolerance); AssertEx.EqualTolerance(DeciwattsInOneWatt, watt.Deciwatts, DeciwattsTolerance); AssertEx.EqualTolerance(FemtowattsInOneWatt, watt.Femtowatts, FemtowattsTolerance); @@ -108,39 +108,39 @@ public void WattToLuminosityUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Decawatt).Decawatts, DecawattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Deciwatt).Deciwatts, DeciwattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Femtowatt).Femtowatts, FemtowattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Gigawatt).Gigawatts, GigawattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Kilowatt).Kilowatts, KilowattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Megawatt).Megawatts, MegawattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Microwatt).Microwatts, MicrowattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Milliwatt).Milliwatts, MilliwattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Nanowatt).Nanowatts, NanowattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Petawatt).Petawatts, PetawattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Picowatt).Picowatts, PicowattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.SolarLuminosity).SolarLuminosities, SolarLuminositiesTolerance); - AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Terawatt).Terawatts, TerawattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Watt).Watts, WattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Decawatt).Decawatts, DecawattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Deciwatt).Deciwatts, DeciwattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Femtowatt).Femtowatts, FemtowattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Gigawatt).Gigawatts, GigawattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Kilowatt).Kilowatts, KilowattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Megawatt).Megawatts, MegawattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Microwatt).Microwatts, MicrowattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Milliwatt).Milliwatts, MilliwattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Nanowatt).Nanowatts, NanowattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Petawatt).Petawatts, PetawattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Picowatt).Picowatts, PicowattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.SolarLuminosity).SolarLuminosities, SolarLuminositiesTolerance); + AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Terawatt).Terawatts, TerawattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.From(1, LuminosityUnit.Watt).Watts, WattsTolerance); } [Fact] public void FromWatts_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Luminosity.FromWatts(double.PositiveInfinity)); - Assert.Throws(() => Luminosity.FromWatts(double.NegativeInfinity)); + Assert.Throws(() => Luminosity.FromWatts(double.PositiveInfinity)); + Assert.Throws(() => Luminosity.FromWatts(double.NegativeInfinity)); } [Fact] public void FromWatts_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Luminosity.FromWatts(double.NaN)); + Assert.Throws(() => Luminosity.FromWatts(double.NaN)); } [Fact] public void As() { - var watt = Luminosity.FromWatts(1); + var watt = Luminosity.FromWatts(1); AssertEx.EqualTolerance(DecawattsInOneWatt, watt.As(LuminosityUnit.Decawatt), DecawattsTolerance); AssertEx.EqualTolerance(DeciwattsInOneWatt, watt.As(LuminosityUnit.Deciwatt), DeciwattsTolerance); AssertEx.EqualTolerance(FemtowattsInOneWatt, watt.As(LuminosityUnit.Femtowatt), FemtowattsTolerance); @@ -160,7 +160,7 @@ public void As() [Fact] public void ToUnit() { - var watt = Luminosity.FromWatts(1); + var watt = Luminosity.FromWatts(1); var decawattQuantity = watt.ToUnit(LuminosityUnit.Decawatt); AssertEx.EqualTolerance(DecawattsInOneWatt, (double)decawattQuantity.Value, DecawattsTolerance); @@ -222,41 +222,41 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Luminosity watt = Luminosity.FromWatts(1); - AssertEx.EqualTolerance(1, Luminosity.FromDecawatts(watt.Decawatts).Watts, DecawattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.FromDeciwatts(watt.Deciwatts).Watts, DeciwattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.FromFemtowatts(watt.Femtowatts).Watts, FemtowattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.FromGigawatts(watt.Gigawatts).Watts, GigawattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.FromKilowatts(watt.Kilowatts).Watts, KilowattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.FromMegawatts(watt.Megawatts).Watts, MegawattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.FromMicrowatts(watt.Microwatts).Watts, MicrowattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.FromMilliwatts(watt.Milliwatts).Watts, MilliwattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.FromNanowatts(watt.Nanowatts).Watts, NanowattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.FromPetawatts(watt.Petawatts).Watts, PetawattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.FromPicowatts(watt.Picowatts).Watts, PicowattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.FromSolarLuminosities(watt.SolarLuminosities).Watts, SolarLuminositiesTolerance); - AssertEx.EqualTolerance(1, Luminosity.FromTerawatts(watt.Terawatts).Watts, TerawattsTolerance); - AssertEx.EqualTolerance(1, Luminosity.FromWatts(watt.Watts).Watts, WattsTolerance); + Luminosity watt = Luminosity.FromWatts(1); + AssertEx.EqualTolerance(1, Luminosity.FromDecawatts(watt.Decawatts).Watts, DecawattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.FromDeciwatts(watt.Deciwatts).Watts, DeciwattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.FromFemtowatts(watt.Femtowatts).Watts, FemtowattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.FromGigawatts(watt.Gigawatts).Watts, GigawattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.FromKilowatts(watt.Kilowatts).Watts, KilowattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.FromMegawatts(watt.Megawatts).Watts, MegawattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.FromMicrowatts(watt.Microwatts).Watts, MicrowattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.FromMilliwatts(watt.Milliwatts).Watts, MilliwattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.FromNanowatts(watt.Nanowatts).Watts, NanowattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.FromPetawatts(watt.Petawatts).Watts, PetawattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.FromPicowatts(watt.Picowatts).Watts, PicowattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.FromSolarLuminosities(watt.SolarLuminosities).Watts, SolarLuminositiesTolerance); + AssertEx.EqualTolerance(1, Luminosity.FromTerawatts(watt.Terawatts).Watts, TerawattsTolerance); + AssertEx.EqualTolerance(1, Luminosity.FromWatts(watt.Watts).Watts, WattsTolerance); } [Fact] public void ArithmeticOperators() { - Luminosity v = Luminosity.FromWatts(1); + Luminosity v = Luminosity.FromWatts(1); AssertEx.EqualTolerance(-1, -v.Watts, WattsTolerance); - AssertEx.EqualTolerance(2, (Luminosity.FromWatts(3)-v).Watts, WattsTolerance); + AssertEx.EqualTolerance(2, (Luminosity.FromWatts(3)-v).Watts, WattsTolerance); AssertEx.EqualTolerance(2, (v + v).Watts, WattsTolerance); AssertEx.EqualTolerance(10, (v*10).Watts, WattsTolerance); AssertEx.EqualTolerance(10, (10*v).Watts, WattsTolerance); - AssertEx.EqualTolerance(2, (Luminosity.FromWatts(10)/5).Watts, WattsTolerance); - AssertEx.EqualTolerance(2, Luminosity.FromWatts(10)/Luminosity.FromWatts(5), WattsTolerance); + AssertEx.EqualTolerance(2, (Luminosity.FromWatts(10)/5).Watts, WattsTolerance); + AssertEx.EqualTolerance(2, Luminosity.FromWatts(10)/Luminosity.FromWatts(5), WattsTolerance); } [Fact] public void ComparisonOperators() { - Luminosity oneWatt = Luminosity.FromWatts(1); - Luminosity twoWatts = Luminosity.FromWatts(2); + Luminosity oneWatt = Luminosity.FromWatts(1); + Luminosity twoWatts = Luminosity.FromWatts(2); Assert.True(oneWatt < twoWatts); Assert.True(oneWatt <= twoWatts); @@ -272,31 +272,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Luminosity watt = Luminosity.FromWatts(1); + Luminosity watt = Luminosity.FromWatts(1); Assert.Equal(0, watt.CompareTo(watt)); - Assert.True(watt.CompareTo(Luminosity.Zero) > 0); - Assert.True(Luminosity.Zero.CompareTo(watt) < 0); + Assert.True(watt.CompareTo(Luminosity.Zero) > 0); + Assert.True(Luminosity.Zero.CompareTo(watt) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Luminosity watt = Luminosity.FromWatts(1); + Luminosity watt = Luminosity.FromWatts(1); Assert.Throws(() => watt.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Luminosity watt = Luminosity.FromWatts(1); + Luminosity watt = Luminosity.FromWatts(1); Assert.Throws(() => watt.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Luminosity.FromWatts(1); - var b = Luminosity.FromWatts(2); + var a = Luminosity.FromWatts(1); + var b = Luminosity.FromWatts(2); // ReSharper disable EqualExpressionComparison @@ -315,8 +315,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Luminosity.FromWatts(1); - var b = Luminosity.FromWatts(2); + var a = Luminosity.FromWatts(1); + var b = Luminosity.FromWatts(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -326,29 +326,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Luminosity.FromWatts(1); - Assert.True(v.Equals(Luminosity.FromWatts(1), WattsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Luminosity.Zero, WattsTolerance, ComparisonType.Relative)); + var v = Luminosity.FromWatts(1); + Assert.True(v.Equals(Luminosity.FromWatts(1), WattsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Luminosity.Zero, WattsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Luminosity watt = Luminosity.FromWatts(1); + Luminosity watt = Luminosity.FromWatts(1); Assert.False(watt.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Luminosity watt = Luminosity.FromWatts(1); + Luminosity watt = Luminosity.FromWatts(1); Assert.False(watt.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(LuminosityUnit.Undefined, Luminosity.Units); + Assert.DoesNotContain(LuminosityUnit.Undefined, Luminosity.Units); } [Fact] @@ -367,7 +367,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Luminosity.BaseDimensions is null); + Assert.False(Luminosity.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs index f2e6fec8b4..852c12f0a4 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs @@ -43,59 +43,59 @@ public abstract partial class LuminousFluxTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new LuminousFlux((double)0.0, LuminousFluxUnit.Undefined)); + Assert.Throws(() => new LuminousFlux((double)0.0, LuminousFluxUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new LuminousFlux(double.PositiveInfinity, LuminousFluxUnit.Lumen)); - Assert.Throws(() => new LuminousFlux(double.NegativeInfinity, LuminousFluxUnit.Lumen)); + Assert.Throws(() => new LuminousFlux(double.PositiveInfinity, LuminousFluxUnit.Lumen)); + Assert.Throws(() => new LuminousFlux(double.NegativeInfinity, LuminousFluxUnit.Lumen)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new LuminousFlux(double.NaN, LuminousFluxUnit.Lumen)); + Assert.Throws(() => new LuminousFlux(double.NaN, LuminousFluxUnit.Lumen)); } [Fact] public void LumenToLuminousFluxUnits() { - LuminousFlux lumen = LuminousFlux.FromLumens(1); + LuminousFlux lumen = LuminousFlux.FromLumens(1); AssertEx.EqualTolerance(LumensInOneLumen, lumen.Lumens, LumensTolerance); } [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, LuminousFlux.From(1, LuminousFluxUnit.Lumen).Lumens, LumensTolerance); + AssertEx.EqualTolerance(1, LuminousFlux.From(1, LuminousFluxUnit.Lumen).Lumens, LumensTolerance); } [Fact] public void FromLumens_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => LuminousFlux.FromLumens(double.PositiveInfinity)); - Assert.Throws(() => LuminousFlux.FromLumens(double.NegativeInfinity)); + Assert.Throws(() => LuminousFlux.FromLumens(double.PositiveInfinity)); + Assert.Throws(() => LuminousFlux.FromLumens(double.NegativeInfinity)); } [Fact] public void FromLumens_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => LuminousFlux.FromLumens(double.NaN)); + Assert.Throws(() => LuminousFlux.FromLumens(double.NaN)); } [Fact] public void As() { - var lumen = LuminousFlux.FromLumens(1); + var lumen = LuminousFlux.FromLumens(1); AssertEx.EqualTolerance(LumensInOneLumen, lumen.As(LuminousFluxUnit.Lumen), LumensTolerance); } [Fact] public void ToUnit() { - var lumen = LuminousFlux.FromLumens(1); + var lumen = LuminousFlux.FromLumens(1); var lumenQuantity = lumen.ToUnit(LuminousFluxUnit.Lumen); AssertEx.EqualTolerance(LumensInOneLumen, (double)lumenQuantity.Value, LumensTolerance); @@ -105,28 +105,28 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - LuminousFlux lumen = LuminousFlux.FromLumens(1); - AssertEx.EqualTolerance(1, LuminousFlux.FromLumens(lumen.Lumens).Lumens, LumensTolerance); + LuminousFlux lumen = LuminousFlux.FromLumens(1); + AssertEx.EqualTolerance(1, LuminousFlux.FromLumens(lumen.Lumens).Lumens, LumensTolerance); } [Fact] public void ArithmeticOperators() { - LuminousFlux v = LuminousFlux.FromLumens(1); + LuminousFlux v = LuminousFlux.FromLumens(1); AssertEx.EqualTolerance(-1, -v.Lumens, LumensTolerance); - AssertEx.EqualTolerance(2, (LuminousFlux.FromLumens(3)-v).Lumens, LumensTolerance); + AssertEx.EqualTolerance(2, (LuminousFlux.FromLumens(3)-v).Lumens, LumensTolerance); AssertEx.EqualTolerance(2, (v + v).Lumens, LumensTolerance); AssertEx.EqualTolerance(10, (v*10).Lumens, LumensTolerance); AssertEx.EqualTolerance(10, (10*v).Lumens, LumensTolerance); - AssertEx.EqualTolerance(2, (LuminousFlux.FromLumens(10)/5).Lumens, LumensTolerance); - AssertEx.EqualTolerance(2, LuminousFlux.FromLumens(10)/LuminousFlux.FromLumens(5), LumensTolerance); + AssertEx.EqualTolerance(2, (LuminousFlux.FromLumens(10)/5).Lumens, LumensTolerance); + AssertEx.EqualTolerance(2, LuminousFlux.FromLumens(10)/LuminousFlux.FromLumens(5), LumensTolerance); } [Fact] public void ComparisonOperators() { - LuminousFlux oneLumen = LuminousFlux.FromLumens(1); - LuminousFlux twoLumens = LuminousFlux.FromLumens(2); + LuminousFlux oneLumen = LuminousFlux.FromLumens(1); + LuminousFlux twoLumens = LuminousFlux.FromLumens(2); Assert.True(oneLumen < twoLumens); Assert.True(oneLumen <= twoLumens); @@ -142,31 +142,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - LuminousFlux lumen = LuminousFlux.FromLumens(1); + LuminousFlux lumen = LuminousFlux.FromLumens(1); Assert.Equal(0, lumen.CompareTo(lumen)); - Assert.True(lumen.CompareTo(LuminousFlux.Zero) > 0); - Assert.True(LuminousFlux.Zero.CompareTo(lumen) < 0); + Assert.True(lumen.CompareTo(LuminousFlux.Zero) > 0); + Assert.True(LuminousFlux.Zero.CompareTo(lumen) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - LuminousFlux lumen = LuminousFlux.FromLumens(1); + LuminousFlux lumen = LuminousFlux.FromLumens(1); Assert.Throws(() => lumen.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - LuminousFlux lumen = LuminousFlux.FromLumens(1); + LuminousFlux lumen = LuminousFlux.FromLumens(1); Assert.Throws(() => lumen.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = LuminousFlux.FromLumens(1); - var b = LuminousFlux.FromLumens(2); + var a = LuminousFlux.FromLumens(1); + var b = LuminousFlux.FromLumens(2); // ReSharper disable EqualExpressionComparison @@ -185,8 +185,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = LuminousFlux.FromLumens(1); - var b = LuminousFlux.FromLumens(2); + var a = LuminousFlux.FromLumens(1); + var b = LuminousFlux.FromLumens(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -196,29 +196,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = LuminousFlux.FromLumens(1); - Assert.True(v.Equals(LuminousFlux.FromLumens(1), LumensTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(LuminousFlux.Zero, LumensTolerance, ComparisonType.Relative)); + var v = LuminousFlux.FromLumens(1); + Assert.True(v.Equals(LuminousFlux.FromLumens(1), LumensTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(LuminousFlux.Zero, LumensTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - LuminousFlux lumen = LuminousFlux.FromLumens(1); + LuminousFlux lumen = LuminousFlux.FromLumens(1); Assert.False(lumen.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - LuminousFlux lumen = LuminousFlux.FromLumens(1); + LuminousFlux lumen = LuminousFlux.FromLumens(1); Assert.False(lumen.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(LuminousFluxUnit.Undefined, LuminousFlux.Units); + Assert.DoesNotContain(LuminousFluxUnit.Undefined, LuminousFlux.Units); } [Fact] @@ -237,7 +237,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(LuminousFlux.BaseDimensions is null); + Assert.False(LuminousFlux.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs index a5b5b6c353..9f6b26e5be 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs @@ -43,59 +43,59 @@ public abstract partial class LuminousIntensityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new LuminousIntensity((double)0.0, LuminousIntensityUnit.Undefined)); + Assert.Throws(() => new LuminousIntensity((double)0.0, LuminousIntensityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new LuminousIntensity(double.PositiveInfinity, LuminousIntensityUnit.Candela)); - Assert.Throws(() => new LuminousIntensity(double.NegativeInfinity, LuminousIntensityUnit.Candela)); + Assert.Throws(() => new LuminousIntensity(double.PositiveInfinity, LuminousIntensityUnit.Candela)); + Assert.Throws(() => new LuminousIntensity(double.NegativeInfinity, LuminousIntensityUnit.Candela)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new LuminousIntensity(double.NaN, LuminousIntensityUnit.Candela)); + Assert.Throws(() => new LuminousIntensity(double.NaN, LuminousIntensityUnit.Candela)); } [Fact] public void CandelaToLuminousIntensityUnits() { - LuminousIntensity candela = LuminousIntensity.FromCandela(1); + LuminousIntensity candela = LuminousIntensity.FromCandela(1); AssertEx.EqualTolerance(CandelaInOneCandela, candela.Candela, CandelaTolerance); } [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, LuminousIntensity.From(1, LuminousIntensityUnit.Candela).Candela, CandelaTolerance); + AssertEx.EqualTolerance(1, LuminousIntensity.From(1, LuminousIntensityUnit.Candela).Candela, CandelaTolerance); } [Fact] public void FromCandela_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => LuminousIntensity.FromCandela(double.PositiveInfinity)); - Assert.Throws(() => LuminousIntensity.FromCandela(double.NegativeInfinity)); + Assert.Throws(() => LuminousIntensity.FromCandela(double.PositiveInfinity)); + Assert.Throws(() => LuminousIntensity.FromCandela(double.NegativeInfinity)); } [Fact] public void FromCandela_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => LuminousIntensity.FromCandela(double.NaN)); + Assert.Throws(() => LuminousIntensity.FromCandela(double.NaN)); } [Fact] public void As() { - var candela = LuminousIntensity.FromCandela(1); + var candela = LuminousIntensity.FromCandela(1); AssertEx.EqualTolerance(CandelaInOneCandela, candela.As(LuminousIntensityUnit.Candela), CandelaTolerance); } [Fact] public void ToUnit() { - var candela = LuminousIntensity.FromCandela(1); + var candela = LuminousIntensity.FromCandela(1); var candelaQuantity = candela.ToUnit(LuminousIntensityUnit.Candela); AssertEx.EqualTolerance(CandelaInOneCandela, (double)candelaQuantity.Value, CandelaTolerance); @@ -105,28 +105,28 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - LuminousIntensity candela = LuminousIntensity.FromCandela(1); - AssertEx.EqualTolerance(1, LuminousIntensity.FromCandela(candela.Candela).Candela, CandelaTolerance); + LuminousIntensity candela = LuminousIntensity.FromCandela(1); + AssertEx.EqualTolerance(1, LuminousIntensity.FromCandela(candela.Candela).Candela, CandelaTolerance); } [Fact] public void ArithmeticOperators() { - LuminousIntensity v = LuminousIntensity.FromCandela(1); + LuminousIntensity v = LuminousIntensity.FromCandela(1); AssertEx.EqualTolerance(-1, -v.Candela, CandelaTolerance); - AssertEx.EqualTolerance(2, (LuminousIntensity.FromCandela(3)-v).Candela, CandelaTolerance); + AssertEx.EqualTolerance(2, (LuminousIntensity.FromCandela(3)-v).Candela, CandelaTolerance); AssertEx.EqualTolerance(2, (v + v).Candela, CandelaTolerance); AssertEx.EqualTolerance(10, (v*10).Candela, CandelaTolerance); AssertEx.EqualTolerance(10, (10*v).Candela, CandelaTolerance); - AssertEx.EqualTolerance(2, (LuminousIntensity.FromCandela(10)/5).Candela, CandelaTolerance); - AssertEx.EqualTolerance(2, LuminousIntensity.FromCandela(10)/LuminousIntensity.FromCandela(5), CandelaTolerance); + AssertEx.EqualTolerance(2, (LuminousIntensity.FromCandela(10)/5).Candela, CandelaTolerance); + AssertEx.EqualTolerance(2, LuminousIntensity.FromCandela(10)/LuminousIntensity.FromCandela(5), CandelaTolerance); } [Fact] public void ComparisonOperators() { - LuminousIntensity oneCandela = LuminousIntensity.FromCandela(1); - LuminousIntensity twoCandela = LuminousIntensity.FromCandela(2); + LuminousIntensity oneCandela = LuminousIntensity.FromCandela(1); + LuminousIntensity twoCandela = LuminousIntensity.FromCandela(2); Assert.True(oneCandela < twoCandela); Assert.True(oneCandela <= twoCandela); @@ -142,31 +142,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - LuminousIntensity candela = LuminousIntensity.FromCandela(1); + LuminousIntensity candela = LuminousIntensity.FromCandela(1); Assert.Equal(0, candela.CompareTo(candela)); - Assert.True(candela.CompareTo(LuminousIntensity.Zero) > 0); - Assert.True(LuminousIntensity.Zero.CompareTo(candela) < 0); + Assert.True(candela.CompareTo(LuminousIntensity.Zero) > 0); + Assert.True(LuminousIntensity.Zero.CompareTo(candela) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - LuminousIntensity candela = LuminousIntensity.FromCandela(1); + LuminousIntensity candela = LuminousIntensity.FromCandela(1); Assert.Throws(() => candela.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - LuminousIntensity candela = LuminousIntensity.FromCandela(1); + LuminousIntensity candela = LuminousIntensity.FromCandela(1); Assert.Throws(() => candela.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = LuminousIntensity.FromCandela(1); - var b = LuminousIntensity.FromCandela(2); + var a = LuminousIntensity.FromCandela(1); + var b = LuminousIntensity.FromCandela(2); // ReSharper disable EqualExpressionComparison @@ -185,8 +185,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = LuminousIntensity.FromCandela(1); - var b = LuminousIntensity.FromCandela(2); + var a = LuminousIntensity.FromCandela(1); + var b = LuminousIntensity.FromCandela(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -196,29 +196,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = LuminousIntensity.FromCandela(1); - Assert.True(v.Equals(LuminousIntensity.FromCandela(1), CandelaTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(LuminousIntensity.Zero, CandelaTolerance, ComparisonType.Relative)); + var v = LuminousIntensity.FromCandela(1); + Assert.True(v.Equals(LuminousIntensity.FromCandela(1), CandelaTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(LuminousIntensity.Zero, CandelaTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - LuminousIntensity candela = LuminousIntensity.FromCandela(1); + LuminousIntensity candela = LuminousIntensity.FromCandela(1); Assert.False(candela.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - LuminousIntensity candela = LuminousIntensity.FromCandela(1); + LuminousIntensity candela = LuminousIntensity.FromCandela(1); Assert.False(candela.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(LuminousIntensityUnit.Undefined, LuminousIntensity.Units); + Assert.DoesNotContain(LuminousIntensityUnit.Undefined, LuminousIntensity.Units); } [Fact] @@ -237,7 +237,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(LuminousIntensity.BaseDimensions is null); + Assert.False(LuminousIntensity.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs index 5a737e0d43..0067049bda 100644 --- a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs @@ -49,26 +49,26 @@ public abstract partial class MagneticFieldTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new MagneticField((double)0.0, MagneticFieldUnit.Undefined)); + Assert.Throws(() => new MagneticField((double)0.0, MagneticFieldUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new MagneticField(double.PositiveInfinity, MagneticFieldUnit.Tesla)); - Assert.Throws(() => new MagneticField(double.NegativeInfinity, MagneticFieldUnit.Tesla)); + Assert.Throws(() => new MagneticField(double.PositiveInfinity, MagneticFieldUnit.Tesla)); + Assert.Throws(() => new MagneticField(double.NegativeInfinity, MagneticFieldUnit.Tesla)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new MagneticField(double.NaN, MagneticFieldUnit.Tesla)); + Assert.Throws(() => new MagneticField(double.NaN, MagneticFieldUnit.Tesla)); } [Fact] public void TeslaToMagneticFieldUnits() { - MagneticField tesla = MagneticField.FromTeslas(1); + MagneticField tesla = MagneticField.FromTeslas(1); AssertEx.EqualTolerance(MicroteslasInOneTesla, tesla.Microteslas, MicroteslasTolerance); AssertEx.EqualTolerance(MilliteslasInOneTesla, tesla.Milliteslas, MilliteslasTolerance); AssertEx.EqualTolerance(NanoteslasInOneTesla, tesla.Nanoteslas, NanoteslasTolerance); @@ -78,29 +78,29 @@ public void TeslaToMagneticFieldUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, MagneticField.From(1, MagneticFieldUnit.Microtesla).Microteslas, MicroteslasTolerance); - AssertEx.EqualTolerance(1, MagneticField.From(1, MagneticFieldUnit.Millitesla).Milliteslas, MilliteslasTolerance); - AssertEx.EqualTolerance(1, MagneticField.From(1, MagneticFieldUnit.Nanotesla).Nanoteslas, NanoteslasTolerance); - AssertEx.EqualTolerance(1, MagneticField.From(1, MagneticFieldUnit.Tesla).Teslas, TeslasTolerance); + AssertEx.EqualTolerance(1, MagneticField.From(1, MagneticFieldUnit.Microtesla).Microteslas, MicroteslasTolerance); + AssertEx.EqualTolerance(1, MagneticField.From(1, MagneticFieldUnit.Millitesla).Milliteslas, MilliteslasTolerance); + AssertEx.EqualTolerance(1, MagneticField.From(1, MagneticFieldUnit.Nanotesla).Nanoteslas, NanoteslasTolerance); + AssertEx.EqualTolerance(1, MagneticField.From(1, MagneticFieldUnit.Tesla).Teslas, TeslasTolerance); } [Fact] public void FromTeslas_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => MagneticField.FromTeslas(double.PositiveInfinity)); - Assert.Throws(() => MagneticField.FromTeslas(double.NegativeInfinity)); + Assert.Throws(() => MagneticField.FromTeslas(double.PositiveInfinity)); + Assert.Throws(() => MagneticField.FromTeslas(double.NegativeInfinity)); } [Fact] public void FromTeslas_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => MagneticField.FromTeslas(double.NaN)); + Assert.Throws(() => MagneticField.FromTeslas(double.NaN)); } [Fact] public void As() { - var tesla = MagneticField.FromTeslas(1); + var tesla = MagneticField.FromTeslas(1); AssertEx.EqualTolerance(MicroteslasInOneTesla, tesla.As(MagneticFieldUnit.Microtesla), MicroteslasTolerance); AssertEx.EqualTolerance(MilliteslasInOneTesla, tesla.As(MagneticFieldUnit.Millitesla), MilliteslasTolerance); AssertEx.EqualTolerance(NanoteslasInOneTesla, tesla.As(MagneticFieldUnit.Nanotesla), NanoteslasTolerance); @@ -110,7 +110,7 @@ public void As() [Fact] public void ToUnit() { - var tesla = MagneticField.FromTeslas(1); + var tesla = MagneticField.FromTeslas(1); var microteslaQuantity = tesla.ToUnit(MagneticFieldUnit.Microtesla); AssertEx.EqualTolerance(MicroteslasInOneTesla, (double)microteslaQuantity.Value, MicroteslasTolerance); @@ -132,31 +132,31 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - MagneticField tesla = MagneticField.FromTeslas(1); - AssertEx.EqualTolerance(1, MagneticField.FromMicroteslas(tesla.Microteslas).Teslas, MicroteslasTolerance); - AssertEx.EqualTolerance(1, MagneticField.FromMilliteslas(tesla.Milliteslas).Teslas, MilliteslasTolerance); - AssertEx.EqualTolerance(1, MagneticField.FromNanoteslas(tesla.Nanoteslas).Teslas, NanoteslasTolerance); - AssertEx.EqualTolerance(1, MagneticField.FromTeslas(tesla.Teslas).Teslas, TeslasTolerance); + MagneticField tesla = MagneticField.FromTeslas(1); + AssertEx.EqualTolerance(1, MagneticField.FromMicroteslas(tesla.Microteslas).Teslas, MicroteslasTolerance); + AssertEx.EqualTolerance(1, MagneticField.FromMilliteslas(tesla.Milliteslas).Teslas, MilliteslasTolerance); + AssertEx.EqualTolerance(1, MagneticField.FromNanoteslas(tesla.Nanoteslas).Teslas, NanoteslasTolerance); + AssertEx.EqualTolerance(1, MagneticField.FromTeslas(tesla.Teslas).Teslas, TeslasTolerance); } [Fact] public void ArithmeticOperators() { - MagneticField v = MagneticField.FromTeslas(1); + MagneticField v = MagneticField.FromTeslas(1); AssertEx.EqualTolerance(-1, -v.Teslas, TeslasTolerance); - AssertEx.EqualTolerance(2, (MagneticField.FromTeslas(3)-v).Teslas, TeslasTolerance); + AssertEx.EqualTolerance(2, (MagneticField.FromTeslas(3)-v).Teslas, TeslasTolerance); AssertEx.EqualTolerance(2, (v + v).Teslas, TeslasTolerance); AssertEx.EqualTolerance(10, (v*10).Teslas, TeslasTolerance); AssertEx.EqualTolerance(10, (10*v).Teslas, TeslasTolerance); - AssertEx.EqualTolerance(2, (MagneticField.FromTeslas(10)/5).Teslas, TeslasTolerance); - AssertEx.EqualTolerance(2, MagneticField.FromTeslas(10)/MagneticField.FromTeslas(5), TeslasTolerance); + AssertEx.EqualTolerance(2, (MagneticField.FromTeslas(10)/5).Teslas, TeslasTolerance); + AssertEx.EqualTolerance(2, MagneticField.FromTeslas(10)/MagneticField.FromTeslas(5), TeslasTolerance); } [Fact] public void ComparisonOperators() { - MagneticField oneTesla = MagneticField.FromTeslas(1); - MagneticField twoTeslas = MagneticField.FromTeslas(2); + MagneticField oneTesla = MagneticField.FromTeslas(1); + MagneticField twoTeslas = MagneticField.FromTeslas(2); Assert.True(oneTesla < twoTeslas); Assert.True(oneTesla <= twoTeslas); @@ -172,31 +172,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - MagneticField tesla = MagneticField.FromTeslas(1); + MagneticField tesla = MagneticField.FromTeslas(1); Assert.Equal(0, tesla.CompareTo(tesla)); - Assert.True(tesla.CompareTo(MagneticField.Zero) > 0); - Assert.True(MagneticField.Zero.CompareTo(tesla) < 0); + Assert.True(tesla.CompareTo(MagneticField.Zero) > 0); + Assert.True(MagneticField.Zero.CompareTo(tesla) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - MagneticField tesla = MagneticField.FromTeslas(1); + MagneticField tesla = MagneticField.FromTeslas(1); Assert.Throws(() => tesla.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - MagneticField tesla = MagneticField.FromTeslas(1); + MagneticField tesla = MagneticField.FromTeslas(1); Assert.Throws(() => tesla.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = MagneticField.FromTeslas(1); - var b = MagneticField.FromTeslas(2); + var a = MagneticField.FromTeslas(1); + var b = MagneticField.FromTeslas(2); // ReSharper disable EqualExpressionComparison @@ -215,8 +215,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = MagneticField.FromTeslas(1); - var b = MagneticField.FromTeslas(2); + var a = MagneticField.FromTeslas(1); + var b = MagneticField.FromTeslas(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -226,29 +226,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = MagneticField.FromTeslas(1); - Assert.True(v.Equals(MagneticField.FromTeslas(1), TeslasTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MagneticField.Zero, TeslasTolerance, ComparisonType.Relative)); + var v = MagneticField.FromTeslas(1); + Assert.True(v.Equals(MagneticField.FromTeslas(1), TeslasTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MagneticField.Zero, TeslasTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - MagneticField tesla = MagneticField.FromTeslas(1); + MagneticField tesla = MagneticField.FromTeslas(1); Assert.False(tesla.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - MagneticField tesla = MagneticField.FromTeslas(1); + MagneticField tesla = MagneticField.FromTeslas(1); Assert.False(tesla.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(MagneticFieldUnit.Undefined, MagneticField.Units); + Assert.DoesNotContain(MagneticFieldUnit.Undefined, MagneticField.Units); } [Fact] @@ -267,7 +267,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(MagneticField.BaseDimensions is null); + Assert.False(MagneticField.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs index 7ac287ba7b..12aa29b873 100644 --- a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs @@ -43,59 +43,59 @@ public abstract partial class MagneticFluxTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new MagneticFlux((double)0.0, MagneticFluxUnit.Undefined)); + Assert.Throws(() => new MagneticFlux((double)0.0, MagneticFluxUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new MagneticFlux(double.PositiveInfinity, MagneticFluxUnit.Weber)); - Assert.Throws(() => new MagneticFlux(double.NegativeInfinity, MagneticFluxUnit.Weber)); + Assert.Throws(() => new MagneticFlux(double.PositiveInfinity, MagneticFluxUnit.Weber)); + Assert.Throws(() => new MagneticFlux(double.NegativeInfinity, MagneticFluxUnit.Weber)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new MagneticFlux(double.NaN, MagneticFluxUnit.Weber)); + Assert.Throws(() => new MagneticFlux(double.NaN, MagneticFluxUnit.Weber)); } [Fact] public void WeberToMagneticFluxUnits() { - MagneticFlux weber = MagneticFlux.FromWebers(1); + MagneticFlux weber = MagneticFlux.FromWebers(1); AssertEx.EqualTolerance(WebersInOneWeber, weber.Webers, WebersTolerance); } [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, MagneticFlux.From(1, MagneticFluxUnit.Weber).Webers, WebersTolerance); + AssertEx.EqualTolerance(1, MagneticFlux.From(1, MagneticFluxUnit.Weber).Webers, WebersTolerance); } [Fact] public void FromWebers_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => MagneticFlux.FromWebers(double.PositiveInfinity)); - Assert.Throws(() => MagneticFlux.FromWebers(double.NegativeInfinity)); + Assert.Throws(() => MagneticFlux.FromWebers(double.PositiveInfinity)); + Assert.Throws(() => MagneticFlux.FromWebers(double.NegativeInfinity)); } [Fact] public void FromWebers_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => MagneticFlux.FromWebers(double.NaN)); + Assert.Throws(() => MagneticFlux.FromWebers(double.NaN)); } [Fact] public void As() { - var weber = MagneticFlux.FromWebers(1); + var weber = MagneticFlux.FromWebers(1); AssertEx.EqualTolerance(WebersInOneWeber, weber.As(MagneticFluxUnit.Weber), WebersTolerance); } [Fact] public void ToUnit() { - var weber = MagneticFlux.FromWebers(1); + var weber = MagneticFlux.FromWebers(1); var weberQuantity = weber.ToUnit(MagneticFluxUnit.Weber); AssertEx.EqualTolerance(WebersInOneWeber, (double)weberQuantity.Value, WebersTolerance); @@ -105,28 +105,28 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - MagneticFlux weber = MagneticFlux.FromWebers(1); - AssertEx.EqualTolerance(1, MagneticFlux.FromWebers(weber.Webers).Webers, WebersTolerance); + MagneticFlux weber = MagneticFlux.FromWebers(1); + AssertEx.EqualTolerance(1, MagneticFlux.FromWebers(weber.Webers).Webers, WebersTolerance); } [Fact] public void ArithmeticOperators() { - MagneticFlux v = MagneticFlux.FromWebers(1); + MagneticFlux v = MagneticFlux.FromWebers(1); AssertEx.EqualTolerance(-1, -v.Webers, WebersTolerance); - AssertEx.EqualTolerance(2, (MagneticFlux.FromWebers(3)-v).Webers, WebersTolerance); + AssertEx.EqualTolerance(2, (MagneticFlux.FromWebers(3)-v).Webers, WebersTolerance); AssertEx.EqualTolerance(2, (v + v).Webers, WebersTolerance); AssertEx.EqualTolerance(10, (v*10).Webers, WebersTolerance); AssertEx.EqualTolerance(10, (10*v).Webers, WebersTolerance); - AssertEx.EqualTolerance(2, (MagneticFlux.FromWebers(10)/5).Webers, WebersTolerance); - AssertEx.EqualTolerance(2, MagneticFlux.FromWebers(10)/MagneticFlux.FromWebers(5), WebersTolerance); + AssertEx.EqualTolerance(2, (MagneticFlux.FromWebers(10)/5).Webers, WebersTolerance); + AssertEx.EqualTolerance(2, MagneticFlux.FromWebers(10)/MagneticFlux.FromWebers(5), WebersTolerance); } [Fact] public void ComparisonOperators() { - MagneticFlux oneWeber = MagneticFlux.FromWebers(1); - MagneticFlux twoWebers = MagneticFlux.FromWebers(2); + MagneticFlux oneWeber = MagneticFlux.FromWebers(1); + MagneticFlux twoWebers = MagneticFlux.FromWebers(2); Assert.True(oneWeber < twoWebers); Assert.True(oneWeber <= twoWebers); @@ -142,31 +142,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - MagneticFlux weber = MagneticFlux.FromWebers(1); + MagneticFlux weber = MagneticFlux.FromWebers(1); Assert.Equal(0, weber.CompareTo(weber)); - Assert.True(weber.CompareTo(MagneticFlux.Zero) > 0); - Assert.True(MagneticFlux.Zero.CompareTo(weber) < 0); + Assert.True(weber.CompareTo(MagneticFlux.Zero) > 0); + Assert.True(MagneticFlux.Zero.CompareTo(weber) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - MagneticFlux weber = MagneticFlux.FromWebers(1); + MagneticFlux weber = MagneticFlux.FromWebers(1); Assert.Throws(() => weber.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - MagneticFlux weber = MagneticFlux.FromWebers(1); + MagneticFlux weber = MagneticFlux.FromWebers(1); Assert.Throws(() => weber.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = MagneticFlux.FromWebers(1); - var b = MagneticFlux.FromWebers(2); + var a = MagneticFlux.FromWebers(1); + var b = MagneticFlux.FromWebers(2); // ReSharper disable EqualExpressionComparison @@ -185,8 +185,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = MagneticFlux.FromWebers(1); - var b = MagneticFlux.FromWebers(2); + var a = MagneticFlux.FromWebers(1); + var b = MagneticFlux.FromWebers(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -196,29 +196,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = MagneticFlux.FromWebers(1); - Assert.True(v.Equals(MagneticFlux.FromWebers(1), WebersTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MagneticFlux.Zero, WebersTolerance, ComparisonType.Relative)); + var v = MagneticFlux.FromWebers(1); + Assert.True(v.Equals(MagneticFlux.FromWebers(1), WebersTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MagneticFlux.Zero, WebersTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - MagneticFlux weber = MagneticFlux.FromWebers(1); + MagneticFlux weber = MagneticFlux.FromWebers(1); Assert.False(weber.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - MagneticFlux weber = MagneticFlux.FromWebers(1); + MagneticFlux weber = MagneticFlux.FromWebers(1); Assert.False(weber.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(MagneticFluxUnit.Undefined, MagneticFlux.Units); + Assert.DoesNotContain(MagneticFluxUnit.Undefined, MagneticFlux.Units); } [Fact] @@ -237,7 +237,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(MagneticFlux.BaseDimensions is null); + Assert.False(MagneticFlux.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs index c4a07f7373..f0dd0f5091 100644 --- a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs @@ -43,59 +43,59 @@ public abstract partial class MagnetizationTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Magnetization((double)0.0, MagnetizationUnit.Undefined)); + Assert.Throws(() => new Magnetization((double)0.0, MagnetizationUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Magnetization(double.PositiveInfinity, MagnetizationUnit.AmperePerMeter)); - Assert.Throws(() => new Magnetization(double.NegativeInfinity, MagnetizationUnit.AmperePerMeter)); + Assert.Throws(() => new Magnetization(double.PositiveInfinity, MagnetizationUnit.AmperePerMeter)); + Assert.Throws(() => new Magnetization(double.NegativeInfinity, MagnetizationUnit.AmperePerMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Magnetization(double.NaN, MagnetizationUnit.AmperePerMeter)); + Assert.Throws(() => new Magnetization(double.NaN, MagnetizationUnit.AmperePerMeter)); } [Fact] public void AmperePerMeterToMagnetizationUnits() { - Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); + Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); AssertEx.EqualTolerance(AmperesPerMeterInOneAmperePerMeter, amperepermeter.AmperesPerMeter, AmperesPerMeterTolerance); } [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Magnetization.From(1, MagnetizationUnit.AmperePerMeter).AmperesPerMeter, AmperesPerMeterTolerance); + AssertEx.EqualTolerance(1, Magnetization.From(1, MagnetizationUnit.AmperePerMeter).AmperesPerMeter, AmperesPerMeterTolerance); } [Fact] public void FromAmperesPerMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.PositiveInfinity)); - Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.NegativeInfinity)); + Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.PositiveInfinity)); + Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.NegativeInfinity)); } [Fact] public void FromAmperesPerMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.NaN)); + Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.NaN)); } [Fact] public void As() { - var amperepermeter = Magnetization.FromAmperesPerMeter(1); + var amperepermeter = Magnetization.FromAmperesPerMeter(1); AssertEx.EqualTolerance(AmperesPerMeterInOneAmperePerMeter, amperepermeter.As(MagnetizationUnit.AmperePerMeter), AmperesPerMeterTolerance); } [Fact] public void ToUnit() { - var amperepermeter = Magnetization.FromAmperesPerMeter(1); + var amperepermeter = Magnetization.FromAmperesPerMeter(1); var amperepermeterQuantity = amperepermeter.ToUnit(MagnetizationUnit.AmperePerMeter); AssertEx.EqualTolerance(AmperesPerMeterInOneAmperePerMeter, (double)amperepermeterQuantity.Value, AmperesPerMeterTolerance); @@ -105,28 +105,28 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); - AssertEx.EqualTolerance(1, Magnetization.FromAmperesPerMeter(amperepermeter.AmperesPerMeter).AmperesPerMeter, AmperesPerMeterTolerance); + Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); + AssertEx.EqualTolerance(1, Magnetization.FromAmperesPerMeter(amperepermeter.AmperesPerMeter).AmperesPerMeter, AmperesPerMeterTolerance); } [Fact] public void ArithmeticOperators() { - Magnetization v = Magnetization.FromAmperesPerMeter(1); + Magnetization v = Magnetization.FromAmperesPerMeter(1); AssertEx.EqualTolerance(-1, -v.AmperesPerMeter, AmperesPerMeterTolerance); - AssertEx.EqualTolerance(2, (Magnetization.FromAmperesPerMeter(3)-v).AmperesPerMeter, AmperesPerMeterTolerance); + AssertEx.EqualTolerance(2, (Magnetization.FromAmperesPerMeter(3)-v).AmperesPerMeter, AmperesPerMeterTolerance); AssertEx.EqualTolerance(2, (v + v).AmperesPerMeter, AmperesPerMeterTolerance); AssertEx.EqualTolerance(10, (v*10).AmperesPerMeter, AmperesPerMeterTolerance); AssertEx.EqualTolerance(10, (10*v).AmperesPerMeter, AmperesPerMeterTolerance); - AssertEx.EqualTolerance(2, (Magnetization.FromAmperesPerMeter(10)/5).AmperesPerMeter, AmperesPerMeterTolerance); - AssertEx.EqualTolerance(2, Magnetization.FromAmperesPerMeter(10)/Magnetization.FromAmperesPerMeter(5), AmperesPerMeterTolerance); + AssertEx.EqualTolerance(2, (Magnetization.FromAmperesPerMeter(10)/5).AmperesPerMeter, AmperesPerMeterTolerance); + AssertEx.EqualTolerance(2, Magnetization.FromAmperesPerMeter(10)/Magnetization.FromAmperesPerMeter(5), AmperesPerMeterTolerance); } [Fact] public void ComparisonOperators() { - Magnetization oneAmperePerMeter = Magnetization.FromAmperesPerMeter(1); - Magnetization twoAmperesPerMeter = Magnetization.FromAmperesPerMeter(2); + Magnetization oneAmperePerMeter = Magnetization.FromAmperesPerMeter(1); + Magnetization twoAmperesPerMeter = Magnetization.FromAmperesPerMeter(2); Assert.True(oneAmperePerMeter < twoAmperesPerMeter); Assert.True(oneAmperePerMeter <= twoAmperesPerMeter); @@ -142,31 +142,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); + Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); Assert.Equal(0, amperepermeter.CompareTo(amperepermeter)); - Assert.True(amperepermeter.CompareTo(Magnetization.Zero) > 0); - Assert.True(Magnetization.Zero.CompareTo(amperepermeter) < 0); + Assert.True(amperepermeter.CompareTo(Magnetization.Zero) > 0); + Assert.True(Magnetization.Zero.CompareTo(amperepermeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); + Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); Assert.Throws(() => amperepermeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); + Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); Assert.Throws(() => amperepermeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Magnetization.FromAmperesPerMeter(1); - var b = Magnetization.FromAmperesPerMeter(2); + var a = Magnetization.FromAmperesPerMeter(1); + var b = Magnetization.FromAmperesPerMeter(2); // ReSharper disable EqualExpressionComparison @@ -185,8 +185,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Magnetization.FromAmperesPerMeter(1); - var b = Magnetization.FromAmperesPerMeter(2); + var a = Magnetization.FromAmperesPerMeter(1); + var b = Magnetization.FromAmperesPerMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -196,29 +196,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Magnetization.FromAmperesPerMeter(1); - Assert.True(v.Equals(Magnetization.FromAmperesPerMeter(1), AmperesPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Magnetization.Zero, AmperesPerMeterTolerance, ComparisonType.Relative)); + var v = Magnetization.FromAmperesPerMeter(1); + Assert.True(v.Equals(Magnetization.FromAmperesPerMeter(1), AmperesPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Magnetization.Zero, AmperesPerMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); + Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); Assert.False(amperepermeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); + Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); Assert.False(amperepermeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(MagnetizationUnit.Undefined, Magnetization.Units); + Assert.DoesNotContain(MagnetizationUnit.Undefined, Magnetization.Units); } [Fact] @@ -237,7 +237,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Magnetization.BaseDimensions is null); + Assert.False(Magnetization.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/MassConcentrationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassConcentrationTestsBase.g.cs index 6cb37d621a..cfc4888118 100644 --- a/UnitsNet.Tests/GeneratedCode/MassConcentrationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassConcentrationTestsBase.g.cs @@ -121,26 +121,26 @@ public abstract partial class MassConcentrationTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new MassConcentration((double)0.0, MassConcentrationUnit.Undefined)); + Assert.Throws(() => new MassConcentration((double)0.0, MassConcentrationUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new MassConcentration(double.PositiveInfinity, MassConcentrationUnit.KilogramPerCubicMeter)); - Assert.Throws(() => new MassConcentration(double.NegativeInfinity, MassConcentrationUnit.KilogramPerCubicMeter)); + Assert.Throws(() => new MassConcentration(double.PositiveInfinity, MassConcentrationUnit.KilogramPerCubicMeter)); + Assert.Throws(() => new MassConcentration(double.NegativeInfinity, MassConcentrationUnit.KilogramPerCubicMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new MassConcentration(double.NaN, MassConcentrationUnit.KilogramPerCubicMeter)); + Assert.Throws(() => new MassConcentration(double.NaN, MassConcentrationUnit.KilogramPerCubicMeter)); } [Fact] public void KilogramPerCubicMeterToMassConcentrationUnits() { - MassConcentration kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); + MassConcentration kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); AssertEx.EqualTolerance(CentigramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.CentigramsPerDeciliter, CentigramsPerDeciliterTolerance); AssertEx.EqualTolerance(CentigramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.CentigramsPerLiter, CentigramsPerLiterTolerance); AssertEx.EqualTolerance(CentigramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.CentigramsPerMilliliter, CentigramsPerMilliliterTolerance); @@ -186,65 +186,65 @@ public void KilogramPerCubicMeterToMassConcentrationUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.CentigramPerDeciliter).CentigramsPerDeciliter, CentigramsPerDeciliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.CentigramPerLiter).CentigramsPerLiter, CentigramsPerLiterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.CentigramPerMilliliter).CentigramsPerMilliliter, CentigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.DecigramPerDeciliter).DecigramsPerDeciliter, DecigramsPerDeciliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.DecigramPerLiter).DecigramsPerLiter, DecigramsPerLiterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.DecigramPerMilliliter).DecigramsPerMilliliter, DecigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.GramPerCubicCentimeter).GramsPerCubicCentimeter, GramsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.GramPerCubicMeter).GramsPerCubicMeter, GramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.GramPerCubicMillimeter).GramsPerCubicMillimeter, GramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.GramPerDeciliter).GramsPerDeciliter, GramsPerDeciliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.GramPerLiter).GramsPerLiter, GramsPerLiterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.GramPerMilliliter).GramsPerMilliliter, GramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.KilogramPerCubicCentimeter).KilogramsPerCubicCentimeter, KilogramsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.KilogramPerCubicMeter).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.KilogramPerCubicMillimeter).KilogramsPerCubicMillimeter, KilogramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.KilogramPerLiter).KilogramsPerLiter, KilogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.KilopoundPerCubicFoot).KilopoundsPerCubicFoot, KilopoundsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.KilopoundPerCubicInch).KilopoundsPerCubicInch, KilopoundsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.MicrogramPerCubicMeter).MicrogramsPerCubicMeter, MicrogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.MicrogramPerDeciliter).MicrogramsPerDeciliter, MicrogramsPerDeciliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.MicrogramPerLiter).MicrogramsPerLiter, MicrogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.MicrogramPerMilliliter).MicrogramsPerMilliliter, MicrogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.MilligramPerCubicMeter).MilligramsPerCubicMeter, MilligramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.MilligramPerDeciliter).MilligramsPerDeciliter, MilligramsPerDeciliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.MilligramPerLiter).MilligramsPerLiter, MilligramsPerLiterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.MilligramPerMilliliter).MilligramsPerMilliliter, MilligramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.NanogramPerDeciliter).NanogramsPerDeciliter, NanogramsPerDeciliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.NanogramPerLiter).NanogramsPerLiter, NanogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.NanogramPerMilliliter).NanogramsPerMilliliter, NanogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.PicogramPerDeciliter).PicogramsPerDeciliter, PicogramsPerDeciliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.PicogramPerLiter).PicogramsPerLiter, PicogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.PicogramPerMilliliter).PicogramsPerMilliliter, PicogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.PoundPerCubicFoot).PoundsPerCubicFoot, PoundsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.PoundPerCubicInch).PoundsPerCubicInch, PoundsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.PoundPerImperialGallon).PoundsPerImperialGallon, PoundsPerImperialGallonTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.PoundPerUSGallon).PoundsPerUSGallon, PoundsPerUSGallonTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.SlugPerCubicFoot).SlugsPerCubicFoot, SlugsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.TonnePerCubicCentimeter).TonnesPerCubicCentimeter, TonnesPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.TonnePerCubicMeter).TonnesPerCubicMeter, TonnesPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.TonnePerCubicMillimeter).TonnesPerCubicMillimeter, TonnesPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.CentigramPerDeciliter).CentigramsPerDeciliter, CentigramsPerDeciliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.CentigramPerLiter).CentigramsPerLiter, CentigramsPerLiterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.CentigramPerMilliliter).CentigramsPerMilliliter, CentigramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.DecigramPerDeciliter).DecigramsPerDeciliter, DecigramsPerDeciliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.DecigramPerLiter).DecigramsPerLiter, DecigramsPerLiterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.DecigramPerMilliliter).DecigramsPerMilliliter, DecigramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.GramPerCubicCentimeter).GramsPerCubicCentimeter, GramsPerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.GramPerCubicMeter).GramsPerCubicMeter, GramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.GramPerCubicMillimeter).GramsPerCubicMillimeter, GramsPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.GramPerDeciliter).GramsPerDeciliter, GramsPerDeciliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.GramPerLiter).GramsPerLiter, GramsPerLiterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.GramPerMilliliter).GramsPerMilliliter, GramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.KilogramPerCubicCentimeter).KilogramsPerCubicCentimeter, KilogramsPerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.KilogramPerCubicMeter).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.KilogramPerCubicMillimeter).KilogramsPerCubicMillimeter, KilogramsPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.KilogramPerLiter).KilogramsPerLiter, KilogramsPerLiterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.KilopoundPerCubicFoot).KilopoundsPerCubicFoot, KilopoundsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.KilopoundPerCubicInch).KilopoundsPerCubicInch, KilopoundsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.MicrogramPerCubicMeter).MicrogramsPerCubicMeter, MicrogramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.MicrogramPerDeciliter).MicrogramsPerDeciliter, MicrogramsPerDeciliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.MicrogramPerLiter).MicrogramsPerLiter, MicrogramsPerLiterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.MicrogramPerMilliliter).MicrogramsPerMilliliter, MicrogramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.MilligramPerCubicMeter).MilligramsPerCubicMeter, MilligramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.MilligramPerDeciliter).MilligramsPerDeciliter, MilligramsPerDeciliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.MilligramPerLiter).MilligramsPerLiter, MilligramsPerLiterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.MilligramPerMilliliter).MilligramsPerMilliliter, MilligramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.NanogramPerDeciliter).NanogramsPerDeciliter, NanogramsPerDeciliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.NanogramPerLiter).NanogramsPerLiter, NanogramsPerLiterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.NanogramPerMilliliter).NanogramsPerMilliliter, NanogramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.PicogramPerDeciliter).PicogramsPerDeciliter, PicogramsPerDeciliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.PicogramPerLiter).PicogramsPerLiter, PicogramsPerLiterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.PicogramPerMilliliter).PicogramsPerMilliliter, PicogramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.PoundPerCubicFoot).PoundsPerCubicFoot, PoundsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.PoundPerCubicInch).PoundsPerCubicInch, PoundsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.PoundPerImperialGallon).PoundsPerImperialGallon, PoundsPerImperialGallonTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.PoundPerUSGallon).PoundsPerUSGallon, PoundsPerUSGallonTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.SlugPerCubicFoot).SlugsPerCubicFoot, SlugsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.TonnePerCubicCentimeter).TonnesPerCubicCentimeter, TonnesPerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.TonnePerCubicMeter).TonnesPerCubicMeter, TonnesPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.From(1, MassConcentrationUnit.TonnePerCubicMillimeter).TonnesPerCubicMillimeter, TonnesPerCubicMillimeterTolerance); } [Fact] public void FromKilogramsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => MassConcentration.FromKilogramsPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => MassConcentration.FromKilogramsPerCubicMeter(double.NegativeInfinity)); + Assert.Throws(() => MassConcentration.FromKilogramsPerCubicMeter(double.PositiveInfinity)); + Assert.Throws(() => MassConcentration.FromKilogramsPerCubicMeter(double.NegativeInfinity)); } [Fact] public void FromKilogramsPerCubicMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => MassConcentration.FromKilogramsPerCubicMeter(double.NaN)); + Assert.Throws(() => MassConcentration.FromKilogramsPerCubicMeter(double.NaN)); } [Fact] public void As() { - var kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); + var kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); AssertEx.EqualTolerance(CentigramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(MassConcentrationUnit.CentigramPerDeciliter), CentigramsPerDeciliterTolerance); AssertEx.EqualTolerance(CentigramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(MassConcentrationUnit.CentigramPerLiter), CentigramsPerLiterTolerance); AssertEx.EqualTolerance(CentigramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(MassConcentrationUnit.CentigramPerMilliliter), CentigramsPerMilliliterTolerance); @@ -290,7 +290,7 @@ public void As() [Fact] public void ToUnit() { - var kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); + var kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); var centigramperdeciliterQuantity = kilogrampercubicmeter.ToUnit(MassConcentrationUnit.CentigramPerDeciliter); AssertEx.EqualTolerance(CentigramsPerDeciliterInOneKilogramPerCubicMeter, (double)centigramperdeciliterQuantity.Value, CentigramsPerDeciliterTolerance); @@ -456,67 +456,67 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - MassConcentration kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); - AssertEx.EqualTolerance(1, MassConcentration.FromCentigramsPerDeciliter(kilogrampercubicmeter.CentigramsPerDeciliter).KilogramsPerCubicMeter, CentigramsPerDeciliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromCentigramsPerLiter(kilogrampercubicmeter.CentigramsPerLiter).KilogramsPerCubicMeter, CentigramsPerLiterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromCentigramsPerMilliliter(kilogrampercubicmeter.CentigramsPerMilliliter).KilogramsPerCubicMeter, CentigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromDecigramsPerDeciliter(kilogrampercubicmeter.DecigramsPerDeciliter).KilogramsPerCubicMeter, DecigramsPerDeciliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromDecigramsPerLiter(kilogrampercubicmeter.DecigramsPerLiter).KilogramsPerCubicMeter, DecigramsPerLiterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromDecigramsPerMilliliter(kilogrampercubicmeter.DecigramsPerMilliliter).KilogramsPerCubicMeter, DecigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromGramsPerCubicCentimeter(kilogrampercubicmeter.GramsPerCubicCentimeter).KilogramsPerCubicMeter, GramsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromGramsPerCubicMeter(kilogrampercubicmeter.GramsPerCubicMeter).KilogramsPerCubicMeter, GramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromGramsPerCubicMillimeter(kilogrampercubicmeter.GramsPerCubicMillimeter).KilogramsPerCubicMeter, GramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromGramsPerDeciliter(kilogrampercubicmeter.GramsPerDeciliter).KilogramsPerCubicMeter, GramsPerDeciliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromGramsPerLiter(kilogrampercubicmeter.GramsPerLiter).KilogramsPerCubicMeter, GramsPerLiterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromGramsPerMilliliter(kilogrampercubicmeter.GramsPerMilliliter).KilogramsPerCubicMeter, GramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromKilogramsPerCubicCentimeter(kilogrampercubicmeter.KilogramsPerCubicCentimeter).KilogramsPerCubicMeter, KilogramsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromKilogramsPerCubicMeter(kilogrampercubicmeter.KilogramsPerCubicMeter).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromKilogramsPerCubicMillimeter(kilogrampercubicmeter.KilogramsPerCubicMillimeter).KilogramsPerCubicMeter, KilogramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromKilogramsPerLiter(kilogrampercubicmeter.KilogramsPerLiter).KilogramsPerCubicMeter, KilogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromKilopoundsPerCubicFoot(kilogrampercubicmeter.KilopoundsPerCubicFoot).KilogramsPerCubicMeter, KilopoundsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromKilopoundsPerCubicInch(kilogrampercubicmeter.KilopoundsPerCubicInch).KilogramsPerCubicMeter, KilopoundsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromMicrogramsPerCubicMeter(kilogrampercubicmeter.MicrogramsPerCubicMeter).KilogramsPerCubicMeter, MicrogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromMicrogramsPerDeciliter(kilogrampercubicmeter.MicrogramsPerDeciliter).KilogramsPerCubicMeter, MicrogramsPerDeciliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromMicrogramsPerLiter(kilogrampercubicmeter.MicrogramsPerLiter).KilogramsPerCubicMeter, MicrogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromMicrogramsPerMilliliter(kilogrampercubicmeter.MicrogramsPerMilliliter).KilogramsPerCubicMeter, MicrogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromMilligramsPerCubicMeter(kilogrampercubicmeter.MilligramsPerCubicMeter).KilogramsPerCubicMeter, MilligramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromMilligramsPerDeciliter(kilogrampercubicmeter.MilligramsPerDeciliter).KilogramsPerCubicMeter, MilligramsPerDeciliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromMilligramsPerLiter(kilogrampercubicmeter.MilligramsPerLiter).KilogramsPerCubicMeter, MilligramsPerLiterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromMilligramsPerMilliliter(kilogrampercubicmeter.MilligramsPerMilliliter).KilogramsPerCubicMeter, MilligramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromNanogramsPerDeciliter(kilogrampercubicmeter.NanogramsPerDeciliter).KilogramsPerCubicMeter, NanogramsPerDeciliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromNanogramsPerLiter(kilogrampercubicmeter.NanogramsPerLiter).KilogramsPerCubicMeter, NanogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromNanogramsPerMilliliter(kilogrampercubicmeter.NanogramsPerMilliliter).KilogramsPerCubicMeter, NanogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromPicogramsPerDeciliter(kilogrampercubicmeter.PicogramsPerDeciliter).KilogramsPerCubicMeter, PicogramsPerDeciliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromPicogramsPerLiter(kilogrampercubicmeter.PicogramsPerLiter).KilogramsPerCubicMeter, PicogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromPicogramsPerMilliliter(kilogrampercubicmeter.PicogramsPerMilliliter).KilogramsPerCubicMeter, PicogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromPoundsPerCubicFoot(kilogrampercubicmeter.PoundsPerCubicFoot).KilogramsPerCubicMeter, PoundsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromPoundsPerCubicInch(kilogrampercubicmeter.PoundsPerCubicInch).KilogramsPerCubicMeter, PoundsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromPoundsPerImperialGallon(kilogrampercubicmeter.PoundsPerImperialGallon).KilogramsPerCubicMeter, PoundsPerImperialGallonTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromPoundsPerUSGallon(kilogrampercubicmeter.PoundsPerUSGallon).KilogramsPerCubicMeter, PoundsPerUSGallonTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromSlugsPerCubicFoot(kilogrampercubicmeter.SlugsPerCubicFoot).KilogramsPerCubicMeter, SlugsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromTonnesPerCubicCentimeter(kilogrampercubicmeter.TonnesPerCubicCentimeter).KilogramsPerCubicMeter, TonnesPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromTonnesPerCubicMeter(kilogrampercubicmeter.TonnesPerCubicMeter).KilogramsPerCubicMeter, TonnesPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, MassConcentration.FromTonnesPerCubicMillimeter(kilogrampercubicmeter.TonnesPerCubicMillimeter).KilogramsPerCubicMeter, TonnesPerCubicMillimeterTolerance); + MassConcentration kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); + AssertEx.EqualTolerance(1, MassConcentration.FromCentigramsPerDeciliter(kilogrampercubicmeter.CentigramsPerDeciliter).KilogramsPerCubicMeter, CentigramsPerDeciliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromCentigramsPerLiter(kilogrampercubicmeter.CentigramsPerLiter).KilogramsPerCubicMeter, CentigramsPerLiterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromCentigramsPerMilliliter(kilogrampercubicmeter.CentigramsPerMilliliter).KilogramsPerCubicMeter, CentigramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromDecigramsPerDeciliter(kilogrampercubicmeter.DecigramsPerDeciliter).KilogramsPerCubicMeter, DecigramsPerDeciliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromDecigramsPerLiter(kilogrampercubicmeter.DecigramsPerLiter).KilogramsPerCubicMeter, DecigramsPerLiterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromDecigramsPerMilliliter(kilogrampercubicmeter.DecigramsPerMilliliter).KilogramsPerCubicMeter, DecigramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromGramsPerCubicCentimeter(kilogrampercubicmeter.GramsPerCubicCentimeter).KilogramsPerCubicMeter, GramsPerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromGramsPerCubicMeter(kilogrampercubicmeter.GramsPerCubicMeter).KilogramsPerCubicMeter, GramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromGramsPerCubicMillimeter(kilogrampercubicmeter.GramsPerCubicMillimeter).KilogramsPerCubicMeter, GramsPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromGramsPerDeciliter(kilogrampercubicmeter.GramsPerDeciliter).KilogramsPerCubicMeter, GramsPerDeciliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromGramsPerLiter(kilogrampercubicmeter.GramsPerLiter).KilogramsPerCubicMeter, GramsPerLiterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromGramsPerMilliliter(kilogrampercubicmeter.GramsPerMilliliter).KilogramsPerCubicMeter, GramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromKilogramsPerCubicCentimeter(kilogrampercubicmeter.KilogramsPerCubicCentimeter).KilogramsPerCubicMeter, KilogramsPerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromKilogramsPerCubicMeter(kilogrampercubicmeter.KilogramsPerCubicMeter).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromKilogramsPerCubicMillimeter(kilogrampercubicmeter.KilogramsPerCubicMillimeter).KilogramsPerCubicMeter, KilogramsPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromKilogramsPerLiter(kilogrampercubicmeter.KilogramsPerLiter).KilogramsPerCubicMeter, KilogramsPerLiterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromKilopoundsPerCubicFoot(kilogrampercubicmeter.KilopoundsPerCubicFoot).KilogramsPerCubicMeter, KilopoundsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromKilopoundsPerCubicInch(kilogrampercubicmeter.KilopoundsPerCubicInch).KilogramsPerCubicMeter, KilopoundsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromMicrogramsPerCubicMeter(kilogrampercubicmeter.MicrogramsPerCubicMeter).KilogramsPerCubicMeter, MicrogramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromMicrogramsPerDeciliter(kilogrampercubicmeter.MicrogramsPerDeciliter).KilogramsPerCubicMeter, MicrogramsPerDeciliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromMicrogramsPerLiter(kilogrampercubicmeter.MicrogramsPerLiter).KilogramsPerCubicMeter, MicrogramsPerLiterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromMicrogramsPerMilliliter(kilogrampercubicmeter.MicrogramsPerMilliliter).KilogramsPerCubicMeter, MicrogramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromMilligramsPerCubicMeter(kilogrampercubicmeter.MilligramsPerCubicMeter).KilogramsPerCubicMeter, MilligramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromMilligramsPerDeciliter(kilogrampercubicmeter.MilligramsPerDeciliter).KilogramsPerCubicMeter, MilligramsPerDeciliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromMilligramsPerLiter(kilogrampercubicmeter.MilligramsPerLiter).KilogramsPerCubicMeter, MilligramsPerLiterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromMilligramsPerMilliliter(kilogrampercubicmeter.MilligramsPerMilliliter).KilogramsPerCubicMeter, MilligramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromNanogramsPerDeciliter(kilogrampercubicmeter.NanogramsPerDeciliter).KilogramsPerCubicMeter, NanogramsPerDeciliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromNanogramsPerLiter(kilogrampercubicmeter.NanogramsPerLiter).KilogramsPerCubicMeter, NanogramsPerLiterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromNanogramsPerMilliliter(kilogrampercubicmeter.NanogramsPerMilliliter).KilogramsPerCubicMeter, NanogramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromPicogramsPerDeciliter(kilogrampercubicmeter.PicogramsPerDeciliter).KilogramsPerCubicMeter, PicogramsPerDeciliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromPicogramsPerLiter(kilogrampercubicmeter.PicogramsPerLiter).KilogramsPerCubicMeter, PicogramsPerLiterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromPicogramsPerMilliliter(kilogrampercubicmeter.PicogramsPerMilliliter).KilogramsPerCubicMeter, PicogramsPerMilliliterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromPoundsPerCubicFoot(kilogrampercubicmeter.PoundsPerCubicFoot).KilogramsPerCubicMeter, PoundsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromPoundsPerCubicInch(kilogrampercubicmeter.PoundsPerCubicInch).KilogramsPerCubicMeter, PoundsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromPoundsPerImperialGallon(kilogrampercubicmeter.PoundsPerImperialGallon).KilogramsPerCubicMeter, PoundsPerImperialGallonTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromPoundsPerUSGallon(kilogrampercubicmeter.PoundsPerUSGallon).KilogramsPerCubicMeter, PoundsPerUSGallonTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromSlugsPerCubicFoot(kilogrampercubicmeter.SlugsPerCubicFoot).KilogramsPerCubicMeter, SlugsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromTonnesPerCubicCentimeter(kilogrampercubicmeter.TonnesPerCubicCentimeter).KilogramsPerCubicMeter, TonnesPerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromTonnesPerCubicMeter(kilogrampercubicmeter.TonnesPerCubicMeter).KilogramsPerCubicMeter, TonnesPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, MassConcentration.FromTonnesPerCubicMillimeter(kilogrampercubicmeter.TonnesPerCubicMillimeter).KilogramsPerCubicMeter, TonnesPerCubicMillimeterTolerance); } [Fact] public void ArithmeticOperators() { - MassConcentration v = MassConcentration.FromKilogramsPerCubicMeter(1); + MassConcentration v = MassConcentration.FromKilogramsPerCubicMeter(1); AssertEx.EqualTolerance(-1, -v.KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (MassConcentration.FromKilogramsPerCubicMeter(3)-v).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, (MassConcentration.FromKilogramsPerCubicMeter(3)-v).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); AssertEx.EqualTolerance(2, (v + v).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); AssertEx.EqualTolerance(10, (v*10).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); AssertEx.EqualTolerance(10, (10*v).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (MassConcentration.FromKilogramsPerCubicMeter(10)/5).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, MassConcentration.FromKilogramsPerCubicMeter(10)/MassConcentration.FromKilogramsPerCubicMeter(5), KilogramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, (MassConcentration.FromKilogramsPerCubicMeter(10)/5).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, MassConcentration.FromKilogramsPerCubicMeter(10)/MassConcentration.FromKilogramsPerCubicMeter(5), KilogramsPerCubicMeterTolerance); } [Fact] public void ComparisonOperators() { - MassConcentration oneKilogramPerCubicMeter = MassConcentration.FromKilogramsPerCubicMeter(1); - MassConcentration twoKilogramsPerCubicMeter = MassConcentration.FromKilogramsPerCubicMeter(2); + MassConcentration oneKilogramPerCubicMeter = MassConcentration.FromKilogramsPerCubicMeter(1); + MassConcentration twoKilogramsPerCubicMeter = MassConcentration.FromKilogramsPerCubicMeter(2); Assert.True(oneKilogramPerCubicMeter < twoKilogramsPerCubicMeter); Assert.True(oneKilogramPerCubicMeter <= twoKilogramsPerCubicMeter); @@ -532,31 +532,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - MassConcentration kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); + MassConcentration kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); Assert.Equal(0, kilogrampercubicmeter.CompareTo(kilogrampercubicmeter)); - Assert.True(kilogrampercubicmeter.CompareTo(MassConcentration.Zero) > 0); - Assert.True(MassConcentration.Zero.CompareTo(kilogrampercubicmeter) < 0); + Assert.True(kilogrampercubicmeter.CompareTo(MassConcentration.Zero) > 0); + Assert.True(MassConcentration.Zero.CompareTo(kilogrampercubicmeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - MassConcentration kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); + MassConcentration kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); Assert.Throws(() => kilogrampercubicmeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - MassConcentration kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); + MassConcentration kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); Assert.Throws(() => kilogrampercubicmeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = MassConcentration.FromKilogramsPerCubicMeter(1); - var b = MassConcentration.FromKilogramsPerCubicMeter(2); + var a = MassConcentration.FromKilogramsPerCubicMeter(1); + var b = MassConcentration.FromKilogramsPerCubicMeter(2); // ReSharper disable EqualExpressionComparison @@ -575,8 +575,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = MassConcentration.FromKilogramsPerCubicMeter(1); - var b = MassConcentration.FromKilogramsPerCubicMeter(2); + var a = MassConcentration.FromKilogramsPerCubicMeter(1); + var b = MassConcentration.FromKilogramsPerCubicMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -586,29 +586,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = MassConcentration.FromKilogramsPerCubicMeter(1); - Assert.True(v.Equals(MassConcentration.FromKilogramsPerCubicMeter(1), KilogramsPerCubicMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MassConcentration.Zero, KilogramsPerCubicMeterTolerance, ComparisonType.Relative)); + var v = MassConcentration.FromKilogramsPerCubicMeter(1); + Assert.True(v.Equals(MassConcentration.FromKilogramsPerCubicMeter(1), KilogramsPerCubicMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MassConcentration.Zero, KilogramsPerCubicMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - MassConcentration kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); + MassConcentration kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); Assert.False(kilogrampercubicmeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - MassConcentration kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); + MassConcentration kilogrampercubicmeter = MassConcentration.FromKilogramsPerCubicMeter(1); Assert.False(kilogrampercubicmeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(MassConcentrationUnit.Undefined, MassConcentration.Units); + Assert.DoesNotContain(MassConcentrationUnit.Undefined, MassConcentration.Units); } [Fact] @@ -627,7 +627,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(MassConcentration.BaseDimensions is null); + Assert.False(MassConcentration.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs index 104e7b51a1..4455e78461 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of MassFlow. + /// Test of MassFlow. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class MassFlowTestsBase @@ -107,26 +107,26 @@ public abstract partial class MassFlowTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new MassFlow((double)0.0, MassFlowUnit.Undefined)); + Assert.Throws(() => new MassFlow((double)0.0, MassFlowUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new MassFlow(double.PositiveInfinity, MassFlowUnit.GramPerSecond)); - Assert.Throws(() => new MassFlow(double.NegativeInfinity, MassFlowUnit.GramPerSecond)); + Assert.Throws(() => new MassFlow(double.PositiveInfinity, MassFlowUnit.GramPerSecond)); + Assert.Throws(() => new MassFlow(double.NegativeInfinity, MassFlowUnit.GramPerSecond)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new MassFlow(double.NaN, MassFlowUnit.GramPerSecond)); + Assert.Throws(() => new MassFlow(double.NaN, MassFlowUnit.GramPerSecond)); } [Fact] public void GramPerSecondToMassFlowUnits() { - MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); + MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); AssertEx.EqualTolerance(CentigramsPerDayInOneGramPerSecond, grampersecond.CentigramsPerDay, CentigramsPerDayTolerance); AssertEx.EqualTolerance(CentigramsPerSecondInOneGramPerSecond, grampersecond.CentigramsPerSecond, CentigramsPerSecondTolerance); AssertEx.EqualTolerance(DecagramsPerDayInOneGramPerSecond, grampersecond.DecagramsPerDay, DecagramsPerDayTolerance); @@ -165,58 +165,58 @@ public void GramPerSecondToMassFlowUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.CentigramPerDay).CentigramsPerDay, CentigramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.CentigramPerSecond).CentigramsPerSecond, CentigramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.DecagramPerDay).DecagramsPerDay, DecagramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.DecagramPerSecond).DecagramsPerSecond, DecagramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.DecigramPerDay).DecigramsPerDay, DecigramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.DecigramPerSecond).DecigramsPerSecond, DecigramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.GramPerDay).GramsPerDay, GramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.GramPerHour).GramsPerHour, GramsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.GramPerSecond).GramsPerSecond, GramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.HectogramPerDay).HectogramsPerDay, HectogramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.HectogramPerSecond).HectogramsPerSecond, HectogramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.KilogramPerDay).KilogramsPerDay, KilogramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.KilogramPerHour).KilogramsPerHour, KilogramsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.KilogramPerMinute).KilogramsPerMinute, KilogramsPerMinuteTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.KilogramPerSecond).KilogramsPerSecond, KilogramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MegagramPerDay).MegagramsPerDay, MegagramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MegapoundPerDay).MegapoundsPerDay, MegapoundsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MegapoundPerHour).MegapoundsPerHour, MegapoundsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MegapoundPerMinute).MegapoundsPerMinute, MegapoundsPerMinuteTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MegapoundPerSecond).MegapoundsPerSecond, MegapoundsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MicrogramPerDay).MicrogramsPerDay, MicrogramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MicrogramPerSecond).MicrogramsPerSecond, MicrogramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MilligramPerDay).MilligramsPerDay, MilligramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MilligramPerSecond).MilligramsPerSecond, MilligramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.NanogramPerDay).NanogramsPerDay, NanogramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.NanogramPerSecond).NanogramsPerSecond, NanogramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.PoundPerDay).PoundsPerDay, PoundsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.PoundPerHour).PoundsPerHour, PoundsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.PoundPerMinute).PoundsPerMinute, PoundsPerMinuteTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.PoundPerSecond).PoundsPerSecond, PoundsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.ShortTonPerHour).ShortTonsPerHour, ShortTonsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.TonnePerDay).TonnesPerDay, TonnesPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.TonnePerHour).TonnesPerHour, TonnesPerHourTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.CentigramPerDay).CentigramsPerDay, CentigramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.CentigramPerSecond).CentigramsPerSecond, CentigramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.DecagramPerDay).DecagramsPerDay, DecagramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.DecagramPerSecond).DecagramsPerSecond, DecagramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.DecigramPerDay).DecigramsPerDay, DecigramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.DecigramPerSecond).DecigramsPerSecond, DecigramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.GramPerDay).GramsPerDay, GramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.GramPerHour).GramsPerHour, GramsPerHourTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.GramPerSecond).GramsPerSecond, GramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.HectogramPerDay).HectogramsPerDay, HectogramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.HectogramPerSecond).HectogramsPerSecond, HectogramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.KilogramPerDay).KilogramsPerDay, KilogramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.KilogramPerHour).KilogramsPerHour, KilogramsPerHourTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.KilogramPerMinute).KilogramsPerMinute, KilogramsPerMinuteTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.KilogramPerSecond).KilogramsPerSecond, KilogramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MegagramPerDay).MegagramsPerDay, MegagramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MegapoundPerDay).MegapoundsPerDay, MegapoundsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MegapoundPerHour).MegapoundsPerHour, MegapoundsPerHourTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MegapoundPerMinute).MegapoundsPerMinute, MegapoundsPerMinuteTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MegapoundPerSecond).MegapoundsPerSecond, MegapoundsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MicrogramPerDay).MicrogramsPerDay, MicrogramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MicrogramPerSecond).MicrogramsPerSecond, MicrogramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MilligramPerDay).MilligramsPerDay, MilligramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MilligramPerSecond).MilligramsPerSecond, MilligramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.NanogramPerDay).NanogramsPerDay, NanogramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.NanogramPerSecond).NanogramsPerSecond, NanogramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.PoundPerDay).PoundsPerDay, PoundsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.PoundPerHour).PoundsPerHour, PoundsPerHourTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.PoundPerMinute).PoundsPerMinute, PoundsPerMinuteTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.PoundPerSecond).PoundsPerSecond, PoundsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.ShortTonPerHour).ShortTonsPerHour, ShortTonsPerHourTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.TonnePerDay).TonnesPerDay, TonnesPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.TonnePerHour).TonnesPerHour, TonnesPerHourTolerance); } [Fact] public void FromGramsPerSecond_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => MassFlow.FromGramsPerSecond(double.PositiveInfinity)); - Assert.Throws(() => MassFlow.FromGramsPerSecond(double.NegativeInfinity)); + Assert.Throws(() => MassFlow.FromGramsPerSecond(double.PositiveInfinity)); + Assert.Throws(() => MassFlow.FromGramsPerSecond(double.NegativeInfinity)); } [Fact] public void FromGramsPerSecond_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => MassFlow.FromGramsPerSecond(double.NaN)); + Assert.Throws(() => MassFlow.FromGramsPerSecond(double.NaN)); } [Fact] public void As() { - var grampersecond = MassFlow.FromGramsPerSecond(1); + var grampersecond = MassFlow.FromGramsPerSecond(1); AssertEx.EqualTolerance(CentigramsPerDayInOneGramPerSecond, grampersecond.As(MassFlowUnit.CentigramPerDay), CentigramsPerDayTolerance); AssertEx.EqualTolerance(CentigramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.CentigramPerSecond), CentigramsPerSecondTolerance); AssertEx.EqualTolerance(DecagramsPerDayInOneGramPerSecond, grampersecond.As(MassFlowUnit.DecagramPerDay), DecagramsPerDayTolerance); @@ -255,7 +255,7 @@ public void As() [Fact] public void ToUnit() { - var grampersecond = MassFlow.FromGramsPerSecond(1); + var grampersecond = MassFlow.FromGramsPerSecond(1); var centigramperdayQuantity = grampersecond.ToUnit(MassFlowUnit.CentigramPerDay); AssertEx.EqualTolerance(CentigramsPerDayInOneGramPerSecond, (double)centigramperdayQuantity.Value, CentigramsPerDayTolerance); @@ -393,60 +393,60 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); - AssertEx.EqualTolerance(1, MassFlow.FromCentigramsPerDay(grampersecond.CentigramsPerDay).GramsPerSecond, CentigramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromCentigramsPerSecond(grampersecond.CentigramsPerSecond).GramsPerSecond, CentigramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromDecagramsPerDay(grampersecond.DecagramsPerDay).GramsPerSecond, DecagramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromDecagramsPerSecond(grampersecond.DecagramsPerSecond).GramsPerSecond, DecagramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromDecigramsPerDay(grampersecond.DecigramsPerDay).GramsPerSecond, DecigramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromDecigramsPerSecond(grampersecond.DecigramsPerSecond).GramsPerSecond, DecigramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromGramsPerDay(grampersecond.GramsPerDay).GramsPerSecond, GramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromGramsPerHour(grampersecond.GramsPerHour).GramsPerSecond, GramsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromGramsPerSecond(grampersecond.GramsPerSecond).GramsPerSecond, GramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromHectogramsPerDay(grampersecond.HectogramsPerDay).GramsPerSecond, HectogramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromHectogramsPerSecond(grampersecond.HectogramsPerSecond).GramsPerSecond, HectogramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromKilogramsPerDay(grampersecond.KilogramsPerDay).GramsPerSecond, KilogramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromKilogramsPerHour(grampersecond.KilogramsPerHour).GramsPerSecond, KilogramsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromKilogramsPerMinute(grampersecond.KilogramsPerMinute).GramsPerSecond, KilogramsPerMinuteTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromKilogramsPerSecond(grampersecond.KilogramsPerSecond).GramsPerSecond, KilogramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromMegagramsPerDay(grampersecond.MegagramsPerDay).GramsPerSecond, MegagramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromMegapoundsPerDay(grampersecond.MegapoundsPerDay).GramsPerSecond, MegapoundsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromMegapoundsPerHour(grampersecond.MegapoundsPerHour).GramsPerSecond, MegapoundsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromMegapoundsPerMinute(grampersecond.MegapoundsPerMinute).GramsPerSecond, MegapoundsPerMinuteTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromMegapoundsPerSecond(grampersecond.MegapoundsPerSecond).GramsPerSecond, MegapoundsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromMicrogramsPerDay(grampersecond.MicrogramsPerDay).GramsPerSecond, MicrogramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromMicrogramsPerSecond(grampersecond.MicrogramsPerSecond).GramsPerSecond, MicrogramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromMilligramsPerDay(grampersecond.MilligramsPerDay).GramsPerSecond, MilligramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromMilligramsPerSecond(grampersecond.MilligramsPerSecond).GramsPerSecond, MilligramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromNanogramsPerDay(grampersecond.NanogramsPerDay).GramsPerSecond, NanogramsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromNanogramsPerSecond(grampersecond.NanogramsPerSecond).GramsPerSecond, NanogramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromPoundsPerDay(grampersecond.PoundsPerDay).GramsPerSecond, PoundsPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromPoundsPerHour(grampersecond.PoundsPerHour).GramsPerSecond, PoundsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromPoundsPerMinute(grampersecond.PoundsPerMinute).GramsPerSecond, PoundsPerMinuteTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromPoundsPerSecond(grampersecond.PoundsPerSecond).GramsPerSecond, PoundsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromShortTonsPerHour(grampersecond.ShortTonsPerHour).GramsPerSecond, ShortTonsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromTonnesPerDay(grampersecond.TonnesPerDay).GramsPerSecond, TonnesPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromTonnesPerHour(grampersecond.TonnesPerHour).GramsPerSecond, TonnesPerHourTolerance); + MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); + AssertEx.EqualTolerance(1, MassFlow.FromCentigramsPerDay(grampersecond.CentigramsPerDay).GramsPerSecond, CentigramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromCentigramsPerSecond(grampersecond.CentigramsPerSecond).GramsPerSecond, CentigramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromDecagramsPerDay(grampersecond.DecagramsPerDay).GramsPerSecond, DecagramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromDecagramsPerSecond(grampersecond.DecagramsPerSecond).GramsPerSecond, DecagramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromDecigramsPerDay(grampersecond.DecigramsPerDay).GramsPerSecond, DecigramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromDecigramsPerSecond(grampersecond.DecigramsPerSecond).GramsPerSecond, DecigramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromGramsPerDay(grampersecond.GramsPerDay).GramsPerSecond, GramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromGramsPerHour(grampersecond.GramsPerHour).GramsPerSecond, GramsPerHourTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromGramsPerSecond(grampersecond.GramsPerSecond).GramsPerSecond, GramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromHectogramsPerDay(grampersecond.HectogramsPerDay).GramsPerSecond, HectogramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromHectogramsPerSecond(grampersecond.HectogramsPerSecond).GramsPerSecond, HectogramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromKilogramsPerDay(grampersecond.KilogramsPerDay).GramsPerSecond, KilogramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromKilogramsPerHour(grampersecond.KilogramsPerHour).GramsPerSecond, KilogramsPerHourTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromKilogramsPerMinute(grampersecond.KilogramsPerMinute).GramsPerSecond, KilogramsPerMinuteTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromKilogramsPerSecond(grampersecond.KilogramsPerSecond).GramsPerSecond, KilogramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromMegagramsPerDay(grampersecond.MegagramsPerDay).GramsPerSecond, MegagramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromMegapoundsPerDay(grampersecond.MegapoundsPerDay).GramsPerSecond, MegapoundsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromMegapoundsPerHour(grampersecond.MegapoundsPerHour).GramsPerSecond, MegapoundsPerHourTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromMegapoundsPerMinute(grampersecond.MegapoundsPerMinute).GramsPerSecond, MegapoundsPerMinuteTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromMegapoundsPerSecond(grampersecond.MegapoundsPerSecond).GramsPerSecond, MegapoundsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromMicrogramsPerDay(grampersecond.MicrogramsPerDay).GramsPerSecond, MicrogramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromMicrogramsPerSecond(grampersecond.MicrogramsPerSecond).GramsPerSecond, MicrogramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromMilligramsPerDay(grampersecond.MilligramsPerDay).GramsPerSecond, MilligramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromMilligramsPerSecond(grampersecond.MilligramsPerSecond).GramsPerSecond, MilligramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromNanogramsPerDay(grampersecond.NanogramsPerDay).GramsPerSecond, NanogramsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromNanogramsPerSecond(grampersecond.NanogramsPerSecond).GramsPerSecond, NanogramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromPoundsPerDay(grampersecond.PoundsPerDay).GramsPerSecond, PoundsPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromPoundsPerHour(grampersecond.PoundsPerHour).GramsPerSecond, PoundsPerHourTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromPoundsPerMinute(grampersecond.PoundsPerMinute).GramsPerSecond, PoundsPerMinuteTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromPoundsPerSecond(grampersecond.PoundsPerSecond).GramsPerSecond, PoundsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromShortTonsPerHour(grampersecond.ShortTonsPerHour).GramsPerSecond, ShortTonsPerHourTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromTonnesPerDay(grampersecond.TonnesPerDay).GramsPerSecond, TonnesPerDayTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromTonnesPerHour(grampersecond.TonnesPerHour).GramsPerSecond, TonnesPerHourTolerance); } [Fact] public void ArithmeticOperators() { - MassFlow v = MassFlow.FromGramsPerSecond(1); + MassFlow v = MassFlow.FromGramsPerSecond(1); AssertEx.EqualTolerance(-1, -v.GramsPerSecond, GramsPerSecondTolerance); - AssertEx.EqualTolerance(2, (MassFlow.FromGramsPerSecond(3)-v).GramsPerSecond, GramsPerSecondTolerance); + AssertEx.EqualTolerance(2, (MassFlow.FromGramsPerSecond(3)-v).GramsPerSecond, GramsPerSecondTolerance); AssertEx.EqualTolerance(2, (v + v).GramsPerSecond, GramsPerSecondTolerance); AssertEx.EqualTolerance(10, (v*10).GramsPerSecond, GramsPerSecondTolerance); AssertEx.EqualTolerance(10, (10*v).GramsPerSecond, GramsPerSecondTolerance); - AssertEx.EqualTolerance(2, (MassFlow.FromGramsPerSecond(10)/5).GramsPerSecond, GramsPerSecondTolerance); - AssertEx.EqualTolerance(2, MassFlow.FromGramsPerSecond(10)/MassFlow.FromGramsPerSecond(5), GramsPerSecondTolerance); + AssertEx.EqualTolerance(2, (MassFlow.FromGramsPerSecond(10)/5).GramsPerSecond, GramsPerSecondTolerance); + AssertEx.EqualTolerance(2, MassFlow.FromGramsPerSecond(10)/MassFlow.FromGramsPerSecond(5), GramsPerSecondTolerance); } [Fact] public void ComparisonOperators() { - MassFlow oneGramPerSecond = MassFlow.FromGramsPerSecond(1); - MassFlow twoGramsPerSecond = MassFlow.FromGramsPerSecond(2); + MassFlow oneGramPerSecond = MassFlow.FromGramsPerSecond(1); + MassFlow twoGramsPerSecond = MassFlow.FromGramsPerSecond(2); Assert.True(oneGramPerSecond < twoGramsPerSecond); Assert.True(oneGramPerSecond <= twoGramsPerSecond); @@ -462,31 +462,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); + MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); Assert.Equal(0, grampersecond.CompareTo(grampersecond)); - Assert.True(grampersecond.CompareTo(MassFlow.Zero) > 0); - Assert.True(MassFlow.Zero.CompareTo(grampersecond) < 0); + Assert.True(grampersecond.CompareTo(MassFlow.Zero) > 0); + Assert.True(MassFlow.Zero.CompareTo(grampersecond) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); + MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); Assert.Throws(() => grampersecond.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); + MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); Assert.Throws(() => grampersecond.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = MassFlow.FromGramsPerSecond(1); - var b = MassFlow.FromGramsPerSecond(2); + var a = MassFlow.FromGramsPerSecond(1); + var b = MassFlow.FromGramsPerSecond(2); // ReSharper disable EqualExpressionComparison @@ -505,8 +505,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = MassFlow.FromGramsPerSecond(1); - var b = MassFlow.FromGramsPerSecond(2); + var a = MassFlow.FromGramsPerSecond(1); + var b = MassFlow.FromGramsPerSecond(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -516,29 +516,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = MassFlow.FromGramsPerSecond(1); - Assert.True(v.Equals(MassFlow.FromGramsPerSecond(1), GramsPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MassFlow.Zero, GramsPerSecondTolerance, ComparisonType.Relative)); + var v = MassFlow.FromGramsPerSecond(1); + Assert.True(v.Equals(MassFlow.FromGramsPerSecond(1), GramsPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MassFlow.Zero, GramsPerSecondTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); + MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); Assert.False(grampersecond.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); + MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); Assert.False(grampersecond.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(MassFlowUnit.Undefined, MassFlow.Units); + Assert.DoesNotContain(MassFlowUnit.Undefined, MassFlow.Units); } [Fact] @@ -557,7 +557,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(MassFlow.BaseDimensions is null); + Assert.False(MassFlow.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs index 8736686e23..371dbd82de 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of MassFlux. + /// Test of MassFlux. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class MassFluxTestsBase @@ -45,26 +45,26 @@ public abstract partial class MassFluxTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new MassFlux((double)0.0, MassFluxUnit.Undefined)); + Assert.Throws(() => new MassFlux((double)0.0, MassFluxUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new MassFlux(double.PositiveInfinity, MassFluxUnit.KilogramPerSecondPerSquareMeter)); - Assert.Throws(() => new MassFlux(double.NegativeInfinity, MassFluxUnit.KilogramPerSecondPerSquareMeter)); + Assert.Throws(() => new MassFlux(double.PositiveInfinity, MassFluxUnit.KilogramPerSecondPerSquareMeter)); + Assert.Throws(() => new MassFlux(double.NegativeInfinity, MassFluxUnit.KilogramPerSecondPerSquareMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new MassFlux(double.NaN, MassFluxUnit.KilogramPerSecondPerSquareMeter)); + Assert.Throws(() => new MassFlux(double.NaN, MassFluxUnit.KilogramPerSecondPerSquareMeter)); } [Fact] public void KilogramPerSecondPerSquareMeterToMassFluxUnits() { - MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); + MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); AssertEx.EqualTolerance(GramsPerSecondPerSquareMeterInOneKilogramPerSecondPerSquareMeter, kilogrampersecondpersquaremeter.GramsPerSecondPerSquareMeter, GramsPerSecondPerSquareMeterTolerance); AssertEx.EqualTolerance(KilogramsPerSecondPerSquareMeterInOneKilogramPerSecondPerSquareMeter, kilogrampersecondpersquaremeter.KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); } @@ -72,27 +72,27 @@ public void KilogramPerSecondPerSquareMeterToMassFluxUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, MassFlux.From(1, MassFluxUnit.GramPerSecondPerSquareMeter).GramsPerSecondPerSquareMeter, GramsPerSecondPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, MassFlux.From(1, MassFluxUnit.KilogramPerSecondPerSquareMeter).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, MassFlux.From(1, MassFluxUnit.GramPerSecondPerSquareMeter).GramsPerSecondPerSquareMeter, GramsPerSecondPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, MassFlux.From(1, MassFluxUnit.KilogramPerSecondPerSquareMeter).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); } [Fact] public void FromKilogramsPerSecondPerSquareMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.NegativeInfinity)); + Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.NegativeInfinity)); } [Fact] public void FromKilogramsPerSecondPerSquareMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.NaN)); + Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.NaN)); } [Fact] public void As() { - var kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); + var kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); AssertEx.EqualTolerance(GramsPerSecondPerSquareMeterInOneKilogramPerSecondPerSquareMeter, kilogrampersecondpersquaremeter.As(MassFluxUnit.GramPerSecondPerSquareMeter), GramsPerSecondPerSquareMeterTolerance); AssertEx.EqualTolerance(KilogramsPerSecondPerSquareMeterInOneKilogramPerSecondPerSquareMeter, kilogrampersecondpersquaremeter.As(MassFluxUnit.KilogramPerSecondPerSquareMeter), KilogramsPerSecondPerSquareMeterTolerance); } @@ -100,7 +100,7 @@ public void As() [Fact] public void ToUnit() { - var kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); + var kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); var grampersecondpersquaremeterQuantity = kilogrampersecondpersquaremeter.ToUnit(MassFluxUnit.GramPerSecondPerSquareMeter); AssertEx.EqualTolerance(GramsPerSecondPerSquareMeterInOneKilogramPerSecondPerSquareMeter, (double)grampersecondpersquaremeterQuantity.Value, GramsPerSecondPerSquareMeterTolerance); @@ -114,29 +114,29 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - AssertEx.EqualTolerance(1, MassFlux.FromGramsPerSecondPerSquareMeter(kilogrampersecondpersquaremeter.GramsPerSecondPerSquareMeter).KilogramsPerSecondPerSquareMeter, GramsPerSecondPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, MassFlux.FromKilogramsPerSecondPerSquareMeter(kilogrampersecondpersquaremeter.KilogramsPerSecondPerSquareMeter).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); + MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); + AssertEx.EqualTolerance(1, MassFlux.FromGramsPerSecondPerSquareMeter(kilogrampersecondpersquaremeter.GramsPerSecondPerSquareMeter).KilogramsPerSecondPerSquareMeter, GramsPerSecondPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, MassFlux.FromKilogramsPerSecondPerSquareMeter(kilogrampersecondpersquaremeter.KilogramsPerSecondPerSquareMeter).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); } [Fact] public void ArithmeticOperators() { - MassFlux v = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); + MassFlux v = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); AssertEx.EqualTolerance(-1, -v.KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (MassFlux.FromKilogramsPerSecondPerSquareMeter(3)-v).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, (MassFlux.FromKilogramsPerSecondPerSquareMeter(3)-v).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); AssertEx.EqualTolerance(2, (v + v).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); AssertEx.EqualTolerance(10, (v*10).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); AssertEx.EqualTolerance(10, (10*v).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (MassFlux.FromKilogramsPerSecondPerSquareMeter(10)/5).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, MassFlux.FromKilogramsPerSecondPerSquareMeter(10)/MassFlux.FromKilogramsPerSecondPerSquareMeter(5), KilogramsPerSecondPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, (MassFlux.FromKilogramsPerSecondPerSquareMeter(10)/5).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); + AssertEx.EqualTolerance(2, MassFlux.FromKilogramsPerSecondPerSquareMeter(10)/MassFlux.FromKilogramsPerSecondPerSquareMeter(5), KilogramsPerSecondPerSquareMeterTolerance); } [Fact] public void ComparisonOperators() { - MassFlux oneKilogramPerSecondPerSquareMeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - MassFlux twoKilogramsPerSecondPerSquareMeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(2); + MassFlux oneKilogramPerSecondPerSquareMeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); + MassFlux twoKilogramsPerSecondPerSquareMeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(2); Assert.True(oneKilogramPerSecondPerSquareMeter < twoKilogramsPerSecondPerSquareMeter); Assert.True(oneKilogramPerSecondPerSquareMeter <= twoKilogramsPerSecondPerSquareMeter); @@ -152,31 +152,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); + MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); Assert.Equal(0, kilogrampersecondpersquaremeter.CompareTo(kilogrampersecondpersquaremeter)); - Assert.True(kilogrampersecondpersquaremeter.CompareTo(MassFlux.Zero) > 0); - Assert.True(MassFlux.Zero.CompareTo(kilogrampersecondpersquaremeter) < 0); + Assert.True(kilogrampersecondpersquaremeter.CompareTo(MassFlux.Zero) > 0); + Assert.True(MassFlux.Zero.CompareTo(kilogrampersecondpersquaremeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); + MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); Assert.Throws(() => kilogrampersecondpersquaremeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); + MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); Assert.Throws(() => kilogrampersecondpersquaremeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - var b = MassFlux.FromKilogramsPerSecondPerSquareMeter(2); + var a = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); + var b = MassFlux.FromKilogramsPerSecondPerSquareMeter(2); // ReSharper disable EqualExpressionComparison @@ -195,8 +195,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - var b = MassFlux.FromKilogramsPerSecondPerSquareMeter(2); + var a = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); + var b = MassFlux.FromKilogramsPerSecondPerSquareMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -206,29 +206,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - Assert.True(v.Equals(MassFlux.FromKilogramsPerSecondPerSquareMeter(1), KilogramsPerSecondPerSquareMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MassFlux.Zero, KilogramsPerSecondPerSquareMeterTolerance, ComparisonType.Relative)); + var v = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); + Assert.True(v.Equals(MassFlux.FromKilogramsPerSecondPerSquareMeter(1), KilogramsPerSecondPerSquareMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MassFlux.Zero, KilogramsPerSecondPerSquareMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); + MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); Assert.False(kilogrampersecondpersquaremeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); + MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); Assert.False(kilogrampersecondpersquaremeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(MassFluxUnit.Undefined, MassFlux.Units); + Assert.DoesNotContain(MassFluxUnit.Undefined, MassFlux.Units); } [Fact] @@ -247,7 +247,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(MassFlux.BaseDimensions is null); + Assert.False(MassFlux.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/MassFractionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFractionTestsBase.g.cs index ef449bd129..e33da44457 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFractionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFractionTestsBase.g.cs @@ -89,26 +89,26 @@ public abstract partial class MassFractionTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new MassFraction((double)0.0, MassFractionUnit.Undefined)); + Assert.Throws(() => new MassFraction((double)0.0, MassFractionUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new MassFraction(double.PositiveInfinity, MassFractionUnit.DecimalFraction)); - Assert.Throws(() => new MassFraction(double.NegativeInfinity, MassFractionUnit.DecimalFraction)); + Assert.Throws(() => new MassFraction(double.PositiveInfinity, MassFractionUnit.DecimalFraction)); + Assert.Throws(() => new MassFraction(double.NegativeInfinity, MassFractionUnit.DecimalFraction)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new MassFraction(double.NaN, MassFractionUnit.DecimalFraction)); + Assert.Throws(() => new MassFraction(double.NaN, MassFractionUnit.DecimalFraction)); } [Fact] public void DecimalFractionToMassFractionUnits() { - MassFraction decimalfraction = MassFraction.FromDecimalFractions(1); + MassFraction decimalfraction = MassFraction.FromDecimalFractions(1); AssertEx.EqualTolerance(CentigramsPerGramInOneDecimalFraction, decimalfraction.CentigramsPerGram, CentigramsPerGramTolerance); AssertEx.EqualTolerance(CentigramsPerKilogramInOneDecimalFraction, decimalfraction.CentigramsPerKilogram, CentigramsPerKilogramTolerance); AssertEx.EqualTolerance(DecagramsPerGramInOneDecimalFraction, decimalfraction.DecagramsPerGram, DecagramsPerGramTolerance); @@ -138,49 +138,49 @@ public void DecimalFractionToMassFractionUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.CentigramPerGram).CentigramsPerGram, CentigramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.CentigramPerKilogram).CentigramsPerKilogram, CentigramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.DecagramPerGram).DecagramsPerGram, DecagramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.DecagramPerKilogram).DecagramsPerKilogram, DecagramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.DecigramPerGram).DecigramsPerGram, DecigramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.DecigramPerKilogram).DecigramsPerKilogram, DecigramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.DecimalFraction).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.GramPerGram).GramsPerGram, GramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.GramPerKilogram).GramsPerKilogram, GramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.HectogramPerGram).HectogramsPerGram, HectogramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.HectogramPerKilogram).HectogramsPerKilogram, HectogramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.KilogramPerGram).KilogramsPerGram, KilogramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.KilogramPerKilogram).KilogramsPerKilogram, KilogramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.MicrogramPerGram).MicrogramsPerGram, MicrogramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.MicrogramPerKilogram).MicrogramsPerKilogram, MicrogramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.MilligramPerGram).MilligramsPerGram, MilligramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.MilligramPerKilogram).MilligramsPerKilogram, MilligramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.NanogramPerGram).NanogramsPerGram, NanogramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.NanogramPerKilogram).NanogramsPerKilogram, NanogramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.PartPerBillion).PartsPerBillion, PartsPerBillionTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.PartPerMillion).PartsPerMillion, PartsPerMillionTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.PartPerThousand).PartsPerThousand, PartsPerThousandTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.PartPerTrillion).PartsPerTrillion, PartsPerTrillionTolerance); - AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.Percent).Percent, PercentTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.CentigramPerGram).CentigramsPerGram, CentigramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.CentigramPerKilogram).CentigramsPerKilogram, CentigramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.DecagramPerGram).DecagramsPerGram, DecagramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.DecagramPerKilogram).DecagramsPerKilogram, DecagramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.DecigramPerGram).DecigramsPerGram, DecigramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.DecigramPerKilogram).DecigramsPerKilogram, DecigramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.DecimalFraction).DecimalFractions, DecimalFractionsTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.GramPerGram).GramsPerGram, GramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.GramPerKilogram).GramsPerKilogram, GramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.HectogramPerGram).HectogramsPerGram, HectogramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.HectogramPerKilogram).HectogramsPerKilogram, HectogramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.KilogramPerGram).KilogramsPerGram, KilogramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.KilogramPerKilogram).KilogramsPerKilogram, KilogramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.MicrogramPerGram).MicrogramsPerGram, MicrogramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.MicrogramPerKilogram).MicrogramsPerKilogram, MicrogramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.MilligramPerGram).MilligramsPerGram, MilligramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.MilligramPerKilogram).MilligramsPerKilogram, MilligramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.NanogramPerGram).NanogramsPerGram, NanogramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.NanogramPerKilogram).NanogramsPerKilogram, NanogramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.PartPerBillion).PartsPerBillion, PartsPerBillionTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.PartPerMillion).PartsPerMillion, PartsPerMillionTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.PartPerThousand).PartsPerThousand, PartsPerThousandTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.PartPerTrillion).PartsPerTrillion, PartsPerTrillionTolerance); + AssertEx.EqualTolerance(1, MassFraction.From(1, MassFractionUnit.Percent).Percent, PercentTolerance); } [Fact] public void FromDecimalFractions_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => MassFraction.FromDecimalFractions(double.PositiveInfinity)); - Assert.Throws(() => MassFraction.FromDecimalFractions(double.NegativeInfinity)); + Assert.Throws(() => MassFraction.FromDecimalFractions(double.PositiveInfinity)); + Assert.Throws(() => MassFraction.FromDecimalFractions(double.NegativeInfinity)); } [Fact] public void FromDecimalFractions_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => MassFraction.FromDecimalFractions(double.NaN)); + Assert.Throws(() => MassFraction.FromDecimalFractions(double.NaN)); } [Fact] public void As() { - var decimalfraction = MassFraction.FromDecimalFractions(1); + var decimalfraction = MassFraction.FromDecimalFractions(1); AssertEx.EqualTolerance(CentigramsPerGramInOneDecimalFraction, decimalfraction.As(MassFractionUnit.CentigramPerGram), CentigramsPerGramTolerance); AssertEx.EqualTolerance(CentigramsPerKilogramInOneDecimalFraction, decimalfraction.As(MassFractionUnit.CentigramPerKilogram), CentigramsPerKilogramTolerance); AssertEx.EqualTolerance(DecagramsPerGramInOneDecimalFraction, decimalfraction.As(MassFractionUnit.DecagramPerGram), DecagramsPerGramTolerance); @@ -210,7 +210,7 @@ public void As() [Fact] public void ToUnit() { - var decimalfraction = MassFraction.FromDecimalFractions(1); + var decimalfraction = MassFraction.FromDecimalFractions(1); var centigrampergramQuantity = decimalfraction.ToUnit(MassFractionUnit.CentigramPerGram); AssertEx.EqualTolerance(CentigramsPerGramInOneDecimalFraction, (double)centigrampergramQuantity.Value, CentigramsPerGramTolerance); @@ -312,51 +312,51 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - MassFraction decimalfraction = MassFraction.FromDecimalFractions(1); - AssertEx.EqualTolerance(1, MassFraction.FromCentigramsPerGram(decimalfraction.CentigramsPerGram).DecimalFractions, CentigramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromCentigramsPerKilogram(decimalfraction.CentigramsPerKilogram).DecimalFractions, CentigramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromDecagramsPerGram(decimalfraction.DecagramsPerGram).DecimalFractions, DecagramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromDecagramsPerKilogram(decimalfraction.DecagramsPerKilogram).DecimalFractions, DecagramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromDecigramsPerGram(decimalfraction.DecigramsPerGram).DecimalFractions, DecigramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromDecigramsPerKilogram(decimalfraction.DecigramsPerKilogram).DecimalFractions, DecigramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromDecimalFractions(decimalfraction.DecimalFractions).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromGramsPerGram(decimalfraction.GramsPerGram).DecimalFractions, GramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromGramsPerKilogram(decimalfraction.GramsPerKilogram).DecimalFractions, GramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromHectogramsPerGram(decimalfraction.HectogramsPerGram).DecimalFractions, HectogramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromHectogramsPerKilogram(decimalfraction.HectogramsPerKilogram).DecimalFractions, HectogramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromKilogramsPerGram(decimalfraction.KilogramsPerGram).DecimalFractions, KilogramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromKilogramsPerKilogram(decimalfraction.KilogramsPerKilogram).DecimalFractions, KilogramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromMicrogramsPerGram(decimalfraction.MicrogramsPerGram).DecimalFractions, MicrogramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromMicrogramsPerKilogram(decimalfraction.MicrogramsPerKilogram).DecimalFractions, MicrogramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromMilligramsPerGram(decimalfraction.MilligramsPerGram).DecimalFractions, MilligramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromMilligramsPerKilogram(decimalfraction.MilligramsPerKilogram).DecimalFractions, MilligramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromNanogramsPerGram(decimalfraction.NanogramsPerGram).DecimalFractions, NanogramsPerGramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromNanogramsPerKilogram(decimalfraction.NanogramsPerKilogram).DecimalFractions, NanogramsPerKilogramTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromPartsPerBillion(decimalfraction.PartsPerBillion).DecimalFractions, PartsPerBillionTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromPartsPerMillion(decimalfraction.PartsPerMillion).DecimalFractions, PartsPerMillionTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromPartsPerThousand(decimalfraction.PartsPerThousand).DecimalFractions, PartsPerThousandTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromPartsPerTrillion(decimalfraction.PartsPerTrillion).DecimalFractions, PartsPerTrillionTolerance); - AssertEx.EqualTolerance(1, MassFraction.FromPercent(decimalfraction.Percent).DecimalFractions, PercentTolerance); + MassFraction decimalfraction = MassFraction.FromDecimalFractions(1); + AssertEx.EqualTolerance(1, MassFraction.FromCentigramsPerGram(decimalfraction.CentigramsPerGram).DecimalFractions, CentigramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromCentigramsPerKilogram(decimalfraction.CentigramsPerKilogram).DecimalFractions, CentigramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromDecagramsPerGram(decimalfraction.DecagramsPerGram).DecimalFractions, DecagramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromDecagramsPerKilogram(decimalfraction.DecagramsPerKilogram).DecimalFractions, DecagramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromDecigramsPerGram(decimalfraction.DecigramsPerGram).DecimalFractions, DecigramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromDecigramsPerKilogram(decimalfraction.DecigramsPerKilogram).DecimalFractions, DecigramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromDecimalFractions(decimalfraction.DecimalFractions).DecimalFractions, DecimalFractionsTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromGramsPerGram(decimalfraction.GramsPerGram).DecimalFractions, GramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromGramsPerKilogram(decimalfraction.GramsPerKilogram).DecimalFractions, GramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromHectogramsPerGram(decimalfraction.HectogramsPerGram).DecimalFractions, HectogramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromHectogramsPerKilogram(decimalfraction.HectogramsPerKilogram).DecimalFractions, HectogramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromKilogramsPerGram(decimalfraction.KilogramsPerGram).DecimalFractions, KilogramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromKilogramsPerKilogram(decimalfraction.KilogramsPerKilogram).DecimalFractions, KilogramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromMicrogramsPerGram(decimalfraction.MicrogramsPerGram).DecimalFractions, MicrogramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromMicrogramsPerKilogram(decimalfraction.MicrogramsPerKilogram).DecimalFractions, MicrogramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromMilligramsPerGram(decimalfraction.MilligramsPerGram).DecimalFractions, MilligramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromMilligramsPerKilogram(decimalfraction.MilligramsPerKilogram).DecimalFractions, MilligramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromNanogramsPerGram(decimalfraction.NanogramsPerGram).DecimalFractions, NanogramsPerGramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromNanogramsPerKilogram(decimalfraction.NanogramsPerKilogram).DecimalFractions, NanogramsPerKilogramTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromPartsPerBillion(decimalfraction.PartsPerBillion).DecimalFractions, PartsPerBillionTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromPartsPerMillion(decimalfraction.PartsPerMillion).DecimalFractions, PartsPerMillionTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromPartsPerThousand(decimalfraction.PartsPerThousand).DecimalFractions, PartsPerThousandTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromPartsPerTrillion(decimalfraction.PartsPerTrillion).DecimalFractions, PartsPerTrillionTolerance); + AssertEx.EqualTolerance(1, MassFraction.FromPercent(decimalfraction.Percent).DecimalFractions, PercentTolerance); } [Fact] public void ArithmeticOperators() { - MassFraction v = MassFraction.FromDecimalFractions(1); + MassFraction v = MassFraction.FromDecimalFractions(1); AssertEx.EqualTolerance(-1, -v.DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(2, (MassFraction.FromDecimalFractions(3)-v).DecimalFractions, DecimalFractionsTolerance); + AssertEx.EqualTolerance(2, (MassFraction.FromDecimalFractions(3)-v).DecimalFractions, DecimalFractionsTolerance); AssertEx.EqualTolerance(2, (v + v).DecimalFractions, DecimalFractionsTolerance); AssertEx.EqualTolerance(10, (v*10).DecimalFractions, DecimalFractionsTolerance); AssertEx.EqualTolerance(10, (10*v).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(2, (MassFraction.FromDecimalFractions(10)/5).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(2, MassFraction.FromDecimalFractions(10)/MassFraction.FromDecimalFractions(5), DecimalFractionsTolerance); + AssertEx.EqualTolerance(2, (MassFraction.FromDecimalFractions(10)/5).DecimalFractions, DecimalFractionsTolerance); + AssertEx.EqualTolerance(2, MassFraction.FromDecimalFractions(10)/MassFraction.FromDecimalFractions(5), DecimalFractionsTolerance); } [Fact] public void ComparisonOperators() { - MassFraction oneDecimalFraction = MassFraction.FromDecimalFractions(1); - MassFraction twoDecimalFractions = MassFraction.FromDecimalFractions(2); + MassFraction oneDecimalFraction = MassFraction.FromDecimalFractions(1); + MassFraction twoDecimalFractions = MassFraction.FromDecimalFractions(2); Assert.True(oneDecimalFraction < twoDecimalFractions); Assert.True(oneDecimalFraction <= twoDecimalFractions); @@ -372,31 +372,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - MassFraction decimalfraction = MassFraction.FromDecimalFractions(1); + MassFraction decimalfraction = MassFraction.FromDecimalFractions(1); Assert.Equal(0, decimalfraction.CompareTo(decimalfraction)); - Assert.True(decimalfraction.CompareTo(MassFraction.Zero) > 0); - Assert.True(MassFraction.Zero.CompareTo(decimalfraction) < 0); + Assert.True(decimalfraction.CompareTo(MassFraction.Zero) > 0); + Assert.True(MassFraction.Zero.CompareTo(decimalfraction) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - MassFraction decimalfraction = MassFraction.FromDecimalFractions(1); + MassFraction decimalfraction = MassFraction.FromDecimalFractions(1); Assert.Throws(() => decimalfraction.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - MassFraction decimalfraction = MassFraction.FromDecimalFractions(1); + MassFraction decimalfraction = MassFraction.FromDecimalFractions(1); Assert.Throws(() => decimalfraction.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = MassFraction.FromDecimalFractions(1); - var b = MassFraction.FromDecimalFractions(2); + var a = MassFraction.FromDecimalFractions(1); + var b = MassFraction.FromDecimalFractions(2); // ReSharper disable EqualExpressionComparison @@ -415,8 +415,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = MassFraction.FromDecimalFractions(1); - var b = MassFraction.FromDecimalFractions(2); + var a = MassFraction.FromDecimalFractions(1); + var b = MassFraction.FromDecimalFractions(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -426,29 +426,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = MassFraction.FromDecimalFractions(1); - Assert.True(v.Equals(MassFraction.FromDecimalFractions(1), DecimalFractionsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MassFraction.Zero, DecimalFractionsTolerance, ComparisonType.Relative)); + var v = MassFraction.FromDecimalFractions(1); + Assert.True(v.Equals(MassFraction.FromDecimalFractions(1), DecimalFractionsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MassFraction.Zero, DecimalFractionsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - MassFraction decimalfraction = MassFraction.FromDecimalFractions(1); + MassFraction decimalfraction = MassFraction.FromDecimalFractions(1); Assert.False(decimalfraction.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - MassFraction decimalfraction = MassFraction.FromDecimalFractions(1); + MassFraction decimalfraction = MassFraction.FromDecimalFractions(1); Assert.False(decimalfraction.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(MassFractionUnit.Undefined, MassFraction.Units); + Assert.DoesNotContain(MassFractionUnit.Undefined, MassFraction.Units); } [Fact] @@ -467,7 +467,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(MassFraction.BaseDimensions is null); + Assert.False(MassFraction.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs index 8e489142a1..a3763c25b2 100644 --- a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs @@ -97,26 +97,26 @@ public abstract partial class MassMomentOfInertiaTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new MassMomentOfInertia((double)0.0, MassMomentOfInertiaUnit.Undefined)); + Assert.Throws(() => new MassMomentOfInertia((double)0.0, MassMomentOfInertiaUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new MassMomentOfInertia(double.PositiveInfinity, MassMomentOfInertiaUnit.KilogramSquareMeter)); - Assert.Throws(() => new MassMomentOfInertia(double.NegativeInfinity, MassMomentOfInertiaUnit.KilogramSquareMeter)); + Assert.Throws(() => new MassMomentOfInertia(double.PositiveInfinity, MassMomentOfInertiaUnit.KilogramSquareMeter)); + Assert.Throws(() => new MassMomentOfInertia(double.NegativeInfinity, MassMomentOfInertiaUnit.KilogramSquareMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new MassMomentOfInertia(double.NaN, MassMomentOfInertiaUnit.KilogramSquareMeter)); + Assert.Throws(() => new MassMomentOfInertia(double.NaN, MassMomentOfInertiaUnit.KilogramSquareMeter)); } [Fact] public void KilogramSquareMeterToMassMomentOfInertiaUnits() { - MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); + MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); AssertEx.EqualTolerance(GramSquareCentimetersInOneKilogramSquareMeter, kilogramsquaremeter.GramSquareCentimeters, GramSquareCentimetersTolerance); AssertEx.EqualTolerance(GramSquareDecimetersInOneKilogramSquareMeter, kilogramsquaremeter.GramSquareDecimeters, GramSquareDecimetersTolerance); AssertEx.EqualTolerance(GramSquareMetersInOneKilogramSquareMeter, kilogramsquaremeter.GramSquareMeters, GramSquareMetersTolerance); @@ -150,53 +150,53 @@ public void KilogramSquareMeterToMassMomentOfInertiaUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.GramSquareCentimeter).GramSquareCentimeters, GramSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.GramSquareDecimeter).GramSquareDecimeters, GramSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.GramSquareMeter).GramSquareMeters, GramSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.GramSquareMillimeter).GramSquareMillimeters, GramSquareMillimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilogramSquareCentimeter).KilogramSquareCentimeters, KilogramSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilogramSquareDecimeter).KilogramSquareDecimeters, KilogramSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilogramSquareMeter).KilogramSquareMeters, KilogramSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilogramSquareMillimeter).KilogramSquareMillimeters, KilogramSquareMillimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilotonneSquareCentimeter).KilotonneSquareCentimeters, KilotonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilotonneSquareDecimeter).KilotonneSquareDecimeters, KilotonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilotonneSquareMeter).KilotonneSquareMeters, KilotonneSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilotonneSquareMilimeter).KilotonneSquareMilimeters, KilotonneSquareMilimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MegatonneSquareCentimeter).MegatonneSquareCentimeters, MegatonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MegatonneSquareDecimeter).MegatonneSquareDecimeters, MegatonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MegatonneSquareMeter).MegatonneSquareMeters, MegatonneSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MegatonneSquareMilimeter).MegatonneSquareMilimeters, MegatonneSquareMilimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MilligramSquareCentimeter).MilligramSquareCentimeters, MilligramSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MilligramSquareDecimeter).MilligramSquareDecimeters, MilligramSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MilligramSquareMeter).MilligramSquareMeters, MilligramSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MilligramSquareMillimeter).MilligramSquareMillimeters, MilligramSquareMillimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.PoundSquareFoot).PoundSquareFeet, PoundSquareFeetTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.PoundSquareInch).PoundSquareInches, PoundSquareInchesTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.SlugSquareFoot).SlugSquareFeet, SlugSquareFeetTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.SlugSquareInch).SlugSquareInches, SlugSquareInchesTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.TonneSquareCentimeter).TonneSquareCentimeters, TonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.TonneSquareDecimeter).TonneSquareDecimeters, TonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.TonneSquareMeter).TonneSquareMeters, TonneSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.TonneSquareMilimeter).TonneSquareMilimeters, TonneSquareMilimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.GramSquareCentimeter).GramSquareCentimeters, GramSquareCentimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.GramSquareDecimeter).GramSquareDecimeters, GramSquareDecimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.GramSquareMeter).GramSquareMeters, GramSquareMetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.GramSquareMillimeter).GramSquareMillimeters, GramSquareMillimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilogramSquareCentimeter).KilogramSquareCentimeters, KilogramSquareCentimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilogramSquareDecimeter).KilogramSquareDecimeters, KilogramSquareDecimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilogramSquareMeter).KilogramSquareMeters, KilogramSquareMetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilogramSquareMillimeter).KilogramSquareMillimeters, KilogramSquareMillimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilotonneSquareCentimeter).KilotonneSquareCentimeters, KilotonneSquareCentimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilotonneSquareDecimeter).KilotonneSquareDecimeters, KilotonneSquareDecimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilotonneSquareMeter).KilotonneSquareMeters, KilotonneSquareMetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilotonneSquareMilimeter).KilotonneSquareMilimeters, KilotonneSquareMilimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MegatonneSquareCentimeter).MegatonneSquareCentimeters, MegatonneSquareCentimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MegatonneSquareDecimeter).MegatonneSquareDecimeters, MegatonneSquareDecimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MegatonneSquareMeter).MegatonneSquareMeters, MegatonneSquareMetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MegatonneSquareMilimeter).MegatonneSquareMilimeters, MegatonneSquareMilimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MilligramSquareCentimeter).MilligramSquareCentimeters, MilligramSquareCentimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MilligramSquareDecimeter).MilligramSquareDecimeters, MilligramSquareDecimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MilligramSquareMeter).MilligramSquareMeters, MilligramSquareMetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MilligramSquareMillimeter).MilligramSquareMillimeters, MilligramSquareMillimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.PoundSquareFoot).PoundSquareFeet, PoundSquareFeetTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.PoundSquareInch).PoundSquareInches, PoundSquareInchesTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.SlugSquareFoot).SlugSquareFeet, SlugSquareFeetTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.SlugSquareInch).SlugSquareInches, SlugSquareInchesTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.TonneSquareCentimeter).TonneSquareCentimeters, TonneSquareCentimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.TonneSquareDecimeter).TonneSquareDecimeters, TonneSquareDecimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.TonneSquareMeter).TonneSquareMeters, TonneSquareMetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.TonneSquareMilimeter).TonneSquareMilimeters, TonneSquareMilimetersTolerance); } [Fact] public void FromKilogramSquareMeters_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.PositiveInfinity)); - Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.NegativeInfinity)); + Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.PositiveInfinity)); + Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.NegativeInfinity)); } [Fact] public void FromKilogramSquareMeters_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.NaN)); + Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.NaN)); } [Fact] public void As() { - var kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); + var kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); AssertEx.EqualTolerance(GramSquareCentimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.GramSquareCentimeter), GramSquareCentimetersTolerance); AssertEx.EqualTolerance(GramSquareDecimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.GramSquareDecimeter), GramSquareDecimetersTolerance); AssertEx.EqualTolerance(GramSquareMetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.GramSquareMeter), GramSquareMetersTolerance); @@ -230,7 +230,7 @@ public void As() [Fact] public void ToUnit() { - var kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); + var kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); var gramsquarecentimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.GramSquareCentimeter); AssertEx.EqualTolerance(GramSquareCentimetersInOneKilogramSquareMeter, (double)gramsquarecentimeterQuantity.Value, GramSquareCentimetersTolerance); @@ -348,55 +348,55 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromGramSquareCentimeters(kilogramsquaremeter.GramSquareCentimeters).KilogramSquareMeters, GramSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromGramSquareDecimeters(kilogramsquaremeter.GramSquareDecimeters).KilogramSquareMeters, GramSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromGramSquareMeters(kilogramsquaremeter.GramSquareMeters).KilogramSquareMeters, GramSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromGramSquareMillimeters(kilogramsquaremeter.GramSquareMillimeters).KilogramSquareMeters, GramSquareMillimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilogramSquareCentimeters(kilogramsquaremeter.KilogramSquareCentimeters).KilogramSquareMeters, KilogramSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilogramSquareDecimeters(kilogramsquaremeter.KilogramSquareDecimeters).KilogramSquareMeters, KilogramSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilogramSquareMeters(kilogramsquaremeter.KilogramSquareMeters).KilogramSquareMeters, KilogramSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilogramSquareMillimeters(kilogramsquaremeter.KilogramSquareMillimeters).KilogramSquareMeters, KilogramSquareMillimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilotonneSquareCentimeters(kilogramsquaremeter.KilotonneSquareCentimeters).KilogramSquareMeters, KilotonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilotonneSquareDecimeters(kilogramsquaremeter.KilotonneSquareDecimeters).KilogramSquareMeters, KilotonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilotonneSquareMeters(kilogramsquaremeter.KilotonneSquareMeters).KilogramSquareMeters, KilotonneSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilotonneSquareMilimeters(kilogramsquaremeter.KilotonneSquareMilimeters).KilogramSquareMeters, KilotonneSquareMilimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMegatonneSquareCentimeters(kilogramsquaremeter.MegatonneSquareCentimeters).KilogramSquareMeters, MegatonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMegatonneSquareDecimeters(kilogramsquaremeter.MegatonneSquareDecimeters).KilogramSquareMeters, MegatonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMegatonneSquareMeters(kilogramsquaremeter.MegatonneSquareMeters).KilogramSquareMeters, MegatonneSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMegatonneSquareMilimeters(kilogramsquaremeter.MegatonneSquareMilimeters).KilogramSquareMeters, MegatonneSquareMilimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMilligramSquareCentimeters(kilogramsquaremeter.MilligramSquareCentimeters).KilogramSquareMeters, MilligramSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMilligramSquareDecimeters(kilogramsquaremeter.MilligramSquareDecimeters).KilogramSquareMeters, MilligramSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMilligramSquareMeters(kilogramsquaremeter.MilligramSquareMeters).KilogramSquareMeters, MilligramSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMilligramSquareMillimeters(kilogramsquaremeter.MilligramSquareMillimeters).KilogramSquareMeters, MilligramSquareMillimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromPoundSquareFeet(kilogramsquaremeter.PoundSquareFeet).KilogramSquareMeters, PoundSquareFeetTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromPoundSquareInches(kilogramsquaremeter.PoundSquareInches).KilogramSquareMeters, PoundSquareInchesTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromSlugSquareFeet(kilogramsquaremeter.SlugSquareFeet).KilogramSquareMeters, SlugSquareFeetTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromSlugSquareInches(kilogramsquaremeter.SlugSquareInches).KilogramSquareMeters, SlugSquareInchesTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromTonneSquareCentimeters(kilogramsquaremeter.TonneSquareCentimeters).KilogramSquareMeters, TonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromTonneSquareDecimeters(kilogramsquaremeter.TonneSquareDecimeters).KilogramSquareMeters, TonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromTonneSquareMeters(kilogramsquaremeter.TonneSquareMeters).KilogramSquareMeters, TonneSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromTonneSquareMilimeters(kilogramsquaremeter.TonneSquareMilimeters).KilogramSquareMeters, TonneSquareMilimetersTolerance); + MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromGramSquareCentimeters(kilogramsquaremeter.GramSquareCentimeters).KilogramSquareMeters, GramSquareCentimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromGramSquareDecimeters(kilogramsquaremeter.GramSquareDecimeters).KilogramSquareMeters, GramSquareDecimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromGramSquareMeters(kilogramsquaremeter.GramSquareMeters).KilogramSquareMeters, GramSquareMetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromGramSquareMillimeters(kilogramsquaremeter.GramSquareMillimeters).KilogramSquareMeters, GramSquareMillimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilogramSquareCentimeters(kilogramsquaremeter.KilogramSquareCentimeters).KilogramSquareMeters, KilogramSquareCentimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilogramSquareDecimeters(kilogramsquaremeter.KilogramSquareDecimeters).KilogramSquareMeters, KilogramSquareDecimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilogramSquareMeters(kilogramsquaremeter.KilogramSquareMeters).KilogramSquareMeters, KilogramSquareMetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilogramSquareMillimeters(kilogramsquaremeter.KilogramSquareMillimeters).KilogramSquareMeters, KilogramSquareMillimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilotonneSquareCentimeters(kilogramsquaremeter.KilotonneSquareCentimeters).KilogramSquareMeters, KilotonneSquareCentimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilotonneSquareDecimeters(kilogramsquaremeter.KilotonneSquareDecimeters).KilogramSquareMeters, KilotonneSquareDecimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilotonneSquareMeters(kilogramsquaremeter.KilotonneSquareMeters).KilogramSquareMeters, KilotonneSquareMetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilotonneSquareMilimeters(kilogramsquaremeter.KilotonneSquareMilimeters).KilogramSquareMeters, KilotonneSquareMilimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMegatonneSquareCentimeters(kilogramsquaremeter.MegatonneSquareCentimeters).KilogramSquareMeters, MegatonneSquareCentimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMegatonneSquareDecimeters(kilogramsquaremeter.MegatonneSquareDecimeters).KilogramSquareMeters, MegatonneSquareDecimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMegatonneSquareMeters(kilogramsquaremeter.MegatonneSquareMeters).KilogramSquareMeters, MegatonneSquareMetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMegatonneSquareMilimeters(kilogramsquaremeter.MegatonneSquareMilimeters).KilogramSquareMeters, MegatonneSquareMilimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMilligramSquareCentimeters(kilogramsquaremeter.MilligramSquareCentimeters).KilogramSquareMeters, MilligramSquareCentimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMilligramSquareDecimeters(kilogramsquaremeter.MilligramSquareDecimeters).KilogramSquareMeters, MilligramSquareDecimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMilligramSquareMeters(kilogramsquaremeter.MilligramSquareMeters).KilogramSquareMeters, MilligramSquareMetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMilligramSquareMillimeters(kilogramsquaremeter.MilligramSquareMillimeters).KilogramSquareMeters, MilligramSquareMillimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromPoundSquareFeet(kilogramsquaremeter.PoundSquareFeet).KilogramSquareMeters, PoundSquareFeetTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromPoundSquareInches(kilogramsquaremeter.PoundSquareInches).KilogramSquareMeters, PoundSquareInchesTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromSlugSquareFeet(kilogramsquaremeter.SlugSquareFeet).KilogramSquareMeters, SlugSquareFeetTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromSlugSquareInches(kilogramsquaremeter.SlugSquareInches).KilogramSquareMeters, SlugSquareInchesTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromTonneSquareCentimeters(kilogramsquaremeter.TonneSquareCentimeters).KilogramSquareMeters, TonneSquareCentimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromTonneSquareDecimeters(kilogramsquaremeter.TonneSquareDecimeters).KilogramSquareMeters, TonneSquareDecimetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromTonneSquareMeters(kilogramsquaremeter.TonneSquareMeters).KilogramSquareMeters, TonneSquareMetersTolerance); + AssertEx.EqualTolerance(1, MassMomentOfInertia.FromTonneSquareMilimeters(kilogramsquaremeter.TonneSquareMilimeters).KilogramSquareMeters, TonneSquareMilimetersTolerance); } [Fact] public void ArithmeticOperators() { - MassMomentOfInertia v = MassMomentOfInertia.FromKilogramSquareMeters(1); + MassMomentOfInertia v = MassMomentOfInertia.FromKilogramSquareMeters(1); AssertEx.EqualTolerance(-1, -v.KilogramSquareMeters, KilogramSquareMetersTolerance); - AssertEx.EqualTolerance(2, (MassMomentOfInertia.FromKilogramSquareMeters(3)-v).KilogramSquareMeters, KilogramSquareMetersTolerance); + AssertEx.EqualTolerance(2, (MassMomentOfInertia.FromKilogramSquareMeters(3)-v).KilogramSquareMeters, KilogramSquareMetersTolerance); AssertEx.EqualTolerance(2, (v + v).KilogramSquareMeters, KilogramSquareMetersTolerance); AssertEx.EqualTolerance(10, (v*10).KilogramSquareMeters, KilogramSquareMetersTolerance); AssertEx.EqualTolerance(10, (10*v).KilogramSquareMeters, KilogramSquareMetersTolerance); - AssertEx.EqualTolerance(2, (MassMomentOfInertia.FromKilogramSquareMeters(10)/5).KilogramSquareMeters, KilogramSquareMetersTolerance); - AssertEx.EqualTolerance(2, MassMomentOfInertia.FromKilogramSquareMeters(10)/MassMomentOfInertia.FromKilogramSquareMeters(5), KilogramSquareMetersTolerance); + AssertEx.EqualTolerance(2, (MassMomentOfInertia.FromKilogramSquareMeters(10)/5).KilogramSquareMeters, KilogramSquareMetersTolerance); + AssertEx.EqualTolerance(2, MassMomentOfInertia.FromKilogramSquareMeters(10)/MassMomentOfInertia.FromKilogramSquareMeters(5), KilogramSquareMetersTolerance); } [Fact] public void ComparisonOperators() { - MassMomentOfInertia oneKilogramSquareMeter = MassMomentOfInertia.FromKilogramSquareMeters(1); - MassMomentOfInertia twoKilogramSquareMeters = MassMomentOfInertia.FromKilogramSquareMeters(2); + MassMomentOfInertia oneKilogramSquareMeter = MassMomentOfInertia.FromKilogramSquareMeters(1); + MassMomentOfInertia twoKilogramSquareMeters = MassMomentOfInertia.FromKilogramSquareMeters(2); Assert.True(oneKilogramSquareMeter < twoKilogramSquareMeters); Assert.True(oneKilogramSquareMeter <= twoKilogramSquareMeters); @@ -412,31 +412,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); + MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); Assert.Equal(0, kilogramsquaremeter.CompareTo(kilogramsquaremeter)); - Assert.True(kilogramsquaremeter.CompareTo(MassMomentOfInertia.Zero) > 0); - Assert.True(MassMomentOfInertia.Zero.CompareTo(kilogramsquaremeter) < 0); + Assert.True(kilogramsquaremeter.CompareTo(MassMomentOfInertia.Zero) > 0); + Assert.True(MassMomentOfInertia.Zero.CompareTo(kilogramsquaremeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); + MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); Assert.Throws(() => kilogramsquaremeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); + MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); Assert.Throws(() => kilogramsquaremeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = MassMomentOfInertia.FromKilogramSquareMeters(1); - var b = MassMomentOfInertia.FromKilogramSquareMeters(2); + var a = MassMomentOfInertia.FromKilogramSquareMeters(1); + var b = MassMomentOfInertia.FromKilogramSquareMeters(2); // ReSharper disable EqualExpressionComparison @@ -455,8 +455,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = MassMomentOfInertia.FromKilogramSquareMeters(1); - var b = MassMomentOfInertia.FromKilogramSquareMeters(2); + var a = MassMomentOfInertia.FromKilogramSquareMeters(1); + var b = MassMomentOfInertia.FromKilogramSquareMeters(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -466,29 +466,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = MassMomentOfInertia.FromKilogramSquareMeters(1); - Assert.True(v.Equals(MassMomentOfInertia.FromKilogramSquareMeters(1), KilogramSquareMetersTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MassMomentOfInertia.Zero, KilogramSquareMetersTolerance, ComparisonType.Relative)); + var v = MassMomentOfInertia.FromKilogramSquareMeters(1); + Assert.True(v.Equals(MassMomentOfInertia.FromKilogramSquareMeters(1), KilogramSquareMetersTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MassMomentOfInertia.Zero, KilogramSquareMetersTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); + MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); Assert.False(kilogramsquaremeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); + MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); Assert.False(kilogramsquaremeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(MassMomentOfInertiaUnit.Undefined, MassMomentOfInertia.Units); + Assert.DoesNotContain(MassMomentOfInertiaUnit.Undefined, MassMomentOfInertia.Units); } [Fact] @@ -507,7 +507,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(MassMomentOfInertia.BaseDimensions is null); + Assert.False(MassMomentOfInertia.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs index df6c140b10..12543b48e5 100644 --- a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs @@ -91,26 +91,26 @@ public abstract partial class MassTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Mass((double)0.0, MassUnit.Undefined)); + Assert.Throws(() => new Mass((double)0.0, MassUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Mass(double.PositiveInfinity, MassUnit.Kilogram)); - Assert.Throws(() => new Mass(double.NegativeInfinity, MassUnit.Kilogram)); + Assert.Throws(() => new Mass(double.PositiveInfinity, MassUnit.Kilogram)); + Assert.Throws(() => new Mass(double.NegativeInfinity, MassUnit.Kilogram)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Mass(double.NaN, MassUnit.Kilogram)); + Assert.Throws(() => new Mass(double.NaN, MassUnit.Kilogram)); } [Fact] public void KilogramToMassUnits() { - Mass kilogram = Mass.FromKilograms(1); + Mass kilogram = Mass.FromKilograms(1); AssertEx.EqualTolerance(CentigramsInOneKilogram, kilogram.Centigrams, CentigramsTolerance); AssertEx.EqualTolerance(DecagramsInOneKilogram, kilogram.Decagrams, DecagramsTolerance); AssertEx.EqualTolerance(DecigramsInOneKilogram, kilogram.Decigrams, DecigramsTolerance); @@ -141,50 +141,50 @@ public void KilogramToMassUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Centigram).Centigrams, CentigramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Decagram).Decagrams, DecagramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Decigram).Decigrams, DecigramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.EarthMass).EarthMasses, EarthMassesTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Grain).Grains, GrainsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Gram).Grams, GramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Hectogram).Hectograms, HectogramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Kilogram).Kilograms, KilogramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Kilopound).Kilopounds, KilopoundsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Kilotonne).Kilotonnes, KilotonnesTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.LongHundredweight).LongHundredweight, LongHundredweightTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.LongTon).LongTons, LongTonsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Megapound).Megapounds, MegapoundsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Megatonne).Megatonnes, MegatonnesTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Microgram).Micrograms, MicrogramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Milligram).Milligrams, MilligramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Nanogram).Nanograms, NanogramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Ounce).Ounces, OuncesTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Pound).Pounds, PoundsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.ShortHundredweight).ShortHundredweight, ShortHundredweightTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.ShortTon).ShortTons, ShortTonsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Slug).Slugs, SlugsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.SolarMass).SolarMasses, SolarMassesTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Stone).Stone, StoneTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Tonne).Tonnes, TonnesTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Centigram).Centigrams, CentigramsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Decagram).Decagrams, DecagramsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Decigram).Decigrams, DecigramsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.EarthMass).EarthMasses, EarthMassesTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Grain).Grains, GrainsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Gram).Grams, GramsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Hectogram).Hectograms, HectogramsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Kilogram).Kilograms, KilogramsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Kilopound).Kilopounds, KilopoundsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Kilotonne).Kilotonnes, KilotonnesTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.LongHundredweight).LongHundredweight, LongHundredweightTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.LongTon).LongTons, LongTonsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Megapound).Megapounds, MegapoundsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Megatonne).Megatonnes, MegatonnesTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Microgram).Micrograms, MicrogramsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Milligram).Milligrams, MilligramsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Nanogram).Nanograms, NanogramsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Ounce).Ounces, OuncesTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Pound).Pounds, PoundsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.ShortHundredweight).ShortHundredweight, ShortHundredweightTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.ShortTon).ShortTons, ShortTonsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Slug).Slugs, SlugsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.SolarMass).SolarMasses, SolarMassesTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Stone).Stone, StoneTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Tonne).Tonnes, TonnesTolerance); } [Fact] public void FromKilograms_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Mass.FromKilograms(double.PositiveInfinity)); - Assert.Throws(() => Mass.FromKilograms(double.NegativeInfinity)); + Assert.Throws(() => Mass.FromKilograms(double.PositiveInfinity)); + Assert.Throws(() => Mass.FromKilograms(double.NegativeInfinity)); } [Fact] public void FromKilograms_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Mass.FromKilograms(double.NaN)); + Assert.Throws(() => Mass.FromKilograms(double.NaN)); } [Fact] public void As() { - var kilogram = Mass.FromKilograms(1); + var kilogram = Mass.FromKilograms(1); AssertEx.EqualTolerance(CentigramsInOneKilogram, kilogram.As(MassUnit.Centigram), CentigramsTolerance); AssertEx.EqualTolerance(DecagramsInOneKilogram, kilogram.As(MassUnit.Decagram), DecagramsTolerance); AssertEx.EqualTolerance(DecigramsInOneKilogram, kilogram.As(MassUnit.Decigram), DecigramsTolerance); @@ -215,7 +215,7 @@ public void As() [Fact] public void ToUnit() { - var kilogram = Mass.FromKilograms(1); + var kilogram = Mass.FromKilograms(1); var centigramQuantity = kilogram.ToUnit(MassUnit.Centigram); AssertEx.EqualTolerance(CentigramsInOneKilogram, (double)centigramQuantity.Value, CentigramsTolerance); @@ -321,52 +321,52 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Mass kilogram = Mass.FromKilograms(1); - AssertEx.EqualTolerance(1, Mass.FromCentigrams(kilogram.Centigrams).Kilograms, CentigramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromDecagrams(kilogram.Decagrams).Kilograms, DecagramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromDecigrams(kilogram.Decigrams).Kilograms, DecigramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromEarthMasses(kilogram.EarthMasses).Kilograms, EarthMassesTolerance); - AssertEx.EqualTolerance(1, Mass.FromGrains(kilogram.Grains).Kilograms, GrainsTolerance); - AssertEx.EqualTolerance(1, Mass.FromGrams(kilogram.Grams).Kilograms, GramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromHectograms(kilogram.Hectograms).Kilograms, HectogramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromKilograms(kilogram.Kilograms).Kilograms, KilogramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromKilopounds(kilogram.Kilopounds).Kilograms, KilopoundsTolerance); - AssertEx.EqualTolerance(1, Mass.FromKilotonnes(kilogram.Kilotonnes).Kilograms, KilotonnesTolerance); - AssertEx.EqualTolerance(1, Mass.FromLongHundredweight(kilogram.LongHundredweight).Kilograms, LongHundredweightTolerance); - AssertEx.EqualTolerance(1, Mass.FromLongTons(kilogram.LongTons).Kilograms, LongTonsTolerance); - AssertEx.EqualTolerance(1, Mass.FromMegapounds(kilogram.Megapounds).Kilograms, MegapoundsTolerance); - AssertEx.EqualTolerance(1, Mass.FromMegatonnes(kilogram.Megatonnes).Kilograms, MegatonnesTolerance); - AssertEx.EqualTolerance(1, Mass.FromMicrograms(kilogram.Micrograms).Kilograms, MicrogramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromMilligrams(kilogram.Milligrams).Kilograms, MilligramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromNanograms(kilogram.Nanograms).Kilograms, NanogramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromOunces(kilogram.Ounces).Kilograms, OuncesTolerance); - AssertEx.EqualTolerance(1, Mass.FromPounds(kilogram.Pounds).Kilograms, PoundsTolerance); - AssertEx.EqualTolerance(1, Mass.FromShortHundredweight(kilogram.ShortHundredweight).Kilograms, ShortHundredweightTolerance); - AssertEx.EqualTolerance(1, Mass.FromShortTons(kilogram.ShortTons).Kilograms, ShortTonsTolerance); - AssertEx.EqualTolerance(1, Mass.FromSlugs(kilogram.Slugs).Kilograms, SlugsTolerance); - AssertEx.EqualTolerance(1, Mass.FromSolarMasses(kilogram.SolarMasses).Kilograms, SolarMassesTolerance); - AssertEx.EqualTolerance(1, Mass.FromStone(kilogram.Stone).Kilograms, StoneTolerance); - AssertEx.EqualTolerance(1, Mass.FromTonnes(kilogram.Tonnes).Kilograms, TonnesTolerance); + Mass kilogram = Mass.FromKilograms(1); + AssertEx.EqualTolerance(1, Mass.FromCentigrams(kilogram.Centigrams).Kilograms, CentigramsTolerance); + AssertEx.EqualTolerance(1, Mass.FromDecagrams(kilogram.Decagrams).Kilograms, DecagramsTolerance); + AssertEx.EqualTolerance(1, Mass.FromDecigrams(kilogram.Decigrams).Kilograms, DecigramsTolerance); + AssertEx.EqualTolerance(1, Mass.FromEarthMasses(kilogram.EarthMasses).Kilograms, EarthMassesTolerance); + AssertEx.EqualTolerance(1, Mass.FromGrains(kilogram.Grains).Kilograms, GrainsTolerance); + AssertEx.EqualTolerance(1, Mass.FromGrams(kilogram.Grams).Kilograms, GramsTolerance); + AssertEx.EqualTolerance(1, Mass.FromHectograms(kilogram.Hectograms).Kilograms, HectogramsTolerance); + AssertEx.EqualTolerance(1, Mass.FromKilograms(kilogram.Kilograms).Kilograms, KilogramsTolerance); + AssertEx.EqualTolerance(1, Mass.FromKilopounds(kilogram.Kilopounds).Kilograms, KilopoundsTolerance); + AssertEx.EqualTolerance(1, Mass.FromKilotonnes(kilogram.Kilotonnes).Kilograms, KilotonnesTolerance); + AssertEx.EqualTolerance(1, Mass.FromLongHundredweight(kilogram.LongHundredweight).Kilograms, LongHundredweightTolerance); + AssertEx.EqualTolerance(1, Mass.FromLongTons(kilogram.LongTons).Kilograms, LongTonsTolerance); + AssertEx.EqualTolerance(1, Mass.FromMegapounds(kilogram.Megapounds).Kilograms, MegapoundsTolerance); + AssertEx.EqualTolerance(1, Mass.FromMegatonnes(kilogram.Megatonnes).Kilograms, MegatonnesTolerance); + AssertEx.EqualTolerance(1, Mass.FromMicrograms(kilogram.Micrograms).Kilograms, MicrogramsTolerance); + AssertEx.EqualTolerance(1, Mass.FromMilligrams(kilogram.Milligrams).Kilograms, MilligramsTolerance); + AssertEx.EqualTolerance(1, Mass.FromNanograms(kilogram.Nanograms).Kilograms, NanogramsTolerance); + AssertEx.EqualTolerance(1, Mass.FromOunces(kilogram.Ounces).Kilograms, OuncesTolerance); + AssertEx.EqualTolerance(1, Mass.FromPounds(kilogram.Pounds).Kilograms, PoundsTolerance); + AssertEx.EqualTolerance(1, Mass.FromShortHundredweight(kilogram.ShortHundredweight).Kilograms, ShortHundredweightTolerance); + AssertEx.EqualTolerance(1, Mass.FromShortTons(kilogram.ShortTons).Kilograms, ShortTonsTolerance); + AssertEx.EqualTolerance(1, Mass.FromSlugs(kilogram.Slugs).Kilograms, SlugsTolerance); + AssertEx.EqualTolerance(1, Mass.FromSolarMasses(kilogram.SolarMasses).Kilograms, SolarMassesTolerance); + AssertEx.EqualTolerance(1, Mass.FromStone(kilogram.Stone).Kilograms, StoneTolerance); + AssertEx.EqualTolerance(1, Mass.FromTonnes(kilogram.Tonnes).Kilograms, TonnesTolerance); } [Fact] public void ArithmeticOperators() { - Mass v = Mass.FromKilograms(1); + Mass v = Mass.FromKilograms(1); AssertEx.EqualTolerance(-1, -v.Kilograms, KilogramsTolerance); - AssertEx.EqualTolerance(2, (Mass.FromKilograms(3)-v).Kilograms, KilogramsTolerance); + AssertEx.EqualTolerance(2, (Mass.FromKilograms(3)-v).Kilograms, KilogramsTolerance); AssertEx.EqualTolerance(2, (v + v).Kilograms, KilogramsTolerance); AssertEx.EqualTolerance(10, (v*10).Kilograms, KilogramsTolerance); AssertEx.EqualTolerance(10, (10*v).Kilograms, KilogramsTolerance); - AssertEx.EqualTolerance(2, (Mass.FromKilograms(10)/5).Kilograms, KilogramsTolerance); - AssertEx.EqualTolerance(2, Mass.FromKilograms(10)/Mass.FromKilograms(5), KilogramsTolerance); + AssertEx.EqualTolerance(2, (Mass.FromKilograms(10)/5).Kilograms, KilogramsTolerance); + AssertEx.EqualTolerance(2, Mass.FromKilograms(10)/Mass.FromKilograms(5), KilogramsTolerance); } [Fact] public void ComparisonOperators() { - Mass oneKilogram = Mass.FromKilograms(1); - Mass twoKilograms = Mass.FromKilograms(2); + Mass oneKilogram = Mass.FromKilograms(1); + Mass twoKilograms = Mass.FromKilograms(2); Assert.True(oneKilogram < twoKilograms); Assert.True(oneKilogram <= twoKilograms); @@ -382,31 +382,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Mass kilogram = Mass.FromKilograms(1); + Mass kilogram = Mass.FromKilograms(1); Assert.Equal(0, kilogram.CompareTo(kilogram)); - Assert.True(kilogram.CompareTo(Mass.Zero) > 0); - Assert.True(Mass.Zero.CompareTo(kilogram) < 0); + Assert.True(kilogram.CompareTo(Mass.Zero) > 0); + Assert.True(Mass.Zero.CompareTo(kilogram) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Mass kilogram = Mass.FromKilograms(1); + Mass kilogram = Mass.FromKilograms(1); Assert.Throws(() => kilogram.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Mass kilogram = Mass.FromKilograms(1); + Mass kilogram = Mass.FromKilograms(1); Assert.Throws(() => kilogram.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Mass.FromKilograms(1); - var b = Mass.FromKilograms(2); + var a = Mass.FromKilograms(1); + var b = Mass.FromKilograms(2); // ReSharper disable EqualExpressionComparison @@ -425,8 +425,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Mass.FromKilograms(1); - var b = Mass.FromKilograms(2); + var a = Mass.FromKilograms(1); + var b = Mass.FromKilograms(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -436,29 +436,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Mass.FromKilograms(1); - Assert.True(v.Equals(Mass.FromKilograms(1), KilogramsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Mass.Zero, KilogramsTolerance, ComparisonType.Relative)); + var v = Mass.FromKilograms(1); + Assert.True(v.Equals(Mass.FromKilograms(1), KilogramsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Mass.Zero, KilogramsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Mass kilogram = Mass.FromKilograms(1); + Mass kilogram = Mass.FromKilograms(1); Assert.False(kilogram.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Mass kilogram = Mass.FromKilograms(1); + Mass kilogram = Mass.FromKilograms(1); Assert.False(kilogram.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(MassUnit.Undefined, Mass.Units); + Assert.DoesNotContain(MassUnit.Undefined, Mass.Units); } [Fact] @@ -477,7 +477,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Mass.BaseDimensions is null); + Assert.False(Mass.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs index 9443a62ff8..b6a87648bb 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of MolarEnergy. + /// Test of MolarEnergy. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class MolarEnergyTestsBase @@ -47,26 +47,26 @@ public abstract partial class MolarEnergyTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new MolarEnergy((double)0.0, MolarEnergyUnit.Undefined)); + Assert.Throws(() => new MolarEnergy((double)0.0, MolarEnergyUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new MolarEnergy(double.PositiveInfinity, MolarEnergyUnit.JoulePerMole)); - Assert.Throws(() => new MolarEnergy(double.NegativeInfinity, MolarEnergyUnit.JoulePerMole)); + Assert.Throws(() => new MolarEnergy(double.PositiveInfinity, MolarEnergyUnit.JoulePerMole)); + Assert.Throws(() => new MolarEnergy(double.NegativeInfinity, MolarEnergyUnit.JoulePerMole)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new MolarEnergy(double.NaN, MolarEnergyUnit.JoulePerMole)); + Assert.Throws(() => new MolarEnergy(double.NaN, MolarEnergyUnit.JoulePerMole)); } [Fact] public void JoulePerMoleToMolarEnergyUnits() { - MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); + MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); AssertEx.EqualTolerance(JoulesPerMoleInOneJoulePerMole, joulepermole.JoulesPerMole, JoulesPerMoleTolerance); AssertEx.EqualTolerance(KilojoulesPerMoleInOneJoulePerMole, joulepermole.KilojoulesPerMole, KilojoulesPerMoleTolerance); AssertEx.EqualTolerance(MegajoulesPerMoleInOneJoulePerMole, joulepermole.MegajoulesPerMole, MegajoulesPerMoleTolerance); @@ -75,28 +75,28 @@ public void JoulePerMoleToMolarEnergyUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, MolarEnergy.From(1, MolarEnergyUnit.JoulePerMole).JoulesPerMole, JoulesPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarEnergy.From(1, MolarEnergyUnit.KilojoulePerMole).KilojoulesPerMole, KilojoulesPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarEnergy.From(1, MolarEnergyUnit.MegajoulePerMole).MegajoulesPerMole, MegajoulesPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarEnergy.From(1, MolarEnergyUnit.JoulePerMole).JoulesPerMole, JoulesPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarEnergy.From(1, MolarEnergyUnit.KilojoulePerMole).KilojoulesPerMole, KilojoulesPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarEnergy.From(1, MolarEnergyUnit.MegajoulePerMole).MegajoulesPerMole, MegajoulesPerMoleTolerance); } [Fact] public void FromJoulesPerMole_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.PositiveInfinity)); - Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.NegativeInfinity)); + Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.PositiveInfinity)); + Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.NegativeInfinity)); } [Fact] public void FromJoulesPerMole_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.NaN)); + Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.NaN)); } [Fact] public void As() { - var joulepermole = MolarEnergy.FromJoulesPerMole(1); + var joulepermole = MolarEnergy.FromJoulesPerMole(1); AssertEx.EqualTolerance(JoulesPerMoleInOneJoulePerMole, joulepermole.As(MolarEnergyUnit.JoulePerMole), JoulesPerMoleTolerance); AssertEx.EqualTolerance(KilojoulesPerMoleInOneJoulePerMole, joulepermole.As(MolarEnergyUnit.KilojoulePerMole), KilojoulesPerMoleTolerance); AssertEx.EqualTolerance(MegajoulesPerMoleInOneJoulePerMole, joulepermole.As(MolarEnergyUnit.MegajoulePerMole), MegajoulesPerMoleTolerance); @@ -105,7 +105,7 @@ public void As() [Fact] public void ToUnit() { - var joulepermole = MolarEnergy.FromJoulesPerMole(1); + var joulepermole = MolarEnergy.FromJoulesPerMole(1); var joulepermoleQuantity = joulepermole.ToUnit(MolarEnergyUnit.JoulePerMole); AssertEx.EqualTolerance(JoulesPerMoleInOneJoulePerMole, (double)joulepermoleQuantity.Value, JoulesPerMoleTolerance); @@ -123,30 +123,30 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); - AssertEx.EqualTolerance(1, MolarEnergy.FromJoulesPerMole(joulepermole.JoulesPerMole).JoulesPerMole, JoulesPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarEnergy.FromKilojoulesPerMole(joulepermole.KilojoulesPerMole).JoulesPerMole, KilojoulesPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarEnergy.FromMegajoulesPerMole(joulepermole.MegajoulesPerMole).JoulesPerMole, MegajoulesPerMoleTolerance); + MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); + AssertEx.EqualTolerance(1, MolarEnergy.FromJoulesPerMole(joulepermole.JoulesPerMole).JoulesPerMole, JoulesPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarEnergy.FromKilojoulesPerMole(joulepermole.KilojoulesPerMole).JoulesPerMole, KilojoulesPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarEnergy.FromMegajoulesPerMole(joulepermole.MegajoulesPerMole).JoulesPerMole, MegajoulesPerMoleTolerance); } [Fact] public void ArithmeticOperators() { - MolarEnergy v = MolarEnergy.FromJoulesPerMole(1); + MolarEnergy v = MolarEnergy.FromJoulesPerMole(1); AssertEx.EqualTolerance(-1, -v.JoulesPerMole, JoulesPerMoleTolerance); - AssertEx.EqualTolerance(2, (MolarEnergy.FromJoulesPerMole(3)-v).JoulesPerMole, JoulesPerMoleTolerance); + AssertEx.EqualTolerance(2, (MolarEnergy.FromJoulesPerMole(3)-v).JoulesPerMole, JoulesPerMoleTolerance); AssertEx.EqualTolerance(2, (v + v).JoulesPerMole, JoulesPerMoleTolerance); AssertEx.EqualTolerance(10, (v*10).JoulesPerMole, JoulesPerMoleTolerance); AssertEx.EqualTolerance(10, (10*v).JoulesPerMole, JoulesPerMoleTolerance); - AssertEx.EqualTolerance(2, (MolarEnergy.FromJoulesPerMole(10)/5).JoulesPerMole, JoulesPerMoleTolerance); - AssertEx.EqualTolerance(2, MolarEnergy.FromJoulesPerMole(10)/MolarEnergy.FromJoulesPerMole(5), JoulesPerMoleTolerance); + AssertEx.EqualTolerance(2, (MolarEnergy.FromJoulesPerMole(10)/5).JoulesPerMole, JoulesPerMoleTolerance); + AssertEx.EqualTolerance(2, MolarEnergy.FromJoulesPerMole(10)/MolarEnergy.FromJoulesPerMole(5), JoulesPerMoleTolerance); } [Fact] public void ComparisonOperators() { - MolarEnergy oneJoulePerMole = MolarEnergy.FromJoulesPerMole(1); - MolarEnergy twoJoulesPerMole = MolarEnergy.FromJoulesPerMole(2); + MolarEnergy oneJoulePerMole = MolarEnergy.FromJoulesPerMole(1); + MolarEnergy twoJoulesPerMole = MolarEnergy.FromJoulesPerMole(2); Assert.True(oneJoulePerMole < twoJoulesPerMole); Assert.True(oneJoulePerMole <= twoJoulesPerMole); @@ -162,31 +162,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); + MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); Assert.Equal(0, joulepermole.CompareTo(joulepermole)); - Assert.True(joulepermole.CompareTo(MolarEnergy.Zero) > 0); - Assert.True(MolarEnergy.Zero.CompareTo(joulepermole) < 0); + Assert.True(joulepermole.CompareTo(MolarEnergy.Zero) > 0); + Assert.True(MolarEnergy.Zero.CompareTo(joulepermole) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); + MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); Assert.Throws(() => joulepermole.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); + MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); Assert.Throws(() => joulepermole.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = MolarEnergy.FromJoulesPerMole(1); - var b = MolarEnergy.FromJoulesPerMole(2); + var a = MolarEnergy.FromJoulesPerMole(1); + var b = MolarEnergy.FromJoulesPerMole(2); // ReSharper disable EqualExpressionComparison @@ -205,8 +205,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = MolarEnergy.FromJoulesPerMole(1); - var b = MolarEnergy.FromJoulesPerMole(2); + var a = MolarEnergy.FromJoulesPerMole(1); + var b = MolarEnergy.FromJoulesPerMole(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -216,29 +216,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = MolarEnergy.FromJoulesPerMole(1); - Assert.True(v.Equals(MolarEnergy.FromJoulesPerMole(1), JoulesPerMoleTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MolarEnergy.Zero, JoulesPerMoleTolerance, ComparisonType.Relative)); + var v = MolarEnergy.FromJoulesPerMole(1); + Assert.True(v.Equals(MolarEnergy.FromJoulesPerMole(1), JoulesPerMoleTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MolarEnergy.Zero, JoulesPerMoleTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); + MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); Assert.False(joulepermole.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); + MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); Assert.False(joulepermole.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(MolarEnergyUnit.Undefined, MolarEnergy.Units); + Assert.DoesNotContain(MolarEnergyUnit.Undefined, MolarEnergy.Units); } [Fact] @@ -257,7 +257,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(MolarEnergy.BaseDimensions is null); + Assert.False(MolarEnergy.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs index cfd28713c1..76be9874cb 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs @@ -47,26 +47,26 @@ public abstract partial class MolarEntropyTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new MolarEntropy((double)0.0, MolarEntropyUnit.Undefined)); + Assert.Throws(() => new MolarEntropy((double)0.0, MolarEntropyUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new MolarEntropy(double.PositiveInfinity, MolarEntropyUnit.JoulePerMoleKelvin)); - Assert.Throws(() => new MolarEntropy(double.NegativeInfinity, MolarEntropyUnit.JoulePerMoleKelvin)); + Assert.Throws(() => new MolarEntropy(double.PositiveInfinity, MolarEntropyUnit.JoulePerMoleKelvin)); + Assert.Throws(() => new MolarEntropy(double.NegativeInfinity, MolarEntropyUnit.JoulePerMoleKelvin)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new MolarEntropy(double.NaN, MolarEntropyUnit.JoulePerMoleKelvin)); + Assert.Throws(() => new MolarEntropy(double.NaN, MolarEntropyUnit.JoulePerMoleKelvin)); } [Fact] public void JoulePerMoleKelvinToMolarEntropyUnits() { - MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); + MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); AssertEx.EqualTolerance(JoulesPerMoleKelvinInOneJoulePerMoleKelvin, joulepermolekelvin.JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); AssertEx.EqualTolerance(KilojoulesPerMoleKelvinInOneJoulePerMoleKelvin, joulepermolekelvin.KilojoulesPerMoleKelvin, KilojoulesPerMoleKelvinTolerance); AssertEx.EqualTolerance(MegajoulesPerMoleKelvinInOneJoulePerMoleKelvin, joulepermolekelvin.MegajoulesPerMoleKelvin, MegajoulesPerMoleKelvinTolerance); @@ -75,28 +75,28 @@ public void JoulePerMoleKelvinToMolarEntropyUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.JoulePerMoleKelvin).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.KilojoulePerMoleKelvin).KilojoulesPerMoleKelvin, KilojoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.MegajoulePerMoleKelvin).MegajoulesPerMoleKelvin, MegajoulesPerMoleKelvinTolerance); + AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.JoulePerMoleKelvin).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); + AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.KilojoulePerMoleKelvin).KilojoulesPerMoleKelvin, KilojoulesPerMoleKelvinTolerance); + AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.MegajoulePerMoleKelvin).MegajoulesPerMoleKelvin, MegajoulesPerMoleKelvinTolerance); } [Fact] public void FromJoulesPerMoleKelvin_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.PositiveInfinity)); - Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NegativeInfinity)); + Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.PositiveInfinity)); + Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NegativeInfinity)); } [Fact] public void FromJoulesPerMoleKelvin_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NaN)); + Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NaN)); } [Fact] public void As() { - var joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); + var joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); AssertEx.EqualTolerance(JoulesPerMoleKelvinInOneJoulePerMoleKelvin, joulepermolekelvin.As(MolarEntropyUnit.JoulePerMoleKelvin), JoulesPerMoleKelvinTolerance); AssertEx.EqualTolerance(KilojoulesPerMoleKelvinInOneJoulePerMoleKelvin, joulepermolekelvin.As(MolarEntropyUnit.KilojoulePerMoleKelvin), KilojoulesPerMoleKelvinTolerance); AssertEx.EqualTolerance(MegajoulesPerMoleKelvinInOneJoulePerMoleKelvin, joulepermolekelvin.As(MolarEntropyUnit.MegajoulePerMoleKelvin), MegajoulesPerMoleKelvinTolerance); @@ -105,7 +105,7 @@ public void As() [Fact] public void ToUnit() { - var joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); + var joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); var joulepermolekelvinQuantity = joulepermolekelvin.ToUnit(MolarEntropyUnit.JoulePerMoleKelvin); AssertEx.EqualTolerance(JoulesPerMoleKelvinInOneJoulePerMoleKelvin, (double)joulepermolekelvinQuantity.Value, JoulesPerMoleKelvinTolerance); @@ -123,30 +123,30 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); - AssertEx.EqualTolerance(1, MolarEntropy.FromJoulesPerMoleKelvin(joulepermolekelvin.JoulesPerMoleKelvin).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(1, MolarEntropy.FromKilojoulesPerMoleKelvin(joulepermolekelvin.KilojoulesPerMoleKelvin).JoulesPerMoleKelvin, KilojoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(1, MolarEntropy.FromMegajoulesPerMoleKelvin(joulepermolekelvin.MegajoulesPerMoleKelvin).JoulesPerMoleKelvin, MegajoulesPerMoleKelvinTolerance); + MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); + AssertEx.EqualTolerance(1, MolarEntropy.FromJoulesPerMoleKelvin(joulepermolekelvin.JoulesPerMoleKelvin).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); + AssertEx.EqualTolerance(1, MolarEntropy.FromKilojoulesPerMoleKelvin(joulepermolekelvin.KilojoulesPerMoleKelvin).JoulesPerMoleKelvin, KilojoulesPerMoleKelvinTolerance); + AssertEx.EqualTolerance(1, MolarEntropy.FromMegajoulesPerMoleKelvin(joulepermolekelvin.MegajoulesPerMoleKelvin).JoulesPerMoleKelvin, MegajoulesPerMoleKelvinTolerance); } [Fact] public void ArithmeticOperators() { - MolarEntropy v = MolarEntropy.FromJoulesPerMoleKelvin(1); + MolarEntropy v = MolarEntropy.FromJoulesPerMoleKelvin(1); AssertEx.EqualTolerance(-1, -v.JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(2, (MolarEntropy.FromJoulesPerMoleKelvin(3)-v).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); + AssertEx.EqualTolerance(2, (MolarEntropy.FromJoulesPerMoleKelvin(3)-v).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); AssertEx.EqualTolerance(2, (v + v).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); AssertEx.EqualTolerance(10, (v*10).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); AssertEx.EqualTolerance(10, (10*v).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(2, (MolarEntropy.FromJoulesPerMoleKelvin(10)/5).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(2, MolarEntropy.FromJoulesPerMoleKelvin(10)/MolarEntropy.FromJoulesPerMoleKelvin(5), JoulesPerMoleKelvinTolerance); + AssertEx.EqualTolerance(2, (MolarEntropy.FromJoulesPerMoleKelvin(10)/5).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); + AssertEx.EqualTolerance(2, MolarEntropy.FromJoulesPerMoleKelvin(10)/MolarEntropy.FromJoulesPerMoleKelvin(5), JoulesPerMoleKelvinTolerance); } [Fact] public void ComparisonOperators() { - MolarEntropy oneJoulePerMoleKelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); - MolarEntropy twoJoulesPerMoleKelvin = MolarEntropy.FromJoulesPerMoleKelvin(2); + MolarEntropy oneJoulePerMoleKelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); + MolarEntropy twoJoulesPerMoleKelvin = MolarEntropy.FromJoulesPerMoleKelvin(2); Assert.True(oneJoulePerMoleKelvin < twoJoulesPerMoleKelvin); Assert.True(oneJoulePerMoleKelvin <= twoJoulesPerMoleKelvin); @@ -162,31 +162,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); + MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); Assert.Equal(0, joulepermolekelvin.CompareTo(joulepermolekelvin)); - Assert.True(joulepermolekelvin.CompareTo(MolarEntropy.Zero) > 0); - Assert.True(MolarEntropy.Zero.CompareTo(joulepermolekelvin) < 0); + Assert.True(joulepermolekelvin.CompareTo(MolarEntropy.Zero) > 0); + Assert.True(MolarEntropy.Zero.CompareTo(joulepermolekelvin) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); + MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); Assert.Throws(() => joulepermolekelvin.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); + MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); Assert.Throws(() => joulepermolekelvin.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = MolarEntropy.FromJoulesPerMoleKelvin(1); - var b = MolarEntropy.FromJoulesPerMoleKelvin(2); + var a = MolarEntropy.FromJoulesPerMoleKelvin(1); + var b = MolarEntropy.FromJoulesPerMoleKelvin(2); // ReSharper disable EqualExpressionComparison @@ -205,8 +205,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = MolarEntropy.FromJoulesPerMoleKelvin(1); - var b = MolarEntropy.FromJoulesPerMoleKelvin(2); + var a = MolarEntropy.FromJoulesPerMoleKelvin(1); + var b = MolarEntropy.FromJoulesPerMoleKelvin(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -216,29 +216,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = MolarEntropy.FromJoulesPerMoleKelvin(1); - Assert.True(v.Equals(MolarEntropy.FromJoulesPerMoleKelvin(1), JoulesPerMoleKelvinTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MolarEntropy.Zero, JoulesPerMoleKelvinTolerance, ComparisonType.Relative)); + var v = MolarEntropy.FromJoulesPerMoleKelvin(1); + Assert.True(v.Equals(MolarEntropy.FromJoulesPerMoleKelvin(1), JoulesPerMoleKelvinTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MolarEntropy.Zero, JoulesPerMoleKelvinTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); + MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); Assert.False(joulepermolekelvin.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); + MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); Assert.False(joulepermolekelvin.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(MolarEntropyUnit.Undefined, MolarEntropy.Units); + Assert.DoesNotContain(MolarEntropyUnit.Undefined, MolarEntropy.Units); } [Fact] @@ -257,7 +257,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(MolarEntropy.BaseDimensions is null); + Assert.False(MolarEntropy.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs index 9f8dfbc78f..8033956309 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs @@ -65,26 +65,26 @@ public abstract partial class MolarMassTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new MolarMass((double)0.0, MolarMassUnit.Undefined)); + Assert.Throws(() => new MolarMass((double)0.0, MolarMassUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new MolarMass(double.PositiveInfinity, MolarMassUnit.KilogramPerMole)); - Assert.Throws(() => new MolarMass(double.NegativeInfinity, MolarMassUnit.KilogramPerMole)); + Assert.Throws(() => new MolarMass(double.PositiveInfinity, MolarMassUnit.KilogramPerMole)); + Assert.Throws(() => new MolarMass(double.NegativeInfinity, MolarMassUnit.KilogramPerMole)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new MolarMass(double.NaN, MolarMassUnit.KilogramPerMole)); + Assert.Throws(() => new MolarMass(double.NaN, MolarMassUnit.KilogramPerMole)); } [Fact] public void KilogramPerMoleToMolarMassUnits() { - MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); + MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); AssertEx.EqualTolerance(CentigramsPerMoleInOneKilogramPerMole, kilogrampermole.CentigramsPerMole, CentigramsPerMoleTolerance); AssertEx.EqualTolerance(DecagramsPerMoleInOneKilogramPerMole, kilogrampermole.DecagramsPerMole, DecagramsPerMoleTolerance); AssertEx.EqualTolerance(DecigramsPerMoleInOneKilogramPerMole, kilogrampermole.DecigramsPerMole, DecigramsPerMoleTolerance); @@ -102,37 +102,37 @@ public void KilogramPerMoleToMolarMassUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.CentigramPerMole).CentigramsPerMole, CentigramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.DecagramPerMole).DecagramsPerMole, DecagramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.DecigramPerMole).DecigramsPerMole, DecigramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.GramPerMole).GramsPerMole, GramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.HectogramPerMole).HectogramsPerMole, HectogramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.KilogramPerMole).KilogramsPerMole, KilogramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.KilopoundPerMole).KilopoundsPerMole, KilopoundsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.MegapoundPerMole).MegapoundsPerMole, MegapoundsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.MicrogramPerMole).MicrogramsPerMole, MicrogramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.MilligramPerMole).MilligramsPerMole, MilligramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.NanogramPerMole).NanogramsPerMole, NanogramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.PoundPerMole).PoundsPerMole, PoundsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.CentigramPerMole).CentigramsPerMole, CentigramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.DecagramPerMole).DecagramsPerMole, DecagramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.DecigramPerMole).DecigramsPerMole, DecigramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.GramPerMole).GramsPerMole, GramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.HectogramPerMole).HectogramsPerMole, HectogramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.KilogramPerMole).KilogramsPerMole, KilogramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.KilopoundPerMole).KilopoundsPerMole, KilopoundsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.MegapoundPerMole).MegapoundsPerMole, MegapoundsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.MicrogramPerMole).MicrogramsPerMole, MicrogramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.MilligramPerMole).MilligramsPerMole, MilligramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.NanogramPerMole).NanogramsPerMole, NanogramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.PoundPerMole).PoundsPerMole, PoundsPerMoleTolerance); } [Fact] public void FromKilogramsPerMole_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.PositiveInfinity)); - Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.NegativeInfinity)); + Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.PositiveInfinity)); + Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.NegativeInfinity)); } [Fact] public void FromKilogramsPerMole_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.NaN)); + Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.NaN)); } [Fact] public void As() { - var kilogrampermole = MolarMass.FromKilogramsPerMole(1); + var kilogrampermole = MolarMass.FromKilogramsPerMole(1); AssertEx.EqualTolerance(CentigramsPerMoleInOneKilogramPerMole, kilogrampermole.As(MolarMassUnit.CentigramPerMole), CentigramsPerMoleTolerance); AssertEx.EqualTolerance(DecagramsPerMoleInOneKilogramPerMole, kilogrampermole.As(MolarMassUnit.DecagramPerMole), DecagramsPerMoleTolerance); AssertEx.EqualTolerance(DecigramsPerMoleInOneKilogramPerMole, kilogrampermole.As(MolarMassUnit.DecigramPerMole), DecigramsPerMoleTolerance); @@ -150,7 +150,7 @@ public void As() [Fact] public void ToUnit() { - var kilogrampermole = MolarMass.FromKilogramsPerMole(1); + var kilogrampermole = MolarMass.FromKilogramsPerMole(1); var centigrampermoleQuantity = kilogrampermole.ToUnit(MolarMassUnit.CentigramPerMole); AssertEx.EqualTolerance(CentigramsPerMoleInOneKilogramPerMole, (double)centigrampermoleQuantity.Value, CentigramsPerMoleTolerance); @@ -204,39 +204,39 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); - AssertEx.EqualTolerance(1, MolarMass.FromCentigramsPerMole(kilogrampermole.CentigramsPerMole).KilogramsPerMole, CentigramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromDecagramsPerMole(kilogrampermole.DecagramsPerMole).KilogramsPerMole, DecagramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromDecigramsPerMole(kilogrampermole.DecigramsPerMole).KilogramsPerMole, DecigramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromGramsPerMole(kilogrampermole.GramsPerMole).KilogramsPerMole, GramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromHectogramsPerMole(kilogrampermole.HectogramsPerMole).KilogramsPerMole, HectogramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromKilogramsPerMole(kilogrampermole.KilogramsPerMole).KilogramsPerMole, KilogramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromKilopoundsPerMole(kilogrampermole.KilopoundsPerMole).KilogramsPerMole, KilopoundsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromMegapoundsPerMole(kilogrampermole.MegapoundsPerMole).KilogramsPerMole, MegapoundsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromMicrogramsPerMole(kilogrampermole.MicrogramsPerMole).KilogramsPerMole, MicrogramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromMilligramsPerMole(kilogrampermole.MilligramsPerMole).KilogramsPerMole, MilligramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromNanogramsPerMole(kilogrampermole.NanogramsPerMole).KilogramsPerMole, NanogramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromPoundsPerMole(kilogrampermole.PoundsPerMole).KilogramsPerMole, PoundsPerMoleTolerance); + MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); + AssertEx.EqualTolerance(1, MolarMass.FromCentigramsPerMole(kilogrampermole.CentigramsPerMole).KilogramsPerMole, CentigramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.FromDecagramsPerMole(kilogrampermole.DecagramsPerMole).KilogramsPerMole, DecagramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.FromDecigramsPerMole(kilogrampermole.DecigramsPerMole).KilogramsPerMole, DecigramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.FromGramsPerMole(kilogrampermole.GramsPerMole).KilogramsPerMole, GramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.FromHectogramsPerMole(kilogrampermole.HectogramsPerMole).KilogramsPerMole, HectogramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.FromKilogramsPerMole(kilogrampermole.KilogramsPerMole).KilogramsPerMole, KilogramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.FromKilopoundsPerMole(kilogrampermole.KilopoundsPerMole).KilogramsPerMole, KilopoundsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.FromMegapoundsPerMole(kilogrampermole.MegapoundsPerMole).KilogramsPerMole, MegapoundsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.FromMicrogramsPerMole(kilogrampermole.MicrogramsPerMole).KilogramsPerMole, MicrogramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.FromMilligramsPerMole(kilogrampermole.MilligramsPerMole).KilogramsPerMole, MilligramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.FromNanogramsPerMole(kilogrampermole.NanogramsPerMole).KilogramsPerMole, NanogramsPerMoleTolerance); + AssertEx.EqualTolerance(1, MolarMass.FromPoundsPerMole(kilogrampermole.PoundsPerMole).KilogramsPerMole, PoundsPerMoleTolerance); } [Fact] public void ArithmeticOperators() { - MolarMass v = MolarMass.FromKilogramsPerMole(1); + MolarMass v = MolarMass.FromKilogramsPerMole(1); AssertEx.EqualTolerance(-1, -v.KilogramsPerMole, KilogramsPerMoleTolerance); - AssertEx.EqualTolerance(2, (MolarMass.FromKilogramsPerMole(3)-v).KilogramsPerMole, KilogramsPerMoleTolerance); + AssertEx.EqualTolerance(2, (MolarMass.FromKilogramsPerMole(3)-v).KilogramsPerMole, KilogramsPerMoleTolerance); AssertEx.EqualTolerance(2, (v + v).KilogramsPerMole, KilogramsPerMoleTolerance); AssertEx.EqualTolerance(10, (v*10).KilogramsPerMole, KilogramsPerMoleTolerance); AssertEx.EqualTolerance(10, (10*v).KilogramsPerMole, KilogramsPerMoleTolerance); - AssertEx.EqualTolerance(2, (MolarMass.FromKilogramsPerMole(10)/5).KilogramsPerMole, KilogramsPerMoleTolerance); - AssertEx.EqualTolerance(2, MolarMass.FromKilogramsPerMole(10)/MolarMass.FromKilogramsPerMole(5), KilogramsPerMoleTolerance); + AssertEx.EqualTolerance(2, (MolarMass.FromKilogramsPerMole(10)/5).KilogramsPerMole, KilogramsPerMoleTolerance); + AssertEx.EqualTolerance(2, MolarMass.FromKilogramsPerMole(10)/MolarMass.FromKilogramsPerMole(5), KilogramsPerMoleTolerance); } [Fact] public void ComparisonOperators() { - MolarMass oneKilogramPerMole = MolarMass.FromKilogramsPerMole(1); - MolarMass twoKilogramsPerMole = MolarMass.FromKilogramsPerMole(2); + MolarMass oneKilogramPerMole = MolarMass.FromKilogramsPerMole(1); + MolarMass twoKilogramsPerMole = MolarMass.FromKilogramsPerMole(2); Assert.True(oneKilogramPerMole < twoKilogramsPerMole); Assert.True(oneKilogramPerMole <= twoKilogramsPerMole); @@ -252,31 +252,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); + MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); Assert.Equal(0, kilogrampermole.CompareTo(kilogrampermole)); - Assert.True(kilogrampermole.CompareTo(MolarMass.Zero) > 0); - Assert.True(MolarMass.Zero.CompareTo(kilogrampermole) < 0); + Assert.True(kilogrampermole.CompareTo(MolarMass.Zero) > 0); + Assert.True(MolarMass.Zero.CompareTo(kilogrampermole) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); + MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); Assert.Throws(() => kilogrampermole.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); + MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); Assert.Throws(() => kilogrampermole.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = MolarMass.FromKilogramsPerMole(1); - var b = MolarMass.FromKilogramsPerMole(2); + var a = MolarMass.FromKilogramsPerMole(1); + var b = MolarMass.FromKilogramsPerMole(2); // ReSharper disable EqualExpressionComparison @@ -295,8 +295,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = MolarMass.FromKilogramsPerMole(1); - var b = MolarMass.FromKilogramsPerMole(2); + var a = MolarMass.FromKilogramsPerMole(1); + var b = MolarMass.FromKilogramsPerMole(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -306,29 +306,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = MolarMass.FromKilogramsPerMole(1); - Assert.True(v.Equals(MolarMass.FromKilogramsPerMole(1), KilogramsPerMoleTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MolarMass.Zero, KilogramsPerMoleTolerance, ComparisonType.Relative)); + var v = MolarMass.FromKilogramsPerMole(1); + Assert.True(v.Equals(MolarMass.FromKilogramsPerMole(1), KilogramsPerMoleTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MolarMass.Zero, KilogramsPerMoleTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); + MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); Assert.False(kilogrampermole.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); + MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); Assert.False(kilogrampermole.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(MolarMassUnit.Undefined, MolarMass.Units); + Assert.DoesNotContain(MolarMassUnit.Undefined, MolarMass.Units); } [Fact] @@ -347,7 +347,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(MolarMass.BaseDimensions is null); + Assert.False(MolarMass.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs index 85937111a0..3ce6d3bd96 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs @@ -57,26 +57,26 @@ public abstract partial class MolarityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Molarity((double)0.0, MolarityUnit.Undefined)); + Assert.Throws(() => new Molarity((double)0.0, MolarityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Molarity(double.PositiveInfinity, MolarityUnit.MolesPerCubicMeter)); - Assert.Throws(() => new Molarity(double.NegativeInfinity, MolarityUnit.MolesPerCubicMeter)); + Assert.Throws(() => new Molarity(double.PositiveInfinity, MolarityUnit.MolesPerCubicMeter)); + Assert.Throws(() => new Molarity(double.NegativeInfinity, MolarityUnit.MolesPerCubicMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Molarity(double.NaN, MolarityUnit.MolesPerCubicMeter)); + Assert.Throws(() => new Molarity(double.NaN, MolarityUnit.MolesPerCubicMeter)); } [Fact] public void MolesPerCubicMeterToMolarityUnits() { - Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); + Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); AssertEx.EqualTolerance(CentimolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.CentimolesPerLiter, CentimolesPerLiterTolerance); AssertEx.EqualTolerance(DecimolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.DecimolesPerLiter, DecimolesPerLiterTolerance); AssertEx.EqualTolerance(MicromolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.MicromolesPerLiter, MicromolesPerLiterTolerance); @@ -90,33 +90,33 @@ public void MolesPerCubicMeterToMolarityUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.CentimolesPerLiter).CentimolesPerLiter, CentimolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.DecimolesPerLiter).DecimolesPerLiter, DecimolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.MicromolesPerLiter).MicromolesPerLiter, MicromolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.MillimolesPerLiter).MillimolesPerLiter, MillimolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.MolesPerCubicMeter).MolesPerCubicMeter, MolesPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.MolesPerLiter).MolesPerLiter, MolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.NanomolesPerLiter).NanomolesPerLiter, NanomolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.PicomolesPerLiter).PicomolesPerLiter, PicomolesPerLiterTolerance); + AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.CentimolesPerLiter).CentimolesPerLiter, CentimolesPerLiterTolerance); + AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.DecimolesPerLiter).DecimolesPerLiter, DecimolesPerLiterTolerance); + AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.MicromolesPerLiter).MicromolesPerLiter, MicromolesPerLiterTolerance); + AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.MillimolesPerLiter).MillimolesPerLiter, MillimolesPerLiterTolerance); + AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.MolesPerCubicMeter).MolesPerCubicMeter, MolesPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.MolesPerLiter).MolesPerLiter, MolesPerLiterTolerance); + AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.NanomolesPerLiter).NanomolesPerLiter, NanomolesPerLiterTolerance); + AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.PicomolesPerLiter).PicomolesPerLiter, PicomolesPerLiterTolerance); } [Fact] public void FromMolesPerCubicMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.NegativeInfinity)); + Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.PositiveInfinity)); + Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.NegativeInfinity)); } [Fact] public void FromMolesPerCubicMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.NaN)); + Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.NaN)); } [Fact] public void As() { - var molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); + var molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); AssertEx.EqualTolerance(CentimolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.As(MolarityUnit.CentimolesPerLiter), CentimolesPerLiterTolerance); AssertEx.EqualTolerance(DecimolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.As(MolarityUnit.DecimolesPerLiter), DecimolesPerLiterTolerance); AssertEx.EqualTolerance(MicromolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.As(MolarityUnit.MicromolesPerLiter), MicromolesPerLiterTolerance); @@ -130,7 +130,7 @@ public void As() [Fact] public void ToUnit() { - var molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); + var molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); var centimolesperliterQuantity = molespercubicmeter.ToUnit(MolarityUnit.CentimolesPerLiter); AssertEx.EqualTolerance(CentimolesPerLiterInOneMolesPerCubicMeter, (double)centimolesperliterQuantity.Value, CentimolesPerLiterTolerance); @@ -168,35 +168,35 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); - AssertEx.EqualTolerance(1, Molarity.FromCentimolesPerLiter(molespercubicmeter.CentimolesPerLiter).MolesPerCubicMeter, CentimolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.FromDecimolesPerLiter(molespercubicmeter.DecimolesPerLiter).MolesPerCubicMeter, DecimolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.FromMicromolesPerLiter(molespercubicmeter.MicromolesPerLiter).MolesPerCubicMeter, MicromolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.FromMillimolesPerLiter(molespercubicmeter.MillimolesPerLiter).MolesPerCubicMeter, MillimolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.FromMolesPerCubicMeter(molespercubicmeter.MolesPerCubicMeter).MolesPerCubicMeter, MolesPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Molarity.FromMolesPerLiter(molespercubicmeter.MolesPerLiter).MolesPerCubicMeter, MolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.FromNanomolesPerLiter(molespercubicmeter.NanomolesPerLiter).MolesPerCubicMeter, NanomolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.FromPicomolesPerLiter(molespercubicmeter.PicomolesPerLiter).MolesPerCubicMeter, PicomolesPerLiterTolerance); + Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); + AssertEx.EqualTolerance(1, Molarity.FromCentimolesPerLiter(molespercubicmeter.CentimolesPerLiter).MolesPerCubicMeter, CentimolesPerLiterTolerance); + AssertEx.EqualTolerance(1, Molarity.FromDecimolesPerLiter(molespercubicmeter.DecimolesPerLiter).MolesPerCubicMeter, DecimolesPerLiterTolerance); + AssertEx.EqualTolerance(1, Molarity.FromMicromolesPerLiter(molespercubicmeter.MicromolesPerLiter).MolesPerCubicMeter, MicromolesPerLiterTolerance); + AssertEx.EqualTolerance(1, Molarity.FromMillimolesPerLiter(molespercubicmeter.MillimolesPerLiter).MolesPerCubicMeter, MillimolesPerLiterTolerance); + AssertEx.EqualTolerance(1, Molarity.FromMolesPerCubicMeter(molespercubicmeter.MolesPerCubicMeter).MolesPerCubicMeter, MolesPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, Molarity.FromMolesPerLiter(molespercubicmeter.MolesPerLiter).MolesPerCubicMeter, MolesPerLiterTolerance); + AssertEx.EqualTolerance(1, Molarity.FromNanomolesPerLiter(molespercubicmeter.NanomolesPerLiter).MolesPerCubicMeter, NanomolesPerLiterTolerance); + AssertEx.EqualTolerance(1, Molarity.FromPicomolesPerLiter(molespercubicmeter.PicomolesPerLiter).MolesPerCubicMeter, PicomolesPerLiterTolerance); } [Fact] public void ArithmeticOperators() { - Molarity v = Molarity.FromMolesPerCubicMeter(1); + Molarity v = Molarity.FromMolesPerCubicMeter(1); AssertEx.EqualTolerance(-1, -v.MolesPerCubicMeter, MolesPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (Molarity.FromMolesPerCubicMeter(3)-v).MolesPerCubicMeter, MolesPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, (Molarity.FromMolesPerCubicMeter(3)-v).MolesPerCubicMeter, MolesPerCubicMeterTolerance); AssertEx.EqualTolerance(2, (v + v).MolesPerCubicMeter, MolesPerCubicMeterTolerance); AssertEx.EqualTolerance(10, (v*10).MolesPerCubicMeter, MolesPerCubicMeterTolerance); AssertEx.EqualTolerance(10, (10*v).MolesPerCubicMeter, MolesPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (Molarity.FromMolesPerCubicMeter(10)/5).MolesPerCubicMeter, MolesPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, Molarity.FromMolesPerCubicMeter(10)/Molarity.FromMolesPerCubicMeter(5), MolesPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, (Molarity.FromMolesPerCubicMeter(10)/5).MolesPerCubicMeter, MolesPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, Molarity.FromMolesPerCubicMeter(10)/Molarity.FromMolesPerCubicMeter(5), MolesPerCubicMeterTolerance); } [Fact] public void ComparisonOperators() { - Molarity oneMolesPerCubicMeter = Molarity.FromMolesPerCubicMeter(1); - Molarity twoMolesPerCubicMeter = Molarity.FromMolesPerCubicMeter(2); + Molarity oneMolesPerCubicMeter = Molarity.FromMolesPerCubicMeter(1); + Molarity twoMolesPerCubicMeter = Molarity.FromMolesPerCubicMeter(2); Assert.True(oneMolesPerCubicMeter < twoMolesPerCubicMeter); Assert.True(oneMolesPerCubicMeter <= twoMolesPerCubicMeter); @@ -212,31 +212,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); + Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); Assert.Equal(0, molespercubicmeter.CompareTo(molespercubicmeter)); - Assert.True(molespercubicmeter.CompareTo(Molarity.Zero) > 0); - Assert.True(Molarity.Zero.CompareTo(molespercubicmeter) < 0); + Assert.True(molespercubicmeter.CompareTo(Molarity.Zero) > 0); + Assert.True(Molarity.Zero.CompareTo(molespercubicmeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); + Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); Assert.Throws(() => molespercubicmeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); + Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); Assert.Throws(() => molespercubicmeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Molarity.FromMolesPerCubicMeter(1); - var b = Molarity.FromMolesPerCubicMeter(2); + var a = Molarity.FromMolesPerCubicMeter(1); + var b = Molarity.FromMolesPerCubicMeter(2); // ReSharper disable EqualExpressionComparison @@ -255,8 +255,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Molarity.FromMolesPerCubicMeter(1); - var b = Molarity.FromMolesPerCubicMeter(2); + var a = Molarity.FromMolesPerCubicMeter(1); + var b = Molarity.FromMolesPerCubicMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -266,29 +266,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Molarity.FromMolesPerCubicMeter(1); - Assert.True(v.Equals(Molarity.FromMolesPerCubicMeter(1), MolesPerCubicMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Molarity.Zero, MolesPerCubicMeterTolerance, ComparisonType.Relative)); + var v = Molarity.FromMolesPerCubicMeter(1); + Assert.True(v.Equals(Molarity.FromMolesPerCubicMeter(1), MolesPerCubicMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Molarity.Zero, MolesPerCubicMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); + Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); Assert.False(molespercubicmeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); + Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); Assert.False(molespercubicmeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(MolarityUnit.Undefined, Molarity.Units); + Assert.DoesNotContain(MolarityUnit.Undefined, Molarity.Units); } [Fact] @@ -307,7 +307,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Molarity.BaseDimensions is null); + Assert.False(Molarity.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs index 51e5c9deac..6624b8bd08 100644 --- a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs @@ -43,59 +43,59 @@ public abstract partial class PermeabilityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Permeability((double)0.0, PermeabilityUnit.Undefined)); + Assert.Throws(() => new Permeability((double)0.0, PermeabilityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Permeability(double.PositiveInfinity, PermeabilityUnit.HenryPerMeter)); - Assert.Throws(() => new Permeability(double.NegativeInfinity, PermeabilityUnit.HenryPerMeter)); + Assert.Throws(() => new Permeability(double.PositiveInfinity, PermeabilityUnit.HenryPerMeter)); + Assert.Throws(() => new Permeability(double.NegativeInfinity, PermeabilityUnit.HenryPerMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Permeability(double.NaN, PermeabilityUnit.HenryPerMeter)); + Assert.Throws(() => new Permeability(double.NaN, PermeabilityUnit.HenryPerMeter)); } [Fact] public void HenryPerMeterToPermeabilityUnits() { - Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); + Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); AssertEx.EqualTolerance(HenriesPerMeterInOneHenryPerMeter, henrypermeter.HenriesPerMeter, HenriesPerMeterTolerance); } [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Permeability.From(1, PermeabilityUnit.HenryPerMeter).HenriesPerMeter, HenriesPerMeterTolerance); + AssertEx.EqualTolerance(1, Permeability.From(1, PermeabilityUnit.HenryPerMeter).HenriesPerMeter, HenriesPerMeterTolerance); } [Fact] public void FromHenriesPerMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Permeability.FromHenriesPerMeter(double.PositiveInfinity)); - Assert.Throws(() => Permeability.FromHenriesPerMeter(double.NegativeInfinity)); + Assert.Throws(() => Permeability.FromHenriesPerMeter(double.PositiveInfinity)); + Assert.Throws(() => Permeability.FromHenriesPerMeter(double.NegativeInfinity)); } [Fact] public void FromHenriesPerMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Permeability.FromHenriesPerMeter(double.NaN)); + Assert.Throws(() => Permeability.FromHenriesPerMeter(double.NaN)); } [Fact] public void As() { - var henrypermeter = Permeability.FromHenriesPerMeter(1); + var henrypermeter = Permeability.FromHenriesPerMeter(1); AssertEx.EqualTolerance(HenriesPerMeterInOneHenryPerMeter, henrypermeter.As(PermeabilityUnit.HenryPerMeter), HenriesPerMeterTolerance); } [Fact] public void ToUnit() { - var henrypermeter = Permeability.FromHenriesPerMeter(1); + var henrypermeter = Permeability.FromHenriesPerMeter(1); var henrypermeterQuantity = henrypermeter.ToUnit(PermeabilityUnit.HenryPerMeter); AssertEx.EqualTolerance(HenriesPerMeterInOneHenryPerMeter, (double)henrypermeterQuantity.Value, HenriesPerMeterTolerance); @@ -105,28 +105,28 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); - AssertEx.EqualTolerance(1, Permeability.FromHenriesPerMeter(henrypermeter.HenriesPerMeter).HenriesPerMeter, HenriesPerMeterTolerance); + Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); + AssertEx.EqualTolerance(1, Permeability.FromHenriesPerMeter(henrypermeter.HenriesPerMeter).HenriesPerMeter, HenriesPerMeterTolerance); } [Fact] public void ArithmeticOperators() { - Permeability v = Permeability.FromHenriesPerMeter(1); + Permeability v = Permeability.FromHenriesPerMeter(1); AssertEx.EqualTolerance(-1, -v.HenriesPerMeter, HenriesPerMeterTolerance); - AssertEx.EqualTolerance(2, (Permeability.FromHenriesPerMeter(3)-v).HenriesPerMeter, HenriesPerMeterTolerance); + AssertEx.EqualTolerance(2, (Permeability.FromHenriesPerMeter(3)-v).HenriesPerMeter, HenriesPerMeterTolerance); AssertEx.EqualTolerance(2, (v + v).HenriesPerMeter, HenriesPerMeterTolerance); AssertEx.EqualTolerance(10, (v*10).HenriesPerMeter, HenriesPerMeterTolerance); AssertEx.EqualTolerance(10, (10*v).HenriesPerMeter, HenriesPerMeterTolerance); - AssertEx.EqualTolerance(2, (Permeability.FromHenriesPerMeter(10)/5).HenriesPerMeter, HenriesPerMeterTolerance); - AssertEx.EqualTolerance(2, Permeability.FromHenriesPerMeter(10)/Permeability.FromHenriesPerMeter(5), HenriesPerMeterTolerance); + AssertEx.EqualTolerance(2, (Permeability.FromHenriesPerMeter(10)/5).HenriesPerMeter, HenriesPerMeterTolerance); + AssertEx.EqualTolerance(2, Permeability.FromHenriesPerMeter(10)/Permeability.FromHenriesPerMeter(5), HenriesPerMeterTolerance); } [Fact] public void ComparisonOperators() { - Permeability oneHenryPerMeter = Permeability.FromHenriesPerMeter(1); - Permeability twoHenriesPerMeter = Permeability.FromHenriesPerMeter(2); + Permeability oneHenryPerMeter = Permeability.FromHenriesPerMeter(1); + Permeability twoHenriesPerMeter = Permeability.FromHenriesPerMeter(2); Assert.True(oneHenryPerMeter < twoHenriesPerMeter); Assert.True(oneHenryPerMeter <= twoHenriesPerMeter); @@ -142,31 +142,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); + Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); Assert.Equal(0, henrypermeter.CompareTo(henrypermeter)); - Assert.True(henrypermeter.CompareTo(Permeability.Zero) > 0); - Assert.True(Permeability.Zero.CompareTo(henrypermeter) < 0); + Assert.True(henrypermeter.CompareTo(Permeability.Zero) > 0); + Assert.True(Permeability.Zero.CompareTo(henrypermeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); + Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); Assert.Throws(() => henrypermeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); + Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); Assert.Throws(() => henrypermeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Permeability.FromHenriesPerMeter(1); - var b = Permeability.FromHenriesPerMeter(2); + var a = Permeability.FromHenriesPerMeter(1); + var b = Permeability.FromHenriesPerMeter(2); // ReSharper disable EqualExpressionComparison @@ -185,8 +185,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Permeability.FromHenriesPerMeter(1); - var b = Permeability.FromHenriesPerMeter(2); + var a = Permeability.FromHenriesPerMeter(1); + var b = Permeability.FromHenriesPerMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -196,29 +196,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Permeability.FromHenriesPerMeter(1); - Assert.True(v.Equals(Permeability.FromHenriesPerMeter(1), HenriesPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Permeability.Zero, HenriesPerMeterTolerance, ComparisonType.Relative)); + var v = Permeability.FromHenriesPerMeter(1); + Assert.True(v.Equals(Permeability.FromHenriesPerMeter(1), HenriesPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Permeability.Zero, HenriesPerMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); + Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); Assert.False(henrypermeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); + Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); Assert.False(henrypermeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(PermeabilityUnit.Undefined, Permeability.Units); + Assert.DoesNotContain(PermeabilityUnit.Undefined, Permeability.Units); } [Fact] @@ -237,7 +237,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Permeability.BaseDimensions is null); + Assert.False(Permeability.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs index d418e80cb9..6be88ecb46 100644 --- a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs @@ -43,59 +43,59 @@ public abstract partial class PermittivityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Permittivity((double)0.0, PermittivityUnit.Undefined)); + Assert.Throws(() => new Permittivity((double)0.0, PermittivityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Permittivity(double.PositiveInfinity, PermittivityUnit.FaradPerMeter)); - Assert.Throws(() => new Permittivity(double.NegativeInfinity, PermittivityUnit.FaradPerMeter)); + Assert.Throws(() => new Permittivity(double.PositiveInfinity, PermittivityUnit.FaradPerMeter)); + Assert.Throws(() => new Permittivity(double.NegativeInfinity, PermittivityUnit.FaradPerMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Permittivity(double.NaN, PermittivityUnit.FaradPerMeter)); + Assert.Throws(() => new Permittivity(double.NaN, PermittivityUnit.FaradPerMeter)); } [Fact] public void FaradPerMeterToPermittivityUnits() { - Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); + Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); AssertEx.EqualTolerance(FaradsPerMeterInOneFaradPerMeter, faradpermeter.FaradsPerMeter, FaradsPerMeterTolerance); } [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Permittivity.From(1, PermittivityUnit.FaradPerMeter).FaradsPerMeter, FaradsPerMeterTolerance); + AssertEx.EqualTolerance(1, Permittivity.From(1, PermittivityUnit.FaradPerMeter).FaradsPerMeter, FaradsPerMeterTolerance); } [Fact] public void FromFaradsPerMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.PositiveInfinity)); - Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.NegativeInfinity)); + Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.PositiveInfinity)); + Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.NegativeInfinity)); } [Fact] public void FromFaradsPerMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.NaN)); + Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.NaN)); } [Fact] public void As() { - var faradpermeter = Permittivity.FromFaradsPerMeter(1); + var faradpermeter = Permittivity.FromFaradsPerMeter(1); AssertEx.EqualTolerance(FaradsPerMeterInOneFaradPerMeter, faradpermeter.As(PermittivityUnit.FaradPerMeter), FaradsPerMeterTolerance); } [Fact] public void ToUnit() { - var faradpermeter = Permittivity.FromFaradsPerMeter(1); + var faradpermeter = Permittivity.FromFaradsPerMeter(1); var faradpermeterQuantity = faradpermeter.ToUnit(PermittivityUnit.FaradPerMeter); AssertEx.EqualTolerance(FaradsPerMeterInOneFaradPerMeter, (double)faradpermeterQuantity.Value, FaradsPerMeterTolerance); @@ -105,28 +105,28 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); - AssertEx.EqualTolerance(1, Permittivity.FromFaradsPerMeter(faradpermeter.FaradsPerMeter).FaradsPerMeter, FaradsPerMeterTolerance); + Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); + AssertEx.EqualTolerance(1, Permittivity.FromFaradsPerMeter(faradpermeter.FaradsPerMeter).FaradsPerMeter, FaradsPerMeterTolerance); } [Fact] public void ArithmeticOperators() { - Permittivity v = Permittivity.FromFaradsPerMeter(1); + Permittivity v = Permittivity.FromFaradsPerMeter(1); AssertEx.EqualTolerance(-1, -v.FaradsPerMeter, FaradsPerMeterTolerance); - AssertEx.EqualTolerance(2, (Permittivity.FromFaradsPerMeter(3)-v).FaradsPerMeter, FaradsPerMeterTolerance); + AssertEx.EqualTolerance(2, (Permittivity.FromFaradsPerMeter(3)-v).FaradsPerMeter, FaradsPerMeterTolerance); AssertEx.EqualTolerance(2, (v + v).FaradsPerMeter, FaradsPerMeterTolerance); AssertEx.EqualTolerance(10, (v*10).FaradsPerMeter, FaradsPerMeterTolerance); AssertEx.EqualTolerance(10, (10*v).FaradsPerMeter, FaradsPerMeterTolerance); - AssertEx.EqualTolerance(2, (Permittivity.FromFaradsPerMeter(10)/5).FaradsPerMeter, FaradsPerMeterTolerance); - AssertEx.EqualTolerance(2, Permittivity.FromFaradsPerMeter(10)/Permittivity.FromFaradsPerMeter(5), FaradsPerMeterTolerance); + AssertEx.EqualTolerance(2, (Permittivity.FromFaradsPerMeter(10)/5).FaradsPerMeter, FaradsPerMeterTolerance); + AssertEx.EqualTolerance(2, Permittivity.FromFaradsPerMeter(10)/Permittivity.FromFaradsPerMeter(5), FaradsPerMeterTolerance); } [Fact] public void ComparisonOperators() { - Permittivity oneFaradPerMeter = Permittivity.FromFaradsPerMeter(1); - Permittivity twoFaradsPerMeter = Permittivity.FromFaradsPerMeter(2); + Permittivity oneFaradPerMeter = Permittivity.FromFaradsPerMeter(1); + Permittivity twoFaradsPerMeter = Permittivity.FromFaradsPerMeter(2); Assert.True(oneFaradPerMeter < twoFaradsPerMeter); Assert.True(oneFaradPerMeter <= twoFaradsPerMeter); @@ -142,31 +142,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); + Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); Assert.Equal(0, faradpermeter.CompareTo(faradpermeter)); - Assert.True(faradpermeter.CompareTo(Permittivity.Zero) > 0); - Assert.True(Permittivity.Zero.CompareTo(faradpermeter) < 0); + Assert.True(faradpermeter.CompareTo(Permittivity.Zero) > 0); + Assert.True(Permittivity.Zero.CompareTo(faradpermeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); + Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); Assert.Throws(() => faradpermeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); + Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); Assert.Throws(() => faradpermeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Permittivity.FromFaradsPerMeter(1); - var b = Permittivity.FromFaradsPerMeter(2); + var a = Permittivity.FromFaradsPerMeter(1); + var b = Permittivity.FromFaradsPerMeter(2); // ReSharper disable EqualExpressionComparison @@ -185,8 +185,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Permittivity.FromFaradsPerMeter(1); - var b = Permittivity.FromFaradsPerMeter(2); + var a = Permittivity.FromFaradsPerMeter(1); + var b = Permittivity.FromFaradsPerMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -196,29 +196,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Permittivity.FromFaradsPerMeter(1); - Assert.True(v.Equals(Permittivity.FromFaradsPerMeter(1), FaradsPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Permittivity.Zero, FaradsPerMeterTolerance, ComparisonType.Relative)); + var v = Permittivity.FromFaradsPerMeter(1); + Assert.True(v.Equals(Permittivity.FromFaradsPerMeter(1), FaradsPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Permittivity.Zero, FaradsPerMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); + Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); Assert.False(faradpermeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); + Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); Assert.False(faradpermeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(PermittivityUnit.Undefined, Permittivity.Units); + Assert.DoesNotContain(PermittivityUnit.Undefined, Permittivity.Units); } [Fact] @@ -237,7 +237,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Permittivity.BaseDimensions is null); + Assert.False(Permittivity.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs index b884d3d037..70d9cdd197 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of PowerDensity. + /// Test of PowerDensity. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class PowerDensityTestsBase @@ -129,26 +129,26 @@ public abstract partial class PowerDensityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new PowerDensity((double)0.0, PowerDensityUnit.Undefined)); + Assert.Throws(() => new PowerDensity((double)0.0, PowerDensityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new PowerDensity(double.PositiveInfinity, PowerDensityUnit.WattPerCubicMeter)); - Assert.Throws(() => new PowerDensity(double.NegativeInfinity, PowerDensityUnit.WattPerCubicMeter)); + Assert.Throws(() => new PowerDensity(double.PositiveInfinity, PowerDensityUnit.WattPerCubicMeter)); + Assert.Throws(() => new PowerDensity(double.NegativeInfinity, PowerDensityUnit.WattPerCubicMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new PowerDensity(double.NaN, PowerDensityUnit.WattPerCubicMeter)); + Assert.Throws(() => new PowerDensity(double.NaN, PowerDensityUnit.WattPerCubicMeter)); } [Fact] public void WattPerCubicMeterToPowerDensityUnits() { - PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); + PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); AssertEx.EqualTolerance(DecawattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.DecawattsPerCubicFoot, DecawattsPerCubicFootTolerance); AssertEx.EqualTolerance(DecawattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.DecawattsPerCubicInch, DecawattsPerCubicInchTolerance); AssertEx.EqualTolerance(DecawattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.DecawattsPerCubicMeter, DecawattsPerCubicMeterTolerance); @@ -198,69 +198,69 @@ public void WattPerCubicMeterToPowerDensityUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DecawattPerCubicFoot).DecawattsPerCubicFoot, DecawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DecawattPerCubicInch).DecawattsPerCubicInch, DecawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DecawattPerCubicMeter).DecawattsPerCubicMeter, DecawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DecawattPerLiter).DecawattsPerLiter, DecawattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DeciwattPerCubicFoot).DeciwattsPerCubicFoot, DeciwattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DeciwattPerCubicInch).DeciwattsPerCubicInch, DeciwattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DeciwattPerCubicMeter).DeciwattsPerCubicMeter, DeciwattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DeciwattPerLiter).DeciwattsPerLiter, DeciwattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.GigawattPerCubicFoot).GigawattsPerCubicFoot, GigawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.GigawattPerCubicInch).GigawattsPerCubicInch, GigawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.GigawattPerCubicMeter).GigawattsPerCubicMeter, GigawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.GigawattPerLiter).GigawattsPerLiter, GigawattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.KilowattPerCubicFoot).KilowattsPerCubicFoot, KilowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.KilowattPerCubicInch).KilowattsPerCubicInch, KilowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.KilowattPerCubicMeter).KilowattsPerCubicMeter, KilowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.KilowattPerLiter).KilowattsPerLiter, KilowattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MegawattPerCubicFoot).MegawattsPerCubicFoot, MegawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MegawattPerCubicInch).MegawattsPerCubicInch, MegawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MegawattPerCubicMeter).MegawattsPerCubicMeter, MegawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MegawattPerLiter).MegawattsPerLiter, MegawattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MicrowattPerCubicFoot).MicrowattsPerCubicFoot, MicrowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MicrowattPerCubicInch).MicrowattsPerCubicInch, MicrowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MicrowattPerCubicMeter).MicrowattsPerCubicMeter, MicrowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MicrowattPerLiter).MicrowattsPerLiter, MicrowattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MilliwattPerCubicFoot).MilliwattsPerCubicFoot, MilliwattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MilliwattPerCubicInch).MilliwattsPerCubicInch, MilliwattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MilliwattPerCubicMeter).MilliwattsPerCubicMeter, MilliwattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MilliwattPerLiter).MilliwattsPerLiter, MilliwattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.NanowattPerCubicFoot).NanowattsPerCubicFoot, NanowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.NanowattPerCubicInch).NanowattsPerCubicInch, NanowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.NanowattPerCubicMeter).NanowattsPerCubicMeter, NanowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.NanowattPerLiter).NanowattsPerLiter, NanowattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.PicowattPerCubicFoot).PicowattsPerCubicFoot, PicowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.PicowattPerCubicInch).PicowattsPerCubicInch, PicowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.PicowattPerCubicMeter).PicowattsPerCubicMeter, PicowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.PicowattPerLiter).PicowattsPerLiter, PicowattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.TerawattPerCubicFoot).TerawattsPerCubicFoot, TerawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.TerawattPerCubicInch).TerawattsPerCubicInch, TerawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.TerawattPerCubicMeter).TerawattsPerCubicMeter, TerawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.TerawattPerLiter).TerawattsPerLiter, TerawattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.WattPerCubicFoot).WattsPerCubicFoot, WattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.WattPerCubicInch).WattsPerCubicInch, WattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.WattPerCubicMeter).WattsPerCubicMeter, WattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.WattPerLiter).WattsPerLiter, WattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DecawattPerCubicFoot).DecawattsPerCubicFoot, DecawattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DecawattPerCubicInch).DecawattsPerCubicInch, DecawattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DecawattPerCubicMeter).DecawattsPerCubicMeter, DecawattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DecawattPerLiter).DecawattsPerLiter, DecawattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DeciwattPerCubicFoot).DeciwattsPerCubicFoot, DeciwattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DeciwattPerCubicInch).DeciwattsPerCubicInch, DeciwattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DeciwattPerCubicMeter).DeciwattsPerCubicMeter, DeciwattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DeciwattPerLiter).DeciwattsPerLiter, DeciwattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.GigawattPerCubicFoot).GigawattsPerCubicFoot, GigawattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.GigawattPerCubicInch).GigawattsPerCubicInch, GigawattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.GigawattPerCubicMeter).GigawattsPerCubicMeter, GigawattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.GigawattPerLiter).GigawattsPerLiter, GigawattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.KilowattPerCubicFoot).KilowattsPerCubicFoot, KilowattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.KilowattPerCubicInch).KilowattsPerCubicInch, KilowattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.KilowattPerCubicMeter).KilowattsPerCubicMeter, KilowattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.KilowattPerLiter).KilowattsPerLiter, KilowattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MegawattPerCubicFoot).MegawattsPerCubicFoot, MegawattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MegawattPerCubicInch).MegawattsPerCubicInch, MegawattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MegawattPerCubicMeter).MegawattsPerCubicMeter, MegawattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MegawattPerLiter).MegawattsPerLiter, MegawattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MicrowattPerCubicFoot).MicrowattsPerCubicFoot, MicrowattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MicrowattPerCubicInch).MicrowattsPerCubicInch, MicrowattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MicrowattPerCubicMeter).MicrowattsPerCubicMeter, MicrowattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MicrowattPerLiter).MicrowattsPerLiter, MicrowattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MilliwattPerCubicFoot).MilliwattsPerCubicFoot, MilliwattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MilliwattPerCubicInch).MilliwattsPerCubicInch, MilliwattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MilliwattPerCubicMeter).MilliwattsPerCubicMeter, MilliwattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MilliwattPerLiter).MilliwattsPerLiter, MilliwattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.NanowattPerCubicFoot).NanowattsPerCubicFoot, NanowattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.NanowattPerCubicInch).NanowattsPerCubicInch, NanowattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.NanowattPerCubicMeter).NanowattsPerCubicMeter, NanowattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.NanowattPerLiter).NanowattsPerLiter, NanowattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.PicowattPerCubicFoot).PicowattsPerCubicFoot, PicowattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.PicowattPerCubicInch).PicowattsPerCubicInch, PicowattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.PicowattPerCubicMeter).PicowattsPerCubicMeter, PicowattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.PicowattPerLiter).PicowattsPerLiter, PicowattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.TerawattPerCubicFoot).TerawattsPerCubicFoot, TerawattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.TerawattPerCubicInch).TerawattsPerCubicInch, TerawattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.TerawattPerCubicMeter).TerawattsPerCubicMeter, TerawattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.TerawattPerLiter).TerawattsPerLiter, TerawattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.WattPerCubicFoot).WattsPerCubicFoot, WattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.WattPerCubicInch).WattsPerCubicInch, WattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.WattPerCubicMeter).WattsPerCubicMeter, WattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.WattPerLiter).WattsPerLiter, WattsPerLiterTolerance); } [Fact] public void FromWattsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.NegativeInfinity)); + Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.PositiveInfinity)); + Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.NegativeInfinity)); } [Fact] public void FromWattsPerCubicMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.NaN)); + Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.NaN)); } [Fact] public void As() { - var wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); + var wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); AssertEx.EqualTolerance(DecawattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.DecawattPerCubicFoot), DecawattsPerCubicFootTolerance); AssertEx.EqualTolerance(DecawattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.DecawattPerCubicInch), DecawattsPerCubicInchTolerance); AssertEx.EqualTolerance(DecawattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.DecawattPerCubicMeter), DecawattsPerCubicMeterTolerance); @@ -310,7 +310,7 @@ public void As() [Fact] public void ToUnit() { - var wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); + var wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); var decawattpercubicfootQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.DecawattPerCubicFoot); AssertEx.EqualTolerance(DecawattsPerCubicFootInOneWattPerCubicMeter, (double)decawattpercubicfootQuantity.Value, DecawattsPerCubicFootTolerance); @@ -492,71 +492,71 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); - AssertEx.EqualTolerance(1, PowerDensity.FromDecawattsPerCubicFoot(wattpercubicmeter.DecawattsPerCubicFoot).WattsPerCubicMeter, DecawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromDecawattsPerCubicInch(wattpercubicmeter.DecawattsPerCubicInch).WattsPerCubicMeter, DecawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromDecawattsPerCubicMeter(wattpercubicmeter.DecawattsPerCubicMeter).WattsPerCubicMeter, DecawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromDecawattsPerLiter(wattpercubicmeter.DecawattsPerLiter).WattsPerCubicMeter, DecawattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromDeciwattsPerCubicFoot(wattpercubicmeter.DeciwattsPerCubicFoot).WattsPerCubicMeter, DeciwattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromDeciwattsPerCubicInch(wattpercubicmeter.DeciwattsPerCubicInch).WattsPerCubicMeter, DeciwattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromDeciwattsPerCubicMeter(wattpercubicmeter.DeciwattsPerCubicMeter).WattsPerCubicMeter, DeciwattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromDeciwattsPerLiter(wattpercubicmeter.DeciwattsPerLiter).WattsPerCubicMeter, DeciwattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromGigawattsPerCubicFoot(wattpercubicmeter.GigawattsPerCubicFoot).WattsPerCubicMeter, GigawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromGigawattsPerCubicInch(wattpercubicmeter.GigawattsPerCubicInch).WattsPerCubicMeter, GigawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromGigawattsPerCubicMeter(wattpercubicmeter.GigawattsPerCubicMeter).WattsPerCubicMeter, GigawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromGigawattsPerLiter(wattpercubicmeter.GigawattsPerLiter).WattsPerCubicMeter, GigawattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromKilowattsPerCubicFoot(wattpercubicmeter.KilowattsPerCubicFoot).WattsPerCubicMeter, KilowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromKilowattsPerCubicInch(wattpercubicmeter.KilowattsPerCubicInch).WattsPerCubicMeter, KilowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromKilowattsPerCubicMeter(wattpercubicmeter.KilowattsPerCubicMeter).WattsPerCubicMeter, KilowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromKilowattsPerLiter(wattpercubicmeter.KilowattsPerLiter).WattsPerCubicMeter, KilowattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMegawattsPerCubicFoot(wattpercubicmeter.MegawattsPerCubicFoot).WattsPerCubicMeter, MegawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMegawattsPerCubicInch(wattpercubicmeter.MegawattsPerCubicInch).WattsPerCubicMeter, MegawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMegawattsPerCubicMeter(wattpercubicmeter.MegawattsPerCubicMeter).WattsPerCubicMeter, MegawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMegawattsPerLiter(wattpercubicmeter.MegawattsPerLiter).WattsPerCubicMeter, MegawattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMicrowattsPerCubicFoot(wattpercubicmeter.MicrowattsPerCubicFoot).WattsPerCubicMeter, MicrowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMicrowattsPerCubicInch(wattpercubicmeter.MicrowattsPerCubicInch).WattsPerCubicMeter, MicrowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMicrowattsPerCubicMeter(wattpercubicmeter.MicrowattsPerCubicMeter).WattsPerCubicMeter, MicrowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMicrowattsPerLiter(wattpercubicmeter.MicrowattsPerLiter).WattsPerCubicMeter, MicrowattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMilliwattsPerCubicFoot(wattpercubicmeter.MilliwattsPerCubicFoot).WattsPerCubicMeter, MilliwattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMilliwattsPerCubicInch(wattpercubicmeter.MilliwattsPerCubicInch).WattsPerCubicMeter, MilliwattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMilliwattsPerCubicMeter(wattpercubicmeter.MilliwattsPerCubicMeter).WattsPerCubicMeter, MilliwattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMilliwattsPerLiter(wattpercubicmeter.MilliwattsPerLiter).WattsPerCubicMeter, MilliwattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromNanowattsPerCubicFoot(wattpercubicmeter.NanowattsPerCubicFoot).WattsPerCubicMeter, NanowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromNanowattsPerCubicInch(wattpercubicmeter.NanowattsPerCubicInch).WattsPerCubicMeter, NanowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromNanowattsPerCubicMeter(wattpercubicmeter.NanowattsPerCubicMeter).WattsPerCubicMeter, NanowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromNanowattsPerLiter(wattpercubicmeter.NanowattsPerLiter).WattsPerCubicMeter, NanowattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromPicowattsPerCubicFoot(wattpercubicmeter.PicowattsPerCubicFoot).WattsPerCubicMeter, PicowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromPicowattsPerCubicInch(wattpercubicmeter.PicowattsPerCubicInch).WattsPerCubicMeter, PicowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromPicowattsPerCubicMeter(wattpercubicmeter.PicowattsPerCubicMeter).WattsPerCubicMeter, PicowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromPicowattsPerLiter(wattpercubicmeter.PicowattsPerLiter).WattsPerCubicMeter, PicowattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromTerawattsPerCubicFoot(wattpercubicmeter.TerawattsPerCubicFoot).WattsPerCubicMeter, TerawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromTerawattsPerCubicInch(wattpercubicmeter.TerawattsPerCubicInch).WattsPerCubicMeter, TerawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromTerawattsPerCubicMeter(wattpercubicmeter.TerawattsPerCubicMeter).WattsPerCubicMeter, TerawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromTerawattsPerLiter(wattpercubicmeter.TerawattsPerLiter).WattsPerCubicMeter, TerawattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromWattsPerCubicFoot(wattpercubicmeter.WattsPerCubicFoot).WattsPerCubicMeter, WattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromWattsPerCubicInch(wattpercubicmeter.WattsPerCubicInch).WattsPerCubicMeter, WattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromWattsPerCubicMeter(wattpercubicmeter.WattsPerCubicMeter).WattsPerCubicMeter, WattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromWattsPerLiter(wattpercubicmeter.WattsPerLiter).WattsPerCubicMeter, WattsPerLiterTolerance); + PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); + AssertEx.EqualTolerance(1, PowerDensity.FromDecawattsPerCubicFoot(wattpercubicmeter.DecawattsPerCubicFoot).WattsPerCubicMeter, DecawattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromDecawattsPerCubicInch(wattpercubicmeter.DecawattsPerCubicInch).WattsPerCubicMeter, DecawattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromDecawattsPerCubicMeter(wattpercubicmeter.DecawattsPerCubicMeter).WattsPerCubicMeter, DecawattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromDecawattsPerLiter(wattpercubicmeter.DecawattsPerLiter).WattsPerCubicMeter, DecawattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromDeciwattsPerCubicFoot(wattpercubicmeter.DeciwattsPerCubicFoot).WattsPerCubicMeter, DeciwattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromDeciwattsPerCubicInch(wattpercubicmeter.DeciwattsPerCubicInch).WattsPerCubicMeter, DeciwattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromDeciwattsPerCubicMeter(wattpercubicmeter.DeciwattsPerCubicMeter).WattsPerCubicMeter, DeciwattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromDeciwattsPerLiter(wattpercubicmeter.DeciwattsPerLiter).WattsPerCubicMeter, DeciwattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromGigawattsPerCubicFoot(wattpercubicmeter.GigawattsPerCubicFoot).WattsPerCubicMeter, GigawattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromGigawattsPerCubicInch(wattpercubicmeter.GigawattsPerCubicInch).WattsPerCubicMeter, GigawattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromGigawattsPerCubicMeter(wattpercubicmeter.GigawattsPerCubicMeter).WattsPerCubicMeter, GigawattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromGigawattsPerLiter(wattpercubicmeter.GigawattsPerLiter).WattsPerCubicMeter, GigawattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromKilowattsPerCubicFoot(wattpercubicmeter.KilowattsPerCubicFoot).WattsPerCubicMeter, KilowattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromKilowattsPerCubicInch(wattpercubicmeter.KilowattsPerCubicInch).WattsPerCubicMeter, KilowattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromKilowattsPerCubicMeter(wattpercubicmeter.KilowattsPerCubicMeter).WattsPerCubicMeter, KilowattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromKilowattsPerLiter(wattpercubicmeter.KilowattsPerLiter).WattsPerCubicMeter, KilowattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromMegawattsPerCubicFoot(wattpercubicmeter.MegawattsPerCubicFoot).WattsPerCubicMeter, MegawattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromMegawattsPerCubicInch(wattpercubicmeter.MegawattsPerCubicInch).WattsPerCubicMeter, MegawattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromMegawattsPerCubicMeter(wattpercubicmeter.MegawattsPerCubicMeter).WattsPerCubicMeter, MegawattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromMegawattsPerLiter(wattpercubicmeter.MegawattsPerLiter).WattsPerCubicMeter, MegawattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromMicrowattsPerCubicFoot(wattpercubicmeter.MicrowattsPerCubicFoot).WattsPerCubicMeter, MicrowattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromMicrowattsPerCubicInch(wattpercubicmeter.MicrowattsPerCubicInch).WattsPerCubicMeter, MicrowattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromMicrowattsPerCubicMeter(wattpercubicmeter.MicrowattsPerCubicMeter).WattsPerCubicMeter, MicrowattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromMicrowattsPerLiter(wattpercubicmeter.MicrowattsPerLiter).WattsPerCubicMeter, MicrowattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromMilliwattsPerCubicFoot(wattpercubicmeter.MilliwattsPerCubicFoot).WattsPerCubicMeter, MilliwattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromMilliwattsPerCubicInch(wattpercubicmeter.MilliwattsPerCubicInch).WattsPerCubicMeter, MilliwattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromMilliwattsPerCubicMeter(wattpercubicmeter.MilliwattsPerCubicMeter).WattsPerCubicMeter, MilliwattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromMilliwattsPerLiter(wattpercubicmeter.MilliwattsPerLiter).WattsPerCubicMeter, MilliwattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromNanowattsPerCubicFoot(wattpercubicmeter.NanowattsPerCubicFoot).WattsPerCubicMeter, NanowattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromNanowattsPerCubicInch(wattpercubicmeter.NanowattsPerCubicInch).WattsPerCubicMeter, NanowattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromNanowattsPerCubicMeter(wattpercubicmeter.NanowattsPerCubicMeter).WattsPerCubicMeter, NanowattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromNanowattsPerLiter(wattpercubicmeter.NanowattsPerLiter).WattsPerCubicMeter, NanowattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromPicowattsPerCubicFoot(wattpercubicmeter.PicowattsPerCubicFoot).WattsPerCubicMeter, PicowattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromPicowattsPerCubicInch(wattpercubicmeter.PicowattsPerCubicInch).WattsPerCubicMeter, PicowattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromPicowattsPerCubicMeter(wattpercubicmeter.PicowattsPerCubicMeter).WattsPerCubicMeter, PicowattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromPicowattsPerLiter(wattpercubicmeter.PicowattsPerLiter).WattsPerCubicMeter, PicowattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromTerawattsPerCubicFoot(wattpercubicmeter.TerawattsPerCubicFoot).WattsPerCubicMeter, TerawattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromTerawattsPerCubicInch(wattpercubicmeter.TerawattsPerCubicInch).WattsPerCubicMeter, TerawattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromTerawattsPerCubicMeter(wattpercubicmeter.TerawattsPerCubicMeter).WattsPerCubicMeter, TerawattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromTerawattsPerLiter(wattpercubicmeter.TerawattsPerLiter).WattsPerCubicMeter, TerawattsPerLiterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromWattsPerCubicFoot(wattpercubicmeter.WattsPerCubicFoot).WattsPerCubicMeter, WattsPerCubicFootTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromWattsPerCubicInch(wattpercubicmeter.WattsPerCubicInch).WattsPerCubicMeter, WattsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromWattsPerCubicMeter(wattpercubicmeter.WattsPerCubicMeter).WattsPerCubicMeter, WattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, PowerDensity.FromWattsPerLiter(wattpercubicmeter.WattsPerLiter).WattsPerCubicMeter, WattsPerLiterTolerance); } [Fact] public void ArithmeticOperators() { - PowerDensity v = PowerDensity.FromWattsPerCubicMeter(1); + PowerDensity v = PowerDensity.FromWattsPerCubicMeter(1); AssertEx.EqualTolerance(-1, -v.WattsPerCubicMeter, WattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (PowerDensity.FromWattsPerCubicMeter(3)-v).WattsPerCubicMeter, WattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, (PowerDensity.FromWattsPerCubicMeter(3)-v).WattsPerCubicMeter, WattsPerCubicMeterTolerance); AssertEx.EqualTolerance(2, (v + v).WattsPerCubicMeter, WattsPerCubicMeterTolerance); AssertEx.EqualTolerance(10, (v*10).WattsPerCubicMeter, WattsPerCubicMeterTolerance); AssertEx.EqualTolerance(10, (10*v).WattsPerCubicMeter, WattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (PowerDensity.FromWattsPerCubicMeter(10)/5).WattsPerCubicMeter, WattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, PowerDensity.FromWattsPerCubicMeter(10)/PowerDensity.FromWattsPerCubicMeter(5), WattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, (PowerDensity.FromWattsPerCubicMeter(10)/5).WattsPerCubicMeter, WattsPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, PowerDensity.FromWattsPerCubicMeter(10)/PowerDensity.FromWattsPerCubicMeter(5), WattsPerCubicMeterTolerance); } [Fact] public void ComparisonOperators() { - PowerDensity oneWattPerCubicMeter = PowerDensity.FromWattsPerCubicMeter(1); - PowerDensity twoWattsPerCubicMeter = PowerDensity.FromWattsPerCubicMeter(2); + PowerDensity oneWattPerCubicMeter = PowerDensity.FromWattsPerCubicMeter(1); + PowerDensity twoWattsPerCubicMeter = PowerDensity.FromWattsPerCubicMeter(2); Assert.True(oneWattPerCubicMeter < twoWattsPerCubicMeter); Assert.True(oneWattPerCubicMeter <= twoWattsPerCubicMeter); @@ -572,31 +572,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); + PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); Assert.Equal(0, wattpercubicmeter.CompareTo(wattpercubicmeter)); - Assert.True(wattpercubicmeter.CompareTo(PowerDensity.Zero) > 0); - Assert.True(PowerDensity.Zero.CompareTo(wattpercubicmeter) < 0); + Assert.True(wattpercubicmeter.CompareTo(PowerDensity.Zero) > 0); + Assert.True(PowerDensity.Zero.CompareTo(wattpercubicmeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); + PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); Assert.Throws(() => wattpercubicmeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); + PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); Assert.Throws(() => wattpercubicmeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = PowerDensity.FromWattsPerCubicMeter(1); - var b = PowerDensity.FromWattsPerCubicMeter(2); + var a = PowerDensity.FromWattsPerCubicMeter(1); + var b = PowerDensity.FromWattsPerCubicMeter(2); // ReSharper disable EqualExpressionComparison @@ -615,8 +615,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = PowerDensity.FromWattsPerCubicMeter(1); - var b = PowerDensity.FromWattsPerCubicMeter(2); + var a = PowerDensity.FromWattsPerCubicMeter(1); + var b = PowerDensity.FromWattsPerCubicMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -626,29 +626,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = PowerDensity.FromWattsPerCubicMeter(1); - Assert.True(v.Equals(PowerDensity.FromWattsPerCubicMeter(1), WattsPerCubicMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(PowerDensity.Zero, WattsPerCubicMeterTolerance, ComparisonType.Relative)); + var v = PowerDensity.FromWattsPerCubicMeter(1); + Assert.True(v.Equals(PowerDensity.FromWattsPerCubicMeter(1), WattsPerCubicMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(PowerDensity.Zero, WattsPerCubicMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); + PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); Assert.False(wattpercubicmeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); + PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); Assert.False(wattpercubicmeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(PowerDensityUnit.Undefined, PowerDensity.Units); + Assert.DoesNotContain(PowerDensityUnit.Undefined, PowerDensity.Units); } [Fact] @@ -667,7 +667,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(PowerDensity.BaseDimensions is null); + Assert.False(PowerDensity.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs index 097dfc37da..e8f5bf6451 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of PowerRatio. + /// Test of PowerRatio. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class PowerRatioTestsBase @@ -45,26 +45,26 @@ public abstract partial class PowerRatioTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new PowerRatio((double)0.0, PowerRatioUnit.Undefined)); + Assert.Throws(() => new PowerRatio((double)0.0, PowerRatioUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new PowerRatio(double.PositiveInfinity, PowerRatioUnit.DecibelWatt)); - Assert.Throws(() => new PowerRatio(double.NegativeInfinity, PowerRatioUnit.DecibelWatt)); + Assert.Throws(() => new PowerRatio(double.PositiveInfinity, PowerRatioUnit.DecibelWatt)); + Assert.Throws(() => new PowerRatio(double.NegativeInfinity, PowerRatioUnit.DecibelWatt)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new PowerRatio(double.NaN, PowerRatioUnit.DecibelWatt)); + Assert.Throws(() => new PowerRatio(double.NaN, PowerRatioUnit.DecibelWatt)); } [Fact] public void DecibelWattToPowerRatioUnits() { - PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); + PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); AssertEx.EqualTolerance(DecibelMilliwattsInOneDecibelWatt, decibelwatt.DecibelMilliwatts, DecibelMilliwattsTolerance); AssertEx.EqualTolerance(DecibelWattsInOneDecibelWatt, decibelwatt.DecibelWatts, DecibelWattsTolerance); } @@ -72,27 +72,27 @@ public void DecibelWattToPowerRatioUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, PowerRatio.From(1, PowerRatioUnit.DecibelMilliwatt).DecibelMilliwatts, DecibelMilliwattsTolerance); - AssertEx.EqualTolerance(1, PowerRatio.From(1, PowerRatioUnit.DecibelWatt).DecibelWatts, DecibelWattsTolerance); + AssertEx.EqualTolerance(1, PowerRatio.From(1, PowerRatioUnit.DecibelMilliwatt).DecibelMilliwatts, DecibelMilliwattsTolerance); + AssertEx.EqualTolerance(1, PowerRatio.From(1, PowerRatioUnit.DecibelWatt).DecibelWatts, DecibelWattsTolerance); } [Fact] public void FromDecibelWatts_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => PowerRatio.FromDecibelWatts(double.PositiveInfinity)); - Assert.Throws(() => PowerRatio.FromDecibelWatts(double.NegativeInfinity)); + Assert.Throws(() => PowerRatio.FromDecibelWatts(double.PositiveInfinity)); + Assert.Throws(() => PowerRatio.FromDecibelWatts(double.NegativeInfinity)); } [Fact] public void FromDecibelWatts_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => PowerRatio.FromDecibelWatts(double.NaN)); + Assert.Throws(() => PowerRatio.FromDecibelWatts(double.NaN)); } [Fact] public void As() { - var decibelwatt = PowerRatio.FromDecibelWatts(1); + var decibelwatt = PowerRatio.FromDecibelWatts(1); AssertEx.EqualTolerance(DecibelMilliwattsInOneDecibelWatt, decibelwatt.As(PowerRatioUnit.DecibelMilliwatt), DecibelMilliwattsTolerance); AssertEx.EqualTolerance(DecibelWattsInOneDecibelWatt, decibelwatt.As(PowerRatioUnit.DecibelWatt), DecibelWattsTolerance); } @@ -100,7 +100,7 @@ public void As() [Fact] public void ToUnit() { - var decibelwatt = PowerRatio.FromDecibelWatts(1); + var decibelwatt = PowerRatio.FromDecibelWatts(1); var decibelmilliwattQuantity = decibelwatt.ToUnit(PowerRatioUnit.DecibelMilliwatt); AssertEx.EqualTolerance(DecibelMilliwattsInOneDecibelWatt, (double)decibelmilliwattQuantity.Value, DecibelMilliwattsTolerance); @@ -114,22 +114,22 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); - AssertEx.EqualTolerance(1, PowerRatio.FromDecibelMilliwatts(decibelwatt.DecibelMilliwatts).DecibelWatts, DecibelMilliwattsTolerance); - AssertEx.EqualTolerance(1, PowerRatio.FromDecibelWatts(decibelwatt.DecibelWatts).DecibelWatts, DecibelWattsTolerance); + PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); + AssertEx.EqualTolerance(1, PowerRatio.FromDecibelMilliwatts(decibelwatt.DecibelMilliwatts).DecibelWatts, DecibelMilliwattsTolerance); + AssertEx.EqualTolerance(1, PowerRatio.FromDecibelWatts(decibelwatt.DecibelWatts).DecibelWatts, DecibelWattsTolerance); } [Fact] public void LogarithmicArithmeticOperators() { - PowerRatio v = PowerRatio.FromDecibelWatts(40); + PowerRatio v = PowerRatio.FromDecibelWatts(40); AssertEx.EqualTolerance(-40, -v.DecibelWatts, DecibelWattsTolerance); AssertLogarithmicAddition(); AssertLogarithmicSubtraction(); AssertEx.EqualTolerance(50, (v*10).DecibelWatts, DecibelWattsTolerance); AssertEx.EqualTolerance(50, (10*v).DecibelWatts, DecibelWattsTolerance); AssertEx.EqualTolerance(35, (v/5).DecibelWatts, DecibelWattsTolerance); - AssertEx.EqualTolerance(35, v/PowerRatio.FromDecibelWatts(5), DecibelWattsTolerance); + AssertEx.EqualTolerance(35, v/PowerRatio.FromDecibelWatts(5), DecibelWattsTolerance); } protected abstract void AssertLogarithmicAddition(); @@ -139,8 +139,8 @@ public void LogarithmicArithmeticOperators() [Fact] public void ComparisonOperators() { - PowerRatio oneDecibelWatt = PowerRatio.FromDecibelWatts(1); - PowerRatio twoDecibelWatts = PowerRatio.FromDecibelWatts(2); + PowerRatio oneDecibelWatt = PowerRatio.FromDecibelWatts(1); + PowerRatio twoDecibelWatts = PowerRatio.FromDecibelWatts(2); Assert.True(oneDecibelWatt < twoDecibelWatts); Assert.True(oneDecibelWatt <= twoDecibelWatts); @@ -156,31 +156,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); + PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); Assert.Equal(0, decibelwatt.CompareTo(decibelwatt)); - Assert.True(decibelwatt.CompareTo(PowerRatio.Zero) > 0); - Assert.True(PowerRatio.Zero.CompareTo(decibelwatt) < 0); + Assert.True(decibelwatt.CompareTo(PowerRatio.Zero) > 0); + Assert.True(PowerRatio.Zero.CompareTo(decibelwatt) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); + PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); Assert.Throws(() => decibelwatt.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); + PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); Assert.Throws(() => decibelwatt.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = PowerRatio.FromDecibelWatts(1); - var b = PowerRatio.FromDecibelWatts(2); + var a = PowerRatio.FromDecibelWatts(1); + var b = PowerRatio.FromDecibelWatts(2); // ReSharper disable EqualExpressionComparison @@ -199,8 +199,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = PowerRatio.FromDecibelWatts(1); - var b = PowerRatio.FromDecibelWatts(2); + var a = PowerRatio.FromDecibelWatts(1); + var b = PowerRatio.FromDecibelWatts(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -210,29 +210,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = PowerRatio.FromDecibelWatts(1); - Assert.True(v.Equals(PowerRatio.FromDecibelWatts(1), DecibelWattsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(PowerRatio.Zero, DecibelWattsTolerance, ComparisonType.Relative)); + var v = PowerRatio.FromDecibelWatts(1); + Assert.True(v.Equals(PowerRatio.FromDecibelWatts(1), DecibelWattsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(PowerRatio.Zero, DecibelWattsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); + PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); Assert.False(decibelwatt.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); + PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); Assert.False(decibelwatt.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(PowerRatioUnit.Undefined, PowerRatio.Units); + Assert.DoesNotContain(PowerRatioUnit.Undefined, PowerRatio.Units); } [Fact] @@ -251,7 +251,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(PowerRatio.BaseDimensions is null); + Assert.False(PowerRatio.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs index 11e0284104..89abfa6346 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs @@ -81,13 +81,13 @@ public abstract partial class PowerTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Power((decimal)0.0, PowerUnit.Undefined)); + Assert.Throws(() => new Power((decimal)0.0, PowerUnit.Undefined)); } [Fact] public void WattToPowerUnits() { - Power watt = Power.FromWatts(1); + Power watt = Power.FromWatts(1); AssertEx.EqualTolerance(BoilerHorsepowerInOneWatt, watt.BoilerHorsepower, BoilerHorsepowerTolerance); AssertEx.EqualTolerance(BritishThermalUnitsPerHourInOneWatt, watt.BritishThermalUnitsPerHour, BritishThermalUnitsPerHourTolerance); AssertEx.EqualTolerance(DecawattsInOneWatt, watt.Decawatts, DecawattsTolerance); @@ -113,32 +113,32 @@ public void WattToPowerUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.BoilerHorsepower).BoilerHorsepower, BoilerHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.BritishThermalUnitPerHour).BritishThermalUnitsPerHour, BritishThermalUnitsPerHourTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Decawatt).Decawatts, DecawattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Deciwatt).Deciwatts, DeciwattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.ElectricalHorsepower).ElectricalHorsepower, ElectricalHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Femtowatt).Femtowatts, FemtowattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Gigawatt).Gigawatts, GigawattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.HydraulicHorsepower).HydraulicHorsepower, HydraulicHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.KilobritishThermalUnitPerHour).KilobritishThermalUnitsPerHour, KilobritishThermalUnitsPerHourTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Kilowatt).Kilowatts, KilowattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.MechanicalHorsepower).MechanicalHorsepower, MechanicalHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Megawatt).Megawatts, MegawattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.MetricHorsepower).MetricHorsepower, MetricHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Microwatt).Microwatts, MicrowattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Milliwatt).Milliwatts, MilliwattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Nanowatt).Nanowatts, NanowattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Petawatt).Petawatts, PetawattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Picowatt).Picowatts, PicowattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Terawatt).Terawatts, TerawattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Watt).Watts, WattsTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.BoilerHorsepower).BoilerHorsepower, BoilerHorsepowerTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.BritishThermalUnitPerHour).BritishThermalUnitsPerHour, BritishThermalUnitsPerHourTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Decawatt).Decawatts, DecawattsTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Deciwatt).Deciwatts, DeciwattsTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.ElectricalHorsepower).ElectricalHorsepower, ElectricalHorsepowerTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Femtowatt).Femtowatts, FemtowattsTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Gigawatt).Gigawatts, GigawattsTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.HydraulicHorsepower).HydraulicHorsepower, HydraulicHorsepowerTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.KilobritishThermalUnitPerHour).KilobritishThermalUnitsPerHour, KilobritishThermalUnitsPerHourTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Kilowatt).Kilowatts, KilowattsTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.MechanicalHorsepower).MechanicalHorsepower, MechanicalHorsepowerTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Megawatt).Megawatts, MegawattsTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.MetricHorsepower).MetricHorsepower, MetricHorsepowerTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Microwatt).Microwatts, MicrowattsTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Milliwatt).Milliwatts, MilliwattsTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Nanowatt).Nanowatts, NanowattsTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Petawatt).Petawatts, PetawattsTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Picowatt).Picowatts, PicowattsTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Terawatt).Terawatts, TerawattsTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Watt).Watts, WattsTolerance); } [Fact] public void As() { - var watt = Power.FromWatts(1); + var watt = Power.FromWatts(1); AssertEx.EqualTolerance(BoilerHorsepowerInOneWatt, watt.As(PowerUnit.BoilerHorsepower), BoilerHorsepowerTolerance); AssertEx.EqualTolerance(BritishThermalUnitsPerHourInOneWatt, watt.As(PowerUnit.BritishThermalUnitPerHour), BritishThermalUnitsPerHourTolerance); AssertEx.EqualTolerance(DecawattsInOneWatt, watt.As(PowerUnit.Decawatt), DecawattsTolerance); @@ -164,7 +164,7 @@ public void As() [Fact] public void ToUnit() { - var watt = Power.FromWatts(1); + var watt = Power.FromWatts(1); var boilerhorsepowerQuantity = watt.ToUnit(PowerUnit.BoilerHorsepower); AssertEx.EqualTolerance(BoilerHorsepowerInOneWatt, (double)boilerhorsepowerQuantity.Value, BoilerHorsepowerTolerance); @@ -250,47 +250,47 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Power watt = Power.FromWatts(1); - AssertEx.EqualTolerance(1, Power.FromBoilerHorsepower(watt.BoilerHorsepower).Watts, BoilerHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.FromBritishThermalUnitsPerHour(watt.BritishThermalUnitsPerHour).Watts, BritishThermalUnitsPerHourTolerance); - AssertEx.EqualTolerance(1, Power.FromDecawatts(watt.Decawatts).Watts, DecawattsTolerance); - AssertEx.EqualTolerance(1, Power.FromDeciwatts(watt.Deciwatts).Watts, DeciwattsTolerance); - AssertEx.EqualTolerance(1, Power.FromElectricalHorsepower(watt.ElectricalHorsepower).Watts, ElectricalHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.FromFemtowatts(watt.Femtowatts).Watts, FemtowattsTolerance); - AssertEx.EqualTolerance(1, Power.FromGigawatts(watt.Gigawatts).Watts, GigawattsTolerance); - AssertEx.EqualTolerance(1, Power.FromHydraulicHorsepower(watt.HydraulicHorsepower).Watts, HydraulicHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.FromKilobritishThermalUnitsPerHour(watt.KilobritishThermalUnitsPerHour).Watts, KilobritishThermalUnitsPerHourTolerance); - AssertEx.EqualTolerance(1, Power.FromKilowatts(watt.Kilowatts).Watts, KilowattsTolerance); - AssertEx.EqualTolerance(1, Power.FromMechanicalHorsepower(watt.MechanicalHorsepower).Watts, MechanicalHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.FromMegawatts(watt.Megawatts).Watts, MegawattsTolerance); - AssertEx.EqualTolerance(1, Power.FromMetricHorsepower(watt.MetricHorsepower).Watts, MetricHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.FromMicrowatts(watt.Microwatts).Watts, MicrowattsTolerance); - AssertEx.EqualTolerance(1, Power.FromMilliwatts(watt.Milliwatts).Watts, MilliwattsTolerance); - AssertEx.EqualTolerance(1, Power.FromNanowatts(watt.Nanowatts).Watts, NanowattsTolerance); - AssertEx.EqualTolerance(1, Power.FromPetawatts(watt.Petawatts).Watts, PetawattsTolerance); - AssertEx.EqualTolerance(1, Power.FromPicowatts(watt.Picowatts).Watts, PicowattsTolerance); - AssertEx.EqualTolerance(1, Power.FromTerawatts(watt.Terawatts).Watts, TerawattsTolerance); - AssertEx.EqualTolerance(1, Power.FromWatts(watt.Watts).Watts, WattsTolerance); + Power watt = Power.FromWatts(1); + AssertEx.EqualTolerance(1, Power.FromBoilerHorsepower(watt.BoilerHorsepower).Watts, BoilerHorsepowerTolerance); + AssertEx.EqualTolerance(1, Power.FromBritishThermalUnitsPerHour(watt.BritishThermalUnitsPerHour).Watts, BritishThermalUnitsPerHourTolerance); + AssertEx.EqualTolerance(1, Power.FromDecawatts(watt.Decawatts).Watts, DecawattsTolerance); + AssertEx.EqualTolerance(1, Power.FromDeciwatts(watt.Deciwatts).Watts, DeciwattsTolerance); + AssertEx.EqualTolerance(1, Power.FromElectricalHorsepower(watt.ElectricalHorsepower).Watts, ElectricalHorsepowerTolerance); + AssertEx.EqualTolerance(1, Power.FromFemtowatts(watt.Femtowatts).Watts, FemtowattsTolerance); + AssertEx.EqualTolerance(1, Power.FromGigawatts(watt.Gigawatts).Watts, GigawattsTolerance); + AssertEx.EqualTolerance(1, Power.FromHydraulicHorsepower(watt.HydraulicHorsepower).Watts, HydraulicHorsepowerTolerance); + AssertEx.EqualTolerance(1, Power.FromKilobritishThermalUnitsPerHour(watt.KilobritishThermalUnitsPerHour).Watts, KilobritishThermalUnitsPerHourTolerance); + AssertEx.EqualTolerance(1, Power.FromKilowatts(watt.Kilowatts).Watts, KilowattsTolerance); + AssertEx.EqualTolerance(1, Power.FromMechanicalHorsepower(watt.MechanicalHorsepower).Watts, MechanicalHorsepowerTolerance); + AssertEx.EqualTolerance(1, Power.FromMegawatts(watt.Megawatts).Watts, MegawattsTolerance); + AssertEx.EqualTolerance(1, Power.FromMetricHorsepower(watt.MetricHorsepower).Watts, MetricHorsepowerTolerance); + AssertEx.EqualTolerance(1, Power.FromMicrowatts(watt.Microwatts).Watts, MicrowattsTolerance); + AssertEx.EqualTolerance(1, Power.FromMilliwatts(watt.Milliwatts).Watts, MilliwattsTolerance); + AssertEx.EqualTolerance(1, Power.FromNanowatts(watt.Nanowatts).Watts, NanowattsTolerance); + AssertEx.EqualTolerance(1, Power.FromPetawatts(watt.Petawatts).Watts, PetawattsTolerance); + AssertEx.EqualTolerance(1, Power.FromPicowatts(watt.Picowatts).Watts, PicowattsTolerance); + AssertEx.EqualTolerance(1, Power.FromTerawatts(watt.Terawatts).Watts, TerawattsTolerance); + AssertEx.EqualTolerance(1, Power.FromWatts(watt.Watts).Watts, WattsTolerance); } [Fact] public void ArithmeticOperators() { - Power v = Power.FromWatts(1); + Power v = Power.FromWatts(1); AssertEx.EqualTolerance(-1, -v.Watts, WattsTolerance); - AssertEx.EqualTolerance(2, (Power.FromWatts(3)-v).Watts, WattsTolerance); + AssertEx.EqualTolerance(2, (Power.FromWatts(3)-v).Watts, WattsTolerance); AssertEx.EqualTolerance(2, (v + v).Watts, WattsTolerance); AssertEx.EqualTolerance(10, (v*10).Watts, WattsTolerance); AssertEx.EqualTolerance(10, (10*v).Watts, WattsTolerance); - AssertEx.EqualTolerance(2, (Power.FromWatts(10)/5).Watts, WattsTolerance); - AssertEx.EqualTolerance(2, Power.FromWatts(10)/Power.FromWatts(5), WattsTolerance); + AssertEx.EqualTolerance(2, (Power.FromWatts(10)/5).Watts, WattsTolerance); + AssertEx.EqualTolerance(2, Power.FromWatts(10)/Power.FromWatts(5), WattsTolerance); } [Fact] public void ComparisonOperators() { - Power oneWatt = Power.FromWatts(1); - Power twoWatts = Power.FromWatts(2); + Power oneWatt = Power.FromWatts(1); + Power twoWatts = Power.FromWatts(2); Assert.True(oneWatt < twoWatts); Assert.True(oneWatt <= twoWatts); @@ -306,31 +306,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Power watt = Power.FromWatts(1); + Power watt = Power.FromWatts(1); Assert.Equal(0, watt.CompareTo(watt)); - Assert.True(watt.CompareTo(Power.Zero) > 0); - Assert.True(Power.Zero.CompareTo(watt) < 0); + Assert.True(watt.CompareTo(Power.Zero) > 0); + Assert.True(Power.Zero.CompareTo(watt) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Power watt = Power.FromWatts(1); + Power watt = Power.FromWatts(1); Assert.Throws(() => watt.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Power watt = Power.FromWatts(1); + Power watt = Power.FromWatts(1); Assert.Throws(() => watt.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Power.FromWatts(1); - var b = Power.FromWatts(2); + var a = Power.FromWatts(1); + var b = Power.FromWatts(2); // ReSharper disable EqualExpressionComparison @@ -349,8 +349,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Power.FromWatts(1); - var b = Power.FromWatts(2); + var a = Power.FromWatts(1); + var b = Power.FromWatts(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -360,29 +360,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Power.FromWatts(1); - Assert.True(v.Equals(Power.FromWatts(1), WattsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Power.Zero, WattsTolerance, ComparisonType.Relative)); + var v = Power.FromWatts(1); + Assert.True(v.Equals(Power.FromWatts(1), WattsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Power.Zero, WattsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Power watt = Power.FromWatts(1); + Power watt = Power.FromWatts(1); Assert.False(watt.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Power watt = Power.FromWatts(1); + Power watt = Power.FromWatts(1); Assert.False(watt.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(PowerUnit.Undefined, Power.Units); + Assert.DoesNotContain(PowerUnit.Undefined, Power.Units); } [Fact] @@ -401,7 +401,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Power.BaseDimensions is null); + Assert.False(Power.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs index e2499e92f0..b78137ac14 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs @@ -55,26 +55,26 @@ public abstract partial class PressureChangeRateTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new PressureChangeRate((double)0.0, PressureChangeRateUnit.Undefined)); + Assert.Throws(() => new PressureChangeRate((double)0.0, PressureChangeRateUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new PressureChangeRate(double.PositiveInfinity, PressureChangeRateUnit.PascalPerSecond)); - Assert.Throws(() => new PressureChangeRate(double.NegativeInfinity, PressureChangeRateUnit.PascalPerSecond)); + Assert.Throws(() => new PressureChangeRate(double.PositiveInfinity, PressureChangeRateUnit.PascalPerSecond)); + Assert.Throws(() => new PressureChangeRate(double.NegativeInfinity, PressureChangeRateUnit.PascalPerSecond)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new PressureChangeRate(double.NaN, PressureChangeRateUnit.PascalPerSecond)); + Assert.Throws(() => new PressureChangeRate(double.NaN, PressureChangeRateUnit.PascalPerSecond)); } [Fact] public void PascalPerSecondToPressureChangeRateUnits() { - PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); + PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); AssertEx.EqualTolerance(AtmospheresPerSecondInOnePascalPerSecond, pascalpersecond.AtmospheresPerSecond, AtmospheresPerSecondTolerance); AssertEx.EqualTolerance(KilopascalsPerMinuteInOnePascalPerSecond, pascalpersecond.KilopascalsPerMinute, KilopascalsPerMinuteTolerance); AssertEx.EqualTolerance(KilopascalsPerSecondInOnePascalPerSecond, pascalpersecond.KilopascalsPerSecond, KilopascalsPerSecondTolerance); @@ -87,32 +87,32 @@ public void PascalPerSecondToPressureChangeRateUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.AtmospherePerSecond).AtmospheresPerSecond, AtmospheresPerSecondTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.KilopascalPerMinute).KilopascalsPerMinute, KilopascalsPerMinuteTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.KilopascalPerSecond).KilopascalsPerSecond, KilopascalsPerSecondTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.MegapascalPerMinute).MegapascalsPerMinute, MegapascalsPerMinuteTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.MegapascalPerSecond).MegapascalsPerSecond, MegapascalsPerSecondTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.PascalPerMinute).PascalsPerMinute, PascalsPerMinuteTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.PascalPerSecond).PascalsPerSecond, PascalsPerSecondTolerance); + AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.AtmospherePerSecond).AtmospheresPerSecond, AtmospheresPerSecondTolerance); + AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.KilopascalPerMinute).KilopascalsPerMinute, KilopascalsPerMinuteTolerance); + AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.KilopascalPerSecond).KilopascalsPerSecond, KilopascalsPerSecondTolerance); + AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.MegapascalPerMinute).MegapascalsPerMinute, MegapascalsPerMinuteTolerance); + AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.MegapascalPerSecond).MegapascalsPerSecond, MegapascalsPerSecondTolerance); + AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.PascalPerMinute).PascalsPerMinute, PascalsPerMinuteTolerance); + AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.PascalPerSecond).PascalsPerSecond, PascalsPerSecondTolerance); } [Fact] public void FromPascalsPerSecond_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.PositiveInfinity)); - Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.NegativeInfinity)); + Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.PositiveInfinity)); + Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.NegativeInfinity)); } [Fact] public void FromPascalsPerSecond_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.NaN)); + Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.NaN)); } [Fact] public void As() { - var pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); + var pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); AssertEx.EqualTolerance(AtmospheresPerSecondInOnePascalPerSecond, pascalpersecond.As(PressureChangeRateUnit.AtmospherePerSecond), AtmospheresPerSecondTolerance); AssertEx.EqualTolerance(KilopascalsPerMinuteInOnePascalPerSecond, pascalpersecond.As(PressureChangeRateUnit.KilopascalPerMinute), KilopascalsPerMinuteTolerance); AssertEx.EqualTolerance(KilopascalsPerSecondInOnePascalPerSecond, pascalpersecond.As(PressureChangeRateUnit.KilopascalPerSecond), KilopascalsPerSecondTolerance); @@ -125,7 +125,7 @@ public void As() [Fact] public void ToUnit() { - var pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); + var pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); var atmospherepersecondQuantity = pascalpersecond.ToUnit(PressureChangeRateUnit.AtmospherePerSecond); AssertEx.EqualTolerance(AtmospheresPerSecondInOnePascalPerSecond, (double)atmospherepersecondQuantity.Value, AtmospheresPerSecondTolerance); @@ -159,34 +159,34 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); - AssertEx.EqualTolerance(1, PressureChangeRate.FromAtmospheresPerSecond(pascalpersecond.AtmospheresPerSecond).PascalsPerSecond, AtmospheresPerSecondTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.FromKilopascalsPerMinute(pascalpersecond.KilopascalsPerMinute).PascalsPerSecond, KilopascalsPerMinuteTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.FromKilopascalsPerSecond(pascalpersecond.KilopascalsPerSecond).PascalsPerSecond, KilopascalsPerSecondTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.FromMegapascalsPerMinute(pascalpersecond.MegapascalsPerMinute).PascalsPerSecond, MegapascalsPerMinuteTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.FromMegapascalsPerSecond(pascalpersecond.MegapascalsPerSecond).PascalsPerSecond, MegapascalsPerSecondTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.FromPascalsPerMinute(pascalpersecond.PascalsPerMinute).PascalsPerSecond, PascalsPerMinuteTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.FromPascalsPerSecond(pascalpersecond.PascalsPerSecond).PascalsPerSecond, PascalsPerSecondTolerance); + PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); + AssertEx.EqualTolerance(1, PressureChangeRate.FromAtmospheresPerSecond(pascalpersecond.AtmospheresPerSecond).PascalsPerSecond, AtmospheresPerSecondTolerance); + AssertEx.EqualTolerance(1, PressureChangeRate.FromKilopascalsPerMinute(pascalpersecond.KilopascalsPerMinute).PascalsPerSecond, KilopascalsPerMinuteTolerance); + AssertEx.EqualTolerance(1, PressureChangeRate.FromKilopascalsPerSecond(pascalpersecond.KilopascalsPerSecond).PascalsPerSecond, KilopascalsPerSecondTolerance); + AssertEx.EqualTolerance(1, PressureChangeRate.FromMegapascalsPerMinute(pascalpersecond.MegapascalsPerMinute).PascalsPerSecond, MegapascalsPerMinuteTolerance); + AssertEx.EqualTolerance(1, PressureChangeRate.FromMegapascalsPerSecond(pascalpersecond.MegapascalsPerSecond).PascalsPerSecond, MegapascalsPerSecondTolerance); + AssertEx.EqualTolerance(1, PressureChangeRate.FromPascalsPerMinute(pascalpersecond.PascalsPerMinute).PascalsPerSecond, PascalsPerMinuteTolerance); + AssertEx.EqualTolerance(1, PressureChangeRate.FromPascalsPerSecond(pascalpersecond.PascalsPerSecond).PascalsPerSecond, PascalsPerSecondTolerance); } [Fact] public void ArithmeticOperators() { - PressureChangeRate v = PressureChangeRate.FromPascalsPerSecond(1); + PressureChangeRate v = PressureChangeRate.FromPascalsPerSecond(1); AssertEx.EqualTolerance(-1, -v.PascalsPerSecond, PascalsPerSecondTolerance); - AssertEx.EqualTolerance(2, (PressureChangeRate.FromPascalsPerSecond(3)-v).PascalsPerSecond, PascalsPerSecondTolerance); + AssertEx.EqualTolerance(2, (PressureChangeRate.FromPascalsPerSecond(3)-v).PascalsPerSecond, PascalsPerSecondTolerance); AssertEx.EqualTolerance(2, (v + v).PascalsPerSecond, PascalsPerSecondTolerance); AssertEx.EqualTolerance(10, (v*10).PascalsPerSecond, PascalsPerSecondTolerance); AssertEx.EqualTolerance(10, (10*v).PascalsPerSecond, PascalsPerSecondTolerance); - AssertEx.EqualTolerance(2, (PressureChangeRate.FromPascalsPerSecond(10)/5).PascalsPerSecond, PascalsPerSecondTolerance); - AssertEx.EqualTolerance(2, PressureChangeRate.FromPascalsPerSecond(10)/PressureChangeRate.FromPascalsPerSecond(5), PascalsPerSecondTolerance); + AssertEx.EqualTolerance(2, (PressureChangeRate.FromPascalsPerSecond(10)/5).PascalsPerSecond, PascalsPerSecondTolerance); + AssertEx.EqualTolerance(2, PressureChangeRate.FromPascalsPerSecond(10)/PressureChangeRate.FromPascalsPerSecond(5), PascalsPerSecondTolerance); } [Fact] public void ComparisonOperators() { - PressureChangeRate onePascalPerSecond = PressureChangeRate.FromPascalsPerSecond(1); - PressureChangeRate twoPascalsPerSecond = PressureChangeRate.FromPascalsPerSecond(2); + PressureChangeRate onePascalPerSecond = PressureChangeRate.FromPascalsPerSecond(1); + PressureChangeRate twoPascalsPerSecond = PressureChangeRate.FromPascalsPerSecond(2); Assert.True(onePascalPerSecond < twoPascalsPerSecond); Assert.True(onePascalPerSecond <= twoPascalsPerSecond); @@ -202,31 +202,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); + PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); Assert.Equal(0, pascalpersecond.CompareTo(pascalpersecond)); - Assert.True(pascalpersecond.CompareTo(PressureChangeRate.Zero) > 0); - Assert.True(PressureChangeRate.Zero.CompareTo(pascalpersecond) < 0); + Assert.True(pascalpersecond.CompareTo(PressureChangeRate.Zero) > 0); + Assert.True(PressureChangeRate.Zero.CompareTo(pascalpersecond) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); + PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); Assert.Throws(() => pascalpersecond.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); + PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); Assert.Throws(() => pascalpersecond.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = PressureChangeRate.FromPascalsPerSecond(1); - var b = PressureChangeRate.FromPascalsPerSecond(2); + var a = PressureChangeRate.FromPascalsPerSecond(1); + var b = PressureChangeRate.FromPascalsPerSecond(2); // ReSharper disable EqualExpressionComparison @@ -245,8 +245,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = PressureChangeRate.FromPascalsPerSecond(1); - var b = PressureChangeRate.FromPascalsPerSecond(2); + var a = PressureChangeRate.FromPascalsPerSecond(1); + var b = PressureChangeRate.FromPascalsPerSecond(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -256,29 +256,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = PressureChangeRate.FromPascalsPerSecond(1); - Assert.True(v.Equals(PressureChangeRate.FromPascalsPerSecond(1), PascalsPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(PressureChangeRate.Zero, PascalsPerSecondTolerance, ComparisonType.Relative)); + var v = PressureChangeRate.FromPascalsPerSecond(1); + Assert.True(v.Equals(PressureChangeRate.FromPascalsPerSecond(1), PascalsPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(PressureChangeRate.Zero, PascalsPerSecondTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); + PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); Assert.False(pascalpersecond.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); + PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); Assert.False(pascalpersecond.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(PressureChangeRateUnit.Undefined, PressureChangeRate.Units); + Assert.DoesNotContain(PressureChangeRateUnit.Undefined, PressureChangeRate.Units); } [Fact] @@ -297,7 +297,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(PressureChangeRate.BaseDimensions is null); + Assert.False(PressureChangeRate.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs index 0306563dd9..2b91744a76 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Pressure. + /// Test of Pressure. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class PressureTestsBase @@ -125,26 +125,26 @@ public abstract partial class PressureTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Pressure((double)0.0, PressureUnit.Undefined)); + Assert.Throws(() => new Pressure((double)0.0, PressureUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Pressure(double.PositiveInfinity, PressureUnit.Pascal)); - Assert.Throws(() => new Pressure(double.NegativeInfinity, PressureUnit.Pascal)); + Assert.Throws(() => new Pressure(double.PositiveInfinity, PressureUnit.Pascal)); + Assert.Throws(() => new Pressure(double.NegativeInfinity, PressureUnit.Pascal)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Pressure(double.NaN, PressureUnit.Pascal)); + Assert.Throws(() => new Pressure(double.NaN, PressureUnit.Pascal)); } [Fact] public void PascalToPressureUnits() { - Pressure pascal = Pressure.FromPascals(1); + Pressure pascal = Pressure.FromPascals(1); AssertEx.EqualTolerance(AtmospheresInOnePascal, pascal.Atmospheres, AtmospheresTolerance); AssertEx.EqualTolerance(BarsInOnePascal, pascal.Bars, BarsTolerance); AssertEx.EqualTolerance(CentibarsInOnePascal, pascal.Centibars, CentibarsTolerance); @@ -192,67 +192,67 @@ public void PascalToPressureUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Atmosphere).Atmospheres, AtmospheresTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Bar).Bars, BarsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Centibar).Centibars, CentibarsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Decapascal).Decapascals, DecapascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Decibar).Decibars, DecibarsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.DynePerSquareCentimeter).DynesPerSquareCentimeter, DynesPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.FootOfHead).FeetOfHead, FeetOfHeadTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Gigapascal).Gigapascals, GigapascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Hectopascal).Hectopascals, HectopascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.InchOfMercury).InchesOfMercury, InchesOfMercuryTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.InchOfWaterColumn).InchesOfWaterColumn, InchesOfWaterColumnTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Kilobar).Kilobars, KilobarsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilogramForcePerSquareCentimeter).KilogramsForcePerSquareCentimeter, KilogramsForcePerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilogramForcePerSquareMeter).KilogramsForcePerSquareMeter, KilogramsForcePerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilogramForcePerSquareMillimeter).KilogramsForcePerSquareMillimeter, KilogramsForcePerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilonewtonPerSquareCentimeter).KilonewtonsPerSquareCentimeter, KilonewtonsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilonewtonPerSquareMeter).KilonewtonsPerSquareMeter, KilonewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilonewtonPerSquareMillimeter).KilonewtonsPerSquareMillimeter, KilonewtonsPerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Kilopascal).Kilopascals, KilopascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilopoundForcePerSquareFoot).KilopoundsForcePerSquareFoot, KilopoundsForcePerSquareFootTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilopoundForcePerSquareInch).KilopoundsForcePerSquareInch, KilopoundsForcePerSquareInchTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Megabar).Megabars, MegabarsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.MeganewtonPerSquareMeter).MeganewtonsPerSquareMeter, MeganewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Megapascal).Megapascals, MegapascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.MeterOfHead).MetersOfHead, MetersOfHeadTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Microbar).Microbars, MicrobarsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Micropascal).Micropascals, MicropascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Millibar).Millibars, MillibarsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.MillimeterOfMercury).MillimetersOfMercury, MillimetersOfMercuryTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Millipascal).Millipascals, MillipascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.NewtonPerSquareCentimeter).NewtonsPerSquareCentimeter, NewtonsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.NewtonPerSquareMeter).NewtonsPerSquareMeter, NewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.NewtonPerSquareMillimeter).NewtonsPerSquareMillimeter, NewtonsPerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Pascal).Pascals, PascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.PoundForcePerSquareFoot).PoundsForcePerSquareFoot, PoundsForcePerSquareFootTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.PoundForcePerSquareInch).PoundsForcePerSquareInch, PoundsForcePerSquareInchTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.PoundPerInchSecondSquared).PoundsPerInchSecondSquared, PoundsPerInchSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.TechnicalAtmosphere).TechnicalAtmospheres, TechnicalAtmospheresTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.TonneForcePerSquareCentimeter).TonnesForcePerSquareCentimeter, TonnesForcePerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.TonneForcePerSquareMeter).TonnesForcePerSquareMeter, TonnesForcePerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.TonneForcePerSquareMillimeter).TonnesForcePerSquareMillimeter, TonnesForcePerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Torr).Torrs, TorrsTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Atmosphere).Atmospheres, AtmospheresTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Bar).Bars, BarsTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Centibar).Centibars, CentibarsTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Decapascal).Decapascals, DecapascalsTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Decibar).Decibars, DecibarsTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.DynePerSquareCentimeter).DynesPerSquareCentimeter, DynesPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.FootOfHead).FeetOfHead, FeetOfHeadTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Gigapascal).Gigapascals, GigapascalsTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Hectopascal).Hectopascals, HectopascalsTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.InchOfMercury).InchesOfMercury, InchesOfMercuryTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.InchOfWaterColumn).InchesOfWaterColumn, InchesOfWaterColumnTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Kilobar).Kilobars, KilobarsTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilogramForcePerSquareCentimeter).KilogramsForcePerSquareCentimeter, KilogramsForcePerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilogramForcePerSquareMeter).KilogramsForcePerSquareMeter, KilogramsForcePerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilogramForcePerSquareMillimeter).KilogramsForcePerSquareMillimeter, KilogramsForcePerSquareMillimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilonewtonPerSquareCentimeter).KilonewtonsPerSquareCentimeter, KilonewtonsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilonewtonPerSquareMeter).KilonewtonsPerSquareMeter, KilonewtonsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilonewtonPerSquareMillimeter).KilonewtonsPerSquareMillimeter, KilonewtonsPerSquareMillimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Kilopascal).Kilopascals, KilopascalsTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilopoundForcePerSquareFoot).KilopoundsForcePerSquareFoot, KilopoundsForcePerSquareFootTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilopoundForcePerSquareInch).KilopoundsForcePerSquareInch, KilopoundsForcePerSquareInchTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Megabar).Megabars, MegabarsTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.MeganewtonPerSquareMeter).MeganewtonsPerSquareMeter, MeganewtonsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Megapascal).Megapascals, MegapascalsTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.MeterOfHead).MetersOfHead, MetersOfHeadTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Microbar).Microbars, MicrobarsTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Micropascal).Micropascals, MicropascalsTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Millibar).Millibars, MillibarsTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.MillimeterOfMercury).MillimetersOfMercury, MillimetersOfMercuryTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Millipascal).Millipascals, MillipascalsTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.NewtonPerSquareCentimeter).NewtonsPerSquareCentimeter, NewtonsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.NewtonPerSquareMeter).NewtonsPerSquareMeter, NewtonsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.NewtonPerSquareMillimeter).NewtonsPerSquareMillimeter, NewtonsPerSquareMillimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Pascal).Pascals, PascalsTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.PoundForcePerSquareFoot).PoundsForcePerSquareFoot, PoundsForcePerSquareFootTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.PoundForcePerSquareInch).PoundsForcePerSquareInch, PoundsForcePerSquareInchTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.PoundPerInchSecondSquared).PoundsPerInchSecondSquared, PoundsPerInchSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.TechnicalAtmosphere).TechnicalAtmospheres, TechnicalAtmospheresTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.TonneForcePerSquareCentimeter).TonnesForcePerSquareCentimeter, TonnesForcePerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.TonneForcePerSquareMeter).TonnesForcePerSquareMeter, TonnesForcePerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.TonneForcePerSquareMillimeter).TonnesForcePerSquareMillimeter, TonnesForcePerSquareMillimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Torr).Torrs, TorrsTolerance); } [Fact] public void FromPascals_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Pressure.FromPascals(double.PositiveInfinity)); - Assert.Throws(() => Pressure.FromPascals(double.NegativeInfinity)); + Assert.Throws(() => Pressure.FromPascals(double.PositiveInfinity)); + Assert.Throws(() => Pressure.FromPascals(double.NegativeInfinity)); } [Fact] public void FromPascals_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Pressure.FromPascals(double.NaN)); + Assert.Throws(() => Pressure.FromPascals(double.NaN)); } [Fact] public void As() { - var pascal = Pressure.FromPascals(1); + var pascal = Pressure.FromPascals(1); AssertEx.EqualTolerance(AtmospheresInOnePascal, pascal.As(PressureUnit.Atmosphere), AtmospheresTolerance); AssertEx.EqualTolerance(BarsInOnePascal, pascal.As(PressureUnit.Bar), BarsTolerance); AssertEx.EqualTolerance(CentibarsInOnePascal, pascal.As(PressureUnit.Centibar), CentibarsTolerance); @@ -300,7 +300,7 @@ public void As() [Fact] public void ToUnit() { - var pascal = Pressure.FromPascals(1); + var pascal = Pressure.FromPascals(1); var atmosphereQuantity = pascal.ToUnit(PressureUnit.Atmosphere); AssertEx.EqualTolerance(AtmospheresInOnePascal, (double)atmosphereQuantity.Value, AtmospheresTolerance); @@ -474,69 +474,69 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Pressure pascal = Pressure.FromPascals(1); - AssertEx.EqualTolerance(1, Pressure.FromAtmospheres(pascal.Atmospheres).Pascals, AtmospheresTolerance); - AssertEx.EqualTolerance(1, Pressure.FromBars(pascal.Bars).Pascals, BarsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromCentibars(pascal.Centibars).Pascals, CentibarsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromDecapascals(pascal.Decapascals).Pascals, DecapascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromDecibars(pascal.Decibars).Pascals, DecibarsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromDynesPerSquareCentimeter(pascal.DynesPerSquareCentimeter).Pascals, DynesPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromFeetOfHead(pascal.FeetOfHead).Pascals, FeetOfHeadTolerance); - AssertEx.EqualTolerance(1, Pressure.FromGigapascals(pascal.Gigapascals).Pascals, GigapascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromHectopascals(pascal.Hectopascals).Pascals, HectopascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromInchesOfMercury(pascal.InchesOfMercury).Pascals, InchesOfMercuryTolerance); - AssertEx.EqualTolerance(1, Pressure.FromInchesOfWaterColumn(pascal.InchesOfWaterColumn).Pascals, InchesOfWaterColumnTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilobars(pascal.Kilobars).Pascals, KilobarsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilogramsForcePerSquareCentimeter(pascal.KilogramsForcePerSquareCentimeter).Pascals, KilogramsForcePerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilogramsForcePerSquareMeter(pascal.KilogramsForcePerSquareMeter).Pascals, KilogramsForcePerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilogramsForcePerSquareMillimeter(pascal.KilogramsForcePerSquareMillimeter).Pascals, KilogramsForcePerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilonewtonsPerSquareCentimeter(pascal.KilonewtonsPerSquareCentimeter).Pascals, KilonewtonsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilonewtonsPerSquareMeter(pascal.KilonewtonsPerSquareMeter).Pascals, KilonewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilonewtonsPerSquareMillimeter(pascal.KilonewtonsPerSquareMillimeter).Pascals, KilonewtonsPerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilopascals(pascal.Kilopascals).Pascals, KilopascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilopoundsForcePerSquareFoot(pascal.KilopoundsForcePerSquareFoot).Pascals, KilopoundsForcePerSquareFootTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilopoundsForcePerSquareInch(pascal.KilopoundsForcePerSquareInch).Pascals, KilopoundsForcePerSquareInchTolerance); - AssertEx.EqualTolerance(1, Pressure.FromMegabars(pascal.Megabars).Pascals, MegabarsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromMeganewtonsPerSquareMeter(pascal.MeganewtonsPerSquareMeter).Pascals, MeganewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromMegapascals(pascal.Megapascals).Pascals, MegapascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromMetersOfHead(pascal.MetersOfHead).Pascals, MetersOfHeadTolerance); - AssertEx.EqualTolerance(1, Pressure.FromMicrobars(pascal.Microbars).Pascals, MicrobarsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromMicropascals(pascal.Micropascals).Pascals, MicropascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromMillibars(pascal.Millibars).Pascals, MillibarsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromMillimetersOfMercury(pascal.MillimetersOfMercury).Pascals, MillimetersOfMercuryTolerance); - AssertEx.EqualTolerance(1, Pressure.FromMillipascals(pascal.Millipascals).Pascals, MillipascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromNewtonsPerSquareCentimeter(pascal.NewtonsPerSquareCentimeter).Pascals, NewtonsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromNewtonsPerSquareMeter(pascal.NewtonsPerSquareMeter).Pascals, NewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromNewtonsPerSquareMillimeter(pascal.NewtonsPerSquareMillimeter).Pascals, NewtonsPerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromPascals(pascal.Pascals).Pascals, PascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromPoundsForcePerSquareFoot(pascal.PoundsForcePerSquareFoot).Pascals, PoundsForcePerSquareFootTolerance); - AssertEx.EqualTolerance(1, Pressure.FromPoundsForcePerSquareInch(pascal.PoundsForcePerSquareInch).Pascals, PoundsForcePerSquareInchTolerance); - AssertEx.EqualTolerance(1, Pressure.FromPoundsPerInchSecondSquared(pascal.PoundsPerInchSecondSquared).Pascals, PoundsPerInchSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Pressure.FromTechnicalAtmospheres(pascal.TechnicalAtmospheres).Pascals, TechnicalAtmospheresTolerance); - AssertEx.EqualTolerance(1, Pressure.FromTonnesForcePerSquareCentimeter(pascal.TonnesForcePerSquareCentimeter).Pascals, TonnesForcePerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromTonnesForcePerSquareMeter(pascal.TonnesForcePerSquareMeter).Pascals, TonnesForcePerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromTonnesForcePerSquareMillimeter(pascal.TonnesForcePerSquareMillimeter).Pascals, TonnesForcePerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromTorrs(pascal.Torrs).Pascals, TorrsTolerance); + Pressure pascal = Pressure.FromPascals(1); + AssertEx.EqualTolerance(1, Pressure.FromAtmospheres(pascal.Atmospheres).Pascals, AtmospheresTolerance); + AssertEx.EqualTolerance(1, Pressure.FromBars(pascal.Bars).Pascals, BarsTolerance); + AssertEx.EqualTolerance(1, Pressure.FromCentibars(pascal.Centibars).Pascals, CentibarsTolerance); + AssertEx.EqualTolerance(1, Pressure.FromDecapascals(pascal.Decapascals).Pascals, DecapascalsTolerance); + AssertEx.EqualTolerance(1, Pressure.FromDecibars(pascal.Decibars).Pascals, DecibarsTolerance); + AssertEx.EqualTolerance(1, Pressure.FromDynesPerSquareCentimeter(pascal.DynesPerSquareCentimeter).Pascals, DynesPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.FromFeetOfHead(pascal.FeetOfHead).Pascals, FeetOfHeadTolerance); + AssertEx.EqualTolerance(1, Pressure.FromGigapascals(pascal.Gigapascals).Pascals, GigapascalsTolerance); + AssertEx.EqualTolerance(1, Pressure.FromHectopascals(pascal.Hectopascals).Pascals, HectopascalsTolerance); + AssertEx.EqualTolerance(1, Pressure.FromInchesOfMercury(pascal.InchesOfMercury).Pascals, InchesOfMercuryTolerance); + AssertEx.EqualTolerance(1, Pressure.FromInchesOfWaterColumn(pascal.InchesOfWaterColumn).Pascals, InchesOfWaterColumnTolerance); + AssertEx.EqualTolerance(1, Pressure.FromKilobars(pascal.Kilobars).Pascals, KilobarsTolerance); + AssertEx.EqualTolerance(1, Pressure.FromKilogramsForcePerSquareCentimeter(pascal.KilogramsForcePerSquareCentimeter).Pascals, KilogramsForcePerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.FromKilogramsForcePerSquareMeter(pascal.KilogramsForcePerSquareMeter).Pascals, KilogramsForcePerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Pressure.FromKilogramsForcePerSquareMillimeter(pascal.KilogramsForcePerSquareMillimeter).Pascals, KilogramsForcePerSquareMillimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.FromKilonewtonsPerSquareCentimeter(pascal.KilonewtonsPerSquareCentimeter).Pascals, KilonewtonsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.FromKilonewtonsPerSquareMeter(pascal.KilonewtonsPerSquareMeter).Pascals, KilonewtonsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Pressure.FromKilonewtonsPerSquareMillimeter(pascal.KilonewtonsPerSquareMillimeter).Pascals, KilonewtonsPerSquareMillimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.FromKilopascals(pascal.Kilopascals).Pascals, KilopascalsTolerance); + AssertEx.EqualTolerance(1, Pressure.FromKilopoundsForcePerSquareFoot(pascal.KilopoundsForcePerSquareFoot).Pascals, KilopoundsForcePerSquareFootTolerance); + AssertEx.EqualTolerance(1, Pressure.FromKilopoundsForcePerSquareInch(pascal.KilopoundsForcePerSquareInch).Pascals, KilopoundsForcePerSquareInchTolerance); + AssertEx.EqualTolerance(1, Pressure.FromMegabars(pascal.Megabars).Pascals, MegabarsTolerance); + AssertEx.EqualTolerance(1, Pressure.FromMeganewtonsPerSquareMeter(pascal.MeganewtonsPerSquareMeter).Pascals, MeganewtonsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Pressure.FromMegapascals(pascal.Megapascals).Pascals, MegapascalsTolerance); + AssertEx.EqualTolerance(1, Pressure.FromMetersOfHead(pascal.MetersOfHead).Pascals, MetersOfHeadTolerance); + AssertEx.EqualTolerance(1, Pressure.FromMicrobars(pascal.Microbars).Pascals, MicrobarsTolerance); + AssertEx.EqualTolerance(1, Pressure.FromMicropascals(pascal.Micropascals).Pascals, MicropascalsTolerance); + AssertEx.EqualTolerance(1, Pressure.FromMillibars(pascal.Millibars).Pascals, MillibarsTolerance); + AssertEx.EqualTolerance(1, Pressure.FromMillimetersOfMercury(pascal.MillimetersOfMercury).Pascals, MillimetersOfMercuryTolerance); + AssertEx.EqualTolerance(1, Pressure.FromMillipascals(pascal.Millipascals).Pascals, MillipascalsTolerance); + AssertEx.EqualTolerance(1, Pressure.FromNewtonsPerSquareCentimeter(pascal.NewtonsPerSquareCentimeter).Pascals, NewtonsPerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.FromNewtonsPerSquareMeter(pascal.NewtonsPerSquareMeter).Pascals, NewtonsPerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Pressure.FromNewtonsPerSquareMillimeter(pascal.NewtonsPerSquareMillimeter).Pascals, NewtonsPerSquareMillimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.FromPascals(pascal.Pascals).Pascals, PascalsTolerance); + AssertEx.EqualTolerance(1, Pressure.FromPoundsForcePerSquareFoot(pascal.PoundsForcePerSquareFoot).Pascals, PoundsForcePerSquareFootTolerance); + AssertEx.EqualTolerance(1, Pressure.FromPoundsForcePerSquareInch(pascal.PoundsForcePerSquareInch).Pascals, PoundsForcePerSquareInchTolerance); + AssertEx.EqualTolerance(1, Pressure.FromPoundsPerInchSecondSquared(pascal.PoundsPerInchSecondSquared).Pascals, PoundsPerInchSecondSquaredTolerance); + AssertEx.EqualTolerance(1, Pressure.FromTechnicalAtmospheres(pascal.TechnicalAtmospheres).Pascals, TechnicalAtmospheresTolerance); + AssertEx.EqualTolerance(1, Pressure.FromTonnesForcePerSquareCentimeter(pascal.TonnesForcePerSquareCentimeter).Pascals, TonnesForcePerSquareCentimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.FromTonnesForcePerSquareMeter(pascal.TonnesForcePerSquareMeter).Pascals, TonnesForcePerSquareMeterTolerance); + AssertEx.EqualTolerance(1, Pressure.FromTonnesForcePerSquareMillimeter(pascal.TonnesForcePerSquareMillimeter).Pascals, TonnesForcePerSquareMillimeterTolerance); + AssertEx.EqualTolerance(1, Pressure.FromTorrs(pascal.Torrs).Pascals, TorrsTolerance); } [Fact] public void ArithmeticOperators() { - Pressure v = Pressure.FromPascals(1); + Pressure v = Pressure.FromPascals(1); AssertEx.EqualTolerance(-1, -v.Pascals, PascalsTolerance); - AssertEx.EqualTolerance(2, (Pressure.FromPascals(3)-v).Pascals, PascalsTolerance); + AssertEx.EqualTolerance(2, (Pressure.FromPascals(3)-v).Pascals, PascalsTolerance); AssertEx.EqualTolerance(2, (v + v).Pascals, PascalsTolerance); AssertEx.EqualTolerance(10, (v*10).Pascals, PascalsTolerance); AssertEx.EqualTolerance(10, (10*v).Pascals, PascalsTolerance); - AssertEx.EqualTolerance(2, (Pressure.FromPascals(10)/5).Pascals, PascalsTolerance); - AssertEx.EqualTolerance(2, Pressure.FromPascals(10)/Pressure.FromPascals(5), PascalsTolerance); + AssertEx.EqualTolerance(2, (Pressure.FromPascals(10)/5).Pascals, PascalsTolerance); + AssertEx.EqualTolerance(2, Pressure.FromPascals(10)/Pressure.FromPascals(5), PascalsTolerance); } [Fact] public void ComparisonOperators() { - Pressure onePascal = Pressure.FromPascals(1); - Pressure twoPascals = Pressure.FromPascals(2); + Pressure onePascal = Pressure.FromPascals(1); + Pressure twoPascals = Pressure.FromPascals(2); Assert.True(onePascal < twoPascals); Assert.True(onePascal <= twoPascals); @@ -552,31 +552,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Pressure pascal = Pressure.FromPascals(1); + Pressure pascal = Pressure.FromPascals(1); Assert.Equal(0, pascal.CompareTo(pascal)); - Assert.True(pascal.CompareTo(Pressure.Zero) > 0); - Assert.True(Pressure.Zero.CompareTo(pascal) < 0); + Assert.True(pascal.CompareTo(Pressure.Zero) > 0); + Assert.True(Pressure.Zero.CompareTo(pascal) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Pressure pascal = Pressure.FromPascals(1); + Pressure pascal = Pressure.FromPascals(1); Assert.Throws(() => pascal.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Pressure pascal = Pressure.FromPascals(1); + Pressure pascal = Pressure.FromPascals(1); Assert.Throws(() => pascal.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Pressure.FromPascals(1); - var b = Pressure.FromPascals(2); + var a = Pressure.FromPascals(1); + var b = Pressure.FromPascals(2); // ReSharper disable EqualExpressionComparison @@ -595,8 +595,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Pressure.FromPascals(1); - var b = Pressure.FromPascals(2); + var a = Pressure.FromPascals(1); + var b = Pressure.FromPascals(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -606,29 +606,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Pressure.FromPascals(1); - Assert.True(v.Equals(Pressure.FromPascals(1), PascalsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Pressure.Zero, PascalsTolerance, ComparisonType.Relative)); + var v = Pressure.FromPascals(1); + Assert.True(v.Equals(Pressure.FromPascals(1), PascalsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Pressure.Zero, PascalsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Pressure pascal = Pressure.FromPascals(1); + Pressure pascal = Pressure.FromPascals(1); Assert.False(pascal.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Pressure pascal = Pressure.FromPascals(1); + Pressure pascal = Pressure.FromPascals(1); Assert.False(pascal.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(PressureUnit.Undefined, Pressure.Units); + Assert.DoesNotContain(PressureUnit.Undefined, Pressure.Units); } [Fact] @@ -647,7 +647,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Pressure.BaseDimensions is null); + Assert.False(Pressure.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/RatioChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RatioChangeRateTestsBase.g.cs index 2ec7b37a46..55f6a0d5be 100644 --- a/UnitsNet.Tests/GeneratedCode/RatioChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RatioChangeRateTestsBase.g.cs @@ -45,26 +45,26 @@ public abstract partial class RatioChangeRateTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new RatioChangeRate((double)0.0, RatioChangeRateUnit.Undefined)); + Assert.Throws(() => new RatioChangeRate((double)0.0, RatioChangeRateUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new RatioChangeRate(double.PositiveInfinity, RatioChangeRateUnit.DecimalFractionPerSecond)); - Assert.Throws(() => new RatioChangeRate(double.NegativeInfinity, RatioChangeRateUnit.DecimalFractionPerSecond)); + Assert.Throws(() => new RatioChangeRate(double.PositiveInfinity, RatioChangeRateUnit.DecimalFractionPerSecond)); + Assert.Throws(() => new RatioChangeRate(double.NegativeInfinity, RatioChangeRateUnit.DecimalFractionPerSecond)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new RatioChangeRate(double.NaN, RatioChangeRateUnit.DecimalFractionPerSecond)); + Assert.Throws(() => new RatioChangeRate(double.NaN, RatioChangeRateUnit.DecimalFractionPerSecond)); } [Fact] public void DecimalFractionPerSecondToRatioChangeRateUnits() { - RatioChangeRate decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); + RatioChangeRate decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); AssertEx.EqualTolerance(DecimalFractionsPerSecondInOneDecimalFractionPerSecond, decimalfractionpersecond.DecimalFractionsPerSecond, DecimalFractionsPerSecondTolerance); AssertEx.EqualTolerance(PercentsPerSecondInOneDecimalFractionPerSecond, decimalfractionpersecond.PercentsPerSecond, PercentsPerSecondTolerance); } @@ -72,27 +72,27 @@ public void DecimalFractionPerSecondToRatioChangeRateUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, RatioChangeRate.From(1, RatioChangeRateUnit.DecimalFractionPerSecond).DecimalFractionsPerSecond, DecimalFractionsPerSecondTolerance); - AssertEx.EqualTolerance(1, RatioChangeRate.From(1, RatioChangeRateUnit.PercentPerSecond).PercentsPerSecond, PercentsPerSecondTolerance); + AssertEx.EqualTolerance(1, RatioChangeRate.From(1, RatioChangeRateUnit.DecimalFractionPerSecond).DecimalFractionsPerSecond, DecimalFractionsPerSecondTolerance); + AssertEx.EqualTolerance(1, RatioChangeRate.From(1, RatioChangeRateUnit.PercentPerSecond).PercentsPerSecond, PercentsPerSecondTolerance); } [Fact] public void FromDecimalFractionsPerSecond_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => RatioChangeRate.FromDecimalFractionsPerSecond(double.PositiveInfinity)); - Assert.Throws(() => RatioChangeRate.FromDecimalFractionsPerSecond(double.NegativeInfinity)); + Assert.Throws(() => RatioChangeRate.FromDecimalFractionsPerSecond(double.PositiveInfinity)); + Assert.Throws(() => RatioChangeRate.FromDecimalFractionsPerSecond(double.NegativeInfinity)); } [Fact] public void FromDecimalFractionsPerSecond_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => RatioChangeRate.FromDecimalFractionsPerSecond(double.NaN)); + Assert.Throws(() => RatioChangeRate.FromDecimalFractionsPerSecond(double.NaN)); } [Fact] public void As() { - var decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); + var decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); AssertEx.EqualTolerance(DecimalFractionsPerSecondInOneDecimalFractionPerSecond, decimalfractionpersecond.As(RatioChangeRateUnit.DecimalFractionPerSecond), DecimalFractionsPerSecondTolerance); AssertEx.EqualTolerance(PercentsPerSecondInOneDecimalFractionPerSecond, decimalfractionpersecond.As(RatioChangeRateUnit.PercentPerSecond), PercentsPerSecondTolerance); } @@ -100,7 +100,7 @@ public void As() [Fact] public void ToUnit() { - var decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); + var decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); var decimalfractionpersecondQuantity = decimalfractionpersecond.ToUnit(RatioChangeRateUnit.DecimalFractionPerSecond); AssertEx.EqualTolerance(DecimalFractionsPerSecondInOneDecimalFractionPerSecond, (double)decimalfractionpersecondQuantity.Value, DecimalFractionsPerSecondTolerance); @@ -114,29 +114,29 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - RatioChangeRate decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); - AssertEx.EqualTolerance(1, RatioChangeRate.FromDecimalFractionsPerSecond(decimalfractionpersecond.DecimalFractionsPerSecond).DecimalFractionsPerSecond, DecimalFractionsPerSecondTolerance); - AssertEx.EqualTolerance(1, RatioChangeRate.FromPercentsPerSecond(decimalfractionpersecond.PercentsPerSecond).DecimalFractionsPerSecond, PercentsPerSecondTolerance); + RatioChangeRate decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); + AssertEx.EqualTolerance(1, RatioChangeRate.FromDecimalFractionsPerSecond(decimalfractionpersecond.DecimalFractionsPerSecond).DecimalFractionsPerSecond, DecimalFractionsPerSecondTolerance); + AssertEx.EqualTolerance(1, RatioChangeRate.FromPercentsPerSecond(decimalfractionpersecond.PercentsPerSecond).DecimalFractionsPerSecond, PercentsPerSecondTolerance); } [Fact] public void ArithmeticOperators() { - RatioChangeRate v = RatioChangeRate.FromDecimalFractionsPerSecond(1); + RatioChangeRate v = RatioChangeRate.FromDecimalFractionsPerSecond(1); AssertEx.EqualTolerance(-1, -v.DecimalFractionsPerSecond, DecimalFractionsPerSecondTolerance); - AssertEx.EqualTolerance(2, (RatioChangeRate.FromDecimalFractionsPerSecond(3)-v).DecimalFractionsPerSecond, DecimalFractionsPerSecondTolerance); + AssertEx.EqualTolerance(2, (RatioChangeRate.FromDecimalFractionsPerSecond(3)-v).DecimalFractionsPerSecond, DecimalFractionsPerSecondTolerance); AssertEx.EqualTolerance(2, (v + v).DecimalFractionsPerSecond, DecimalFractionsPerSecondTolerance); AssertEx.EqualTolerance(10, (v*10).DecimalFractionsPerSecond, DecimalFractionsPerSecondTolerance); AssertEx.EqualTolerance(10, (10*v).DecimalFractionsPerSecond, DecimalFractionsPerSecondTolerance); - AssertEx.EqualTolerance(2, (RatioChangeRate.FromDecimalFractionsPerSecond(10)/5).DecimalFractionsPerSecond, DecimalFractionsPerSecondTolerance); - AssertEx.EqualTolerance(2, RatioChangeRate.FromDecimalFractionsPerSecond(10)/RatioChangeRate.FromDecimalFractionsPerSecond(5), DecimalFractionsPerSecondTolerance); + AssertEx.EqualTolerance(2, (RatioChangeRate.FromDecimalFractionsPerSecond(10)/5).DecimalFractionsPerSecond, DecimalFractionsPerSecondTolerance); + AssertEx.EqualTolerance(2, RatioChangeRate.FromDecimalFractionsPerSecond(10)/RatioChangeRate.FromDecimalFractionsPerSecond(5), DecimalFractionsPerSecondTolerance); } [Fact] public void ComparisonOperators() { - RatioChangeRate oneDecimalFractionPerSecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); - RatioChangeRate twoDecimalFractionsPerSecond = RatioChangeRate.FromDecimalFractionsPerSecond(2); + RatioChangeRate oneDecimalFractionPerSecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); + RatioChangeRate twoDecimalFractionsPerSecond = RatioChangeRate.FromDecimalFractionsPerSecond(2); Assert.True(oneDecimalFractionPerSecond < twoDecimalFractionsPerSecond); Assert.True(oneDecimalFractionPerSecond <= twoDecimalFractionsPerSecond); @@ -152,31 +152,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - RatioChangeRate decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); + RatioChangeRate decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); Assert.Equal(0, decimalfractionpersecond.CompareTo(decimalfractionpersecond)); - Assert.True(decimalfractionpersecond.CompareTo(RatioChangeRate.Zero) > 0); - Assert.True(RatioChangeRate.Zero.CompareTo(decimalfractionpersecond) < 0); + Assert.True(decimalfractionpersecond.CompareTo(RatioChangeRate.Zero) > 0); + Assert.True(RatioChangeRate.Zero.CompareTo(decimalfractionpersecond) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - RatioChangeRate decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); + RatioChangeRate decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); Assert.Throws(() => decimalfractionpersecond.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - RatioChangeRate decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); + RatioChangeRate decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); Assert.Throws(() => decimalfractionpersecond.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = RatioChangeRate.FromDecimalFractionsPerSecond(1); - var b = RatioChangeRate.FromDecimalFractionsPerSecond(2); + var a = RatioChangeRate.FromDecimalFractionsPerSecond(1); + var b = RatioChangeRate.FromDecimalFractionsPerSecond(2); // ReSharper disable EqualExpressionComparison @@ -195,8 +195,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = RatioChangeRate.FromDecimalFractionsPerSecond(1); - var b = RatioChangeRate.FromDecimalFractionsPerSecond(2); + var a = RatioChangeRate.FromDecimalFractionsPerSecond(1); + var b = RatioChangeRate.FromDecimalFractionsPerSecond(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -206,29 +206,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = RatioChangeRate.FromDecimalFractionsPerSecond(1); - Assert.True(v.Equals(RatioChangeRate.FromDecimalFractionsPerSecond(1), DecimalFractionsPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(RatioChangeRate.Zero, DecimalFractionsPerSecondTolerance, ComparisonType.Relative)); + var v = RatioChangeRate.FromDecimalFractionsPerSecond(1); + Assert.True(v.Equals(RatioChangeRate.FromDecimalFractionsPerSecond(1), DecimalFractionsPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(RatioChangeRate.Zero, DecimalFractionsPerSecondTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - RatioChangeRate decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); + RatioChangeRate decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); Assert.False(decimalfractionpersecond.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - RatioChangeRate decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); + RatioChangeRate decimalfractionpersecond = RatioChangeRate.FromDecimalFractionsPerSecond(1); Assert.False(decimalfractionpersecond.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(RatioChangeRateUnit.Undefined, RatioChangeRate.Units); + Assert.DoesNotContain(RatioChangeRateUnit.Undefined, RatioChangeRate.Units); } [Fact] @@ -247,7 +247,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(RatioChangeRate.BaseDimensions is null); + Assert.False(RatioChangeRate.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs index 8cb3a02c23..edeabcd516 100644 --- a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs @@ -53,26 +53,26 @@ public abstract partial class RatioTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Ratio((double)0.0, RatioUnit.Undefined)); + Assert.Throws(() => new Ratio((double)0.0, RatioUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Ratio(double.PositiveInfinity, RatioUnit.DecimalFraction)); - Assert.Throws(() => new Ratio(double.NegativeInfinity, RatioUnit.DecimalFraction)); + Assert.Throws(() => new Ratio(double.PositiveInfinity, RatioUnit.DecimalFraction)); + Assert.Throws(() => new Ratio(double.NegativeInfinity, RatioUnit.DecimalFraction)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Ratio(double.NaN, RatioUnit.DecimalFraction)); + Assert.Throws(() => new Ratio(double.NaN, RatioUnit.DecimalFraction)); } [Fact] public void DecimalFractionToRatioUnits() { - Ratio decimalfraction = Ratio.FromDecimalFractions(1); + Ratio decimalfraction = Ratio.FromDecimalFractions(1); AssertEx.EqualTolerance(DecimalFractionsInOneDecimalFraction, decimalfraction.DecimalFractions, DecimalFractionsTolerance); AssertEx.EqualTolerance(PartsPerBillionInOneDecimalFraction, decimalfraction.PartsPerBillion, PartsPerBillionTolerance); AssertEx.EqualTolerance(PartsPerMillionInOneDecimalFraction, decimalfraction.PartsPerMillion, PartsPerMillionTolerance); @@ -84,31 +84,31 @@ public void DecimalFractionToRatioUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.DecimalFraction).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.PartPerBillion).PartsPerBillion, PartsPerBillionTolerance); - AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.PartPerMillion).PartsPerMillion, PartsPerMillionTolerance); - AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.PartPerThousand).PartsPerThousand, PartsPerThousandTolerance); - AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.PartPerTrillion).PartsPerTrillion, PartsPerTrillionTolerance); - AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.Percent).Percent, PercentTolerance); + AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.DecimalFraction).DecimalFractions, DecimalFractionsTolerance); + AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.PartPerBillion).PartsPerBillion, PartsPerBillionTolerance); + AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.PartPerMillion).PartsPerMillion, PartsPerMillionTolerance); + AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.PartPerThousand).PartsPerThousand, PartsPerThousandTolerance); + AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.PartPerTrillion).PartsPerTrillion, PartsPerTrillionTolerance); + AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.Percent).Percent, PercentTolerance); } [Fact] public void FromDecimalFractions_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Ratio.FromDecimalFractions(double.PositiveInfinity)); - Assert.Throws(() => Ratio.FromDecimalFractions(double.NegativeInfinity)); + Assert.Throws(() => Ratio.FromDecimalFractions(double.PositiveInfinity)); + Assert.Throws(() => Ratio.FromDecimalFractions(double.NegativeInfinity)); } [Fact] public void FromDecimalFractions_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Ratio.FromDecimalFractions(double.NaN)); + Assert.Throws(() => Ratio.FromDecimalFractions(double.NaN)); } [Fact] public void As() { - var decimalfraction = Ratio.FromDecimalFractions(1); + var decimalfraction = Ratio.FromDecimalFractions(1); AssertEx.EqualTolerance(DecimalFractionsInOneDecimalFraction, decimalfraction.As(RatioUnit.DecimalFraction), DecimalFractionsTolerance); AssertEx.EqualTolerance(PartsPerBillionInOneDecimalFraction, decimalfraction.As(RatioUnit.PartPerBillion), PartsPerBillionTolerance); AssertEx.EqualTolerance(PartsPerMillionInOneDecimalFraction, decimalfraction.As(RatioUnit.PartPerMillion), PartsPerMillionTolerance); @@ -120,7 +120,7 @@ public void As() [Fact] public void ToUnit() { - var decimalfraction = Ratio.FromDecimalFractions(1); + var decimalfraction = Ratio.FromDecimalFractions(1); var decimalfractionQuantity = decimalfraction.ToUnit(RatioUnit.DecimalFraction); AssertEx.EqualTolerance(DecimalFractionsInOneDecimalFraction, (double)decimalfractionQuantity.Value, DecimalFractionsTolerance); @@ -150,33 +150,33 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Ratio decimalfraction = Ratio.FromDecimalFractions(1); - AssertEx.EqualTolerance(1, Ratio.FromDecimalFractions(decimalfraction.DecimalFractions).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(1, Ratio.FromPartsPerBillion(decimalfraction.PartsPerBillion).DecimalFractions, PartsPerBillionTolerance); - AssertEx.EqualTolerance(1, Ratio.FromPartsPerMillion(decimalfraction.PartsPerMillion).DecimalFractions, PartsPerMillionTolerance); - AssertEx.EqualTolerance(1, Ratio.FromPartsPerThousand(decimalfraction.PartsPerThousand).DecimalFractions, PartsPerThousandTolerance); - AssertEx.EqualTolerance(1, Ratio.FromPartsPerTrillion(decimalfraction.PartsPerTrillion).DecimalFractions, PartsPerTrillionTolerance); - AssertEx.EqualTolerance(1, Ratio.FromPercent(decimalfraction.Percent).DecimalFractions, PercentTolerance); + Ratio decimalfraction = Ratio.FromDecimalFractions(1); + AssertEx.EqualTolerance(1, Ratio.FromDecimalFractions(decimalfraction.DecimalFractions).DecimalFractions, DecimalFractionsTolerance); + AssertEx.EqualTolerance(1, Ratio.FromPartsPerBillion(decimalfraction.PartsPerBillion).DecimalFractions, PartsPerBillionTolerance); + AssertEx.EqualTolerance(1, Ratio.FromPartsPerMillion(decimalfraction.PartsPerMillion).DecimalFractions, PartsPerMillionTolerance); + AssertEx.EqualTolerance(1, Ratio.FromPartsPerThousand(decimalfraction.PartsPerThousand).DecimalFractions, PartsPerThousandTolerance); + AssertEx.EqualTolerance(1, Ratio.FromPartsPerTrillion(decimalfraction.PartsPerTrillion).DecimalFractions, PartsPerTrillionTolerance); + AssertEx.EqualTolerance(1, Ratio.FromPercent(decimalfraction.Percent).DecimalFractions, PercentTolerance); } [Fact] public void ArithmeticOperators() { - Ratio v = Ratio.FromDecimalFractions(1); + Ratio v = Ratio.FromDecimalFractions(1); AssertEx.EqualTolerance(-1, -v.DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(2, (Ratio.FromDecimalFractions(3)-v).DecimalFractions, DecimalFractionsTolerance); + AssertEx.EqualTolerance(2, (Ratio.FromDecimalFractions(3)-v).DecimalFractions, DecimalFractionsTolerance); AssertEx.EqualTolerance(2, (v + v).DecimalFractions, DecimalFractionsTolerance); AssertEx.EqualTolerance(10, (v*10).DecimalFractions, DecimalFractionsTolerance); AssertEx.EqualTolerance(10, (10*v).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(2, (Ratio.FromDecimalFractions(10)/5).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(2, Ratio.FromDecimalFractions(10)/Ratio.FromDecimalFractions(5), DecimalFractionsTolerance); + AssertEx.EqualTolerance(2, (Ratio.FromDecimalFractions(10)/5).DecimalFractions, DecimalFractionsTolerance); + AssertEx.EqualTolerance(2, Ratio.FromDecimalFractions(10)/Ratio.FromDecimalFractions(5), DecimalFractionsTolerance); } [Fact] public void ComparisonOperators() { - Ratio oneDecimalFraction = Ratio.FromDecimalFractions(1); - Ratio twoDecimalFractions = Ratio.FromDecimalFractions(2); + Ratio oneDecimalFraction = Ratio.FromDecimalFractions(1); + Ratio twoDecimalFractions = Ratio.FromDecimalFractions(2); Assert.True(oneDecimalFraction < twoDecimalFractions); Assert.True(oneDecimalFraction <= twoDecimalFractions); @@ -192,31 +192,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Ratio decimalfraction = Ratio.FromDecimalFractions(1); + Ratio decimalfraction = Ratio.FromDecimalFractions(1); Assert.Equal(0, decimalfraction.CompareTo(decimalfraction)); - Assert.True(decimalfraction.CompareTo(Ratio.Zero) > 0); - Assert.True(Ratio.Zero.CompareTo(decimalfraction) < 0); + Assert.True(decimalfraction.CompareTo(Ratio.Zero) > 0); + Assert.True(Ratio.Zero.CompareTo(decimalfraction) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Ratio decimalfraction = Ratio.FromDecimalFractions(1); + Ratio decimalfraction = Ratio.FromDecimalFractions(1); Assert.Throws(() => decimalfraction.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Ratio decimalfraction = Ratio.FromDecimalFractions(1); + Ratio decimalfraction = Ratio.FromDecimalFractions(1); Assert.Throws(() => decimalfraction.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Ratio.FromDecimalFractions(1); - var b = Ratio.FromDecimalFractions(2); + var a = Ratio.FromDecimalFractions(1); + var b = Ratio.FromDecimalFractions(2); // ReSharper disable EqualExpressionComparison @@ -235,8 +235,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Ratio.FromDecimalFractions(1); - var b = Ratio.FromDecimalFractions(2); + var a = Ratio.FromDecimalFractions(1); + var b = Ratio.FromDecimalFractions(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -246,29 +246,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Ratio.FromDecimalFractions(1); - Assert.True(v.Equals(Ratio.FromDecimalFractions(1), DecimalFractionsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Ratio.Zero, DecimalFractionsTolerance, ComparisonType.Relative)); + var v = Ratio.FromDecimalFractions(1); + Assert.True(v.Equals(Ratio.FromDecimalFractions(1), DecimalFractionsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Ratio.Zero, DecimalFractionsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Ratio decimalfraction = Ratio.FromDecimalFractions(1); + Ratio decimalfraction = Ratio.FromDecimalFractions(1); Assert.False(decimalfraction.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Ratio decimalfraction = Ratio.FromDecimalFractions(1); + Ratio decimalfraction = Ratio.FromDecimalFractions(1); Assert.False(decimalfraction.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(RatioUnit.Undefined, Ratio.Units); + Assert.DoesNotContain(RatioUnit.Undefined, Ratio.Units); } [Fact] @@ -287,7 +287,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Ratio.BaseDimensions is null); + Assert.False(Ratio.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs index c0ea41c393..e67942ef95 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of ReactiveEnergy. + /// Test of ReactiveEnergy. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class ReactiveEnergyTestsBase @@ -47,26 +47,26 @@ public abstract partial class ReactiveEnergyTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ReactiveEnergy((double)0.0, ReactiveEnergyUnit.Undefined)); + Assert.Throws(() => new ReactiveEnergy((double)0.0, ReactiveEnergyUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ReactiveEnergy(double.PositiveInfinity, ReactiveEnergyUnit.VoltampereReactiveHour)); - Assert.Throws(() => new ReactiveEnergy(double.NegativeInfinity, ReactiveEnergyUnit.VoltampereReactiveHour)); + Assert.Throws(() => new ReactiveEnergy(double.PositiveInfinity, ReactiveEnergyUnit.VoltampereReactiveHour)); + Assert.Throws(() => new ReactiveEnergy(double.NegativeInfinity, ReactiveEnergyUnit.VoltampereReactiveHour)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ReactiveEnergy(double.NaN, ReactiveEnergyUnit.VoltampereReactiveHour)); + Assert.Throws(() => new ReactiveEnergy(double.NaN, ReactiveEnergyUnit.VoltampereReactiveHour)); } [Fact] public void VoltampereReactiveHourToReactiveEnergyUnits() { - ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); + ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); AssertEx.EqualTolerance(KilovoltampereReactiveHoursInOneVoltampereReactiveHour, voltamperereactivehour.KilovoltampereReactiveHours, KilovoltampereReactiveHoursTolerance); AssertEx.EqualTolerance(MegavoltampereReactiveHoursInOneVoltampereReactiveHour, voltamperereactivehour.MegavoltampereReactiveHours, MegavoltampereReactiveHoursTolerance); AssertEx.EqualTolerance(VoltampereReactiveHoursInOneVoltampereReactiveHour, voltamperereactivehour.VoltampereReactiveHours, VoltampereReactiveHoursTolerance); @@ -75,28 +75,28 @@ public void VoltampereReactiveHourToReactiveEnergyUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ReactiveEnergy.From(1, ReactiveEnergyUnit.KilovoltampereReactiveHour).KilovoltampereReactiveHours, KilovoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(1, ReactiveEnergy.From(1, ReactiveEnergyUnit.MegavoltampereReactiveHour).MegavoltampereReactiveHours, MegavoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(1, ReactiveEnergy.From(1, ReactiveEnergyUnit.VoltampereReactiveHour).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); + AssertEx.EqualTolerance(1, ReactiveEnergy.From(1, ReactiveEnergyUnit.KilovoltampereReactiveHour).KilovoltampereReactiveHours, KilovoltampereReactiveHoursTolerance); + AssertEx.EqualTolerance(1, ReactiveEnergy.From(1, ReactiveEnergyUnit.MegavoltampereReactiveHour).MegavoltampereReactiveHours, MegavoltampereReactiveHoursTolerance); + AssertEx.EqualTolerance(1, ReactiveEnergy.From(1, ReactiveEnergyUnit.VoltampereReactiveHour).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); } [Fact] public void FromVoltampereReactiveHours_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.PositiveInfinity)); - Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.NegativeInfinity)); + Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.PositiveInfinity)); + Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.NegativeInfinity)); } [Fact] public void FromVoltampereReactiveHours_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.NaN)); + Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.NaN)); } [Fact] public void As() { - var voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); + var voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); AssertEx.EqualTolerance(KilovoltampereReactiveHoursInOneVoltampereReactiveHour, voltamperereactivehour.As(ReactiveEnergyUnit.KilovoltampereReactiveHour), KilovoltampereReactiveHoursTolerance); AssertEx.EqualTolerance(MegavoltampereReactiveHoursInOneVoltampereReactiveHour, voltamperereactivehour.As(ReactiveEnergyUnit.MegavoltampereReactiveHour), MegavoltampereReactiveHoursTolerance); AssertEx.EqualTolerance(VoltampereReactiveHoursInOneVoltampereReactiveHour, voltamperereactivehour.As(ReactiveEnergyUnit.VoltampereReactiveHour), VoltampereReactiveHoursTolerance); @@ -105,7 +105,7 @@ public void As() [Fact] public void ToUnit() { - var voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); + var voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); var kilovoltamperereactivehourQuantity = voltamperereactivehour.ToUnit(ReactiveEnergyUnit.KilovoltampereReactiveHour); AssertEx.EqualTolerance(KilovoltampereReactiveHoursInOneVoltampereReactiveHour, (double)kilovoltamperereactivehourQuantity.Value, KilovoltampereReactiveHoursTolerance); @@ -123,30 +123,30 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); - AssertEx.EqualTolerance(1, ReactiveEnergy.FromKilovoltampereReactiveHours(voltamperereactivehour.KilovoltampereReactiveHours).VoltampereReactiveHours, KilovoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(1, ReactiveEnergy.FromMegavoltampereReactiveHours(voltamperereactivehour.MegavoltampereReactiveHours).VoltampereReactiveHours, MegavoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(1, ReactiveEnergy.FromVoltampereReactiveHours(voltamperereactivehour.VoltampereReactiveHours).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); + ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); + AssertEx.EqualTolerance(1, ReactiveEnergy.FromKilovoltampereReactiveHours(voltamperereactivehour.KilovoltampereReactiveHours).VoltampereReactiveHours, KilovoltampereReactiveHoursTolerance); + AssertEx.EqualTolerance(1, ReactiveEnergy.FromMegavoltampereReactiveHours(voltamperereactivehour.MegavoltampereReactiveHours).VoltampereReactiveHours, MegavoltampereReactiveHoursTolerance); + AssertEx.EqualTolerance(1, ReactiveEnergy.FromVoltampereReactiveHours(voltamperereactivehour.VoltampereReactiveHours).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); } [Fact] public void ArithmeticOperators() { - ReactiveEnergy v = ReactiveEnergy.FromVoltampereReactiveHours(1); + ReactiveEnergy v = ReactiveEnergy.FromVoltampereReactiveHours(1); AssertEx.EqualTolerance(-1, -v.VoltampereReactiveHours, VoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(2, (ReactiveEnergy.FromVoltampereReactiveHours(3)-v).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); + AssertEx.EqualTolerance(2, (ReactiveEnergy.FromVoltampereReactiveHours(3)-v).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); AssertEx.EqualTolerance(2, (v + v).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); AssertEx.EqualTolerance(10, (v*10).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); AssertEx.EqualTolerance(10, (10*v).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(2, (ReactiveEnergy.FromVoltampereReactiveHours(10)/5).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(2, ReactiveEnergy.FromVoltampereReactiveHours(10)/ReactiveEnergy.FromVoltampereReactiveHours(5), VoltampereReactiveHoursTolerance); + AssertEx.EqualTolerance(2, (ReactiveEnergy.FromVoltampereReactiveHours(10)/5).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); + AssertEx.EqualTolerance(2, ReactiveEnergy.FromVoltampereReactiveHours(10)/ReactiveEnergy.FromVoltampereReactiveHours(5), VoltampereReactiveHoursTolerance); } [Fact] public void ComparisonOperators() { - ReactiveEnergy oneVoltampereReactiveHour = ReactiveEnergy.FromVoltampereReactiveHours(1); - ReactiveEnergy twoVoltampereReactiveHours = ReactiveEnergy.FromVoltampereReactiveHours(2); + ReactiveEnergy oneVoltampereReactiveHour = ReactiveEnergy.FromVoltampereReactiveHours(1); + ReactiveEnergy twoVoltampereReactiveHours = ReactiveEnergy.FromVoltampereReactiveHours(2); Assert.True(oneVoltampereReactiveHour < twoVoltampereReactiveHours); Assert.True(oneVoltampereReactiveHour <= twoVoltampereReactiveHours); @@ -162,31 +162,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); + ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); Assert.Equal(0, voltamperereactivehour.CompareTo(voltamperereactivehour)); - Assert.True(voltamperereactivehour.CompareTo(ReactiveEnergy.Zero) > 0); - Assert.True(ReactiveEnergy.Zero.CompareTo(voltamperereactivehour) < 0); + Assert.True(voltamperereactivehour.CompareTo(ReactiveEnergy.Zero) > 0); + Assert.True(ReactiveEnergy.Zero.CompareTo(voltamperereactivehour) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); + ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); Assert.Throws(() => voltamperereactivehour.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); + ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); Assert.Throws(() => voltamperereactivehour.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ReactiveEnergy.FromVoltampereReactiveHours(1); - var b = ReactiveEnergy.FromVoltampereReactiveHours(2); + var a = ReactiveEnergy.FromVoltampereReactiveHours(1); + var b = ReactiveEnergy.FromVoltampereReactiveHours(2); // ReSharper disable EqualExpressionComparison @@ -205,8 +205,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ReactiveEnergy.FromVoltampereReactiveHours(1); - var b = ReactiveEnergy.FromVoltampereReactiveHours(2); + var a = ReactiveEnergy.FromVoltampereReactiveHours(1); + var b = ReactiveEnergy.FromVoltampereReactiveHours(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -216,29 +216,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ReactiveEnergy.FromVoltampereReactiveHours(1); - Assert.True(v.Equals(ReactiveEnergy.FromVoltampereReactiveHours(1), VoltampereReactiveHoursTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ReactiveEnergy.Zero, VoltampereReactiveHoursTolerance, ComparisonType.Relative)); + var v = ReactiveEnergy.FromVoltampereReactiveHours(1); + Assert.True(v.Equals(ReactiveEnergy.FromVoltampereReactiveHours(1), VoltampereReactiveHoursTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ReactiveEnergy.Zero, VoltampereReactiveHoursTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); + ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); Assert.False(voltamperereactivehour.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); + ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); Assert.False(voltamperereactivehour.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ReactiveEnergyUnit.Undefined, ReactiveEnergy.Units); + Assert.DoesNotContain(ReactiveEnergyUnit.Undefined, ReactiveEnergy.Units); } [Fact] @@ -257,7 +257,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ReactiveEnergy.BaseDimensions is null); + Assert.False(ReactiveEnergy.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs index 7566d1bc32..4661c45dc3 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs @@ -49,26 +49,26 @@ public abstract partial class ReactivePowerTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ReactivePower((double)0.0, ReactivePowerUnit.Undefined)); + Assert.Throws(() => new ReactivePower((double)0.0, ReactivePowerUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ReactivePower(double.PositiveInfinity, ReactivePowerUnit.VoltampereReactive)); - Assert.Throws(() => new ReactivePower(double.NegativeInfinity, ReactivePowerUnit.VoltampereReactive)); + Assert.Throws(() => new ReactivePower(double.PositiveInfinity, ReactivePowerUnit.VoltampereReactive)); + Assert.Throws(() => new ReactivePower(double.NegativeInfinity, ReactivePowerUnit.VoltampereReactive)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ReactivePower(double.NaN, ReactivePowerUnit.VoltampereReactive)); + Assert.Throws(() => new ReactivePower(double.NaN, ReactivePowerUnit.VoltampereReactive)); } [Fact] public void VoltampereReactiveToReactivePowerUnits() { - ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); + ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); AssertEx.EqualTolerance(GigavoltamperesReactiveInOneVoltampereReactive, voltamperereactive.GigavoltamperesReactive, GigavoltamperesReactiveTolerance); AssertEx.EqualTolerance(KilovoltamperesReactiveInOneVoltampereReactive, voltamperereactive.KilovoltamperesReactive, KilovoltamperesReactiveTolerance); AssertEx.EqualTolerance(MegavoltamperesReactiveInOneVoltampereReactive, voltamperereactive.MegavoltamperesReactive, MegavoltamperesReactiveTolerance); @@ -78,29 +78,29 @@ public void VoltampereReactiveToReactivePowerUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ReactivePower.From(1, ReactivePowerUnit.GigavoltampereReactive).GigavoltamperesReactive, GigavoltamperesReactiveTolerance); - AssertEx.EqualTolerance(1, ReactivePower.From(1, ReactivePowerUnit.KilovoltampereReactive).KilovoltamperesReactive, KilovoltamperesReactiveTolerance); - AssertEx.EqualTolerance(1, ReactivePower.From(1, ReactivePowerUnit.MegavoltampereReactive).MegavoltamperesReactive, MegavoltamperesReactiveTolerance); - AssertEx.EqualTolerance(1, ReactivePower.From(1, ReactivePowerUnit.VoltampereReactive).VoltamperesReactive, VoltamperesReactiveTolerance); + AssertEx.EqualTolerance(1, ReactivePower.From(1, ReactivePowerUnit.GigavoltampereReactive).GigavoltamperesReactive, GigavoltamperesReactiveTolerance); + AssertEx.EqualTolerance(1, ReactivePower.From(1, ReactivePowerUnit.KilovoltampereReactive).KilovoltamperesReactive, KilovoltamperesReactiveTolerance); + AssertEx.EqualTolerance(1, ReactivePower.From(1, ReactivePowerUnit.MegavoltampereReactive).MegavoltamperesReactive, MegavoltamperesReactiveTolerance); + AssertEx.EqualTolerance(1, ReactivePower.From(1, ReactivePowerUnit.VoltampereReactive).VoltamperesReactive, VoltamperesReactiveTolerance); } [Fact] public void FromVoltamperesReactive_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.PositiveInfinity)); - Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.NegativeInfinity)); + Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.PositiveInfinity)); + Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.NegativeInfinity)); } [Fact] public void FromVoltamperesReactive_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.NaN)); + Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.NaN)); } [Fact] public void As() { - var voltamperereactive = ReactivePower.FromVoltamperesReactive(1); + var voltamperereactive = ReactivePower.FromVoltamperesReactive(1); AssertEx.EqualTolerance(GigavoltamperesReactiveInOneVoltampereReactive, voltamperereactive.As(ReactivePowerUnit.GigavoltampereReactive), GigavoltamperesReactiveTolerance); AssertEx.EqualTolerance(KilovoltamperesReactiveInOneVoltampereReactive, voltamperereactive.As(ReactivePowerUnit.KilovoltampereReactive), KilovoltamperesReactiveTolerance); AssertEx.EqualTolerance(MegavoltamperesReactiveInOneVoltampereReactive, voltamperereactive.As(ReactivePowerUnit.MegavoltampereReactive), MegavoltamperesReactiveTolerance); @@ -110,7 +110,7 @@ public void As() [Fact] public void ToUnit() { - var voltamperereactive = ReactivePower.FromVoltamperesReactive(1); + var voltamperereactive = ReactivePower.FromVoltamperesReactive(1); var gigavoltamperereactiveQuantity = voltamperereactive.ToUnit(ReactivePowerUnit.GigavoltampereReactive); AssertEx.EqualTolerance(GigavoltamperesReactiveInOneVoltampereReactive, (double)gigavoltamperereactiveQuantity.Value, GigavoltamperesReactiveTolerance); @@ -132,31 +132,31 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); - AssertEx.EqualTolerance(1, ReactivePower.FromGigavoltamperesReactive(voltamperereactive.GigavoltamperesReactive).VoltamperesReactive, GigavoltamperesReactiveTolerance); - AssertEx.EqualTolerance(1, ReactivePower.FromKilovoltamperesReactive(voltamperereactive.KilovoltamperesReactive).VoltamperesReactive, KilovoltamperesReactiveTolerance); - AssertEx.EqualTolerance(1, ReactivePower.FromMegavoltamperesReactive(voltamperereactive.MegavoltamperesReactive).VoltamperesReactive, MegavoltamperesReactiveTolerance); - AssertEx.EqualTolerance(1, ReactivePower.FromVoltamperesReactive(voltamperereactive.VoltamperesReactive).VoltamperesReactive, VoltamperesReactiveTolerance); + ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); + AssertEx.EqualTolerance(1, ReactivePower.FromGigavoltamperesReactive(voltamperereactive.GigavoltamperesReactive).VoltamperesReactive, GigavoltamperesReactiveTolerance); + AssertEx.EqualTolerance(1, ReactivePower.FromKilovoltamperesReactive(voltamperereactive.KilovoltamperesReactive).VoltamperesReactive, KilovoltamperesReactiveTolerance); + AssertEx.EqualTolerance(1, ReactivePower.FromMegavoltamperesReactive(voltamperereactive.MegavoltamperesReactive).VoltamperesReactive, MegavoltamperesReactiveTolerance); + AssertEx.EqualTolerance(1, ReactivePower.FromVoltamperesReactive(voltamperereactive.VoltamperesReactive).VoltamperesReactive, VoltamperesReactiveTolerance); } [Fact] public void ArithmeticOperators() { - ReactivePower v = ReactivePower.FromVoltamperesReactive(1); + ReactivePower v = ReactivePower.FromVoltamperesReactive(1); AssertEx.EqualTolerance(-1, -v.VoltamperesReactive, VoltamperesReactiveTolerance); - AssertEx.EqualTolerance(2, (ReactivePower.FromVoltamperesReactive(3)-v).VoltamperesReactive, VoltamperesReactiveTolerance); + AssertEx.EqualTolerance(2, (ReactivePower.FromVoltamperesReactive(3)-v).VoltamperesReactive, VoltamperesReactiveTolerance); AssertEx.EqualTolerance(2, (v + v).VoltamperesReactive, VoltamperesReactiveTolerance); AssertEx.EqualTolerance(10, (v*10).VoltamperesReactive, VoltamperesReactiveTolerance); AssertEx.EqualTolerance(10, (10*v).VoltamperesReactive, VoltamperesReactiveTolerance); - AssertEx.EqualTolerance(2, (ReactivePower.FromVoltamperesReactive(10)/5).VoltamperesReactive, VoltamperesReactiveTolerance); - AssertEx.EqualTolerance(2, ReactivePower.FromVoltamperesReactive(10)/ReactivePower.FromVoltamperesReactive(5), VoltamperesReactiveTolerance); + AssertEx.EqualTolerance(2, (ReactivePower.FromVoltamperesReactive(10)/5).VoltamperesReactive, VoltamperesReactiveTolerance); + AssertEx.EqualTolerance(2, ReactivePower.FromVoltamperesReactive(10)/ReactivePower.FromVoltamperesReactive(5), VoltamperesReactiveTolerance); } [Fact] public void ComparisonOperators() { - ReactivePower oneVoltampereReactive = ReactivePower.FromVoltamperesReactive(1); - ReactivePower twoVoltamperesReactive = ReactivePower.FromVoltamperesReactive(2); + ReactivePower oneVoltampereReactive = ReactivePower.FromVoltamperesReactive(1); + ReactivePower twoVoltamperesReactive = ReactivePower.FromVoltamperesReactive(2); Assert.True(oneVoltampereReactive < twoVoltamperesReactive); Assert.True(oneVoltampereReactive <= twoVoltamperesReactive); @@ -172,31 +172,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); + ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); Assert.Equal(0, voltamperereactive.CompareTo(voltamperereactive)); - Assert.True(voltamperereactive.CompareTo(ReactivePower.Zero) > 0); - Assert.True(ReactivePower.Zero.CompareTo(voltamperereactive) < 0); + Assert.True(voltamperereactive.CompareTo(ReactivePower.Zero) > 0); + Assert.True(ReactivePower.Zero.CompareTo(voltamperereactive) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); + ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); Assert.Throws(() => voltamperereactive.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); + ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); Assert.Throws(() => voltamperereactive.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ReactivePower.FromVoltamperesReactive(1); - var b = ReactivePower.FromVoltamperesReactive(2); + var a = ReactivePower.FromVoltamperesReactive(1); + var b = ReactivePower.FromVoltamperesReactive(2); // ReSharper disable EqualExpressionComparison @@ -215,8 +215,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ReactivePower.FromVoltamperesReactive(1); - var b = ReactivePower.FromVoltamperesReactive(2); + var a = ReactivePower.FromVoltamperesReactive(1); + var b = ReactivePower.FromVoltamperesReactive(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -226,29 +226,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ReactivePower.FromVoltamperesReactive(1); - Assert.True(v.Equals(ReactivePower.FromVoltamperesReactive(1), VoltamperesReactiveTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ReactivePower.Zero, VoltamperesReactiveTolerance, ComparisonType.Relative)); + var v = ReactivePower.FromVoltamperesReactive(1); + Assert.True(v.Equals(ReactivePower.FromVoltamperesReactive(1), VoltamperesReactiveTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ReactivePower.Zero, VoltamperesReactiveTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); + ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); Assert.False(voltamperereactive.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); + ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); Assert.False(voltamperereactive.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ReactivePowerUnit.Undefined, ReactivePower.Units); + Assert.DoesNotContain(ReactivePowerUnit.Undefined, ReactivePower.Units); } [Fact] @@ -267,7 +267,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ReactivePower.BaseDimensions is null); + Assert.False(ReactivePower.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs index b54fd439e2..04bda57195 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs @@ -49,26 +49,26 @@ public abstract partial class RotationalAccelerationTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new RotationalAcceleration((double)0.0, RotationalAccelerationUnit.Undefined)); + Assert.Throws(() => new RotationalAcceleration((double)0.0, RotationalAccelerationUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new RotationalAcceleration(double.PositiveInfinity, RotationalAccelerationUnit.RadianPerSecondSquared)); - Assert.Throws(() => new RotationalAcceleration(double.NegativeInfinity, RotationalAccelerationUnit.RadianPerSecondSquared)); + Assert.Throws(() => new RotationalAcceleration(double.PositiveInfinity, RotationalAccelerationUnit.RadianPerSecondSquared)); + Assert.Throws(() => new RotationalAcceleration(double.NegativeInfinity, RotationalAccelerationUnit.RadianPerSecondSquared)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new RotationalAcceleration(double.NaN, RotationalAccelerationUnit.RadianPerSecondSquared)); + Assert.Throws(() => new RotationalAcceleration(double.NaN, RotationalAccelerationUnit.RadianPerSecondSquared)); } [Fact] public void RadianPerSecondSquaredToRotationalAccelerationUnits() { - RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); + RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); AssertEx.EqualTolerance(DegreesPerSecondSquaredInOneRadianPerSecondSquared, radianpersecondsquared.DegreesPerSecondSquared, DegreesPerSecondSquaredTolerance); AssertEx.EqualTolerance(RadiansPerSecondSquaredInOneRadianPerSecondSquared, radianpersecondsquared.RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); AssertEx.EqualTolerance(RevolutionsPerMinutePerSecondInOneRadianPerSecondSquared, radianpersecondsquared.RevolutionsPerMinutePerSecond, RevolutionsPerMinutePerSecondTolerance); @@ -78,29 +78,29 @@ public void RadianPerSecondSquaredToRotationalAccelerationUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, RotationalAcceleration.From(1, RotationalAccelerationUnit.DegreePerSecondSquared).DegreesPerSecondSquared, DegreesPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, RotationalAcceleration.From(1, RotationalAccelerationUnit.RadianPerSecondSquared).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, RotationalAcceleration.From(1, RotationalAccelerationUnit.RevolutionPerMinutePerSecond).RevolutionsPerMinutePerSecond, RevolutionsPerMinutePerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalAcceleration.From(1, RotationalAccelerationUnit.RevolutionPerSecondSquared).RevolutionsPerSecondSquared, RevolutionsPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, RotationalAcceleration.From(1, RotationalAccelerationUnit.DegreePerSecondSquared).DegreesPerSecondSquared, DegreesPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, RotationalAcceleration.From(1, RotationalAccelerationUnit.RadianPerSecondSquared).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, RotationalAcceleration.From(1, RotationalAccelerationUnit.RevolutionPerMinutePerSecond).RevolutionsPerMinutePerSecond, RevolutionsPerMinutePerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalAcceleration.From(1, RotationalAccelerationUnit.RevolutionPerSecondSquared).RevolutionsPerSecondSquared, RevolutionsPerSecondSquaredTolerance); } [Fact] public void FromRadiansPerSecondSquared_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.PositiveInfinity)); - Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.NegativeInfinity)); + Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.PositiveInfinity)); + Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.NegativeInfinity)); } [Fact] public void FromRadiansPerSecondSquared_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.NaN)); + Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.NaN)); } [Fact] public void As() { - var radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); + var radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); AssertEx.EqualTolerance(DegreesPerSecondSquaredInOneRadianPerSecondSquared, radianpersecondsquared.As(RotationalAccelerationUnit.DegreePerSecondSquared), DegreesPerSecondSquaredTolerance); AssertEx.EqualTolerance(RadiansPerSecondSquaredInOneRadianPerSecondSquared, radianpersecondsquared.As(RotationalAccelerationUnit.RadianPerSecondSquared), RadiansPerSecondSquaredTolerance); AssertEx.EqualTolerance(RevolutionsPerMinutePerSecondInOneRadianPerSecondSquared, radianpersecondsquared.As(RotationalAccelerationUnit.RevolutionPerMinutePerSecond), RevolutionsPerMinutePerSecondTolerance); @@ -110,7 +110,7 @@ public void As() [Fact] public void ToUnit() { - var radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); + var radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); var degreepersecondsquaredQuantity = radianpersecondsquared.ToUnit(RotationalAccelerationUnit.DegreePerSecondSquared); AssertEx.EqualTolerance(DegreesPerSecondSquaredInOneRadianPerSecondSquared, (double)degreepersecondsquaredQuantity.Value, DegreesPerSecondSquaredTolerance); @@ -132,31 +132,31 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); - AssertEx.EqualTolerance(1, RotationalAcceleration.FromDegreesPerSecondSquared(radianpersecondsquared.DegreesPerSecondSquared).RadiansPerSecondSquared, DegreesPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, RotationalAcceleration.FromRadiansPerSecondSquared(radianpersecondsquared.RadiansPerSecondSquared).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, RotationalAcceleration.FromRevolutionsPerMinutePerSecond(radianpersecondsquared.RevolutionsPerMinutePerSecond).RadiansPerSecondSquared, RevolutionsPerMinutePerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalAcceleration.FromRevolutionsPerSecondSquared(radianpersecondsquared.RevolutionsPerSecondSquared).RadiansPerSecondSquared, RevolutionsPerSecondSquaredTolerance); + RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); + AssertEx.EqualTolerance(1, RotationalAcceleration.FromDegreesPerSecondSquared(radianpersecondsquared.DegreesPerSecondSquared).RadiansPerSecondSquared, DegreesPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, RotationalAcceleration.FromRadiansPerSecondSquared(radianpersecondsquared.RadiansPerSecondSquared).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); + AssertEx.EqualTolerance(1, RotationalAcceleration.FromRevolutionsPerMinutePerSecond(radianpersecondsquared.RevolutionsPerMinutePerSecond).RadiansPerSecondSquared, RevolutionsPerMinutePerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalAcceleration.FromRevolutionsPerSecondSquared(radianpersecondsquared.RevolutionsPerSecondSquared).RadiansPerSecondSquared, RevolutionsPerSecondSquaredTolerance); } [Fact] public void ArithmeticOperators() { - RotationalAcceleration v = RotationalAcceleration.FromRadiansPerSecondSquared(1); + RotationalAcceleration v = RotationalAcceleration.FromRadiansPerSecondSquared(1); AssertEx.EqualTolerance(-1, -v.RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); - AssertEx.EqualTolerance(2, (RotationalAcceleration.FromRadiansPerSecondSquared(3)-v).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); + AssertEx.EqualTolerance(2, (RotationalAcceleration.FromRadiansPerSecondSquared(3)-v).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); AssertEx.EqualTolerance(2, (v + v).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); AssertEx.EqualTolerance(10, (v*10).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); AssertEx.EqualTolerance(10, (10*v).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); - AssertEx.EqualTolerance(2, (RotationalAcceleration.FromRadiansPerSecondSquared(10)/5).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); - AssertEx.EqualTolerance(2, RotationalAcceleration.FromRadiansPerSecondSquared(10)/RotationalAcceleration.FromRadiansPerSecondSquared(5), RadiansPerSecondSquaredTolerance); + AssertEx.EqualTolerance(2, (RotationalAcceleration.FromRadiansPerSecondSquared(10)/5).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); + AssertEx.EqualTolerance(2, RotationalAcceleration.FromRadiansPerSecondSquared(10)/RotationalAcceleration.FromRadiansPerSecondSquared(5), RadiansPerSecondSquaredTolerance); } [Fact] public void ComparisonOperators() { - RotationalAcceleration oneRadianPerSecondSquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); - RotationalAcceleration twoRadiansPerSecondSquared = RotationalAcceleration.FromRadiansPerSecondSquared(2); + RotationalAcceleration oneRadianPerSecondSquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); + RotationalAcceleration twoRadiansPerSecondSquared = RotationalAcceleration.FromRadiansPerSecondSquared(2); Assert.True(oneRadianPerSecondSquared < twoRadiansPerSecondSquared); Assert.True(oneRadianPerSecondSquared <= twoRadiansPerSecondSquared); @@ -172,31 +172,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); + RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); Assert.Equal(0, radianpersecondsquared.CompareTo(radianpersecondsquared)); - Assert.True(radianpersecondsquared.CompareTo(RotationalAcceleration.Zero) > 0); - Assert.True(RotationalAcceleration.Zero.CompareTo(radianpersecondsquared) < 0); + Assert.True(radianpersecondsquared.CompareTo(RotationalAcceleration.Zero) > 0); + Assert.True(RotationalAcceleration.Zero.CompareTo(radianpersecondsquared) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); + RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); Assert.Throws(() => radianpersecondsquared.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); + RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); Assert.Throws(() => radianpersecondsquared.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = RotationalAcceleration.FromRadiansPerSecondSquared(1); - var b = RotationalAcceleration.FromRadiansPerSecondSquared(2); + var a = RotationalAcceleration.FromRadiansPerSecondSquared(1); + var b = RotationalAcceleration.FromRadiansPerSecondSquared(2); // ReSharper disable EqualExpressionComparison @@ -215,8 +215,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = RotationalAcceleration.FromRadiansPerSecondSquared(1); - var b = RotationalAcceleration.FromRadiansPerSecondSquared(2); + var a = RotationalAcceleration.FromRadiansPerSecondSquared(1); + var b = RotationalAcceleration.FromRadiansPerSecondSquared(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -226,29 +226,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = RotationalAcceleration.FromRadiansPerSecondSquared(1); - Assert.True(v.Equals(RotationalAcceleration.FromRadiansPerSecondSquared(1), RadiansPerSecondSquaredTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(RotationalAcceleration.Zero, RadiansPerSecondSquaredTolerance, ComparisonType.Relative)); + var v = RotationalAcceleration.FromRadiansPerSecondSquared(1); + Assert.True(v.Equals(RotationalAcceleration.FromRadiansPerSecondSquared(1), RadiansPerSecondSquaredTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(RotationalAcceleration.Zero, RadiansPerSecondSquaredTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); + RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); Assert.False(radianpersecondsquared.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); + RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); Assert.False(radianpersecondsquared.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(RotationalAccelerationUnit.Undefined, RotationalAcceleration.Units); + Assert.DoesNotContain(RotationalAccelerationUnit.Undefined, RotationalAcceleration.Units); } [Fact] @@ -267,7 +267,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(RotationalAcceleration.BaseDimensions is null); + Assert.False(RotationalAcceleration.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs index b4ddc61cab..b47fd8dbb8 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs @@ -67,26 +67,26 @@ public abstract partial class RotationalSpeedTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new RotationalSpeed((double)0.0, RotationalSpeedUnit.Undefined)); + Assert.Throws(() => new RotationalSpeed((double)0.0, RotationalSpeedUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new RotationalSpeed(double.PositiveInfinity, RotationalSpeedUnit.RadianPerSecond)); - Assert.Throws(() => new RotationalSpeed(double.NegativeInfinity, RotationalSpeedUnit.RadianPerSecond)); + Assert.Throws(() => new RotationalSpeed(double.PositiveInfinity, RotationalSpeedUnit.RadianPerSecond)); + Assert.Throws(() => new RotationalSpeed(double.NegativeInfinity, RotationalSpeedUnit.RadianPerSecond)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new RotationalSpeed(double.NaN, RotationalSpeedUnit.RadianPerSecond)); + Assert.Throws(() => new RotationalSpeed(double.NaN, RotationalSpeedUnit.RadianPerSecond)); } [Fact] public void RadianPerSecondToRotationalSpeedUnits() { - RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); + RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); AssertEx.EqualTolerance(CentiradiansPerSecondInOneRadianPerSecond, radianpersecond.CentiradiansPerSecond, CentiradiansPerSecondTolerance); AssertEx.EqualTolerance(DeciradiansPerSecondInOneRadianPerSecond, radianpersecond.DeciradiansPerSecond, DeciradiansPerSecondTolerance); AssertEx.EqualTolerance(DegreesPerMinuteInOneRadianPerSecond, radianpersecond.DegreesPerMinute, DegreesPerMinuteTolerance); @@ -105,38 +105,38 @@ public void RadianPerSecondToRotationalSpeedUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.CentiradianPerSecond).CentiradiansPerSecond, CentiradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.DeciradianPerSecond).DeciradiansPerSecond, DeciradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.DegreePerMinute).DegreesPerMinute, DegreesPerMinuteTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.DegreePerSecond).DegreesPerSecond, DegreesPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.MicrodegreePerSecond).MicrodegreesPerSecond, MicrodegreesPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.MicroradianPerSecond).MicroradiansPerSecond, MicroradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.MillidegreePerSecond).MillidegreesPerSecond, MillidegreesPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.MilliradianPerSecond).MilliradiansPerSecond, MilliradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.NanodegreePerSecond).NanodegreesPerSecond, NanodegreesPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.NanoradianPerSecond).NanoradiansPerSecond, NanoradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.RadianPerSecond).RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.RevolutionPerMinute).RevolutionsPerMinute, RevolutionsPerMinuteTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.RevolutionPerSecond).RevolutionsPerSecond, RevolutionsPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.CentiradianPerSecond).CentiradiansPerSecond, CentiradiansPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.DeciradianPerSecond).DeciradiansPerSecond, DeciradiansPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.DegreePerMinute).DegreesPerMinute, DegreesPerMinuteTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.DegreePerSecond).DegreesPerSecond, DegreesPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.MicrodegreePerSecond).MicrodegreesPerSecond, MicrodegreesPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.MicroradianPerSecond).MicroradiansPerSecond, MicroradiansPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.MillidegreePerSecond).MillidegreesPerSecond, MillidegreesPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.MilliradianPerSecond).MilliradiansPerSecond, MilliradiansPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.NanodegreePerSecond).NanodegreesPerSecond, NanodegreesPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.NanoradianPerSecond).NanoradiansPerSecond, NanoradiansPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.RadianPerSecond).RadiansPerSecond, RadiansPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.RevolutionPerMinute).RevolutionsPerMinute, RevolutionsPerMinuteTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.RevolutionPerSecond).RevolutionsPerSecond, RevolutionsPerSecondTolerance); } [Fact] public void FromRadiansPerSecond_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.PositiveInfinity)); - Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.NegativeInfinity)); + Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.PositiveInfinity)); + Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.NegativeInfinity)); } [Fact] public void FromRadiansPerSecond_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.NaN)); + Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.NaN)); } [Fact] public void As() { - var radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); + var radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); AssertEx.EqualTolerance(CentiradiansPerSecondInOneRadianPerSecond, radianpersecond.As(RotationalSpeedUnit.CentiradianPerSecond), CentiradiansPerSecondTolerance); AssertEx.EqualTolerance(DeciradiansPerSecondInOneRadianPerSecond, radianpersecond.As(RotationalSpeedUnit.DeciradianPerSecond), DeciradiansPerSecondTolerance); AssertEx.EqualTolerance(DegreesPerMinuteInOneRadianPerSecond, radianpersecond.As(RotationalSpeedUnit.DegreePerMinute), DegreesPerMinuteTolerance); @@ -155,7 +155,7 @@ public void As() [Fact] public void ToUnit() { - var radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); + var radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); var centiradianpersecondQuantity = radianpersecond.ToUnit(RotationalSpeedUnit.CentiradianPerSecond); AssertEx.EqualTolerance(CentiradiansPerSecondInOneRadianPerSecond, (double)centiradianpersecondQuantity.Value, CentiradiansPerSecondTolerance); @@ -213,40 +213,40 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); - AssertEx.EqualTolerance(1, RotationalSpeed.FromCentiradiansPerSecond(radianpersecond.CentiradiansPerSecond).RadiansPerSecond, CentiradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromDeciradiansPerSecond(radianpersecond.DeciradiansPerSecond).RadiansPerSecond, DeciradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromDegreesPerMinute(radianpersecond.DegreesPerMinute).RadiansPerSecond, DegreesPerMinuteTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromDegreesPerSecond(radianpersecond.DegreesPerSecond).RadiansPerSecond, DegreesPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromMicrodegreesPerSecond(radianpersecond.MicrodegreesPerSecond).RadiansPerSecond, MicrodegreesPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromMicroradiansPerSecond(radianpersecond.MicroradiansPerSecond).RadiansPerSecond, MicroradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromMillidegreesPerSecond(radianpersecond.MillidegreesPerSecond).RadiansPerSecond, MillidegreesPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromMilliradiansPerSecond(radianpersecond.MilliradiansPerSecond).RadiansPerSecond, MilliradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromNanodegreesPerSecond(radianpersecond.NanodegreesPerSecond).RadiansPerSecond, NanodegreesPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromNanoradiansPerSecond(radianpersecond.NanoradiansPerSecond).RadiansPerSecond, NanoradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromRadiansPerSecond(radianpersecond.RadiansPerSecond).RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromRevolutionsPerMinute(radianpersecond.RevolutionsPerMinute).RadiansPerSecond, RevolutionsPerMinuteTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromRevolutionsPerSecond(radianpersecond.RevolutionsPerSecond).RadiansPerSecond, RevolutionsPerSecondTolerance); + RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); + AssertEx.EqualTolerance(1, RotationalSpeed.FromCentiradiansPerSecond(radianpersecond.CentiradiansPerSecond).RadiansPerSecond, CentiradiansPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.FromDeciradiansPerSecond(radianpersecond.DeciradiansPerSecond).RadiansPerSecond, DeciradiansPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.FromDegreesPerMinute(radianpersecond.DegreesPerMinute).RadiansPerSecond, DegreesPerMinuteTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.FromDegreesPerSecond(radianpersecond.DegreesPerSecond).RadiansPerSecond, DegreesPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.FromMicrodegreesPerSecond(radianpersecond.MicrodegreesPerSecond).RadiansPerSecond, MicrodegreesPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.FromMicroradiansPerSecond(radianpersecond.MicroradiansPerSecond).RadiansPerSecond, MicroradiansPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.FromMillidegreesPerSecond(radianpersecond.MillidegreesPerSecond).RadiansPerSecond, MillidegreesPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.FromMilliradiansPerSecond(radianpersecond.MilliradiansPerSecond).RadiansPerSecond, MilliradiansPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.FromNanodegreesPerSecond(radianpersecond.NanodegreesPerSecond).RadiansPerSecond, NanodegreesPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.FromNanoradiansPerSecond(radianpersecond.NanoradiansPerSecond).RadiansPerSecond, NanoradiansPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.FromRadiansPerSecond(radianpersecond.RadiansPerSecond).RadiansPerSecond, RadiansPerSecondTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.FromRevolutionsPerMinute(radianpersecond.RevolutionsPerMinute).RadiansPerSecond, RevolutionsPerMinuteTolerance); + AssertEx.EqualTolerance(1, RotationalSpeed.FromRevolutionsPerSecond(radianpersecond.RevolutionsPerSecond).RadiansPerSecond, RevolutionsPerSecondTolerance); } [Fact] public void ArithmeticOperators() { - RotationalSpeed v = RotationalSpeed.FromRadiansPerSecond(1); + RotationalSpeed v = RotationalSpeed.FromRadiansPerSecond(1); AssertEx.EqualTolerance(-1, -v.RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(2, (RotationalSpeed.FromRadiansPerSecond(3)-v).RadiansPerSecond, RadiansPerSecondTolerance); + AssertEx.EqualTolerance(2, (RotationalSpeed.FromRadiansPerSecond(3)-v).RadiansPerSecond, RadiansPerSecondTolerance); AssertEx.EqualTolerance(2, (v + v).RadiansPerSecond, RadiansPerSecondTolerance); AssertEx.EqualTolerance(10, (v*10).RadiansPerSecond, RadiansPerSecondTolerance); AssertEx.EqualTolerance(10, (10*v).RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(2, (RotationalSpeed.FromRadiansPerSecond(10)/5).RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(2, RotationalSpeed.FromRadiansPerSecond(10)/RotationalSpeed.FromRadiansPerSecond(5), RadiansPerSecondTolerance); + AssertEx.EqualTolerance(2, (RotationalSpeed.FromRadiansPerSecond(10)/5).RadiansPerSecond, RadiansPerSecondTolerance); + AssertEx.EqualTolerance(2, RotationalSpeed.FromRadiansPerSecond(10)/RotationalSpeed.FromRadiansPerSecond(5), RadiansPerSecondTolerance); } [Fact] public void ComparisonOperators() { - RotationalSpeed oneRadianPerSecond = RotationalSpeed.FromRadiansPerSecond(1); - RotationalSpeed twoRadiansPerSecond = RotationalSpeed.FromRadiansPerSecond(2); + RotationalSpeed oneRadianPerSecond = RotationalSpeed.FromRadiansPerSecond(1); + RotationalSpeed twoRadiansPerSecond = RotationalSpeed.FromRadiansPerSecond(2); Assert.True(oneRadianPerSecond < twoRadiansPerSecond); Assert.True(oneRadianPerSecond <= twoRadiansPerSecond); @@ -262,31 +262,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); + RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); Assert.Equal(0, radianpersecond.CompareTo(radianpersecond)); - Assert.True(radianpersecond.CompareTo(RotationalSpeed.Zero) > 0); - Assert.True(RotationalSpeed.Zero.CompareTo(radianpersecond) < 0); + Assert.True(radianpersecond.CompareTo(RotationalSpeed.Zero) > 0); + Assert.True(RotationalSpeed.Zero.CompareTo(radianpersecond) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); + RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); Assert.Throws(() => radianpersecond.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); + RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); Assert.Throws(() => radianpersecond.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = RotationalSpeed.FromRadiansPerSecond(1); - var b = RotationalSpeed.FromRadiansPerSecond(2); + var a = RotationalSpeed.FromRadiansPerSecond(1); + var b = RotationalSpeed.FromRadiansPerSecond(2); // ReSharper disable EqualExpressionComparison @@ -305,8 +305,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = RotationalSpeed.FromRadiansPerSecond(1); - var b = RotationalSpeed.FromRadiansPerSecond(2); + var a = RotationalSpeed.FromRadiansPerSecond(1); + var b = RotationalSpeed.FromRadiansPerSecond(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -316,29 +316,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = RotationalSpeed.FromRadiansPerSecond(1); - Assert.True(v.Equals(RotationalSpeed.FromRadiansPerSecond(1), RadiansPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(RotationalSpeed.Zero, RadiansPerSecondTolerance, ComparisonType.Relative)); + var v = RotationalSpeed.FromRadiansPerSecond(1); + Assert.True(v.Equals(RotationalSpeed.FromRadiansPerSecond(1), RadiansPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(RotationalSpeed.Zero, RadiansPerSecondTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); + RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); Assert.False(radianpersecond.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); + RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); Assert.False(radianpersecond.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(RotationalSpeedUnit.Undefined, RotationalSpeed.Units); + Assert.DoesNotContain(RotationalSpeedUnit.Undefined, RotationalSpeed.Units); } [Fact] @@ -357,7 +357,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(RotationalSpeed.BaseDimensions is null); + Assert.False(RotationalSpeed.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs index 789c3b95fd..4f4a5d9f0e 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs @@ -47,26 +47,26 @@ public abstract partial class RotationalStiffnessPerLengthTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new RotationalStiffnessPerLength((double)0.0, RotationalStiffnessPerLengthUnit.Undefined)); + Assert.Throws(() => new RotationalStiffnessPerLength((double)0.0, RotationalStiffnessPerLengthUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new RotationalStiffnessPerLength(double.PositiveInfinity, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); - Assert.Throws(() => new RotationalStiffnessPerLength(double.NegativeInfinity, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); + Assert.Throws(() => new RotationalStiffnessPerLength(double.PositiveInfinity, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); + Assert.Throws(() => new RotationalStiffnessPerLength(double.NegativeInfinity, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new RotationalStiffnessPerLength(double.NaN, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); + Assert.Throws(() => new RotationalStiffnessPerLength(double.NaN, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); } [Fact] public void NewtonMeterPerRadianPerMeterToRotationalStiffnessPerLengthUnits() { - RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); + RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); AssertEx.EqualTolerance(KilonewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, newtonmeterperradianpermeter.KilonewtonMetersPerRadianPerMeter, KilonewtonMetersPerRadianPerMeterTolerance); AssertEx.EqualTolerance(MeganewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, newtonmeterperradianpermeter.MeganewtonMetersPerRadianPerMeter, MeganewtonMetersPerRadianPerMeterTolerance); AssertEx.EqualTolerance(NewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, newtonmeterperradianpermeter.NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance); @@ -75,28 +75,28 @@ public void NewtonMeterPerRadianPerMeterToRotationalStiffnessPerLengthUnits() [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); + AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.From(1, RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter).KilonewtonMetersPerRadianPerMeter, KilonewtonMetersPerRadianPerMeterTolerance); + AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.From(1, RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter).MeganewtonMetersPerRadianPerMeter, MeganewtonMetersPerRadianPerMeterTolerance); + AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.From(1, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance); } [Fact] public void FromNewtonMetersPerRadianPerMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.PositiveInfinity)); - Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.NegativeInfinity)); + Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.PositiveInfinity)); + Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.NegativeInfinity)); } [Fact] public void FromNewtonMetersPerRadianPerMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.NaN)); + Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.NaN)); } [Fact] public void As() { - var newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); + 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); @@ -105,7 +105,7 @@ public void As() [Fact] public void ToUnit() { - var newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); + var newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); var kilonewtonmeterperradianpermeterQuantity = newtonmeterperradianpermeter.ToUnit(RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter); AssertEx.EqualTolerance(KilonewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, (double)kilonewtonmeterperradianpermeterQuantity.Value, KilonewtonMetersPerRadianPerMeterTolerance); @@ -123,30 +123,30 @@ public void ToUnit() [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); + 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); + RotationalStiffnessPerLength v = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); AssertEx.EqualTolerance(-1, -v.NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance); - AssertEx.EqualTolerance(2, (RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(3)-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); + 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); + RotationalStiffnessPerLength oneNewtonMeterPerRadianPerMeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); + RotationalStiffnessPerLength twoNewtonMetersPerRadianPerMeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(2); Assert.True(oneNewtonMeterPerRadianPerMeter < twoNewtonMetersPerRadianPerMeter); Assert.True(oneNewtonMeterPerRadianPerMeter <= twoNewtonMetersPerRadianPerMeter); @@ -162,31 +162,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); + 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); + Assert.True(newtonmeterperradianpermeter.CompareTo(RotationalStiffnessPerLength.Zero) > 0); + Assert.True(RotationalStiffnessPerLength.Zero.CompareTo(newtonmeterperradianpermeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); + RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); Assert.Throws(() => newtonmeterperradianpermeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); + RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); Assert.Throws(() => newtonmeterperradianpermeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - var b = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(2); + var a = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); + var b = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(2); // ReSharper disable EqualExpressionComparison @@ -205,8 +205,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - var b = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(2); + var a = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); + var b = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -216,29 +216,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - Assert.True(v.Equals(RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1), NewtonMetersPerRadianPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(RotationalStiffnessPerLength.Zero, NewtonMetersPerRadianPerMeterTolerance, ComparisonType.Relative)); + var v = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); + Assert.True(v.Equals(RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1), NewtonMetersPerRadianPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(RotationalStiffnessPerLength.Zero, NewtonMetersPerRadianPerMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); + RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); Assert.False(newtonmeterperradianpermeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); + RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); Assert.False(newtonmeterperradianpermeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(RotationalStiffnessPerLengthUnit.Undefined, RotationalStiffnessPerLength.Units); + Assert.DoesNotContain(RotationalStiffnessPerLengthUnit.Undefined, RotationalStiffnessPerLength.Units); } [Fact] @@ -257,7 +257,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(RotationalStiffnessPerLength.BaseDimensions is null); + Assert.False(RotationalStiffnessPerLength.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs index f614eaff14..5b7dcb33c2 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs @@ -47,26 +47,26 @@ public abstract partial class RotationalStiffnessTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new RotationalStiffness((double)0.0, RotationalStiffnessUnit.Undefined)); + Assert.Throws(() => new RotationalStiffness((double)0.0, RotationalStiffnessUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new RotationalStiffness(double.PositiveInfinity, RotationalStiffnessUnit.NewtonMeterPerRadian)); - Assert.Throws(() => new RotationalStiffness(double.NegativeInfinity, RotationalStiffnessUnit.NewtonMeterPerRadian)); + Assert.Throws(() => new RotationalStiffness(double.PositiveInfinity, RotationalStiffnessUnit.NewtonMeterPerRadian)); + Assert.Throws(() => new RotationalStiffness(double.NegativeInfinity, RotationalStiffnessUnit.NewtonMeterPerRadian)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new RotationalStiffness(double.NaN, RotationalStiffnessUnit.NewtonMeterPerRadian)); + Assert.Throws(() => new RotationalStiffness(double.NaN, RotationalStiffnessUnit.NewtonMeterPerRadian)); } [Fact] public void NewtonMeterPerRadianToRotationalStiffnessUnits() { - RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); + RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); AssertEx.EqualTolerance(KilonewtonMetersPerRadianInOneNewtonMeterPerRadian, newtonmeterperradian.KilonewtonMetersPerRadian, KilonewtonMetersPerRadianTolerance); AssertEx.EqualTolerance(MeganewtonMetersPerRadianInOneNewtonMeterPerRadian, newtonmeterperradian.MeganewtonMetersPerRadian, MeganewtonMetersPerRadianTolerance); AssertEx.EqualTolerance(NewtonMetersPerRadianInOneNewtonMeterPerRadian, newtonmeterperradian.NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); @@ -75,28 +75,28 @@ public void NewtonMeterPerRadianToRotationalStiffnessUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, RotationalStiffness.From(1, RotationalStiffnessUnit.KilonewtonMeterPerRadian).KilonewtonMetersPerRadian, KilonewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(1, RotationalStiffness.From(1, RotationalStiffnessUnit.MeganewtonMeterPerRadian).MeganewtonMetersPerRadian, MeganewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(1, RotationalStiffness.From(1, RotationalStiffnessUnit.NewtonMeterPerRadian).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); + AssertEx.EqualTolerance(1, RotationalStiffness.From(1, RotationalStiffnessUnit.KilonewtonMeterPerRadian).KilonewtonMetersPerRadian, KilonewtonMetersPerRadianTolerance); + AssertEx.EqualTolerance(1, RotationalStiffness.From(1, RotationalStiffnessUnit.MeganewtonMeterPerRadian).MeganewtonMetersPerRadian, MeganewtonMetersPerRadianTolerance); + AssertEx.EqualTolerance(1, RotationalStiffness.From(1, RotationalStiffnessUnit.NewtonMeterPerRadian).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); } [Fact] public void FromNewtonMetersPerRadian_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.PositiveInfinity)); - Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.NegativeInfinity)); + Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.PositiveInfinity)); + Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.NegativeInfinity)); } [Fact] public void FromNewtonMetersPerRadian_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.NaN)); + Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.NaN)); } [Fact] public void As() { - var newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); + var newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); AssertEx.EqualTolerance(KilonewtonMetersPerRadianInOneNewtonMeterPerRadian, newtonmeterperradian.As(RotationalStiffnessUnit.KilonewtonMeterPerRadian), KilonewtonMetersPerRadianTolerance); AssertEx.EqualTolerance(MeganewtonMetersPerRadianInOneNewtonMeterPerRadian, newtonmeterperradian.As(RotationalStiffnessUnit.MeganewtonMeterPerRadian), MeganewtonMetersPerRadianTolerance); AssertEx.EqualTolerance(NewtonMetersPerRadianInOneNewtonMeterPerRadian, newtonmeterperradian.As(RotationalStiffnessUnit.NewtonMeterPerRadian), NewtonMetersPerRadianTolerance); @@ -105,7 +105,7 @@ public void As() [Fact] public void ToUnit() { - var newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); + var newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); var kilonewtonmeterperradianQuantity = newtonmeterperradian.ToUnit(RotationalStiffnessUnit.KilonewtonMeterPerRadian); AssertEx.EqualTolerance(KilonewtonMetersPerRadianInOneNewtonMeterPerRadian, (double)kilonewtonmeterperradianQuantity.Value, KilonewtonMetersPerRadianTolerance); @@ -123,30 +123,30 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); - AssertEx.EqualTolerance(1, RotationalStiffness.FromKilonewtonMetersPerRadian(newtonmeterperradian.KilonewtonMetersPerRadian).NewtonMetersPerRadian, KilonewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(1, RotationalStiffness.FromMeganewtonMetersPerRadian(newtonmeterperradian.MeganewtonMetersPerRadian).NewtonMetersPerRadian, MeganewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(1, RotationalStiffness.FromNewtonMetersPerRadian(newtonmeterperradian.NewtonMetersPerRadian).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); + RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); + AssertEx.EqualTolerance(1, RotationalStiffness.FromKilonewtonMetersPerRadian(newtonmeterperradian.KilonewtonMetersPerRadian).NewtonMetersPerRadian, KilonewtonMetersPerRadianTolerance); + AssertEx.EqualTolerance(1, RotationalStiffness.FromMeganewtonMetersPerRadian(newtonmeterperradian.MeganewtonMetersPerRadian).NewtonMetersPerRadian, MeganewtonMetersPerRadianTolerance); + AssertEx.EqualTolerance(1, RotationalStiffness.FromNewtonMetersPerRadian(newtonmeterperradian.NewtonMetersPerRadian).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); } [Fact] public void ArithmeticOperators() { - RotationalStiffness v = RotationalStiffness.FromNewtonMetersPerRadian(1); + RotationalStiffness v = RotationalStiffness.FromNewtonMetersPerRadian(1); AssertEx.EqualTolerance(-1, -v.NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(2, (RotationalStiffness.FromNewtonMetersPerRadian(3)-v).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); + AssertEx.EqualTolerance(2, (RotationalStiffness.FromNewtonMetersPerRadian(3)-v).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); AssertEx.EqualTolerance(2, (v + v).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); AssertEx.EqualTolerance(10, (v*10).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); AssertEx.EqualTolerance(10, (10*v).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(2, (RotationalStiffness.FromNewtonMetersPerRadian(10)/5).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(2, RotationalStiffness.FromNewtonMetersPerRadian(10)/RotationalStiffness.FromNewtonMetersPerRadian(5), NewtonMetersPerRadianTolerance); + AssertEx.EqualTolerance(2, (RotationalStiffness.FromNewtonMetersPerRadian(10)/5).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); + AssertEx.EqualTolerance(2, RotationalStiffness.FromNewtonMetersPerRadian(10)/RotationalStiffness.FromNewtonMetersPerRadian(5), NewtonMetersPerRadianTolerance); } [Fact] public void ComparisonOperators() { - RotationalStiffness oneNewtonMeterPerRadian = RotationalStiffness.FromNewtonMetersPerRadian(1); - RotationalStiffness twoNewtonMetersPerRadian = RotationalStiffness.FromNewtonMetersPerRadian(2); + RotationalStiffness oneNewtonMeterPerRadian = RotationalStiffness.FromNewtonMetersPerRadian(1); + RotationalStiffness twoNewtonMetersPerRadian = RotationalStiffness.FromNewtonMetersPerRadian(2); Assert.True(oneNewtonMeterPerRadian < twoNewtonMetersPerRadian); Assert.True(oneNewtonMeterPerRadian <= twoNewtonMetersPerRadian); @@ -162,31 +162,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); + RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); Assert.Equal(0, newtonmeterperradian.CompareTo(newtonmeterperradian)); - Assert.True(newtonmeterperradian.CompareTo(RotationalStiffness.Zero) > 0); - Assert.True(RotationalStiffness.Zero.CompareTo(newtonmeterperradian) < 0); + Assert.True(newtonmeterperradian.CompareTo(RotationalStiffness.Zero) > 0); + Assert.True(RotationalStiffness.Zero.CompareTo(newtonmeterperradian) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); + RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); Assert.Throws(() => newtonmeterperradian.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); + RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); Assert.Throws(() => newtonmeterperradian.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = RotationalStiffness.FromNewtonMetersPerRadian(1); - var b = RotationalStiffness.FromNewtonMetersPerRadian(2); + var a = RotationalStiffness.FromNewtonMetersPerRadian(1); + var b = RotationalStiffness.FromNewtonMetersPerRadian(2); // ReSharper disable EqualExpressionComparison @@ -205,8 +205,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = RotationalStiffness.FromNewtonMetersPerRadian(1); - var b = RotationalStiffness.FromNewtonMetersPerRadian(2); + var a = RotationalStiffness.FromNewtonMetersPerRadian(1); + var b = RotationalStiffness.FromNewtonMetersPerRadian(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -216,29 +216,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = RotationalStiffness.FromNewtonMetersPerRadian(1); - Assert.True(v.Equals(RotationalStiffness.FromNewtonMetersPerRadian(1), NewtonMetersPerRadianTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(RotationalStiffness.Zero, NewtonMetersPerRadianTolerance, ComparisonType.Relative)); + var v = RotationalStiffness.FromNewtonMetersPerRadian(1); + Assert.True(v.Equals(RotationalStiffness.FromNewtonMetersPerRadian(1), NewtonMetersPerRadianTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(RotationalStiffness.Zero, NewtonMetersPerRadianTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); + RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); Assert.False(newtonmeterperradian.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); + RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); Assert.False(newtonmeterperradian.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(RotationalStiffnessUnit.Undefined, RotationalStiffness.Units); + Assert.DoesNotContain(RotationalStiffnessUnit.Undefined, RotationalStiffness.Units); } [Fact] @@ -257,7 +257,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(RotationalStiffness.BaseDimensions is null); + Assert.False(RotationalStiffness.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs index 74769f9fa4..ab0eb472b8 100644 --- a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of SolidAngle. + /// Test of SolidAngle. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class SolidAngleTestsBase @@ -43,59 +43,59 @@ public abstract partial class SolidAngleTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new SolidAngle((double)0.0, SolidAngleUnit.Undefined)); + Assert.Throws(() => new SolidAngle((double)0.0, SolidAngleUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new SolidAngle(double.PositiveInfinity, SolidAngleUnit.Steradian)); - Assert.Throws(() => new SolidAngle(double.NegativeInfinity, SolidAngleUnit.Steradian)); + Assert.Throws(() => new SolidAngle(double.PositiveInfinity, SolidAngleUnit.Steradian)); + Assert.Throws(() => new SolidAngle(double.NegativeInfinity, SolidAngleUnit.Steradian)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new SolidAngle(double.NaN, SolidAngleUnit.Steradian)); + Assert.Throws(() => new SolidAngle(double.NaN, SolidAngleUnit.Steradian)); } [Fact] public void SteradianToSolidAngleUnits() { - SolidAngle steradian = SolidAngle.FromSteradians(1); + 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); + AssertEx.EqualTolerance(1, SolidAngle.From(1, SolidAngleUnit.Steradian).Steradians, SteradiansTolerance); } [Fact] public void FromSteradians_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => SolidAngle.FromSteradians(double.PositiveInfinity)); - Assert.Throws(() => SolidAngle.FromSteradians(double.NegativeInfinity)); + Assert.Throws(() => SolidAngle.FromSteradians(double.PositiveInfinity)); + Assert.Throws(() => SolidAngle.FromSteradians(double.NegativeInfinity)); } [Fact] public void FromSteradians_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => SolidAngle.FromSteradians(double.NaN)); + Assert.Throws(() => SolidAngle.FromSteradians(double.NaN)); } [Fact] public void As() { - var steradian = SolidAngle.FromSteradians(1); + var steradian = SolidAngle.FromSteradians(1); AssertEx.EqualTolerance(SteradiansInOneSteradian, steradian.As(SolidAngleUnit.Steradian), SteradiansTolerance); } [Fact] public void ToUnit() { - var steradian = SolidAngle.FromSteradians(1); + var steradian = SolidAngle.FromSteradians(1); var steradianQuantity = steradian.ToUnit(SolidAngleUnit.Steradian); AssertEx.EqualTolerance(SteradiansInOneSteradian, (double)steradianQuantity.Value, SteradiansTolerance); @@ -105,28 +105,28 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - SolidAngle steradian = SolidAngle.FromSteradians(1); - AssertEx.EqualTolerance(1, SolidAngle.FromSteradians(steradian.Steradians).Steradians, SteradiansTolerance); + SolidAngle steradian = SolidAngle.FromSteradians(1); + AssertEx.EqualTolerance(1, SolidAngle.FromSteradians(steradian.Steradians).Steradians, SteradiansTolerance); } [Fact] public void ArithmeticOperators() { - SolidAngle v = SolidAngle.FromSteradians(1); + SolidAngle v = SolidAngle.FromSteradians(1); AssertEx.EqualTolerance(-1, -v.Steradians, SteradiansTolerance); - AssertEx.EqualTolerance(2, (SolidAngle.FromSteradians(3)-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); + 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); + SolidAngle oneSteradian = SolidAngle.FromSteradians(1); + SolidAngle twoSteradians = SolidAngle.FromSteradians(2); Assert.True(oneSteradian < twoSteradians); Assert.True(oneSteradian <= twoSteradians); @@ -142,31 +142,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - SolidAngle steradian = SolidAngle.FromSteradians(1); + 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); + Assert.True(steradian.CompareTo(SolidAngle.Zero) > 0); + Assert.True(SolidAngle.Zero.CompareTo(steradian) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - SolidAngle steradian = SolidAngle.FromSteradians(1); + SolidAngle steradian = SolidAngle.FromSteradians(1); Assert.Throws(() => steradian.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - SolidAngle steradian = SolidAngle.FromSteradians(1); + SolidAngle steradian = SolidAngle.FromSteradians(1); Assert.Throws(() => steradian.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = SolidAngle.FromSteradians(1); - var b = SolidAngle.FromSteradians(2); + var a = SolidAngle.FromSteradians(1); + var b = SolidAngle.FromSteradians(2); // ReSharper disable EqualExpressionComparison @@ -185,8 +185,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = SolidAngle.FromSteradians(1); - var b = SolidAngle.FromSteradians(2); + var a = SolidAngle.FromSteradians(1); + var b = SolidAngle.FromSteradians(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -196,29 +196,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = SolidAngle.FromSteradians(1); - Assert.True(v.Equals(SolidAngle.FromSteradians(1), SteradiansTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(SolidAngle.Zero, SteradiansTolerance, ComparisonType.Relative)); + var v = SolidAngle.FromSteradians(1); + Assert.True(v.Equals(SolidAngle.FromSteradians(1), SteradiansTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(SolidAngle.Zero, SteradiansTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - SolidAngle steradian = SolidAngle.FromSteradians(1); + SolidAngle steradian = SolidAngle.FromSteradians(1); Assert.False(steradian.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - SolidAngle steradian = SolidAngle.FromSteradians(1); + SolidAngle steradian = SolidAngle.FromSteradians(1); Assert.False(steradian.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(SolidAngleUnit.Undefined, SolidAngle.Units); + Assert.DoesNotContain(SolidAngleUnit.Undefined, SolidAngle.Units); } [Fact] @@ -237,7 +237,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(SolidAngle.BaseDimensions is null); + Assert.False(SolidAngle.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs index 6cc36999b2..44bab7017f 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of SpecificEnergy. + /// Test of SpecificEnergy. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class SpecificEnergyTestsBase @@ -59,26 +59,26 @@ public abstract partial class SpecificEnergyTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new SpecificEnergy((double)0.0, SpecificEnergyUnit.Undefined)); + Assert.Throws(() => new SpecificEnergy((double)0.0, SpecificEnergyUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new SpecificEnergy(double.PositiveInfinity, SpecificEnergyUnit.JoulePerKilogram)); - Assert.Throws(() => new SpecificEnergy(double.NegativeInfinity, SpecificEnergyUnit.JoulePerKilogram)); + Assert.Throws(() => new SpecificEnergy(double.PositiveInfinity, SpecificEnergyUnit.JoulePerKilogram)); + Assert.Throws(() => new SpecificEnergy(double.NegativeInfinity, SpecificEnergyUnit.JoulePerKilogram)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new SpecificEnergy(double.NaN, SpecificEnergyUnit.JoulePerKilogram)); + Assert.Throws(() => new SpecificEnergy(double.NaN, SpecificEnergyUnit.JoulePerKilogram)); } [Fact] public void JoulePerKilogramToSpecificEnergyUnits() { - SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); + SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); AssertEx.EqualTolerance(BtuPerPoundInOneJoulePerKilogram, jouleperkilogram.BtuPerPound, BtuPerPoundTolerance); AssertEx.EqualTolerance(CaloriesPerGramInOneJoulePerKilogram, jouleperkilogram.CaloriesPerGram, CaloriesPerGramTolerance); AssertEx.EqualTolerance(JoulesPerKilogramInOneJoulePerKilogram, jouleperkilogram.JoulesPerKilogram, JoulesPerKilogramTolerance); @@ -93,34 +93,34 @@ public void JoulePerKilogramToSpecificEnergyUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.BtuPerPound).BtuPerPound, BtuPerPoundTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.CaloriePerGram).CaloriesPerGram, CaloriesPerGramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.JoulePerKilogram).JoulesPerKilogram, JoulesPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.KilocaloriePerGram).KilocaloriesPerGram, KilocaloriesPerGramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.KilojoulePerKilogram).KilojoulesPerKilogram, KilojoulesPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.KilowattHourPerKilogram).KilowattHoursPerKilogram, KilowattHoursPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.MegajoulePerKilogram).MegajoulesPerKilogram, MegajoulesPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.MegawattHourPerKilogram).MegawattHoursPerKilogram, MegawattHoursPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.WattHourPerKilogram).WattHoursPerKilogram, WattHoursPerKilogramTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.BtuPerPound).BtuPerPound, BtuPerPoundTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.CaloriePerGram).CaloriesPerGram, CaloriesPerGramTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.JoulePerKilogram).JoulesPerKilogram, JoulesPerKilogramTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.KilocaloriePerGram).KilocaloriesPerGram, KilocaloriesPerGramTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.KilojoulePerKilogram).KilojoulesPerKilogram, KilojoulesPerKilogramTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.KilowattHourPerKilogram).KilowattHoursPerKilogram, KilowattHoursPerKilogramTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.MegajoulePerKilogram).MegajoulesPerKilogram, MegajoulesPerKilogramTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.MegawattHourPerKilogram).MegawattHoursPerKilogram, MegawattHoursPerKilogramTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.WattHourPerKilogram).WattHoursPerKilogram, WattHoursPerKilogramTolerance); } [Fact] public void FromJoulesPerKilogram_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.PositiveInfinity)); - Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.NegativeInfinity)); + Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.PositiveInfinity)); + Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.NegativeInfinity)); } [Fact] public void FromJoulesPerKilogram_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.NaN)); + Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.NaN)); } [Fact] public void As() { - var jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); + var jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); AssertEx.EqualTolerance(BtuPerPoundInOneJoulePerKilogram, jouleperkilogram.As(SpecificEnergyUnit.BtuPerPound), BtuPerPoundTolerance); AssertEx.EqualTolerance(CaloriesPerGramInOneJoulePerKilogram, jouleperkilogram.As(SpecificEnergyUnit.CaloriePerGram), CaloriesPerGramTolerance); AssertEx.EqualTolerance(JoulesPerKilogramInOneJoulePerKilogram, jouleperkilogram.As(SpecificEnergyUnit.JoulePerKilogram), JoulesPerKilogramTolerance); @@ -135,7 +135,7 @@ public void As() [Fact] public void ToUnit() { - var jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); + var jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); var btuperpoundQuantity = jouleperkilogram.ToUnit(SpecificEnergyUnit.BtuPerPound); AssertEx.EqualTolerance(BtuPerPoundInOneJoulePerKilogram, (double)btuperpoundQuantity.Value, BtuPerPoundTolerance); @@ -177,36 +177,36 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); - AssertEx.EqualTolerance(1, SpecificEnergy.FromBtuPerPound(jouleperkilogram.BtuPerPound).JoulesPerKilogram, BtuPerPoundTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.FromCaloriesPerGram(jouleperkilogram.CaloriesPerGram).JoulesPerKilogram, CaloriesPerGramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.FromJoulesPerKilogram(jouleperkilogram.JoulesPerKilogram).JoulesPerKilogram, JoulesPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.FromKilocaloriesPerGram(jouleperkilogram.KilocaloriesPerGram).JoulesPerKilogram, KilocaloriesPerGramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.FromKilojoulesPerKilogram(jouleperkilogram.KilojoulesPerKilogram).JoulesPerKilogram, KilojoulesPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.FromKilowattHoursPerKilogram(jouleperkilogram.KilowattHoursPerKilogram).JoulesPerKilogram, KilowattHoursPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.FromMegajoulesPerKilogram(jouleperkilogram.MegajoulesPerKilogram).JoulesPerKilogram, MegajoulesPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.FromMegawattHoursPerKilogram(jouleperkilogram.MegawattHoursPerKilogram).JoulesPerKilogram, MegawattHoursPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.FromWattHoursPerKilogram(jouleperkilogram.WattHoursPerKilogram).JoulesPerKilogram, WattHoursPerKilogramTolerance); + SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); + AssertEx.EqualTolerance(1, SpecificEnergy.FromBtuPerPound(jouleperkilogram.BtuPerPound).JoulesPerKilogram, BtuPerPoundTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.FromCaloriesPerGram(jouleperkilogram.CaloriesPerGram).JoulesPerKilogram, CaloriesPerGramTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.FromJoulesPerKilogram(jouleperkilogram.JoulesPerKilogram).JoulesPerKilogram, JoulesPerKilogramTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.FromKilocaloriesPerGram(jouleperkilogram.KilocaloriesPerGram).JoulesPerKilogram, KilocaloriesPerGramTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.FromKilojoulesPerKilogram(jouleperkilogram.KilojoulesPerKilogram).JoulesPerKilogram, KilojoulesPerKilogramTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.FromKilowattHoursPerKilogram(jouleperkilogram.KilowattHoursPerKilogram).JoulesPerKilogram, KilowattHoursPerKilogramTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.FromMegajoulesPerKilogram(jouleperkilogram.MegajoulesPerKilogram).JoulesPerKilogram, MegajoulesPerKilogramTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.FromMegawattHoursPerKilogram(jouleperkilogram.MegawattHoursPerKilogram).JoulesPerKilogram, MegawattHoursPerKilogramTolerance); + AssertEx.EqualTolerance(1, SpecificEnergy.FromWattHoursPerKilogram(jouleperkilogram.WattHoursPerKilogram).JoulesPerKilogram, WattHoursPerKilogramTolerance); } [Fact] public void ArithmeticOperators() { - SpecificEnergy v = SpecificEnergy.FromJoulesPerKilogram(1); + SpecificEnergy v = SpecificEnergy.FromJoulesPerKilogram(1); AssertEx.EqualTolerance(-1, -v.JoulesPerKilogram, JoulesPerKilogramTolerance); - AssertEx.EqualTolerance(2, (SpecificEnergy.FromJoulesPerKilogram(3)-v).JoulesPerKilogram, JoulesPerKilogramTolerance); + AssertEx.EqualTolerance(2, (SpecificEnergy.FromJoulesPerKilogram(3)-v).JoulesPerKilogram, JoulesPerKilogramTolerance); AssertEx.EqualTolerance(2, (v + v).JoulesPerKilogram, JoulesPerKilogramTolerance); AssertEx.EqualTolerance(10, (v*10).JoulesPerKilogram, JoulesPerKilogramTolerance); AssertEx.EqualTolerance(10, (10*v).JoulesPerKilogram, JoulesPerKilogramTolerance); - AssertEx.EqualTolerance(2, (SpecificEnergy.FromJoulesPerKilogram(10)/5).JoulesPerKilogram, JoulesPerKilogramTolerance); - AssertEx.EqualTolerance(2, SpecificEnergy.FromJoulesPerKilogram(10)/SpecificEnergy.FromJoulesPerKilogram(5), JoulesPerKilogramTolerance); + AssertEx.EqualTolerance(2, (SpecificEnergy.FromJoulesPerKilogram(10)/5).JoulesPerKilogram, JoulesPerKilogramTolerance); + AssertEx.EqualTolerance(2, SpecificEnergy.FromJoulesPerKilogram(10)/SpecificEnergy.FromJoulesPerKilogram(5), JoulesPerKilogramTolerance); } [Fact] public void ComparisonOperators() { - SpecificEnergy oneJoulePerKilogram = SpecificEnergy.FromJoulesPerKilogram(1); - SpecificEnergy twoJoulesPerKilogram = SpecificEnergy.FromJoulesPerKilogram(2); + SpecificEnergy oneJoulePerKilogram = SpecificEnergy.FromJoulesPerKilogram(1); + SpecificEnergy twoJoulesPerKilogram = SpecificEnergy.FromJoulesPerKilogram(2); Assert.True(oneJoulePerKilogram < twoJoulesPerKilogram); Assert.True(oneJoulePerKilogram <= twoJoulesPerKilogram); @@ -222,31 +222,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); + SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); Assert.Equal(0, jouleperkilogram.CompareTo(jouleperkilogram)); - Assert.True(jouleperkilogram.CompareTo(SpecificEnergy.Zero) > 0); - Assert.True(SpecificEnergy.Zero.CompareTo(jouleperkilogram) < 0); + Assert.True(jouleperkilogram.CompareTo(SpecificEnergy.Zero) > 0); + Assert.True(SpecificEnergy.Zero.CompareTo(jouleperkilogram) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); + SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); Assert.Throws(() => jouleperkilogram.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); + SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); Assert.Throws(() => jouleperkilogram.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = SpecificEnergy.FromJoulesPerKilogram(1); - var b = SpecificEnergy.FromJoulesPerKilogram(2); + var a = SpecificEnergy.FromJoulesPerKilogram(1); + var b = SpecificEnergy.FromJoulesPerKilogram(2); // ReSharper disable EqualExpressionComparison @@ -265,8 +265,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = SpecificEnergy.FromJoulesPerKilogram(1); - var b = SpecificEnergy.FromJoulesPerKilogram(2); + var a = SpecificEnergy.FromJoulesPerKilogram(1); + var b = SpecificEnergy.FromJoulesPerKilogram(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -276,29 +276,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = SpecificEnergy.FromJoulesPerKilogram(1); - Assert.True(v.Equals(SpecificEnergy.FromJoulesPerKilogram(1), JoulesPerKilogramTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(SpecificEnergy.Zero, JoulesPerKilogramTolerance, ComparisonType.Relative)); + var v = SpecificEnergy.FromJoulesPerKilogram(1); + Assert.True(v.Equals(SpecificEnergy.FromJoulesPerKilogram(1), JoulesPerKilogramTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(SpecificEnergy.Zero, JoulesPerKilogramTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); + SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); Assert.False(jouleperkilogram.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); + SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); Assert.False(jouleperkilogram.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(SpecificEnergyUnit.Undefined, SpecificEnergy.Units); + Assert.DoesNotContain(SpecificEnergyUnit.Undefined, SpecificEnergy.Units); } [Fact] @@ -317,7 +317,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(SpecificEnergy.BaseDimensions is null); + Assert.False(SpecificEnergy.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs index 3282c91896..af32b0dbcf 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs @@ -59,26 +59,26 @@ public abstract partial class SpecificEntropyTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new SpecificEntropy((double)0.0, SpecificEntropyUnit.Undefined)); + Assert.Throws(() => new SpecificEntropy((double)0.0, SpecificEntropyUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new SpecificEntropy(double.PositiveInfinity, SpecificEntropyUnit.JoulePerKilogramKelvin)); - Assert.Throws(() => new SpecificEntropy(double.NegativeInfinity, SpecificEntropyUnit.JoulePerKilogramKelvin)); + Assert.Throws(() => new SpecificEntropy(double.PositiveInfinity, SpecificEntropyUnit.JoulePerKilogramKelvin)); + Assert.Throws(() => new SpecificEntropy(double.NegativeInfinity, SpecificEntropyUnit.JoulePerKilogramKelvin)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new SpecificEntropy(double.NaN, SpecificEntropyUnit.JoulePerKilogramKelvin)); + Assert.Throws(() => new SpecificEntropy(double.NaN, SpecificEntropyUnit.JoulePerKilogramKelvin)); } [Fact] public void JoulePerKilogramKelvinToSpecificEntropyUnits() { - SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); + SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); AssertEx.EqualTolerance(BtusPerPoundFahrenheitInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.BtusPerPoundFahrenheit, BtusPerPoundFahrenheitTolerance); AssertEx.EqualTolerance(CaloriesPerGramKelvinInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.CaloriesPerGramKelvin, CaloriesPerGramKelvinTolerance); AssertEx.EqualTolerance(JoulesPerKilogramDegreeCelsiusInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.JoulesPerKilogramDegreeCelsius, JoulesPerKilogramDegreeCelsiusTolerance); @@ -93,34 +93,34 @@ public void JoulePerKilogramKelvinToSpecificEntropyUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.BtuPerPoundFahrenheit).BtusPerPoundFahrenheit, BtusPerPoundFahrenheitTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.CaloriePerGramKelvin).CaloriesPerGramKelvin, CaloriesPerGramKelvinTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.JoulePerKilogramDegreeCelsius).JoulesPerKilogramDegreeCelsius, JoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.JoulePerKilogramKelvin).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.KilocaloriePerGramKelvin).KilocaloriesPerGramKelvin, KilocaloriesPerGramKelvinTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius).KilojoulesPerKilogramDegreeCelsius, KilojoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.KilojoulePerKilogramKelvin).KilojoulesPerKilogramKelvin, KilojoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius).MegajoulesPerKilogramDegreeCelsius, MegajoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.MegajoulePerKilogramKelvin).MegajoulesPerKilogramKelvin, MegajoulesPerKilogramKelvinTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.BtuPerPoundFahrenheit).BtusPerPoundFahrenheit, BtusPerPoundFahrenheitTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.CaloriePerGramKelvin).CaloriesPerGramKelvin, CaloriesPerGramKelvinTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.JoulePerKilogramDegreeCelsius).JoulesPerKilogramDegreeCelsius, JoulesPerKilogramDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.JoulePerKilogramKelvin).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.KilocaloriePerGramKelvin).KilocaloriesPerGramKelvin, KilocaloriesPerGramKelvinTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius).KilojoulesPerKilogramDegreeCelsius, KilojoulesPerKilogramDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.KilojoulePerKilogramKelvin).KilojoulesPerKilogramKelvin, KilojoulesPerKilogramKelvinTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius).MegajoulesPerKilogramDegreeCelsius, MegajoulesPerKilogramDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.MegajoulePerKilogramKelvin).MegajoulesPerKilogramKelvin, MegajoulesPerKilogramKelvinTolerance); } [Fact] public void FromJoulesPerKilogramKelvin_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.PositiveInfinity)); - Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.NegativeInfinity)); + Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.PositiveInfinity)); + Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.NegativeInfinity)); } [Fact] public void FromJoulesPerKilogramKelvin_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.NaN)); + Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.NaN)); } [Fact] public void As() { - var jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); + var jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); AssertEx.EqualTolerance(BtusPerPoundFahrenheitInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.As(SpecificEntropyUnit.BtuPerPoundFahrenheit), BtusPerPoundFahrenheitTolerance); AssertEx.EqualTolerance(CaloriesPerGramKelvinInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.As(SpecificEntropyUnit.CaloriePerGramKelvin), CaloriesPerGramKelvinTolerance); AssertEx.EqualTolerance(JoulesPerKilogramDegreeCelsiusInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.As(SpecificEntropyUnit.JoulePerKilogramDegreeCelsius), JoulesPerKilogramDegreeCelsiusTolerance); @@ -135,7 +135,7 @@ public void As() [Fact] public void ToUnit() { - var jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); + var jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); var btuperpoundfahrenheitQuantity = jouleperkilogramkelvin.ToUnit(SpecificEntropyUnit.BtuPerPoundFahrenheit); AssertEx.EqualTolerance(BtusPerPoundFahrenheitInOneJoulePerKilogramKelvin, (double)btuperpoundfahrenheitQuantity.Value, BtusPerPoundFahrenheitTolerance); @@ -177,36 +177,36 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - AssertEx.EqualTolerance(1, SpecificEntropy.FromBtusPerPoundFahrenheit(jouleperkilogramkelvin.BtusPerPoundFahrenheit).JoulesPerKilogramKelvin, BtusPerPoundFahrenheitTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.FromCaloriesPerGramKelvin(jouleperkilogramkelvin.CaloriesPerGramKelvin).JoulesPerKilogramKelvin, CaloriesPerGramKelvinTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.FromJoulesPerKilogramDegreeCelsius(jouleperkilogramkelvin.JoulesPerKilogramDegreeCelsius).JoulesPerKilogramKelvin, JoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.FromJoulesPerKilogramKelvin(jouleperkilogramkelvin.JoulesPerKilogramKelvin).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.FromKilocaloriesPerGramKelvin(jouleperkilogramkelvin.KilocaloriesPerGramKelvin).JoulesPerKilogramKelvin, KilocaloriesPerGramKelvinTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.FromKilojoulesPerKilogramDegreeCelsius(jouleperkilogramkelvin.KilojoulesPerKilogramDegreeCelsius).JoulesPerKilogramKelvin, KilojoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.FromKilojoulesPerKilogramKelvin(jouleperkilogramkelvin.KilojoulesPerKilogramKelvin).JoulesPerKilogramKelvin, KilojoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.FromMegajoulesPerKilogramDegreeCelsius(jouleperkilogramkelvin.MegajoulesPerKilogramDegreeCelsius).JoulesPerKilogramKelvin, MegajoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.FromMegajoulesPerKilogramKelvin(jouleperkilogramkelvin.MegajoulesPerKilogramKelvin).JoulesPerKilogramKelvin, MegajoulesPerKilogramKelvinTolerance); + SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); + AssertEx.EqualTolerance(1, SpecificEntropy.FromBtusPerPoundFahrenheit(jouleperkilogramkelvin.BtusPerPoundFahrenheit).JoulesPerKilogramKelvin, BtusPerPoundFahrenheitTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.FromCaloriesPerGramKelvin(jouleperkilogramkelvin.CaloriesPerGramKelvin).JoulesPerKilogramKelvin, CaloriesPerGramKelvinTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.FromJoulesPerKilogramDegreeCelsius(jouleperkilogramkelvin.JoulesPerKilogramDegreeCelsius).JoulesPerKilogramKelvin, JoulesPerKilogramDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.FromJoulesPerKilogramKelvin(jouleperkilogramkelvin.JoulesPerKilogramKelvin).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.FromKilocaloriesPerGramKelvin(jouleperkilogramkelvin.KilocaloriesPerGramKelvin).JoulesPerKilogramKelvin, KilocaloriesPerGramKelvinTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.FromKilojoulesPerKilogramDegreeCelsius(jouleperkilogramkelvin.KilojoulesPerKilogramDegreeCelsius).JoulesPerKilogramKelvin, KilojoulesPerKilogramDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.FromKilojoulesPerKilogramKelvin(jouleperkilogramkelvin.KilojoulesPerKilogramKelvin).JoulesPerKilogramKelvin, KilojoulesPerKilogramKelvinTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.FromMegajoulesPerKilogramDegreeCelsius(jouleperkilogramkelvin.MegajoulesPerKilogramDegreeCelsius).JoulesPerKilogramKelvin, MegajoulesPerKilogramDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, SpecificEntropy.FromMegajoulesPerKilogramKelvin(jouleperkilogramkelvin.MegajoulesPerKilogramKelvin).JoulesPerKilogramKelvin, MegajoulesPerKilogramKelvinTolerance); } [Fact] public void ArithmeticOperators() { - SpecificEntropy v = SpecificEntropy.FromJoulesPerKilogramKelvin(1); + SpecificEntropy v = SpecificEntropy.FromJoulesPerKilogramKelvin(1); AssertEx.EqualTolerance(-1, -v.JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(2, (SpecificEntropy.FromJoulesPerKilogramKelvin(3)-v).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); + AssertEx.EqualTolerance(2, (SpecificEntropy.FromJoulesPerKilogramKelvin(3)-v).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); AssertEx.EqualTolerance(2, (v + v).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); AssertEx.EqualTolerance(10, (v*10).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); AssertEx.EqualTolerance(10, (10*v).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(2, (SpecificEntropy.FromJoulesPerKilogramKelvin(10)/5).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(2, SpecificEntropy.FromJoulesPerKilogramKelvin(10)/SpecificEntropy.FromJoulesPerKilogramKelvin(5), JoulesPerKilogramKelvinTolerance); + AssertEx.EqualTolerance(2, (SpecificEntropy.FromJoulesPerKilogramKelvin(10)/5).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); + AssertEx.EqualTolerance(2, SpecificEntropy.FromJoulesPerKilogramKelvin(10)/SpecificEntropy.FromJoulesPerKilogramKelvin(5), JoulesPerKilogramKelvinTolerance); } [Fact] public void ComparisonOperators() { - SpecificEntropy oneJoulePerKilogramKelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - SpecificEntropy twoJoulesPerKilogramKelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(2); + SpecificEntropy oneJoulePerKilogramKelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); + SpecificEntropy twoJoulesPerKilogramKelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(2); Assert.True(oneJoulePerKilogramKelvin < twoJoulesPerKilogramKelvin); Assert.True(oneJoulePerKilogramKelvin <= twoJoulesPerKilogramKelvin); @@ -222,31 +222,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); + SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); Assert.Equal(0, jouleperkilogramkelvin.CompareTo(jouleperkilogramkelvin)); - Assert.True(jouleperkilogramkelvin.CompareTo(SpecificEntropy.Zero) > 0); - Assert.True(SpecificEntropy.Zero.CompareTo(jouleperkilogramkelvin) < 0); + Assert.True(jouleperkilogramkelvin.CompareTo(SpecificEntropy.Zero) > 0); + Assert.True(SpecificEntropy.Zero.CompareTo(jouleperkilogramkelvin) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); + SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); Assert.Throws(() => jouleperkilogramkelvin.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); + SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); Assert.Throws(() => jouleperkilogramkelvin.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - var b = SpecificEntropy.FromJoulesPerKilogramKelvin(2); + var a = SpecificEntropy.FromJoulesPerKilogramKelvin(1); + var b = SpecificEntropy.FromJoulesPerKilogramKelvin(2); // ReSharper disable EqualExpressionComparison @@ -265,8 +265,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - var b = SpecificEntropy.FromJoulesPerKilogramKelvin(2); + var a = SpecificEntropy.FromJoulesPerKilogramKelvin(1); + var b = SpecificEntropy.FromJoulesPerKilogramKelvin(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -276,29 +276,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - Assert.True(v.Equals(SpecificEntropy.FromJoulesPerKilogramKelvin(1), JoulesPerKilogramKelvinTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(SpecificEntropy.Zero, JoulesPerKilogramKelvinTolerance, ComparisonType.Relative)); + var v = SpecificEntropy.FromJoulesPerKilogramKelvin(1); + Assert.True(v.Equals(SpecificEntropy.FromJoulesPerKilogramKelvin(1), JoulesPerKilogramKelvinTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(SpecificEntropy.Zero, JoulesPerKilogramKelvinTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); + SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); Assert.False(jouleperkilogramkelvin.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); + SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); Assert.False(jouleperkilogramkelvin.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(SpecificEntropyUnit.Undefined, SpecificEntropy.Units); + Assert.DoesNotContain(SpecificEntropyUnit.Undefined, SpecificEntropy.Units); } [Fact] @@ -317,7 +317,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(SpecificEntropy.BaseDimensions is null); + Assert.False(SpecificEntropy.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs index 357fb9b237..afb657fa3e 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of SpecificVolume. + /// Test of SpecificVolume. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class SpecificVolumeTestsBase @@ -47,26 +47,26 @@ public abstract partial class SpecificVolumeTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new SpecificVolume((double)0.0, SpecificVolumeUnit.Undefined)); + Assert.Throws(() => new SpecificVolume((double)0.0, SpecificVolumeUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new SpecificVolume(double.PositiveInfinity, SpecificVolumeUnit.CubicMeterPerKilogram)); - Assert.Throws(() => new SpecificVolume(double.NegativeInfinity, SpecificVolumeUnit.CubicMeterPerKilogram)); + Assert.Throws(() => new SpecificVolume(double.PositiveInfinity, SpecificVolumeUnit.CubicMeterPerKilogram)); + Assert.Throws(() => new SpecificVolume(double.NegativeInfinity, SpecificVolumeUnit.CubicMeterPerKilogram)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new SpecificVolume(double.NaN, SpecificVolumeUnit.CubicMeterPerKilogram)); + Assert.Throws(() => new SpecificVolume(double.NaN, SpecificVolumeUnit.CubicMeterPerKilogram)); } [Fact] public void CubicMeterPerKilogramToSpecificVolumeUnits() { - SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); + SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); AssertEx.EqualTolerance(CubicFeetPerPoundInOneCubicMeterPerKilogram, cubicmeterperkilogram.CubicFeetPerPound, CubicFeetPerPoundTolerance); AssertEx.EqualTolerance(CubicMetersPerKilogramInOneCubicMeterPerKilogram, cubicmeterperkilogram.CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); AssertEx.EqualTolerance(MillicubicMetersPerKilogramInOneCubicMeterPerKilogram, cubicmeterperkilogram.MillicubicMetersPerKilogram, MillicubicMetersPerKilogramTolerance); @@ -75,28 +75,28 @@ public void CubicMeterPerKilogramToSpecificVolumeUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, SpecificVolume.From(1, SpecificVolumeUnit.CubicFootPerPound).CubicFeetPerPound, CubicFeetPerPoundTolerance); - AssertEx.EqualTolerance(1, SpecificVolume.From(1, SpecificVolumeUnit.CubicMeterPerKilogram).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificVolume.From(1, SpecificVolumeUnit.MillicubicMeterPerKilogram).MillicubicMetersPerKilogram, MillicubicMetersPerKilogramTolerance); + AssertEx.EqualTolerance(1, SpecificVolume.From(1, SpecificVolumeUnit.CubicFootPerPound).CubicFeetPerPound, CubicFeetPerPoundTolerance); + AssertEx.EqualTolerance(1, SpecificVolume.From(1, SpecificVolumeUnit.CubicMeterPerKilogram).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); + AssertEx.EqualTolerance(1, SpecificVolume.From(1, SpecificVolumeUnit.MillicubicMeterPerKilogram).MillicubicMetersPerKilogram, MillicubicMetersPerKilogramTolerance); } [Fact] public void FromCubicMetersPerKilogram_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.PositiveInfinity)); - Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.NegativeInfinity)); + Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.PositiveInfinity)); + Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.NegativeInfinity)); } [Fact] public void FromCubicMetersPerKilogram_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.NaN)); + Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.NaN)); } [Fact] public void As() { - var cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); + var cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); AssertEx.EqualTolerance(CubicFeetPerPoundInOneCubicMeterPerKilogram, cubicmeterperkilogram.As(SpecificVolumeUnit.CubicFootPerPound), CubicFeetPerPoundTolerance); AssertEx.EqualTolerance(CubicMetersPerKilogramInOneCubicMeterPerKilogram, cubicmeterperkilogram.As(SpecificVolumeUnit.CubicMeterPerKilogram), CubicMetersPerKilogramTolerance); AssertEx.EqualTolerance(MillicubicMetersPerKilogramInOneCubicMeterPerKilogram, cubicmeterperkilogram.As(SpecificVolumeUnit.MillicubicMeterPerKilogram), MillicubicMetersPerKilogramTolerance); @@ -105,7 +105,7 @@ public void As() [Fact] public void ToUnit() { - var cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); + var cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); var cubicfootperpoundQuantity = cubicmeterperkilogram.ToUnit(SpecificVolumeUnit.CubicFootPerPound); AssertEx.EqualTolerance(CubicFeetPerPoundInOneCubicMeterPerKilogram, (double)cubicfootperpoundQuantity.Value, CubicFeetPerPoundTolerance); @@ -123,30 +123,30 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); - AssertEx.EqualTolerance(1, SpecificVolume.FromCubicFeetPerPound(cubicmeterperkilogram.CubicFeetPerPound).CubicMetersPerKilogram, CubicFeetPerPoundTolerance); - AssertEx.EqualTolerance(1, SpecificVolume.FromCubicMetersPerKilogram(cubicmeterperkilogram.CubicMetersPerKilogram).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificVolume.FromMillicubicMetersPerKilogram(cubicmeterperkilogram.MillicubicMetersPerKilogram).CubicMetersPerKilogram, MillicubicMetersPerKilogramTolerance); + SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); + AssertEx.EqualTolerance(1, SpecificVolume.FromCubicFeetPerPound(cubicmeterperkilogram.CubicFeetPerPound).CubicMetersPerKilogram, CubicFeetPerPoundTolerance); + AssertEx.EqualTolerance(1, SpecificVolume.FromCubicMetersPerKilogram(cubicmeterperkilogram.CubicMetersPerKilogram).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); + AssertEx.EqualTolerance(1, SpecificVolume.FromMillicubicMetersPerKilogram(cubicmeterperkilogram.MillicubicMetersPerKilogram).CubicMetersPerKilogram, MillicubicMetersPerKilogramTolerance); } [Fact] public void ArithmeticOperators() { - SpecificVolume v = SpecificVolume.FromCubicMetersPerKilogram(1); + SpecificVolume v = SpecificVolume.FromCubicMetersPerKilogram(1); AssertEx.EqualTolerance(-1, -v.CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); - AssertEx.EqualTolerance(2, (SpecificVolume.FromCubicMetersPerKilogram(3)-v).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); + AssertEx.EqualTolerance(2, (SpecificVolume.FromCubicMetersPerKilogram(3)-v).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); AssertEx.EqualTolerance(2, (v + v).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); AssertEx.EqualTolerance(10, (v*10).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); AssertEx.EqualTolerance(10, (10*v).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); - AssertEx.EqualTolerance(2, (SpecificVolume.FromCubicMetersPerKilogram(10)/5).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); - AssertEx.EqualTolerance(2, SpecificVolume.FromCubicMetersPerKilogram(10)/SpecificVolume.FromCubicMetersPerKilogram(5), CubicMetersPerKilogramTolerance); + AssertEx.EqualTolerance(2, (SpecificVolume.FromCubicMetersPerKilogram(10)/5).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); + AssertEx.EqualTolerance(2, SpecificVolume.FromCubicMetersPerKilogram(10)/SpecificVolume.FromCubicMetersPerKilogram(5), CubicMetersPerKilogramTolerance); } [Fact] public void ComparisonOperators() { - SpecificVolume oneCubicMeterPerKilogram = SpecificVolume.FromCubicMetersPerKilogram(1); - SpecificVolume twoCubicMetersPerKilogram = SpecificVolume.FromCubicMetersPerKilogram(2); + SpecificVolume oneCubicMeterPerKilogram = SpecificVolume.FromCubicMetersPerKilogram(1); + SpecificVolume twoCubicMetersPerKilogram = SpecificVolume.FromCubicMetersPerKilogram(2); Assert.True(oneCubicMeterPerKilogram < twoCubicMetersPerKilogram); Assert.True(oneCubicMeterPerKilogram <= twoCubicMetersPerKilogram); @@ -162,31 +162,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); + SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); Assert.Equal(0, cubicmeterperkilogram.CompareTo(cubicmeterperkilogram)); - Assert.True(cubicmeterperkilogram.CompareTo(SpecificVolume.Zero) > 0); - Assert.True(SpecificVolume.Zero.CompareTo(cubicmeterperkilogram) < 0); + Assert.True(cubicmeterperkilogram.CompareTo(SpecificVolume.Zero) > 0); + Assert.True(SpecificVolume.Zero.CompareTo(cubicmeterperkilogram) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); + SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); Assert.Throws(() => cubicmeterperkilogram.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); + SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); Assert.Throws(() => cubicmeterperkilogram.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = SpecificVolume.FromCubicMetersPerKilogram(1); - var b = SpecificVolume.FromCubicMetersPerKilogram(2); + var a = SpecificVolume.FromCubicMetersPerKilogram(1); + var b = SpecificVolume.FromCubicMetersPerKilogram(2); // ReSharper disable EqualExpressionComparison @@ -205,8 +205,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = SpecificVolume.FromCubicMetersPerKilogram(1); - var b = SpecificVolume.FromCubicMetersPerKilogram(2); + var a = SpecificVolume.FromCubicMetersPerKilogram(1); + var b = SpecificVolume.FromCubicMetersPerKilogram(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -216,29 +216,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = SpecificVolume.FromCubicMetersPerKilogram(1); - Assert.True(v.Equals(SpecificVolume.FromCubicMetersPerKilogram(1), CubicMetersPerKilogramTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(SpecificVolume.Zero, CubicMetersPerKilogramTolerance, ComparisonType.Relative)); + var v = SpecificVolume.FromCubicMetersPerKilogram(1); + Assert.True(v.Equals(SpecificVolume.FromCubicMetersPerKilogram(1), CubicMetersPerKilogramTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(SpecificVolume.Zero, CubicMetersPerKilogramTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); + SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); Assert.False(cubicmeterperkilogram.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); + SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); Assert.False(cubicmeterperkilogram.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(SpecificVolumeUnit.Undefined, SpecificVolume.Units); + Assert.DoesNotContain(SpecificVolumeUnit.Undefined, SpecificVolume.Units); } [Fact] @@ -257,7 +257,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(SpecificVolume.BaseDimensions is null); + Assert.False(SpecificVolume.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs index e50be4ed3f..db376262e3 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs @@ -75,26 +75,26 @@ public abstract partial class SpecificWeightTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new SpecificWeight((double)0.0, SpecificWeightUnit.Undefined)); + Assert.Throws(() => new SpecificWeight((double)0.0, SpecificWeightUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new SpecificWeight(double.PositiveInfinity, SpecificWeightUnit.NewtonPerCubicMeter)); - Assert.Throws(() => new SpecificWeight(double.NegativeInfinity, SpecificWeightUnit.NewtonPerCubicMeter)); + Assert.Throws(() => new SpecificWeight(double.PositiveInfinity, SpecificWeightUnit.NewtonPerCubicMeter)); + Assert.Throws(() => new SpecificWeight(double.NegativeInfinity, SpecificWeightUnit.NewtonPerCubicMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new SpecificWeight(double.NaN, SpecificWeightUnit.NewtonPerCubicMeter)); + Assert.Throws(() => new SpecificWeight(double.NaN, SpecificWeightUnit.NewtonPerCubicMeter)); } [Fact] public void NewtonPerCubicMeterToSpecificWeightUnits() { - SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); + SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); AssertEx.EqualTolerance(KilogramsForcePerCubicCentimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.KilogramsForcePerCubicCentimeter, KilogramsForcePerCubicCentimeterTolerance); AssertEx.EqualTolerance(KilogramsForcePerCubicMeterInOneNewtonPerCubicMeter, newtonpercubicmeter.KilogramsForcePerCubicMeter, KilogramsForcePerCubicMeterTolerance); AssertEx.EqualTolerance(KilogramsForcePerCubicMillimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.KilogramsForcePerCubicMillimeter, KilogramsForcePerCubicMillimeterTolerance); @@ -117,42 +117,42 @@ public void NewtonPerCubicMeterToSpecificWeightUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilogramForcePerCubicCentimeter).KilogramsForcePerCubicCentimeter, KilogramsForcePerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilogramForcePerCubicMeter).KilogramsForcePerCubicMeter, KilogramsForcePerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilogramForcePerCubicMillimeter).KilogramsForcePerCubicMillimeter, KilogramsForcePerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilonewtonPerCubicCentimeter).KilonewtonsPerCubicCentimeter, KilonewtonsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilonewtonPerCubicMeter).KilonewtonsPerCubicMeter, KilonewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilonewtonPerCubicMillimeter).KilonewtonsPerCubicMillimeter, KilonewtonsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilopoundForcePerCubicFoot).KilopoundsForcePerCubicFoot, KilopoundsForcePerCubicFootTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilopoundForcePerCubicInch).KilopoundsForcePerCubicInch, KilopoundsForcePerCubicInchTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.MeganewtonPerCubicMeter).MeganewtonsPerCubicMeter, MeganewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.NewtonPerCubicCentimeter).NewtonsPerCubicCentimeter, NewtonsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.NewtonPerCubicMeter).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.NewtonPerCubicMillimeter).NewtonsPerCubicMillimeter, NewtonsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.PoundForcePerCubicFoot).PoundsForcePerCubicFoot, PoundsForcePerCubicFootTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.PoundForcePerCubicInch).PoundsForcePerCubicInch, PoundsForcePerCubicInchTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.TonneForcePerCubicCentimeter).TonnesForcePerCubicCentimeter, TonnesForcePerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.TonneForcePerCubicMeter).TonnesForcePerCubicMeter, TonnesForcePerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.TonneForcePerCubicMillimeter).TonnesForcePerCubicMillimeter, TonnesForcePerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilogramForcePerCubicCentimeter).KilogramsForcePerCubicCentimeter, KilogramsForcePerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilogramForcePerCubicMeter).KilogramsForcePerCubicMeter, KilogramsForcePerCubicMeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilogramForcePerCubicMillimeter).KilogramsForcePerCubicMillimeter, KilogramsForcePerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilonewtonPerCubicCentimeter).KilonewtonsPerCubicCentimeter, KilonewtonsPerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilonewtonPerCubicMeter).KilonewtonsPerCubicMeter, KilonewtonsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilonewtonPerCubicMillimeter).KilonewtonsPerCubicMillimeter, KilonewtonsPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilopoundForcePerCubicFoot).KilopoundsForcePerCubicFoot, KilopoundsForcePerCubicFootTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilopoundForcePerCubicInch).KilopoundsForcePerCubicInch, KilopoundsForcePerCubicInchTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.MeganewtonPerCubicMeter).MeganewtonsPerCubicMeter, MeganewtonsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.NewtonPerCubicCentimeter).NewtonsPerCubicCentimeter, NewtonsPerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.NewtonPerCubicMeter).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.NewtonPerCubicMillimeter).NewtonsPerCubicMillimeter, NewtonsPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.PoundForcePerCubicFoot).PoundsForcePerCubicFoot, PoundsForcePerCubicFootTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.PoundForcePerCubicInch).PoundsForcePerCubicInch, PoundsForcePerCubicInchTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.TonneForcePerCubicCentimeter).TonnesForcePerCubicCentimeter, TonnesForcePerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.TonneForcePerCubicMeter).TonnesForcePerCubicMeter, TonnesForcePerCubicMeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.TonneForcePerCubicMillimeter).TonnesForcePerCubicMillimeter, TonnesForcePerCubicMillimeterTolerance); } [Fact] public void FromNewtonsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.NegativeInfinity)); + Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.PositiveInfinity)); + Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.NegativeInfinity)); } [Fact] public void FromNewtonsPerCubicMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.NaN)); + Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.NaN)); } [Fact] public void As() { - var newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); + var newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); AssertEx.EqualTolerance(KilogramsForcePerCubicCentimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.KilogramForcePerCubicCentimeter), KilogramsForcePerCubicCentimeterTolerance); AssertEx.EqualTolerance(KilogramsForcePerCubicMeterInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.KilogramForcePerCubicMeter), KilogramsForcePerCubicMeterTolerance); AssertEx.EqualTolerance(KilogramsForcePerCubicMillimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.KilogramForcePerCubicMillimeter), KilogramsForcePerCubicMillimeterTolerance); @@ -175,7 +175,7 @@ public void As() [Fact] public void ToUnit() { - var newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); + var newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); var kilogramforcepercubiccentimeterQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.KilogramForcePerCubicCentimeter); AssertEx.EqualTolerance(KilogramsForcePerCubicCentimeterInOneNewtonPerCubicMeter, (double)kilogramforcepercubiccentimeterQuantity.Value, KilogramsForcePerCubicCentimeterTolerance); @@ -249,44 +249,44 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); - AssertEx.EqualTolerance(1, SpecificWeight.FromKilogramsForcePerCubicCentimeter(newtonpercubicmeter.KilogramsForcePerCubicCentimeter).NewtonsPerCubicMeter, KilogramsForcePerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromKilogramsForcePerCubicMeter(newtonpercubicmeter.KilogramsForcePerCubicMeter).NewtonsPerCubicMeter, KilogramsForcePerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromKilogramsForcePerCubicMillimeter(newtonpercubicmeter.KilogramsForcePerCubicMillimeter).NewtonsPerCubicMeter, KilogramsForcePerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromKilonewtonsPerCubicCentimeter(newtonpercubicmeter.KilonewtonsPerCubicCentimeter).NewtonsPerCubicMeter, KilonewtonsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromKilonewtonsPerCubicMeter(newtonpercubicmeter.KilonewtonsPerCubicMeter).NewtonsPerCubicMeter, KilonewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromKilonewtonsPerCubicMillimeter(newtonpercubicmeter.KilonewtonsPerCubicMillimeter).NewtonsPerCubicMeter, KilonewtonsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromKilopoundsForcePerCubicFoot(newtonpercubicmeter.KilopoundsForcePerCubicFoot).NewtonsPerCubicMeter, KilopoundsForcePerCubicFootTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromKilopoundsForcePerCubicInch(newtonpercubicmeter.KilopoundsForcePerCubicInch).NewtonsPerCubicMeter, KilopoundsForcePerCubicInchTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromMeganewtonsPerCubicMeter(newtonpercubicmeter.MeganewtonsPerCubicMeter).NewtonsPerCubicMeter, MeganewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromNewtonsPerCubicCentimeter(newtonpercubicmeter.NewtonsPerCubicCentimeter).NewtonsPerCubicMeter, NewtonsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromNewtonsPerCubicMeter(newtonpercubicmeter.NewtonsPerCubicMeter).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromNewtonsPerCubicMillimeter(newtonpercubicmeter.NewtonsPerCubicMillimeter).NewtonsPerCubicMeter, NewtonsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromPoundsForcePerCubicFoot(newtonpercubicmeter.PoundsForcePerCubicFoot).NewtonsPerCubicMeter, PoundsForcePerCubicFootTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromPoundsForcePerCubicInch(newtonpercubicmeter.PoundsForcePerCubicInch).NewtonsPerCubicMeter, PoundsForcePerCubicInchTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromTonnesForcePerCubicCentimeter(newtonpercubicmeter.TonnesForcePerCubicCentimeter).NewtonsPerCubicMeter, TonnesForcePerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromTonnesForcePerCubicMeter(newtonpercubicmeter.TonnesForcePerCubicMeter).NewtonsPerCubicMeter, TonnesForcePerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromTonnesForcePerCubicMillimeter(newtonpercubicmeter.TonnesForcePerCubicMillimeter).NewtonsPerCubicMeter, TonnesForcePerCubicMillimeterTolerance); + SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); + AssertEx.EqualTolerance(1, SpecificWeight.FromKilogramsForcePerCubicCentimeter(newtonpercubicmeter.KilogramsForcePerCubicCentimeter).NewtonsPerCubicMeter, KilogramsForcePerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.FromKilogramsForcePerCubicMeter(newtonpercubicmeter.KilogramsForcePerCubicMeter).NewtonsPerCubicMeter, KilogramsForcePerCubicMeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.FromKilogramsForcePerCubicMillimeter(newtonpercubicmeter.KilogramsForcePerCubicMillimeter).NewtonsPerCubicMeter, KilogramsForcePerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.FromKilonewtonsPerCubicCentimeter(newtonpercubicmeter.KilonewtonsPerCubicCentimeter).NewtonsPerCubicMeter, KilonewtonsPerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.FromKilonewtonsPerCubicMeter(newtonpercubicmeter.KilonewtonsPerCubicMeter).NewtonsPerCubicMeter, KilonewtonsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.FromKilonewtonsPerCubicMillimeter(newtonpercubicmeter.KilonewtonsPerCubicMillimeter).NewtonsPerCubicMeter, KilonewtonsPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.FromKilopoundsForcePerCubicFoot(newtonpercubicmeter.KilopoundsForcePerCubicFoot).NewtonsPerCubicMeter, KilopoundsForcePerCubicFootTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.FromKilopoundsForcePerCubicInch(newtonpercubicmeter.KilopoundsForcePerCubicInch).NewtonsPerCubicMeter, KilopoundsForcePerCubicInchTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.FromMeganewtonsPerCubicMeter(newtonpercubicmeter.MeganewtonsPerCubicMeter).NewtonsPerCubicMeter, MeganewtonsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.FromNewtonsPerCubicCentimeter(newtonpercubicmeter.NewtonsPerCubicCentimeter).NewtonsPerCubicMeter, NewtonsPerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.FromNewtonsPerCubicMeter(newtonpercubicmeter.NewtonsPerCubicMeter).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.FromNewtonsPerCubicMillimeter(newtonpercubicmeter.NewtonsPerCubicMillimeter).NewtonsPerCubicMeter, NewtonsPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.FromPoundsForcePerCubicFoot(newtonpercubicmeter.PoundsForcePerCubicFoot).NewtonsPerCubicMeter, PoundsForcePerCubicFootTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.FromPoundsForcePerCubicInch(newtonpercubicmeter.PoundsForcePerCubicInch).NewtonsPerCubicMeter, PoundsForcePerCubicInchTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.FromTonnesForcePerCubicCentimeter(newtonpercubicmeter.TonnesForcePerCubicCentimeter).NewtonsPerCubicMeter, TonnesForcePerCubicCentimeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.FromTonnesForcePerCubicMeter(newtonpercubicmeter.TonnesForcePerCubicMeter).NewtonsPerCubicMeter, TonnesForcePerCubicMeterTolerance); + AssertEx.EqualTolerance(1, SpecificWeight.FromTonnesForcePerCubicMillimeter(newtonpercubicmeter.TonnesForcePerCubicMillimeter).NewtonsPerCubicMeter, TonnesForcePerCubicMillimeterTolerance); } [Fact] public void ArithmeticOperators() { - SpecificWeight v = SpecificWeight.FromNewtonsPerCubicMeter(1); + SpecificWeight v = SpecificWeight.FromNewtonsPerCubicMeter(1); AssertEx.EqualTolerance(-1, -v.NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (SpecificWeight.FromNewtonsPerCubicMeter(3)-v).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, (SpecificWeight.FromNewtonsPerCubicMeter(3)-v).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); AssertEx.EqualTolerance(2, (v + v).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); AssertEx.EqualTolerance(10, (v*10).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); AssertEx.EqualTolerance(10, (10*v).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (SpecificWeight.FromNewtonsPerCubicMeter(10)/5).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, SpecificWeight.FromNewtonsPerCubicMeter(10)/SpecificWeight.FromNewtonsPerCubicMeter(5), NewtonsPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, (SpecificWeight.FromNewtonsPerCubicMeter(10)/5).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); + AssertEx.EqualTolerance(2, SpecificWeight.FromNewtonsPerCubicMeter(10)/SpecificWeight.FromNewtonsPerCubicMeter(5), NewtonsPerCubicMeterTolerance); } [Fact] public void ComparisonOperators() { - SpecificWeight oneNewtonPerCubicMeter = SpecificWeight.FromNewtonsPerCubicMeter(1); - SpecificWeight twoNewtonsPerCubicMeter = SpecificWeight.FromNewtonsPerCubicMeter(2); + SpecificWeight oneNewtonPerCubicMeter = SpecificWeight.FromNewtonsPerCubicMeter(1); + SpecificWeight twoNewtonsPerCubicMeter = SpecificWeight.FromNewtonsPerCubicMeter(2); Assert.True(oneNewtonPerCubicMeter < twoNewtonsPerCubicMeter); Assert.True(oneNewtonPerCubicMeter <= twoNewtonsPerCubicMeter); @@ -302,31 +302,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); + SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); Assert.Equal(0, newtonpercubicmeter.CompareTo(newtonpercubicmeter)); - Assert.True(newtonpercubicmeter.CompareTo(SpecificWeight.Zero) > 0); - Assert.True(SpecificWeight.Zero.CompareTo(newtonpercubicmeter) < 0); + Assert.True(newtonpercubicmeter.CompareTo(SpecificWeight.Zero) > 0); + Assert.True(SpecificWeight.Zero.CompareTo(newtonpercubicmeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); + SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); Assert.Throws(() => newtonpercubicmeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); + SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); Assert.Throws(() => newtonpercubicmeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = SpecificWeight.FromNewtonsPerCubicMeter(1); - var b = SpecificWeight.FromNewtonsPerCubicMeter(2); + var a = SpecificWeight.FromNewtonsPerCubicMeter(1); + var b = SpecificWeight.FromNewtonsPerCubicMeter(2); // ReSharper disable EqualExpressionComparison @@ -345,8 +345,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = SpecificWeight.FromNewtonsPerCubicMeter(1); - var b = SpecificWeight.FromNewtonsPerCubicMeter(2); + var a = SpecificWeight.FromNewtonsPerCubicMeter(1); + var b = SpecificWeight.FromNewtonsPerCubicMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -356,29 +356,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = SpecificWeight.FromNewtonsPerCubicMeter(1); - Assert.True(v.Equals(SpecificWeight.FromNewtonsPerCubicMeter(1), NewtonsPerCubicMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(SpecificWeight.Zero, NewtonsPerCubicMeterTolerance, ComparisonType.Relative)); + var v = SpecificWeight.FromNewtonsPerCubicMeter(1); + Assert.True(v.Equals(SpecificWeight.FromNewtonsPerCubicMeter(1), NewtonsPerCubicMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(SpecificWeight.Zero, NewtonsPerCubicMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); + SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); Assert.False(newtonpercubicmeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); + SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); Assert.False(newtonpercubicmeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(SpecificWeightUnit.Undefined, SpecificWeight.Units); + Assert.DoesNotContain(SpecificWeightUnit.Undefined, SpecificWeight.Units); } [Fact] @@ -397,7 +397,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(SpecificWeight.BaseDimensions is null); + Assert.False(SpecificWeight.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs index bc5807b1a0..d8b42a397a 100644 --- a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs @@ -105,26 +105,26 @@ public abstract partial class SpeedTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Speed((double)0.0, SpeedUnit.Undefined)); + Assert.Throws(() => new Speed((double)0.0, SpeedUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Speed(double.PositiveInfinity, SpeedUnit.MeterPerSecond)); - Assert.Throws(() => new Speed(double.NegativeInfinity, SpeedUnit.MeterPerSecond)); + Assert.Throws(() => new Speed(double.PositiveInfinity, SpeedUnit.MeterPerSecond)); + Assert.Throws(() => new Speed(double.NegativeInfinity, SpeedUnit.MeterPerSecond)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Speed(double.NaN, SpeedUnit.MeterPerSecond)); + Assert.Throws(() => new Speed(double.NaN, SpeedUnit.MeterPerSecond)); } [Fact] public void MeterPerSecondToSpeedUnits() { - Speed meterpersecond = Speed.FromMetersPerSecond(1); + Speed meterpersecond = Speed.FromMetersPerSecond(1); AssertEx.EqualTolerance(CentimetersPerHourInOneMeterPerSecond, meterpersecond.CentimetersPerHour, CentimetersPerHourTolerance); AssertEx.EqualTolerance(CentimetersPerMinutesInOneMeterPerSecond, meterpersecond.CentimetersPerMinutes, CentimetersPerMinutesTolerance); AssertEx.EqualTolerance(CentimetersPerSecondInOneMeterPerSecond, meterpersecond.CentimetersPerSecond, CentimetersPerSecondTolerance); @@ -162,57 +162,57 @@ public void MeterPerSecondToSpeedUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.CentimeterPerHour).CentimetersPerHour, CentimetersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.CentimeterPerMinute).CentimetersPerMinutes, CentimetersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.CentimeterPerSecond).CentimetersPerSecond, CentimetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.DecimeterPerMinute).DecimetersPerMinutes, DecimetersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.DecimeterPerSecond).DecimetersPerSecond, DecimetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.FootPerHour).FeetPerHour, FeetPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.FootPerMinute).FeetPerMinute, FeetPerMinuteTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.FootPerSecond).FeetPerSecond, FeetPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.InchPerHour).InchesPerHour, InchesPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.InchPerMinute).InchesPerMinute, InchesPerMinuteTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.InchPerSecond).InchesPerSecond, InchesPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.KilometerPerHour).KilometersPerHour, KilometersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.KilometerPerMinute).KilometersPerMinutes, KilometersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.KilometerPerSecond).KilometersPerSecond, KilometersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.Knot).Knots, KnotsTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MeterPerHour).MetersPerHour, MetersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MeterPerMinute).MetersPerMinutes, MetersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MeterPerSecond).MetersPerSecond, MetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MicrometerPerMinute).MicrometersPerMinutes, MicrometersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MicrometerPerSecond).MicrometersPerSecond, MicrometersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MilePerHour).MilesPerHour, MilesPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MillimeterPerHour).MillimetersPerHour, MillimetersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MillimeterPerMinute).MillimetersPerMinutes, MillimetersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MillimeterPerSecond).MillimetersPerSecond, MillimetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.NanometerPerMinute).NanometersPerMinutes, NanometersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.NanometerPerSecond).NanometersPerSecond, NanometersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.UsSurveyFootPerHour).UsSurveyFeetPerHour, UsSurveyFeetPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.UsSurveyFootPerMinute).UsSurveyFeetPerMinute, UsSurveyFeetPerMinuteTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.UsSurveyFootPerSecond).UsSurveyFeetPerSecond, UsSurveyFeetPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.YardPerHour).YardsPerHour, YardsPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.YardPerMinute).YardsPerMinute, YardsPerMinuteTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.YardPerSecond).YardsPerSecond, YardsPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.CentimeterPerHour).CentimetersPerHour, CentimetersPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.CentimeterPerMinute).CentimetersPerMinutes, CentimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.CentimeterPerSecond).CentimetersPerSecond, CentimetersPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.DecimeterPerMinute).DecimetersPerMinutes, DecimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.DecimeterPerSecond).DecimetersPerSecond, DecimetersPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.FootPerHour).FeetPerHour, FeetPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.FootPerMinute).FeetPerMinute, FeetPerMinuteTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.FootPerSecond).FeetPerSecond, FeetPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.InchPerHour).InchesPerHour, InchesPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.InchPerMinute).InchesPerMinute, InchesPerMinuteTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.InchPerSecond).InchesPerSecond, InchesPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.KilometerPerHour).KilometersPerHour, KilometersPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.KilometerPerMinute).KilometersPerMinutes, KilometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.KilometerPerSecond).KilometersPerSecond, KilometersPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.Knot).Knots, KnotsTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MeterPerHour).MetersPerHour, MetersPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MeterPerMinute).MetersPerMinutes, MetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MeterPerSecond).MetersPerSecond, MetersPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MicrometerPerMinute).MicrometersPerMinutes, MicrometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MicrometerPerSecond).MicrometersPerSecond, MicrometersPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MilePerHour).MilesPerHour, MilesPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MillimeterPerHour).MillimetersPerHour, MillimetersPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MillimeterPerMinute).MillimetersPerMinutes, MillimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MillimeterPerSecond).MillimetersPerSecond, MillimetersPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.NanometerPerMinute).NanometersPerMinutes, NanometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.NanometerPerSecond).NanometersPerSecond, NanometersPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.UsSurveyFootPerHour).UsSurveyFeetPerHour, UsSurveyFeetPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.UsSurveyFootPerMinute).UsSurveyFeetPerMinute, UsSurveyFeetPerMinuteTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.UsSurveyFootPerSecond).UsSurveyFeetPerSecond, UsSurveyFeetPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.YardPerHour).YardsPerHour, YardsPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.YardPerMinute).YardsPerMinute, YardsPerMinuteTolerance); + AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.YardPerSecond).YardsPerSecond, YardsPerSecondTolerance); } [Fact] public void FromMetersPerSecond_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Speed.FromMetersPerSecond(double.PositiveInfinity)); - Assert.Throws(() => Speed.FromMetersPerSecond(double.NegativeInfinity)); + Assert.Throws(() => Speed.FromMetersPerSecond(double.PositiveInfinity)); + Assert.Throws(() => Speed.FromMetersPerSecond(double.NegativeInfinity)); } [Fact] public void FromMetersPerSecond_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Speed.FromMetersPerSecond(double.NaN)); + Assert.Throws(() => Speed.FromMetersPerSecond(double.NaN)); } [Fact] public void As() { - var meterpersecond = Speed.FromMetersPerSecond(1); + var meterpersecond = Speed.FromMetersPerSecond(1); AssertEx.EqualTolerance(CentimetersPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.CentimeterPerHour), CentimetersPerHourTolerance); AssertEx.EqualTolerance(CentimetersPerMinutesInOneMeterPerSecond, meterpersecond.As(SpeedUnit.CentimeterPerMinute), CentimetersPerMinutesTolerance); AssertEx.EqualTolerance(CentimetersPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.CentimeterPerSecond), CentimetersPerSecondTolerance); @@ -250,7 +250,7 @@ public void As() [Fact] public void ToUnit() { - var meterpersecond = Speed.FromMetersPerSecond(1); + var meterpersecond = Speed.FromMetersPerSecond(1); var centimeterperhourQuantity = meterpersecond.ToUnit(SpeedUnit.CentimeterPerHour); AssertEx.EqualTolerance(CentimetersPerHourInOneMeterPerSecond, (double)centimeterperhourQuantity.Value, CentimetersPerHourTolerance); @@ -384,59 +384,59 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Speed meterpersecond = Speed.FromMetersPerSecond(1); - AssertEx.EqualTolerance(1, Speed.FromCentimetersPerHour(meterpersecond.CentimetersPerHour).MetersPerSecond, CentimetersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromCentimetersPerMinutes(meterpersecond.CentimetersPerMinutes).MetersPerSecond, CentimetersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.FromCentimetersPerSecond(meterpersecond.CentimetersPerSecond).MetersPerSecond, CentimetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromDecimetersPerMinutes(meterpersecond.DecimetersPerMinutes).MetersPerSecond, DecimetersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.FromDecimetersPerSecond(meterpersecond.DecimetersPerSecond).MetersPerSecond, DecimetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromFeetPerHour(meterpersecond.FeetPerHour).MetersPerSecond, FeetPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromFeetPerMinute(meterpersecond.FeetPerMinute).MetersPerSecond, FeetPerMinuteTolerance); - AssertEx.EqualTolerance(1, Speed.FromFeetPerSecond(meterpersecond.FeetPerSecond).MetersPerSecond, FeetPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromInchesPerHour(meterpersecond.InchesPerHour).MetersPerSecond, InchesPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromInchesPerMinute(meterpersecond.InchesPerMinute).MetersPerSecond, InchesPerMinuteTolerance); - AssertEx.EqualTolerance(1, Speed.FromInchesPerSecond(meterpersecond.InchesPerSecond).MetersPerSecond, InchesPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromKilometersPerHour(meterpersecond.KilometersPerHour).MetersPerSecond, KilometersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromKilometersPerMinutes(meterpersecond.KilometersPerMinutes).MetersPerSecond, KilometersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.FromKilometersPerSecond(meterpersecond.KilometersPerSecond).MetersPerSecond, KilometersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromKnots(meterpersecond.Knots).MetersPerSecond, KnotsTolerance); - AssertEx.EqualTolerance(1, Speed.FromMetersPerHour(meterpersecond.MetersPerHour).MetersPerSecond, MetersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromMetersPerMinutes(meterpersecond.MetersPerMinutes).MetersPerSecond, MetersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.FromMetersPerSecond(meterpersecond.MetersPerSecond).MetersPerSecond, MetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromMicrometersPerMinutes(meterpersecond.MicrometersPerMinutes).MetersPerSecond, MicrometersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.FromMicrometersPerSecond(meterpersecond.MicrometersPerSecond).MetersPerSecond, MicrometersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromMilesPerHour(meterpersecond.MilesPerHour).MetersPerSecond, MilesPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromMillimetersPerHour(meterpersecond.MillimetersPerHour).MetersPerSecond, MillimetersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromMillimetersPerMinutes(meterpersecond.MillimetersPerMinutes).MetersPerSecond, MillimetersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.FromMillimetersPerSecond(meterpersecond.MillimetersPerSecond).MetersPerSecond, MillimetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromNanometersPerMinutes(meterpersecond.NanometersPerMinutes).MetersPerSecond, NanometersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.FromNanometersPerSecond(meterpersecond.NanometersPerSecond).MetersPerSecond, NanometersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromUsSurveyFeetPerHour(meterpersecond.UsSurveyFeetPerHour).MetersPerSecond, UsSurveyFeetPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromUsSurveyFeetPerMinute(meterpersecond.UsSurveyFeetPerMinute).MetersPerSecond, UsSurveyFeetPerMinuteTolerance); - AssertEx.EqualTolerance(1, Speed.FromUsSurveyFeetPerSecond(meterpersecond.UsSurveyFeetPerSecond).MetersPerSecond, UsSurveyFeetPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromYardsPerHour(meterpersecond.YardsPerHour).MetersPerSecond, YardsPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromYardsPerMinute(meterpersecond.YardsPerMinute).MetersPerSecond, YardsPerMinuteTolerance); - AssertEx.EqualTolerance(1, Speed.FromYardsPerSecond(meterpersecond.YardsPerSecond).MetersPerSecond, YardsPerSecondTolerance); + Speed meterpersecond = Speed.FromMetersPerSecond(1); + AssertEx.EqualTolerance(1, Speed.FromCentimetersPerHour(meterpersecond.CentimetersPerHour).MetersPerSecond, CentimetersPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.FromCentimetersPerMinutes(meterpersecond.CentimetersPerMinutes).MetersPerSecond, CentimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.FromCentimetersPerSecond(meterpersecond.CentimetersPerSecond).MetersPerSecond, CentimetersPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.FromDecimetersPerMinutes(meterpersecond.DecimetersPerMinutes).MetersPerSecond, DecimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.FromDecimetersPerSecond(meterpersecond.DecimetersPerSecond).MetersPerSecond, DecimetersPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.FromFeetPerHour(meterpersecond.FeetPerHour).MetersPerSecond, FeetPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.FromFeetPerMinute(meterpersecond.FeetPerMinute).MetersPerSecond, FeetPerMinuteTolerance); + AssertEx.EqualTolerance(1, Speed.FromFeetPerSecond(meterpersecond.FeetPerSecond).MetersPerSecond, FeetPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.FromInchesPerHour(meterpersecond.InchesPerHour).MetersPerSecond, InchesPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.FromInchesPerMinute(meterpersecond.InchesPerMinute).MetersPerSecond, InchesPerMinuteTolerance); + AssertEx.EqualTolerance(1, Speed.FromInchesPerSecond(meterpersecond.InchesPerSecond).MetersPerSecond, InchesPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.FromKilometersPerHour(meterpersecond.KilometersPerHour).MetersPerSecond, KilometersPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.FromKilometersPerMinutes(meterpersecond.KilometersPerMinutes).MetersPerSecond, KilometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.FromKilometersPerSecond(meterpersecond.KilometersPerSecond).MetersPerSecond, KilometersPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.FromKnots(meterpersecond.Knots).MetersPerSecond, KnotsTolerance); + AssertEx.EqualTolerance(1, Speed.FromMetersPerHour(meterpersecond.MetersPerHour).MetersPerSecond, MetersPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.FromMetersPerMinutes(meterpersecond.MetersPerMinutes).MetersPerSecond, MetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.FromMetersPerSecond(meterpersecond.MetersPerSecond).MetersPerSecond, MetersPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.FromMicrometersPerMinutes(meterpersecond.MicrometersPerMinutes).MetersPerSecond, MicrometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.FromMicrometersPerSecond(meterpersecond.MicrometersPerSecond).MetersPerSecond, MicrometersPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.FromMilesPerHour(meterpersecond.MilesPerHour).MetersPerSecond, MilesPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.FromMillimetersPerHour(meterpersecond.MillimetersPerHour).MetersPerSecond, MillimetersPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.FromMillimetersPerMinutes(meterpersecond.MillimetersPerMinutes).MetersPerSecond, MillimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.FromMillimetersPerSecond(meterpersecond.MillimetersPerSecond).MetersPerSecond, MillimetersPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.FromNanometersPerMinutes(meterpersecond.NanometersPerMinutes).MetersPerSecond, NanometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.FromNanometersPerSecond(meterpersecond.NanometersPerSecond).MetersPerSecond, NanometersPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.FromUsSurveyFeetPerHour(meterpersecond.UsSurveyFeetPerHour).MetersPerSecond, UsSurveyFeetPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.FromUsSurveyFeetPerMinute(meterpersecond.UsSurveyFeetPerMinute).MetersPerSecond, UsSurveyFeetPerMinuteTolerance); + AssertEx.EqualTolerance(1, Speed.FromUsSurveyFeetPerSecond(meterpersecond.UsSurveyFeetPerSecond).MetersPerSecond, UsSurveyFeetPerSecondTolerance); + AssertEx.EqualTolerance(1, Speed.FromYardsPerHour(meterpersecond.YardsPerHour).MetersPerSecond, YardsPerHourTolerance); + AssertEx.EqualTolerance(1, Speed.FromYardsPerMinute(meterpersecond.YardsPerMinute).MetersPerSecond, YardsPerMinuteTolerance); + AssertEx.EqualTolerance(1, Speed.FromYardsPerSecond(meterpersecond.YardsPerSecond).MetersPerSecond, YardsPerSecondTolerance); } [Fact] public void ArithmeticOperators() { - Speed v = Speed.FromMetersPerSecond(1); + Speed v = Speed.FromMetersPerSecond(1); AssertEx.EqualTolerance(-1, -v.MetersPerSecond, MetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (Speed.FromMetersPerSecond(3)-v).MetersPerSecond, MetersPerSecondTolerance); + AssertEx.EqualTolerance(2, (Speed.FromMetersPerSecond(3)-v).MetersPerSecond, MetersPerSecondTolerance); AssertEx.EqualTolerance(2, (v + v).MetersPerSecond, MetersPerSecondTolerance); AssertEx.EqualTolerance(10, (v*10).MetersPerSecond, MetersPerSecondTolerance); AssertEx.EqualTolerance(10, (10*v).MetersPerSecond, MetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (Speed.FromMetersPerSecond(10)/5).MetersPerSecond, MetersPerSecondTolerance); - AssertEx.EqualTolerance(2, Speed.FromMetersPerSecond(10)/Speed.FromMetersPerSecond(5), MetersPerSecondTolerance); + AssertEx.EqualTolerance(2, (Speed.FromMetersPerSecond(10)/5).MetersPerSecond, MetersPerSecondTolerance); + AssertEx.EqualTolerance(2, Speed.FromMetersPerSecond(10)/Speed.FromMetersPerSecond(5), MetersPerSecondTolerance); } [Fact] public void ComparisonOperators() { - Speed oneMeterPerSecond = Speed.FromMetersPerSecond(1); - Speed twoMetersPerSecond = Speed.FromMetersPerSecond(2); + Speed oneMeterPerSecond = Speed.FromMetersPerSecond(1); + Speed twoMetersPerSecond = Speed.FromMetersPerSecond(2); Assert.True(oneMeterPerSecond < twoMetersPerSecond); Assert.True(oneMeterPerSecond <= twoMetersPerSecond); @@ -452,31 +452,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Speed meterpersecond = Speed.FromMetersPerSecond(1); + Speed meterpersecond = Speed.FromMetersPerSecond(1); Assert.Equal(0, meterpersecond.CompareTo(meterpersecond)); - Assert.True(meterpersecond.CompareTo(Speed.Zero) > 0); - Assert.True(Speed.Zero.CompareTo(meterpersecond) < 0); + Assert.True(meterpersecond.CompareTo(Speed.Zero) > 0); + Assert.True(Speed.Zero.CompareTo(meterpersecond) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Speed meterpersecond = Speed.FromMetersPerSecond(1); + Speed meterpersecond = Speed.FromMetersPerSecond(1); Assert.Throws(() => meterpersecond.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Speed meterpersecond = Speed.FromMetersPerSecond(1); + Speed meterpersecond = Speed.FromMetersPerSecond(1); Assert.Throws(() => meterpersecond.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Speed.FromMetersPerSecond(1); - var b = Speed.FromMetersPerSecond(2); + var a = Speed.FromMetersPerSecond(1); + var b = Speed.FromMetersPerSecond(2); // ReSharper disable EqualExpressionComparison @@ -495,8 +495,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Speed.FromMetersPerSecond(1); - var b = Speed.FromMetersPerSecond(2); + var a = Speed.FromMetersPerSecond(1); + var b = Speed.FromMetersPerSecond(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -506,29 +506,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Speed.FromMetersPerSecond(1); - Assert.True(v.Equals(Speed.FromMetersPerSecond(1), MetersPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Speed.Zero, MetersPerSecondTolerance, ComparisonType.Relative)); + var v = Speed.FromMetersPerSecond(1); + Assert.True(v.Equals(Speed.FromMetersPerSecond(1), MetersPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Speed.Zero, MetersPerSecondTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Speed meterpersecond = Speed.FromMetersPerSecond(1); + Speed meterpersecond = Speed.FromMetersPerSecond(1); Assert.False(meterpersecond.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Speed meterpersecond = Speed.FromMetersPerSecond(1); + Speed meterpersecond = Speed.FromMetersPerSecond(1); Assert.False(meterpersecond.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(SpeedUnit.Undefined, Speed.Units); + Assert.DoesNotContain(SpeedUnit.Undefined, Speed.Units); } [Fact] @@ -547,7 +547,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Speed.BaseDimensions is null); + Assert.False(Speed.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs index 35fa628185..827ae58334 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs @@ -61,26 +61,26 @@ public abstract partial class TemperatureChangeRateTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new TemperatureChangeRate((double)0.0, TemperatureChangeRateUnit.Undefined)); + Assert.Throws(() => new TemperatureChangeRate((double)0.0, TemperatureChangeRateUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new TemperatureChangeRate(double.PositiveInfinity, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); - Assert.Throws(() => new TemperatureChangeRate(double.NegativeInfinity, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); + Assert.Throws(() => new TemperatureChangeRate(double.PositiveInfinity, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); + Assert.Throws(() => new TemperatureChangeRate(double.NegativeInfinity, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new TemperatureChangeRate(double.NaN, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); + Assert.Throws(() => new TemperatureChangeRate(double.NaN, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); } [Fact] public void DegreeCelsiusPerSecondToTemperatureChangeRateUnits() { - TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); + TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); AssertEx.EqualTolerance(CentidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.CentidegreesCelsiusPerSecond, CentidegreesCelsiusPerSecondTolerance); AssertEx.EqualTolerance(DecadegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.DecadegreesCelsiusPerSecond, DecadegreesCelsiusPerSecondTolerance); AssertEx.EqualTolerance(DecidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.DecidegreesCelsiusPerSecond, DecidegreesCelsiusPerSecondTolerance); @@ -96,35 +96,35 @@ public void DegreeCelsiusPerSecondToTemperatureChangeRateUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond).CentidegreesCelsiusPerSecond, CentidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond).DecadegreesCelsiusPerSecond, DecadegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond).DecidegreesCelsiusPerSecond, DecidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.DegreeCelsiusPerMinute).DegreesCelsiusPerMinute, DegreesCelsiusPerMinuteTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.DegreeCelsiusPerSecond).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond).HectodegreesCelsiusPerSecond, HectodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond).KilodegreesCelsiusPerSecond, KilodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond).MicrodegreesCelsiusPerSecond, MicrodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond).MillidegreesCelsiusPerSecond, MillidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond).NanodegreesCelsiusPerSecond, NanodegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond).CentidegreesCelsiusPerSecond, CentidegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond).DecadegreesCelsiusPerSecond, DecadegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond).DecidegreesCelsiusPerSecond, DecidegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.DegreeCelsiusPerMinute).DegreesCelsiusPerMinute, DegreesCelsiusPerMinuteTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.DegreeCelsiusPerSecond).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond).HectodegreesCelsiusPerSecond, HectodegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond).KilodegreesCelsiusPerSecond, KilodegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond).MicrodegreesCelsiusPerSecond, MicrodegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond).MillidegreesCelsiusPerSecond, MillidegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond).NanodegreesCelsiusPerSecond, NanodegreesCelsiusPerSecondTolerance); } [Fact] public void FromDegreesCelsiusPerSecond_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.PositiveInfinity)); - Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.NegativeInfinity)); + Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.PositiveInfinity)); + Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.NegativeInfinity)); } [Fact] public void FromDegreesCelsiusPerSecond_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.NaN)); + Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.NaN)); } [Fact] public void As() { - var degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); + var degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); AssertEx.EqualTolerance(CentidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.As(TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond), CentidegreesCelsiusPerSecondTolerance); AssertEx.EqualTolerance(DecadegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.As(TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond), DecadegreesCelsiusPerSecondTolerance); AssertEx.EqualTolerance(DecidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.As(TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond), DecidegreesCelsiusPerSecondTolerance); @@ -140,7 +140,7 @@ public void As() [Fact] public void ToUnit() { - var degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); + var degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); var centidegreecelsiuspersecondQuantity = degreecelsiuspersecond.ToUnit(TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond); AssertEx.EqualTolerance(CentidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, (double)centidegreecelsiuspersecondQuantity.Value, CentidegreesCelsiusPerSecondTolerance); @@ -186,37 +186,37 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromCentidegreesCelsiusPerSecond(degreecelsiuspersecond.CentidegreesCelsiusPerSecond).DegreesCelsiusPerSecond, CentidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromDecadegreesCelsiusPerSecond(degreecelsiuspersecond.DecadegreesCelsiusPerSecond).DegreesCelsiusPerSecond, DecadegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromDecidegreesCelsiusPerSecond(degreecelsiuspersecond.DecidegreesCelsiusPerSecond).DegreesCelsiusPerSecond, DecidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromDegreesCelsiusPerMinute(degreecelsiuspersecond.DegreesCelsiusPerMinute).DegreesCelsiusPerSecond, DegreesCelsiusPerMinuteTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromDegreesCelsiusPerSecond(degreecelsiuspersecond.DegreesCelsiusPerSecond).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromHectodegreesCelsiusPerSecond(degreecelsiuspersecond.HectodegreesCelsiusPerSecond).DegreesCelsiusPerSecond, HectodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromKilodegreesCelsiusPerSecond(degreecelsiuspersecond.KilodegreesCelsiusPerSecond).DegreesCelsiusPerSecond, KilodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromMicrodegreesCelsiusPerSecond(degreecelsiuspersecond.MicrodegreesCelsiusPerSecond).DegreesCelsiusPerSecond, MicrodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromMillidegreesCelsiusPerSecond(degreecelsiuspersecond.MillidegreesCelsiusPerSecond).DegreesCelsiusPerSecond, MillidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromNanodegreesCelsiusPerSecond(degreecelsiuspersecond.NanodegreesCelsiusPerSecond).DegreesCelsiusPerSecond, NanodegreesCelsiusPerSecondTolerance); + TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); + AssertEx.EqualTolerance(1, TemperatureChangeRate.FromCentidegreesCelsiusPerSecond(degreecelsiuspersecond.CentidegreesCelsiusPerSecond).DegreesCelsiusPerSecond, CentidegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.FromDecadegreesCelsiusPerSecond(degreecelsiuspersecond.DecadegreesCelsiusPerSecond).DegreesCelsiusPerSecond, DecadegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.FromDecidegreesCelsiusPerSecond(degreecelsiuspersecond.DecidegreesCelsiusPerSecond).DegreesCelsiusPerSecond, DecidegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.FromDegreesCelsiusPerMinute(degreecelsiuspersecond.DegreesCelsiusPerMinute).DegreesCelsiusPerSecond, DegreesCelsiusPerMinuteTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.FromDegreesCelsiusPerSecond(degreecelsiuspersecond.DegreesCelsiusPerSecond).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.FromHectodegreesCelsiusPerSecond(degreecelsiuspersecond.HectodegreesCelsiusPerSecond).DegreesCelsiusPerSecond, HectodegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.FromKilodegreesCelsiusPerSecond(degreecelsiuspersecond.KilodegreesCelsiusPerSecond).DegreesCelsiusPerSecond, KilodegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.FromMicrodegreesCelsiusPerSecond(degreecelsiuspersecond.MicrodegreesCelsiusPerSecond).DegreesCelsiusPerSecond, MicrodegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.FromMillidegreesCelsiusPerSecond(degreecelsiuspersecond.MillidegreesCelsiusPerSecond).DegreesCelsiusPerSecond, MillidegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(1, TemperatureChangeRate.FromNanodegreesCelsiusPerSecond(degreecelsiuspersecond.NanodegreesCelsiusPerSecond).DegreesCelsiusPerSecond, NanodegreesCelsiusPerSecondTolerance); } [Fact] public void ArithmeticOperators() { - TemperatureChangeRate v = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); + TemperatureChangeRate v = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); AssertEx.EqualTolerance(-1, -v.DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(2, (TemperatureChangeRate.FromDegreesCelsiusPerSecond(3)-v).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(2, (TemperatureChangeRate.FromDegreesCelsiusPerSecond(3)-v).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); AssertEx.EqualTolerance(2, (v + v).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); AssertEx.EqualTolerance(10, (v*10).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); AssertEx.EqualTolerance(10, (10*v).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(2, (TemperatureChangeRate.FromDegreesCelsiusPerSecond(10)/5).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(2, TemperatureChangeRate.FromDegreesCelsiusPerSecond(10)/TemperatureChangeRate.FromDegreesCelsiusPerSecond(5), DegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(2, (TemperatureChangeRate.FromDegreesCelsiusPerSecond(10)/5).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); + AssertEx.EqualTolerance(2, TemperatureChangeRate.FromDegreesCelsiusPerSecond(10)/TemperatureChangeRate.FromDegreesCelsiusPerSecond(5), DegreesCelsiusPerSecondTolerance); } [Fact] public void ComparisonOperators() { - TemperatureChangeRate oneDegreeCelsiusPerSecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - TemperatureChangeRate twoDegreesCelsiusPerSecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(2); + TemperatureChangeRate oneDegreeCelsiusPerSecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); + TemperatureChangeRate twoDegreesCelsiusPerSecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(2); Assert.True(oneDegreeCelsiusPerSecond < twoDegreesCelsiusPerSecond); Assert.True(oneDegreeCelsiusPerSecond <= twoDegreesCelsiusPerSecond); @@ -232,31 +232,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); + TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); Assert.Equal(0, degreecelsiuspersecond.CompareTo(degreecelsiuspersecond)); - Assert.True(degreecelsiuspersecond.CompareTo(TemperatureChangeRate.Zero) > 0); - Assert.True(TemperatureChangeRate.Zero.CompareTo(degreecelsiuspersecond) < 0); + Assert.True(degreecelsiuspersecond.CompareTo(TemperatureChangeRate.Zero) > 0); + Assert.True(TemperatureChangeRate.Zero.CompareTo(degreecelsiuspersecond) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); + TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); Assert.Throws(() => degreecelsiuspersecond.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); + TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); Assert.Throws(() => degreecelsiuspersecond.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - var b = TemperatureChangeRate.FromDegreesCelsiusPerSecond(2); + var a = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); + var b = TemperatureChangeRate.FromDegreesCelsiusPerSecond(2); // ReSharper disable EqualExpressionComparison @@ -275,8 +275,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - var b = TemperatureChangeRate.FromDegreesCelsiusPerSecond(2); + var a = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); + var b = TemperatureChangeRate.FromDegreesCelsiusPerSecond(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -286,29 +286,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - Assert.True(v.Equals(TemperatureChangeRate.FromDegreesCelsiusPerSecond(1), DegreesCelsiusPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(TemperatureChangeRate.Zero, DegreesCelsiusPerSecondTolerance, ComparisonType.Relative)); + var v = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); + Assert.True(v.Equals(TemperatureChangeRate.FromDegreesCelsiusPerSecond(1), DegreesCelsiusPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(TemperatureChangeRate.Zero, DegreesCelsiusPerSecondTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); + TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); Assert.False(degreecelsiuspersecond.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); + TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); Assert.False(degreecelsiuspersecond.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(TemperatureChangeRateUnit.Undefined, TemperatureChangeRate.Units); + Assert.DoesNotContain(TemperatureChangeRateUnit.Undefined, TemperatureChangeRate.Units); } [Fact] @@ -327,7 +327,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(TemperatureChangeRate.BaseDimensions is null); + Assert.False(TemperatureChangeRate.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs index 101fe4981e..742550405e 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of TemperatureDelta. + /// Test of TemperatureDelta. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class TemperatureDeltaTestsBase @@ -57,26 +57,26 @@ public abstract partial class TemperatureDeltaTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new TemperatureDelta((double)0.0, TemperatureDeltaUnit.Undefined)); + Assert.Throws(() => new TemperatureDelta((double)0.0, TemperatureDeltaUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new TemperatureDelta(double.PositiveInfinity, TemperatureDeltaUnit.Kelvin)); - Assert.Throws(() => new TemperatureDelta(double.NegativeInfinity, TemperatureDeltaUnit.Kelvin)); + Assert.Throws(() => new TemperatureDelta(double.PositiveInfinity, TemperatureDeltaUnit.Kelvin)); + Assert.Throws(() => new TemperatureDelta(double.NegativeInfinity, TemperatureDeltaUnit.Kelvin)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new TemperatureDelta(double.NaN, TemperatureDeltaUnit.Kelvin)); + Assert.Throws(() => new TemperatureDelta(double.NaN, TemperatureDeltaUnit.Kelvin)); } [Fact] public void KelvinToTemperatureDeltaUnits() { - TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); + TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); AssertEx.EqualTolerance(DegreesCelsiusInOneKelvin, kelvin.DegreesCelsius, DegreesCelsiusTolerance); AssertEx.EqualTolerance(DegreesDelisleInOneKelvin, kelvin.DegreesDelisle, DegreesDelisleTolerance); AssertEx.EqualTolerance(DegreesFahrenheitInOneKelvin, kelvin.DegreesFahrenheit, DegreesFahrenheitTolerance); @@ -90,33 +90,33 @@ public void KelvinToTemperatureDeltaUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeCelsius).DegreesCelsius, DegreesCelsiusTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeDelisle).DegreesDelisle, DegreesDelisleTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeFahrenheit).DegreesFahrenheit, DegreesFahrenheitTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeNewton).DegreesNewton, DegreesNewtonTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRankine).DegreesRankine, DegreesRankineTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeReaumur).DegreesReaumur, DegreesReaumurTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRoemer).DegreesRoemer, DegreesRoemerTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.Kelvin).Kelvins, KelvinsTolerance); + AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeCelsius).DegreesCelsius, DegreesCelsiusTolerance); + AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeDelisle).DegreesDelisle, DegreesDelisleTolerance); + AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeFahrenheit).DegreesFahrenheit, DegreesFahrenheitTolerance); + AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeNewton).DegreesNewton, DegreesNewtonTolerance); + AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRankine).DegreesRankine, DegreesRankineTolerance); + AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeReaumur).DegreesReaumur, DegreesReaumurTolerance); + AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRoemer).DegreesRoemer, DegreesRoemerTolerance); + AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.Kelvin).Kelvins, KelvinsTolerance); } [Fact] public void FromKelvins_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => TemperatureDelta.FromKelvins(double.PositiveInfinity)); - Assert.Throws(() => TemperatureDelta.FromKelvins(double.NegativeInfinity)); + Assert.Throws(() => TemperatureDelta.FromKelvins(double.PositiveInfinity)); + Assert.Throws(() => TemperatureDelta.FromKelvins(double.NegativeInfinity)); } [Fact] public void FromKelvins_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => TemperatureDelta.FromKelvins(double.NaN)); + Assert.Throws(() => TemperatureDelta.FromKelvins(double.NaN)); } [Fact] public void As() { - var kelvin = TemperatureDelta.FromKelvins(1); + var kelvin = TemperatureDelta.FromKelvins(1); AssertEx.EqualTolerance(DegreesCelsiusInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeCelsius), DegreesCelsiusTolerance); AssertEx.EqualTolerance(DegreesDelisleInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeDelisle), DegreesDelisleTolerance); AssertEx.EqualTolerance(DegreesFahrenheitInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeFahrenheit), DegreesFahrenheitTolerance); @@ -130,7 +130,7 @@ public void As() [Fact] public void ToUnit() { - var kelvin = TemperatureDelta.FromKelvins(1); + var kelvin = TemperatureDelta.FromKelvins(1); var degreecelsiusQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeCelsius); AssertEx.EqualTolerance(DegreesCelsiusInOneKelvin, (double)degreecelsiusQuantity.Value, DegreesCelsiusTolerance); @@ -168,35 +168,35 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesCelsius(kelvin.DegreesCelsius).Kelvins, DegreesCelsiusTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesDelisle(kelvin.DegreesDelisle).Kelvins, DegreesDelisleTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesFahrenheit(kelvin.DegreesFahrenheit).Kelvins, DegreesFahrenheitTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesNewton(kelvin.DegreesNewton).Kelvins, DegreesNewtonTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesRankine(kelvin.DegreesRankine).Kelvins, DegreesRankineTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesReaumur(kelvin.DegreesReaumur).Kelvins, DegreesReaumurTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesRoemer(kelvin.DegreesRoemer).Kelvins, DegreesRoemerTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromKelvins(kelvin.Kelvins).Kelvins, KelvinsTolerance); + TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); + AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesCelsius(kelvin.DegreesCelsius).Kelvins, DegreesCelsiusTolerance); + AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesDelisle(kelvin.DegreesDelisle).Kelvins, DegreesDelisleTolerance); + AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesFahrenheit(kelvin.DegreesFahrenheit).Kelvins, DegreesFahrenheitTolerance); + AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesNewton(kelvin.DegreesNewton).Kelvins, DegreesNewtonTolerance); + AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesRankine(kelvin.DegreesRankine).Kelvins, DegreesRankineTolerance); + AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesReaumur(kelvin.DegreesReaumur).Kelvins, DegreesReaumurTolerance); + AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesRoemer(kelvin.DegreesRoemer).Kelvins, DegreesRoemerTolerance); + AssertEx.EqualTolerance(1, TemperatureDelta.FromKelvins(kelvin.Kelvins).Kelvins, KelvinsTolerance); } [Fact] public void ArithmeticOperators() { - TemperatureDelta v = TemperatureDelta.FromKelvins(1); + TemperatureDelta v = TemperatureDelta.FromKelvins(1); AssertEx.EqualTolerance(-1, -v.Kelvins, KelvinsTolerance); - AssertEx.EqualTolerance(2, (TemperatureDelta.FromKelvins(3)-v).Kelvins, KelvinsTolerance); + AssertEx.EqualTolerance(2, (TemperatureDelta.FromKelvins(3)-v).Kelvins, KelvinsTolerance); AssertEx.EqualTolerance(2, (v + v).Kelvins, KelvinsTolerance); AssertEx.EqualTolerance(10, (v*10).Kelvins, KelvinsTolerance); AssertEx.EqualTolerance(10, (10*v).Kelvins, KelvinsTolerance); - AssertEx.EqualTolerance(2, (TemperatureDelta.FromKelvins(10)/5).Kelvins, KelvinsTolerance); - AssertEx.EqualTolerance(2, TemperatureDelta.FromKelvins(10)/TemperatureDelta.FromKelvins(5), KelvinsTolerance); + AssertEx.EqualTolerance(2, (TemperatureDelta.FromKelvins(10)/5).Kelvins, KelvinsTolerance); + AssertEx.EqualTolerance(2, TemperatureDelta.FromKelvins(10)/TemperatureDelta.FromKelvins(5), KelvinsTolerance); } [Fact] public void ComparisonOperators() { - TemperatureDelta oneKelvin = TemperatureDelta.FromKelvins(1); - TemperatureDelta twoKelvins = TemperatureDelta.FromKelvins(2); + TemperatureDelta oneKelvin = TemperatureDelta.FromKelvins(1); + TemperatureDelta twoKelvins = TemperatureDelta.FromKelvins(2); Assert.True(oneKelvin < twoKelvins); Assert.True(oneKelvin <= twoKelvins); @@ -212,31 +212,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); + TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); Assert.Equal(0, kelvin.CompareTo(kelvin)); - Assert.True(kelvin.CompareTo(TemperatureDelta.Zero) > 0); - Assert.True(TemperatureDelta.Zero.CompareTo(kelvin) < 0); + Assert.True(kelvin.CompareTo(TemperatureDelta.Zero) > 0); + Assert.True(TemperatureDelta.Zero.CompareTo(kelvin) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); + TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); Assert.Throws(() => kelvin.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); + TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); Assert.Throws(() => kelvin.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = TemperatureDelta.FromKelvins(1); - var b = TemperatureDelta.FromKelvins(2); + var a = TemperatureDelta.FromKelvins(1); + var b = TemperatureDelta.FromKelvins(2); // ReSharper disable EqualExpressionComparison @@ -255,8 +255,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = TemperatureDelta.FromKelvins(1); - var b = TemperatureDelta.FromKelvins(2); + var a = TemperatureDelta.FromKelvins(1); + var b = TemperatureDelta.FromKelvins(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -266,29 +266,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = TemperatureDelta.FromKelvins(1); - Assert.True(v.Equals(TemperatureDelta.FromKelvins(1), KelvinsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(TemperatureDelta.Zero, KelvinsTolerance, ComparisonType.Relative)); + var v = TemperatureDelta.FromKelvins(1); + Assert.True(v.Equals(TemperatureDelta.FromKelvins(1), KelvinsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(TemperatureDelta.Zero, KelvinsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); + TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); Assert.False(kelvin.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); + TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); Assert.False(kelvin.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(TemperatureDeltaUnit.Undefined, TemperatureDelta.Units); + Assert.DoesNotContain(TemperatureDeltaUnit.Undefined, TemperatureDelta.Units); } [Fact] @@ -307,7 +307,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(TemperatureDelta.BaseDimensions is null); + Assert.False(TemperatureDelta.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs index 46b4313c36..8749450966 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Temperature. + /// Test of Temperature. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class TemperatureTestsBase @@ -59,26 +59,26 @@ public abstract partial class TemperatureTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Temperature((double)0.0, TemperatureUnit.Undefined)); + Assert.Throws(() => new Temperature((double)0.0, TemperatureUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Temperature(double.PositiveInfinity, TemperatureUnit.Kelvin)); - Assert.Throws(() => new Temperature(double.NegativeInfinity, TemperatureUnit.Kelvin)); + Assert.Throws(() => new Temperature(double.PositiveInfinity, TemperatureUnit.Kelvin)); + Assert.Throws(() => new Temperature(double.NegativeInfinity, TemperatureUnit.Kelvin)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Temperature(double.NaN, TemperatureUnit.Kelvin)); + Assert.Throws(() => new Temperature(double.NaN, TemperatureUnit.Kelvin)); } [Fact] public void KelvinToTemperatureUnits() { - Temperature kelvin = Temperature.FromKelvins(1); + Temperature kelvin = Temperature.FromKelvins(1); AssertEx.EqualTolerance(DegreesCelsiusInOneKelvin, kelvin.DegreesCelsius, DegreesCelsiusTolerance); AssertEx.EqualTolerance(DegreesDelisleInOneKelvin, kelvin.DegreesDelisle, DegreesDelisleTolerance); AssertEx.EqualTolerance(DegreesFahrenheitInOneKelvin, kelvin.DegreesFahrenheit, DegreesFahrenheitTolerance); @@ -93,34 +93,34 @@ public void KelvinToTemperatureUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeCelsius).DegreesCelsius, DegreesCelsiusTolerance); - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeDelisle).DegreesDelisle, DegreesDelisleTolerance); - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeFahrenheit).DegreesFahrenheit, DegreesFahrenheitTolerance); - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeNewton).DegreesNewton, DegreesNewtonTolerance); - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeRankine).DegreesRankine, DegreesRankineTolerance); - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeReaumur).DegreesReaumur, DegreesReaumurTolerance); - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeRoemer).DegreesRoemer, DegreesRoemerTolerance); - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.Kelvin).Kelvins, KelvinsTolerance); - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.SolarTemperature).SolarTemperatures, SolarTemperaturesTolerance); + AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeCelsius).DegreesCelsius, DegreesCelsiusTolerance); + AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeDelisle).DegreesDelisle, DegreesDelisleTolerance); + AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeFahrenheit).DegreesFahrenheit, DegreesFahrenheitTolerance); + AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeNewton).DegreesNewton, DegreesNewtonTolerance); + AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeRankine).DegreesRankine, DegreesRankineTolerance); + AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeReaumur).DegreesReaumur, DegreesReaumurTolerance); + AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeRoemer).DegreesRoemer, DegreesRoemerTolerance); + AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.Kelvin).Kelvins, KelvinsTolerance); + AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.SolarTemperature).SolarTemperatures, SolarTemperaturesTolerance); } [Fact] public void FromKelvins_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Temperature.FromKelvins(double.PositiveInfinity)); - Assert.Throws(() => Temperature.FromKelvins(double.NegativeInfinity)); + Assert.Throws(() => Temperature.FromKelvins(double.PositiveInfinity)); + Assert.Throws(() => Temperature.FromKelvins(double.NegativeInfinity)); } [Fact] public void FromKelvins_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Temperature.FromKelvins(double.NaN)); + Assert.Throws(() => Temperature.FromKelvins(double.NaN)); } [Fact] public void As() { - var kelvin = Temperature.FromKelvins(1); + var kelvin = Temperature.FromKelvins(1); AssertEx.EqualTolerance(DegreesCelsiusInOneKelvin, kelvin.As(TemperatureUnit.DegreeCelsius), DegreesCelsiusTolerance); AssertEx.EqualTolerance(DegreesDelisleInOneKelvin, kelvin.As(TemperatureUnit.DegreeDelisle), DegreesDelisleTolerance); AssertEx.EqualTolerance(DegreesFahrenheitInOneKelvin, kelvin.As(TemperatureUnit.DegreeFahrenheit), DegreesFahrenheitTolerance); @@ -135,7 +135,7 @@ public void As() [Fact] public void ToUnit() { - var kelvin = Temperature.FromKelvins(1); + var kelvin = Temperature.FromKelvins(1); var degreecelsiusQuantity = kelvin.ToUnit(TemperatureUnit.DegreeCelsius); AssertEx.EqualTolerance(DegreesCelsiusInOneKelvin, (double)degreecelsiusQuantity.Value, DegreesCelsiusTolerance); @@ -177,24 +177,24 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Temperature kelvin = Temperature.FromKelvins(1); - AssertEx.EqualTolerance(1, Temperature.FromDegreesCelsius(kelvin.DegreesCelsius).Kelvins, DegreesCelsiusTolerance); - AssertEx.EqualTolerance(1, Temperature.FromDegreesDelisle(kelvin.DegreesDelisle).Kelvins, DegreesDelisleTolerance); - AssertEx.EqualTolerance(1, Temperature.FromDegreesFahrenheit(kelvin.DegreesFahrenheit).Kelvins, DegreesFahrenheitTolerance); - AssertEx.EqualTolerance(1, Temperature.FromDegreesNewton(kelvin.DegreesNewton).Kelvins, DegreesNewtonTolerance); - AssertEx.EqualTolerance(1, Temperature.FromDegreesRankine(kelvin.DegreesRankine).Kelvins, DegreesRankineTolerance); - AssertEx.EqualTolerance(1, Temperature.FromDegreesReaumur(kelvin.DegreesReaumur).Kelvins, DegreesReaumurTolerance); - AssertEx.EqualTolerance(1, Temperature.FromDegreesRoemer(kelvin.DegreesRoemer).Kelvins, DegreesRoemerTolerance); - AssertEx.EqualTolerance(1, Temperature.FromKelvins(kelvin.Kelvins).Kelvins, KelvinsTolerance); - AssertEx.EqualTolerance(1, Temperature.FromSolarTemperatures(kelvin.SolarTemperatures).Kelvins, SolarTemperaturesTolerance); + Temperature kelvin = Temperature.FromKelvins(1); + AssertEx.EqualTolerance(1, Temperature.FromDegreesCelsius(kelvin.DegreesCelsius).Kelvins, DegreesCelsiusTolerance); + AssertEx.EqualTolerance(1, Temperature.FromDegreesDelisle(kelvin.DegreesDelisle).Kelvins, DegreesDelisleTolerance); + AssertEx.EqualTolerance(1, Temperature.FromDegreesFahrenheit(kelvin.DegreesFahrenheit).Kelvins, DegreesFahrenheitTolerance); + AssertEx.EqualTolerance(1, Temperature.FromDegreesNewton(kelvin.DegreesNewton).Kelvins, DegreesNewtonTolerance); + AssertEx.EqualTolerance(1, Temperature.FromDegreesRankine(kelvin.DegreesRankine).Kelvins, DegreesRankineTolerance); + AssertEx.EqualTolerance(1, Temperature.FromDegreesReaumur(kelvin.DegreesReaumur).Kelvins, DegreesReaumurTolerance); + AssertEx.EqualTolerance(1, Temperature.FromDegreesRoemer(kelvin.DegreesRoemer).Kelvins, DegreesRoemerTolerance); + AssertEx.EqualTolerance(1, Temperature.FromKelvins(kelvin.Kelvins).Kelvins, KelvinsTolerance); + AssertEx.EqualTolerance(1, Temperature.FromSolarTemperatures(kelvin.SolarTemperatures).Kelvins, SolarTemperaturesTolerance); } [Fact] public void ComparisonOperators() { - Temperature oneKelvin = Temperature.FromKelvins(1); - Temperature twoKelvins = Temperature.FromKelvins(2); + Temperature oneKelvin = Temperature.FromKelvins(1); + Temperature twoKelvins = Temperature.FromKelvins(2); Assert.True(oneKelvin < twoKelvins); Assert.True(oneKelvin <= twoKelvins); @@ -210,31 +210,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Temperature kelvin = Temperature.FromKelvins(1); + Temperature kelvin = Temperature.FromKelvins(1); Assert.Equal(0, kelvin.CompareTo(kelvin)); - Assert.True(kelvin.CompareTo(Temperature.Zero) > 0); - Assert.True(Temperature.Zero.CompareTo(kelvin) < 0); + Assert.True(kelvin.CompareTo(Temperature.Zero) > 0); + Assert.True(Temperature.Zero.CompareTo(kelvin) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Temperature kelvin = Temperature.FromKelvins(1); + Temperature kelvin = Temperature.FromKelvins(1); Assert.Throws(() => kelvin.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Temperature kelvin = Temperature.FromKelvins(1); + Temperature kelvin = Temperature.FromKelvins(1); Assert.Throws(() => kelvin.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Temperature.FromKelvins(1); - var b = Temperature.FromKelvins(2); + var a = Temperature.FromKelvins(1); + var b = Temperature.FromKelvins(2); // ReSharper disable EqualExpressionComparison @@ -253,8 +253,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Temperature.FromKelvins(1); - var b = Temperature.FromKelvins(2); + var a = Temperature.FromKelvins(1); + var b = Temperature.FromKelvins(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -264,29 +264,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Temperature.FromKelvins(1); - Assert.True(v.Equals(Temperature.FromKelvins(1), KelvinsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Temperature.Zero, KelvinsTolerance, ComparisonType.Relative)); + var v = Temperature.FromKelvins(1); + Assert.True(v.Equals(Temperature.FromKelvins(1), KelvinsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Temperature.Zero, KelvinsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Temperature kelvin = Temperature.FromKelvins(1); + Temperature kelvin = Temperature.FromKelvins(1); Assert.False(kelvin.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Temperature kelvin = Temperature.FromKelvins(1); + Temperature kelvin = Temperature.FromKelvins(1); Assert.False(kelvin.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(TemperatureUnit.Undefined, Temperature.Units); + Assert.DoesNotContain(TemperatureUnit.Undefined, Temperature.Units); } [Fact] @@ -305,7 +305,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Temperature.BaseDimensions is null); + Assert.False(Temperature.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs index 85c3cd196c..7913a5c81c 100644 --- a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs @@ -45,26 +45,26 @@ public abstract partial class ThermalConductivityTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ThermalConductivity((double)0.0, ThermalConductivityUnit.Undefined)); + Assert.Throws(() => new ThermalConductivity((double)0.0, ThermalConductivityUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ThermalConductivity(double.PositiveInfinity, ThermalConductivityUnit.WattPerMeterKelvin)); - Assert.Throws(() => new ThermalConductivity(double.NegativeInfinity, ThermalConductivityUnit.WattPerMeterKelvin)); + Assert.Throws(() => new ThermalConductivity(double.PositiveInfinity, ThermalConductivityUnit.WattPerMeterKelvin)); + Assert.Throws(() => new ThermalConductivity(double.NegativeInfinity, ThermalConductivityUnit.WattPerMeterKelvin)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ThermalConductivity(double.NaN, ThermalConductivityUnit.WattPerMeterKelvin)); + Assert.Throws(() => new ThermalConductivity(double.NaN, ThermalConductivityUnit.WattPerMeterKelvin)); } [Fact] public void WattPerMeterKelvinToThermalConductivityUnits() { - ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); + ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); AssertEx.EqualTolerance(BtusPerHourFootFahrenheitInOneWattPerMeterKelvin, wattpermeterkelvin.BtusPerHourFootFahrenheit, BtusPerHourFootFahrenheitTolerance); AssertEx.EqualTolerance(WattsPerMeterKelvinInOneWattPerMeterKelvin, wattpermeterkelvin.WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); } @@ -72,27 +72,27 @@ public void WattPerMeterKelvinToThermalConductivityUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ThermalConductivity.From(1, ThermalConductivityUnit.BtuPerHourFootFahrenheit).BtusPerHourFootFahrenheit, BtusPerHourFootFahrenheitTolerance); - AssertEx.EqualTolerance(1, ThermalConductivity.From(1, ThermalConductivityUnit.WattPerMeterKelvin).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); + AssertEx.EqualTolerance(1, ThermalConductivity.From(1, ThermalConductivityUnit.BtuPerHourFootFahrenheit).BtusPerHourFootFahrenheit, BtusPerHourFootFahrenheitTolerance); + AssertEx.EqualTolerance(1, ThermalConductivity.From(1, ThermalConductivityUnit.WattPerMeterKelvin).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); } [Fact] public void FromWattsPerMeterKelvin_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.PositiveInfinity)); - Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.NegativeInfinity)); + Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.PositiveInfinity)); + Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.NegativeInfinity)); } [Fact] public void FromWattsPerMeterKelvin_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.NaN)); + Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.NaN)); } [Fact] public void As() { - var wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); + var wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); AssertEx.EqualTolerance(BtusPerHourFootFahrenheitInOneWattPerMeterKelvin, wattpermeterkelvin.As(ThermalConductivityUnit.BtuPerHourFootFahrenheit), BtusPerHourFootFahrenheitTolerance); AssertEx.EqualTolerance(WattsPerMeterKelvinInOneWattPerMeterKelvin, wattpermeterkelvin.As(ThermalConductivityUnit.WattPerMeterKelvin), WattsPerMeterKelvinTolerance); } @@ -100,7 +100,7 @@ public void As() [Fact] public void ToUnit() { - var wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); + var wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); var btuperhourfootfahrenheitQuantity = wattpermeterkelvin.ToUnit(ThermalConductivityUnit.BtuPerHourFootFahrenheit); AssertEx.EqualTolerance(BtusPerHourFootFahrenheitInOneWattPerMeterKelvin, (double)btuperhourfootfahrenheitQuantity.Value, BtusPerHourFootFahrenheitTolerance); @@ -114,29 +114,29 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); - AssertEx.EqualTolerance(1, ThermalConductivity.FromBtusPerHourFootFahrenheit(wattpermeterkelvin.BtusPerHourFootFahrenheit).WattsPerMeterKelvin, BtusPerHourFootFahrenheitTolerance); - AssertEx.EqualTolerance(1, ThermalConductivity.FromWattsPerMeterKelvin(wattpermeterkelvin.WattsPerMeterKelvin).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); + ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); + AssertEx.EqualTolerance(1, ThermalConductivity.FromBtusPerHourFootFahrenheit(wattpermeterkelvin.BtusPerHourFootFahrenheit).WattsPerMeterKelvin, BtusPerHourFootFahrenheitTolerance); + AssertEx.EqualTolerance(1, ThermalConductivity.FromWattsPerMeterKelvin(wattpermeterkelvin.WattsPerMeterKelvin).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); } [Fact] public void ArithmeticOperators() { - ThermalConductivity v = ThermalConductivity.FromWattsPerMeterKelvin(1); + ThermalConductivity v = ThermalConductivity.FromWattsPerMeterKelvin(1); AssertEx.EqualTolerance(-1, -v.WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); - AssertEx.EqualTolerance(2, (ThermalConductivity.FromWattsPerMeterKelvin(3)-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); + 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); + ThermalConductivity oneWattPerMeterKelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); + ThermalConductivity twoWattsPerMeterKelvin = ThermalConductivity.FromWattsPerMeterKelvin(2); Assert.True(oneWattPerMeterKelvin < twoWattsPerMeterKelvin); Assert.True(oneWattPerMeterKelvin <= twoWattsPerMeterKelvin); @@ -152,31 +152,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); + 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); + Assert.True(wattpermeterkelvin.CompareTo(ThermalConductivity.Zero) > 0); + Assert.True(ThermalConductivity.Zero.CompareTo(wattpermeterkelvin) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); + ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); Assert.Throws(() => wattpermeterkelvin.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); + ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); Assert.Throws(() => wattpermeterkelvin.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ThermalConductivity.FromWattsPerMeterKelvin(1); - var b = ThermalConductivity.FromWattsPerMeterKelvin(2); + var a = ThermalConductivity.FromWattsPerMeterKelvin(1); + var b = ThermalConductivity.FromWattsPerMeterKelvin(2); // ReSharper disable EqualExpressionComparison @@ -195,8 +195,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ThermalConductivity.FromWattsPerMeterKelvin(1); - var b = ThermalConductivity.FromWattsPerMeterKelvin(2); + var a = ThermalConductivity.FromWattsPerMeterKelvin(1); + var b = ThermalConductivity.FromWattsPerMeterKelvin(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -206,29 +206,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ThermalConductivity.FromWattsPerMeterKelvin(1); - Assert.True(v.Equals(ThermalConductivity.FromWattsPerMeterKelvin(1), WattsPerMeterKelvinTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ThermalConductivity.Zero, WattsPerMeterKelvinTolerance, ComparisonType.Relative)); + var v = ThermalConductivity.FromWattsPerMeterKelvin(1); + Assert.True(v.Equals(ThermalConductivity.FromWattsPerMeterKelvin(1), WattsPerMeterKelvinTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ThermalConductivity.Zero, WattsPerMeterKelvinTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); + ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); Assert.False(wattpermeterkelvin.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); + ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); Assert.False(wattpermeterkelvin.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ThermalConductivityUnit.Undefined, ThermalConductivity.Units); + Assert.DoesNotContain(ThermalConductivityUnit.Undefined, ThermalConductivity.Units); } [Fact] @@ -247,7 +247,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ThermalConductivity.BaseDimensions is null); + Assert.False(ThermalConductivity.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs index 7faf749bef..0a4472745c 100644 --- a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs @@ -51,26 +51,26 @@ public abstract partial class ThermalResistanceTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new ThermalResistance((double)0.0, ThermalResistanceUnit.Undefined)); + Assert.Throws(() => new ThermalResistance((double)0.0, ThermalResistanceUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new ThermalResistance(double.PositiveInfinity, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); - Assert.Throws(() => new ThermalResistance(double.NegativeInfinity, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); + Assert.Throws(() => new ThermalResistance(double.PositiveInfinity, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); + Assert.Throws(() => new ThermalResistance(double.NegativeInfinity, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new ThermalResistance(double.NaN, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); + Assert.Throws(() => new ThermalResistance(double.NaN, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); } [Fact] public void SquareMeterKelvinPerKilowattToThermalResistanceUnits() { - ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); + ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); AssertEx.EqualTolerance(HourSquareFeetDegreesFahrenheitPerBtuInOneSquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowatt.HourSquareFeetDegreesFahrenheitPerBtu, HourSquareFeetDegreesFahrenheitPerBtuTolerance); AssertEx.EqualTolerance(SquareCentimeterHourDegreesCelsiusPerKilocalorieInOneSquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowatt.SquareCentimeterHourDegreesCelsiusPerKilocalorie, SquareCentimeterHourDegreesCelsiusPerKilocalorieTolerance); AssertEx.EqualTolerance(SquareCentimeterKelvinsPerWattInOneSquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowatt.SquareCentimeterKelvinsPerWatt, SquareCentimeterKelvinsPerWattTolerance); @@ -81,30 +81,30 @@ public void SquareMeterKelvinPerKilowattToThermalResistanceUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu).HourSquareFeetDegreesFahrenheitPerBtu, HourSquareFeetDegreesFahrenheitPerBtuTolerance); - AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie).SquareCentimeterHourDegreesCelsiusPerKilocalorie, SquareCentimeterHourDegreesCelsiusPerKilocalorieTolerance); - AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.SquareCentimeterKelvinPerWatt).SquareCentimeterKelvinsPerWatt, SquareCentimeterKelvinsPerWattTolerance); - AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt).SquareMeterDegreesCelsiusPerWatt, SquareMeterDegreesCelsiusPerWattTolerance); - AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); + AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu).HourSquareFeetDegreesFahrenheitPerBtu, HourSquareFeetDegreesFahrenheitPerBtuTolerance); + AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie).SquareCentimeterHourDegreesCelsiusPerKilocalorie, SquareCentimeterHourDegreesCelsiusPerKilocalorieTolerance); + AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.SquareCentimeterKelvinPerWatt).SquareCentimeterKelvinsPerWatt, SquareCentimeterKelvinsPerWattTolerance); + AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt).SquareMeterDegreesCelsiusPerWatt, SquareMeterDegreesCelsiusPerWattTolerance); + AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); } [Fact] public void FromSquareMeterKelvinsPerKilowatt_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.PositiveInfinity)); - Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.NegativeInfinity)); + Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.PositiveInfinity)); + Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.NegativeInfinity)); } [Fact] public void FromSquareMeterKelvinsPerKilowatt_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.NaN)); + Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.NaN)); } [Fact] public void As() { - var squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); + var squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); AssertEx.EqualTolerance(HourSquareFeetDegreesFahrenheitPerBtuInOneSquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowatt.As(ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu), HourSquareFeetDegreesFahrenheitPerBtuTolerance); AssertEx.EqualTolerance(SquareCentimeterHourDegreesCelsiusPerKilocalorieInOneSquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowatt.As(ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie), SquareCentimeterHourDegreesCelsiusPerKilocalorieTolerance); AssertEx.EqualTolerance(SquareCentimeterKelvinsPerWattInOneSquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowatt.As(ThermalResistanceUnit.SquareCentimeterKelvinPerWatt), SquareCentimeterKelvinsPerWattTolerance); @@ -115,7 +115,7 @@ public void As() [Fact] public void ToUnit() { - var squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); + var squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); var hoursquarefeetdegreefahrenheitperbtuQuantity = squaremeterkelvinperkilowatt.ToUnit(ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu); AssertEx.EqualTolerance(HourSquareFeetDegreesFahrenheitPerBtuInOneSquareMeterKelvinPerKilowatt, (double)hoursquarefeetdegreefahrenheitperbtuQuantity.Value, HourSquareFeetDegreesFahrenheitPerBtuTolerance); @@ -141,32 +141,32 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - AssertEx.EqualTolerance(1, ThermalResistance.FromHourSquareFeetDegreesFahrenheitPerBtu(squaremeterkelvinperkilowatt.HourSquareFeetDegreesFahrenheitPerBtu).SquareMeterKelvinsPerKilowatt, HourSquareFeetDegreesFahrenheitPerBtuTolerance); - AssertEx.EqualTolerance(1, ThermalResistance.FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(squaremeterkelvinperkilowatt.SquareCentimeterHourDegreesCelsiusPerKilocalorie).SquareMeterKelvinsPerKilowatt, SquareCentimeterHourDegreesCelsiusPerKilocalorieTolerance); - AssertEx.EqualTolerance(1, ThermalResistance.FromSquareCentimeterKelvinsPerWatt(squaremeterkelvinperkilowatt.SquareCentimeterKelvinsPerWatt).SquareMeterKelvinsPerKilowatt, SquareCentimeterKelvinsPerWattTolerance); - AssertEx.EqualTolerance(1, ThermalResistance.FromSquareMeterDegreesCelsiusPerWatt(squaremeterkelvinperkilowatt.SquareMeterDegreesCelsiusPerWatt).SquareMeterKelvinsPerKilowatt, SquareMeterDegreesCelsiusPerWattTolerance); - AssertEx.EqualTolerance(1, ThermalResistance.FromSquareMeterKelvinsPerKilowatt(squaremeterkelvinperkilowatt.SquareMeterKelvinsPerKilowatt).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); + ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); + AssertEx.EqualTolerance(1, ThermalResistance.FromHourSquareFeetDegreesFahrenheitPerBtu(squaremeterkelvinperkilowatt.HourSquareFeetDegreesFahrenheitPerBtu).SquareMeterKelvinsPerKilowatt, HourSquareFeetDegreesFahrenheitPerBtuTolerance); + AssertEx.EqualTolerance(1, ThermalResistance.FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(squaremeterkelvinperkilowatt.SquareCentimeterHourDegreesCelsiusPerKilocalorie).SquareMeterKelvinsPerKilowatt, SquareCentimeterHourDegreesCelsiusPerKilocalorieTolerance); + AssertEx.EqualTolerance(1, ThermalResistance.FromSquareCentimeterKelvinsPerWatt(squaremeterkelvinperkilowatt.SquareCentimeterKelvinsPerWatt).SquareMeterKelvinsPerKilowatt, SquareCentimeterKelvinsPerWattTolerance); + AssertEx.EqualTolerance(1, ThermalResistance.FromSquareMeterDegreesCelsiusPerWatt(squaremeterkelvinperkilowatt.SquareMeterDegreesCelsiusPerWatt).SquareMeterKelvinsPerKilowatt, SquareMeterDegreesCelsiusPerWattTolerance); + AssertEx.EqualTolerance(1, ThermalResistance.FromSquareMeterKelvinsPerKilowatt(squaremeterkelvinperkilowatt.SquareMeterKelvinsPerKilowatt).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); } [Fact] public void ArithmeticOperators() { - ThermalResistance v = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); + ThermalResistance v = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); AssertEx.EqualTolerance(-1, -v.SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); - AssertEx.EqualTolerance(2, (ThermalResistance.FromSquareMeterKelvinsPerKilowatt(3)-v).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); + AssertEx.EqualTolerance(2, (ThermalResistance.FromSquareMeterKelvinsPerKilowatt(3)-v).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); AssertEx.EqualTolerance(2, (v + v).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); AssertEx.EqualTolerance(10, (v*10).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); AssertEx.EqualTolerance(10, (10*v).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); - AssertEx.EqualTolerance(2, (ThermalResistance.FromSquareMeterKelvinsPerKilowatt(10)/5).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); - AssertEx.EqualTolerance(2, ThermalResistance.FromSquareMeterKelvinsPerKilowatt(10)/ThermalResistance.FromSquareMeterKelvinsPerKilowatt(5), SquareMeterKelvinsPerKilowattTolerance); + AssertEx.EqualTolerance(2, (ThermalResistance.FromSquareMeterKelvinsPerKilowatt(10)/5).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); + AssertEx.EqualTolerance(2, ThermalResistance.FromSquareMeterKelvinsPerKilowatt(10)/ThermalResistance.FromSquareMeterKelvinsPerKilowatt(5), SquareMeterKelvinsPerKilowattTolerance); } [Fact] public void ComparisonOperators() { - ThermalResistance oneSquareMeterKelvinPerKilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - ThermalResistance twoSquareMeterKelvinsPerKilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(2); + ThermalResistance oneSquareMeterKelvinPerKilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); + ThermalResistance twoSquareMeterKelvinsPerKilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(2); Assert.True(oneSquareMeterKelvinPerKilowatt < twoSquareMeterKelvinsPerKilowatt); Assert.True(oneSquareMeterKelvinPerKilowatt <= twoSquareMeterKelvinsPerKilowatt); @@ -182,31 +182,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); + ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); Assert.Equal(0, squaremeterkelvinperkilowatt.CompareTo(squaremeterkelvinperkilowatt)); - Assert.True(squaremeterkelvinperkilowatt.CompareTo(ThermalResistance.Zero) > 0); - Assert.True(ThermalResistance.Zero.CompareTo(squaremeterkelvinperkilowatt) < 0); + Assert.True(squaremeterkelvinperkilowatt.CompareTo(ThermalResistance.Zero) > 0); + Assert.True(ThermalResistance.Zero.CompareTo(squaremeterkelvinperkilowatt) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); + ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); Assert.Throws(() => squaremeterkelvinperkilowatt.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); + ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); Assert.Throws(() => squaremeterkelvinperkilowatt.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - var b = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(2); + var a = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); + var b = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(2); // ReSharper disable EqualExpressionComparison @@ -225,8 +225,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - var b = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(2); + var a = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); + var b = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -236,29 +236,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - Assert.True(v.Equals(ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1), SquareMeterKelvinsPerKilowattTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ThermalResistance.Zero, SquareMeterKelvinsPerKilowattTolerance, ComparisonType.Relative)); + var v = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); + Assert.True(v.Equals(ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1), SquareMeterKelvinsPerKilowattTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ThermalResistance.Zero, SquareMeterKelvinsPerKilowattTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); + ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); Assert.False(squaremeterkelvinperkilowatt.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); + ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); Assert.False(squaremeterkelvinperkilowatt.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(ThermalResistanceUnit.Undefined, ThermalResistance.Units); + Assert.DoesNotContain(ThermalResistanceUnit.Undefined, ThermalResistance.Units); } [Fact] @@ -277,7 +277,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(ThermalResistance.BaseDimensions is null); + Assert.False(ThermalResistance.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs index a6e2e905e6..858e9892d6 100644 --- a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Torque. + /// Test of Torque. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class TorqueTestsBase @@ -83,26 +83,26 @@ public abstract partial class TorqueTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Torque((double)0.0, TorqueUnit.Undefined)); + Assert.Throws(() => new Torque((double)0.0, TorqueUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Torque(double.PositiveInfinity, TorqueUnit.NewtonMeter)); - Assert.Throws(() => new Torque(double.NegativeInfinity, TorqueUnit.NewtonMeter)); + Assert.Throws(() => new Torque(double.PositiveInfinity, TorqueUnit.NewtonMeter)); + Assert.Throws(() => new Torque(double.NegativeInfinity, TorqueUnit.NewtonMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Torque(double.NaN, TorqueUnit.NewtonMeter)); + Assert.Throws(() => new Torque(double.NaN, TorqueUnit.NewtonMeter)); } [Fact] public void NewtonMeterToTorqueUnits() { - Torque newtonmeter = Torque.FromNewtonMeters(1); + Torque newtonmeter = Torque.FromNewtonMeters(1); AssertEx.EqualTolerance(KilogramForceCentimetersInOneNewtonMeter, newtonmeter.KilogramForceCentimeters, KilogramForceCentimetersTolerance); AssertEx.EqualTolerance(KilogramForceMetersInOneNewtonMeter, newtonmeter.KilogramForceMeters, KilogramForceMetersTolerance); AssertEx.EqualTolerance(KilogramForceMillimetersInOneNewtonMeter, newtonmeter.KilogramForceMillimeters, KilogramForceMillimetersTolerance); @@ -129,46 +129,46 @@ public void NewtonMeterToTorqueUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilogramForceCentimeter).KilogramForceCentimeters, KilogramForceCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilogramForceMeter).KilogramForceMeters, KilogramForceMetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilogramForceMillimeter).KilogramForceMillimeters, KilogramForceMillimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilonewtonCentimeter).KilonewtonCentimeters, KilonewtonCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilonewtonMeter).KilonewtonMeters, KilonewtonMetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilonewtonMillimeter).KilonewtonMillimeters, KilonewtonMillimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilopoundForceFoot).KilopoundForceFeet, KilopoundForceFeetTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilopoundForceInch).KilopoundForceInches, KilopoundForceInchesTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.MeganewtonCentimeter).MeganewtonCentimeters, MeganewtonCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.MeganewtonMeter).MeganewtonMeters, MeganewtonMetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.MeganewtonMillimeter).MeganewtonMillimeters, MeganewtonMillimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.MegapoundForceFoot).MegapoundForceFeet, MegapoundForceFeetTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.MegapoundForceInch).MegapoundForceInches, MegapoundForceInchesTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.NewtonCentimeter).NewtonCentimeters, NewtonCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.NewtonMeter).NewtonMeters, NewtonMetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.NewtonMillimeter).NewtonMillimeters, NewtonMillimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.PoundForceFoot).PoundForceFeet, PoundForceFeetTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.PoundForceInch).PoundForceInches, PoundForceInchesTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.TonneForceCentimeter).TonneForceCentimeters, TonneForceCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.TonneForceMeter).TonneForceMeters, TonneForceMetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.TonneForceMillimeter).TonneForceMillimeters, TonneForceMillimetersTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilogramForceCentimeter).KilogramForceCentimeters, KilogramForceCentimetersTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilogramForceMeter).KilogramForceMeters, KilogramForceMetersTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilogramForceMillimeter).KilogramForceMillimeters, KilogramForceMillimetersTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilonewtonCentimeter).KilonewtonCentimeters, KilonewtonCentimetersTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilonewtonMeter).KilonewtonMeters, KilonewtonMetersTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilonewtonMillimeter).KilonewtonMillimeters, KilonewtonMillimetersTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilopoundForceFoot).KilopoundForceFeet, KilopoundForceFeetTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilopoundForceInch).KilopoundForceInches, KilopoundForceInchesTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.MeganewtonCentimeter).MeganewtonCentimeters, MeganewtonCentimetersTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.MeganewtonMeter).MeganewtonMeters, MeganewtonMetersTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.MeganewtonMillimeter).MeganewtonMillimeters, MeganewtonMillimetersTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.MegapoundForceFoot).MegapoundForceFeet, MegapoundForceFeetTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.MegapoundForceInch).MegapoundForceInches, MegapoundForceInchesTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.NewtonCentimeter).NewtonCentimeters, NewtonCentimetersTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.NewtonMeter).NewtonMeters, NewtonMetersTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.NewtonMillimeter).NewtonMillimeters, NewtonMillimetersTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.PoundForceFoot).PoundForceFeet, PoundForceFeetTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.PoundForceInch).PoundForceInches, PoundForceInchesTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.TonneForceCentimeter).TonneForceCentimeters, TonneForceCentimetersTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.TonneForceMeter).TonneForceMeters, TonneForceMetersTolerance); + AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.TonneForceMillimeter).TonneForceMillimeters, TonneForceMillimetersTolerance); } [Fact] public void FromNewtonMeters_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Torque.FromNewtonMeters(double.PositiveInfinity)); - Assert.Throws(() => Torque.FromNewtonMeters(double.NegativeInfinity)); + Assert.Throws(() => Torque.FromNewtonMeters(double.PositiveInfinity)); + Assert.Throws(() => Torque.FromNewtonMeters(double.NegativeInfinity)); } [Fact] public void FromNewtonMeters_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Torque.FromNewtonMeters(double.NaN)); + Assert.Throws(() => Torque.FromNewtonMeters(double.NaN)); } [Fact] public void As() { - var newtonmeter = Torque.FromNewtonMeters(1); + var newtonmeter = Torque.FromNewtonMeters(1); AssertEx.EqualTolerance(KilogramForceCentimetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.KilogramForceCentimeter), KilogramForceCentimetersTolerance); AssertEx.EqualTolerance(KilogramForceMetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.KilogramForceMeter), KilogramForceMetersTolerance); AssertEx.EqualTolerance(KilogramForceMillimetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.KilogramForceMillimeter), KilogramForceMillimetersTolerance); @@ -195,7 +195,7 @@ public void As() [Fact] public void ToUnit() { - var newtonmeter = Torque.FromNewtonMeters(1); + var newtonmeter = Torque.FromNewtonMeters(1); var kilogramforcecentimeterQuantity = newtonmeter.ToUnit(TorqueUnit.KilogramForceCentimeter); AssertEx.EqualTolerance(KilogramForceCentimetersInOneNewtonMeter, (double)kilogramforcecentimeterQuantity.Value, KilogramForceCentimetersTolerance); @@ -285,48 +285,48 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Torque newtonmeter = Torque.FromNewtonMeters(1); - AssertEx.EqualTolerance(1, Torque.FromKilogramForceCentimeters(newtonmeter.KilogramForceCentimeters).NewtonMeters, KilogramForceCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromKilogramForceMeters(newtonmeter.KilogramForceMeters).NewtonMeters, KilogramForceMetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromKilogramForceMillimeters(newtonmeter.KilogramForceMillimeters).NewtonMeters, KilogramForceMillimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromKilonewtonCentimeters(newtonmeter.KilonewtonCentimeters).NewtonMeters, KilonewtonCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromKilonewtonMeters(newtonmeter.KilonewtonMeters).NewtonMeters, KilonewtonMetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromKilonewtonMillimeters(newtonmeter.KilonewtonMillimeters).NewtonMeters, KilonewtonMillimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromKilopoundForceFeet(newtonmeter.KilopoundForceFeet).NewtonMeters, KilopoundForceFeetTolerance); - AssertEx.EqualTolerance(1, Torque.FromKilopoundForceInches(newtonmeter.KilopoundForceInches).NewtonMeters, KilopoundForceInchesTolerance); - AssertEx.EqualTolerance(1, Torque.FromMeganewtonCentimeters(newtonmeter.MeganewtonCentimeters).NewtonMeters, MeganewtonCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromMeganewtonMeters(newtonmeter.MeganewtonMeters).NewtonMeters, MeganewtonMetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromMeganewtonMillimeters(newtonmeter.MeganewtonMillimeters).NewtonMeters, MeganewtonMillimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromMegapoundForceFeet(newtonmeter.MegapoundForceFeet).NewtonMeters, MegapoundForceFeetTolerance); - AssertEx.EqualTolerance(1, Torque.FromMegapoundForceInches(newtonmeter.MegapoundForceInches).NewtonMeters, MegapoundForceInchesTolerance); - AssertEx.EqualTolerance(1, Torque.FromNewtonCentimeters(newtonmeter.NewtonCentimeters).NewtonMeters, NewtonCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromNewtonMeters(newtonmeter.NewtonMeters).NewtonMeters, NewtonMetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromNewtonMillimeters(newtonmeter.NewtonMillimeters).NewtonMeters, NewtonMillimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromPoundForceFeet(newtonmeter.PoundForceFeet).NewtonMeters, PoundForceFeetTolerance); - AssertEx.EqualTolerance(1, Torque.FromPoundForceInches(newtonmeter.PoundForceInches).NewtonMeters, PoundForceInchesTolerance); - AssertEx.EqualTolerance(1, Torque.FromTonneForceCentimeters(newtonmeter.TonneForceCentimeters).NewtonMeters, TonneForceCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromTonneForceMeters(newtonmeter.TonneForceMeters).NewtonMeters, TonneForceMetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromTonneForceMillimeters(newtonmeter.TonneForceMillimeters).NewtonMeters, TonneForceMillimetersTolerance); + Torque newtonmeter = Torque.FromNewtonMeters(1); + AssertEx.EqualTolerance(1, Torque.FromKilogramForceCentimeters(newtonmeter.KilogramForceCentimeters).NewtonMeters, KilogramForceCentimetersTolerance); + AssertEx.EqualTolerance(1, Torque.FromKilogramForceMeters(newtonmeter.KilogramForceMeters).NewtonMeters, KilogramForceMetersTolerance); + AssertEx.EqualTolerance(1, Torque.FromKilogramForceMillimeters(newtonmeter.KilogramForceMillimeters).NewtonMeters, KilogramForceMillimetersTolerance); + AssertEx.EqualTolerance(1, Torque.FromKilonewtonCentimeters(newtonmeter.KilonewtonCentimeters).NewtonMeters, KilonewtonCentimetersTolerance); + AssertEx.EqualTolerance(1, Torque.FromKilonewtonMeters(newtonmeter.KilonewtonMeters).NewtonMeters, KilonewtonMetersTolerance); + AssertEx.EqualTolerance(1, Torque.FromKilonewtonMillimeters(newtonmeter.KilonewtonMillimeters).NewtonMeters, KilonewtonMillimetersTolerance); + AssertEx.EqualTolerance(1, Torque.FromKilopoundForceFeet(newtonmeter.KilopoundForceFeet).NewtonMeters, KilopoundForceFeetTolerance); + AssertEx.EqualTolerance(1, Torque.FromKilopoundForceInches(newtonmeter.KilopoundForceInches).NewtonMeters, KilopoundForceInchesTolerance); + AssertEx.EqualTolerance(1, Torque.FromMeganewtonCentimeters(newtonmeter.MeganewtonCentimeters).NewtonMeters, MeganewtonCentimetersTolerance); + AssertEx.EqualTolerance(1, Torque.FromMeganewtonMeters(newtonmeter.MeganewtonMeters).NewtonMeters, MeganewtonMetersTolerance); + AssertEx.EqualTolerance(1, Torque.FromMeganewtonMillimeters(newtonmeter.MeganewtonMillimeters).NewtonMeters, MeganewtonMillimetersTolerance); + AssertEx.EqualTolerance(1, Torque.FromMegapoundForceFeet(newtonmeter.MegapoundForceFeet).NewtonMeters, MegapoundForceFeetTolerance); + AssertEx.EqualTolerance(1, Torque.FromMegapoundForceInches(newtonmeter.MegapoundForceInches).NewtonMeters, MegapoundForceInchesTolerance); + AssertEx.EqualTolerance(1, Torque.FromNewtonCentimeters(newtonmeter.NewtonCentimeters).NewtonMeters, NewtonCentimetersTolerance); + AssertEx.EqualTolerance(1, Torque.FromNewtonMeters(newtonmeter.NewtonMeters).NewtonMeters, NewtonMetersTolerance); + AssertEx.EqualTolerance(1, Torque.FromNewtonMillimeters(newtonmeter.NewtonMillimeters).NewtonMeters, NewtonMillimetersTolerance); + AssertEx.EqualTolerance(1, Torque.FromPoundForceFeet(newtonmeter.PoundForceFeet).NewtonMeters, PoundForceFeetTolerance); + AssertEx.EqualTolerance(1, Torque.FromPoundForceInches(newtonmeter.PoundForceInches).NewtonMeters, PoundForceInchesTolerance); + AssertEx.EqualTolerance(1, Torque.FromTonneForceCentimeters(newtonmeter.TonneForceCentimeters).NewtonMeters, TonneForceCentimetersTolerance); + AssertEx.EqualTolerance(1, Torque.FromTonneForceMeters(newtonmeter.TonneForceMeters).NewtonMeters, TonneForceMetersTolerance); + AssertEx.EqualTolerance(1, Torque.FromTonneForceMillimeters(newtonmeter.TonneForceMillimeters).NewtonMeters, TonneForceMillimetersTolerance); } [Fact] public void ArithmeticOperators() { - Torque v = Torque.FromNewtonMeters(1); + Torque v = Torque.FromNewtonMeters(1); AssertEx.EqualTolerance(-1, -v.NewtonMeters, NewtonMetersTolerance); - AssertEx.EqualTolerance(2, (Torque.FromNewtonMeters(3)-v).NewtonMeters, NewtonMetersTolerance); + AssertEx.EqualTolerance(2, (Torque.FromNewtonMeters(3)-v).NewtonMeters, NewtonMetersTolerance); AssertEx.EqualTolerance(2, (v + v).NewtonMeters, NewtonMetersTolerance); AssertEx.EqualTolerance(10, (v*10).NewtonMeters, NewtonMetersTolerance); AssertEx.EqualTolerance(10, (10*v).NewtonMeters, NewtonMetersTolerance); - AssertEx.EqualTolerance(2, (Torque.FromNewtonMeters(10)/5).NewtonMeters, NewtonMetersTolerance); - AssertEx.EqualTolerance(2, Torque.FromNewtonMeters(10)/Torque.FromNewtonMeters(5), NewtonMetersTolerance); + AssertEx.EqualTolerance(2, (Torque.FromNewtonMeters(10)/5).NewtonMeters, NewtonMetersTolerance); + AssertEx.EqualTolerance(2, Torque.FromNewtonMeters(10)/Torque.FromNewtonMeters(5), NewtonMetersTolerance); } [Fact] public void ComparisonOperators() { - Torque oneNewtonMeter = Torque.FromNewtonMeters(1); - Torque twoNewtonMeters = Torque.FromNewtonMeters(2); + Torque oneNewtonMeter = Torque.FromNewtonMeters(1); + Torque twoNewtonMeters = Torque.FromNewtonMeters(2); Assert.True(oneNewtonMeter < twoNewtonMeters); Assert.True(oneNewtonMeter <= twoNewtonMeters); @@ -342,31 +342,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Torque newtonmeter = Torque.FromNewtonMeters(1); + Torque newtonmeter = Torque.FromNewtonMeters(1); Assert.Equal(0, newtonmeter.CompareTo(newtonmeter)); - Assert.True(newtonmeter.CompareTo(Torque.Zero) > 0); - Assert.True(Torque.Zero.CompareTo(newtonmeter) < 0); + Assert.True(newtonmeter.CompareTo(Torque.Zero) > 0); + Assert.True(Torque.Zero.CompareTo(newtonmeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Torque newtonmeter = Torque.FromNewtonMeters(1); + Torque newtonmeter = Torque.FromNewtonMeters(1); Assert.Throws(() => newtonmeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Torque newtonmeter = Torque.FromNewtonMeters(1); + Torque newtonmeter = Torque.FromNewtonMeters(1); Assert.Throws(() => newtonmeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Torque.FromNewtonMeters(1); - var b = Torque.FromNewtonMeters(2); + var a = Torque.FromNewtonMeters(1); + var b = Torque.FromNewtonMeters(2); // ReSharper disable EqualExpressionComparison @@ -385,8 +385,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Torque.FromNewtonMeters(1); - var b = Torque.FromNewtonMeters(2); + var a = Torque.FromNewtonMeters(1); + var b = Torque.FromNewtonMeters(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -396,29 +396,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Torque.FromNewtonMeters(1); - Assert.True(v.Equals(Torque.FromNewtonMeters(1), NewtonMetersTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Torque.Zero, NewtonMetersTolerance, ComparisonType.Relative)); + var v = Torque.FromNewtonMeters(1); + Assert.True(v.Equals(Torque.FromNewtonMeters(1), NewtonMetersTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Torque.Zero, NewtonMetersTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Torque newtonmeter = Torque.FromNewtonMeters(1); + Torque newtonmeter = Torque.FromNewtonMeters(1); Assert.False(newtonmeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Torque newtonmeter = Torque.FromNewtonMeters(1); + Torque newtonmeter = Torque.FromNewtonMeters(1); Assert.False(newtonmeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(TorqueUnit.Undefined, Torque.Units); + Assert.DoesNotContain(TorqueUnit.Undefined, Torque.Units); } [Fact] @@ -437,7 +437,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Torque.BaseDimensions is null); + Assert.False(Torque.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs index ef0ee963b1..a280bd08d6 100644 --- a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs @@ -43,59 +43,59 @@ public abstract partial class VitaminATestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new VitaminA((double)0.0, VitaminAUnit.Undefined)); + Assert.Throws(() => new VitaminA((double)0.0, VitaminAUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new VitaminA(double.PositiveInfinity, VitaminAUnit.InternationalUnit)); - Assert.Throws(() => new VitaminA(double.NegativeInfinity, VitaminAUnit.InternationalUnit)); + Assert.Throws(() => new VitaminA(double.PositiveInfinity, VitaminAUnit.InternationalUnit)); + Assert.Throws(() => new VitaminA(double.NegativeInfinity, VitaminAUnit.InternationalUnit)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new VitaminA(double.NaN, VitaminAUnit.InternationalUnit)); + Assert.Throws(() => new VitaminA(double.NaN, VitaminAUnit.InternationalUnit)); } [Fact] public void InternationalUnitToVitaminAUnits() { - VitaminA internationalunit = VitaminA.FromInternationalUnits(1); + VitaminA internationalunit = VitaminA.FromInternationalUnits(1); AssertEx.EqualTolerance(InternationalUnitsInOneInternationalUnit, internationalunit.InternationalUnits, InternationalUnitsTolerance); } [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, VitaminA.From(1, VitaminAUnit.InternationalUnit).InternationalUnits, InternationalUnitsTolerance); + AssertEx.EqualTolerance(1, VitaminA.From(1, VitaminAUnit.InternationalUnit).InternationalUnits, InternationalUnitsTolerance); } [Fact] public void FromInternationalUnits_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => VitaminA.FromInternationalUnits(double.PositiveInfinity)); - Assert.Throws(() => VitaminA.FromInternationalUnits(double.NegativeInfinity)); + Assert.Throws(() => VitaminA.FromInternationalUnits(double.PositiveInfinity)); + Assert.Throws(() => VitaminA.FromInternationalUnits(double.NegativeInfinity)); } [Fact] public void FromInternationalUnits_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => VitaminA.FromInternationalUnits(double.NaN)); + Assert.Throws(() => VitaminA.FromInternationalUnits(double.NaN)); } [Fact] public void As() { - var internationalunit = VitaminA.FromInternationalUnits(1); + var internationalunit = VitaminA.FromInternationalUnits(1); AssertEx.EqualTolerance(InternationalUnitsInOneInternationalUnit, internationalunit.As(VitaminAUnit.InternationalUnit), InternationalUnitsTolerance); } [Fact] public void ToUnit() { - var internationalunit = VitaminA.FromInternationalUnits(1); + var internationalunit = VitaminA.FromInternationalUnits(1); var internationalunitQuantity = internationalunit.ToUnit(VitaminAUnit.InternationalUnit); AssertEx.EqualTolerance(InternationalUnitsInOneInternationalUnit, (double)internationalunitQuantity.Value, InternationalUnitsTolerance); @@ -105,28 +105,28 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - VitaminA internationalunit = VitaminA.FromInternationalUnits(1); - AssertEx.EqualTolerance(1, VitaminA.FromInternationalUnits(internationalunit.InternationalUnits).InternationalUnits, InternationalUnitsTolerance); + VitaminA internationalunit = VitaminA.FromInternationalUnits(1); + AssertEx.EqualTolerance(1, VitaminA.FromInternationalUnits(internationalunit.InternationalUnits).InternationalUnits, InternationalUnitsTolerance); } [Fact] public void ArithmeticOperators() { - VitaminA v = VitaminA.FromInternationalUnits(1); + VitaminA v = VitaminA.FromInternationalUnits(1); AssertEx.EqualTolerance(-1, -v.InternationalUnits, InternationalUnitsTolerance); - AssertEx.EqualTolerance(2, (VitaminA.FromInternationalUnits(3)-v).InternationalUnits, InternationalUnitsTolerance); + AssertEx.EqualTolerance(2, (VitaminA.FromInternationalUnits(3)-v).InternationalUnits, InternationalUnitsTolerance); AssertEx.EqualTolerance(2, (v + v).InternationalUnits, InternationalUnitsTolerance); AssertEx.EqualTolerance(10, (v*10).InternationalUnits, InternationalUnitsTolerance); AssertEx.EqualTolerance(10, (10*v).InternationalUnits, InternationalUnitsTolerance); - AssertEx.EqualTolerance(2, (VitaminA.FromInternationalUnits(10)/5).InternationalUnits, InternationalUnitsTolerance); - AssertEx.EqualTolerance(2, VitaminA.FromInternationalUnits(10)/VitaminA.FromInternationalUnits(5), InternationalUnitsTolerance); + AssertEx.EqualTolerance(2, (VitaminA.FromInternationalUnits(10)/5).InternationalUnits, InternationalUnitsTolerance); + AssertEx.EqualTolerance(2, VitaminA.FromInternationalUnits(10)/VitaminA.FromInternationalUnits(5), InternationalUnitsTolerance); } [Fact] public void ComparisonOperators() { - VitaminA oneInternationalUnit = VitaminA.FromInternationalUnits(1); - VitaminA twoInternationalUnits = VitaminA.FromInternationalUnits(2); + VitaminA oneInternationalUnit = VitaminA.FromInternationalUnits(1); + VitaminA twoInternationalUnits = VitaminA.FromInternationalUnits(2); Assert.True(oneInternationalUnit < twoInternationalUnits); Assert.True(oneInternationalUnit <= twoInternationalUnits); @@ -142,31 +142,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - VitaminA internationalunit = VitaminA.FromInternationalUnits(1); + VitaminA internationalunit = VitaminA.FromInternationalUnits(1); Assert.Equal(0, internationalunit.CompareTo(internationalunit)); - Assert.True(internationalunit.CompareTo(VitaminA.Zero) > 0); - Assert.True(VitaminA.Zero.CompareTo(internationalunit) < 0); + Assert.True(internationalunit.CompareTo(VitaminA.Zero) > 0); + Assert.True(VitaminA.Zero.CompareTo(internationalunit) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - VitaminA internationalunit = VitaminA.FromInternationalUnits(1); + VitaminA internationalunit = VitaminA.FromInternationalUnits(1); Assert.Throws(() => internationalunit.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - VitaminA internationalunit = VitaminA.FromInternationalUnits(1); + VitaminA internationalunit = VitaminA.FromInternationalUnits(1); Assert.Throws(() => internationalunit.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = VitaminA.FromInternationalUnits(1); - var b = VitaminA.FromInternationalUnits(2); + var a = VitaminA.FromInternationalUnits(1); + var b = VitaminA.FromInternationalUnits(2); // ReSharper disable EqualExpressionComparison @@ -185,8 +185,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = VitaminA.FromInternationalUnits(1); - var b = VitaminA.FromInternationalUnits(2); + var a = VitaminA.FromInternationalUnits(1); + var b = VitaminA.FromInternationalUnits(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -196,29 +196,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = VitaminA.FromInternationalUnits(1); - Assert.True(v.Equals(VitaminA.FromInternationalUnits(1), InternationalUnitsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(VitaminA.Zero, InternationalUnitsTolerance, ComparisonType.Relative)); + var v = VitaminA.FromInternationalUnits(1); + Assert.True(v.Equals(VitaminA.FromInternationalUnits(1), InternationalUnitsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(VitaminA.Zero, InternationalUnitsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - VitaminA internationalunit = VitaminA.FromInternationalUnits(1); + VitaminA internationalunit = VitaminA.FromInternationalUnits(1); Assert.False(internationalunit.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - VitaminA internationalunit = VitaminA.FromInternationalUnits(1); + VitaminA internationalunit = VitaminA.FromInternationalUnits(1); Assert.False(internationalunit.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(VitaminAUnit.Undefined, VitaminA.Units); + Assert.DoesNotContain(VitaminAUnit.Undefined, VitaminA.Units); } [Fact] @@ -237,7 +237,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(VitaminA.BaseDimensions is null); + Assert.False(VitaminA.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/VolumeConcentrationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeConcentrationTestsBase.g.cs index 4151783148..9079fcbd3e 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeConcentrationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeConcentrationTestsBase.g.cs @@ -81,26 +81,26 @@ public abstract partial class VolumeConcentrationTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new VolumeConcentration((double)0.0, VolumeConcentrationUnit.Undefined)); + Assert.Throws(() => new VolumeConcentration((double)0.0, VolumeConcentrationUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new VolumeConcentration(double.PositiveInfinity, VolumeConcentrationUnit.DecimalFraction)); - Assert.Throws(() => new VolumeConcentration(double.NegativeInfinity, VolumeConcentrationUnit.DecimalFraction)); + Assert.Throws(() => new VolumeConcentration(double.PositiveInfinity, VolumeConcentrationUnit.DecimalFraction)); + Assert.Throws(() => new VolumeConcentration(double.NegativeInfinity, VolumeConcentrationUnit.DecimalFraction)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new VolumeConcentration(double.NaN, VolumeConcentrationUnit.DecimalFraction)); + Assert.Throws(() => new VolumeConcentration(double.NaN, VolumeConcentrationUnit.DecimalFraction)); } [Fact] public void DecimalFractionToVolumeConcentrationUnits() { - VolumeConcentration decimalfraction = VolumeConcentration.FromDecimalFractions(1); + VolumeConcentration decimalfraction = VolumeConcentration.FromDecimalFractions(1); AssertEx.EqualTolerance(CentilitersPerLiterInOneDecimalFraction, decimalfraction.CentilitersPerLiter, CentilitersPerLiterTolerance); AssertEx.EqualTolerance(CentilitersPerMililiterInOneDecimalFraction, decimalfraction.CentilitersPerMililiter, CentilitersPerMililiterTolerance); AssertEx.EqualTolerance(DecilitersPerLiterInOneDecimalFraction, decimalfraction.DecilitersPerLiter, DecilitersPerLiterTolerance); @@ -126,45 +126,45 @@ public void DecimalFractionToVolumeConcentrationUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.CentilitersPerLiter).CentilitersPerLiter, CentilitersPerLiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.CentilitersPerMililiter).CentilitersPerMililiter, CentilitersPerMililiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.DecilitersPerLiter).DecilitersPerLiter, DecilitersPerLiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.DecilitersPerMililiter).DecilitersPerMililiter, DecilitersPerMililiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.DecimalFraction).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.LitersPerLiter).LitersPerLiter, LitersPerLiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.LitersPerMililiter).LitersPerMililiter, LitersPerMililiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.MicrolitersPerLiter).MicrolitersPerLiter, MicrolitersPerLiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.MicrolitersPerMililiter).MicrolitersPerMililiter, MicrolitersPerMililiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.MillilitersPerLiter).MillilitersPerLiter, MillilitersPerLiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.MillilitersPerMililiter).MillilitersPerMililiter, MillilitersPerMililiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.NanolitersPerLiter).NanolitersPerLiter, NanolitersPerLiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.NanolitersPerMililiter).NanolitersPerMililiter, NanolitersPerMililiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.PartPerBillion).PartsPerBillion, PartsPerBillionTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.PartPerMillion).PartsPerMillion, PartsPerMillionTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.PartPerThousand).PartsPerThousand, PartsPerThousandTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.PartPerTrillion).PartsPerTrillion, PartsPerTrillionTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.Percent).Percent, PercentTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.PicolitersPerLiter).PicolitersPerLiter, PicolitersPerLiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.PicolitersPerMililiter).PicolitersPerMililiter, PicolitersPerMililiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.CentilitersPerLiter).CentilitersPerLiter, CentilitersPerLiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.CentilitersPerMililiter).CentilitersPerMililiter, CentilitersPerMililiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.DecilitersPerLiter).DecilitersPerLiter, DecilitersPerLiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.DecilitersPerMililiter).DecilitersPerMililiter, DecilitersPerMililiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.DecimalFraction).DecimalFractions, DecimalFractionsTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.LitersPerLiter).LitersPerLiter, LitersPerLiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.LitersPerMililiter).LitersPerMililiter, LitersPerMililiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.MicrolitersPerLiter).MicrolitersPerLiter, MicrolitersPerLiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.MicrolitersPerMililiter).MicrolitersPerMililiter, MicrolitersPerMililiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.MillilitersPerLiter).MillilitersPerLiter, MillilitersPerLiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.MillilitersPerMililiter).MillilitersPerMililiter, MillilitersPerMililiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.NanolitersPerLiter).NanolitersPerLiter, NanolitersPerLiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.NanolitersPerMililiter).NanolitersPerMililiter, NanolitersPerMililiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.PartPerBillion).PartsPerBillion, PartsPerBillionTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.PartPerMillion).PartsPerMillion, PartsPerMillionTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.PartPerThousand).PartsPerThousand, PartsPerThousandTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.PartPerTrillion).PartsPerTrillion, PartsPerTrillionTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.Percent).Percent, PercentTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.PicolitersPerLiter).PicolitersPerLiter, PicolitersPerLiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.From(1, VolumeConcentrationUnit.PicolitersPerMililiter).PicolitersPerMililiter, PicolitersPerMililiterTolerance); } [Fact] public void FromDecimalFractions_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => VolumeConcentration.FromDecimalFractions(double.PositiveInfinity)); - Assert.Throws(() => VolumeConcentration.FromDecimalFractions(double.NegativeInfinity)); + Assert.Throws(() => VolumeConcentration.FromDecimalFractions(double.PositiveInfinity)); + Assert.Throws(() => VolumeConcentration.FromDecimalFractions(double.NegativeInfinity)); } [Fact] public void FromDecimalFractions_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => VolumeConcentration.FromDecimalFractions(double.NaN)); + Assert.Throws(() => VolumeConcentration.FromDecimalFractions(double.NaN)); } [Fact] public void As() { - var decimalfraction = VolumeConcentration.FromDecimalFractions(1); + var decimalfraction = VolumeConcentration.FromDecimalFractions(1); AssertEx.EqualTolerance(CentilitersPerLiterInOneDecimalFraction, decimalfraction.As(VolumeConcentrationUnit.CentilitersPerLiter), CentilitersPerLiterTolerance); AssertEx.EqualTolerance(CentilitersPerMililiterInOneDecimalFraction, decimalfraction.As(VolumeConcentrationUnit.CentilitersPerMililiter), CentilitersPerMililiterTolerance); AssertEx.EqualTolerance(DecilitersPerLiterInOneDecimalFraction, decimalfraction.As(VolumeConcentrationUnit.DecilitersPerLiter), DecilitersPerLiterTolerance); @@ -190,7 +190,7 @@ public void As() [Fact] public void ToUnit() { - var decimalfraction = VolumeConcentration.FromDecimalFractions(1); + var decimalfraction = VolumeConcentration.FromDecimalFractions(1); var centilitersperliterQuantity = decimalfraction.ToUnit(VolumeConcentrationUnit.CentilitersPerLiter); AssertEx.EqualTolerance(CentilitersPerLiterInOneDecimalFraction, (double)centilitersperliterQuantity.Value, CentilitersPerLiterTolerance); @@ -276,47 +276,47 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - VolumeConcentration decimalfraction = VolumeConcentration.FromDecimalFractions(1); - AssertEx.EqualTolerance(1, VolumeConcentration.FromCentilitersPerLiter(decimalfraction.CentilitersPerLiter).DecimalFractions, CentilitersPerLiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromCentilitersPerMililiter(decimalfraction.CentilitersPerMililiter).DecimalFractions, CentilitersPerMililiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromDecilitersPerLiter(decimalfraction.DecilitersPerLiter).DecimalFractions, DecilitersPerLiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromDecilitersPerMililiter(decimalfraction.DecilitersPerMililiter).DecimalFractions, DecilitersPerMililiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromDecimalFractions(decimalfraction.DecimalFractions).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromLitersPerLiter(decimalfraction.LitersPerLiter).DecimalFractions, LitersPerLiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromLitersPerMililiter(decimalfraction.LitersPerMililiter).DecimalFractions, LitersPerMililiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromMicrolitersPerLiter(decimalfraction.MicrolitersPerLiter).DecimalFractions, MicrolitersPerLiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromMicrolitersPerMililiter(decimalfraction.MicrolitersPerMililiter).DecimalFractions, MicrolitersPerMililiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromMillilitersPerLiter(decimalfraction.MillilitersPerLiter).DecimalFractions, MillilitersPerLiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromMillilitersPerMililiter(decimalfraction.MillilitersPerMililiter).DecimalFractions, MillilitersPerMililiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromNanolitersPerLiter(decimalfraction.NanolitersPerLiter).DecimalFractions, NanolitersPerLiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromNanolitersPerMililiter(decimalfraction.NanolitersPerMililiter).DecimalFractions, NanolitersPerMililiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromPartsPerBillion(decimalfraction.PartsPerBillion).DecimalFractions, PartsPerBillionTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromPartsPerMillion(decimalfraction.PartsPerMillion).DecimalFractions, PartsPerMillionTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromPartsPerThousand(decimalfraction.PartsPerThousand).DecimalFractions, PartsPerThousandTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromPartsPerTrillion(decimalfraction.PartsPerTrillion).DecimalFractions, PartsPerTrillionTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromPercent(decimalfraction.Percent).DecimalFractions, PercentTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromPicolitersPerLiter(decimalfraction.PicolitersPerLiter).DecimalFractions, PicolitersPerLiterTolerance); - AssertEx.EqualTolerance(1, VolumeConcentration.FromPicolitersPerMililiter(decimalfraction.PicolitersPerMililiter).DecimalFractions, PicolitersPerMililiterTolerance); + VolumeConcentration decimalfraction = VolumeConcentration.FromDecimalFractions(1); + AssertEx.EqualTolerance(1, VolumeConcentration.FromCentilitersPerLiter(decimalfraction.CentilitersPerLiter).DecimalFractions, CentilitersPerLiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromCentilitersPerMililiter(decimalfraction.CentilitersPerMililiter).DecimalFractions, CentilitersPerMililiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromDecilitersPerLiter(decimalfraction.DecilitersPerLiter).DecimalFractions, DecilitersPerLiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromDecilitersPerMililiter(decimalfraction.DecilitersPerMililiter).DecimalFractions, DecilitersPerMililiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromDecimalFractions(decimalfraction.DecimalFractions).DecimalFractions, DecimalFractionsTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromLitersPerLiter(decimalfraction.LitersPerLiter).DecimalFractions, LitersPerLiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromLitersPerMililiter(decimalfraction.LitersPerMililiter).DecimalFractions, LitersPerMililiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromMicrolitersPerLiter(decimalfraction.MicrolitersPerLiter).DecimalFractions, MicrolitersPerLiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromMicrolitersPerMililiter(decimalfraction.MicrolitersPerMililiter).DecimalFractions, MicrolitersPerMililiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromMillilitersPerLiter(decimalfraction.MillilitersPerLiter).DecimalFractions, MillilitersPerLiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromMillilitersPerMililiter(decimalfraction.MillilitersPerMililiter).DecimalFractions, MillilitersPerMililiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromNanolitersPerLiter(decimalfraction.NanolitersPerLiter).DecimalFractions, NanolitersPerLiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromNanolitersPerMililiter(decimalfraction.NanolitersPerMililiter).DecimalFractions, NanolitersPerMililiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromPartsPerBillion(decimalfraction.PartsPerBillion).DecimalFractions, PartsPerBillionTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromPartsPerMillion(decimalfraction.PartsPerMillion).DecimalFractions, PartsPerMillionTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromPartsPerThousand(decimalfraction.PartsPerThousand).DecimalFractions, PartsPerThousandTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromPartsPerTrillion(decimalfraction.PartsPerTrillion).DecimalFractions, PartsPerTrillionTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromPercent(decimalfraction.Percent).DecimalFractions, PercentTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromPicolitersPerLiter(decimalfraction.PicolitersPerLiter).DecimalFractions, PicolitersPerLiterTolerance); + AssertEx.EqualTolerance(1, VolumeConcentration.FromPicolitersPerMililiter(decimalfraction.PicolitersPerMililiter).DecimalFractions, PicolitersPerMililiterTolerance); } [Fact] public void ArithmeticOperators() { - VolumeConcentration v = VolumeConcentration.FromDecimalFractions(1); + VolumeConcentration v = VolumeConcentration.FromDecimalFractions(1); AssertEx.EqualTolerance(-1, -v.DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(2, (VolumeConcentration.FromDecimalFractions(3)-v).DecimalFractions, DecimalFractionsTolerance); + AssertEx.EqualTolerance(2, (VolumeConcentration.FromDecimalFractions(3)-v).DecimalFractions, DecimalFractionsTolerance); AssertEx.EqualTolerance(2, (v + v).DecimalFractions, DecimalFractionsTolerance); AssertEx.EqualTolerance(10, (v*10).DecimalFractions, DecimalFractionsTolerance); AssertEx.EqualTolerance(10, (10*v).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(2, (VolumeConcentration.FromDecimalFractions(10)/5).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(2, VolumeConcentration.FromDecimalFractions(10)/VolumeConcentration.FromDecimalFractions(5), DecimalFractionsTolerance); + AssertEx.EqualTolerance(2, (VolumeConcentration.FromDecimalFractions(10)/5).DecimalFractions, DecimalFractionsTolerance); + AssertEx.EqualTolerance(2, VolumeConcentration.FromDecimalFractions(10)/VolumeConcentration.FromDecimalFractions(5), DecimalFractionsTolerance); } [Fact] public void ComparisonOperators() { - VolumeConcentration oneDecimalFraction = VolumeConcentration.FromDecimalFractions(1); - VolumeConcentration twoDecimalFractions = VolumeConcentration.FromDecimalFractions(2); + VolumeConcentration oneDecimalFraction = VolumeConcentration.FromDecimalFractions(1); + VolumeConcentration twoDecimalFractions = VolumeConcentration.FromDecimalFractions(2); Assert.True(oneDecimalFraction < twoDecimalFractions); Assert.True(oneDecimalFraction <= twoDecimalFractions); @@ -332,31 +332,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - VolumeConcentration decimalfraction = VolumeConcentration.FromDecimalFractions(1); + VolumeConcentration decimalfraction = VolumeConcentration.FromDecimalFractions(1); Assert.Equal(0, decimalfraction.CompareTo(decimalfraction)); - Assert.True(decimalfraction.CompareTo(VolumeConcentration.Zero) > 0); - Assert.True(VolumeConcentration.Zero.CompareTo(decimalfraction) < 0); + Assert.True(decimalfraction.CompareTo(VolumeConcentration.Zero) > 0); + Assert.True(VolumeConcentration.Zero.CompareTo(decimalfraction) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - VolumeConcentration decimalfraction = VolumeConcentration.FromDecimalFractions(1); + VolumeConcentration decimalfraction = VolumeConcentration.FromDecimalFractions(1); Assert.Throws(() => decimalfraction.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - VolumeConcentration decimalfraction = VolumeConcentration.FromDecimalFractions(1); + VolumeConcentration decimalfraction = VolumeConcentration.FromDecimalFractions(1); Assert.Throws(() => decimalfraction.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = VolumeConcentration.FromDecimalFractions(1); - var b = VolumeConcentration.FromDecimalFractions(2); + var a = VolumeConcentration.FromDecimalFractions(1); + var b = VolumeConcentration.FromDecimalFractions(2); // ReSharper disable EqualExpressionComparison @@ -375,8 +375,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = VolumeConcentration.FromDecimalFractions(1); - var b = VolumeConcentration.FromDecimalFractions(2); + var a = VolumeConcentration.FromDecimalFractions(1); + var b = VolumeConcentration.FromDecimalFractions(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -386,29 +386,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = VolumeConcentration.FromDecimalFractions(1); - Assert.True(v.Equals(VolumeConcentration.FromDecimalFractions(1), DecimalFractionsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(VolumeConcentration.Zero, DecimalFractionsTolerance, ComparisonType.Relative)); + var v = VolumeConcentration.FromDecimalFractions(1); + Assert.True(v.Equals(VolumeConcentration.FromDecimalFractions(1), DecimalFractionsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(VolumeConcentration.Zero, DecimalFractionsTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - VolumeConcentration decimalfraction = VolumeConcentration.FromDecimalFractions(1); + VolumeConcentration decimalfraction = VolumeConcentration.FromDecimalFractions(1); Assert.False(decimalfraction.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - VolumeConcentration decimalfraction = VolumeConcentration.FromDecimalFractions(1); + VolumeConcentration decimalfraction = VolumeConcentration.FromDecimalFractions(1); Assert.False(decimalfraction.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(VolumeConcentrationUnit.Undefined, VolumeConcentration.Units); + Assert.DoesNotContain(VolumeConcentrationUnit.Undefined, VolumeConcentration.Units); } [Fact] @@ -427,7 +427,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(VolumeConcentration.BaseDimensions is null); + Assert.False(VolumeConcentration.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs index dcfca82dca..400664fdb9 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of VolumeFlow. + /// Test of VolumeFlow. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class VolumeFlowTestsBase @@ -139,26 +139,26 @@ public abstract partial class VolumeFlowTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new VolumeFlow((double)0.0, VolumeFlowUnit.Undefined)); + Assert.Throws(() => new VolumeFlow((double)0.0, VolumeFlowUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new VolumeFlow(double.PositiveInfinity, VolumeFlowUnit.CubicMeterPerSecond)); - Assert.Throws(() => new VolumeFlow(double.NegativeInfinity, VolumeFlowUnit.CubicMeterPerSecond)); + Assert.Throws(() => new VolumeFlow(double.PositiveInfinity, VolumeFlowUnit.CubicMeterPerSecond)); + Assert.Throws(() => new VolumeFlow(double.NegativeInfinity, VolumeFlowUnit.CubicMeterPerSecond)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new VolumeFlow(double.NaN, VolumeFlowUnit.CubicMeterPerSecond)); + Assert.Throws(() => new VolumeFlow(double.NaN, VolumeFlowUnit.CubicMeterPerSecond)); } [Fact] public void CubicMeterPerSecondToVolumeFlowUnits() { - VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); + VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); AssertEx.EqualTolerance(AcreFeetPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.AcreFeetPerDay, AcreFeetPerDayTolerance); AssertEx.EqualTolerance(AcreFeetPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.AcreFeetPerHour, AcreFeetPerHourTolerance); AssertEx.EqualTolerance(AcreFeetPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.AcreFeetPerMinute, AcreFeetPerMinuteTolerance); @@ -213,74 +213,74 @@ public void CubicMeterPerSecondToVolumeFlowUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.AcreFootPerDay).AcreFeetPerDay, AcreFeetPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.AcreFootPerHour).AcreFeetPerHour, AcreFeetPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.AcreFootPerMinute).AcreFeetPerMinute, AcreFeetPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.AcreFootPerSecond).AcreFeetPerSecond, AcreFeetPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CentiliterPerDay).CentilitersPerDay, CentilitersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CentiliterPerMinute).CentilitersPerMinute, CentilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicDecimeterPerMinute).CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicFootPerHour).CubicFeetPerHour, CubicFeetPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicFootPerMinute).CubicFeetPerMinute, CubicFeetPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicFootPerSecond).CubicFeetPerSecond, CubicFeetPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicMeterPerDay).CubicMetersPerDay, CubicMetersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicMeterPerHour).CubicMetersPerHour, CubicMetersPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicMeterPerMinute).CubicMetersPerMinute, CubicMetersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicMeterPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicMillimeterPerSecond).CubicMillimetersPerSecond, CubicMillimetersPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicYardPerDay).CubicYardsPerDay, CubicYardsPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicYardPerHour).CubicYardsPerHour, CubicYardsPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicYardPerMinute).CubicYardsPerMinute, CubicYardsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicYardPerSecond).CubicYardsPerSecond, CubicYardsPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.DeciliterPerDay).DecilitersPerDay, DecilitersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.DeciliterPerMinute).DecilitersPerMinute, DecilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.KiloliterPerDay).KilolitersPerDay, KilolitersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.KiloliterPerMinute).KilolitersPerMinute, KilolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.KilousGallonPerMinute).KilousGallonsPerMinute, KilousGallonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LiterPerDay).LitersPerDay, LitersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LiterPerHour).LitersPerHour, LitersPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LiterPerMinute).LitersPerMinute, LitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LiterPerSecond).LitersPerSecond, LitersPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MegaliterPerDay).MegalitersPerDay, MegalitersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MegaukGallonPerSecond).MegaukGallonsPerSecond, MegaukGallonsPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MicroliterPerDay).MicrolitersPerDay, MicrolitersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MicroliterPerMinute).MicrolitersPerMinute, MicrolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MilliliterPerDay).MillilitersPerDay, MillilitersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MilliliterPerMinute).MillilitersPerMinute, MillilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MillionUsGallonsPerDay).MillionUsGallonsPerDay, MillionUsGallonsPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.NanoliterPerDay).NanolitersPerDay, NanolitersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.NanoliterPerMinute).NanolitersPerMinute, NanolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerDay).OilBarrelsPerDay, OilBarrelsPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerHour).OilBarrelsPerHour, OilBarrelsPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerMinute).OilBarrelsPerMinute, OilBarrelsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerSecond).OilBarrelsPerSecond, OilBarrelsPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UkGallonPerDay).UkGallonsPerDay, UkGallonsPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UkGallonPerHour).UkGallonsPerHour, UkGallonsPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UkGallonPerMinute).UkGallonsPerMinute, UkGallonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UkGallonPerSecond).UkGallonsPerSecond, UkGallonsPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerDay).UsGallonsPerDay, UsGallonsPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerHour).UsGallonsPerHour, UsGallonsPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerMinute).UsGallonsPerMinute, UsGallonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerSecond).UsGallonsPerSecond, UsGallonsPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.AcreFootPerDay).AcreFeetPerDay, AcreFeetPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.AcreFootPerHour).AcreFeetPerHour, AcreFeetPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.AcreFootPerMinute).AcreFeetPerMinute, AcreFeetPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.AcreFootPerSecond).AcreFeetPerSecond, AcreFeetPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CentiliterPerDay).CentilitersPerDay, CentilitersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CentiliterPerMinute).CentilitersPerMinute, CentilitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicDecimeterPerMinute).CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicFootPerHour).CubicFeetPerHour, CubicFeetPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicFootPerMinute).CubicFeetPerMinute, CubicFeetPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicFootPerSecond).CubicFeetPerSecond, CubicFeetPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicMeterPerDay).CubicMetersPerDay, CubicMetersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicMeterPerHour).CubicMetersPerHour, CubicMetersPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicMeterPerMinute).CubicMetersPerMinute, CubicMetersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicMeterPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicMillimeterPerSecond).CubicMillimetersPerSecond, CubicMillimetersPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicYardPerDay).CubicYardsPerDay, CubicYardsPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicYardPerHour).CubicYardsPerHour, CubicYardsPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicYardPerMinute).CubicYardsPerMinute, CubicYardsPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicYardPerSecond).CubicYardsPerSecond, CubicYardsPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.DeciliterPerDay).DecilitersPerDay, DecilitersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.DeciliterPerMinute).DecilitersPerMinute, DecilitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.KiloliterPerDay).KilolitersPerDay, KilolitersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.KiloliterPerMinute).KilolitersPerMinute, KilolitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.KilousGallonPerMinute).KilousGallonsPerMinute, KilousGallonsPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LiterPerDay).LitersPerDay, LitersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LiterPerHour).LitersPerHour, LitersPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LiterPerMinute).LitersPerMinute, LitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LiterPerSecond).LitersPerSecond, LitersPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MegaliterPerDay).MegalitersPerDay, MegalitersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MegaukGallonPerSecond).MegaukGallonsPerSecond, MegaukGallonsPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MicroliterPerDay).MicrolitersPerDay, MicrolitersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MicroliterPerMinute).MicrolitersPerMinute, MicrolitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MilliliterPerDay).MillilitersPerDay, MillilitersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MilliliterPerMinute).MillilitersPerMinute, MillilitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MillionUsGallonsPerDay).MillionUsGallonsPerDay, MillionUsGallonsPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.NanoliterPerDay).NanolitersPerDay, NanolitersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.NanoliterPerMinute).NanolitersPerMinute, NanolitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerDay).OilBarrelsPerDay, OilBarrelsPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerHour).OilBarrelsPerHour, OilBarrelsPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerMinute).OilBarrelsPerMinute, OilBarrelsPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerSecond).OilBarrelsPerSecond, OilBarrelsPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UkGallonPerDay).UkGallonsPerDay, UkGallonsPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UkGallonPerHour).UkGallonsPerHour, UkGallonsPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UkGallonPerMinute).UkGallonsPerMinute, UkGallonsPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UkGallonPerSecond).UkGallonsPerSecond, UkGallonsPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerDay).UsGallonsPerDay, UsGallonsPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerHour).UsGallonsPerHour, UsGallonsPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerMinute).UsGallonsPerMinute, UsGallonsPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerSecond).UsGallonsPerSecond, UsGallonsPerSecondTolerance); } [Fact] public void FromCubicMetersPerSecond_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.PositiveInfinity)); - Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.NegativeInfinity)); + Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.PositiveInfinity)); + Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.NegativeInfinity)); } [Fact] public void FromCubicMetersPerSecond_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.NaN)); + Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.NaN)); } [Fact] public void As() { - var cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); + var cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); AssertEx.EqualTolerance(AcreFeetPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.AcreFootPerDay), AcreFeetPerDayTolerance); AssertEx.EqualTolerance(AcreFeetPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.AcreFootPerHour), AcreFeetPerHourTolerance); AssertEx.EqualTolerance(AcreFeetPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.AcreFootPerMinute), AcreFeetPerMinuteTolerance); @@ -335,7 +335,7 @@ public void As() [Fact] public void ToUnit() { - var cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); + var cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); var acrefootperdayQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.AcreFootPerDay); AssertEx.EqualTolerance(AcreFeetPerDayInOneCubicMeterPerSecond, (double)acrefootperdayQuantity.Value, AcreFeetPerDayTolerance); @@ -537,76 +537,76 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); - AssertEx.EqualTolerance(1, VolumeFlow.FromAcreFeetPerDay(cubicmeterpersecond.AcreFeetPerDay).CubicMetersPerSecond, AcreFeetPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromAcreFeetPerHour(cubicmeterpersecond.AcreFeetPerHour).CubicMetersPerSecond, AcreFeetPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromAcreFeetPerMinute(cubicmeterpersecond.AcreFeetPerMinute).CubicMetersPerSecond, AcreFeetPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromAcreFeetPerSecond(cubicmeterpersecond.AcreFeetPerSecond).CubicMetersPerSecond, AcreFeetPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCentilitersPerDay(cubicmeterpersecond.CentilitersPerDay).CubicMetersPerSecond, CentilitersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCentilitersPerMinute(cubicmeterpersecond.CentilitersPerMinute).CubicMetersPerSecond, CentilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicDecimetersPerMinute(cubicmeterpersecond.CubicDecimetersPerMinute).CubicMetersPerSecond, CubicDecimetersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicFeetPerHour(cubicmeterpersecond.CubicFeetPerHour).CubicMetersPerSecond, CubicFeetPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicFeetPerMinute(cubicmeterpersecond.CubicFeetPerMinute).CubicMetersPerSecond, CubicFeetPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicFeetPerSecond(cubicmeterpersecond.CubicFeetPerSecond).CubicMetersPerSecond, CubicFeetPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicMetersPerDay(cubicmeterpersecond.CubicMetersPerDay).CubicMetersPerSecond, CubicMetersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicMetersPerHour(cubicmeterpersecond.CubicMetersPerHour).CubicMetersPerSecond, CubicMetersPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicMetersPerMinute(cubicmeterpersecond.CubicMetersPerMinute).CubicMetersPerSecond, CubicMetersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicMetersPerSecond(cubicmeterpersecond.CubicMetersPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicMillimetersPerSecond(cubicmeterpersecond.CubicMillimetersPerSecond).CubicMetersPerSecond, CubicMillimetersPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicYardsPerDay(cubicmeterpersecond.CubicYardsPerDay).CubicMetersPerSecond, CubicYardsPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicYardsPerHour(cubicmeterpersecond.CubicYardsPerHour).CubicMetersPerSecond, CubicYardsPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicYardsPerMinute(cubicmeterpersecond.CubicYardsPerMinute).CubicMetersPerSecond, CubicYardsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicYardsPerSecond(cubicmeterpersecond.CubicYardsPerSecond).CubicMetersPerSecond, CubicYardsPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromDecilitersPerDay(cubicmeterpersecond.DecilitersPerDay).CubicMetersPerSecond, DecilitersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromDecilitersPerMinute(cubicmeterpersecond.DecilitersPerMinute).CubicMetersPerSecond, DecilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromKilolitersPerDay(cubicmeterpersecond.KilolitersPerDay).CubicMetersPerSecond, KilolitersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromKilolitersPerMinute(cubicmeterpersecond.KilolitersPerMinute).CubicMetersPerSecond, KilolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromKilousGallonsPerMinute(cubicmeterpersecond.KilousGallonsPerMinute).CubicMetersPerSecond, KilousGallonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromLitersPerDay(cubicmeterpersecond.LitersPerDay).CubicMetersPerSecond, LitersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromLitersPerHour(cubicmeterpersecond.LitersPerHour).CubicMetersPerSecond, LitersPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromLitersPerMinute(cubicmeterpersecond.LitersPerMinute).CubicMetersPerSecond, LitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromLitersPerSecond(cubicmeterpersecond.LitersPerSecond).CubicMetersPerSecond, LitersPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromMegalitersPerDay(cubicmeterpersecond.MegalitersPerDay).CubicMetersPerSecond, MegalitersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromMegaukGallonsPerSecond(cubicmeterpersecond.MegaukGallonsPerSecond).CubicMetersPerSecond, MegaukGallonsPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromMicrolitersPerDay(cubicmeterpersecond.MicrolitersPerDay).CubicMetersPerSecond, MicrolitersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromMicrolitersPerMinute(cubicmeterpersecond.MicrolitersPerMinute).CubicMetersPerSecond, MicrolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromMillilitersPerDay(cubicmeterpersecond.MillilitersPerDay).CubicMetersPerSecond, MillilitersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromMillilitersPerMinute(cubicmeterpersecond.MillilitersPerMinute).CubicMetersPerSecond, MillilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromMillionUsGallonsPerDay(cubicmeterpersecond.MillionUsGallonsPerDay).CubicMetersPerSecond, MillionUsGallonsPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromNanolitersPerDay(cubicmeterpersecond.NanolitersPerDay).CubicMetersPerSecond, NanolitersPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromNanolitersPerMinute(cubicmeterpersecond.NanolitersPerMinute).CubicMetersPerSecond, NanolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromOilBarrelsPerDay(cubicmeterpersecond.OilBarrelsPerDay).CubicMetersPerSecond, OilBarrelsPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromOilBarrelsPerHour(cubicmeterpersecond.OilBarrelsPerHour).CubicMetersPerSecond, OilBarrelsPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromOilBarrelsPerMinute(cubicmeterpersecond.OilBarrelsPerMinute).CubicMetersPerSecond, OilBarrelsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromOilBarrelsPerSecond(cubicmeterpersecond.OilBarrelsPerSecond).CubicMetersPerSecond, OilBarrelsPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromUkGallonsPerDay(cubicmeterpersecond.UkGallonsPerDay).CubicMetersPerSecond, UkGallonsPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromUkGallonsPerHour(cubicmeterpersecond.UkGallonsPerHour).CubicMetersPerSecond, UkGallonsPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromUkGallonsPerMinute(cubicmeterpersecond.UkGallonsPerMinute).CubicMetersPerSecond, UkGallonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromUkGallonsPerSecond(cubicmeterpersecond.UkGallonsPerSecond).CubicMetersPerSecond, UkGallonsPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromUsGallonsPerDay(cubicmeterpersecond.UsGallonsPerDay).CubicMetersPerSecond, UsGallonsPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromUsGallonsPerHour(cubicmeterpersecond.UsGallonsPerHour).CubicMetersPerSecond, UsGallonsPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromUsGallonsPerMinute(cubicmeterpersecond.UsGallonsPerMinute).CubicMetersPerSecond, UsGallonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromUsGallonsPerSecond(cubicmeterpersecond.UsGallonsPerSecond).CubicMetersPerSecond, UsGallonsPerSecondTolerance); + VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); + AssertEx.EqualTolerance(1, VolumeFlow.FromAcreFeetPerDay(cubicmeterpersecond.AcreFeetPerDay).CubicMetersPerSecond, AcreFeetPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromAcreFeetPerHour(cubicmeterpersecond.AcreFeetPerHour).CubicMetersPerSecond, AcreFeetPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromAcreFeetPerMinute(cubicmeterpersecond.AcreFeetPerMinute).CubicMetersPerSecond, AcreFeetPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromAcreFeetPerSecond(cubicmeterpersecond.AcreFeetPerSecond).CubicMetersPerSecond, AcreFeetPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromCentilitersPerDay(cubicmeterpersecond.CentilitersPerDay).CubicMetersPerSecond, CentilitersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromCentilitersPerMinute(cubicmeterpersecond.CentilitersPerMinute).CubicMetersPerSecond, CentilitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromCubicDecimetersPerMinute(cubicmeterpersecond.CubicDecimetersPerMinute).CubicMetersPerSecond, CubicDecimetersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromCubicFeetPerHour(cubicmeterpersecond.CubicFeetPerHour).CubicMetersPerSecond, CubicFeetPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromCubicFeetPerMinute(cubicmeterpersecond.CubicFeetPerMinute).CubicMetersPerSecond, CubicFeetPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromCubicFeetPerSecond(cubicmeterpersecond.CubicFeetPerSecond).CubicMetersPerSecond, CubicFeetPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromCubicMetersPerDay(cubicmeterpersecond.CubicMetersPerDay).CubicMetersPerSecond, CubicMetersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromCubicMetersPerHour(cubicmeterpersecond.CubicMetersPerHour).CubicMetersPerSecond, CubicMetersPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromCubicMetersPerMinute(cubicmeterpersecond.CubicMetersPerMinute).CubicMetersPerSecond, CubicMetersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromCubicMetersPerSecond(cubicmeterpersecond.CubicMetersPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromCubicMillimetersPerSecond(cubicmeterpersecond.CubicMillimetersPerSecond).CubicMetersPerSecond, CubicMillimetersPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromCubicYardsPerDay(cubicmeterpersecond.CubicYardsPerDay).CubicMetersPerSecond, CubicYardsPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromCubicYardsPerHour(cubicmeterpersecond.CubicYardsPerHour).CubicMetersPerSecond, CubicYardsPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromCubicYardsPerMinute(cubicmeterpersecond.CubicYardsPerMinute).CubicMetersPerSecond, CubicYardsPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromCubicYardsPerSecond(cubicmeterpersecond.CubicYardsPerSecond).CubicMetersPerSecond, CubicYardsPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromDecilitersPerDay(cubicmeterpersecond.DecilitersPerDay).CubicMetersPerSecond, DecilitersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromDecilitersPerMinute(cubicmeterpersecond.DecilitersPerMinute).CubicMetersPerSecond, DecilitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromKilolitersPerDay(cubicmeterpersecond.KilolitersPerDay).CubicMetersPerSecond, KilolitersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromKilolitersPerMinute(cubicmeterpersecond.KilolitersPerMinute).CubicMetersPerSecond, KilolitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromKilousGallonsPerMinute(cubicmeterpersecond.KilousGallonsPerMinute).CubicMetersPerSecond, KilousGallonsPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromLitersPerDay(cubicmeterpersecond.LitersPerDay).CubicMetersPerSecond, LitersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromLitersPerHour(cubicmeterpersecond.LitersPerHour).CubicMetersPerSecond, LitersPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromLitersPerMinute(cubicmeterpersecond.LitersPerMinute).CubicMetersPerSecond, LitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromLitersPerSecond(cubicmeterpersecond.LitersPerSecond).CubicMetersPerSecond, LitersPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromMegalitersPerDay(cubicmeterpersecond.MegalitersPerDay).CubicMetersPerSecond, MegalitersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromMegaukGallonsPerSecond(cubicmeterpersecond.MegaukGallonsPerSecond).CubicMetersPerSecond, MegaukGallonsPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromMicrolitersPerDay(cubicmeterpersecond.MicrolitersPerDay).CubicMetersPerSecond, MicrolitersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromMicrolitersPerMinute(cubicmeterpersecond.MicrolitersPerMinute).CubicMetersPerSecond, MicrolitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromMillilitersPerDay(cubicmeterpersecond.MillilitersPerDay).CubicMetersPerSecond, MillilitersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromMillilitersPerMinute(cubicmeterpersecond.MillilitersPerMinute).CubicMetersPerSecond, MillilitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromMillionUsGallonsPerDay(cubicmeterpersecond.MillionUsGallonsPerDay).CubicMetersPerSecond, MillionUsGallonsPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromNanolitersPerDay(cubicmeterpersecond.NanolitersPerDay).CubicMetersPerSecond, NanolitersPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromNanolitersPerMinute(cubicmeterpersecond.NanolitersPerMinute).CubicMetersPerSecond, NanolitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromOilBarrelsPerDay(cubicmeterpersecond.OilBarrelsPerDay).CubicMetersPerSecond, OilBarrelsPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromOilBarrelsPerHour(cubicmeterpersecond.OilBarrelsPerHour).CubicMetersPerSecond, OilBarrelsPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromOilBarrelsPerMinute(cubicmeterpersecond.OilBarrelsPerMinute).CubicMetersPerSecond, OilBarrelsPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromOilBarrelsPerSecond(cubicmeterpersecond.OilBarrelsPerSecond).CubicMetersPerSecond, OilBarrelsPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromUkGallonsPerDay(cubicmeterpersecond.UkGallonsPerDay).CubicMetersPerSecond, UkGallonsPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromUkGallonsPerHour(cubicmeterpersecond.UkGallonsPerHour).CubicMetersPerSecond, UkGallonsPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromUkGallonsPerMinute(cubicmeterpersecond.UkGallonsPerMinute).CubicMetersPerSecond, UkGallonsPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromUkGallonsPerSecond(cubicmeterpersecond.UkGallonsPerSecond).CubicMetersPerSecond, UkGallonsPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromUsGallonsPerDay(cubicmeterpersecond.UsGallonsPerDay).CubicMetersPerSecond, UsGallonsPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromUsGallonsPerHour(cubicmeterpersecond.UsGallonsPerHour).CubicMetersPerSecond, UsGallonsPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromUsGallonsPerMinute(cubicmeterpersecond.UsGallonsPerMinute).CubicMetersPerSecond, UsGallonsPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.FromUsGallonsPerSecond(cubicmeterpersecond.UsGallonsPerSecond).CubicMetersPerSecond, UsGallonsPerSecondTolerance); } [Fact] public void ArithmeticOperators() { - VolumeFlow v = VolumeFlow.FromCubicMetersPerSecond(1); + VolumeFlow v = VolumeFlow.FromCubicMetersPerSecond(1); AssertEx.EqualTolerance(-1, -v.CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (VolumeFlow.FromCubicMetersPerSecond(3)-v).CubicMetersPerSecond, CubicMetersPerSecondTolerance); + AssertEx.EqualTolerance(2, (VolumeFlow.FromCubicMetersPerSecond(3)-v).CubicMetersPerSecond, CubicMetersPerSecondTolerance); AssertEx.EqualTolerance(2, (v + v).CubicMetersPerSecond, CubicMetersPerSecondTolerance); AssertEx.EqualTolerance(10, (v*10).CubicMetersPerSecond, CubicMetersPerSecondTolerance); AssertEx.EqualTolerance(10, (10*v).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (VolumeFlow.FromCubicMetersPerSecond(10)/5).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, VolumeFlow.FromCubicMetersPerSecond(10)/VolumeFlow.FromCubicMetersPerSecond(5), CubicMetersPerSecondTolerance); + AssertEx.EqualTolerance(2, (VolumeFlow.FromCubicMetersPerSecond(10)/5).CubicMetersPerSecond, CubicMetersPerSecondTolerance); + AssertEx.EqualTolerance(2, VolumeFlow.FromCubicMetersPerSecond(10)/VolumeFlow.FromCubicMetersPerSecond(5), CubicMetersPerSecondTolerance); } [Fact] public void ComparisonOperators() { - VolumeFlow oneCubicMeterPerSecond = VolumeFlow.FromCubicMetersPerSecond(1); - VolumeFlow twoCubicMetersPerSecond = VolumeFlow.FromCubicMetersPerSecond(2); + VolumeFlow oneCubicMeterPerSecond = VolumeFlow.FromCubicMetersPerSecond(1); + VolumeFlow twoCubicMetersPerSecond = VolumeFlow.FromCubicMetersPerSecond(2); Assert.True(oneCubicMeterPerSecond < twoCubicMetersPerSecond); Assert.True(oneCubicMeterPerSecond <= twoCubicMetersPerSecond); @@ -622,31 +622,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); + VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); Assert.Equal(0, cubicmeterpersecond.CompareTo(cubicmeterpersecond)); - Assert.True(cubicmeterpersecond.CompareTo(VolumeFlow.Zero) > 0); - Assert.True(VolumeFlow.Zero.CompareTo(cubicmeterpersecond) < 0); + Assert.True(cubicmeterpersecond.CompareTo(VolumeFlow.Zero) > 0); + Assert.True(VolumeFlow.Zero.CompareTo(cubicmeterpersecond) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); + VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); Assert.Throws(() => cubicmeterpersecond.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); + VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); Assert.Throws(() => cubicmeterpersecond.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = VolumeFlow.FromCubicMetersPerSecond(1); - var b = VolumeFlow.FromCubicMetersPerSecond(2); + var a = VolumeFlow.FromCubicMetersPerSecond(1); + var b = VolumeFlow.FromCubicMetersPerSecond(2); // ReSharper disable EqualExpressionComparison @@ -665,8 +665,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = VolumeFlow.FromCubicMetersPerSecond(1); - var b = VolumeFlow.FromCubicMetersPerSecond(2); + var a = VolumeFlow.FromCubicMetersPerSecond(1); + var b = VolumeFlow.FromCubicMetersPerSecond(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -676,29 +676,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = VolumeFlow.FromCubicMetersPerSecond(1); - Assert.True(v.Equals(VolumeFlow.FromCubicMetersPerSecond(1), CubicMetersPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(VolumeFlow.Zero, CubicMetersPerSecondTolerance, ComparisonType.Relative)); + var v = VolumeFlow.FromCubicMetersPerSecond(1); + Assert.True(v.Equals(VolumeFlow.FromCubicMetersPerSecond(1), CubicMetersPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(VolumeFlow.Zero, CubicMetersPerSecondTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); + VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); Assert.False(cubicmeterpersecond.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); + VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); Assert.False(cubicmeterpersecond.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(VolumeFlowUnit.Undefined, VolumeFlow.Units); + Assert.DoesNotContain(VolumeFlowUnit.Undefined, VolumeFlow.Units); } [Fact] @@ -717,7 +717,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(VolumeFlow.BaseDimensions is null); + Assert.False(VolumeFlow.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/VolumePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumePerLengthTestsBase.g.cs index e28c1081d4..aa114de110 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumePerLengthTestsBase.g.cs @@ -47,26 +47,26 @@ public abstract partial class VolumePerLengthTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new VolumePerLength((double)0.0, VolumePerLengthUnit.Undefined)); + Assert.Throws(() => new VolumePerLength((double)0.0, VolumePerLengthUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new VolumePerLength(double.PositiveInfinity, VolumePerLengthUnit.CubicMeterPerMeter)); - Assert.Throws(() => new VolumePerLength(double.NegativeInfinity, VolumePerLengthUnit.CubicMeterPerMeter)); + Assert.Throws(() => new VolumePerLength(double.PositiveInfinity, VolumePerLengthUnit.CubicMeterPerMeter)); + Assert.Throws(() => new VolumePerLength(double.NegativeInfinity, VolumePerLengthUnit.CubicMeterPerMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new VolumePerLength(double.NaN, VolumePerLengthUnit.CubicMeterPerMeter)); + Assert.Throws(() => new VolumePerLength(double.NaN, VolumePerLengthUnit.CubicMeterPerMeter)); } [Fact] public void CubicMeterPerMeterToVolumePerLengthUnits() { - VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); + VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); AssertEx.EqualTolerance(CubicMetersPerMeterInOneCubicMeterPerMeter, cubicmeterpermeter.CubicMetersPerMeter, CubicMetersPerMeterTolerance); AssertEx.EqualTolerance(LitersPerMeterInOneCubicMeterPerMeter, cubicmeterpermeter.LitersPerMeter, LitersPerMeterTolerance); AssertEx.EqualTolerance(OilBarrelsPerFootInOneCubicMeterPerMeter, cubicmeterpermeter.OilBarrelsPerFoot, OilBarrelsPerFootTolerance); @@ -75,28 +75,28 @@ public void CubicMeterPerMeterToVolumePerLengthUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, VolumePerLength.From(1, VolumePerLengthUnit.CubicMeterPerMeter).CubicMetersPerMeter, CubicMetersPerMeterTolerance); - AssertEx.EqualTolerance(1, VolumePerLength.From(1, VolumePerLengthUnit.LiterPerMeter).LitersPerMeter, LitersPerMeterTolerance); - AssertEx.EqualTolerance(1, VolumePerLength.From(1, VolumePerLengthUnit.OilBarrelPerFoot).OilBarrelsPerFoot, OilBarrelsPerFootTolerance); + AssertEx.EqualTolerance(1, VolumePerLength.From(1, VolumePerLengthUnit.CubicMeterPerMeter).CubicMetersPerMeter, CubicMetersPerMeterTolerance); + AssertEx.EqualTolerance(1, VolumePerLength.From(1, VolumePerLengthUnit.LiterPerMeter).LitersPerMeter, LitersPerMeterTolerance); + AssertEx.EqualTolerance(1, VolumePerLength.From(1, VolumePerLengthUnit.OilBarrelPerFoot).OilBarrelsPerFoot, OilBarrelsPerFootTolerance); } [Fact] public void FromCubicMetersPerMeter_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => VolumePerLength.FromCubicMetersPerMeter(double.PositiveInfinity)); - Assert.Throws(() => VolumePerLength.FromCubicMetersPerMeter(double.NegativeInfinity)); + Assert.Throws(() => VolumePerLength.FromCubicMetersPerMeter(double.PositiveInfinity)); + Assert.Throws(() => VolumePerLength.FromCubicMetersPerMeter(double.NegativeInfinity)); } [Fact] public void FromCubicMetersPerMeter_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => VolumePerLength.FromCubicMetersPerMeter(double.NaN)); + Assert.Throws(() => VolumePerLength.FromCubicMetersPerMeter(double.NaN)); } [Fact] public void As() { - var cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); + var cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); AssertEx.EqualTolerance(CubicMetersPerMeterInOneCubicMeterPerMeter, cubicmeterpermeter.As(VolumePerLengthUnit.CubicMeterPerMeter), CubicMetersPerMeterTolerance); AssertEx.EqualTolerance(LitersPerMeterInOneCubicMeterPerMeter, cubicmeterpermeter.As(VolumePerLengthUnit.LiterPerMeter), LitersPerMeterTolerance); AssertEx.EqualTolerance(OilBarrelsPerFootInOneCubicMeterPerMeter, cubicmeterpermeter.As(VolumePerLengthUnit.OilBarrelPerFoot), OilBarrelsPerFootTolerance); @@ -105,7 +105,7 @@ public void As() [Fact] public void ToUnit() { - var cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); + var cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); var cubicmeterpermeterQuantity = cubicmeterpermeter.ToUnit(VolumePerLengthUnit.CubicMeterPerMeter); AssertEx.EqualTolerance(CubicMetersPerMeterInOneCubicMeterPerMeter, (double)cubicmeterpermeterQuantity.Value, CubicMetersPerMeterTolerance); @@ -123,30 +123,30 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); - AssertEx.EqualTolerance(1, VolumePerLength.FromCubicMetersPerMeter(cubicmeterpermeter.CubicMetersPerMeter).CubicMetersPerMeter, CubicMetersPerMeterTolerance); - AssertEx.EqualTolerance(1, VolumePerLength.FromLitersPerMeter(cubicmeterpermeter.LitersPerMeter).CubicMetersPerMeter, LitersPerMeterTolerance); - AssertEx.EqualTolerance(1, VolumePerLength.FromOilBarrelsPerFoot(cubicmeterpermeter.OilBarrelsPerFoot).CubicMetersPerMeter, OilBarrelsPerFootTolerance); + VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); + AssertEx.EqualTolerance(1, VolumePerLength.FromCubicMetersPerMeter(cubicmeterpermeter.CubicMetersPerMeter).CubicMetersPerMeter, CubicMetersPerMeterTolerance); + AssertEx.EqualTolerance(1, VolumePerLength.FromLitersPerMeter(cubicmeterpermeter.LitersPerMeter).CubicMetersPerMeter, LitersPerMeterTolerance); + AssertEx.EqualTolerance(1, VolumePerLength.FromOilBarrelsPerFoot(cubicmeterpermeter.OilBarrelsPerFoot).CubicMetersPerMeter, OilBarrelsPerFootTolerance); } [Fact] public void ArithmeticOperators() { - VolumePerLength v = VolumePerLength.FromCubicMetersPerMeter(1); + VolumePerLength v = VolumePerLength.FromCubicMetersPerMeter(1); AssertEx.EqualTolerance(-1, -v.CubicMetersPerMeter, CubicMetersPerMeterTolerance); - AssertEx.EqualTolerance(2, (VolumePerLength.FromCubicMetersPerMeter(3)-v).CubicMetersPerMeter, CubicMetersPerMeterTolerance); + AssertEx.EqualTolerance(2, (VolumePerLength.FromCubicMetersPerMeter(3)-v).CubicMetersPerMeter, CubicMetersPerMeterTolerance); AssertEx.EqualTolerance(2, (v + v).CubicMetersPerMeter, CubicMetersPerMeterTolerance); AssertEx.EqualTolerance(10, (v*10).CubicMetersPerMeter, CubicMetersPerMeterTolerance); AssertEx.EqualTolerance(10, (10*v).CubicMetersPerMeter, CubicMetersPerMeterTolerance); - AssertEx.EqualTolerance(2, (VolumePerLength.FromCubicMetersPerMeter(10)/5).CubicMetersPerMeter, CubicMetersPerMeterTolerance); - AssertEx.EqualTolerance(2, VolumePerLength.FromCubicMetersPerMeter(10)/VolumePerLength.FromCubicMetersPerMeter(5), CubicMetersPerMeterTolerance); + AssertEx.EqualTolerance(2, (VolumePerLength.FromCubicMetersPerMeter(10)/5).CubicMetersPerMeter, CubicMetersPerMeterTolerance); + AssertEx.EqualTolerance(2, VolumePerLength.FromCubicMetersPerMeter(10)/VolumePerLength.FromCubicMetersPerMeter(5), CubicMetersPerMeterTolerance); } [Fact] public void ComparisonOperators() { - VolumePerLength oneCubicMeterPerMeter = VolumePerLength.FromCubicMetersPerMeter(1); - VolumePerLength twoCubicMetersPerMeter = VolumePerLength.FromCubicMetersPerMeter(2); + VolumePerLength oneCubicMeterPerMeter = VolumePerLength.FromCubicMetersPerMeter(1); + VolumePerLength twoCubicMetersPerMeter = VolumePerLength.FromCubicMetersPerMeter(2); Assert.True(oneCubicMeterPerMeter < twoCubicMetersPerMeter); Assert.True(oneCubicMeterPerMeter <= twoCubicMetersPerMeter); @@ -162,31 +162,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); + VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); Assert.Equal(0, cubicmeterpermeter.CompareTo(cubicmeterpermeter)); - Assert.True(cubicmeterpermeter.CompareTo(VolumePerLength.Zero) > 0); - Assert.True(VolumePerLength.Zero.CompareTo(cubicmeterpermeter) < 0); + Assert.True(cubicmeterpermeter.CompareTo(VolumePerLength.Zero) > 0); + Assert.True(VolumePerLength.Zero.CompareTo(cubicmeterpermeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); + VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); Assert.Throws(() => cubicmeterpermeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); + VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); Assert.Throws(() => cubicmeterpermeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = VolumePerLength.FromCubicMetersPerMeter(1); - var b = VolumePerLength.FromCubicMetersPerMeter(2); + var a = VolumePerLength.FromCubicMetersPerMeter(1); + var b = VolumePerLength.FromCubicMetersPerMeter(2); // ReSharper disable EqualExpressionComparison @@ -205,8 +205,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = VolumePerLength.FromCubicMetersPerMeter(1); - var b = VolumePerLength.FromCubicMetersPerMeter(2); + var a = VolumePerLength.FromCubicMetersPerMeter(1); + var b = VolumePerLength.FromCubicMetersPerMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -216,29 +216,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = VolumePerLength.FromCubicMetersPerMeter(1); - Assert.True(v.Equals(VolumePerLength.FromCubicMetersPerMeter(1), CubicMetersPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(VolumePerLength.Zero, CubicMetersPerMeterTolerance, ComparisonType.Relative)); + var v = VolumePerLength.FromCubicMetersPerMeter(1); + Assert.True(v.Equals(VolumePerLength.FromCubicMetersPerMeter(1), CubicMetersPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(VolumePerLength.Zero, CubicMetersPerMeterTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); + VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); Assert.False(cubicmeterpermeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); + VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1); Assert.False(cubicmeterpermeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(VolumePerLengthUnit.Undefined, VolumePerLength.Units); + Assert.DoesNotContain(VolumePerLengthUnit.Undefined, VolumePerLength.Units); } [Fact] @@ -257,7 +257,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(VolumePerLength.BaseDimensions is null); + Assert.False(VolumePerLength.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs index 187bc90fc2..1d9e185b5f 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Volume. + /// Test of Volume. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class VolumeTestsBase @@ -135,26 +135,26 @@ public abstract partial class VolumeTestsBase [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new Volume((double)0.0, VolumeUnit.Undefined)); + Assert.Throws(() => new Volume((double)0.0, VolumeUnit.Undefined)); } [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => new Volume(double.PositiveInfinity, VolumeUnit.CubicMeter)); - Assert.Throws(() => new Volume(double.NegativeInfinity, VolumeUnit.CubicMeter)); + Assert.Throws(() => new Volume(double.PositiveInfinity, VolumeUnit.CubicMeter)); + Assert.Throws(() => new Volume(double.NegativeInfinity, VolumeUnit.CubicMeter)); } [Fact] public void Ctor_WithNaNValue_ThrowsArgumentException() { - Assert.Throws(() => new Volume(double.NaN, VolumeUnit.CubicMeter)); + Assert.Throws(() => new Volume(double.NaN, VolumeUnit.CubicMeter)); } [Fact] public void CubicMeterToVolumeUnits() { - Volume cubicmeter = Volume.FromCubicMeters(1); + Volume cubicmeter = Volume.FromCubicMeters(1); AssertEx.EqualTolerance(AcreFeetInOneCubicMeter, cubicmeter.AcreFeet, AcreFeetTolerance); AssertEx.EqualTolerance(AuTablespoonsInOneCubicMeter, cubicmeter.AuTablespoons, AuTablespoonsTolerance); AssertEx.EqualTolerance(CentilitersInOneCubicMeter, cubicmeter.Centiliters, CentilitersTolerance); @@ -207,72 +207,72 @@ public void CubicMeterToVolumeUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.AcreFoot).AcreFeet, AcreFeetTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.AuTablespoon).AuTablespoons, AuTablespoonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Centiliter).Centiliters, CentilitersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicCentimeter).CubicCentimeters, CubicCentimetersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicDecimeter).CubicDecimeters, CubicDecimetersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicFoot).CubicFeet, CubicFeetTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicHectometer).CubicHectometers, CubicHectometersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicInch).CubicInches, CubicInchesTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicKilometer).CubicKilometers, CubicKilometersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicMeter).CubicMeters, CubicMetersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicMicrometer).CubicMicrometers, CubicMicrometersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicMile).CubicMiles, CubicMilesTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicMillimeter).CubicMillimeters, CubicMillimetersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicYard).CubicYards, CubicYardsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Deciliter).Deciliters, DecilitersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.HectocubicFoot).HectocubicFeet, HectocubicFeetTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.HectocubicMeter).HectocubicMeters, HectocubicMetersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Hectoliter).Hectoliters, HectolitersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.ImperialBeerBarrel).ImperialBeerBarrels, ImperialBeerBarrelsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.ImperialGallon).ImperialGallons, ImperialGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.ImperialOunce).ImperialOunces, ImperialOuncesTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.ImperialPint).ImperialPints, ImperialPintsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.KilocubicFoot).KilocubicFeet, KilocubicFeetTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.KilocubicMeter).KilocubicMeters, KilocubicMetersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.KiloimperialGallon).KiloimperialGallons, KiloimperialGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Kiloliter).Kiloliters, KilolitersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.KilousGallon).KilousGallons, KilousGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Liter).Liters, LitersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MegacubicFoot).MegacubicFeet, MegacubicFeetTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MegaimperialGallon).MegaimperialGallons, MegaimperialGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Megaliter).Megaliters, MegalitersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MegausGallon).MegausGallons, MegausGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MetricCup).MetricCups, MetricCupsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MetricTeaspoon).MetricTeaspoons, MetricTeaspoonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Microliter).Microliters, MicrolitersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Milliliter).Milliliters, MillilitersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.OilBarrel).OilBarrels, OilBarrelsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UkTablespoon).UkTablespoons, UkTablespoonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsBeerBarrel).UsBeerBarrels, UsBeerBarrelsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsCustomaryCup).UsCustomaryCups, UsCustomaryCupsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsGallon).UsGallons, UsGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsLegalCup).UsLegalCups, UsLegalCupsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsOunce).UsOunces, UsOuncesTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsPint).UsPints, UsPintsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsQuart).UsQuarts, UsQuartsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsTablespoon).UsTablespoons, UsTablespoonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsTeaspoon).UsTeaspoons, UsTeaspoonsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.AcreFoot).AcreFeet, AcreFeetTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.AuTablespoon).AuTablespoons, AuTablespoonsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Centiliter).Centiliters, CentilitersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicCentimeter).CubicCentimeters, CubicCentimetersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicDecimeter).CubicDecimeters, CubicDecimetersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicFoot).CubicFeet, CubicFeetTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicHectometer).CubicHectometers, CubicHectometersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicInch).CubicInches, CubicInchesTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicKilometer).CubicKilometers, CubicKilometersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicMeter).CubicMeters, CubicMetersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicMicrometer).CubicMicrometers, CubicMicrometersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicMile).CubicMiles, CubicMilesTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicMillimeter).CubicMillimeters, CubicMillimetersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicYard).CubicYards, CubicYardsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Deciliter).Deciliters, DecilitersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.HectocubicFoot).HectocubicFeet, HectocubicFeetTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.HectocubicMeter).HectocubicMeters, HectocubicMetersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Hectoliter).Hectoliters, HectolitersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.ImperialBeerBarrel).ImperialBeerBarrels, ImperialBeerBarrelsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.ImperialGallon).ImperialGallons, ImperialGallonsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.ImperialOunce).ImperialOunces, ImperialOuncesTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.ImperialPint).ImperialPints, ImperialPintsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.KilocubicFoot).KilocubicFeet, KilocubicFeetTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.KilocubicMeter).KilocubicMeters, KilocubicMetersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.KiloimperialGallon).KiloimperialGallons, KiloimperialGallonsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Kiloliter).Kiloliters, KilolitersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.KilousGallon).KilousGallons, KilousGallonsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Liter).Liters, LitersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MegacubicFoot).MegacubicFeet, MegacubicFeetTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MegaimperialGallon).MegaimperialGallons, MegaimperialGallonsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Megaliter).Megaliters, MegalitersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MegausGallon).MegausGallons, MegausGallonsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MetricCup).MetricCups, MetricCupsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MetricTeaspoon).MetricTeaspoons, MetricTeaspoonsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Microliter).Microliters, MicrolitersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Milliliter).Milliliters, MillilitersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.OilBarrel).OilBarrels, OilBarrelsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UkTablespoon).UkTablespoons, UkTablespoonsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsBeerBarrel).UsBeerBarrels, UsBeerBarrelsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsCustomaryCup).UsCustomaryCups, UsCustomaryCupsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsGallon).UsGallons, UsGallonsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsLegalCup).UsLegalCups, UsLegalCupsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsOunce).UsOunces, UsOuncesTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsPint).UsPints, UsPintsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsQuart).UsQuarts, UsQuartsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsTablespoon).UsTablespoons, UsTablespoonsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsTeaspoon).UsTeaspoons, UsTeaspoonsTolerance); } [Fact] public void FromCubicMeters_WithInfinityValue_ThrowsArgumentException() { - Assert.Throws(() => Volume.FromCubicMeters(double.PositiveInfinity)); - Assert.Throws(() => Volume.FromCubicMeters(double.NegativeInfinity)); + Assert.Throws(() => Volume.FromCubicMeters(double.PositiveInfinity)); + Assert.Throws(() => Volume.FromCubicMeters(double.NegativeInfinity)); } [Fact] public void FromCubicMeters_WithNanValue_ThrowsArgumentException() { - Assert.Throws(() => Volume.FromCubicMeters(double.NaN)); + Assert.Throws(() => Volume.FromCubicMeters(double.NaN)); } [Fact] public void As() { - var cubicmeter = Volume.FromCubicMeters(1); + var cubicmeter = Volume.FromCubicMeters(1); AssertEx.EqualTolerance(AcreFeetInOneCubicMeter, cubicmeter.As(VolumeUnit.AcreFoot), AcreFeetTolerance); AssertEx.EqualTolerance(AuTablespoonsInOneCubicMeter, cubicmeter.As(VolumeUnit.AuTablespoon), AuTablespoonsTolerance); AssertEx.EqualTolerance(CentilitersInOneCubicMeter, cubicmeter.As(VolumeUnit.Centiliter), CentilitersTolerance); @@ -325,7 +325,7 @@ public void As() [Fact] public void ToUnit() { - var cubicmeter = Volume.FromCubicMeters(1); + var cubicmeter = Volume.FromCubicMeters(1); var acrefootQuantity = cubicmeter.ToUnit(VolumeUnit.AcreFoot); AssertEx.EqualTolerance(AcreFeetInOneCubicMeter, (double)acrefootQuantity.Value, AcreFeetTolerance); @@ -519,74 +519,74 @@ public void ToUnit() [Fact] public void ConversionRoundTrip() { - Volume cubicmeter = Volume.FromCubicMeters(1); - AssertEx.EqualTolerance(1, Volume.FromAcreFeet(cubicmeter.AcreFeet).CubicMeters, AcreFeetTolerance); - AssertEx.EqualTolerance(1, Volume.FromAuTablespoons(cubicmeter.AuTablespoons).CubicMeters, AuTablespoonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromCentiliters(cubicmeter.Centiliters).CubicMeters, CentilitersTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicCentimeters(cubicmeter.CubicCentimeters).CubicMeters, CubicCentimetersTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicDecimeters(cubicmeter.CubicDecimeters).CubicMeters, CubicDecimetersTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicFeet(cubicmeter.CubicFeet).CubicMeters, CubicFeetTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicHectometers(cubicmeter.CubicHectometers).CubicMeters, CubicHectometersTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicInches(cubicmeter.CubicInches).CubicMeters, CubicInchesTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicKilometers(cubicmeter.CubicKilometers).CubicMeters, CubicKilometersTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicMeters(cubicmeter.CubicMeters).CubicMeters, CubicMetersTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicMicrometers(cubicmeter.CubicMicrometers).CubicMeters, CubicMicrometersTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicMiles(cubicmeter.CubicMiles).CubicMeters, CubicMilesTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicMillimeters(cubicmeter.CubicMillimeters).CubicMeters, CubicMillimetersTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicYards(cubicmeter.CubicYards).CubicMeters, CubicYardsTolerance); - AssertEx.EqualTolerance(1, Volume.FromDeciliters(cubicmeter.Deciliters).CubicMeters, DecilitersTolerance); - AssertEx.EqualTolerance(1, Volume.FromHectocubicFeet(cubicmeter.HectocubicFeet).CubicMeters, HectocubicFeetTolerance); - AssertEx.EqualTolerance(1, Volume.FromHectocubicMeters(cubicmeter.HectocubicMeters).CubicMeters, HectocubicMetersTolerance); - AssertEx.EqualTolerance(1, Volume.FromHectoliters(cubicmeter.Hectoliters).CubicMeters, HectolitersTolerance); - AssertEx.EqualTolerance(1, Volume.FromImperialBeerBarrels(cubicmeter.ImperialBeerBarrels).CubicMeters, ImperialBeerBarrelsTolerance); - AssertEx.EqualTolerance(1, Volume.FromImperialGallons(cubicmeter.ImperialGallons).CubicMeters, ImperialGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromImperialOunces(cubicmeter.ImperialOunces).CubicMeters, ImperialOuncesTolerance); - AssertEx.EqualTolerance(1, Volume.FromImperialPints(cubicmeter.ImperialPints).CubicMeters, ImperialPintsTolerance); - AssertEx.EqualTolerance(1, Volume.FromKilocubicFeet(cubicmeter.KilocubicFeet).CubicMeters, KilocubicFeetTolerance); - AssertEx.EqualTolerance(1, Volume.FromKilocubicMeters(cubicmeter.KilocubicMeters).CubicMeters, KilocubicMetersTolerance); - AssertEx.EqualTolerance(1, Volume.FromKiloimperialGallons(cubicmeter.KiloimperialGallons).CubicMeters, KiloimperialGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromKiloliters(cubicmeter.Kiloliters).CubicMeters, KilolitersTolerance); - AssertEx.EqualTolerance(1, Volume.FromKilousGallons(cubicmeter.KilousGallons).CubicMeters, KilousGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromLiters(cubicmeter.Liters).CubicMeters, LitersTolerance); - AssertEx.EqualTolerance(1, Volume.FromMegacubicFeet(cubicmeter.MegacubicFeet).CubicMeters, MegacubicFeetTolerance); - AssertEx.EqualTolerance(1, Volume.FromMegaimperialGallons(cubicmeter.MegaimperialGallons).CubicMeters, MegaimperialGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromMegaliters(cubicmeter.Megaliters).CubicMeters, MegalitersTolerance); - AssertEx.EqualTolerance(1, Volume.FromMegausGallons(cubicmeter.MegausGallons).CubicMeters, MegausGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromMetricCups(cubicmeter.MetricCups).CubicMeters, MetricCupsTolerance); - AssertEx.EqualTolerance(1, Volume.FromMetricTeaspoons(cubicmeter.MetricTeaspoons).CubicMeters, MetricTeaspoonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromMicroliters(cubicmeter.Microliters).CubicMeters, MicrolitersTolerance); - AssertEx.EqualTolerance(1, Volume.FromMilliliters(cubicmeter.Milliliters).CubicMeters, MillilitersTolerance); - AssertEx.EqualTolerance(1, Volume.FromOilBarrels(cubicmeter.OilBarrels).CubicMeters, OilBarrelsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUkTablespoons(cubicmeter.UkTablespoons).CubicMeters, UkTablespoonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsBeerBarrels(cubicmeter.UsBeerBarrels).CubicMeters, UsBeerBarrelsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsCustomaryCups(cubicmeter.UsCustomaryCups).CubicMeters, UsCustomaryCupsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsGallons(cubicmeter.UsGallons).CubicMeters, UsGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsLegalCups(cubicmeter.UsLegalCups).CubicMeters, UsLegalCupsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsOunces(cubicmeter.UsOunces).CubicMeters, UsOuncesTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsPints(cubicmeter.UsPints).CubicMeters, UsPintsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsQuarts(cubicmeter.UsQuarts).CubicMeters, UsQuartsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsTablespoons(cubicmeter.UsTablespoons).CubicMeters, UsTablespoonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsTeaspoons(cubicmeter.UsTeaspoons).CubicMeters, UsTeaspoonsTolerance); + Volume cubicmeter = Volume.FromCubicMeters(1); + AssertEx.EqualTolerance(1, Volume.FromAcreFeet(cubicmeter.AcreFeet).CubicMeters, AcreFeetTolerance); + AssertEx.EqualTolerance(1, Volume.FromAuTablespoons(cubicmeter.AuTablespoons).CubicMeters, AuTablespoonsTolerance); + AssertEx.EqualTolerance(1, Volume.FromCentiliters(cubicmeter.Centiliters).CubicMeters, CentilitersTolerance); + AssertEx.EqualTolerance(1, Volume.FromCubicCentimeters(cubicmeter.CubicCentimeters).CubicMeters, CubicCentimetersTolerance); + AssertEx.EqualTolerance(1, Volume.FromCubicDecimeters(cubicmeter.CubicDecimeters).CubicMeters, CubicDecimetersTolerance); + AssertEx.EqualTolerance(1, Volume.FromCubicFeet(cubicmeter.CubicFeet).CubicMeters, CubicFeetTolerance); + AssertEx.EqualTolerance(1, Volume.FromCubicHectometers(cubicmeter.CubicHectometers).CubicMeters, CubicHectometersTolerance); + AssertEx.EqualTolerance(1, Volume.FromCubicInches(cubicmeter.CubicInches).CubicMeters, CubicInchesTolerance); + AssertEx.EqualTolerance(1, Volume.FromCubicKilometers(cubicmeter.CubicKilometers).CubicMeters, CubicKilometersTolerance); + AssertEx.EqualTolerance(1, Volume.FromCubicMeters(cubicmeter.CubicMeters).CubicMeters, CubicMetersTolerance); + AssertEx.EqualTolerance(1, Volume.FromCubicMicrometers(cubicmeter.CubicMicrometers).CubicMeters, CubicMicrometersTolerance); + AssertEx.EqualTolerance(1, Volume.FromCubicMiles(cubicmeter.CubicMiles).CubicMeters, CubicMilesTolerance); + AssertEx.EqualTolerance(1, Volume.FromCubicMillimeters(cubicmeter.CubicMillimeters).CubicMeters, CubicMillimetersTolerance); + AssertEx.EqualTolerance(1, Volume.FromCubicYards(cubicmeter.CubicYards).CubicMeters, CubicYardsTolerance); + AssertEx.EqualTolerance(1, Volume.FromDeciliters(cubicmeter.Deciliters).CubicMeters, DecilitersTolerance); + AssertEx.EqualTolerance(1, Volume.FromHectocubicFeet(cubicmeter.HectocubicFeet).CubicMeters, HectocubicFeetTolerance); + AssertEx.EqualTolerance(1, Volume.FromHectocubicMeters(cubicmeter.HectocubicMeters).CubicMeters, HectocubicMetersTolerance); + AssertEx.EqualTolerance(1, Volume.FromHectoliters(cubicmeter.Hectoliters).CubicMeters, HectolitersTolerance); + AssertEx.EqualTolerance(1, Volume.FromImperialBeerBarrels(cubicmeter.ImperialBeerBarrels).CubicMeters, ImperialBeerBarrelsTolerance); + AssertEx.EqualTolerance(1, Volume.FromImperialGallons(cubicmeter.ImperialGallons).CubicMeters, ImperialGallonsTolerance); + AssertEx.EqualTolerance(1, Volume.FromImperialOunces(cubicmeter.ImperialOunces).CubicMeters, ImperialOuncesTolerance); + AssertEx.EqualTolerance(1, Volume.FromImperialPints(cubicmeter.ImperialPints).CubicMeters, ImperialPintsTolerance); + AssertEx.EqualTolerance(1, Volume.FromKilocubicFeet(cubicmeter.KilocubicFeet).CubicMeters, KilocubicFeetTolerance); + AssertEx.EqualTolerance(1, Volume.FromKilocubicMeters(cubicmeter.KilocubicMeters).CubicMeters, KilocubicMetersTolerance); + AssertEx.EqualTolerance(1, Volume.FromKiloimperialGallons(cubicmeter.KiloimperialGallons).CubicMeters, KiloimperialGallonsTolerance); + AssertEx.EqualTolerance(1, Volume.FromKiloliters(cubicmeter.Kiloliters).CubicMeters, KilolitersTolerance); + AssertEx.EqualTolerance(1, Volume.FromKilousGallons(cubicmeter.KilousGallons).CubicMeters, KilousGallonsTolerance); + AssertEx.EqualTolerance(1, Volume.FromLiters(cubicmeter.Liters).CubicMeters, LitersTolerance); + AssertEx.EqualTolerance(1, Volume.FromMegacubicFeet(cubicmeter.MegacubicFeet).CubicMeters, MegacubicFeetTolerance); + AssertEx.EqualTolerance(1, Volume.FromMegaimperialGallons(cubicmeter.MegaimperialGallons).CubicMeters, MegaimperialGallonsTolerance); + AssertEx.EqualTolerance(1, Volume.FromMegaliters(cubicmeter.Megaliters).CubicMeters, MegalitersTolerance); + AssertEx.EqualTolerance(1, Volume.FromMegausGallons(cubicmeter.MegausGallons).CubicMeters, MegausGallonsTolerance); + AssertEx.EqualTolerance(1, Volume.FromMetricCups(cubicmeter.MetricCups).CubicMeters, MetricCupsTolerance); + AssertEx.EqualTolerance(1, Volume.FromMetricTeaspoons(cubicmeter.MetricTeaspoons).CubicMeters, MetricTeaspoonsTolerance); + AssertEx.EqualTolerance(1, Volume.FromMicroliters(cubicmeter.Microliters).CubicMeters, MicrolitersTolerance); + AssertEx.EqualTolerance(1, Volume.FromMilliliters(cubicmeter.Milliliters).CubicMeters, MillilitersTolerance); + AssertEx.EqualTolerance(1, Volume.FromOilBarrels(cubicmeter.OilBarrels).CubicMeters, OilBarrelsTolerance); + AssertEx.EqualTolerance(1, Volume.FromUkTablespoons(cubicmeter.UkTablespoons).CubicMeters, UkTablespoonsTolerance); + AssertEx.EqualTolerance(1, Volume.FromUsBeerBarrels(cubicmeter.UsBeerBarrels).CubicMeters, UsBeerBarrelsTolerance); + AssertEx.EqualTolerance(1, Volume.FromUsCustomaryCups(cubicmeter.UsCustomaryCups).CubicMeters, UsCustomaryCupsTolerance); + AssertEx.EqualTolerance(1, Volume.FromUsGallons(cubicmeter.UsGallons).CubicMeters, UsGallonsTolerance); + AssertEx.EqualTolerance(1, Volume.FromUsLegalCups(cubicmeter.UsLegalCups).CubicMeters, UsLegalCupsTolerance); + AssertEx.EqualTolerance(1, Volume.FromUsOunces(cubicmeter.UsOunces).CubicMeters, UsOuncesTolerance); + AssertEx.EqualTolerance(1, Volume.FromUsPints(cubicmeter.UsPints).CubicMeters, UsPintsTolerance); + AssertEx.EqualTolerance(1, Volume.FromUsQuarts(cubicmeter.UsQuarts).CubicMeters, UsQuartsTolerance); + AssertEx.EqualTolerance(1, Volume.FromUsTablespoons(cubicmeter.UsTablespoons).CubicMeters, UsTablespoonsTolerance); + AssertEx.EqualTolerance(1, Volume.FromUsTeaspoons(cubicmeter.UsTeaspoons).CubicMeters, UsTeaspoonsTolerance); } [Fact] public void ArithmeticOperators() { - Volume v = Volume.FromCubicMeters(1); + Volume v = Volume.FromCubicMeters(1); AssertEx.EqualTolerance(-1, -v.CubicMeters, CubicMetersTolerance); - AssertEx.EqualTolerance(2, (Volume.FromCubicMeters(3)-v).CubicMeters, CubicMetersTolerance); + AssertEx.EqualTolerance(2, (Volume.FromCubicMeters(3)-v).CubicMeters, CubicMetersTolerance); AssertEx.EqualTolerance(2, (v + v).CubicMeters, CubicMetersTolerance); AssertEx.EqualTolerance(10, (v*10).CubicMeters, CubicMetersTolerance); AssertEx.EqualTolerance(10, (10*v).CubicMeters, CubicMetersTolerance); - AssertEx.EqualTolerance(2, (Volume.FromCubicMeters(10)/5).CubicMeters, CubicMetersTolerance); - AssertEx.EqualTolerance(2, Volume.FromCubicMeters(10)/Volume.FromCubicMeters(5), CubicMetersTolerance); + AssertEx.EqualTolerance(2, (Volume.FromCubicMeters(10)/5).CubicMeters, CubicMetersTolerance); + AssertEx.EqualTolerance(2, Volume.FromCubicMeters(10)/Volume.FromCubicMeters(5), CubicMetersTolerance); } [Fact] public void ComparisonOperators() { - Volume oneCubicMeter = Volume.FromCubicMeters(1); - Volume twoCubicMeters = Volume.FromCubicMeters(2); + Volume oneCubicMeter = Volume.FromCubicMeters(1); + Volume twoCubicMeters = Volume.FromCubicMeters(2); Assert.True(oneCubicMeter < twoCubicMeters); Assert.True(oneCubicMeter <= twoCubicMeters); @@ -602,31 +602,31 @@ public void ComparisonOperators() [Fact] public void CompareToIsImplemented() { - Volume cubicmeter = Volume.FromCubicMeters(1); + Volume cubicmeter = Volume.FromCubicMeters(1); Assert.Equal(0, cubicmeter.CompareTo(cubicmeter)); - Assert.True(cubicmeter.CompareTo(Volume.Zero) > 0); - Assert.True(Volume.Zero.CompareTo(cubicmeter) < 0); + Assert.True(cubicmeter.CompareTo(Volume.Zero) > 0); + Assert.True(Volume.Zero.CompareTo(cubicmeter) < 0); } [Fact] public void CompareToThrowsOnTypeMismatch() { - Volume cubicmeter = Volume.FromCubicMeters(1); + Volume cubicmeter = Volume.FromCubicMeters(1); Assert.Throws(() => cubicmeter.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - Volume cubicmeter = Volume.FromCubicMeters(1); + Volume cubicmeter = Volume.FromCubicMeters(1); Assert.Throws(() => cubicmeter.CompareTo(null)); } [Fact] public void EqualityOperators() { - var a = Volume.FromCubicMeters(1); - var b = Volume.FromCubicMeters(2); + var a = Volume.FromCubicMeters(1); + var b = Volume.FromCubicMeters(2); // ReSharper disable EqualExpressionComparison @@ -645,8 +645,8 @@ public void EqualityOperators() [Fact] public void EqualsIsImplemented() { - var a = Volume.FromCubicMeters(1); - var b = Volume.FromCubicMeters(2); + var a = Volume.FromCubicMeters(1); + var b = Volume.FromCubicMeters(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); @@ -656,29 +656,29 @@ public void EqualsIsImplemented() [Fact] public void EqualsRelativeToleranceIsImplemented() { - var v = Volume.FromCubicMeters(1); - Assert.True(v.Equals(Volume.FromCubicMeters(1), CubicMetersTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Volume.Zero, CubicMetersTolerance, ComparisonType.Relative)); + var v = Volume.FromCubicMeters(1); + Assert.True(v.Equals(Volume.FromCubicMeters(1), CubicMetersTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Volume.Zero, CubicMetersTolerance, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - Volume cubicmeter = Volume.FromCubicMeters(1); + Volume cubicmeter = Volume.FromCubicMeters(1); Assert.False(cubicmeter.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - Volume cubicmeter = Volume.FromCubicMeters(1); + Volume cubicmeter = Volume.FromCubicMeters(1); Assert.False(cubicmeter.Equals(null)); } [Fact] public void UnitsDoesNotContainUndefined() { - Assert.DoesNotContain(VolumeUnit.Undefined, Volume.Units); + Assert.DoesNotContain(VolumeUnit.Undefined, Volume.Units); } [Fact] @@ -697,7 +697,7 @@ public void HasAtLeastOneAbbreviationSpecified() [Fact] public void BaseDimensionsShouldNeverBeNull() { - Assert.False(Volume.BaseDimensions is null); + Assert.False(Volume.BaseDimensions is null); } } } diff --git a/UnitsNet.Tests/GeneratedQuantityCodeTests.cs b/UnitsNet.Tests/GeneratedQuantityCodeTests.cs index 4f188897f4..891c832678 100644 --- a/UnitsNet.Tests/GeneratedQuantityCodeTests.cs +++ b/UnitsNet.Tests/GeneratedQuantityCodeTests.cs @@ -20,12 +20,12 @@ public void LengthEquals_GivenMaxError_ReturnsTrueIfWithinError() { var smallError = 1e-5; - Assert.True(Length.FromMeters(1).Equals(Length.FromMeters(1), 0, ComparisonType.Relative), "Integer values have zero difference."); - Assert.True(Length.FromMeters(1).Equals(Length.FromMeters(1), smallError, ComparisonType.Relative), "Using a max difference value should not change that fact."); + Assert.True(Length.FromMeters(1).Equals(Length.FromMeters(1), 0, ComparisonType.Relative), "Integer values have zero difference."); + Assert.True(Length.FromMeters(1).Equals(Length.FromMeters(1), smallError, ComparisonType.Relative), "Using a max difference value should not change that fact."); - Assert.False(Length.FromMeters(1 + 0.39).Equals(Length.FromMeters(1.39), 0, ComparisonType.Relative), + Assert.False(Length.FromMeters(1 + 0.39).Equals(Length.FromMeters(1.39), 0, ComparisonType.Relative), "Example of floating precision arithmetic that produces slightly different results."); - Assert.True(Length.FromMeters(1 + 0.39).Equals(Length.FromMeters(1.39), smallError, ComparisonType.Relative), "But the difference is very small"); + Assert.True(Length.FromMeters(1 + 0.39).Equals(Length.FromMeters(1.39), smallError, ComparisonType.Relative), "But the difference is very small"); } } } diff --git a/UnitsNet.Tests/IntOverloadTests.cs b/UnitsNet.Tests/IntOverloadTests.cs index bf63007ba7..afcd9cbe1d 100644 --- a/UnitsNet.Tests/IntOverloadTests.cs +++ b/UnitsNet.Tests/IntOverloadTests.cs @@ -10,14 +10,14 @@ public class IntOverloadTests [Fact] public static void CreatingQuantityWithDoubleBackingFieldFromIntReturnsCorrectValue() { - Acceleration acceleration = Acceleration.FromMetersPerSecondSquared(1); + var acceleration = Acceleration.FromMetersPerSecondSquared(1); Assert.Equal(1.0, acceleration.MetersPerSecondSquared); } [Fact] public static void CreatingQuantityWithIntBackingFieldFromIntReturnsCorrectValue() { - Power power = Power.FromWatts(1); + var power = Power.FromWatts(1); Assert.Equal(1.0, power.Watts); } } diff --git a/UnitsNet.Tests/InterUnitConversionTests.cs b/UnitsNet.Tests/InterUnitConversionTests.cs index d19bd70de0..f503906657 100644 --- a/UnitsNet.Tests/InterUnitConversionTests.cs +++ b/UnitsNet.Tests/InterUnitConversionTests.cs @@ -10,16 +10,16 @@ public class InterUnitConversionTests [Fact] public void KilogramForceToKilogram() { - Force force = Force.FromKilogramsForce(1); - Mass mass = Mass.FromGravitationalForce(force); + var force = Force.FromKilogramsForce(1); + var mass = Mass.FromGravitationalForce(force); Assert.Equal(mass.Kilograms, force.KilogramsForce); } [Fact] public void KilogramToKilogramForce() { - Mass mass = Mass.FromKilograms(1); - Force force = Force.FromKilogramsForce(mass.Kilograms); + var mass = Mass.FromKilograms(1); + var force = Force.FromKilogramsForce(mass.Kilograms); Assert.Equal(mass.Kilograms, force.KilogramsForce); } } diff --git a/UnitsNet.Tests/LongOverloadTests.cs b/UnitsNet.Tests/LongOverloadTests.cs index fd54377f08..445aec8780 100644 --- a/UnitsNet.Tests/LongOverloadTests.cs +++ b/UnitsNet.Tests/LongOverloadTests.cs @@ -10,14 +10,14 @@ public class LongOverloadTests [Fact] public static void CreatingQuantityWithDoubleBackingFieldFromLongReturnsCorrectValue() { - Acceleration acceleration = Acceleration.FromMetersPerSecondSquared(1L); + var acceleration = Acceleration.FromMetersPerSecondSquared(1L); Assert.Equal(1.0, acceleration.MetersPerSecondSquared); } [Fact] public static void CreatingQuantityWithLongBackingFieldFromLongReturnsCorrectValue() { - Power power = Power.FromWatts(1L); + var power = Power.FromWatts(1L); Assert.Equal(1.0, power.Watts); } } diff --git a/UnitsNet.Tests/QuantityIConvertibleTests.cs b/UnitsNet.Tests/QuantityIConvertibleTests.cs index 698d4ce9b9..740ce2aa59 100644 --- a/UnitsNet.Tests/QuantityIConvertibleTests.cs +++ b/UnitsNet.Tests/QuantityIConvertibleTests.cs @@ -7,8 +7,8 @@ namespace UnitsNet.Tests { public class QuantityIConvertibleTests { - private static Length length = Length.FromMeters(3.0); - private static IConvertible lengthAsIConvertible = Length.FromMeters(3.0); + private static Length length = Length.FromMeters(3.0); + private static IConvertible lengthAsIConvertible = Length.FromMeters(3.0); [Fact] public void GetTypeCodeTest() @@ -126,28 +126,28 @@ public void ToStringTest() public void ToTypeTest() { // Same quantity type - Assert.Equal(length, lengthAsIConvertible.ToType(typeof(Length), null)); - Assert.Equal(length, Convert.ChangeType(length, typeof(Length))); + Assert.Equal(length, lengthAsIConvertible.ToType(typeof(Length), null)); + Assert.Equal(length, Convert.ChangeType(length, typeof(Length))); // Same unit type Assert.Equal(length.Unit, lengthAsIConvertible.ToType(typeof(LengthUnit), null)); Assert.Equal(length.Unit, Convert.ChangeType(length, typeof(LengthUnit))); // Different type - Assert.Throws(() => lengthAsIConvertible.ToType(typeof(Duration), null)); - Assert.Throws(() => Convert.ChangeType(length, typeof(Duration))); + Assert.Throws(() => lengthAsIConvertible.ToType(typeof(Duration), null)); + Assert.Throws(() => Convert.ChangeType(length, typeof(Duration))); // Different unit type Assert.Throws(() => lengthAsIConvertible.ToType(typeof(DurationUnit), null)); Assert.Throws(() => Convert.ChangeType(length, typeof(DurationUnit))); // QuantityType - Assert.Equal(Length.QuantityType, lengthAsIConvertible.ToType(typeof(QuantityType), null)); - Assert.Equal(Length.QuantityType, Convert.ChangeType(length, typeof(QuantityType))); + Assert.Equal(Length.QuantityType, lengthAsIConvertible.ToType(typeof(QuantityType), null)); + Assert.Equal(Length.QuantityType, Convert.ChangeType(length, typeof(QuantityType))); // BaseDimensions - Assert.Equal(Length.BaseDimensions, lengthAsIConvertible.ToType(typeof(BaseDimensions), null)); - Assert.Equal(Length.BaseDimensions, Convert.ChangeType(length, typeof(BaseDimensions))); + Assert.Equal(Length.BaseDimensions, lengthAsIConvertible.ToType(typeof(BaseDimensions), null)); + Assert.Equal(Length.BaseDimensions, Convert.ChangeType(length, typeof(BaseDimensions))); } [Fact] diff --git a/UnitsNet.Tests/QuantityIFormattableTests.cs b/UnitsNet.Tests/QuantityIFormattableTests.cs index 059b5b22e2..504b0f59fd 100644 --- a/UnitsNet.Tests/QuantityIFormattableTests.cs +++ b/UnitsNet.Tests/QuantityIFormattableTests.cs @@ -9,7 +9,7 @@ namespace UnitsNet.Tests { public class QuantityIFormattableTests { - private static Length length = Length.FromFeet(1.2345678); + private static Length length = Length.FromFeet(1.2345678); [Fact] public void GFormatStringEqualsToString() @@ -49,7 +49,7 @@ public void VFormatEqualsValueToString() [Fact] public void QFormatEqualsQuantityName() { - Assert.Equal(Length.Info.Name, length.ToString("q")); + Assert.Equal(Length.Info.Name, length.ToString("q")); } [Theory] diff --git a/UnitsNet.Tests/QuantityInfoTest.cs b/UnitsNet.Tests/QuantityInfoTest.cs index 51ab1ad90d..ab20f933e4 100644 --- a/UnitsNet.Tests/QuantityInfoTest.cs +++ b/UnitsNet.Tests/QuantityInfoTest.cs @@ -14,14 +14,14 @@ public class QuantityInfoTest [Fact] public void Constructor_AssignsProperties() { - var expectedZero = Length.FromCentimeters(10); + var expectedZero = Length.FromCentimeters(10); var expectedUnitInfos = new UnitInfo[]{ new UnitInfo(LengthUnit.Centimeter, new BaseUnits(LengthUnit.Centimeter)), new UnitInfo(LengthUnit.Kilometer, new BaseUnits(LengthUnit.Kilometer)) }; var expectedBaseUnit = LengthUnit.Centimeter; var expectedQuantityType = QuantityType.Length; - var expectedBaseDimensions = Length.BaseDimensions; + var expectedBaseDimensions = Length.BaseDimensions; var info = new QuantityInfo(expectedQuantityType, expectedUnitInfos, expectedBaseUnit, expectedZero, expectedBaseDimensions); @@ -42,14 +42,14 @@ public void Constructor_AssignsProperties() [Fact] public void GenericsConstructor_AssignsProperties() { - var expectedZero = Length.FromCentimeters(10); + var expectedZero = Length.FromCentimeters(10); var expectedUnitInfos = new UnitInfo[]{ new UnitInfo(LengthUnit.Centimeter, new BaseUnits(LengthUnit.Centimeter)), new UnitInfo(LengthUnit.Kilometer, new BaseUnits(LengthUnit.Kilometer)) }; var expectedBaseUnit = LengthUnit.Centimeter; var expectedQuantityType = QuantityType.Length; - var expectedBaseDimensions = Length.BaseDimensions; + var expectedBaseDimensions = Length.BaseDimensions; var info = new QuantityInfo(expectedQuantityType, expectedUnitInfos, expectedBaseUnit, expectedZero, expectedBaseDimensions); @@ -71,14 +71,14 @@ public void GenericsConstructor_AssignsProperties() public void Constructor_GivenUndefinedAsQuantityType_ThrowsArgumentException() { Assert.Throws(() => new QuantityInfo(QuantityType.Undefined, - Length.Info.UnitInfos, Length.BaseUnit, Length.Zero, Length.BaseDimensions)); + Length.Info.UnitInfos, Length.BaseUnit, Length.Zero, Length.BaseDimensions)); } [Fact] public void GenericsConstructor_GivenUndefinedAsQuantityType_ThrowsArgumentException() { Assert.Throws(() => new QuantityInfo(QuantityType.Undefined, - Length.Info.UnitInfos, Length.BaseUnit, Length.Zero, Length.BaseDimensions)); + Length.Info.UnitInfos, Length.BaseUnit, Length.Zero, Length.BaseDimensions)); } [Fact] @@ -86,7 +86,7 @@ public void GenericsConstructor_GivenUndefinedAsQuantityType_ThrowsArgumentExcep public void Constructor_GivenNullAsUnitInfos_ThrowsArgumentNullException() { Assert.Throws(() => new QuantityInfo(QuantityType.Length, - null, Length.BaseUnit, Length.Zero, Length.BaseDimensions)); + null, Length.BaseUnit, Length.Zero, Length.BaseDimensions)); } [Fact] @@ -94,7 +94,7 @@ public void Constructor_GivenNullAsUnitInfos_ThrowsArgumentNullException() public void GenericsConstructor_GivenNullAsUnitInfos_ThrowsArgumentNullException() { Assert.Throws(() => new QuantityInfo(QuantityType.Length, - null, Length.BaseUnit, Length.Zero, Length.BaseDimensions)); + null, Length.BaseUnit, Length.Zero, Length.BaseDimensions)); } [Fact] @@ -102,7 +102,7 @@ public void GenericsConstructor_GivenNullAsUnitInfos_ThrowsArgumentNullException public void Constructor_GivenNullAsBaseUnit_ThrowsArgumentNullException() { Assert.Throws(() => new QuantityInfo(QuantityType.Length, - Length.Info.UnitInfos, null, Length.Zero, Length.BaseDimensions)); + Length.Info.UnitInfos, null, Length.Zero, Length.BaseDimensions)); } [Fact] @@ -110,7 +110,7 @@ public void Constructor_GivenNullAsBaseUnit_ThrowsArgumentNullException() public void Constructor_GivenNullAsZero_ThrowsArgumentNullException() { Assert.Throws(() => new QuantityInfo(QuantityType.Length, - Length.Info.UnitInfos, Length.BaseUnit, null, Length.BaseDimensions)); + Length.Info.UnitInfos, Length.BaseUnit, null, Length.BaseDimensions)); } [Fact] @@ -118,7 +118,7 @@ public void Constructor_GivenNullAsZero_ThrowsArgumentNullException() public void GenericsConstructor_GivenNullAsZero_ThrowsArgumentNullException() { Assert.Throws(() => new QuantityInfo(QuantityType.Length, - Length.Info.UnitInfos, Length.BaseUnit, null, Length.BaseDimensions)); + Length.Info.UnitInfos, Length.BaseUnit, null, Length.BaseDimensions)); } [Fact] @@ -126,7 +126,7 @@ public void GenericsConstructor_GivenNullAsZero_ThrowsArgumentNullException() public void Constructor_GivenNullAsBaseDimensions_ThrowsArgumentNullException() { Assert.Throws(() => new QuantityInfo(QuantityType.Length, - Length.Info.UnitInfos, Length.BaseUnit, Length.Zero, null)); + Length.Info.UnitInfos, Length.BaseUnit, Length.Zero, null)); } [Fact] @@ -134,20 +134,20 @@ public void Constructor_GivenNullAsBaseDimensions_ThrowsArgumentNullException() public void GenericsConstructor_GivenNullAsBaseDimensions_ThrowsArgumentNullException() { Assert.Throws(() => new QuantityInfo(QuantityType.Length, - Length.Info.UnitInfos, Length.BaseUnit, Length.Zero, null)); + Length.Info.UnitInfos, Length.BaseUnit, Length.Zero, null)); } [Fact] public void GetUnitInfoFor_GivenNullAsBaseUnits_ThrowsArgumentNullException() { - Assert.Throws(() => Length.Info.GetUnitInfoFor(null)); + Assert.Throws(() => Length.Info.GetUnitInfoFor(null)); } [Fact] public void GetUnitInfoFor_GivenBaseUnitsWithNoMatch_ThrowsInvalidOperationException() { var baseUnitsWithNoMatch = new BaseUnits(mass: MassUnit.Kilogram); - Assert.Throws(() => Length.Info.GetUnitInfoFor(baseUnitsWithNoMatch)); + Assert.Throws(() => Length.Info.GetUnitInfoFor(baseUnitsWithNoMatch)); } [Fact] @@ -159,7 +159,7 @@ public void GetUnitInfoFor_GivenBaseUnitsWithMultipleMatches_ThrowsInvalidOperat new UnitInfo[]{ new UnitInfo(LengthUnit.Meter, baseUnits), new UnitInfo(LengthUnit.Foot, baseUnits) }, - LengthUnit.Meter, Length.Zero, Length.BaseDimensions); + LengthUnit.Meter, Length.Zero, Length.BaseDimensions); Assert.Throws(() => quantityInfo.GetUnitInfoFor(baseUnits)); } @@ -167,14 +167,14 @@ public void GetUnitInfoFor_GivenBaseUnitsWithMultipleMatches_ThrowsInvalidOperat [Fact] public void GetUnitInfosFor_GivenNullAsBaseUnits_ThrowsArgumentNullException() { - Assert.Throws(() => Length.Info.GetUnitInfosFor(null)); + Assert.Throws(() => Length.Info.GetUnitInfosFor(null)); } [Fact] public void GetUnitInfosFor_GivenBaseUnitsWithNoMatch_ReturnsEmpty() { var baseUnitsWithNoMatch = new BaseUnits(mass: MassUnit.Kilogram); - var result = Length.Info.GetUnitInfosFor(baseUnitsWithNoMatch); + var result = Length.Info.GetUnitInfosFor(baseUnitsWithNoMatch); Assert.Empty(result); } @@ -182,7 +182,7 @@ public void GetUnitInfosFor_GivenBaseUnitsWithNoMatch_ReturnsEmpty() public void GetUnitInfosFor_GivenBaseUnitsWithOneMatch_ReturnsOneMatch() { var baseUnitsWithOneMatch = new BaseUnits(LengthUnit.Foot); - var result = Length.Info.GetUnitInfosFor(baseUnitsWithOneMatch); + var result = Length.Info.GetUnitInfosFor(baseUnitsWithOneMatch); Assert.Collection(result, element1 => Assert.Equal(LengthUnit.Foot, element1.Value)); } @@ -195,7 +195,7 @@ public void GetUnitInfosFor_GivenBaseUnitsWithMultipleMatches_ReturnsMultipleMat new UnitInfo[]{ new UnitInfo(LengthUnit.Meter, baseUnits), new UnitInfo(LengthUnit.Foot, baseUnits) }, - LengthUnit.Meter, Length.Zero, Length.BaseDimensions); + LengthUnit.Meter, Length.Zero, Length.BaseDimensions); var result = quantityInfo.GetUnitInfosFor(baseUnits); diff --git a/UnitsNet.Tests/QuantityTest.cs b/UnitsNet.Tests/QuantityTest.cs index 296a01eb68..77ebeefff1 100644 --- a/UnitsNet.Tests/QuantityTest.cs +++ b/UnitsNet.Tests/QuantityTest.cs @@ -21,7 +21,7 @@ public class QuantityTest [InlineData(double.NegativeInfinity)] public void From_GivenNaNOrInfinity_ThrowsArgumentException(double value) { - Assert.Throws(() => Quantity.From(value, LengthUnit.Centimeter)); + Assert.Throws(() => Quantity.From(value, LengthUnit.Centimeter)); } [Theory] @@ -30,16 +30,16 @@ public void From_GivenNaNOrInfinity_ThrowsArgumentException(double value) [InlineData(double.NegativeInfinity)] public void TryFrom_GivenNaNOrInfinity_ReturnsFalseAndNullQuantity(double value) { - Assert.False(Quantity.TryFrom(value, LengthUnit.Centimeter, out IQuantity parsedLength)); + Assert.False(Quantity.TryFrom( value, LengthUnit.Centimeter, out IQuantity parsedLength)); Assert.Null(parsedLength); } [Fact] public void From_GivenValueAndUnit_ReturnsQuantity() { - Assert.Equal(Length.FromCentimeters(3), Quantity.From(3, LengthUnit.Centimeter)); - Assert.Equal(Mass.FromTonnes(3), Quantity.From(3, MassUnit.Tonne)); - Assert.Equal(Pressure.FromMegabars(3), Quantity.From(3, PressureUnit.Megabar)); + Assert.Equal(Length.FromCentimeters(3), Quantity.From( 3, LengthUnit.Centimeter)); + Assert.Equal(Mass.FromTonnes(3), Quantity.From( 3, MassUnit.Tonne)); + Assert.Equal(Pressure.FromMegabars(3), Quantity.From( 3, PressureUnit.Megabar)); } [Fact] @@ -61,8 +61,8 @@ public void GetInfo_GivenLength_ReturnsQuantityInfoForLength() Assert.Equal(lengthUnitCount, quantityInfo.Units.Length); #pragma warning restore 618 Assert.Equal(typeof(LengthUnit), quantityInfo.UnitType); - Assert.Equal(typeof(Length), quantityInfo.ValueType); - Assert.Equal(Length.Zero, quantityInfo.Zero); + Assert.Equal(typeof(Length), quantityInfo.ValueType); + Assert.Equal(Length.Zero, quantityInfo.Zero); } [Fact] @@ -84,8 +84,8 @@ public void GetInfo_GivenMass_ReturnsQuantityInfoForMass() Assert.Equal(massUnitCount, quantityInfo.Units.Length); #pragma warning restore 618 Assert.Equal(typeof(MassUnit), quantityInfo.UnitType); - Assert.Equal(typeof(Mass), quantityInfo.ValueType); - Assert.Equal(Mass.Zero, quantityInfo.Zero); + Assert.Equal(typeof(Mass), quantityInfo.ValueType); + Assert.Equal(Mass.Zero, quantityInfo.Zero); } [Fact] @@ -107,9 +107,9 @@ public void Infos_ReturnsKnownQuantityInfoObjects() [Fact] public void Parse_GivenValueAndUnit_ReturnsQuantity() { - Assert.Equal(Length.FromCentimeters(3), Quantity.Parse(CultureInfo.InvariantCulture, typeof(Length), "3 cm")); - Assert.Equal(Mass.FromTonnes(3), Quantity.Parse(CultureInfo.InvariantCulture, typeof(Mass), "03t")); - Assert.Equal(Pressure.FromMegabars(3), Quantity.Parse(CultureInfo.InvariantCulture, typeof(Pressure), "3.0 Mbar")); + Assert.Equal(Length.FromCentimeters(3), Quantity.Parse( CultureInfo.InvariantCulture, typeof(Length), "3 cm")); + Assert.Equal(Mass.FromTonnes(3), Quantity.Parse( CultureInfo.InvariantCulture, typeof(Mass), "03t")); + Assert.Equal(Pressure.FromMegabars(3), Quantity.Parse( CultureInfo.InvariantCulture, typeof(Pressure), "3.0 Mbar")); } [Fact] @@ -126,47 +126,47 @@ public void QuantityNames_ReturnsKnownNames() [Fact] public void TryFrom_GivenValueAndUnit_ReturnsQuantity() { - Assert.True(Quantity.TryFrom(3, LengthUnit.Centimeter, out IQuantity parsedLength)); - Assert.Equal(Length.FromCentimeters(3), parsedLength); + Assert.True(Quantity.TryFrom( 3, LengthUnit.Centimeter, out IQuantity parsedLength)); + Assert.Equal(Length.FromCentimeters(3), parsedLength); - Assert.True(Quantity.TryFrom(3, MassUnit.Tonne, out IQuantity parsedMass)); - Assert.Equal(Mass.FromTonnes(3), parsedMass); + Assert.True(Quantity.TryFrom( 3, MassUnit.Tonne, out IQuantity parsedMass)); + Assert.Equal(Mass.FromTonnes(3), parsedMass); - Assert.True(Quantity.TryFrom(3, PressureUnit.Megabar, out IQuantity parsedPressure)); - Assert.Equal(Pressure.FromMegabars(3), parsedPressure); + Assert.True(Quantity.TryFrom( 3, PressureUnit.Megabar, out IQuantity parsedPressure)); + Assert.Equal(Pressure.FromMegabars(3), parsedPressure); } [Fact] public void TryParse_GivenInvalidQuantityType_ReturnsFalseAndNullQuantity() { - Assert.False(Quantity.TryParse(typeof(DummyIQuantity), "3.0 cm", out IQuantity parsedLength)); + Assert.False(Quantity.TryParse( typeof(DummyIQuantity), "3.0 cm", out IQuantity parsedLength)); Assert.Null(parsedLength); } [Fact] public void TryParse_GivenInvalidString_ReturnsFalseAndNullQuantity() { - Assert.False(Quantity.TryParse(typeof(Length), "x cm", out IQuantity parsedLength)); + Assert.False(Quantity.TryParse( typeof(Length), "x cm", out IQuantity parsedLength)); Assert.Null(parsedLength); - Assert.False(Quantity.TryParse(typeof(Mass), "xt", out IQuantity parsedMass)); + Assert.False(Quantity.TryParse( typeof(Mass), "xt", out IQuantity parsedMass)); Assert.Null(parsedMass); - Assert.False(Quantity.TryParse(typeof(Pressure), "foo", out IQuantity parsedPressure)); + Assert.False(Quantity.TryParse( typeof(Pressure ), "foo", out IQuantity parsedPressure)); Assert.Null(parsedPressure); } [Fact] public void TryParse_GivenValueAndUnit_ReturnsQuantity() { - Assert.True(Quantity.TryParse(typeof(Length), "3 cm", out IQuantity parsedLength)); - Assert.Equal(Length.FromCentimeters(3), parsedLength); + Assert.True(Quantity.TryParse( typeof(Length), "3 cm", out IQuantity parsedLength)); + Assert.Equal(Length.FromCentimeters(3), parsedLength); - Assert.True(Quantity.TryParse(typeof(Mass), "03t", out IQuantity parsedMass)); - Assert.Equal(Mass.FromTonnes(3), parsedMass); + Assert.True(Quantity.TryParse( typeof(Mass), "03t", out IQuantity parsedMass)); + Assert.Equal(Mass.FromTonnes(3), parsedMass); - Assert.True(Quantity.TryParse(NumberFormatInfo.InvariantInfo, typeof(Pressure), "3.0 Mbar", out IQuantity parsedPressure)); - Assert.Equal(Pressure.FromMegabars(3), parsedPressure); + Assert.True(Quantity.TryParse( NumberFormatInfo.InvariantInfo, typeof(Pressure ), "3.0 Mbar", out IQuantity parsedPressure)); + Assert.Equal(Pressure.FromMegabars(3), parsedPressure); } [Fact] @@ -183,23 +183,23 @@ public void Types_ReturnsKnownQuantityTypes() [Fact] public void FromQuantityType_GivenUndefinedQuantityType_ThrowsArgumentException() { - Assert.Throws(() => Quantity.FromQuantityType(QuantityType.Undefined, 0.0)); + Assert.Throws(() => Quantity.FromQuantityType( QuantityType.Undefined, 0.0)); } [Fact] public void FromQuantityType_GivenInvalidQuantityType_ThrowsArgumentException() { - Assert.Throws(() => Quantity.FromQuantityType((QuantityType)(-1), 0.0)); + Assert.Throws(() => Quantity.FromQuantityType( (QuantityType)(-1), 0.0)); } [Fact] public void FromQuantityType_GivenLengthQuantityType_ReturnsLengthQuantity() { - var fromQuantity = Quantity.FromQuantityType(QuantityType.Length, 0.0); + var fromQuantity = Quantity.FromQuantityType( QuantityType.Length, 0.0); Assert.Equal(0.0, fromQuantity.Value); Assert.Equal(QuantityType.Length, fromQuantity.Type); - Assert.Equal(Length.BaseUnit, fromQuantity.Unit); + Assert.Equal(Length.BaseUnit, fromQuantity.Unit); } } } diff --git a/UnitsNet.Tests/QuantityTests.Ctor.cs b/UnitsNet.Tests/QuantityTests.Ctor.cs index 869a3df951..a7259c4353 100644 --- a/UnitsNet.Tests/QuantityTests.Ctor.cs +++ b/UnitsNet.Tests/QuantityTests.Ctor.cs @@ -19,29 +19,29 @@ public class Ctor public void DefaultCtorOfRepresentativeTypes_DoesNotThrow() { // double types - new Length(); + new Length(); // decimal types - new Information(); + new Information(); // logarithmic types - new Level(); + new Level(); } [Fact] public void DefaultCtorOfRepresentativeTypes_SetsValueToZeroAndUnitToBaseUnit() { // double types - Assert.Equal(0, new Mass().Value); - Assert.Equal(MassUnit.Kilogram, new Mass().Unit); + Assert.Equal(0, new Mass().Value); + Assert.Equal(MassUnit.Kilogram, new Mass().Unit); // decimal types - Assert.Equal(0, new Information().Value); - Assert.Equal(InformationUnit.Bit, new Information().Unit); + Assert.Equal(0, new Information().Value); + Assert.Equal(InformationUnit.Bit, new Information().Unit); // logarithmic types - Assert.Equal(0, new Level().Value); - Assert.Equal(LevelUnit.Decibel, new Level().Unit); + Assert.Equal(0, new Level().Value); + Assert.Equal(LevelUnit.Decibel, new Level().Unit); } /// @@ -53,13 +53,13 @@ public void DefaultCtorOfRepresentativeTypes_SetsValueToZeroAndUnitToBaseUnit() public void DefaultCtorOfRepresentativeTypes_DoesNotThrowWhenConvertingToOtherUnits() { // double types - Assert.Equal(0, new Mass().Hectograms); + Assert.Equal(0, new Mass().Hectograms); // decimal types - Assert.Equal(0, new Information().Kibibits); + Assert.Equal(0, new Information().Kibibits); // logarithmic types - Assert.Equal(0, new Level().Nepers); + Assert.Equal(0, new Level().Nepers); } [Fact] @@ -67,22 +67,22 @@ public void CtorWithOnlyValueOfRepresentativeTypes_SetsValueToGivenValueAndUnitT { #pragma warning disable 618 // double types - Assert.Equal(5, new Mass(5L, MassUnit.Kilogram).Value); - Assert.Equal(5, new Mass(5d, MassUnit.Kilogram).Value); - Assert.Equal(MassUnit.Kilogram, new Mass(5L, MassUnit.Kilogram).Unit); - Assert.Equal(MassUnit.Kilogram, new Mass(5d, MassUnit.Kilogram).Unit); + Assert.Equal(5, new Mass(5L, MassUnit.Kilogram).Value); + Assert.Equal(5, new Mass(5d, MassUnit.Kilogram).Value); + Assert.Equal(MassUnit.Kilogram, new Mass(5L, MassUnit.Kilogram).Unit); + Assert.Equal(MassUnit.Kilogram, new Mass(5d, MassUnit.Kilogram).Unit); // decimal types - Assert.Equal(5, new Information(5L, InformationUnit.Bit).Value); - Assert.Equal(5, new Information(5m, InformationUnit.Bit).Value); - Assert.Equal(InformationUnit.Bit, new Information(5L, InformationUnit.Bit).Unit); - Assert.Equal(InformationUnit.Bit, new Information(5m, InformationUnit.Bit).Unit); + Assert.Equal(5, new Information(5L, InformationUnit.Bit).Value); + Assert.Equal(5, new Information(5m, InformationUnit.Bit).Value); + Assert.Equal(InformationUnit.Bit, new Information(5L, InformationUnit.Bit).Unit); + Assert.Equal(InformationUnit.Bit, new Information(5m, InformationUnit.Bit).Unit); // logarithmic types - Assert.Equal(5, new Level(5L, LevelUnit.Decibel).Value); - Assert.Equal(5, new Level(5d, LevelUnit.Decibel).Value); - Assert.Equal(LevelUnit.Decibel, new Level(5L, LevelUnit.Decibel).Unit); - Assert.Equal(LevelUnit.Decibel, new Level(5d, LevelUnit.Decibel).Unit); + Assert.Equal(5, new Level(5L, LevelUnit.Decibel).Value); + Assert.Equal(5, new Level(5d, LevelUnit.Decibel).Value); + Assert.Equal(LevelUnit.Decibel, new Level(5L, LevelUnit.Decibel).Unit); + Assert.Equal(LevelUnit.Decibel, new Level(5d, LevelUnit.Decibel).Unit); #pragma warning restore 618 } @@ -90,17 +90,17 @@ public void CtorWithOnlyValueOfRepresentativeTypes_SetsValueToGivenValueAndUnitT public void CtorWithValueAndUnitOfRepresentativeTypes_SetsValueAndUnit() { // double types - var mass = new Mass(5L, MassUnit.Centigram); + var mass = new Mass(5L, MassUnit.Centigram); Assert.Equal(5, mass.Value); Assert.Equal(MassUnit.Centigram, mass.Unit); // decimal types - var information = new Information(5, InformationUnit.Kibibit); + var information = new Information(5, InformationUnit.Kibibit); Assert.Equal(5, information.Value); Assert.Equal(InformationUnit.Kibibit, information.Unit); // logarithmic types - var level = new Level(5, LevelUnit.Neper); + var level = new Level(5, LevelUnit.Neper); Assert.Equal(5, level.Value); Assert.Equal(LevelUnit.Neper, level.Unit); } @@ -108,7 +108,7 @@ public void CtorWithValueAndUnitOfRepresentativeTypes_SetsValueAndUnit() [Fact] public void Constructor_UnitSystemGivenNull_ThrowsArgumentNullException() { - Assert.Throws(() => new Length(1.0, null)); + Assert.Throws(() => new Length(1.0, null)); } /// @@ -122,101 +122,101 @@ public void Constructor_UnitSystemGivenNull_ThrowsArgumentNullException() [Fact] public void Ctor_WithValueAndSIUnitSystem_ReturnsQuantityWithSIUnitOrThrowsArgumentExceptionIfNotImplemented() { - AssertUnitValue(new Acceleration(1, UnitSystem.SI), 1, AccelerationUnit.MeterPerSecondSquared); - AssertUnitValue(new AmountOfSubstance(1, UnitSystem.SI), 1, AmountOfSubstanceUnit.Mole); - Assert.Throws(() => new AmplitudeRatio(1, UnitSystem.SI)); - Assert.Throws(() => new Angle(1, UnitSystem.SI)); - Assert.Throws(() => new ApparentEnergy(1, UnitSystem.SI)); - Assert.Throws(() => new ApparentPower(1, UnitSystem.SI)); - AssertUnitValue(new AreaDensity(1, UnitSystem.SI), 1, AreaDensityUnit.KilogramPerSquareMeter); - AssertUnitValue(new AreaMomentOfInertia(1, UnitSystem.SI), 1, AreaMomentOfInertiaUnit.MeterToTheFourth); - AssertUnitValue(new Area(1, UnitSystem.SI), 1, AreaUnit.SquareMeter); - Assert.Throws(() => new BitRate(1, UnitSystem.SI)); - Assert.Throws(() => new BrakeSpecificFuelConsumption(1, UnitSystem.SI)); - AssertUnitValue(new Capacitance(1, UnitSystem.SI), 1, CapacitanceUnit.Farad); - AssertUnitValue(new CoefficientOfThermalExpansion(1, UnitSystem.SI), 1, CoefficientOfThermalExpansionUnit.InverseKelvin); - Assert.Throws(() => new Density(1, UnitSystem.SI)); - AssertUnitValue(new Duration(1, UnitSystem.SI), 1, DurationUnit.Second); - Assert.Throws(() => new DynamicViscosity(1, UnitSystem.SI)); - Assert.Throws(() => new ElectricAdmittance(1, UnitSystem.SI)); - AssertUnitValue(new ElectricChargeDensity(1, UnitSystem.SI), 1, ElectricChargeDensityUnit.CoulombPerCubicMeter); - Assert.Throws(() => new ElectricCharge(1, UnitSystem.SI)); - Assert.Throws(() => new ElectricConductance(1, UnitSystem.SI)); - AssertUnitValue(new ElectricConductivity(1, UnitSystem.SI), 1, ElectricConductivityUnit.SiemensPerMeter); - AssertUnitValue(new ElectricCurrentDensity(1, UnitSystem.SI), 1, ElectricCurrentDensityUnit.AmperePerSquareMeter); - Assert.Throws(() => new ElectricCurrentGradient(1, UnitSystem.SI)); - AssertUnitValue(new ElectricField(1, UnitSystem.SI), 1, ElectricFieldUnit.VoltPerMeter); - Assert.Throws(() => new ElectricInductance(1, UnitSystem.SI)); - Assert.Throws(() => new ElectricPotentialAc(1, UnitSystem.SI)); - Assert.Throws(() => new ElectricPotentialDc(1, UnitSystem.SI)); - AssertUnitValue(new ElectricPotential(1, UnitSystem.SI), 1, ElectricPotentialUnit.Volt); - Assert.Throws(() => new ElectricResistance(1, UnitSystem.SI)); - Assert.Throws(() => new ElectricResistivity(1, UnitSystem.SI)); - AssertUnitValue(new ElectricSurfaceChargeDensity(1, UnitSystem.SI), 1, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter); - AssertUnitValue(new Energy(1, UnitSystem.SI), 1, EnergyUnit.Joule); - Assert.Throws(() => new Entropy(1, UnitSystem.SI)); - Assert.Throws(() => new ForceChangeRate(1, UnitSystem.SI)); - Assert.Throws(() => new ForcePerLength(1, UnitSystem.SI)); - AssertUnitValue(new Force(1, UnitSystem.SI), 1, ForceUnit.Newton); - Assert.Throws(() => new Frequency(1, UnitSystem.SI)); - AssertUnitValue(new HeatFlux(1, UnitSystem.SI), 1, HeatFluxUnit.WattPerSquareMeter); - Assert.Throws(() => new HeatTransferCoefficient(1, UnitSystem.SI)); - Assert.Throws(() => new Illuminance(1, UnitSystem.SI)); - Assert.Throws(() => new Information(1, UnitSystem.SI)); - Assert.Throws(() => new Irradiance(1, UnitSystem.SI)); - Assert.Throws(() => new Irradiation(1, UnitSystem.SI)); - Assert.Throws(() => new KinematicViscosity(1, UnitSystem.SI)); - Assert.Throws(() => new LapseRate(1, UnitSystem.SI)); - AssertUnitValue(new Length(1, UnitSystem.SI), 1, LengthUnit.Meter); - Assert.Throws(() => new Level(1, UnitSystem.SI)); - Assert.Throws(() => new LinearDensity(1, UnitSystem.SI)); - Assert.Throws(() => new Luminosity(1, UnitSystem.SI)); - Assert.Throws(() => new LuminousFlux(1, UnitSystem.SI)); - AssertUnitValue(new LuminousIntensity(1, UnitSystem.SI), 1, LuminousIntensityUnit.Candela); - Assert.Throws(() => new MagneticField(1, UnitSystem.SI)); - Assert.Throws(() => new MagneticFlux(1, UnitSystem.SI)); - AssertUnitValue(new Magnetization(1, UnitSystem.SI), 1, MagnetizationUnit.AmperePerMeter); - Assert.Throws(() => new MassConcentration(1, UnitSystem.SI)); - Assert.Throws(() => new MassFlow(1, UnitSystem.SI)); - Assert.Throws(() => new MassFlux(1, UnitSystem.SI)); - Assert.Throws(() => new MassFraction(1, UnitSystem.SI)); - Assert.Throws(() => new MassMomentOfInertia(1, UnitSystem.SI)); - Assert.Throws(() => new Mass(1, UnitSystem.SI)); - Assert.Throws(() => new MolarEnergy(1, UnitSystem.SI)); - Assert.Throws(() => new MolarEntropy(1, UnitSystem.SI)); - AssertUnitValue(new Molarity(1, UnitSystem.SI), 1, MolarityUnit.MolesPerCubicMeter); - Assert.Throws(() => new MolarMass(1, UnitSystem.SI)); - Assert.Throws(() => new Permeability(1, UnitSystem.SI)); - Assert.Throws(() => new Permittivity(1, UnitSystem.SI)); - AssertUnitValue(new PowerDensity(1, UnitSystem.SI), 1, PowerDensityUnit.WattPerCubicMeter); - Assert.Throws(() => new PowerRatio(1, UnitSystem.SI)); - Assert.Throws(() => new Power(1, UnitSystem.SI)); - Assert.Throws(() => new PressureChangeRate(1, UnitSystem.SI)); - AssertUnitValue(new Pressure(1, UnitSystem.SI), 1, PressureUnit.Pascal); - Assert.Throws(() => new RatioChangeRate(1, UnitSystem.SI)); - Assert.Throws(() => new Ratio(1, UnitSystem.SI)); - Assert.Throws(() => new ReactiveEnergy(1, UnitSystem.SI)); - Assert.Throws(() => new ReactivePower(1, UnitSystem.SI)); - Assert.Throws(() => new RotationalAcceleration(1, UnitSystem.SI)); - Assert.Throws(() => new RotationalSpeed(1, UnitSystem.SI)); - Assert.Throws(() => new RotationalStiffness(1, UnitSystem.SI)); - Assert.Throws(() => new SolidAngle(1, UnitSystem.SI)); - Assert.Throws(() => new SpecificEnergy(1, UnitSystem.SI)); - Assert.Throws(() => new SpecificEntropy(1, UnitSystem.SI)); - Assert.Throws(() => new SpecificVolume(1, UnitSystem.SI)); - Assert.Throws(() => new SpecificWeight(1, UnitSystem.SI)); - AssertUnitValue(new Speed(1, UnitSystem.SI), 1, SpeedUnit.MeterPerSecond); - Assert.Throws(() => new TemperatureChangeRate(1, UnitSystem.SI)); - Assert.Throws(() => new TemperatureDelta(1, UnitSystem.SI)); - AssertUnitValue(new Temperature(1, UnitSystem.SI), 1, TemperatureUnit.Kelvin); - Assert.Throws(() => new ThermalConductivity(1, UnitSystem.SI)); - Assert.Throws(() => new ThermalResistance(1, UnitSystem.SI)); - Assert.Throws(() => new Torque(1, UnitSystem.SI)); - Assert.Throws(() => new VitaminA(1, UnitSystem.SI)); - Assert.Throws(() => new VolumeConcentration(1, UnitSystem.SI)); - Assert.Throws(() => new VolumeFlow(1, UnitSystem.SI)); - AssertUnitValue(new VolumePerLength(1, UnitSystem.SI), 1, VolumePerLengthUnit.CubicMeterPerMeter); - Assert.Throws(() => new Volume(1, UnitSystem.SI)); + AssertUnitValue(new Acceleration(1, UnitSystem.SI), 1, AccelerationUnit.MeterPerSecondSquared); + AssertUnitValue(new AmountOfSubstance(1, UnitSystem.SI), 1, AmountOfSubstanceUnit.Mole); + Assert.Throws(() => new AmplitudeRatio(1, UnitSystem.SI)); + Assert.Throws(() => new Angle(1, UnitSystem.SI)); + Assert.Throws(() => new ApparentEnergy(1, UnitSystem.SI)); + Assert.Throws(() => new ApparentPower(1, UnitSystem.SI)); + AssertUnitValue(new AreaDensity(1, UnitSystem.SI), 1, AreaDensityUnit.KilogramPerSquareMeter); + AssertUnitValue(new AreaMomentOfInertia(1, UnitSystem.SI), 1, AreaMomentOfInertiaUnit.MeterToTheFourth); + AssertUnitValue(new Area(1, UnitSystem.SI), 1, AreaUnit.SquareMeter); + Assert.Throws(() => new BitRate(1, UnitSystem.SI)); + Assert.Throws(() => new BrakeSpecificFuelConsumption(1, UnitSystem.SI)); + AssertUnitValue(new Capacitance(1, UnitSystem.SI), 1, CapacitanceUnit.Farad); + AssertUnitValue(new CoefficientOfThermalExpansion(1, UnitSystem.SI), 1, CoefficientOfThermalExpansionUnit.InverseKelvin); + Assert.Throws(() => new Density(1, UnitSystem.SI)); + AssertUnitValue(new Duration(1, UnitSystem.SI), 1, DurationUnit.Second); + Assert.Throws(() => new DynamicViscosity(1, UnitSystem.SI)); + Assert.Throws(() => new ElectricAdmittance(1, UnitSystem.SI)); + AssertUnitValue(new ElectricChargeDensity(1, UnitSystem.SI), 1, ElectricChargeDensityUnit.CoulombPerCubicMeter); + Assert.Throws(() => new ElectricCharge(1, UnitSystem.SI)); + Assert.Throws(() => new ElectricConductance(1, UnitSystem.SI)); + AssertUnitValue(new ElectricConductivity(1, UnitSystem.SI), 1, ElectricConductivityUnit.SiemensPerMeter); + AssertUnitValue(new ElectricCurrentDensity(1, UnitSystem.SI), 1, ElectricCurrentDensityUnit.AmperePerSquareMeter); + Assert.Throws(() => new ElectricCurrentGradient(1, UnitSystem.SI)); + AssertUnitValue(new ElectricField(1, UnitSystem.SI), 1, ElectricFieldUnit.VoltPerMeter); + Assert.Throws(() => new ElectricInductance(1, UnitSystem.SI)); + Assert.Throws(() => new ElectricPotentialAc(1, UnitSystem.SI)); + Assert.Throws(() => new ElectricPotentialDc(1, UnitSystem.SI)); + AssertUnitValue(new ElectricPotential(1, UnitSystem.SI), 1, ElectricPotentialUnit.Volt); + Assert.Throws(() => new ElectricResistance(1, UnitSystem.SI)); + Assert.Throws(() => new ElectricResistivity(1, UnitSystem.SI)); + AssertUnitValue(new ElectricSurfaceChargeDensity(1, UnitSystem.SI), 1, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter); + AssertUnitValue(new Energy(1, UnitSystem.SI), 1, EnergyUnit.Joule); + Assert.Throws(() => new Entropy(1, UnitSystem.SI)); + Assert.Throws(() => new ForceChangeRate(1, UnitSystem.SI)); + Assert.Throws(() => new ForcePerLength(1, UnitSystem.SI)); + AssertUnitValue(new Force(1, UnitSystem.SI), 1, ForceUnit.Newton); + Assert.Throws(() => new Frequency(1, UnitSystem.SI)); + AssertUnitValue(new HeatFlux(1, UnitSystem.SI), 1, HeatFluxUnit.WattPerSquareMeter); + Assert.Throws(() => new HeatTransferCoefficient(1, UnitSystem.SI)); + Assert.Throws(() => new Illuminance(1, UnitSystem.SI)); + Assert.Throws(() => new Information(1, UnitSystem.SI)); + Assert.Throws(() => new Irradiance(1, UnitSystem.SI)); + Assert.Throws(() => new Irradiation(1, UnitSystem.SI)); + Assert.Throws(() => new KinematicViscosity(1, UnitSystem.SI)); + Assert.Throws(() => new LapseRate(1, UnitSystem.SI)); + AssertUnitValue(new Length(1, UnitSystem.SI), 1, LengthUnit.Meter); + Assert.Throws(() => new Level(1, UnitSystem.SI)); + Assert.Throws(() => new LinearDensity(1, UnitSystem.SI)); + Assert.Throws(() => new Luminosity(1, UnitSystem.SI)); + Assert.Throws(() => new LuminousFlux(1, UnitSystem.SI)); + AssertUnitValue(new LuminousIntensity(1, UnitSystem.SI), 1, LuminousIntensityUnit.Candela); + Assert.Throws(() => new MagneticField(1, UnitSystem.SI)); + Assert.Throws(() => new MagneticFlux(1, UnitSystem.SI)); + AssertUnitValue(new Magnetization(1, UnitSystem.SI), 1, MagnetizationUnit.AmperePerMeter); + Assert.Throws(() => new MassConcentration(1, UnitSystem.SI)); + Assert.Throws(() => new MassFlow(1, UnitSystem.SI)); + Assert.Throws(() => new MassFlux(1, UnitSystem.SI)); + Assert.Throws(() => new MassFraction(1, UnitSystem.SI)); + Assert.Throws(() => new MassMomentOfInertia(1, UnitSystem.SI)); + Assert.Throws(() => new Mass(1, UnitSystem.SI)); + Assert.Throws(() => new MolarEnergy(1, UnitSystem.SI)); + Assert.Throws(() => new MolarEntropy(1, UnitSystem.SI)); + AssertUnitValue(new Molarity(1, UnitSystem.SI), 1, MolarityUnit.MolesPerCubicMeter); + Assert.Throws(() => new MolarMass(1, UnitSystem.SI)); + Assert.Throws(() => new Permeability(1, UnitSystem.SI)); + Assert.Throws(() => new Permittivity(1, UnitSystem.SI)); + AssertUnitValue(new PowerDensity(1, UnitSystem.SI), 1, PowerDensityUnit.WattPerCubicMeter); + Assert.Throws(() => new PowerRatio(1, UnitSystem.SI)); + Assert.Throws(() => new Power(1, UnitSystem.SI)); + Assert.Throws(() => new PressureChangeRate(1, UnitSystem.SI)); + AssertUnitValue(new Pressure(1, UnitSystem.SI), 1, PressureUnit.Pascal); + Assert.Throws(() => new RatioChangeRate(1, UnitSystem.SI)); + Assert.Throws(() => new Ratio(1, UnitSystem.SI)); + Assert.Throws(() => new ReactiveEnergy(1, UnitSystem.SI)); + Assert.Throws(() => new ReactivePower(1, UnitSystem.SI)); + Assert.Throws(() => new RotationalAcceleration(1, UnitSystem.SI)); + Assert.Throws(() => new RotationalSpeed(1, UnitSystem.SI)); + Assert.Throws(() => new RotationalStiffness(1, UnitSystem.SI)); + Assert.Throws(() => new SolidAngle(1, UnitSystem.SI)); + Assert.Throws(() => new SpecificEnergy(1, UnitSystem.SI)); + Assert.Throws(() => new SpecificEntropy(1, UnitSystem.SI)); + Assert.Throws(() => new SpecificVolume(1, UnitSystem.SI)); + Assert.Throws(() => new SpecificWeight(1, UnitSystem.SI)); + AssertUnitValue(new Speed(1, UnitSystem.SI), 1, SpeedUnit.MeterPerSecond); + Assert.Throws(() => new TemperatureChangeRate(1, UnitSystem.SI)); + Assert.Throws(() => new TemperatureDelta(1, UnitSystem.SI)); + AssertUnitValue(new Temperature(1, UnitSystem.SI), 1, TemperatureUnit.Kelvin); + Assert.Throws(() => new ThermalConductivity(1, UnitSystem.SI)); + Assert.Throws(() => new ThermalResistance(1, UnitSystem.SI)); + Assert.Throws(() => new Torque(1, UnitSystem.SI)); + Assert.Throws(() => new VitaminA(1, UnitSystem.SI)); + Assert.Throws(() => new VolumeConcentration(1, UnitSystem.SI)); + Assert.Throws(() => new VolumeFlow(1, UnitSystem.SI)); + AssertUnitValue(new VolumePerLength(1, UnitSystem.SI), 1, VolumePerLengthUnit.CubicMeterPerMeter); + Assert.Throws(() => new Volume(1, UnitSystem.SI)); } private static void AssertUnitValue(IQuantity actual, double expectedValue, Enum expectedUnit) diff --git a/UnitsNet.Tests/QuantityTests.ToString.cs b/UnitsNet.Tests/QuantityTests.ToString.cs index e261daa6c6..1c99c2b8e8 100644 --- a/UnitsNet.Tests/QuantityTests.ToString.cs +++ b/UnitsNet.Tests/QuantityTests.ToString.cs @@ -17,13 +17,13 @@ public class ToStringTests public void CreatedByDefaultCtor_ReturnsValueInBaseUnit() { // double types - Assert.Equal("0 kg", new Mass().ToString()); + Assert.Equal("0 kg", new Mass().ToString()); // decimal types - Assert.Equal("0 b", new Information().ToString()); + Assert.Equal("0 b", new Information().ToString()); // logarithmic types - Assert.Equal("0 dB", new Level().ToString()); + Assert.Equal("0 dB", new Level().ToString()); } [Fact] @@ -31,16 +31,16 @@ public void CreatedByCtorWithValue_ReturnsValueInBaseUnit() { #pragma warning disable 618 // double types - Assert.Equal("5 kg", new Mass(5L, MassUnit.Kilogram).ToString()); - Assert.Equal("5 kg", new Mass(5d, MassUnit.Kilogram).ToString()); + Assert.Equal("5 kg", new Mass(5L, MassUnit.Kilogram).ToString()); + Assert.Equal("5 kg", new Mass(5d, MassUnit.Kilogram).ToString()); // decimal types - Assert.Equal("5 b", new Information(5L, InformationUnit.Bit).ToString()); - Assert.Equal("5 b", new Information(5m, InformationUnit.Bit).ToString()); + Assert.Equal("5 b", new Information(5L, InformationUnit.Bit).ToString()); + Assert.Equal("5 b", new Information(5m, InformationUnit.Bit).ToString()); // logarithmic types - Assert.Equal("5 dB", new Level(5L, LevelUnit.Decibel).ToString()); - Assert.Equal("5 dB", new Level(5d, LevelUnit.Decibel).ToString()); + Assert.Equal("5 dB", new Level(5L, LevelUnit.Decibel).ToString()); + Assert.Equal("5 dB", new Level(5d, LevelUnit.Decibel).ToString()); #pragma warning restore 618 } @@ -49,13 +49,13 @@ public void CreatedByCtorWithValueAndUnit_ReturnsValueAndUnit() { #pragma warning disable 618 // double types - Assert.Equal("5 hg", new Mass(5, MassUnit.Hectogram).ToString()); + Assert.Equal("5 hg", new Mass(5, MassUnit.Hectogram).ToString()); // decimal types - Assert.Equal("8 B", new Information(8, InformationUnit.Byte).ToString()); + Assert.Equal("8 B", new Information(8, InformationUnit.Byte).ToString()); // logarithmic types - Assert.Equal("5 Np", new Level(5, LevelUnit.Neper).ToString()); + Assert.Equal("5 Np", new Level(5, LevelUnit.Neper).ToString()); #pragma warning restore 618 } @@ -66,15 +66,15 @@ public void ReturnsTheOriginalValueAndUnit() try { CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture; - Assert.Equal("5 kg", Mass.FromKilograms(5).ToString()); - Assert.Equal("5,000 g", Mass.FromGrams(5000).ToString()); - Assert.Equal("1e-04 long tn", Mass.FromLongTons(1e-4).ToString()); - Assert.Equal("3.46e-04 dN/m", ForcePerLength.FromDecinewtonsPerMeter(0.00034567).ToString()); - Assert.Equal("0.0069 dB", Level.FromDecibels(0.0069).ToString()); - Assert.Equal("0.011 kWh/kg", SpecificEnergy.FromKilowattHoursPerKilogram(0.011).ToString()); + Assert.Equal("5 kg", Mass.FromKilograms(5).ToString()); + Assert.Equal("5,000 g", Mass.FromGrams(5000).ToString()); + Assert.Equal("1e-04 long tn", Mass.FromLongTons(1e-4).ToString()); + Assert.Equal("3.46e-04 dN/m", ForcePerLength.FromDecinewtonsPerMeter(0.00034567).ToString()); + Assert.Equal("0.0069 dB", Level.FromDecibels(0.0069).ToString()); + Assert.Equal("0.011 kWh/kg", SpecificEnergy.FromKilowattHoursPerKilogram(0.011).ToString()); // Assert.Equal("0.1 MJ/kg·C", SpecificEntropy.FromMegajoulesPerKilogramDegreeCelsius(0.1).ToString()); - Assert.Equal("0.1 MJ/kg.C", SpecificEntropy.FromMegajoulesPerKilogramDegreeCelsius(0.1).ToString()); - Assert.Equal("5 cm", Length.FromCentimeters(5).ToString()); + Assert.Equal("0.1 MJ/kg.C", SpecificEntropy.FromMegajoulesPerKilogramDegreeCelsius(0.1).ToString()); + Assert.Equal("5 cm", Length.FromCentimeters(5).ToString()); } finally { @@ -89,10 +89,10 @@ public void ConvertsToTheGivenUnit() try { CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture; - Assert.Equal("5,000 g", Mass.FromKilograms(5).ToUnit(MassUnit.Gram).ToString()); - Assert.Equal("5 kg", Mass.FromGrams(5000).ToUnit(MassUnit.Kilogram).ToString()); - Assert.Equal("0.05 m", Length.FromCentimeters(5).ToUnit(LengthUnit.Meter).ToString()); - Assert.Equal("1.97 in", Length.FromCentimeters(5).ToUnit(LengthUnit.Inch).ToString()); + Assert.Equal("5,000 g", Mass.FromKilograms(5).ToUnit(MassUnit.Gram).ToString()); + Assert.Equal("5 kg", Mass.FromGrams(5000).ToUnit(MassUnit.Kilogram).ToString()); + Assert.Equal("0.05 m", Length.FromCentimeters(5).ToUnit(LengthUnit.Meter).ToString()); + Assert.Equal("1.97 in", Length.FromCentimeters(5).ToUnit(LengthUnit.Inch).ToString()); } finally { @@ -107,9 +107,9 @@ public void FormatsNumberUsingGivenCulture() try { CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture; - Assert.Equal("0.05 m", Length.FromCentimeters(5).ToUnit(LengthUnit.Meter).ToString((IFormatProvider)null)); - Assert.Equal("0.05 m", Length.FromCentimeters(5).ToUnit(LengthUnit.Meter).ToString(CultureInfo.InvariantCulture)); - Assert.Equal("0,05 m", Length.FromCentimeters(5).ToUnit(LengthUnit.Meter).ToString(new CultureInfo("nb-NO"))); + Assert.Equal("0.05 m", Length.FromCentimeters(5).ToUnit(LengthUnit.Meter).ToString((IFormatProvider)null)); + Assert.Equal("0.05 m", Length.FromCentimeters(5).ToUnit(LengthUnit.Meter).ToString(CultureInfo.InvariantCulture)); + Assert.Equal("0,05 m", Length.FromCentimeters(5).ToUnit(LengthUnit.Meter).ToString(new CultureInfo("nb-NO"))); } finally { @@ -124,9 +124,9 @@ public void FormatsNumberUsingGivenDigitsAfterRadix() try { CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture; - Assert.Equal("0.05 m", Length.FromCentimeters(5).ToUnit(LengthUnit.Meter).ToString("s4")); - Assert.Equal("1.97 in", Length.FromCentimeters(5).ToUnit(LengthUnit.Inch).ToString("s2")); - Assert.Equal("1.9685 in", Length.FromCentimeters(5).ToUnit(LengthUnit.Inch).ToString("s4")); + Assert.Equal("0.05 m", Length.FromCentimeters(5).ToUnit(LengthUnit.Meter).ToString("s4")); + Assert.Equal("1.97 in", Length.FromCentimeters(5).ToUnit(LengthUnit.Inch).ToString("s2")); + Assert.Equal("1.9685 in", Length.FromCentimeters(5).ToUnit(LengthUnit.Inch).ToString("s4")); } finally { diff --git a/UnitsNet.Tests/QuantityTests.cs b/UnitsNet.Tests/QuantityTests.cs index ab97ec0b6e..66f514baa3 100644 --- a/UnitsNet.Tests/QuantityTests.cs +++ b/UnitsNet.Tests/QuantityTests.cs @@ -12,8 +12,8 @@ public partial class QuantityTests [Fact] public void GetHashCodeForDifferentQuantitiesWithSameValuesAreNotEqual() { - var length = new Length(1.0, (LengthUnit)2); - var area = new Area(1.0, (AreaUnit)2); + var length = new Length(1.0, (LengthUnit)2); + var area = new Area(1.0, (AreaUnit)2); Assert.NotEqual(length.GetHashCode(), area.GetHashCode()); } @@ -21,7 +21,7 @@ public void GetHashCodeForDifferentQuantitiesWithSameValuesAreNotEqual() [Fact] public void Length_QuantityInfo_ReturnsQuantityInfoAboutLength() { - var length = new Length(1, LengthUnit.Centimeter); + var length = new Length(1, LengthUnit.Centimeter); QuantityInfo quantityInfo = length.QuantityInfo; @@ -31,14 +31,14 @@ public void Length_QuantityInfo_ReturnsQuantityInfoAboutLength() [Fact] public void Length_Info_ReturnsQuantityInfoAboutLength() { - QuantityInfo quantityInfo = Length.Info; + QuantityInfo quantityInfo = Length.Info; AssertQuantityInfoRepresentsLength(quantityInfo); } private static void AssertQuantityInfoRepresentsLength(QuantityInfo quantityInfo) { - Assert.Equal(Length.Zero, quantityInfo.Zero); + Assert.Equal(Length.Zero, quantityInfo.Zero); Assert.Equal("Length", quantityInfo.Name); Assert.Equal(QuantityType.Length, quantityInfo.QuantityType); diff --git a/UnitsNet.Tests/QuantityTypeConverterTest.cs b/UnitsNet.Tests/QuantityTypeConverterTest.cs index 5de7b6d269..c9acaf5fbb 100644 --- a/UnitsNet.Tests/QuantityTypeConverterTest.cs +++ b/UnitsNet.Tests/QuantityTypeConverterTest.cs @@ -1,4 +1,4 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. +// Licensed under MIT No Attribution, see LICENSE file at the root. // Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. using System; @@ -42,10 +42,10 @@ static QuantityTypeConverterTest() [InlineData(typeof(double), false)] [InlineData(typeof(object), false)] [InlineData(typeof(float), false)] - [InlineData(typeof(Length), false)] + [InlineData(typeof(Length), false)] public void CanConvertFrom_GivenSomeTypes(Type value, bool expectedResult) { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); bool canConvertFrom = converter.CanConvertFrom(value); @@ -57,10 +57,10 @@ public void CanConvertFrom_GivenSomeTypes(Type value, bool expectedResult) [InlineData(typeof(double), false)] [InlineData(typeof(object), false)] [InlineData(typeof(float), false)] - [InlineData(typeof(Length), false)] + [InlineData(typeof(Length), false)] public void CanConvertTo_GivenSomeTypes(Type value, bool expectedResult) { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); bool canConvertTo = converter.CanConvertTo(value); @@ -74,10 +74,10 @@ public void CanConvertTo_GivenSomeTypes(Type value, bool expectedResult) [InlineData("1km", 1, Units.LengthUnit.Kilometer)] public void ConvertFrom_GivenQuantityStringAndContextWithNoAttributes_ReturnsQuantityWithBaseUnitIfNotSpecified(string str, double expectedValue, Enum expectedUnit) { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { }); - var convertedValue = (Length)converter.ConvertFrom(context, culture, str); + var convertedValue = (Length)converter.ConvertFrom(context, culture, str); Assert.Equal(expectedValue, convertedValue.Value); Assert.Equal(expectedUnit, convertedValue.Unit); @@ -90,13 +90,13 @@ public void ConvertFrom_GivenQuantityStringAndContextWithNoAttributes_ReturnsQua [InlineData("1km", 1, Units.LengthUnit.Kilometer)] public void ConvertFrom_GivenQuantityStringAndContextWithDefaultUnitAttribute_ReturnsQuantityWithGivenDefaultUnitIfNotSpecified(string str, double expectedValue, Enum expectedUnit) { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { new DefaultUnitAttribute(Units.LengthUnit.Centimeter) }); - var convertedValue = (Length)converter.ConvertFrom(context, culture, str); + var convertedValue = (Length)converter.ConvertFrom(context, culture, str); Assert.Equal(expectedValue, convertedValue.Value); Assert.Equal(expectedUnit, convertedValue.Unit); @@ -109,14 +109,14 @@ public void ConvertFrom_GivenQuantityStringAndContextWithDefaultUnitAttribute_Re [InlineData("1km", 1000, Units.LengthUnit.Meter)] public void ConvertFrom_GivenQuantityStringAndContextWithDefaultUnitAndConvertToUnitAttributes_ReturnsQuantityConvertedToUnit(string str, double expectedValue, Enum expectedUnit) { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { new DefaultUnitAttribute(Units.LengthUnit.Centimeter), new ConvertToUnitAttribute(Units.LengthUnit.Meter) }); - var convertedValue = (Length)converter.ConvertFrom(context, culture, str); + var convertedValue = (Length)converter.ConvertFrom(context, culture, str); Assert.Equal(expectedValue, convertedValue.Value); Assert.Equal(expectedUnit, convertedValue.Unit); @@ -125,7 +125,7 @@ public void ConvertFrom_GivenQuantityStringAndContextWithDefaultUnitAndConvertTo [Fact] public void ConvertFrom_GivenEmptyString_ThrowsNotSupportedException() { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { }); Assert.Throws(() => converter.ConvertFrom(context, culture, "")); @@ -134,21 +134,21 @@ public void ConvertFrom_GivenEmptyString_ThrowsNotSupportedException() [Fact] public void ConvertFrom_GivenWrongQuantity_ThrowsArgumentException() { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { }); Assert.Throws(() => converter.ConvertFrom(context, culture, "1m^2")); } [Theory] - [InlineData(typeof(Length))] + [InlineData(typeof(Length))] [InlineData(typeof(IQuantity))] [InlineData(typeof(object))] public void ConvertTo_GivenWrongType_ThrowsNotSupportedException(Type value) { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { }); - Length length = Length.FromMeters(1); + Length length = Length.FromMeters(1); Assert.Throws(() => converter.ConvertTo(length, value)); } @@ -156,9 +156,9 @@ public void ConvertTo_GivenWrongType_ThrowsNotSupportedException(Type value) [Fact] public void ConvertTo_GivenStringType_ReturnsQuantityString() { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { }); - Length length = Length.FromMeters(1); + Length length = Length.FromMeters(1); string convertedQuantity = (string)converter.ConvertTo(length, typeof(string)); @@ -168,9 +168,9 @@ public void ConvertTo_GivenStringType_ReturnsQuantityString() [Fact] public void ConvertTo_GivenSomeQuantitysAndContextWithNoAttributes_ReturnsQuantityStringInUnitOfQuantity() { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { }); - Length length = Length.FromMeters(1); + Length length = Length.FromMeters(1); string convertedQuantity = (string)converter.ConvertTo(context, culture, length, typeof(string)); @@ -180,12 +180,12 @@ public void ConvertTo_GivenSomeQuantitysAndContextWithNoAttributes_ReturnsQuanti [Fact] public void ConvertTo_TestDisplayAsFormatting_ReturnsQuantityStringWithDisplayUnitDefaultFormating() { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { new DisplayAsUnitAttribute(Units.LengthUnit.Decimeter) }); - Length length = Length.FromMeters(1); + var length = Length.FromMeters(1); string convertedQuantity = (string)converter.ConvertTo(context, culture, length, typeof(string)); @@ -195,12 +195,12 @@ public void ConvertTo_TestDisplayAsFormatting_ReturnsQuantityStringWithDisplayUn [Fact] public void ConvertTo_TestDisplayAsFormatting_ReturnsQuantityStringWithDisplayUnitFormateAsValueOnly() { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { new DisplayAsUnitAttribute(Units.LengthUnit.Decimeter, "v") }); - Length length = Length.FromMeters(1); + var length = Length.FromMeters(1); string convertedQuantity = (string)converter.ConvertTo(context, culture, length, typeof(string)); @@ -210,12 +210,12 @@ public void ConvertTo_TestDisplayAsFormatting_ReturnsQuantityStringWithDisplayUn [Fact] public void ConvertTo_TestDisplayAsFormattingWithoutDefinedUnit_ReturnsQuantityStringWithQuantetiesUnitAndFormatedAsValueOnly() { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { new DisplayAsUnitAttribute(null, "v") }); - Length length = Length.FromMeters(1); + var length = Length.FromMeters(1); string convertedQuantity = (string)converter.ConvertTo(context, culture, length, typeof(string)); @@ -225,12 +225,12 @@ public void ConvertTo_TestDisplayAsFormattingWithoutDefinedUnit_ReturnsQuantityS [Fact] public void ConvertTo_GivenSomeQuantitysAndContextWithDisplayAsUnitAttributes_ReturnsQuantityStringInSpecifiedDisplayUnit() { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { new DisplayAsUnitAttribute(Units.LengthUnit.Decimeter) }); - Length length = Length.FromMeters(1); + var length = Length.FromMeters(1); string convertedQuantityDefaultCulture = (string)converter.ConvertTo(length, typeof(string)); string convertedQuantitySpecificCulture = (string)converter.ConvertTo(context, culture, length, typeof(string)); @@ -242,7 +242,7 @@ public void ConvertTo_GivenSomeQuantitysAndContextWithDisplayAsUnitAttributes_Re [Fact] public void ConvertFrom_GivenDefaultUnitAttributeWithWrongUnitType_ThrowsArgumentException() { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { new DefaultUnitAttribute(Units.VolumeUnit.CubicMeter) @@ -254,62 +254,62 @@ public void ConvertFrom_GivenDefaultUnitAttributeWithWrongUnitType_ThrowsArgumen [Fact] public void ConvertFrom_GivenStringWithPower_1() { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { }); - Assert.Equal(Length.FromMeters(1), converter.ConvertFrom(context, culture, "1m")); - Assert.Equal(Length.FromMeters(1), converter.ConvertFrom(context, culture, "1m^1")); + Assert.Equal(Length.FromMeters(1), converter.ConvertFrom(context, culture, "1m")); + Assert.Equal(Length.FromMeters(1), converter.ConvertFrom(context, culture, "1m^1")); } [Fact] public void ConvertFrom_GivenStringWithPower_2() { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { }); - Assert.Equal(Area.FromSquareMeters(1), converter.ConvertFrom(context, culture, "1m²")); - Assert.Equal(Area.FromSquareMeters(1), converter.ConvertFrom(context, culture, "1m^2")); + Assert.Equal(Area.FromSquareMeters(1), converter.ConvertFrom(context, culture, "1m²")); + Assert.Equal(Area.FromSquareMeters(1), converter.ConvertFrom(context, culture, "1m^2")); } [Fact] public void ConvertFrom_GivenStringWithPower_3() { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { }); - Assert.Equal(Volume.FromCubicMeters(1), converter.ConvertFrom(context, culture, "1m³")); - Assert.Equal(Volume.FromCubicMeters(1), converter.ConvertFrom(context, culture, "1m^3")); + Assert.Equal(Volume.FromCubicMeters(1), converter.ConvertFrom(context, culture, "1m³")); + Assert.Equal(Volume.FromCubicMeters(1), converter.ConvertFrom(context, culture, "1m^3")); } [Fact] public void ConvertFrom_GivenStringWithPower_4() { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { }); - Assert.Equal(AreaMomentOfInertia.FromMetersToTheFourth(1), converter.ConvertFrom(context, culture, "1m⁴")); - Assert.Equal(AreaMomentOfInertia.FromMetersToTheFourth(1), converter.ConvertFrom(context, culture, "1m^4")); + Assert.Equal(AreaMomentOfInertia.FromMetersToTheFourth(1), converter.ConvertFrom(context, culture, "1m⁴")); + Assert.Equal(AreaMomentOfInertia.FromMetersToTheFourth(1), converter.ConvertFrom(context, culture, "1m^4")); } [Fact] public void ConvertFrom_GivenStringWithPower_minus1() { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { }); - Assert.Equal(CoefficientOfThermalExpansion.FromInverseKelvin(1), converter.ConvertFrom(context, culture, "1K⁻¹")); - Assert.Equal(CoefficientOfThermalExpansion.FromInverseKelvin(1), converter.ConvertFrom(context, culture, "1K^-1")); + Assert.Equal(CoefficientOfThermalExpansion.FromInverseKelvin(1), converter.ConvertFrom(context, culture, "1K⁻¹")); + Assert.Equal(CoefficientOfThermalExpansion.FromInverseKelvin(1), converter.ConvertFrom(context, culture, "1K^-1")); } [Fact] public void ConvertFrom_GivenStringWithPower_minus2() { - var converter = new QuantityTypeConverter(); + var converter = new QuantityTypeConverter>(); ITypeDescriptorContext context = new TypeDescriptorContext("SomeMemberName", new Attribute[] { }); - Assert.Equal(MassFlux.FromKilogramsPerSecondPerSquareMeter(1), converter.ConvertFrom(context, culture, "1kg·s⁻¹·m⁻²")); - Assert.Equal(MassFlux.FromKilogramsPerSecondPerSquareMeter(1), converter.ConvertFrom(context, culture, "1kg·s^-1·m^-2")); - Assert.Equal(MassFlux.FromKilogramsPerSecondPerSquareMeter(1), converter.ConvertFrom(context, culture, "1kg*s^-1*m^-2")); + Assert.Equal(MassFlux.FromKilogramsPerSecondPerSquareMeter(1), converter.ConvertFrom(context, culture, "1kg·s⁻¹·m⁻²")); + Assert.Equal(MassFlux.FromKilogramsPerSecondPerSquareMeter(1), converter.ConvertFrom(context, culture, "1kg·s^-1·m^-2")); + Assert.Equal(MassFlux.FromKilogramsPerSecondPerSquareMeter(1), converter.ConvertFrom(context, culture, "1kg*s^-1*m^-2")); } } } diff --git a/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs b/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs index 5103231a36..6d554ba7d3 100644 --- a/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs +++ b/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs @@ -37,7 +37,7 @@ public UnitAbbreviationsCacheTests(ITestOutputHelper output) [InlineData(0.115, "0.12 m")] public void DefaultToStringFormatting(double value, string expected) { - string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(AmericanCulture); + string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(AmericanCulture); Assert.Equal(expected, actual); } @@ -59,7 +59,7 @@ private enum CustomUnit [InlineData("it-IT")] public void CommaRadixPointCultureFormatting(string culture) { - Assert.Equal("0,12 m", Length.FromMeters(0.12).ToUnit(LengthUnit.Meter).ToString(GetCulture(culture))); + Assert.Equal("0,12 m", Length.FromMeters(0.12).ToUnit(LengthUnit.Meter).ToString(GetCulture(culture))); } // These cultures all use a decimal point for the radix point @@ -71,7 +71,7 @@ public void CommaRadixPointCultureFormatting(string culture) [InlineData("es-MX")] public void DecimalRadixPointCultureFormatting(string culture) { - Assert.Equal("0.12 m", Length.FromMeters(0.12).ToUnit(LengthUnit.Meter).ToString(GetCulture(culture))); + Assert.Equal("0.12 m", Length.FromMeters(0.12).ToUnit(LengthUnit.Meter).ToString(GetCulture(culture))); } // These cultures all use a comma in digit grouping @@ -84,14 +84,14 @@ public void DecimalRadixPointCultureFormatting(string culture) public void CommaDigitGroupingCultureFormatting(string cultureName) { CultureInfo culture = GetCulture(cultureName); - Assert.Equal("1,111 m", Length.FromMeters(1111).ToUnit(LengthUnit.Meter).ToString(culture)); + Assert.Equal("1,111 m", Length.FromMeters(1111).ToUnit(LengthUnit.Meter).ToString(culture)); // Feet/Inch and Stone/Pound combinations are only used (customarily) in the US, UK and maybe Ireland - all English speaking countries. // FeetInches returns a whole number of feet, with the remainder expressed (rounded) in inches. Same for SonePounds. Assert.Equal("2,222 ft 3 in", - Length.FromFeetInches(2222, 3).FeetInches.ToString(culture)); + Length.FromFeetInches(2222, 3).FeetInches.ToString(culture)); Assert.Equal("3,333 st 7 lb", - Mass.FromStonePounds(3333, 7).StonePounds.ToString(culture)); + Mass.FromStonePounds(3333, 7).StonePounds.ToString(culture)); } // These cultures use a thin space in digit grouping @@ -101,7 +101,7 @@ public void CommaDigitGroupingCultureFormatting(string cultureName) public void SpaceDigitGroupingCultureFormatting(string culture) { // Note: the space used in digit groupings is actually a "thin space" Unicode character U+2009 - Assert.Equal("1 111 m", Length.FromMeters(1111).ToUnit(LengthUnit.Meter).ToString(GetCulture(culture))); + Assert.Equal("1 111 m", Length.FromMeters(1111).ToUnit(LengthUnit.Meter).ToString(GetCulture(culture))); } // These cultures all use a decimal point in digit grouping @@ -113,7 +113,7 @@ public void SpaceDigitGroupingCultureFormatting(string culture) [InlineData("it-IT")] public void DecimalPointDigitGroupingCultureFormatting(string culture) { - Assert.Equal("1.111 m", Length.FromMeters(1111).ToUnit(LengthUnit.Meter).ToString(GetCulture(culture))); + Assert.Equal("1.111 m", Length.FromMeters(1111).ToUnit(LengthUnit.Meter).ToString(GetCulture(culture))); } // Due to rounding, the values will result in the same string representation regardless of the number of significant digits (up to a certain point) @@ -127,7 +127,7 @@ public void DecimalPointDigitGroupingCultureFormatting(string culture) public void RoundingErrorsWithSignificantDigitsAfterRadixFormatting(double value, string significantDigitsAfterRadixFormatString, string expected) { - string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(significantDigitsAfterRadixFormatString, AmericanCulture); + string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(significantDigitsAfterRadixFormatString, AmericanCulture); Assert.Equal(expected, actual); } @@ -139,7 +139,7 @@ public void RoundingErrorsWithSignificantDigitsAfterRadixFormatting(double value [InlineData(1.99e-4, "1.99e-04 m")] public void ScientificNotationLowerInterval(double value, string expected) { - string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(AmericanCulture); + string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(AmericanCulture); Assert.Equal(expected, actual); } @@ -150,7 +150,7 @@ public void ScientificNotationLowerInterval(double value, string expected) [InlineData(999.99, "999.99 m")] public void FixedPointNotationIntervalFormatting(double value, string expected) { - string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(AmericanCulture); + string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(AmericanCulture); Assert.Equal(expected, actual); } @@ -162,7 +162,7 @@ public void FixedPointNotationIntervalFormatting(double value, string expected) [InlineData(999999.99, "999,999.99 m")] public void FixedPointNotationWithDigitGroupingIntervalFormatting(double value, string expected) { - string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(AmericanCulture); + string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(AmericanCulture); Assert.Equal(expected, actual); } @@ -173,62 +173,62 @@ public void FixedPointNotationWithDigitGroupingIntervalFormatting(double value, [InlineData(double.MaxValue, "1.8e+308 m")] public void ScientificNotationUpperIntervalFormatting(double value, string expected) { - string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(AmericanCulture); + string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(AmericanCulture); Assert.Equal(expected, actual); } [Fact] public void AllUnitsImplementToStringForInvariantCulture() { - Assert.Equal("1 °", Angle.FromDegrees(1).ToString()); - Assert.Equal("1 m²", Area.FromSquareMeters(1).ToString()); - Assert.Equal("1 V", ElectricPotential.FromVolts(1).ToString()); - Assert.Equal("1 N", Force.FromNewtons(1).ToString()); - Assert.Equal("1 m", Length.FromMeters(1).ToString()); - Assert.Equal("1 kg", Mass.FromKilograms(1).ToString()); - Assert.Equal("1 Pa", Pressure.FromPascals(1).ToString()); - Assert.Equal("1 rad/s", RotationalSpeed.FromRadiansPerSecond(1).ToString()); - Assert.Equal("1 K", Temperature.FromKelvins(1).ToString()); - Assert.Equal("1 N·m", Torque.FromNewtonMeters(1).ToString()); - Assert.Equal("1 m³", Volume.FromCubicMeters(1).ToString()); - Assert.Equal("1 m³/s", VolumeFlow.FromCubicMetersPerSecond(1).ToString()); - - Assert.Equal("2 ft 3 in", Length.FromFeetInches(2, 3).FeetInches.ToString()); - Assert.Equal("3 st 7 lb", Mass.FromStonePounds(3, 7).StonePounds.ToString()); + Assert.Equal("1 °", Angle.FromDegrees(1).ToString()); + Assert.Equal("1 m²", Area.FromSquareMeters(1).ToString()); + Assert.Equal("1 V", ElectricPotential.FromVolts(1).ToString()); + Assert.Equal("1 N", Force.FromNewtons(1).ToString()); + Assert.Equal("1 m", Length.FromMeters(1).ToString()); + Assert.Equal("1 kg", Mass.FromKilograms(1).ToString()); + Assert.Equal("1 Pa", Pressure.FromPascals(1).ToString()); + Assert.Equal("1 rad/s", RotationalSpeed.FromRadiansPerSecond(1).ToString()); + Assert.Equal("1 K", Temperature.FromKelvins(1).ToString()); + Assert.Equal("1 N·m", Torque.FromNewtonMeters(1).ToString()); + Assert.Equal("1 m³", Volume.FromCubicMeters(1).ToString()); + Assert.Equal("1 m³/s", VolumeFlow.FromCubicMetersPerSecond(1).ToString()); + + Assert.Equal("2 ft 3 in", Length.FromFeetInches(2, 3).FeetInches.ToString()); + Assert.Equal("3 st 7 lb", Mass.FromStonePounds(3, 7).StonePounds.ToString()); } [Fact] public void ToString_WithNorwegianCulture() { - Assert.Equal("1 °", Angle.FromDegrees(1).ToUnit(AngleUnit.Degree).ToString(NorwegianCulture)); - Assert.Equal("1 m²", Area.FromSquareMeters(1).ToUnit(AreaUnit.SquareMeter).ToString(NorwegianCulture)); - Assert.Equal("1 V", ElectricPotential.FromVolts(1).ToUnit(ElectricPotentialUnit.Volt).ToString(NorwegianCulture)); - Assert.Equal("1 m³/s", VolumeFlow.FromCubicMetersPerSecond(1).ToUnit(VolumeFlowUnit.CubicMeterPerSecond).ToString(NorwegianCulture)); - Assert.Equal("1 N", Force.FromNewtons(1).ToUnit(ForceUnit.Newton).ToString(NorwegianCulture)); - Assert.Equal("1 m", Length.FromMeters(1).ToUnit(LengthUnit.Meter).ToString(NorwegianCulture)); - Assert.Equal("1 kg", Mass.FromKilograms(1).ToUnit(MassUnit.Kilogram).ToString(NorwegianCulture)); - Assert.Equal("1 Pa", Pressure.FromPascals(1).ToUnit(PressureUnit.Pascal).ToString(NorwegianCulture)); - Assert.Equal("1 rad/s", RotationalSpeed.FromRadiansPerSecond(1).ToUnit(RotationalSpeedUnit.RadianPerSecond).ToString(NorwegianCulture)); - Assert.Equal("1 K", Temperature.FromKelvins(1).ToUnit(TemperatureUnit.Kelvin).ToString(NorwegianCulture)); - Assert.Equal("1 N·m", Torque.FromNewtonMeters(1).ToUnit(TorqueUnit.NewtonMeter).ToString(NorwegianCulture)); - Assert.Equal("1 m³", Volume.FromCubicMeters(1).ToUnit(VolumeUnit.CubicMeter).ToString(NorwegianCulture)); + Assert.Equal("1 °", Angle.FromDegrees(1).ToUnit(AngleUnit.Degree).ToString(NorwegianCulture)); + Assert.Equal("1 m²", Area.FromSquareMeters(1).ToUnit(AreaUnit.SquareMeter).ToString(NorwegianCulture)); + Assert.Equal("1 V", ElectricPotential.FromVolts(1).ToUnit(ElectricPotentialUnit.Volt).ToString(NorwegianCulture)); + Assert.Equal("1 m³/s", VolumeFlow.FromCubicMetersPerSecond(1).ToUnit(VolumeFlowUnit.CubicMeterPerSecond).ToString(NorwegianCulture)); + Assert.Equal("1 N", Force.FromNewtons(1).ToUnit(ForceUnit.Newton).ToString(NorwegianCulture)); + Assert.Equal("1 m", Length.FromMeters(1).ToUnit(LengthUnit.Meter).ToString(NorwegianCulture)); + Assert.Equal("1 kg", Mass.FromKilograms(1).ToUnit(MassUnit.Kilogram).ToString(NorwegianCulture)); + Assert.Equal("1 Pa", Pressure.FromPascals(1).ToUnit(PressureUnit.Pascal).ToString(NorwegianCulture)); + Assert.Equal("1 rad/s", RotationalSpeed.FromRadiansPerSecond(1).ToUnit(RotationalSpeedUnit.RadianPerSecond).ToString(NorwegianCulture)); + Assert.Equal("1 K", Temperature.FromKelvins(1).ToUnit(TemperatureUnit.Kelvin).ToString(NorwegianCulture)); + Assert.Equal("1 N·m", Torque.FromNewtonMeters(1).ToUnit(TorqueUnit.NewtonMeter).ToString(NorwegianCulture)); + Assert.Equal("1 m³", Volume.FromCubicMeters(1).ToUnit(VolumeUnit.CubicMeter).ToString(NorwegianCulture)); } [Fact] public void ToString_WithRussianCulture() { - Assert.Equal("1 °", Angle.FromDegrees(1).ToUnit(AngleUnit.Degree).ToString(RussianCulture)); - Assert.Equal("1 м²", Area.FromSquareMeters(1).ToUnit(AreaUnit.SquareMeter).ToString(RussianCulture)); - Assert.Equal("1 В", ElectricPotential.FromVolts(1).ToUnit(ElectricPotentialUnit.Volt).ToString(RussianCulture)); - Assert.Equal("1 м³/с", VolumeFlow.FromCubicMetersPerSecond(1).ToUnit(VolumeFlowUnit.CubicMeterPerSecond).ToString(RussianCulture)); - Assert.Equal("1 Н", Force.FromNewtons(1).ToUnit(ForceUnit.Newton).ToString(RussianCulture)); - Assert.Equal("1 м", Length.FromMeters(1).ToUnit(LengthUnit.Meter).ToString(RussianCulture)); - Assert.Equal("1 кг", Mass.FromKilograms(1).ToUnit(MassUnit.Kilogram).ToString(RussianCulture)); - Assert.Equal("1 Па", Pressure.FromPascals(1).ToUnit(PressureUnit.Pascal).ToString(RussianCulture)); - Assert.Equal("1 рад/с", RotationalSpeed.FromRadiansPerSecond(1).ToUnit(RotationalSpeedUnit.RadianPerSecond).ToString(RussianCulture)); - Assert.Equal("1 K", Temperature.FromKelvins(1).ToUnit(TemperatureUnit.Kelvin).ToString(RussianCulture)); - Assert.Equal("1 Н·м", Torque.FromNewtonMeters(1).ToUnit(TorqueUnit.NewtonMeter).ToString(RussianCulture)); - Assert.Equal("1 м³", Volume.FromCubicMeters(1).ToUnit(VolumeUnit.CubicMeter).ToString(RussianCulture)); + Assert.Equal("1 °", Angle.FromDegrees(1).ToUnit(AngleUnit.Degree).ToString(RussianCulture)); + Assert.Equal("1 м²", Area.FromSquareMeters(1).ToUnit(AreaUnit.SquareMeter).ToString(RussianCulture)); + Assert.Equal("1 В", ElectricPotential.FromVolts(1).ToUnit(ElectricPotentialUnit.Volt).ToString(RussianCulture)); + Assert.Equal("1 м³/с", VolumeFlow.FromCubicMetersPerSecond(1).ToUnit(VolumeFlowUnit.CubicMeterPerSecond).ToString(RussianCulture)); + Assert.Equal("1 Н", Force.FromNewtons(1).ToUnit(ForceUnit.Newton).ToString(RussianCulture)); + Assert.Equal("1 м", Length.FromMeters(1).ToUnit(LengthUnit.Meter).ToString(RussianCulture)); + Assert.Equal("1 кг", Mass.FromKilograms(1).ToUnit(MassUnit.Kilogram).ToString(RussianCulture)); + Assert.Equal("1 Па", Pressure.FromPascals(1).ToUnit(PressureUnit.Pascal).ToString(RussianCulture)); + Assert.Equal("1 рад/с", RotationalSpeed.FromRadiansPerSecond(1).ToUnit(RotationalSpeedUnit.RadianPerSecond).ToString(RussianCulture)); + Assert.Equal("1 K", Temperature.FromKelvins(1).ToUnit(TemperatureUnit.Kelvin).ToString(RussianCulture)); + Assert.Equal("1 Н·м", Torque.FromNewtonMeters(1).ToUnit(TorqueUnit.NewtonMeter).ToString(RussianCulture)); + Assert.Equal("1 м³", Volume.FromCubicMeters(1).ToUnit(VolumeUnit.CubicMeter).ToString(RussianCulture)); } [Fact] @@ -293,7 +293,7 @@ public void MapUnitToDefaultAbbreviation_GivenCustomAbbreviation_SetsAbbreviatio var newZealandCulture = GetCulture("en-NZ"); UnitAbbreviationsCache.Default.MapUnitToDefaultAbbreviation(AreaUnit.SquareMeter, newZealandCulture, "m^2"); - Assert.Equal("1 m^2", Area.FromSquareMeters(1).ToString(newZealandCulture)); + Assert.Equal("1 m^2", Area.FromSquareMeters(1).ToString(newZealandCulture)); } /// diff --git a/UnitsNet.Tests/UnitConverterTest.cs b/UnitsNet.Tests/UnitConverterTest.cs index c94ef6159e..88ec10f26f 100644 --- a/UnitsNet.Tests/UnitConverterTest.cs +++ b/UnitsNet.Tests/UnitConverterTest.cs @@ -13,77 +13,77 @@ public class UnitConverterTest [Fact] public void CustomConversionWithSameQuantityType() { - Length ConversionFunction(Length from) => Length.FromInches(18); + Length ConversionFunction(Length from ) => Length.FromInches(18); - var unitConverter = new UnitConverter(); - unitConverter.SetConversionFunction(LengthUnit.Meter, LengthUnit.Inch, ConversionFunction); + var unitConverter = new UnitConverter(); + unitConverter.SetConversionFunction>(LengthUnit.Meter, LengthUnit.Inch, ConversionFunction); - var foundConversionFunction = unitConverter.GetConversionFunction(LengthUnit.Meter, LengthUnit.Inch); - var converted = foundConversionFunction(Length.FromMeters(1.0)); + var foundConversionFunction = unitConverter.GetConversionFunction>(LengthUnit.Meter, LengthUnit.Inch); + var converted = foundConversionFunction(Length.FromMeters(1.0)); - Assert.Equal(Length.FromInches(18), converted); + Assert.Equal(Length.FromInches(18), converted); } [Fact] public void CustomConversionWithSameQuantityTypeByTypeParam() { - Length ConversionFunction(Length from) => Length.FromInches(18); + Length ConversionFunction(Length from ) => Length.FromInches(18); - var unitConverter = new UnitConverter(); - unitConverter.SetConversionFunction(LengthUnit.Meter, LengthUnit.Inch, (ConversionFunction) ConversionFunction); + var unitConverter = new UnitConverter(); + unitConverter.SetConversionFunction(LengthUnit.Meter, LengthUnit.Inch, (ConversionFunction>) ConversionFunction); - var foundConversionFunction = unitConverter.GetConversionFunction(typeof(Length), LengthUnit.Meter, typeof(Length), LengthUnit.Inch); - var converted = foundConversionFunction(Length.FromMeters(1.0)); + var foundConversionFunction = unitConverter.GetConversionFunction(typeof(Length), LengthUnit.Meter, typeof(Length), LengthUnit.Inch); + var converted = foundConversionFunction(Length.FromMeters(1.0)); - Assert.Equal(Length.FromInches(18), converted); + Assert.Equal(Length.FromInches(18), converted); } [Fact] public void CustomConversionWithDifferentQuantityTypes() { - IQuantity ConversionFunction(IQuantity from) => Length.FromInches(18); + IQuantity ConversionFunction(IQuantity from) => Length.FromInches(18); - var unitConverter = new UnitConverter(); - unitConverter.SetConversionFunction(MassUnit.Grain, LengthUnit.Inch, ConversionFunction); + var unitConverter = new UnitConverter(); + unitConverter.SetConversionFunction, Length>(MassUnit.Grain, LengthUnit.Inch, ConversionFunction); - var foundConversionFunction = unitConverter.GetConversionFunction(MassUnit.Grain, LengthUnit.Inch); - var converted = foundConversionFunction(Mass.FromGrains(100)); + var foundConversionFunction = unitConverter.GetConversionFunction, Length>(MassUnit.Grain, LengthUnit.Inch); + var converted = foundConversionFunction(Mass.FromGrains(100)); - Assert.Equal(Length.FromInches(18), converted); + Assert.Equal(Length.FromInches(18), converted); } [Fact] public void CustomConversionWithDifferentQuantityTypesByTypeParam() { - IQuantity ConversionFunction(IQuantity from) => Length.FromInches(18); + IQuantity ConversionFunction(IQuantity from) => Length.FromInches(18); - var unitConverter = new UnitConverter(); - unitConverter.SetConversionFunction(MassUnit.Grain, LengthUnit.Inch, ConversionFunction); + var unitConverter = new UnitConverter(); + unitConverter.SetConversionFunction, Length>(MassUnit.Grain, LengthUnit.Inch, ConversionFunction); - var foundConversionFunction = unitConverter.GetConversionFunction(typeof(Mass), MassUnit.Grain, typeof(Length), LengthUnit.Inch); - var converted = foundConversionFunction(Mass.FromGrains(100)); + var foundConversionFunction = unitConverter.GetConversionFunction(typeof(Mass), MassUnit.Grain, typeof(Length), LengthUnit.Inch); + var converted = foundConversionFunction(Mass.FromGrains(100)); - Assert.Equal(Length.FromInches(18), converted); + Assert.Equal(Length.FromInches(18), converted); } [Fact] public void TryCustomConversionForOilBarrelsToUsGallons() { - Volume ConversionFunction(Volume from) => Volume.FromUsGallons(from.Value * 42); + Volume ConversionFunction(Volume from ) => Volume.FromUsGallons(from.Value * 42); - var unitConverter = new UnitConverter(); - unitConverter.SetConversionFunction(VolumeUnit.OilBarrel, VolumeUnit.UsGallon, ConversionFunction); + var unitConverter = new UnitConverter(); + unitConverter.SetConversionFunction>(VolumeUnit.OilBarrel, VolumeUnit.UsGallon, ConversionFunction); - var foundConversionFunction = unitConverter.GetConversionFunction(VolumeUnit.OilBarrel, VolumeUnit.UsGallon); - var converted = foundConversionFunction(Volume.FromOilBarrels(1)); + var foundConversionFunction = unitConverter.GetConversionFunction>(VolumeUnit.OilBarrel, VolumeUnit.UsGallon); + var converted = foundConversionFunction(Volume.FromOilBarrels(1)); - Assert.Equal(Volume.FromUsGallons(42), converted); + Assert.Equal(Volume.FromUsGallons(42), converted); } [Fact] public void ConversionToSameUnit_ReturnsSameQuantity() { - var unitConverter = new UnitConverter(); + var unitConverter = new UnitConverter(); var foundConversionFunction = unitConverter.GetConversionFunction(HowMuchUnit.ATon, HowMuchUnit.ATon); var converted = foundConversionFunction(new HowMuch(39, HowMuchUnit.Some)); // Intentionally pass the wrong unit here, to test that the exact same quantity is returned @@ -99,7 +99,7 @@ public void ConversionToSameUnit_ReturnsSameQuantity() public void ConversionForUnitsOfCustomQuantity(double fromValue, Enum fromUnit, Enum toUnit, double expectedValue) { // Intentionally don't map conversion Some->Some, it is not necessary - var unitConverter = new UnitConverter(); + var unitConverter = new UnitConverter(); unitConverter.SetConversionFunction(HowMuchUnit.Some, HowMuchUnit.ATon, x => new HowMuch(x.Value * 2, HowMuchUnit.ATon)); unitConverter.SetConversionFunction(HowMuchUnit.Some, HowMuchUnit.AShitTon, x => new HowMuch(x.Value * 10, HowMuchUnit.AShitTon)); @@ -118,26 +118,26 @@ public void ConversionForUnitsOfCustomQuantity(double fromValue, Enum fromUnit, [InlineData(1000, 1, "ElectricCurrent", "Kiloampere", "Ampere")] public void ConvertByName_ConvertsTheValueToGivenUnit(double expectedValue, double inputValue, string quantityTypeName, string fromUnit, string toUnit) { - Assert.Equal(expectedValue, UnitConverter.ConvertByName(inputValue, quantityTypeName, fromUnit, toUnit)); + Assert.Equal(expectedValue, UnitConverter.ConvertByName(inputValue, quantityTypeName, fromUnit, toUnit)); } [Fact] public void ConvertByName_QuantityCaseInsensitive() { - Assert.Equal(0, UnitConverter.ConvertByName(0, "length", "Meter", "Centimeter")); + Assert.Equal(0, UnitConverter.ConvertByName(0, "length", "Meter", "Centimeter")); } [Fact] public void ConvertByName_UnitTypeCaseInsensitive() { - Assert.Equal(0, UnitConverter.ConvertByName(0, "Length", "meter", "Centimeter")); + Assert.Equal(0, UnitConverter.ConvertByName(0, "Length", "meter", "Centimeter")); } [Theory] [InlineData(1, "UnknownQuantity", "Meter", "Centimeter")] public void ConvertByName_ThrowsUnitNotFoundExceptionOnUnknownQuantity(double inputValue, string quantityTypeName, string fromUnit, string toUnit) { - Assert.Throws(() => UnitConverter.ConvertByName(inputValue, quantityTypeName, fromUnit, toUnit)); + Assert.Throws(() => UnitConverter.ConvertByName(inputValue, quantityTypeName, fromUnit, toUnit)); } [Theory] @@ -145,7 +145,7 @@ public void ConvertByName_ThrowsUnitNotFoundExceptionOnUnknownQuantity(double in [InlineData(1, "Length", "Meter", "UnknownToUnit")] public void ConvertByName_ThrowsUnitNotFoundExceptionOnUnknownFromOrToUnit(double inputValue, string quantityTypeName, string fromUnit, string toUnit) { - Assert.Throws(() => UnitConverter.ConvertByName(inputValue, quantityTypeName, fromUnit, toUnit)); + Assert.Throws(() => UnitConverter.ConvertByName(inputValue, quantityTypeName, fromUnit, toUnit)); } [Theory] @@ -154,7 +154,7 @@ public void ConvertByName_ThrowsUnitNotFoundExceptionOnUnknownFromOrToUnit(doubl [InlineData(1, "Length", "Meter", "UnknownToUnit")] public void TryConvertByName_ReturnsFalseForInvalidInput(double inputValue, string quantityTypeName, string fromUnit, string toUnit) { - Assert.False(UnitConverter.TryConvertByName(inputValue, quantityTypeName, fromUnit, toUnit, out double result)); + Assert.False(UnitConverter.TryConvertByName(inputValue, quantityTypeName, fromUnit, toUnit, out double result)); Assert.Equal(0, result); } @@ -166,7 +166,7 @@ public void TryConvertByName_ReturnsFalseForInvalidInput(double inputValue, stri public void TryConvertByName_ReturnsTrueOnSuccessAndOutputsResult(double expectedValue, double inputValue, string quantityTypeName, string fromUnit, string toUnit) { - Assert.True(UnitConverter.TryConvertByName(inputValue, quantityTypeName, fromUnit, toUnit, out double result), "TryConvertByName() return value."); + Assert.True(UnitConverter.TryConvertByName(inputValue, quantityTypeName, fromUnit, toUnit, out double result), "TryConvertByName() return value."); Assert.Equal(expectedValue, result); } @@ -177,14 +177,14 @@ public void TryConvertByName_ReturnsTrueOnSuccessAndOutputsResult(double expecte [InlineData(1000, 1, "ElectricCurrent", "kA", "A")] public void ConvertByAbbreviation_ConvertsTheValueToGivenUnit(double expectedValue, double inputValue, string quantityTypeName, string fromUnit, string toUnit) { - Assert.Equal(expectedValue, UnitConverter.ConvertByAbbreviation(inputValue, quantityTypeName, fromUnit, toUnit)); + Assert.Equal(expectedValue, UnitConverter.ConvertByAbbreviation(inputValue, quantityTypeName, fromUnit, toUnit)); } [Theory] [InlineData(1, "UnknownQuantity", "m", "cm")] public void ConvertByAbbreviation_ThrowsUnitNotFoundExceptionOnUnknownQuantity( double inputValue, string quantityTypeName, string fromUnit, string toUnit) { - Assert.Throws(() => UnitConverter.ConvertByAbbreviation(inputValue, quantityTypeName, fromUnit, toUnit)); + Assert.Throws(() => UnitConverter.ConvertByAbbreviation(inputValue, quantityTypeName, fromUnit, toUnit)); } [Theory] @@ -192,7 +192,7 @@ public void ConvertByAbbreviation_ThrowsUnitNotFoundExceptionOnUnknownQuantity( [InlineData(1, "Length", "m", "UnknownToUnit")] public void ConvertByAbbreviation_ThrowsUnitNotFoundExceptionOnUnknownFromOrToUnitAbbreviation(double inputValue, string quantityTypeName, string fromUnit, string toUnit) { - Assert.Throws(() => UnitConverter.ConvertByAbbreviation(inputValue, quantityTypeName, fromUnit, toUnit)); + Assert.Throws(() => UnitConverter.ConvertByAbbreviation(inputValue, quantityTypeName, fromUnit, toUnit)); } [Theory] @@ -201,7 +201,7 @@ public void ConvertByAbbreviation_ThrowsUnitNotFoundExceptionOnUnknownFromOrToUn [InlineData(1, "Length", "m", "UnknownToUnit")] public void TryConvertByAbbreviation_ReturnsFalseForInvalidInput(double inputValue, string quantityTypeName, string fromUnit, string toUnit) { - Assert.False(UnitConverter.TryConvertByAbbreviation(inputValue, quantityTypeName, fromUnit, toUnit, out double result)); + Assert.False(UnitConverter.TryConvertByAbbreviation(inputValue, quantityTypeName, fromUnit, toUnit, out double result)); Assert.Equal(0, result); } @@ -213,7 +213,7 @@ public void TryConvertByAbbreviation_ReturnsFalseForInvalidInput(double inputVal public void TryConvertByAbbreviation_ReturnsTrueOnSuccessAndOutputsResult(double expectedValue, double inputValue, string quantityTypeName, string fromUnit, string toUnit) { - Assert.True(UnitConverter.TryConvertByAbbreviation(inputValue, quantityTypeName, fromUnit, toUnit, out double result), "TryConvertByAbbreviation() return value."); + Assert.True(UnitConverter.TryConvertByAbbreviation(inputValue, quantityTypeName, fromUnit, toUnit, out double result), "TryConvertByAbbreviation() return value."); Assert.Equal(expectedValue, result); } } diff --git a/UnitsNet.Tests/UnitMathTests.cs b/UnitsNet.Tests/UnitMathTests.cs index affc38d44b..b92e56f3e6 100644 --- a/UnitsNet.Tests/UnitMathTests.cs +++ b/UnitsNet.Tests/UnitMathTests.cs @@ -10,25 +10,25 @@ public class UnitMathTests [Fact] public void AverageOfDifferentUnitsThrowsException() { - var units = new IQuantity[] {Length.FromMeters(1), Volume.FromLiters(50)}; + var units = new IQuantity[] {Length.FromMeters(1), Volume.FromLiters(50)}; - Assert.Throws(() => units.Average(LengthUnit.Centimeter)); + Assert.Throws(() => units.Average(LengthUnit.Centimeter)); } [Fact] public void AverageOfEmptySourceThrowsException() { - var units = new Length[] { }; + var units = new Length[] { }; - Assert.Throws(() => units.Average(LengthUnit.Centimeter)); + Assert.Throws(() => units.Average, double>(LengthUnit.Centimeter)); } [Fact] public void AverageOfLengthsCalculatesCorrectly() { - var units = new[] {Length.FromMeters(1), Length.FromCentimeters(50)}; + var units = new[] {Length.FromMeters(1), Length.FromCentimeters(50)}; - Length average = units.Average(LengthUnit.Centimeter); + var average = units.Average, double>( LengthUnit.Centimeter); Assert.Equal(75, average.Value); Assert.Equal(LengthUnit.Centimeter, average.Unit); @@ -39,11 +39,11 @@ public void AverageOfLengthsWithNullSelectorThrowsException() { var units = new[] { - new KeyValuePair("1", Length.FromMeters(1)), - new KeyValuePair("2", Length.FromCentimeters(50)) + new KeyValuePair>("1", Length.FromMeters(1)), + new KeyValuePair>("2", Length.FromCentimeters(50)) }; - Assert.Throws(() => units.Average((Func, Length>) null, LengthUnit.Centimeter)); + Assert.Throws(() => units.Average>, Length, double>((Func>, Length>) null, LengthUnit.Centimeter)); } [Fact] @@ -51,11 +51,11 @@ public void AverageOfLengthsWithSelectorCalculatesCorrectly() { var units = new[] { - new KeyValuePair("1", Length.FromMeters(1)), - new KeyValuePair("2", Length.FromCentimeters(50)) + new KeyValuePair>("1", Length.FromMeters(1)), + new KeyValuePair>("2", Length.FromCentimeters(50)) }; - Length average = units.Average(x => x.Value, LengthUnit.Centimeter); + var average = units.Average>, Length, double>( x => x.Value, LengthUnit.Centimeter); Assert.Equal(75, average.Value); Assert.Equal(LengthUnit.Centimeter, average.Unit); @@ -64,25 +64,25 @@ public void AverageOfLengthsWithSelectorCalculatesCorrectly() [Fact] public void MaxOfDifferentUnitsThrowsException() { - var units = new IQuantity[] {Length.FromMeters(1), Volume.FromLiters(50)}; + var units = new IQuantity[] {Length.FromMeters(1), Volume.FromLiters(50)}; - Assert.Throws(() => units.Max(LengthUnit.Centimeter)); + Assert.Throws(() => units.Max(LengthUnit.Centimeter)); } [Fact] public void MaxOfEmptySourceThrowsException() { - var units = new Length[] { }; + var units = new Length[] { }; - Assert.Throws(() => units.Max(LengthUnit.Centimeter)); + Assert.Throws(() => units.Max, double>(LengthUnit.Centimeter)); } [Fact] public void MaxOfLengthsCalculatesCorrectly() { - var units = new[] {Length.FromMeters(1), Length.FromCentimeters(50)}; + var units = new[] {Length.FromMeters(1), Length.FromCentimeters(50)}; - Length max = units.Max(LengthUnit.Centimeter); + var max = units.Max, double>(LengthUnit.Centimeter); Assert.Equal(100, max.Value); Assert.Equal(LengthUnit.Centimeter, max.Unit); @@ -93,11 +93,11 @@ public void MaxOfLengthsWithNullSelectorThrowsException() { var units = new[] { - new KeyValuePair("1", Length.FromMeters(1)), - new KeyValuePair("2", Length.FromCentimeters(50)) + new KeyValuePair>("1", Length.FromMeters(1)), + new KeyValuePair>("2", Length.FromCentimeters(50)) }; - Assert.Throws(() => units.Max((Func, Length>) null, LengthUnit.Centimeter)); + Assert.Throws(() => units.Max>, Length, double>( (Func>, Length>) null, LengthUnit.Centimeter)); } [Fact] @@ -105,11 +105,11 @@ public void MaxOfLengthsWithSelectorCalculatesCorrectly() { var units = new[] { - new KeyValuePair("1", Length.FromMeters(1)), - new KeyValuePair("2", Length.FromCentimeters(50)) + new KeyValuePair>("1", Length.FromMeters(1)), + new KeyValuePair>("2", Length.FromCentimeters(50)) }; - Length max = units.Max(x => x.Value, LengthUnit.Centimeter); + var max = units.Max>, Length, double>( x => x.Value, LengthUnit.Centimeter); Assert.Equal(100, max.Value); Assert.Equal(LengthUnit.Centimeter, max.Unit); @@ -118,25 +118,25 @@ public void MaxOfLengthsWithSelectorCalculatesCorrectly() [Fact] public void MinOfDifferentUnitsThrowsException() { - var units = new IQuantity[] {Length.FromMeters(1), Volume.FromLiters(50)}; + var units = new IQuantity[] {Length.FromMeters(1), Volume.FromLiters(50)}; - Assert.Throws(() => units.Min(LengthUnit.Centimeter)); + Assert.Throws(() => units.Min(LengthUnit.Centimeter)); } [Fact] public void MinOfEmptySourceThrowsException() { - var units = new Length[] { }; + var units = new Length[] { }; - Assert.Throws(() => units.Min(LengthUnit.Centimeter)); + Assert.Throws(() => units.Min, double>(LengthUnit.Centimeter)); } [Fact] public void MinOfLengthsCalculatesCorrectly() { - var units = new[] {Length.FromMeters(1), Length.FromCentimeters(50)}; + var units = new[] {Length.FromMeters(1), Length.FromCentimeters(50)}; - Length min = units.Min(LengthUnit.Centimeter); + var min = units.Min, double>(LengthUnit.Centimeter); Assert.Equal(50, min.Value); Assert.Equal(LengthUnit.Centimeter, min.Unit); @@ -147,11 +147,11 @@ public void MinOfLengthsWithNullSelectorThrowsException() { var units = new[] { - new KeyValuePair("1", Length.FromMeters(1)), - new KeyValuePair("2", Length.FromCentimeters(50)) + new KeyValuePair>("1", Length.FromMeters(1)), + new KeyValuePair>("2", Length.FromCentimeters(50)) }; - Assert.Throws(() => units.Min((Func, Length>) null, LengthUnit.Centimeter)); + Assert.Throws(() => units.Min>, Length, double>( (Func>, Length>) null, LengthUnit.Centimeter)); } [Fact] @@ -159,11 +159,11 @@ public void MinOfLengthsWithSelectorCalculatesCorrectly() { var units = new[] { - new KeyValuePair("1", Length.FromMeters(1)), - new KeyValuePair("2", Length.FromCentimeters(50)) + new KeyValuePair>("1", Length.FromMeters(1)), + new KeyValuePair>("2", Length.FromCentimeters(50)) }; - Length min = units.Min(x => x.Value, LengthUnit.Centimeter); + var min = units.Min>, Length, double>(x => x.Value, LengthUnit.Centimeter); Assert.Equal(50, min.Value); Assert.Equal(LengthUnit.Centimeter, min.Unit); @@ -172,27 +172,27 @@ public void MinOfLengthsWithSelectorCalculatesCorrectly() [Fact] public void SumOfDifferentUnitsThrowsException() { - var units = new IQuantity[] {Length.FromMeters(1), Volume.FromLiters(50)}; + var units = new IQuantity[] {Length.FromMeters(1), Volume.FromLiters(50)}; - Assert.Throws(() => units.Sum(LengthUnit.Centimeter)); + Assert.Throws(() => units.Sum(LengthUnit.Centimeter)); } [Fact] public void SumOfEmptySourceReturnsZero() { - var units = new Length[] { }; + var units = new Length[] { }; - Length sum = units.Sum(Length.BaseUnit); + var sum = units.Sum, double>(Length.BaseUnit); - Assert.Equal(Length.Zero, sum); + Assert.Equal(Length.Zero, sum); } [Fact] public void SumOfLengthsCalculatesCorrectly() { - var units = new[] {Length.FromMeters(1), Length.FromCentimeters(50)}; + var units = new[] {Length.FromMeters(1), Length.FromCentimeters(50)}; - Length sum = units.Sum(LengthUnit.Centimeter); + var sum = units.Sum, double>(LengthUnit.Centimeter); Assert.Equal(150, sum.Value); Assert.Equal(LengthUnit.Centimeter, sum.Unit); @@ -203,11 +203,11 @@ public void SumOfLengthsWithNullSelectorThrowsException() { var units = new[] { - new KeyValuePair("1", Length.FromMeters(1)), - new KeyValuePair("2", Length.FromCentimeters(50)) + new KeyValuePair>("1", Length.FromMeters(1)), + new KeyValuePair>("2", Length.FromCentimeters(50)) }; - Assert.Throws(() => units.Sum((Func, Length>) null, LengthUnit.Centimeter)); + Assert.Throws(() => units.Sum>, Length, double>( (Func>, Length>) null, LengthUnit.Centimeter)); } [Fact] @@ -215,11 +215,11 @@ public void SumOfLengthsWithSelectorCalculatesCorrectly() { var units = new[] { - new KeyValuePair("1", Length.FromMeters(1)), - new KeyValuePair("2", Length.FromCentimeters(50)) + new KeyValuePair>("1", Length.FromMeters(1)), + new KeyValuePair>("2", Length.FromCentimeters(50)) }; - Length sum = units.Sum(x => x.Value, LengthUnit.Centimeter); + var sum = units.Sum>, Length, double>( x => x.Value, LengthUnit.Centimeter); Assert.Equal(150, sum.Value); Assert.Equal(LengthUnit.Centimeter, sum.Unit); diff --git a/UnitsNet.Tests/UnitParserTests.cs b/UnitsNet.Tests/UnitParserTests.cs index 08411f0a24..7df073d75f 100644 --- a/UnitsNet.Tests/UnitParserTests.cs +++ b/UnitsNet.Tests/UnitParserTests.cs @@ -53,8 +53,8 @@ public void Parse_AbbreviationCaseInsensitive_Uppercase_Years() [Fact] public void Parse_GivenAbbreviationsThatAreAmbiguousWhenLowerCase_ReturnsCorrectUnit() { - Assert.Equal(PressureUnit.Megabar, Pressure.ParseUnit("Mbar")); - Assert.Equal(PressureUnit.Millibar, Pressure.ParseUnit("mbar")); + Assert.Equal(PressureUnit.Megabar, Pressure.ParseUnit("Mbar")); + Assert.Equal(PressureUnit.Millibar, Pressure.ParseUnit("mbar")); } [Fact] @@ -107,7 +107,7 @@ public void Parse_AmbiguousUnitsThrowsException() var exception1 = Assert.Throws(() => UnitParser.Default.Parse("pt")); // Act 2 - var exception2 = Assert.Throws(() => Length.Parse("1 pt")); + var exception2 = Assert.Throws(() => Length.Parse("1 pt")); // Assert Assert.Equal("Cannot parse \"pt\" since it could be either of these: DtpPoint, PrinterPoint", exception1.Message); diff --git a/UnitsNet/GeneratedCode/Quantity.g.cs b/UnitsNet/GeneratedCode/Quantity.g.cs index 3301b13eac..f9c7b68739 100644 --- a/UnitsNet/GeneratedCode/Quantity.g.cs +++ b/UnitsNet/GeneratedCode/Quantity.g.cs @@ -558,7 +558,7 @@ public static bool TryFrom(QuantityValue value, Enum unit, out IQuantity quan /// Try to dynamically parse a quantity string representation. /// /// The format provider to use for lookup. Defaults to if null. - /// Type of quantity, such as . + /// Type of quantity, such as . /// Quantity string representation, such as "1.5 kg". Must be compatible with given quantity type. /// The resulting quantity if successful, otherwise default. /// The parsed quantity. From 1e5513cb0128a3c3f024baef0d4e4d6f733568f6 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Wed, 23 Oct 2019 11:38:25 -0400 Subject: [PATCH 10/13] Starting to switch internals to generic type --- .../UnitsNetGen/QuantityGenerator.cs | 152 +++-- UnitsNet.Tests/CompiledLambdasTests.cs | 9 + .../AmountOfSubstanceTestsBase.g.cs | 2 +- .../AmplitudeRatioTestsBase.g.cs | 2 +- .../GeneratedCode/AngleTestsBase.g.cs | 2 +- .../ApparentEnergyTestsBase.g.cs | 2 +- .../GeneratedCode/AreaDensityTestsBase.g.cs | 2 +- ...BrakeSpecificFuelConsumptionTestsBase.g.cs | 2 +- .../GeneratedCode/DensityTestsBase.g.cs | 2 +- .../ElectricChargeDensityTestsBase.g.cs | 2 +- .../ElectricCurrentDensityTestsBase.g.cs | 2 +- .../ElectricPotentialTestsBase.g.cs | 2 +- ...ElectricSurfaceChargeDensityTestsBase.g.cs | 2 +- .../GeneratedCode/EnergyTestsBase.g.cs | 2 +- .../GeneratedCode/InformationTestsBase.g.cs | 2 +- .../GeneratedCode/LapseRateTestsBase.g.cs | 2 +- .../GeneratedCode/LevelTestsBase.g.cs | 2 +- .../GeneratedCode/LinearDensityTestsBase.g.cs | 2 +- .../GeneratedCode/MassFlowTestsBase.g.cs | 2 +- .../GeneratedCode/MassFluxTestsBase.g.cs | 2 +- .../GeneratedCode/MolarEnergyTestsBase.g.cs | 2 +- .../GeneratedCode/PowerDensityTestsBase.g.cs | 2 +- .../GeneratedCode/PowerRatioTestsBase.g.cs | 2 +- .../GeneratedCode/PressureTestsBase.g.cs | 2 +- .../ReactiveEnergyTestsBase.g.cs | 2 +- .../GeneratedCode/SolidAngleTestsBase.g.cs | 2 +- .../SpecificEnergyTestsBase.g.cs | 2 +- .../SpecificVolumeTestsBase.g.cs | 2 +- .../TemperatureDeltaTestsBase.g.cs | 2 +- .../GeneratedCode/TemperatureTestsBase.g.cs | 2 +- .../GeneratedCode/TorqueTestsBase.g.cs | 2 +- .../GeneratedCode/VolumeFlowTestsBase.g.cs | 2 +- .../GeneratedCode/VolumeTestsBase.g.cs | 2 +- UnitsNet/CompiledLambdas.cs | 31 + .../Quantities/AmplitudeRatio.extra.cs | 2 +- .../CustomCode/Quantities/Duration.extra.cs | 27 +- UnitsNet/CustomCode/Quantities/Level.extra.cs | 2 +- .../CustomCode/Quantities/Molarity.extra.cs | 2 +- .../CustomCode/Quantities/PowerRatio.extra.cs | 2 +- .../Quantities/Acceleration.g.cs | 236 ++++---- .../Quantities/AmountOfSubstance.g.cs | 254 ++++---- .../Quantities/AmplitudeRatio.g.cs | 128 ++-- UnitsNet/GeneratedCode/Quantities/Angle.g.cs | 245 ++++---- .../Quantities/ApparentEnergy.g.cs | 146 ++--- .../Quantities/ApparentPower.g.cs | 155 ++--- UnitsNet/GeneratedCode/Quantities/Area.g.cs | 245 ++++---- .../GeneratedCode/Quantities/AreaDensity.g.cs | 128 ++-- .../Quantities/AreaMomentOfInertia.g.cs | 173 +++--- .../GeneratedCode/Quantities/BitRate.g.cs | 353 ++++++----- .../BrakeSpecificFuelConsumption.g.cs | 146 ++--- .../GeneratedCode/Quantities/Capacitance.g.cs | 182 +++--- .../CoefficientOfThermalExpansion.g.cs | 146 ++--- .../GeneratedCode/Quantities/Density.g.cs | 479 +++++++-------- .../GeneratedCode/Quantities/Duration.g.cs | 209 +++---- .../Quantities/DynamicViscosity.g.cs | 200 +++---- .../Quantities/ElectricAdmittance.g.cs | 155 ++--- .../Quantities/ElectricCharge.g.cs | 164 ++--- .../Quantities/ElectricChargeDensity.g.cs | 128 ++-- .../Quantities/ElectricConductance.g.cs | 146 ++--- .../Quantities/ElectricConductivity.g.cs | 146 ++--- .../Quantities/ElectricCurrent.g.cs | 191 +++--- .../Quantities/ElectricCurrentDensity.g.cs | 146 ++--- .../Quantities/ElectricCurrentGradient.g.cs | 128 ++-- .../Quantities/ElectricField.g.cs | 128 ++-- .../Quantities/ElectricInductance.g.cs | 155 ++--- .../Quantities/ElectricPotential.g.cs | 164 ++--- .../Quantities/ElectricPotentialAc.g.cs | 164 ++--- .../Quantities/ElectricPotentialDc.g.cs | 164 ++--- .../Quantities/ElectricResistance.g.cs | 164 ++--- .../Quantities/ElectricResistivity.g.cs | 245 ++++---- .../ElectricSurfaceChargeDensity.g.cs | 146 ++--- UnitsNet/GeneratedCode/Quantities/Energy.g.cs | 335 +++++------ .../GeneratedCode/Quantities/Entropy.g.cs | 182 +++--- UnitsNet/GeneratedCode/Quantities/Force.g.cs | 236 ++++---- .../Quantities/ForceChangeRate.g.cs | 218 +++---- .../Quantities/ForcePerLength.g.cs | 227 ++++--- .../GeneratedCode/Quantities/Frequency.g.cs | 200 +++---- .../Quantities/FuelEfficiency.g.cs | 155 ++--- .../GeneratedCode/Quantities/HeatFlux.g.cs | 281 +++++---- .../Quantities/HeatTransferCoefficient.g.cs | 146 ++--- .../GeneratedCode/Quantities/Illuminance.g.cs | 155 ++--- .../GeneratedCode/Quantities/Information.g.cs | 353 ++++++----- .../GeneratedCode/Quantities/Irradiance.g.cs | 245 ++++---- .../GeneratedCode/Quantities/Irradiation.g.cs | 182 +++--- .../Quantities/KinematicViscosity.g.cs | 191 +++--- .../GeneratedCode/Quantities/LapseRate.g.cs | 128 ++-- UnitsNet/GeneratedCode/Quantities/Length.g.cs | 407 ++++++------- UnitsNet/GeneratedCode/Quantities/Level.g.cs | 110 ++-- .../Quantities/LinearDensity.g.cs | 146 ++--- .../GeneratedCode/Quantities/Luminosity.g.cs | 245 ++++---- .../Quantities/LuminousFlux.g.cs | 128 ++-- .../Quantities/LuminousIntensity.g.cs | 128 ++-- .../Quantities/MagneticField.g.cs | 155 ++--- .../Quantities/MagneticFlux.g.cs | 128 ++-- .../Quantities/Magnetization.g.cs | 128 ++-- UnitsNet/GeneratedCode/Quantities/Mass.g.cs | 344 ++++++----- .../Quantities/MassConcentration.g.cs | 479 +++++++-------- .../GeneratedCode/Quantities/MassFlow.g.cs | 416 ++++++------- .../GeneratedCode/Quantities/MassFlux.g.cs | 137 +++-- .../Quantities/MassFraction.g.cs | 335 +++++------ .../Quantities/MassMomentOfInertia.g.cs | 371 ++++++------ .../GeneratedCode/Quantities/MolarEnergy.g.cs | 146 ++--- .../Quantities/MolarEntropy.g.cs | 146 ++--- .../GeneratedCode/Quantities/MolarMass.g.cs | 227 ++++--- .../GeneratedCode/Quantities/Molarity.g.cs | 191 +++--- .../Quantities/Permeability.g.cs | 128 ++-- .../Quantities/Permittivity.g.cs | 128 ++-- UnitsNet/GeneratedCode/Quantities/Power.g.cs | 299 +++++----- .../Quantities/PowerDensity.g.cs | 515 ++++++++-------- .../GeneratedCode/Quantities/PowerRatio.g.cs | 110 ++-- .../GeneratedCode/Quantities/Pressure.g.cs | 497 ++++++++-------- .../Quantities/PressureChangeRate.g.cs | 182 +++--- UnitsNet/GeneratedCode/Quantities/Ratio.g.cs | 173 +++--- .../Quantities/RatioChangeRate.g.cs | 137 +++-- .../Quantities/ReactiveEnergy.g.cs | 146 ++--- .../Quantities/ReactivePower.g.cs | 155 ++--- .../Quantities/RotationalAcceleration.g.cs | 155 ++--- .../Quantities/RotationalSpeed.g.cs | 236 ++++---- .../Quantities/RotationalStiffness.g.cs | 146 ++--- .../RotationalStiffnessPerLength.g.cs | 146 ++--- .../GeneratedCode/Quantities/SolidAngle.g.cs | 128 ++-- .../Quantities/SpecificEnergy.g.cs | 200 +++---- .../Quantities/SpecificEntropy.g.cs | 200 +++---- .../Quantities/SpecificVolume.g.cs | 146 ++--- .../Quantities/SpecificWeight.g.cs | 272 +++++---- UnitsNet/GeneratedCode/Quantities/Speed.g.cs | 407 ++++++------- .../GeneratedCode/Quantities/Temperature.g.cs | 173 +++--- .../Quantities/TemperatureChangeRate.g.cs | 209 +++---- .../Quantities/TemperatureDelta.g.cs | 191 +++--- .../Quantities/ThermalConductivity.g.cs | 137 +++-- .../Quantities/ThermalResistance.g.cs | 164 ++--- UnitsNet/GeneratedCode/Quantities/Torque.g.cs | 308 +++++----- .../GeneratedCode/Quantities/VitaminA.g.cs | 128 ++-- UnitsNet/GeneratedCode/Quantities/Volume.g.cs | 542 ++++++++--------- .../Quantities/VolumeConcentration.g.cs | 299 +++++----- .../GeneratedCode/Quantities/VolumeFlow.g.cs | 560 ++++++++---------- .../Quantities/VolumePerLength.g.cs | 146 ++--- UnitsNet/IQuantityT.cs | 81 +++ UnitsNet/QuantityValue.cs | 11 + 139 files changed, 10719 insertions(+), 10585 deletions(-) create mode 100644 UnitsNet/IQuantityT.cs diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs index 9300ba6d71..542acfe7c0 100644 --- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs @@ -68,13 +68,8 @@ namespace UnitsNet /// "); Writer.WL($@" - public partial struct {_quantity.Name} : IQuantity<{_unitEnumName}>, IEquatable<{_quantity.Name}>, IComparable, IComparable<{_quantity.Name}>, IConvertible, IFormattable + public partial struct {_quantity.Name} : IQuantityT<{_unitEnumName}, T>, IEquatable<{_quantity.Name}>, IComparable, IComparable<{_quantity.Name}>, IConvertible, IFormattable {{ - /// - /// The numeric value this quantity was constructed with. - /// - private readonly {_quantity.BaseType} _value; - /// /// The unit this quantity was constructed with. /// @@ -161,18 +156,12 @@ private void GenerateInstanceConstructors() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public {_quantity.Name}({_quantity.BaseType} value, {_unitEnumName} unit) + public {_quantity.Name}(T value, {_unitEnumName} unit) {{ if(unit == {_unitEnumName}.Undefined) throw new ArgumentException(""The quantity can not be created with an undefined unit."", nameof(unit)); -"); - Writer.WL(_quantity.BaseType == "double" - ? @" - _value = Guard.EnsureValidNumber(value, nameof(value));" - : @" - _value = value;"); - Writer.WL($@" + Value = value; _unit = unit; }} @@ -184,22 +173,16 @@ private void GenerateInstanceConstructors() /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public {_quantity.Name}({_valueType} value, UnitSystem unitSystem) + public {_quantity.Name}(T value, UnitSystem unitSystem) {{ if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); -"); - Writer.WL(_quantity.BaseType == "double" - ? @" - _value = Guard.EnsureValidNumber(value, nameof(value));" - : @" - _value = value;"); - Writer.WL(@" + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException(""No units were found for the given UnitSystem."", nameof(unitSystem)); - } + }} "); } @@ -244,7 +227,7 @@ private void GenerateStaticProperties() /// /// Gets an instance of this quantity with a value of 0 in the base unit {_quantity.BaseUnit}. /// - public static {_quantity.Name} Zero {{ get; }} = new {_quantity.Name}(0, BaseUnit); + public static {_quantity.Name} Zero {{ get; }} = new {_quantity.Name}((T)0, BaseUnit); #endregion "); @@ -258,16 +241,10 @@ private void GenerateProperties() /// /// The numeric value this quantity was constructed with. /// - public {_valueType} Value => _value; -"); + public T Value{{ get; }} - // Need to provide explicit interface implementation for decimal quantities like Information - if (_quantity.BaseType != "double") - Writer.WL(@" - double IQuantity.Value => (double) _value; -"); + double IQuantity.Value => Convert.ToDouble(Value); - Writer.WL($@" Enum IQuantity.Unit => Unit; /// @@ -306,7 +283,7 @@ private void GenerateConversionProperties() /// "); Writer.WLIfText(2, GetObsoleteAttributeOrNull(unit)); Writer.WL($@" - public double {unit.PluralName} => As({_unitEnumName}.{unit.SingularName}); + public T {unit.PluralName} => As({_unitEnumName}.{unit.SingularName}); "); } @@ -362,10 +339,9 @@ private void GenerateStaticFactoryMethods() /// If value is NaN or Infinity."); Writer.WLIfText(2, GetObsoleteAttributeOrNull(unit)); Writer.WL($@" - public static {_quantity.Name} From{unit.PluralName}(QuantityValue {valueParamName}) + public static {_quantity.Name} From{unit.PluralName}(T {valueParamName}) {{ - {_valueType} value = ({_valueType}) {valueParamName}; - return new {_quantity.Name}(value, {_unitEnumName}.{unit.SingularName}); + return new {_quantity.Name}({valueParamName}, {_unitEnumName}.{unit.SingularName}); }}"); } @@ -377,13 +353,13 @@ private void GenerateStaticFactoryMethods() /// Value to convert from. /// Unit to convert from. /// unit value. - public static {_quantity.Name} From(QuantityValue value, {_unitEnumName} fromUnit) + public static {_quantity.Name} From(T value, {_unitEnumName} fromUnit) {{ - return new {_quantity.Name}(({_valueType})value, fromUnit); + return new {_quantity.Name}(value, fromUnit); }} #endregion -"); +" ); } private void GenerateStaticParseMethods() @@ -553,43 +529,48 @@ private void GenerateArithmeticOperators() /// Negate the value. public static {_quantity.Name} operator -({_quantity.Name} right) {{ - return new {_quantity.Name}(-right.Value, right.Unit); + return new {_quantity.Name}(CompiledLambdas.Negate(right.Value), right.Unit); }} /// Get from adding two . public static {_quantity.Name} operator +({_quantity.Name} left, {_quantity.Name} right) {{ - return new {_quantity.Name}(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new {_quantity.Name}(value, left.Unit); }} /// Get from subtracting two . public static {_quantity.Name} operator -({_quantity.Name} left, {_quantity.Name} right) {{ - return new {_quantity.Name}(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new {_quantity.Name}(value, left.Unit); }} /// Get from multiplying value and . - public static {_quantity.Name} operator *({_valueType} left, {_quantity.Name} right) + public static {_quantity.Name} operator *(T left, {_quantity.Name} right) {{ - return new {_quantity.Name}(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new {_quantity.Name}(value, right.Unit); }} /// Get from multiplying value and . - public static {_quantity.Name} operator *({_quantity.Name} left, {_valueType} right) + public static {_quantity.Name} operator *({_quantity.Name} left, T right) {{ - return new {_quantity.Name}(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new {_quantity.Name}(value, left.Unit); }} /// Get from dividing by value. - public static {_quantity.Name} operator /({_quantity.Name} left, {_valueType} right) + public static {_quantity.Name} operator /({_quantity.Name} left, T right) {{ - return new {_quantity.Name}(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new {_quantity.Name}(value, left.Unit); }} /// Get ratio value from dividing by . - public static double operator /({_quantity.Name} left, {_quantity.Name} right) + public static T operator /({_quantity.Name} left, {_quantity.Name} right) {{ - return left.{_baseUnit.PluralName} / right.{_baseUnit.PluralName}; + return CompiledLambdas.Divide(left.{_baseUnit.PluralName}, right.{_baseUnit.PluralName}); }} #endregion @@ -666,25 +647,25 @@ private void GenerateEqualityAndComparison() /// Returns true if less or equal to. public static bool operator <=({_quantity.Name} left, {_quantity.Name} right) {{ - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); }} /// Returns true if greater than or equal to. public static bool operator >=({_quantity.Name} left, {_quantity.Name} right) {{ - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); }} /// Returns true if less than. public static bool operator <({_quantity.Name} left, {_quantity.Name} right) {{ - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); }} /// Returns true if greater than. public static bool operator >({_quantity.Name} left, {_quantity.Name} right) {{ - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); }} /// Returns true if exactly equal. @@ -713,7 +694,7 @@ public int CompareTo(object obj) /// public int CompareTo({_quantity.Name} other) {{ - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); }} /// @@ -730,7 +711,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals({_quantity.Name} other) {{ - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); }} /// @@ -778,10 +759,8 @@ public bool Equals({_quantity.Name} other, double tolerance, ComparisonType c if(tolerance < 0) throw new ArgumentOutOfRangeException(""tolerance"", ""Tolerance must be greater than or equal to 0.""); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); }} /// @@ -806,17 +785,17 @@ private void GenerateConversionMethods() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As({_unitEnumName} unit) + public T As({_unitEnumName} unit) {{ if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; }} /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) {{ if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -836,9 +815,14 @@ double IQuantity.As(Enum unit) if(!(unit is {_unitEnumName} unitAs{_unitEnumName})) throw new ArgumentException($""The given unit is of type {{unit.GetType()}}. Only {{typeof({_unitEnumName})}} is supported."", nameof(unit)); - return As(unitAs{_unitEnumName}); + var asValue = As(unitAs{_unitEnumName}); + return Convert.ToDouble(asValue); }} + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity<{_unitEnumName}>.As({_unitEnumName} unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -879,21 +863,27 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity<{_unitEnumName}> IQuantity<{_unitEnumName}>.ToUnit({_unitEnumName} unit) => ToUnit(unit); + /// + IQuantityT<{_unitEnumName}, T> IQuantityT<{_unitEnumName}, T>.ToUnit({_unitEnumName} unit) => ToUnit(unit); + /// IQuantity<{_unitEnumName}> IQuantity<{_unitEnumName}>.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT<{_unitEnumName}, T> IQuantityT<{_unitEnumName}, T>.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private {_valueType} GetValueInBaseUnit() + private T GetValueInBaseUnit() {{ switch(Unit) - {{"); + {{" ); foreach (var unit in _quantity.Units) { - var func = unit.FromUnitToBaseFunc.Replace("x", "_value"); + var func = unit.FromUnitToBaseFunc.Replace("x", "Value"); Writer.WL($@" case {_unitEnumName}.{unit.SingularName}: return {func};"); } @@ -915,10 +905,10 @@ IQuantity IQuantity.ToUnit(Enum unit) return new {_quantity.Name}(baseUnitValue, BaseUnit); }} - private {_valueType} GetValueAs({_unitEnumName} unit) + private T GetValueAs({_unitEnumName} unit) {{ if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1043,7 +1033,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) {{ - return Convert.ToByte(_value); + return Convert.ToByte(Value); }} char IConvertible.ToChar(IFormatProvider provider) @@ -1058,37 +1048,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) {{ - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); }} double IConvertible.ToDouble(IFormatProvider provider) {{ - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); }} short IConvertible.ToInt16(IFormatProvider provider) {{ - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); }} int IConvertible.ToInt32(IFormatProvider provider) {{ - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); }} long IConvertible.ToInt64(IFormatProvider provider) {{ - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); }} sbyte IConvertible.ToSByte(IFormatProvider provider) {{ - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); }} float IConvertible.ToSingle(IFormatProvider provider) {{ - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); }} string IConvertible.ToString(IFormatProvider provider) @@ -1112,17 +1102,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) {{ - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); }} uint IConvertible.ToUInt32(IFormatProvider provider) {{ - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); }} ulong IConvertible.ToUInt64(IFormatProvider provider) {{ - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); }} #endregion" ); diff --git a/UnitsNet.Tests/CompiledLambdasTests.cs b/UnitsNet.Tests/CompiledLambdasTests.cs index 5ef295d2b6..538eff4f1f 100644 --- a/UnitsNet.Tests/CompiledLambdasTests.cs +++ b/UnitsNet.Tests/CompiledLambdasTests.cs @@ -91,5 +91,14 @@ public void GreaterThanOrEqualReturnsExpectedValues(TLeft left, T { Assert.Equal(expected, CompiledLambdas.GreaterThanOrEqual(left, right)); } + + [Theory] + [InlineData(3.0, -3.0)] + [InlineData(0.0, 0.0)] + [InlineData(-3.0, 3.0)] + public void NegateReturnsExpectedValues(T value, T expected) + { + Assert.Equal(expected, CompiledLambdas.Negate(value)); + } } } diff --git a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs index 3a311ef153..87dd876761 100644 --- a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of AmountOfSubstance. + /// Test of AmountOfSubstance. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class AmountOfSubstanceTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs index 6be1ef240e..a321a780bc 100644 --- a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of AmplitudeRatio. + /// Test of AmplitudeRatio. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class AmplitudeRatioTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs index 3beed0a7f1..f773c26f41 100644 --- a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Angle. + /// Test of Angle. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class AngleTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs index 2d22f35b23..1817f18e1b 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of ApparentEnergy. + /// Test of ApparentEnergy. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class ApparentEnergyTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs index b6d3680596..6de1e152f9 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of AreaDensity. + /// Test of AreaDensity. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class AreaDensityTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs index bbbf11a979..4a7ad6f695 100644 --- a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of BrakeSpecificFuelConsumption. + /// Test of BrakeSpecificFuelConsumption. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class BrakeSpecificFuelConsumptionTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs index 5f8209ba2f..ae9e610315 100644 --- a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Density. + /// Test of Density. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class DensityTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs index 1a5e381e1f..bf026c49e4 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of ElectricChargeDensity. + /// Test of ElectricChargeDensity. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class ElectricChargeDensityTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs index f8c4c7f4cd..477b8a3214 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of ElectricCurrentDensity. + /// Test of ElectricCurrentDensity. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class ElectricCurrentDensityTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs index 31c15ac415..6e9a28e357 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of ElectricPotential. + /// Test of ElectricPotential. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class ElectricPotentialTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/ElectricSurfaceChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricSurfaceChargeDensityTestsBase.g.cs index f804d851f2..46669b804c 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricSurfaceChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricSurfaceChargeDensityTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of ElectricSurfaceChargeDensity. + /// Test of ElectricSurfaceChargeDensity. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class ElectricSurfaceChargeDensityTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs index 0194b85dba..6d058a1bca 100644 --- a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Energy. + /// Test of Energy. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class EnergyTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs index d1b3f05ddd..4c8fb7b2c2 100644 --- a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Information. + /// Test of Information. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class InformationTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs index 7325512bbb..b7c323a250 100644 --- a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of LapseRate. + /// Test of LapseRate. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class LapseRateTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs index dc17386959..db105a567c 100644 --- a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Level. + /// Test of Level. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class LevelTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs index bc2b836994..8ac620432a 100644 --- a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of LinearDensity. + /// Test of LinearDensity. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class LinearDensityTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs index 4455e78461..a01158794c 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of MassFlow. + /// Test of MassFlow. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class MassFlowTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs index 371dbd82de..308cb6141a 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of MassFlux. + /// Test of MassFlux. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class MassFluxTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs index b6a87648bb..568b38f9b5 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of MolarEnergy. + /// Test of MolarEnergy. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class MolarEnergyTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs index 70d9cdd197..b2d2cfc7bd 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of PowerDensity. + /// Test of PowerDensity. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class PowerDensityTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs index e8f5bf6451..0f46c40044 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of PowerRatio. + /// Test of PowerRatio. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class PowerRatioTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs index 2b91744a76..37f351ffa2 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Pressure. + /// Test of Pressure. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class PressureTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs index e67942ef95..ec51ed1356 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of ReactiveEnergy. + /// Test of ReactiveEnergy. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class ReactiveEnergyTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs index ab0eb472b8..30536baff8 100644 --- a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of SolidAngle. + /// Test of SolidAngle. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class SolidAngleTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs index 44bab7017f..43f55506db 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of SpecificEnergy. + /// Test of SpecificEnergy. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class SpecificEnergyTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs index afb657fa3e..714026e6be 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of SpecificVolume. + /// Test of SpecificVolume. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class SpecificVolumeTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs index 742550405e..465706a919 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of TemperatureDelta. + /// Test of TemperatureDelta. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class TemperatureDeltaTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs index 8749450966..65a2f49924 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Temperature. + /// Test of Temperature. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class TemperatureTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs index 858e9892d6..9ecbbf317f 100644 --- a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Torque. + /// Test of Torque. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class TorqueTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs index 400664fdb9..01956fc6f9 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of VolumeFlow. + /// Test of VolumeFlow. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class VolumeFlowTestsBase diff --git a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs index 1d9e185b5f..090251bc9a 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs @@ -29,7 +29,7 @@ namespace UnitsNet.Tests { /// - /// Test of Volume. + /// Test of Volume. /// // ReSharper disable once PartialTypeWithSinglePart public abstract partial class VolumeTestsBase diff --git a/UnitsNet/CompiledLambdas.cs b/UnitsNet/CompiledLambdas.cs index 47c5f0d67e..7a34e0af2b 100644 --- a/UnitsNet/CompiledLambdas.cs +++ b/UnitsNet/CompiledLambdas.cs @@ -197,6 +197,14 @@ internal static bool GreaterThan(TLeft left, TRight right) => internal static bool GreaterThanOrEqual(TLeft left, TRight right) => GreaterThanOrEqualImplementation.Invoke(left, right); + /// + /// Negates the value. + /// + /// The type of the value to negate. + /// The value to negate. + /// The negated value. + internal static T Negate(T value) => NegateImplementation.Invoke(value); + #region Implementation Classes private static class MultiplyImplementation @@ -287,8 +295,31 @@ private static class GreaterThanOrEqualImplementation internal static bool Invoke(TLeft left, TRight right) => Function(left, right); } + private static class NegateImplementation + { + private readonly static Func Function = + CreateUnaryFunction(Expression.Negate); + + internal static TResult Invoke(T value) => Function(value); + } + #endregion + /// + /// Creates a compiled lambda for the given . + /// + /// The type of the value to be passed to the . + /// The return type of the . + /// The function that creates a unary expression to compile. + /// The compiled unary expression. + private static Func CreateUnaryFunction(Func expressionCreationFunction) + { + var valueParameter = Expression.Parameter(typeof(T), "value"); + var negationExpression = expressionCreationFunction(valueParameter); + var lambda = Expression.Lambda>(negationExpression, valueParameter); + return lambda.Compile(); + } + /// /// Creates a compiled lambda for the given . /// diff --git a/UnitsNet/CustomCode/Quantities/AmplitudeRatio.extra.cs b/UnitsNet/CustomCode/Quantities/AmplitudeRatio.extra.cs index 55bc926724..8ac9b25682 100644 --- a/UnitsNet/CustomCode/Quantities/AmplitudeRatio.extra.cs +++ b/UnitsNet/CustomCode/Quantities/AmplitudeRatio.extra.cs @@ -24,7 +24,7 @@ public AmplitudeRatio(ElectricPotential voltage ) "The base-10 logarithm of a number ≤ 0 is undefined. Voltage must be greater than 0 V."); // E(dBV) = 20*log10(value(V)/reference(V)) - _value = 20 * Math.Log10(voltage.Volts / 1); + Value = 20 * Math.Log10(voltage.Volts / 1); _unit = AmplitudeRatioUnit.DecibelVolt; } diff --git a/UnitsNet/CustomCode/Quantities/Duration.extra.cs b/UnitsNet/CustomCode/Quantities/Duration.extra.cs index 5b1bded61f..0981ba9064 100644 --- a/UnitsNet/CustomCode/Quantities/Duration.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Duration.extra.cs @@ -21,25 +21,25 @@ public TimeSpan ToTimeSpan() } /// Get from plus . - public static DateTime operator +(DateTime time, Duration duration ) + public static DateTime operator +(DateTime time, Duration duration) { return time.AddSeconds(duration.Seconds); } /// Get from minus . - public static DateTime operator -(DateTime time, Duration duration ) + public static DateTime operator -(DateTime time, Duration duration) { return time.AddSeconds(-duration.Seconds); } /// Explicitly cast to . - public static explicit operator TimeSpan(Duration duration ) + public static explicit operator TimeSpan(Duration duration) { return duration.ToTimeSpan(); } /// Explicitly cast to . - public static explicit operator Duration( TimeSpan duration) + public static explicit operator Duration(TimeSpan duration) { return FromSeconds(duration.TotalSeconds); } @@ -47,55 +47,56 @@ public static explicit operator Duration( TimeSpan duration) /// True if is less than . public static bool operator <(Duration duration, TimeSpan timeSpan) { - return duration.Seconds < timeSpan.TotalSeconds; + return CompiledLambdas.LessThan(duration.Seconds, timeSpan.TotalSeconds); } /// True if is greater than . public static bool operator >(Duration duration, TimeSpan timeSpan) { - return duration.Seconds > timeSpan.TotalSeconds; + return CompiledLambdas.GreaterThan(duration.Seconds, timeSpan.TotalSeconds); } /// True if is less than or equal to . public static bool operator <=(Duration duration, TimeSpan timeSpan) { - return duration.Seconds <= timeSpan.TotalSeconds; + return CompiledLambdas.LessThanOrEqual( duration.Seconds, timeSpan.TotalSeconds); } /// True if is greater than or equal to . public static bool operator >=(Duration duration, TimeSpan timeSpan) { - return duration.Seconds >= timeSpan.TotalSeconds; + return CompiledLambdas.GreaterThanOrEqual(duration.Seconds, timeSpan.TotalSeconds); } /// True if is less than . public static bool operator <(TimeSpan timeSpan, Duration duration ) { - return timeSpan.TotalSeconds < duration.Seconds; + return CompiledLambdas.LessThan(timeSpan.TotalSeconds, duration.Seconds); } /// True if is greater than . public static bool operator >(TimeSpan timeSpan, Duration duration ) { - return timeSpan.TotalSeconds > duration.Seconds; + return CompiledLambdas.GreaterThan(timeSpan.TotalSeconds, duration.Seconds); } /// True if is less than or equal to . public static bool operator <=(TimeSpan timeSpan, Duration duration ) { - return timeSpan.TotalSeconds <= duration.Seconds; + return CompiledLambdas.LessThanOrEqual(timeSpan.TotalSeconds, duration.Seconds); } /// True if is greater than or equal to . public static bool operator >=(TimeSpan timeSpan, Duration duration ) { - return timeSpan.TotalSeconds >= duration.Seconds; + return CompiledLambdas.GreaterThanOrEqual(timeSpan.TotalSeconds, duration.Seconds); } /// Get from times . public static Volume operator *(Duration duration, VolumeFlow volumeFlow ) { - return Volume.FromCubicMeters(volumeFlow.CubicMetersPerSecond * duration.Seconds); + var value = CompiledLambdas.Multiply(volumeFlow.CubicMetersPerSecond, duration.Seconds); + return Volume.FromCubicMeters(value); } } } diff --git a/UnitsNet/CustomCode/Quantities/Level.extra.cs b/UnitsNet/CustomCode/Quantities/Level.extra.cs index 5e8ed17fb9..493f3f09ce 100644 --- a/UnitsNet/CustomCode/Quantities/Level.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Level.extra.cs @@ -27,7 +27,7 @@ public Level(double quantity, double reference) throw new ArgumentOutOfRangeException(nameof(reference), errorMessage); // ReSharper restore CompareOfFloatsByEqualityOperator - _value = 10*Math.Log10(quantity/reference); + Value = 10*Math.Log10(quantity/reference); _unit = LevelUnit.Decibel; } } diff --git a/UnitsNet/CustomCode/Quantities/Molarity.extra.cs b/UnitsNet/CustomCode/Quantities/Molarity.extra.cs index 0a3d7fcc7f..b174705e68 100644 --- a/UnitsNet/CustomCode/Quantities/Molarity.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Molarity.extra.cs @@ -13,7 +13,7 @@ public partial struct Molarity public Molarity(Density density, Mass molecularWeight ) : this() { - _value = density.KilogramsPerCubicMeter / molecularWeight.Kilograms; + Value = density.KilogramsPerCubicMeter / molecularWeight.Kilograms; _unit = MolarityUnit.MolesPerCubicMeter; } diff --git a/UnitsNet/CustomCode/Quantities/PowerRatio.extra.cs b/UnitsNet/CustomCode/Quantities/PowerRatio.extra.cs index a392c560d4..68af34cb7b 100644 --- a/UnitsNet/CustomCode/Quantities/PowerRatio.extra.cs +++ b/UnitsNet/CustomCode/Quantities/PowerRatio.extra.cs @@ -21,7 +21,7 @@ public PowerRatio(Power power ) nameof(power), "The base-10 logarithm of a number ≤ 0 is undefined. Power must be greater than 0 W."); // P(dBW) = 10*log10(value(W)/reference(W)) - _value = 10 * Math.Log10(power.Watts / 1); + Value = 10 * Math.Log10(power.Watts / 1); _unit = PowerRatioUnit.DecibelWatt; } diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs index 6ed75806bb..b8f1a85912 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Acceleration, in physics, is the rate at which the velocity of an object changes over time. An object's acceleration is the net result of any and all forces acting on the object, as described by Newton's Second Law. The SI unit for acceleration is the Meter per second squared (m/s²). Accelerations are vector quantities (they have magnitude and direction) and add according to the parallelogram law. As a vector, the calculated net force is equal to the product of the object's mass (a scalar quantity) and the acceleration. /// - public partial struct Acceleration : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Acceleration : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -73,12 +68,12 @@ static Acceleration() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Acceleration(double value, AccelerationUnit unit) + public Acceleration(T value, AccelerationUnit unit) { if(unit == AccelerationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -90,14 +85,14 @@ public Acceleration(double value, AccelerationUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Acceleration(double value, UnitSystem unitSystem) + public Acceleration(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -139,7 +134,7 @@ public Acceleration(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit MeterPerSecondSquared. /// - public static Acceleration Zero { get; } = new Acceleration(0, BaseUnit); + public static Acceleration Zero { get; } = new Acceleration((T)0, BaseUnit); #endregion @@ -148,7 +143,9 @@ public Acceleration(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -178,67 +175,67 @@ public Acceleration(double value, UnitSystem unitSystem) /// /// Get in CentimetersPerSecondSquared. /// - public double CentimetersPerSecondSquared => As(AccelerationUnit.CentimeterPerSecondSquared); + public T CentimetersPerSecondSquared => As(AccelerationUnit.CentimeterPerSecondSquared); /// /// Get in DecimetersPerSecondSquared. /// - public double DecimetersPerSecondSquared => As(AccelerationUnit.DecimeterPerSecondSquared); + public T DecimetersPerSecondSquared => As(AccelerationUnit.DecimeterPerSecondSquared); /// /// Get in FeetPerSecondSquared. /// - public double FeetPerSecondSquared => As(AccelerationUnit.FootPerSecondSquared); + public T FeetPerSecondSquared => As(AccelerationUnit.FootPerSecondSquared); /// /// Get in InchesPerSecondSquared. /// - public double InchesPerSecondSquared => As(AccelerationUnit.InchPerSecondSquared); + public T InchesPerSecondSquared => As(AccelerationUnit.InchPerSecondSquared); /// /// Get in KilometersPerSecondSquared. /// - public double KilometersPerSecondSquared => As(AccelerationUnit.KilometerPerSecondSquared); + public T KilometersPerSecondSquared => As(AccelerationUnit.KilometerPerSecondSquared); /// /// Get in KnotsPerHour. /// - public double KnotsPerHour => As(AccelerationUnit.KnotPerHour); + public T KnotsPerHour => As(AccelerationUnit.KnotPerHour); /// /// Get in KnotsPerMinute. /// - public double KnotsPerMinute => As(AccelerationUnit.KnotPerMinute); + public T KnotsPerMinute => As(AccelerationUnit.KnotPerMinute); /// /// Get in KnotsPerSecond. /// - public double KnotsPerSecond => As(AccelerationUnit.KnotPerSecond); + public T KnotsPerSecond => As(AccelerationUnit.KnotPerSecond); /// /// Get in MetersPerSecondSquared. /// - public double MetersPerSecondSquared => As(AccelerationUnit.MeterPerSecondSquared); + public T MetersPerSecondSquared => As(AccelerationUnit.MeterPerSecondSquared); /// /// Get in MicrometersPerSecondSquared. /// - public double MicrometersPerSecondSquared => As(AccelerationUnit.MicrometerPerSecondSquared); + public T MicrometersPerSecondSquared => As(AccelerationUnit.MicrometerPerSecondSquared); /// /// Get in MillimetersPerSecondSquared. /// - public double MillimetersPerSecondSquared => As(AccelerationUnit.MillimeterPerSecondSquared); + public T MillimetersPerSecondSquared => As(AccelerationUnit.MillimeterPerSecondSquared); /// /// Get in NanometersPerSecondSquared. /// - public double NanometersPerSecondSquared => As(AccelerationUnit.NanometerPerSecondSquared); + public T NanometersPerSecondSquared => As(AccelerationUnit.NanometerPerSecondSquared); /// /// Get in StandardGravity. /// - public double StandardGravity => As(AccelerationUnit.StandardGravity); + public T StandardGravity => As(AccelerationUnit.StandardGravity); #endregion @@ -273,118 +270,105 @@ public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] IFormatP /// Get from CentimetersPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromCentimetersPerSecondSquared(QuantityValue centimeterspersecondsquared) + public static Acceleration FromCentimetersPerSecondSquared(T centimeterspersecondsquared) { - double value = (double) centimeterspersecondsquared; - return new Acceleration(value, AccelerationUnit.CentimeterPerSecondSquared); + return new Acceleration(centimeterspersecondsquared, AccelerationUnit.CentimeterPerSecondSquared); } /// /// Get from DecimetersPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromDecimetersPerSecondSquared(QuantityValue decimeterspersecondsquared) + public static Acceleration FromDecimetersPerSecondSquared(T decimeterspersecondsquared) { - double value = (double) decimeterspersecondsquared; - return new Acceleration(value, AccelerationUnit.DecimeterPerSecondSquared); + return new Acceleration(decimeterspersecondsquared, AccelerationUnit.DecimeterPerSecondSquared); } /// /// Get from FeetPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromFeetPerSecondSquared(QuantityValue feetpersecondsquared) + public static Acceleration FromFeetPerSecondSquared(T feetpersecondsquared) { - double value = (double) feetpersecondsquared; - return new Acceleration(value, AccelerationUnit.FootPerSecondSquared); + return new Acceleration(feetpersecondsquared, AccelerationUnit.FootPerSecondSquared); } /// /// Get from InchesPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromInchesPerSecondSquared(QuantityValue inchespersecondsquared) + public static Acceleration FromInchesPerSecondSquared(T inchespersecondsquared) { - double value = (double) inchespersecondsquared; - return new Acceleration(value, AccelerationUnit.InchPerSecondSquared); + return new Acceleration(inchespersecondsquared, AccelerationUnit.InchPerSecondSquared); } /// /// Get from KilometersPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromKilometersPerSecondSquared(QuantityValue kilometerspersecondsquared) + public static Acceleration FromKilometersPerSecondSquared(T kilometerspersecondsquared) { - double value = (double) kilometerspersecondsquared; - return new Acceleration(value, AccelerationUnit.KilometerPerSecondSquared); + return new Acceleration(kilometerspersecondsquared, AccelerationUnit.KilometerPerSecondSquared); } /// /// Get from KnotsPerHour. /// /// If value is NaN or Infinity. - public static Acceleration FromKnotsPerHour(QuantityValue knotsperhour) + public static Acceleration FromKnotsPerHour(T knotsperhour) { - double value = (double) knotsperhour; - return new Acceleration(value, AccelerationUnit.KnotPerHour); + return new Acceleration(knotsperhour, AccelerationUnit.KnotPerHour); } /// /// Get from KnotsPerMinute. /// /// If value is NaN or Infinity. - public static Acceleration FromKnotsPerMinute(QuantityValue knotsperminute) + public static Acceleration FromKnotsPerMinute(T knotsperminute) { - double value = (double) knotsperminute; - return new Acceleration(value, AccelerationUnit.KnotPerMinute); + return new Acceleration(knotsperminute, AccelerationUnit.KnotPerMinute); } /// /// Get from KnotsPerSecond. /// /// If value is NaN or Infinity. - public static Acceleration FromKnotsPerSecond(QuantityValue knotspersecond) + public static Acceleration FromKnotsPerSecond(T knotspersecond) { - double value = (double) knotspersecond; - return new Acceleration(value, AccelerationUnit.KnotPerSecond); + return new Acceleration(knotspersecond, AccelerationUnit.KnotPerSecond); } /// /// Get from MetersPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromMetersPerSecondSquared(QuantityValue meterspersecondsquared) + public static Acceleration FromMetersPerSecondSquared(T meterspersecondsquared) { - double value = (double) meterspersecondsquared; - return new Acceleration(value, AccelerationUnit.MeterPerSecondSquared); + return new Acceleration(meterspersecondsquared, AccelerationUnit.MeterPerSecondSquared); } /// /// Get from MicrometersPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromMicrometersPerSecondSquared(QuantityValue micrometerspersecondsquared) + public static Acceleration FromMicrometersPerSecondSquared(T micrometerspersecondsquared) { - double value = (double) micrometerspersecondsquared; - return new Acceleration(value, AccelerationUnit.MicrometerPerSecondSquared); + return new Acceleration(micrometerspersecondsquared, AccelerationUnit.MicrometerPerSecondSquared); } /// /// Get from MillimetersPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromMillimetersPerSecondSquared(QuantityValue millimeterspersecondsquared) + public static Acceleration FromMillimetersPerSecondSquared(T millimeterspersecondsquared) { - double value = (double) millimeterspersecondsquared; - return new Acceleration(value, AccelerationUnit.MillimeterPerSecondSquared); + return new Acceleration(millimeterspersecondsquared, AccelerationUnit.MillimeterPerSecondSquared); } /// /// Get from NanometersPerSecondSquared. /// /// If value is NaN or Infinity. - public static Acceleration FromNanometersPerSecondSquared(QuantityValue nanometerspersecondsquared) + public static Acceleration FromNanometersPerSecondSquared(T nanometerspersecondsquared) { - double value = (double) nanometerspersecondsquared; - return new Acceleration(value, AccelerationUnit.NanometerPerSecondSquared); + return new Acceleration(nanometerspersecondsquared, AccelerationUnit.NanometerPerSecondSquared); } /// /// Get from StandardGravity. /// /// If value is NaN or Infinity. - public static Acceleration FromStandardGravity(QuantityValue standardgravity) + public static Acceleration FromStandardGravity(T standardgravity) { - double value = (double) standardgravity; - return new Acceleration(value, AccelerationUnit.StandardGravity); + return new Acceleration(standardgravity, AccelerationUnit.StandardGravity); } /// @@ -393,9 +377,9 @@ public static Acceleration FromStandardGravity(QuantityValue standardgravity) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Acceleration From(QuantityValue value, AccelerationUnit fromUnit) + public static Acceleration From(T value, AccelerationUnit fromUnit) { - return new Acceleration((double)value, fromUnit); + return new Acceleration(value, fromUnit); } #endregion @@ -549,43 +533,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Accele /// Negate the value. public static Acceleration operator -(Acceleration right) { - return new Acceleration(-right.Value, right.Unit); + return new Acceleration(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Acceleration operator +(Acceleration left, Acceleration right) { - return new Acceleration(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Acceleration(value, left.Unit); } /// Get from subtracting two . public static Acceleration operator -(Acceleration left, Acceleration right) { - return new Acceleration(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Acceleration(value, left.Unit); } /// Get from multiplying value and . - public static Acceleration operator *(double left, Acceleration right) + public static Acceleration operator *(T left, Acceleration right) { - return new Acceleration(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Acceleration(value, right.Unit); } /// Get from multiplying value and . - public static Acceleration operator *(Acceleration left, double right) + public static Acceleration operator *(Acceleration left, T right) { - return new Acceleration(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Acceleration(value, left.Unit); } /// Get from dividing by value. - public static Acceleration operator /(Acceleration left, double right) + public static Acceleration operator /(Acceleration left, T right) { - return new Acceleration(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Acceleration(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Acceleration left, Acceleration right) + public static T operator /(Acceleration left, Acceleration right) { - return left.MetersPerSecondSquared / right.MetersPerSecondSquared; + return CompiledLambdas.Divide(left.MetersPerSecondSquared, right.MetersPerSecondSquared); } #endregion @@ -595,25 +584,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Accele /// Returns true if less or equal to. public static bool operator <=(Acceleration left, Acceleration right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Acceleration left, Acceleration right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Acceleration left, Acceleration right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Acceleration left, Acceleration right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -642,7 +631,7 @@ public int CompareTo(object obj) /// public int CompareTo(Acceleration other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -659,7 +648,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Acceleration other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -707,10 +696,8 @@ public bool Equals(Acceleration other, double tolerance, ComparisonType compa if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -730,17 +717,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(AccelerationUnit unit) + public T As(AccelerationUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -760,9 +747,14 @@ double IQuantity.As(Enum unit) if(!(unit is AccelerationUnit unitAsAccelerationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AccelerationUnit)} is supported.", nameof(unit)); - return As(unitAsAccelerationUnit); + var asValue = As(unitAsAccelerationUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(AccelerationUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -803,31 +795,37 @@ public Acceleration ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(AccelerationUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(AccelerationUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case AccelerationUnit.CentimeterPerSecondSquared: return (_value) * 1e-2d; - case AccelerationUnit.DecimeterPerSecondSquared: return (_value) * 1e-1d; - case AccelerationUnit.FootPerSecondSquared: return _value*0.304800; - case AccelerationUnit.InchPerSecondSquared: return _value*0.0254; - case AccelerationUnit.KilometerPerSecondSquared: return (_value) * 1e3d; - case AccelerationUnit.KnotPerHour: return _value*0.5144444444444/3600; - case AccelerationUnit.KnotPerMinute: return _value*0.5144444444444/60; - case AccelerationUnit.KnotPerSecond: return _value*0.5144444444444; - case AccelerationUnit.MeterPerSecondSquared: return _value; - case AccelerationUnit.MicrometerPerSecondSquared: return (_value) * 1e-6d; - case AccelerationUnit.MillimeterPerSecondSquared: return (_value) * 1e-3d; - case AccelerationUnit.NanometerPerSecondSquared: return (_value) * 1e-9d; - case AccelerationUnit.StandardGravity: return _value*9.80665; + case AccelerationUnit.CentimeterPerSecondSquared: return (Value) * 1e-2d; + case AccelerationUnit.DecimeterPerSecondSquared: return (Value) * 1e-1d; + case AccelerationUnit.FootPerSecondSquared: return Value*0.304800; + case AccelerationUnit.InchPerSecondSquared: return Value*0.0254; + case AccelerationUnit.KilometerPerSecondSquared: return (Value) * 1e3d; + case AccelerationUnit.KnotPerHour: return Value*0.5144444444444/3600; + case AccelerationUnit.KnotPerMinute: return Value*0.5144444444444/60; + case AccelerationUnit.KnotPerSecond: return Value*0.5144444444444; + case AccelerationUnit.MeterPerSecondSquared: return Value; + case AccelerationUnit.MicrometerPerSecondSquared: return (Value) * 1e-6d; + case AccelerationUnit.MillimeterPerSecondSquared: return (Value) * 1e-3d; + case AccelerationUnit.NanometerPerSecondSquared: return (Value) * 1e-9d; + case AccelerationUnit.StandardGravity: return Value*9.80665; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -844,10 +842,10 @@ internal Acceleration ToBaseUnit() return new Acceleration(baseUnitValue, BaseUnit); } - private double GetValueAs(AccelerationUnit unit) + private T GetValueAs(AccelerationUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -967,7 +965,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -982,37 +980,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1036,17 +1034,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs index 8045e0a565..fe205e4b69 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Mole is the amount of substance containing Avagadro's Number (6.02 x 10 ^ 23) of real particles such as molecules,atoms, ions or radicals. /// - public partial struct AmountOfSubstance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct AmountOfSubstance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -75,12 +70,12 @@ static AmountOfSubstance() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public AmountOfSubstance(double value, AmountOfSubstanceUnit unit) + public AmountOfSubstance(T value, AmountOfSubstanceUnit unit) { if(unit == AmountOfSubstanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -92,14 +87,14 @@ public AmountOfSubstance(double value, AmountOfSubstanceUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public AmountOfSubstance(double value, UnitSystem unitSystem) + public AmountOfSubstance(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -141,7 +136,7 @@ public AmountOfSubstance(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Mole. /// - public static AmountOfSubstance Zero { get; } = new AmountOfSubstance(0, BaseUnit); + public static AmountOfSubstance Zero { get; } = new AmountOfSubstance((T)0, BaseUnit); #endregion @@ -150,7 +145,9 @@ public AmountOfSubstance(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -180,77 +177,77 @@ public AmountOfSubstance(double value, UnitSystem unitSystem) /// /// Get in Centimoles. /// - public double Centimoles => As(AmountOfSubstanceUnit.Centimole); + public T Centimoles => As(AmountOfSubstanceUnit.Centimole); /// /// Get in CentipoundMoles. /// - public double CentipoundMoles => As(AmountOfSubstanceUnit.CentipoundMole); + public T CentipoundMoles => As(AmountOfSubstanceUnit.CentipoundMole); /// /// Get in Decimoles. /// - public double Decimoles => As(AmountOfSubstanceUnit.Decimole); + public T Decimoles => As(AmountOfSubstanceUnit.Decimole); /// /// Get in DecipoundMoles. /// - public double DecipoundMoles => As(AmountOfSubstanceUnit.DecipoundMole); + public T DecipoundMoles => As(AmountOfSubstanceUnit.DecipoundMole); /// /// Get in Kilomoles. /// - public double Kilomoles => As(AmountOfSubstanceUnit.Kilomole); + public T Kilomoles => As(AmountOfSubstanceUnit.Kilomole); /// /// Get in KilopoundMoles. /// - public double KilopoundMoles => As(AmountOfSubstanceUnit.KilopoundMole); + public T KilopoundMoles => As(AmountOfSubstanceUnit.KilopoundMole); /// /// Get in Megamoles. /// - public double Megamoles => As(AmountOfSubstanceUnit.Megamole); + public T Megamoles => As(AmountOfSubstanceUnit.Megamole); /// /// Get in Micromoles. /// - public double Micromoles => As(AmountOfSubstanceUnit.Micromole); + public T Micromoles => As(AmountOfSubstanceUnit.Micromole); /// /// Get in MicropoundMoles. /// - public double MicropoundMoles => As(AmountOfSubstanceUnit.MicropoundMole); + public T MicropoundMoles => As(AmountOfSubstanceUnit.MicropoundMole); /// /// Get in Millimoles. /// - public double Millimoles => As(AmountOfSubstanceUnit.Millimole); + public T Millimoles => As(AmountOfSubstanceUnit.Millimole); /// /// Get in MillipoundMoles. /// - public double MillipoundMoles => As(AmountOfSubstanceUnit.MillipoundMole); + public T MillipoundMoles => As(AmountOfSubstanceUnit.MillipoundMole); /// /// Get in Moles. /// - public double Moles => As(AmountOfSubstanceUnit.Mole); + public T Moles => As(AmountOfSubstanceUnit.Mole); /// /// Get in Nanomoles. /// - public double Nanomoles => As(AmountOfSubstanceUnit.Nanomole); + public T Nanomoles => As(AmountOfSubstanceUnit.Nanomole); /// /// Get in NanopoundMoles. /// - public double NanopoundMoles => As(AmountOfSubstanceUnit.NanopoundMole); + public T NanopoundMoles => As(AmountOfSubstanceUnit.NanopoundMole); /// /// Get in PoundMoles. /// - public double PoundMoles => As(AmountOfSubstanceUnit.PoundMole); + public T PoundMoles => As(AmountOfSubstanceUnit.PoundMole); #endregion @@ -285,136 +282,121 @@ public static string GetAbbreviation(AmountOfSubstanceUnit unit, [CanBeNull] IFo /// Get from Centimoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromCentimoles(QuantityValue centimoles) + public static AmountOfSubstance FromCentimoles(T centimoles) { - double value = (double) centimoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Centimole); + return new AmountOfSubstance(centimoles, AmountOfSubstanceUnit.Centimole); } /// /// Get from CentipoundMoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromCentipoundMoles(QuantityValue centipoundmoles) + public static AmountOfSubstance FromCentipoundMoles(T centipoundmoles) { - double value = (double) centipoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.CentipoundMole); + return new AmountOfSubstance(centipoundmoles, AmountOfSubstanceUnit.CentipoundMole); } /// /// Get from Decimoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromDecimoles(QuantityValue decimoles) + public static AmountOfSubstance FromDecimoles(T decimoles) { - double value = (double) decimoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Decimole); + return new AmountOfSubstance(decimoles, AmountOfSubstanceUnit.Decimole); } /// /// Get from DecipoundMoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromDecipoundMoles(QuantityValue decipoundmoles) + public static AmountOfSubstance FromDecipoundMoles(T decipoundmoles) { - double value = (double) decipoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.DecipoundMole); + return new AmountOfSubstance(decipoundmoles, AmountOfSubstanceUnit.DecipoundMole); } /// /// Get from Kilomoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromKilomoles(QuantityValue kilomoles) + public static AmountOfSubstance FromKilomoles(T kilomoles) { - double value = (double) kilomoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Kilomole); + return new AmountOfSubstance(kilomoles, AmountOfSubstanceUnit.Kilomole); } /// /// Get from KilopoundMoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromKilopoundMoles(QuantityValue kilopoundmoles) + public static AmountOfSubstance FromKilopoundMoles(T kilopoundmoles) { - double value = (double) kilopoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.KilopoundMole); + return new AmountOfSubstance(kilopoundmoles, AmountOfSubstanceUnit.KilopoundMole); } /// /// Get from Megamoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromMegamoles(QuantityValue megamoles) + public static AmountOfSubstance FromMegamoles(T megamoles) { - double value = (double) megamoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Megamole); + return new AmountOfSubstance(megamoles, AmountOfSubstanceUnit.Megamole); } /// /// Get from Micromoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromMicromoles(QuantityValue micromoles) + public static AmountOfSubstance FromMicromoles(T micromoles) { - double value = (double) micromoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Micromole); + return new AmountOfSubstance(micromoles, AmountOfSubstanceUnit.Micromole); } /// /// Get from MicropoundMoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromMicropoundMoles(QuantityValue micropoundmoles) + public static AmountOfSubstance FromMicropoundMoles(T micropoundmoles) { - double value = (double) micropoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.MicropoundMole); + return new AmountOfSubstance(micropoundmoles, AmountOfSubstanceUnit.MicropoundMole); } /// /// Get from Millimoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromMillimoles(QuantityValue millimoles) + public static AmountOfSubstance FromMillimoles(T millimoles) { - double value = (double) millimoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Millimole); + return new AmountOfSubstance(millimoles, AmountOfSubstanceUnit.Millimole); } /// /// Get from MillipoundMoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromMillipoundMoles(QuantityValue millipoundmoles) + public static AmountOfSubstance FromMillipoundMoles(T millipoundmoles) { - double value = (double) millipoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.MillipoundMole); + return new AmountOfSubstance(millipoundmoles, AmountOfSubstanceUnit.MillipoundMole); } /// /// Get from Moles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromMoles(QuantityValue moles) + public static AmountOfSubstance FromMoles(T moles) { - double value = (double) moles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Mole); + return new AmountOfSubstance(moles, AmountOfSubstanceUnit.Mole); } /// /// Get from Nanomoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromNanomoles(QuantityValue nanomoles) + public static AmountOfSubstance FromNanomoles(T nanomoles) { - double value = (double) nanomoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Nanomole); + return new AmountOfSubstance(nanomoles, AmountOfSubstanceUnit.Nanomole); } /// /// Get from NanopoundMoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromNanopoundMoles(QuantityValue nanopoundmoles) + public static AmountOfSubstance FromNanopoundMoles(T nanopoundmoles) { - double value = (double) nanopoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.NanopoundMole); + return new AmountOfSubstance(nanopoundmoles, AmountOfSubstanceUnit.NanopoundMole); } /// /// Get from PoundMoles. /// /// If value is NaN or Infinity. - public static AmountOfSubstance FromPoundMoles(QuantityValue poundmoles) + public static AmountOfSubstance FromPoundMoles(T poundmoles) { - double value = (double) poundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.PoundMole); + return new AmountOfSubstance(poundmoles, AmountOfSubstanceUnit.PoundMole); } /// @@ -423,9 +405,9 @@ public static AmountOfSubstance FromPoundMoles(QuantityValue poundmoles) /// Value to convert from. /// Unit to convert from. /// unit value. - public static AmountOfSubstance From(QuantityValue value, AmountOfSubstanceUnit fromUnit) + public static AmountOfSubstance From(T value, AmountOfSubstanceUnit fromUnit) { - return new AmountOfSubstance((double)value, fromUnit); + return new AmountOfSubstance(value, fromUnit); } #endregion @@ -579,43 +561,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amount /// Negate the value. public static AmountOfSubstance operator -(AmountOfSubstance right) { - return new AmountOfSubstance(-right.Value, right.Unit); + return new AmountOfSubstance(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static AmountOfSubstance operator +(AmountOfSubstance left, AmountOfSubstance right) { - return new AmountOfSubstance(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new AmountOfSubstance(value, left.Unit); } /// Get from subtracting two . public static AmountOfSubstance operator -(AmountOfSubstance left, AmountOfSubstance right) { - return new AmountOfSubstance(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new AmountOfSubstance(value, left.Unit); } /// Get from multiplying value and . - public static AmountOfSubstance operator *(double left, AmountOfSubstance right) + public static AmountOfSubstance operator *(T left, AmountOfSubstance right) { - return new AmountOfSubstance(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new AmountOfSubstance(value, right.Unit); } /// Get from multiplying value and . - public static AmountOfSubstance operator *(AmountOfSubstance left, double right) + public static AmountOfSubstance operator *(AmountOfSubstance left, T right) { - return new AmountOfSubstance(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new AmountOfSubstance(value, left.Unit); } /// Get from dividing by value. - public static AmountOfSubstance operator /(AmountOfSubstance left, double right) + public static AmountOfSubstance operator /(AmountOfSubstance left, T right) { - return new AmountOfSubstance(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new AmountOfSubstance(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(AmountOfSubstance left, AmountOfSubstance right) + public static T operator /(AmountOfSubstance left, AmountOfSubstance right) { - return left.Moles / right.Moles; + return CompiledLambdas.Divide(left.Moles, right.Moles); } #endregion @@ -625,25 +612,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amount /// Returns true if less or equal to. public static bool operator <=(AmountOfSubstance left, AmountOfSubstance right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(AmountOfSubstance left, AmountOfSubstance right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(AmountOfSubstance left, AmountOfSubstance right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(AmountOfSubstance left, AmountOfSubstance right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -672,7 +659,7 @@ public int CompareTo(object obj) /// public int CompareTo(AmountOfSubstance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -689,7 +676,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(AmountOfSubstance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -737,10 +724,8 @@ public bool Equals(AmountOfSubstance other, double tolerance, ComparisonType if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -760,17 +745,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(AmountOfSubstanceUnit unit) + public T As(AmountOfSubstanceUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -790,9 +775,14 @@ double IQuantity.As(Enum unit) if(!(unit is AmountOfSubstanceUnit unitAsAmountOfSubstanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AmountOfSubstanceUnit)} is supported.", nameof(unit)); - return As(unitAsAmountOfSubstanceUnit); + var asValue = As(unitAsAmountOfSubstanceUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(AmountOfSubstanceUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -833,33 +823,39 @@ public AmountOfSubstance ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(AmountOfSubstanceUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(AmountOfSubstanceUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case AmountOfSubstanceUnit.Centimole: return (_value) * 1e-2d; - case AmountOfSubstanceUnit.CentipoundMole: return (_value*453.59237) * 1e-2d; - case AmountOfSubstanceUnit.Decimole: return (_value) * 1e-1d; - case AmountOfSubstanceUnit.DecipoundMole: return (_value*453.59237) * 1e-1d; - case AmountOfSubstanceUnit.Kilomole: return (_value) * 1e3d; - case AmountOfSubstanceUnit.KilopoundMole: return (_value*453.59237) * 1e3d; - case AmountOfSubstanceUnit.Megamole: return (_value) * 1e6d; - case AmountOfSubstanceUnit.Micromole: return (_value) * 1e-6d; - case AmountOfSubstanceUnit.MicropoundMole: return (_value*453.59237) * 1e-6d; - case AmountOfSubstanceUnit.Millimole: return (_value) * 1e-3d; - case AmountOfSubstanceUnit.MillipoundMole: return (_value*453.59237) * 1e-3d; - case AmountOfSubstanceUnit.Mole: return _value; - case AmountOfSubstanceUnit.Nanomole: return (_value) * 1e-9d; - case AmountOfSubstanceUnit.NanopoundMole: return (_value*453.59237) * 1e-9d; - case AmountOfSubstanceUnit.PoundMole: return _value*453.59237; + case AmountOfSubstanceUnit.Centimole: return (Value) * 1e-2d; + case AmountOfSubstanceUnit.CentipoundMole: return (Value*453.59237) * 1e-2d; + case AmountOfSubstanceUnit.Decimole: return (Value) * 1e-1d; + case AmountOfSubstanceUnit.DecipoundMole: return (Value*453.59237) * 1e-1d; + case AmountOfSubstanceUnit.Kilomole: return (Value) * 1e3d; + case AmountOfSubstanceUnit.KilopoundMole: return (Value*453.59237) * 1e3d; + case AmountOfSubstanceUnit.Megamole: return (Value) * 1e6d; + case AmountOfSubstanceUnit.Micromole: return (Value) * 1e-6d; + case AmountOfSubstanceUnit.MicropoundMole: return (Value*453.59237) * 1e-6d; + case AmountOfSubstanceUnit.Millimole: return (Value) * 1e-3d; + case AmountOfSubstanceUnit.MillipoundMole: return (Value*453.59237) * 1e-3d; + case AmountOfSubstanceUnit.Mole: return Value; + case AmountOfSubstanceUnit.Nanomole: return (Value) * 1e-9d; + case AmountOfSubstanceUnit.NanopoundMole: return (Value*453.59237) * 1e-9d; + case AmountOfSubstanceUnit.PoundMole: return Value*453.59237; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -876,10 +872,10 @@ internal AmountOfSubstance ToBaseUnit() return new AmountOfSubstance(baseUnitValue, BaseUnit); } - private double GetValueAs(AmountOfSubstanceUnit unit) + private T GetValueAs(AmountOfSubstanceUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1001,7 +997,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1016,37 +1012,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1070,17 +1066,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs index b10dddde83..89d228b92e 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// The strength of a signal expressed in decibels (dB) relative to one volt RMS. /// - public partial struct AmplitudeRatio : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct AmplitudeRatio : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -64,12 +59,12 @@ static AmplitudeRatio() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public AmplitudeRatio(double value, AmplitudeRatioUnit unit) + public AmplitudeRatio(T value, AmplitudeRatioUnit unit) { if(unit == AmplitudeRatioUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -81,14 +76,14 @@ public AmplitudeRatio(double value, AmplitudeRatioUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public AmplitudeRatio(double value, UnitSystem unitSystem) + public AmplitudeRatio(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -130,7 +125,7 @@ public AmplitudeRatio(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit DecibelVolt. /// - public static AmplitudeRatio Zero { get; } = new AmplitudeRatio(0, BaseUnit); + public static AmplitudeRatio Zero { get; } = new AmplitudeRatio((T)0, BaseUnit); #endregion @@ -139,7 +134,9 @@ public AmplitudeRatio(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -169,22 +166,22 @@ public AmplitudeRatio(double value, UnitSystem unitSystem) /// /// Get in DecibelMicrovolts. /// - public double DecibelMicrovolts => As(AmplitudeRatioUnit.DecibelMicrovolt); + public T DecibelMicrovolts => As(AmplitudeRatioUnit.DecibelMicrovolt); /// /// Get in DecibelMillivolts. /// - public double DecibelMillivolts => As(AmplitudeRatioUnit.DecibelMillivolt); + public T DecibelMillivolts => As(AmplitudeRatioUnit.DecibelMillivolt); /// /// Get in DecibelsUnloaded. /// - public double DecibelsUnloaded => As(AmplitudeRatioUnit.DecibelUnloaded); + public T DecibelsUnloaded => As(AmplitudeRatioUnit.DecibelUnloaded); /// /// Get in DecibelVolts. /// - public double DecibelVolts => As(AmplitudeRatioUnit.DecibelVolt); + public T DecibelVolts => As(AmplitudeRatioUnit.DecibelVolt); #endregion @@ -219,37 +216,33 @@ public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] IForma /// Get from DecibelMicrovolts. /// /// If value is NaN or Infinity. - public static AmplitudeRatio FromDecibelMicrovolts(QuantityValue decibelmicrovolts) + public static AmplitudeRatio FromDecibelMicrovolts(T decibelmicrovolts) { - double value = (double) decibelmicrovolts; - return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelMicrovolt); + return new AmplitudeRatio(decibelmicrovolts, AmplitudeRatioUnit.DecibelMicrovolt); } /// /// Get from DecibelMillivolts. /// /// If value is NaN or Infinity. - public static AmplitudeRatio FromDecibelMillivolts(QuantityValue decibelmillivolts) + public static AmplitudeRatio FromDecibelMillivolts(T decibelmillivolts) { - double value = (double) decibelmillivolts; - return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelMillivolt); + return new AmplitudeRatio(decibelmillivolts, AmplitudeRatioUnit.DecibelMillivolt); } /// /// Get from DecibelsUnloaded. /// /// If value is NaN or Infinity. - public static AmplitudeRatio FromDecibelsUnloaded(QuantityValue decibelsunloaded) + public static AmplitudeRatio FromDecibelsUnloaded(T decibelsunloaded) { - double value = (double) decibelsunloaded; - return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelUnloaded); + return new AmplitudeRatio(decibelsunloaded, AmplitudeRatioUnit.DecibelUnloaded); } /// /// Get from DecibelVolts. /// /// If value is NaN or Infinity. - public static AmplitudeRatio FromDecibelVolts(QuantityValue decibelvolts) + public static AmplitudeRatio FromDecibelVolts(T decibelvolts) { - double value = (double) decibelvolts; - return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelVolt); + return new AmplitudeRatio(decibelvolts, AmplitudeRatioUnit.DecibelVolt); } /// @@ -258,9 +251,9 @@ public static AmplitudeRatio FromDecibelVolts(QuantityValue decibelvolts) /// Value to convert from. /// Unit to convert from. /// unit value. - public static AmplitudeRatio From(QuantityValue value, AmplitudeRatioUnit fromUnit) + public static AmplitudeRatio From(T value, AmplitudeRatioUnit fromUnit) { - return new AmplitudeRatio((double)value, fromUnit); + return new AmplitudeRatio(value, fromUnit); } #endregion @@ -468,25 +461,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amplit /// Returns true if less or equal to. public static bool operator <=(AmplitudeRatio left, AmplitudeRatio right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(AmplitudeRatio left, AmplitudeRatio right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(AmplitudeRatio left, AmplitudeRatio right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(AmplitudeRatio left, AmplitudeRatio right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -515,7 +508,7 @@ public int CompareTo(object obj) /// public int CompareTo(AmplitudeRatio other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -532,7 +525,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(AmplitudeRatio other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -580,10 +573,8 @@ public bool Equals(AmplitudeRatio other, double tolerance, ComparisonType com if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -603,17 +594,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(AmplitudeRatioUnit unit) + public T As(AmplitudeRatioUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -633,9 +624,14 @@ double IQuantity.As(Enum unit) if(!(unit is AmplitudeRatioUnit unitAsAmplitudeRatioUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AmplitudeRatioUnit)} is supported.", nameof(unit)); - return As(unitAsAmplitudeRatioUnit); + var asValue = As(unitAsAmplitudeRatioUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(AmplitudeRatioUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -676,22 +672,28 @@ public AmplitudeRatio ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(AmplitudeRatioUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(AmplitudeRatioUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case AmplitudeRatioUnit.DecibelMicrovolt: return _value - 120; - case AmplitudeRatioUnit.DecibelMillivolt: return _value - 60; - case AmplitudeRatioUnit.DecibelUnloaded: return _value - 2.218487499; - case AmplitudeRatioUnit.DecibelVolt: return _value; + case AmplitudeRatioUnit.DecibelMicrovolt: return Value - 120; + case AmplitudeRatioUnit.DecibelMillivolt: return Value - 60; + case AmplitudeRatioUnit.DecibelUnloaded: return Value - 2.218487499; + case AmplitudeRatioUnit.DecibelVolt: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -708,10 +710,10 @@ internal AmplitudeRatio ToBaseUnit() return new AmplitudeRatio(baseUnitValue, BaseUnit); } - private double GetValueAs(AmplitudeRatioUnit unit) + private T GetValueAs(AmplitudeRatioUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -822,7 +824,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -837,37 +839,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -891,17 +893,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs index 17cf7aecfa..9cf7534e8c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// In geometry, an angle is the figure formed by two rays, called the sides of the angle, sharing a common endpoint, called the vertex of the angle. /// - public partial struct Angle : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Angle : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -74,12 +69,12 @@ static Angle() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Angle(double value, AngleUnit unit) + public Angle(T value, AngleUnit unit) { if(unit == AngleUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -91,14 +86,14 @@ public Angle(double value, AngleUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Angle(double value, UnitSystem unitSystem) + public Angle(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -140,7 +135,7 @@ public Angle(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Degree. /// - public static Angle Zero { get; } = new Angle(0, BaseUnit); + public static Angle Zero { get; } = new Angle((T)0, BaseUnit); #endregion @@ -149,7 +144,9 @@ public Angle(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -179,72 +176,72 @@ public Angle(double value, UnitSystem unitSystem) /// /// Get in Arcminutes. /// - public double Arcminutes => As(AngleUnit.Arcminute); + public T Arcminutes => As(AngleUnit.Arcminute); /// /// Get in Arcseconds. /// - public double Arcseconds => As(AngleUnit.Arcsecond); + public T Arcseconds => As(AngleUnit.Arcsecond); /// /// Get in Centiradians. /// - public double Centiradians => As(AngleUnit.Centiradian); + public T Centiradians => As(AngleUnit.Centiradian); /// /// Get in Deciradians. /// - public double Deciradians => As(AngleUnit.Deciradian); + public T Deciradians => As(AngleUnit.Deciradian); /// /// Get in Degrees. /// - public double Degrees => As(AngleUnit.Degree); + public T Degrees => As(AngleUnit.Degree); /// /// Get in Gradians. /// - public double Gradians => As(AngleUnit.Gradian); + public T Gradians => As(AngleUnit.Gradian); /// /// Get in Microdegrees. /// - public double Microdegrees => As(AngleUnit.Microdegree); + public T Microdegrees => As(AngleUnit.Microdegree); /// /// Get in Microradians. /// - public double Microradians => As(AngleUnit.Microradian); + public T Microradians => As(AngleUnit.Microradian); /// /// Get in Millidegrees. /// - public double Millidegrees => As(AngleUnit.Millidegree); + public T Millidegrees => As(AngleUnit.Millidegree); /// /// Get in Milliradians. /// - public double Milliradians => As(AngleUnit.Milliradian); + public T Milliradians => As(AngleUnit.Milliradian); /// /// Get in Nanodegrees. /// - public double Nanodegrees => As(AngleUnit.Nanodegree); + public T Nanodegrees => As(AngleUnit.Nanodegree); /// /// Get in Nanoradians. /// - public double Nanoradians => As(AngleUnit.Nanoradian); + public T Nanoradians => As(AngleUnit.Nanoradian); /// /// Get in Radians. /// - public double Radians => As(AngleUnit.Radian); + public T Radians => As(AngleUnit.Radian); /// /// Get in Revolutions. /// - public double Revolutions => As(AngleUnit.Revolution); + public T Revolutions => As(AngleUnit.Revolution); #endregion @@ -279,127 +276,113 @@ public static string GetAbbreviation(AngleUnit unit, [CanBeNull] IFormatProvider /// Get from Arcminutes. /// /// If value is NaN or Infinity. - public static Angle FromArcminutes(QuantityValue arcminutes) + public static Angle FromArcminutes(T arcminutes) { - double value = (double) arcminutes; - return new Angle(value, AngleUnit.Arcminute); + return new Angle(arcminutes, AngleUnit.Arcminute); } /// /// Get from Arcseconds. /// /// If value is NaN or Infinity. - public static Angle FromArcseconds(QuantityValue arcseconds) + public static Angle FromArcseconds(T arcseconds) { - double value = (double) arcseconds; - return new Angle(value, AngleUnit.Arcsecond); + return new Angle(arcseconds, AngleUnit.Arcsecond); } /// /// Get from Centiradians. /// /// If value is NaN or Infinity. - public static Angle FromCentiradians(QuantityValue centiradians) + public static Angle FromCentiradians(T centiradians) { - double value = (double) centiradians; - return new Angle(value, AngleUnit.Centiradian); + return new Angle(centiradians, AngleUnit.Centiradian); } /// /// Get from Deciradians. /// /// If value is NaN or Infinity. - public static Angle FromDeciradians(QuantityValue deciradians) + public static Angle FromDeciradians(T deciradians) { - double value = (double) deciradians; - return new Angle(value, AngleUnit.Deciradian); + return new Angle(deciradians, AngleUnit.Deciradian); } /// /// Get from Degrees. /// /// If value is NaN or Infinity. - public static Angle FromDegrees(QuantityValue degrees) + public static Angle FromDegrees(T degrees) { - double value = (double) degrees; - return new Angle(value, AngleUnit.Degree); + return new Angle(degrees, AngleUnit.Degree); } /// /// Get from Gradians. /// /// If value is NaN or Infinity. - public static Angle FromGradians(QuantityValue gradians) + public static Angle FromGradians(T gradians) { - double value = (double) gradians; - return new Angle(value, AngleUnit.Gradian); + return new Angle(gradians, AngleUnit.Gradian); } /// /// Get from Microdegrees. /// /// If value is NaN or Infinity. - public static Angle FromMicrodegrees(QuantityValue microdegrees) + public static Angle FromMicrodegrees(T microdegrees) { - double value = (double) microdegrees; - return new Angle(value, AngleUnit.Microdegree); + return new Angle(microdegrees, AngleUnit.Microdegree); } /// /// Get from Microradians. /// /// If value is NaN or Infinity. - public static Angle FromMicroradians(QuantityValue microradians) + public static Angle FromMicroradians(T microradians) { - double value = (double) microradians; - return new Angle(value, AngleUnit.Microradian); + return new Angle(microradians, AngleUnit.Microradian); } /// /// Get from Millidegrees. /// /// If value is NaN or Infinity. - public static Angle FromMillidegrees(QuantityValue millidegrees) + public static Angle FromMillidegrees(T millidegrees) { - double value = (double) millidegrees; - return new Angle(value, AngleUnit.Millidegree); + return new Angle(millidegrees, AngleUnit.Millidegree); } /// /// Get from Milliradians. /// /// If value is NaN or Infinity. - public static Angle FromMilliradians(QuantityValue milliradians) + public static Angle FromMilliradians(T milliradians) { - double value = (double) milliradians; - return new Angle(value, AngleUnit.Milliradian); + return new Angle(milliradians, AngleUnit.Milliradian); } /// /// Get from Nanodegrees. /// /// If value is NaN or Infinity. - public static Angle FromNanodegrees(QuantityValue nanodegrees) + public static Angle FromNanodegrees(T nanodegrees) { - double value = (double) nanodegrees; - return new Angle(value, AngleUnit.Nanodegree); + return new Angle(nanodegrees, AngleUnit.Nanodegree); } /// /// Get from Nanoradians. /// /// If value is NaN or Infinity. - public static Angle FromNanoradians(QuantityValue nanoradians) + public static Angle FromNanoradians(T nanoradians) { - double value = (double) nanoradians; - return new Angle(value, AngleUnit.Nanoradian); + return new Angle(nanoradians, AngleUnit.Nanoradian); } /// /// Get from Radians. /// /// If value is NaN or Infinity. - public static Angle FromRadians(QuantityValue radians) + public static Angle FromRadians(T radians) { - double value = (double) radians; - return new Angle(value, AngleUnit.Radian); + return new Angle(radians, AngleUnit.Radian); } /// /// Get from Revolutions. /// /// If value is NaN or Infinity. - public static Angle FromRevolutions(QuantityValue revolutions) + public static Angle FromRevolutions(T revolutions) { - double value = (double) revolutions; - return new Angle(value, AngleUnit.Revolution); + return new Angle(revolutions, AngleUnit.Revolution); } /// @@ -408,9 +391,9 @@ public static Angle FromRevolutions(QuantityValue revolutions) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Angle From(QuantityValue value, AngleUnit fromUnit) + public static Angle From(T value, AngleUnit fromUnit) { - return new Angle((double)value, fromUnit); + return new Angle(value, fromUnit); } #endregion @@ -564,43 +547,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AngleU /// Negate the value. public static Angle operator -(Angle right) { - return new Angle(-right.Value, right.Unit); + return new Angle(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Angle operator +(Angle left, Angle right) { - return new Angle(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Angle(value, left.Unit); } /// Get from subtracting two . public static Angle operator -(Angle left, Angle right) { - return new Angle(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Angle(value, left.Unit); } /// Get from multiplying value and . - public static Angle operator *(double left, Angle right) + public static Angle operator *(T left, Angle right) { - return new Angle(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Angle(value, right.Unit); } /// Get from multiplying value and . - public static Angle operator *(Angle left, double right) + public static Angle operator *(Angle left, T right) { - return new Angle(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Angle(value, left.Unit); } /// Get from dividing by value. - public static Angle operator /(Angle left, double right) + public static Angle operator /(Angle left, T right) { - return new Angle(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Angle(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Angle left, Angle right) + public static T operator /(Angle left, Angle right) { - return left.Degrees / right.Degrees; + return CompiledLambdas.Divide(left.Degrees, right.Degrees); } #endregion @@ -610,25 +598,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AngleU /// Returns true if less or equal to. public static bool operator <=(Angle left, Angle right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Angle left, Angle right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Angle left, Angle right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Angle left, Angle right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -657,7 +645,7 @@ public int CompareTo(object obj) /// public int CompareTo(Angle other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -674,7 +662,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Angle other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -722,10 +710,8 @@ public bool Equals(Angle other, double tolerance, ComparisonType comparisonTy if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -745,17 +731,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(AngleUnit unit) + public T As(AngleUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -775,9 +761,14 @@ double IQuantity.As(Enum unit) if(!(unit is AngleUnit unitAsAngleUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AngleUnit)} is supported.", nameof(unit)); - return As(unitAsAngleUnit); + var asValue = As(unitAsAngleUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(AngleUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -818,32 +809,38 @@ public Angle ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(AngleUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(AngleUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case AngleUnit.Arcminute: return _value/60; - case AngleUnit.Arcsecond: return _value/3600; - case AngleUnit.Centiradian: return (_value*180/Math.PI) * 1e-2d; - case AngleUnit.Deciradian: return (_value*180/Math.PI) * 1e-1d; - case AngleUnit.Degree: return _value; - case AngleUnit.Gradian: return _value*0.9; - case AngleUnit.Microdegree: return (_value) * 1e-6d; - case AngleUnit.Microradian: return (_value*180/Math.PI) * 1e-6d; - case AngleUnit.Millidegree: return (_value) * 1e-3d; - case AngleUnit.Milliradian: return (_value*180/Math.PI) * 1e-3d; - case AngleUnit.Nanodegree: return (_value) * 1e-9d; - case AngleUnit.Nanoradian: return (_value*180/Math.PI) * 1e-9d; - case AngleUnit.Radian: return _value*180/Math.PI; - case AngleUnit.Revolution: return _value*360; + case AngleUnit.Arcminute: return Value/60; + case AngleUnit.Arcsecond: return Value/3600; + case AngleUnit.Centiradian: return (Value*180/Math.PI) * 1e-2d; + case AngleUnit.Deciradian: return (Value*180/Math.PI) * 1e-1d; + case AngleUnit.Degree: return Value; + case AngleUnit.Gradian: return Value*0.9; + case AngleUnit.Microdegree: return (Value) * 1e-6d; + case AngleUnit.Microradian: return (Value*180/Math.PI) * 1e-6d; + case AngleUnit.Millidegree: return (Value) * 1e-3d; + case AngleUnit.Milliradian: return (Value*180/Math.PI) * 1e-3d; + case AngleUnit.Nanodegree: return (Value) * 1e-9d; + case AngleUnit.Nanoradian: return (Value*180/Math.PI) * 1e-9d; + case AngleUnit.Radian: return Value*180/Math.PI; + case AngleUnit.Revolution: return Value*360; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -860,10 +857,10 @@ internal Angle ToBaseUnit() return new Angle(baseUnitValue, BaseUnit); } - private double GetValueAs(AngleUnit unit) + private T GetValueAs(AngleUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -984,7 +981,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -999,37 +996,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1053,17 +1050,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs index 4a3cca559b..1f3875bb29 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// A unit for expressing the integral of apparent power over time, equal to the product of 1 volt-ampere and 1 hour, or to 3600 joules. /// - public partial struct ApparentEnergy : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ApparentEnergy : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -63,12 +58,12 @@ static ApparentEnergy() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ApparentEnergy(double value, ApparentEnergyUnit unit) + public ApparentEnergy(T value, ApparentEnergyUnit unit) { if(unit == ApparentEnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -80,14 +75,14 @@ public ApparentEnergy(double value, ApparentEnergyUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ApparentEnergy(double value, UnitSystem unitSystem) + public ApparentEnergy(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -129,7 +124,7 @@ public ApparentEnergy(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereHour. /// - public static ApparentEnergy Zero { get; } = new ApparentEnergy(0, BaseUnit); + public static ApparentEnergy Zero { get; } = new ApparentEnergy((T)0, BaseUnit); #endregion @@ -138,7 +133,9 @@ public ApparentEnergy(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -168,17 +165,17 @@ public ApparentEnergy(double value, UnitSystem unitSystem) /// /// Get in KilovoltampereHours. /// - public double KilovoltampereHours => As(ApparentEnergyUnit.KilovoltampereHour); + public T KilovoltampereHours => As(ApparentEnergyUnit.KilovoltampereHour); /// /// Get in MegavoltampereHours. /// - public double MegavoltampereHours => As(ApparentEnergyUnit.MegavoltampereHour); + public T MegavoltampereHours => As(ApparentEnergyUnit.MegavoltampereHour); /// /// Get in VoltampereHours. /// - public double VoltampereHours => As(ApparentEnergyUnit.VoltampereHour); + public T VoltampereHours => As(ApparentEnergyUnit.VoltampereHour); #endregion @@ -213,28 +210,25 @@ public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] IForma /// Get from KilovoltampereHours. /// /// If value is NaN or Infinity. - public static ApparentEnergy FromKilovoltampereHours(QuantityValue kilovoltamperehours) + public static ApparentEnergy FromKilovoltampereHours(T kilovoltamperehours) { - double value = (double) kilovoltamperehours; - return new ApparentEnergy(value, ApparentEnergyUnit.KilovoltampereHour); + return new ApparentEnergy(kilovoltamperehours, ApparentEnergyUnit.KilovoltampereHour); } /// /// Get from MegavoltampereHours. /// /// If value is NaN or Infinity. - public static ApparentEnergy FromMegavoltampereHours(QuantityValue megavoltamperehours) + public static ApparentEnergy FromMegavoltampereHours(T megavoltamperehours) { - double value = (double) megavoltamperehours; - return new ApparentEnergy(value, ApparentEnergyUnit.MegavoltampereHour); + return new ApparentEnergy(megavoltamperehours, ApparentEnergyUnit.MegavoltampereHour); } /// /// Get from VoltampereHours. /// /// If value is NaN or Infinity. - public static ApparentEnergy FromVoltampereHours(QuantityValue voltamperehours) + public static ApparentEnergy FromVoltampereHours(T voltamperehours) { - double value = (double) voltamperehours; - return new ApparentEnergy(value, ApparentEnergyUnit.VoltampereHour); + return new ApparentEnergy(voltamperehours, ApparentEnergyUnit.VoltampereHour); } /// @@ -243,9 +237,9 @@ public static ApparentEnergy FromVoltampereHours(QuantityValue voltamperehour /// Value to convert from. /// Unit to convert from. /// unit value. - public static ApparentEnergy From(QuantityValue value, ApparentEnergyUnit fromUnit) + public static ApparentEnergy From(T value, ApparentEnergyUnit fromUnit) { - return new ApparentEnergy((double)value, fromUnit); + return new ApparentEnergy(value, fromUnit); } #endregion @@ -399,43 +393,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare /// Negate the value. public static ApparentEnergy operator -(ApparentEnergy right) { - return new ApparentEnergy(-right.Value, right.Unit); + return new ApparentEnergy(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ApparentEnergy operator +(ApparentEnergy left, ApparentEnergy right) { - return new ApparentEnergy(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ApparentEnergy(value, left.Unit); } /// Get from subtracting two . public static ApparentEnergy operator -(ApparentEnergy left, ApparentEnergy right) { - return new ApparentEnergy(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ApparentEnergy(value, left.Unit); } /// Get from multiplying value and . - public static ApparentEnergy operator *(double left, ApparentEnergy right) + public static ApparentEnergy operator *(T left, ApparentEnergy right) { - return new ApparentEnergy(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ApparentEnergy(value, right.Unit); } /// Get from multiplying value and . - public static ApparentEnergy operator *(ApparentEnergy left, double right) + public static ApparentEnergy operator *(ApparentEnergy left, T right) { - return new ApparentEnergy(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ApparentEnergy(value, left.Unit); } /// Get from dividing by value. - public static ApparentEnergy operator /(ApparentEnergy left, double right) + public static ApparentEnergy operator /(ApparentEnergy left, T right) { - return new ApparentEnergy(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ApparentEnergy(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ApparentEnergy left, ApparentEnergy right) + public static T operator /(ApparentEnergy left, ApparentEnergy right) { - return left.VoltampereHours / right.VoltampereHours; + return CompiledLambdas.Divide(left.VoltampereHours, right.VoltampereHours); } #endregion @@ -445,25 +444,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare /// Returns true if less or equal to. public static bool operator <=(ApparentEnergy left, ApparentEnergy right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ApparentEnergy left, ApparentEnergy right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ApparentEnergy left, ApparentEnergy right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ApparentEnergy left, ApparentEnergy right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -492,7 +491,7 @@ public int CompareTo(object obj) /// public int CompareTo(ApparentEnergy other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -509,7 +508,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ApparentEnergy other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -557,10 +556,8 @@ public bool Equals(ApparentEnergy other, double tolerance, ComparisonType com if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -580,17 +577,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ApparentEnergyUnit unit) + public T As(ApparentEnergyUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -610,9 +607,14 @@ double IQuantity.As(Enum unit) if(!(unit is ApparentEnergyUnit unitAsApparentEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ApparentEnergyUnit)} is supported.", nameof(unit)); - return As(unitAsApparentEnergyUnit); + var asValue = As(unitAsApparentEnergyUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ApparentEnergyUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -653,21 +655,27 @@ public ApparentEnergy ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ApparentEnergyUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ApparentEnergyUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ApparentEnergyUnit.KilovoltampereHour: return (_value) * 1e3d; - case ApparentEnergyUnit.MegavoltampereHour: return (_value) * 1e6d; - case ApparentEnergyUnit.VoltampereHour: return _value; + case ApparentEnergyUnit.KilovoltampereHour: return (Value) * 1e3d; + case ApparentEnergyUnit.MegavoltampereHour: return (Value) * 1e6d; + case ApparentEnergyUnit.VoltampereHour: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -684,10 +692,10 @@ internal ApparentEnergy ToBaseUnit() return new ApparentEnergy(baseUnitValue, BaseUnit); } - private double GetValueAs(ApparentEnergyUnit unit) + private T GetValueAs(ApparentEnergyUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -797,7 +805,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -812,37 +820,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -866,17 +874,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs index 0ebb0ec462..9c6b1ddd35 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Power engineers measure apparent power as the magnitude of the vector sum of active and reactive power. Apparent power is the product of the root-mean-square of voltage and current. /// - public partial struct ApparentPower : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ApparentPower : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -64,12 +59,12 @@ static ApparentPower() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ApparentPower(double value, ApparentPowerUnit unit) + public ApparentPower(T value, ApparentPowerUnit unit) { if(unit == ApparentPowerUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -81,14 +76,14 @@ public ApparentPower(double value, ApparentPowerUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ApparentPower(double value, UnitSystem unitSystem) + public ApparentPower(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -130,7 +125,7 @@ public ApparentPower(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Voltampere. /// - public static ApparentPower Zero { get; } = new ApparentPower(0, BaseUnit); + public static ApparentPower Zero { get; } = new ApparentPower((T)0, BaseUnit); #endregion @@ -139,7 +134,9 @@ public ApparentPower(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -169,22 +166,22 @@ public ApparentPower(double value, UnitSystem unitSystem) /// /// Get in Gigavoltamperes. /// - public double Gigavoltamperes => As(ApparentPowerUnit.Gigavoltampere); + public T Gigavoltamperes => As(ApparentPowerUnit.Gigavoltampere); /// /// Get in Kilovoltamperes. /// - public double Kilovoltamperes => As(ApparentPowerUnit.Kilovoltampere); + public T Kilovoltamperes => As(ApparentPowerUnit.Kilovoltampere); /// /// Get in Megavoltamperes. /// - public double Megavoltamperes => As(ApparentPowerUnit.Megavoltampere); + public T Megavoltamperes => As(ApparentPowerUnit.Megavoltampere); /// /// Get in Voltamperes. /// - public double Voltamperes => As(ApparentPowerUnit.Voltampere); + public T Voltamperes => As(ApparentPowerUnit.Voltampere); #endregion @@ -219,37 +216,33 @@ public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] IFormat /// Get from Gigavoltamperes. /// /// If value is NaN or Infinity. - public static ApparentPower FromGigavoltamperes(QuantityValue gigavoltamperes) + public static ApparentPower FromGigavoltamperes(T gigavoltamperes) { - double value = (double) gigavoltamperes; - return new ApparentPower(value, ApparentPowerUnit.Gigavoltampere); + return new ApparentPower(gigavoltamperes, ApparentPowerUnit.Gigavoltampere); } /// /// Get from Kilovoltamperes. /// /// If value is NaN or Infinity. - public static ApparentPower FromKilovoltamperes(QuantityValue kilovoltamperes) + public static ApparentPower FromKilovoltamperes(T kilovoltamperes) { - double value = (double) kilovoltamperes; - return new ApparentPower(value, ApparentPowerUnit.Kilovoltampere); + return new ApparentPower(kilovoltamperes, ApparentPowerUnit.Kilovoltampere); } /// /// Get from Megavoltamperes. /// /// If value is NaN or Infinity. - public static ApparentPower FromMegavoltamperes(QuantityValue megavoltamperes) + public static ApparentPower FromMegavoltamperes(T megavoltamperes) { - double value = (double) megavoltamperes; - return new ApparentPower(value, ApparentPowerUnit.Megavoltampere); + return new ApparentPower(megavoltamperes, ApparentPowerUnit.Megavoltampere); } /// /// Get from Voltamperes. /// /// If value is NaN or Infinity. - public static ApparentPower FromVoltamperes(QuantityValue voltamperes) + public static ApparentPower FromVoltamperes(T voltamperes) { - double value = (double) voltamperes; - return new ApparentPower(value, ApparentPowerUnit.Voltampere); + return new ApparentPower(voltamperes, ApparentPowerUnit.Voltampere); } /// @@ -258,9 +251,9 @@ public static ApparentPower FromVoltamperes(QuantityValue voltamperes) /// Value to convert from. /// Unit to convert from. /// unit value. - public static ApparentPower From(QuantityValue value, ApparentPowerUnit fromUnit) + public static ApparentPower From(T value, ApparentPowerUnit fromUnit) { - return new ApparentPower((double)value, fromUnit); + return new ApparentPower(value, fromUnit); } #endregion @@ -414,43 +407,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare /// Negate the value. public static ApparentPower operator -(ApparentPower right) { - return new ApparentPower(-right.Value, right.Unit); + return new ApparentPower(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ApparentPower operator +(ApparentPower left, ApparentPower right) { - return new ApparentPower(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ApparentPower(value, left.Unit); } /// Get from subtracting two . public static ApparentPower operator -(ApparentPower left, ApparentPower right) { - return new ApparentPower(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ApparentPower(value, left.Unit); } /// Get from multiplying value and . - public static ApparentPower operator *(double left, ApparentPower right) + public static ApparentPower operator *(T left, ApparentPower right) { - return new ApparentPower(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ApparentPower(value, right.Unit); } /// Get from multiplying value and . - public static ApparentPower operator *(ApparentPower left, double right) + public static ApparentPower operator *(ApparentPower left, T right) { - return new ApparentPower(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ApparentPower(value, left.Unit); } /// Get from dividing by value. - public static ApparentPower operator /(ApparentPower left, double right) + public static ApparentPower operator /(ApparentPower left, T right) { - return new ApparentPower(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ApparentPower(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ApparentPower left, ApparentPower right) + public static T operator /(ApparentPower left, ApparentPower right) { - return left.Voltamperes / right.Voltamperes; + return CompiledLambdas.Divide(left.Voltamperes, right.Voltamperes); } #endregion @@ -460,25 +458,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare /// Returns true if less or equal to. public static bool operator <=(ApparentPower left, ApparentPower right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ApparentPower left, ApparentPower right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ApparentPower left, ApparentPower right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ApparentPower left, ApparentPower right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -507,7 +505,7 @@ public int CompareTo(object obj) /// public int CompareTo(ApparentPower other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -524,7 +522,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ApparentPower other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -572,10 +570,8 @@ public bool Equals(ApparentPower other, double tolerance, ComparisonType comp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -595,17 +591,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ApparentPowerUnit unit) + public T As(ApparentPowerUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -625,9 +621,14 @@ double IQuantity.As(Enum unit) if(!(unit is ApparentPowerUnit unitAsApparentPowerUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ApparentPowerUnit)} is supported.", nameof(unit)); - return As(unitAsApparentPowerUnit); + var asValue = As(unitAsApparentPowerUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ApparentPowerUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -668,22 +669,28 @@ public ApparentPower ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ApparentPowerUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ApparentPowerUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ApparentPowerUnit.Gigavoltampere: return (_value) * 1e9d; - case ApparentPowerUnit.Kilovoltampere: return (_value) * 1e3d; - case ApparentPowerUnit.Megavoltampere: return (_value) * 1e6d; - case ApparentPowerUnit.Voltampere: return _value; + case ApparentPowerUnit.Gigavoltampere: return (Value) * 1e9d; + case ApparentPowerUnit.Kilovoltampere: return (Value) * 1e3d; + case ApparentPowerUnit.Megavoltampere: return (Value) * 1e6d; + case ApparentPowerUnit.Voltampere: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -700,10 +707,10 @@ internal ApparentPower ToBaseUnit() return new ApparentPower(baseUnitValue, BaseUnit); } - private double GetValueAs(ApparentPowerUnit unit) + private T GetValueAs(ApparentPowerUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -814,7 +821,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -829,37 +836,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -883,17 +890,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs index 7d58afb6be..37634a5cc5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Area is a quantity that expresses the extent of a two-dimensional surface or shape, or planar lamina, in the plane. Area can be understood as the amount of material with a given thickness that would be necessary to fashion a model of the shape, or the amount of paint necessary to cover the surface with a single coat.[1] It is the two-dimensional analog of the length of a curve (a one-dimensional concept) or the volume of a solid (a three-dimensional concept). /// - public partial struct Area : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Area : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -74,12 +69,12 @@ static Area() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Area(double value, AreaUnit unit) + public Area(T value, AreaUnit unit) { if(unit == AreaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -91,14 +86,14 @@ public Area(double value, AreaUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Area(double value, UnitSystem unitSystem) + public Area(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -140,7 +135,7 @@ public Area(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeter. /// - public static Area Zero { get; } = new Area(0, BaseUnit); + public static Area Zero { get; } = new Area((T)0, BaseUnit); #endregion @@ -149,7 +144,9 @@ public Area(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -179,72 +176,72 @@ public Area(double value, UnitSystem unitSystem) /// /// Get in Acres. /// - public double Acres => As(AreaUnit.Acre); + public T Acres => As(AreaUnit.Acre); /// /// Get in Hectares. /// - public double Hectares => As(AreaUnit.Hectare); + public T Hectares => As(AreaUnit.Hectare); /// /// Get in SquareCentimeters. /// - public double SquareCentimeters => As(AreaUnit.SquareCentimeter); + public T SquareCentimeters => As(AreaUnit.SquareCentimeter); /// /// Get in SquareDecimeters. /// - public double SquareDecimeters => As(AreaUnit.SquareDecimeter); + public T SquareDecimeters => As(AreaUnit.SquareDecimeter); /// /// Get in SquareFeet. /// - public double SquareFeet => As(AreaUnit.SquareFoot); + public T SquareFeet => As(AreaUnit.SquareFoot); /// /// Get in SquareInches. /// - public double SquareInches => As(AreaUnit.SquareInch); + public T SquareInches => As(AreaUnit.SquareInch); /// /// Get in SquareKilometers. /// - public double SquareKilometers => As(AreaUnit.SquareKilometer); + public T SquareKilometers => As(AreaUnit.SquareKilometer); /// /// Get in SquareMeters. /// - public double SquareMeters => As(AreaUnit.SquareMeter); + public T SquareMeters => As(AreaUnit.SquareMeter); /// /// Get in SquareMicrometers. /// - public double SquareMicrometers => As(AreaUnit.SquareMicrometer); + public T SquareMicrometers => As(AreaUnit.SquareMicrometer); /// /// Get in SquareMiles. /// - public double SquareMiles => As(AreaUnit.SquareMile); + public T SquareMiles => As(AreaUnit.SquareMile); /// /// Get in SquareMillimeters. /// - public double SquareMillimeters => As(AreaUnit.SquareMillimeter); + public T SquareMillimeters => As(AreaUnit.SquareMillimeter); /// /// Get in SquareNauticalMiles. /// - public double SquareNauticalMiles => As(AreaUnit.SquareNauticalMile); + public T SquareNauticalMiles => As(AreaUnit.SquareNauticalMile); /// /// Get in SquareYards. /// - public double SquareYards => As(AreaUnit.SquareYard); + public T SquareYards => As(AreaUnit.SquareYard); /// /// Get in UsSurveySquareFeet. /// - public double UsSurveySquareFeet => As(AreaUnit.UsSurveySquareFoot); + public T UsSurveySquareFeet => As(AreaUnit.UsSurveySquareFoot); #endregion @@ -279,127 +276,113 @@ public static string GetAbbreviation(AreaUnit unit, [CanBeNull] IFormatProvider /// Get from Acres. /// /// If value is NaN or Infinity. - public static Area FromAcres(QuantityValue acres) + public static Area FromAcres(T acres) { - double value = (double) acres; - return new Area(value, AreaUnit.Acre); + return new Area(acres, AreaUnit.Acre); } /// /// Get from Hectares. /// /// If value is NaN or Infinity. - public static Area FromHectares(QuantityValue hectares) + public static Area FromHectares(T hectares) { - double value = (double) hectares; - return new Area(value, AreaUnit.Hectare); + return new Area(hectares, AreaUnit.Hectare); } /// /// Get from SquareCentimeters. /// /// If value is NaN or Infinity. - public static Area FromSquareCentimeters(QuantityValue squarecentimeters) + public static Area FromSquareCentimeters(T squarecentimeters) { - double value = (double) squarecentimeters; - return new Area(value, AreaUnit.SquareCentimeter); + return new Area(squarecentimeters, AreaUnit.SquareCentimeter); } /// /// Get from SquareDecimeters. /// /// If value is NaN or Infinity. - public static Area FromSquareDecimeters(QuantityValue squaredecimeters) + public static Area FromSquareDecimeters(T squaredecimeters) { - double value = (double) squaredecimeters; - return new Area(value, AreaUnit.SquareDecimeter); + return new Area(squaredecimeters, AreaUnit.SquareDecimeter); } /// /// Get from SquareFeet. /// /// If value is NaN or Infinity. - public static Area FromSquareFeet(QuantityValue squarefeet) + public static Area FromSquareFeet(T squarefeet) { - double value = (double) squarefeet; - return new Area(value, AreaUnit.SquareFoot); + return new Area(squarefeet, AreaUnit.SquareFoot); } /// /// Get from SquareInches. /// /// If value is NaN or Infinity. - public static Area FromSquareInches(QuantityValue squareinches) + public static Area FromSquareInches(T squareinches) { - double value = (double) squareinches; - return new Area(value, AreaUnit.SquareInch); + return new Area(squareinches, AreaUnit.SquareInch); } /// /// Get from SquareKilometers. /// /// If value is NaN or Infinity. - public static Area FromSquareKilometers(QuantityValue squarekilometers) + public static Area FromSquareKilometers(T squarekilometers) { - double value = (double) squarekilometers; - return new Area(value, AreaUnit.SquareKilometer); + return new Area(squarekilometers, AreaUnit.SquareKilometer); } /// /// Get from SquareMeters. /// /// If value is NaN or Infinity. - public static Area FromSquareMeters(QuantityValue squaremeters) + public static Area FromSquareMeters(T squaremeters) { - double value = (double) squaremeters; - return new Area(value, AreaUnit.SquareMeter); + return new Area(squaremeters, AreaUnit.SquareMeter); } /// /// Get from SquareMicrometers. /// /// If value is NaN or Infinity. - public static Area FromSquareMicrometers(QuantityValue squaremicrometers) + public static Area FromSquareMicrometers(T squaremicrometers) { - double value = (double) squaremicrometers; - return new Area(value, AreaUnit.SquareMicrometer); + return new Area(squaremicrometers, AreaUnit.SquareMicrometer); } /// /// Get from SquareMiles. /// /// If value is NaN or Infinity. - public static Area FromSquareMiles(QuantityValue squaremiles) + public static Area FromSquareMiles(T squaremiles) { - double value = (double) squaremiles; - return new Area(value, AreaUnit.SquareMile); + return new Area(squaremiles, AreaUnit.SquareMile); } /// /// Get from SquareMillimeters. /// /// If value is NaN or Infinity. - public static Area FromSquareMillimeters(QuantityValue squaremillimeters) + public static Area FromSquareMillimeters(T squaremillimeters) { - double value = (double) squaremillimeters; - return new Area(value, AreaUnit.SquareMillimeter); + return new Area(squaremillimeters, AreaUnit.SquareMillimeter); } /// /// Get from SquareNauticalMiles. /// /// If value is NaN or Infinity. - public static Area FromSquareNauticalMiles(QuantityValue squarenauticalmiles) + public static Area FromSquareNauticalMiles(T squarenauticalmiles) { - double value = (double) squarenauticalmiles; - return new Area(value, AreaUnit.SquareNauticalMile); + return new Area(squarenauticalmiles, AreaUnit.SquareNauticalMile); } /// /// Get from SquareYards. /// /// If value is NaN or Infinity. - public static Area FromSquareYards(QuantityValue squareyards) + public static Area FromSquareYards(T squareyards) { - double value = (double) squareyards; - return new Area(value, AreaUnit.SquareYard); + return new Area(squareyards, AreaUnit.SquareYard); } /// /// Get from UsSurveySquareFeet. /// /// If value is NaN or Infinity. - public static Area FromUsSurveySquareFeet(QuantityValue ussurveysquarefeet) + public static Area FromUsSurveySquareFeet(T ussurveysquarefeet) { - double value = (double) ussurveysquarefeet; - return new Area(value, AreaUnit.UsSurveySquareFoot); + return new Area(ussurveysquarefeet, AreaUnit.UsSurveySquareFoot); } /// @@ -408,9 +391,9 @@ public static Area FromUsSurveySquareFeet(QuantityValue ussurveysquarefeet) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Area From(QuantityValue value, AreaUnit fromUnit) + public static Area From(T value, AreaUnit fromUnit) { - return new Area((double)value, fromUnit); + return new Area(value, fromUnit); } #endregion @@ -564,43 +547,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaUn /// Negate the value. public static Area operator -(Area right) { - return new Area(-right.Value, right.Unit); + return new Area(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Area operator +(Area left, Area right) { - return new Area(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Area(value, left.Unit); } /// Get from subtracting two . public static Area operator -(Area left, Area right) { - return new Area(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Area(value, left.Unit); } /// Get from multiplying value and . - public static Area operator *(double left, Area right) + public static Area operator *(T left, Area right) { - return new Area(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Area(value, right.Unit); } /// Get from multiplying value and . - public static Area operator *(Area left, double right) + public static Area operator *(Area left, T right) { - return new Area(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Area(value, left.Unit); } /// Get from dividing by value. - public static Area operator /(Area left, double right) + public static Area operator /(Area left, T right) { - return new Area(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Area(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Area left, Area right) + public static T operator /(Area left, Area right) { - return left.SquareMeters / right.SquareMeters; + return CompiledLambdas.Divide(left.SquareMeters, right.SquareMeters); } #endregion @@ -610,25 +598,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaUn /// Returns true if less or equal to. public static bool operator <=(Area left, Area right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Area left, Area right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Area left, Area right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Area left, Area right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -657,7 +645,7 @@ public int CompareTo(object obj) /// public int CompareTo(Area other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -674,7 +662,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Area other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -722,10 +710,8 @@ public bool Equals(Area other, double tolerance, ComparisonType comparisonTyp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -745,17 +731,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(AreaUnit unit) + public T As(AreaUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -775,9 +761,14 @@ double IQuantity.As(Enum unit) if(!(unit is AreaUnit unitAsAreaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaUnit)} is supported.", nameof(unit)); - return As(unitAsAreaUnit); + var asValue = As(unitAsAreaUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(AreaUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -818,32 +809,38 @@ public Area ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(AreaUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(AreaUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case AreaUnit.Acre: return _value*4046.85642; - case AreaUnit.Hectare: return _value*1e4; - case AreaUnit.SquareCentimeter: return _value*1e-4; - case AreaUnit.SquareDecimeter: return _value*1e-2; - case AreaUnit.SquareFoot: return _value*0.092903; - case AreaUnit.SquareInch: return _value*0.00064516; - case AreaUnit.SquareKilometer: return _value*1e6; - case AreaUnit.SquareMeter: return _value; - case AreaUnit.SquareMicrometer: return _value*1e-12; - case AreaUnit.SquareMile: return _value*2.59e6; - case AreaUnit.SquareMillimeter: return _value*1e-6; - case AreaUnit.SquareNauticalMile: return _value*3429904; - case AreaUnit.SquareYard: return _value*0.836127; - case AreaUnit.UsSurveySquareFoot: return _value*0.09290341161; + case AreaUnit.Acre: return Value*4046.85642; + case AreaUnit.Hectare: return Value*1e4; + case AreaUnit.SquareCentimeter: return Value*1e-4; + case AreaUnit.SquareDecimeter: return Value*1e-2; + case AreaUnit.SquareFoot: return Value*0.092903; + case AreaUnit.SquareInch: return Value*0.00064516; + case AreaUnit.SquareKilometer: return Value*1e6; + case AreaUnit.SquareMeter: return Value; + case AreaUnit.SquareMicrometer: return Value*1e-12; + case AreaUnit.SquareMile: return Value*2.59e6; + case AreaUnit.SquareMillimeter: return Value*1e-6; + case AreaUnit.SquareNauticalMile: return Value*3429904; + case AreaUnit.SquareYard: return Value*0.836127; + case AreaUnit.UsSurveySquareFoot: return Value*0.09290341161; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -860,10 +857,10 @@ internal Area ToBaseUnit() return new Area(baseUnitValue, BaseUnit); } - private double GetValueAs(AreaUnit unit) + private T GetValueAs(AreaUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -984,7 +981,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -999,37 +996,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1053,17 +1050,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs index 9632f883bc..2013b158da 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// The area density of a two-dimensional object is calculated as the mass per unit area. /// - public partial struct AreaDensity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct AreaDensity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -61,12 +56,12 @@ static AreaDensity() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public AreaDensity(double value, AreaDensityUnit unit) + public AreaDensity(T value, AreaDensityUnit unit) { if(unit == AreaDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -78,14 +73,14 @@ public AreaDensity(double value, AreaDensityUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public AreaDensity(double value, UnitSystem unitSystem) + public AreaDensity(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -127,7 +122,7 @@ public AreaDensity(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerSquareMeter. /// - public static AreaDensity Zero { get; } = new AreaDensity(0, BaseUnit); + public static AreaDensity Zero { get; } = new AreaDensity((T)0, BaseUnit); #endregion @@ -136,7 +131,9 @@ public AreaDensity(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -166,7 +163,7 @@ public AreaDensity(double value, UnitSystem unitSystem) /// /// Get in KilogramsPerSquareMeter. /// - public double KilogramsPerSquareMeter => As(AreaDensityUnit.KilogramPerSquareMeter); + public T KilogramsPerSquareMeter => As(AreaDensityUnit.KilogramPerSquareMeter); #endregion @@ -201,10 +198,9 @@ public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] IFormatPr /// Get from KilogramsPerSquareMeter. /// /// If value is NaN or Infinity. - public static AreaDensity FromKilogramsPerSquareMeter(QuantityValue kilogramspersquaremeter) + public static AreaDensity FromKilogramsPerSquareMeter(T kilogramspersquaremeter) { - double value = (double) kilogramspersquaremeter; - return new AreaDensity(value, AreaDensityUnit.KilogramPerSquareMeter); + return new AreaDensity(kilogramspersquaremeter, AreaDensityUnit.KilogramPerSquareMeter); } /// @@ -213,9 +209,9 @@ public static AreaDensity FromKilogramsPerSquareMeter(QuantityValue kilograms /// Value to convert from. /// Unit to convert from. /// unit value. - public static AreaDensity From(QuantityValue value, AreaDensityUnit fromUnit) + public static AreaDensity From(T value, AreaDensityUnit fromUnit) { - return new AreaDensity((double)value, fromUnit); + return new AreaDensity(value, fromUnit); } #endregion @@ -369,43 +365,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaDe /// Negate the value. public static AreaDensity operator -(AreaDensity right) { - return new AreaDensity(-right.Value, right.Unit); + return new AreaDensity(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static AreaDensity operator +(AreaDensity left, AreaDensity right) { - return new AreaDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new AreaDensity(value, left.Unit); } /// Get from subtracting two . public static AreaDensity operator -(AreaDensity left, AreaDensity right) { - return new AreaDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new AreaDensity(value, left.Unit); } /// Get from multiplying value and . - public static AreaDensity operator *(double left, AreaDensity right) + public static AreaDensity operator *(T left, AreaDensity right) { - return new AreaDensity(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new AreaDensity(value, right.Unit); } /// Get from multiplying value and . - public static AreaDensity operator *(AreaDensity left, double right) + public static AreaDensity operator *(AreaDensity left, T right) { - return new AreaDensity(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new AreaDensity(value, left.Unit); } /// Get from dividing by value. - public static AreaDensity operator /(AreaDensity left, double right) + public static AreaDensity operator /(AreaDensity left, T right) { - return new AreaDensity(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new AreaDensity(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(AreaDensity left, AreaDensity right) + public static T operator /(AreaDensity left, AreaDensity right) { - return left.KilogramsPerSquareMeter / right.KilogramsPerSquareMeter; + return CompiledLambdas.Divide(left.KilogramsPerSquareMeter, right.KilogramsPerSquareMeter); } #endregion @@ -415,25 +416,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaDe /// Returns true if less or equal to. public static bool operator <=(AreaDensity left, AreaDensity right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(AreaDensity left, AreaDensity right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(AreaDensity left, AreaDensity right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(AreaDensity left, AreaDensity right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -462,7 +463,7 @@ public int CompareTo(object obj) /// public int CompareTo(AreaDensity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -479,7 +480,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(AreaDensity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -527,10 +528,8 @@ public bool Equals(AreaDensity other, double tolerance, ComparisonType compar if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -550,17 +549,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(AreaDensityUnit unit) + public T As(AreaDensityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -580,9 +579,14 @@ double IQuantity.As(Enum unit) if(!(unit is AreaDensityUnit unitAsAreaDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaDensityUnit)} is supported.", nameof(unit)); - return As(unitAsAreaDensityUnit); + var asValue = As(unitAsAreaDensityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(AreaDensityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -623,19 +627,25 @@ public AreaDensity ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(AreaDensityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(AreaDensityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case AreaDensityUnit.KilogramPerSquareMeter: return _value; + case AreaDensityUnit.KilogramPerSquareMeter: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -652,10 +662,10 @@ internal AreaDensity ToBaseUnit() return new AreaDensity(baseUnitValue, BaseUnit); } - private double GetValueAs(AreaDensityUnit unit) + private T GetValueAs(AreaDensityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -763,7 +773,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -778,37 +788,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -832,17 +842,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs index 71ad804b79..90e0bf1893 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// A geometric property of an area that reflects how its points are distributed with regard to an axis. /// - public partial struct AreaMomentOfInertia : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct AreaMomentOfInertia : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -66,12 +61,12 @@ static AreaMomentOfInertia() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public AreaMomentOfInertia(double value, AreaMomentOfInertiaUnit unit) + public AreaMomentOfInertia(T value, AreaMomentOfInertiaUnit unit) { if(unit == AreaMomentOfInertiaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -83,14 +78,14 @@ public AreaMomentOfInertia(double value, AreaMomentOfInertiaUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public AreaMomentOfInertia(double value, UnitSystem unitSystem) + public AreaMomentOfInertia(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -132,7 +127,7 @@ public AreaMomentOfInertia(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit MeterToTheFourth. /// - public static AreaMomentOfInertia Zero { get; } = new AreaMomentOfInertia(0, BaseUnit); + public static AreaMomentOfInertia Zero { get; } = new AreaMomentOfInertia((T)0, BaseUnit); #endregion @@ -141,7 +136,9 @@ public AreaMomentOfInertia(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -171,32 +168,32 @@ public AreaMomentOfInertia(double value, UnitSystem unitSystem) /// /// Get in CentimetersToTheFourth. /// - public double CentimetersToTheFourth => As(AreaMomentOfInertiaUnit.CentimeterToTheFourth); + public T CentimetersToTheFourth => As(AreaMomentOfInertiaUnit.CentimeterToTheFourth); /// /// Get in DecimetersToTheFourth. /// - public double DecimetersToTheFourth => As(AreaMomentOfInertiaUnit.DecimeterToTheFourth); + public T DecimetersToTheFourth => As(AreaMomentOfInertiaUnit.DecimeterToTheFourth); /// /// Get in FeetToTheFourth. /// - public double FeetToTheFourth => As(AreaMomentOfInertiaUnit.FootToTheFourth); + public T FeetToTheFourth => As(AreaMomentOfInertiaUnit.FootToTheFourth); /// /// Get in InchesToTheFourth. /// - public double InchesToTheFourth => As(AreaMomentOfInertiaUnit.InchToTheFourth); + public T InchesToTheFourth => As(AreaMomentOfInertiaUnit.InchToTheFourth); /// /// Get in MetersToTheFourth. /// - public double MetersToTheFourth => As(AreaMomentOfInertiaUnit.MeterToTheFourth); + public T MetersToTheFourth => As(AreaMomentOfInertiaUnit.MeterToTheFourth); /// /// Get in MillimetersToTheFourth. /// - public double MillimetersToTheFourth => As(AreaMomentOfInertiaUnit.MillimeterToTheFourth); + public T MillimetersToTheFourth => As(AreaMomentOfInertiaUnit.MillimeterToTheFourth); #endregion @@ -231,55 +228,49 @@ public static string GetAbbreviation(AreaMomentOfInertiaUnit unit, [CanBeNull] I /// Get from CentimetersToTheFourth. /// /// If value is NaN or Infinity. - public static AreaMomentOfInertia FromCentimetersToTheFourth(QuantityValue centimeterstothefourth) + public static AreaMomentOfInertia FromCentimetersToTheFourth(T centimeterstothefourth) { - double value = (double) centimeterstothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.CentimeterToTheFourth); + return new AreaMomentOfInertia(centimeterstothefourth, AreaMomentOfInertiaUnit.CentimeterToTheFourth); } /// /// Get from DecimetersToTheFourth. /// /// If value is NaN or Infinity. - public static AreaMomentOfInertia FromDecimetersToTheFourth(QuantityValue decimeterstothefourth) + public static AreaMomentOfInertia FromDecimetersToTheFourth(T decimeterstothefourth) { - double value = (double) decimeterstothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.DecimeterToTheFourth); + return new AreaMomentOfInertia(decimeterstothefourth, AreaMomentOfInertiaUnit.DecimeterToTheFourth); } /// /// Get from FeetToTheFourth. /// /// If value is NaN or Infinity. - public static AreaMomentOfInertia FromFeetToTheFourth(QuantityValue feettothefourth) + public static AreaMomentOfInertia FromFeetToTheFourth(T feettothefourth) { - double value = (double) feettothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.FootToTheFourth); + return new AreaMomentOfInertia(feettothefourth, AreaMomentOfInertiaUnit.FootToTheFourth); } /// /// Get from InchesToTheFourth. /// /// If value is NaN or Infinity. - public static AreaMomentOfInertia FromInchesToTheFourth(QuantityValue inchestothefourth) + public static AreaMomentOfInertia FromInchesToTheFourth(T inchestothefourth) { - double value = (double) inchestothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.InchToTheFourth); + return new AreaMomentOfInertia(inchestothefourth, AreaMomentOfInertiaUnit.InchToTheFourth); } /// /// Get from MetersToTheFourth. /// /// If value is NaN or Infinity. - public static AreaMomentOfInertia FromMetersToTheFourth(QuantityValue meterstothefourth) + public static AreaMomentOfInertia FromMetersToTheFourth(T meterstothefourth) { - double value = (double) meterstothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.MeterToTheFourth); + return new AreaMomentOfInertia(meterstothefourth, AreaMomentOfInertiaUnit.MeterToTheFourth); } /// /// Get from MillimetersToTheFourth. /// /// If value is NaN or Infinity. - public static AreaMomentOfInertia FromMillimetersToTheFourth(QuantityValue millimeterstothefourth) + public static AreaMomentOfInertia FromMillimetersToTheFourth(T millimeterstothefourth) { - double value = (double) millimeterstothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.MillimeterToTheFourth); + return new AreaMomentOfInertia(millimeterstothefourth, AreaMomentOfInertiaUnit.MillimeterToTheFourth); } /// @@ -288,9 +279,9 @@ public static AreaMomentOfInertia FromMillimetersToTheFourth(QuantityValue mi /// Value to convert from. /// Unit to convert from. /// unit value. - public static AreaMomentOfInertia From(QuantityValue value, AreaMomentOfInertiaUnit fromUnit) + public static AreaMomentOfInertia From(T value, AreaMomentOfInertiaUnit fromUnit) { - return new AreaMomentOfInertia((double)value, fromUnit); + return new AreaMomentOfInertia(value, fromUnit); } #endregion @@ -444,43 +435,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaMo /// Negate the value. public static AreaMomentOfInertia operator -(AreaMomentOfInertia right) { - return new AreaMomentOfInertia(-right.Value, right.Unit); + return new AreaMomentOfInertia(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static AreaMomentOfInertia operator +(AreaMomentOfInertia left, AreaMomentOfInertia right) { - return new AreaMomentOfInertia(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new AreaMomentOfInertia(value, left.Unit); } /// Get from subtracting two . public static AreaMomentOfInertia operator -(AreaMomentOfInertia left, AreaMomentOfInertia right) { - return new AreaMomentOfInertia(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new AreaMomentOfInertia(value, left.Unit); } /// Get from multiplying value and . - public static AreaMomentOfInertia operator *(double left, AreaMomentOfInertia right) + public static AreaMomentOfInertia operator *(T left, AreaMomentOfInertia right) { - return new AreaMomentOfInertia(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new AreaMomentOfInertia(value, right.Unit); } /// Get from multiplying value and . - public static AreaMomentOfInertia operator *(AreaMomentOfInertia left, double right) + public static AreaMomentOfInertia operator *(AreaMomentOfInertia left, T right) { - return new AreaMomentOfInertia(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new AreaMomentOfInertia(value, left.Unit); } /// Get from dividing by value. - public static AreaMomentOfInertia operator /(AreaMomentOfInertia left, double right) + public static AreaMomentOfInertia operator /(AreaMomentOfInertia left, T right) { - return new AreaMomentOfInertia(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new AreaMomentOfInertia(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(AreaMomentOfInertia left, AreaMomentOfInertia right) + public static T operator /(AreaMomentOfInertia left, AreaMomentOfInertia right) { - return left.MetersToTheFourth / right.MetersToTheFourth; + return CompiledLambdas.Divide(left.MetersToTheFourth, right.MetersToTheFourth); } #endregion @@ -490,25 +486,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaMo /// Returns true if less or equal to. public static bool operator <=(AreaMomentOfInertia left, AreaMomentOfInertia right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(AreaMomentOfInertia left, AreaMomentOfInertia right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(AreaMomentOfInertia left, AreaMomentOfInertia right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(AreaMomentOfInertia left, AreaMomentOfInertia right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -537,7 +533,7 @@ public int CompareTo(object obj) /// public int CompareTo(AreaMomentOfInertia other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -554,7 +550,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(AreaMomentOfInertia other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -602,10 +598,8 @@ public bool Equals(AreaMomentOfInertia other, double tolerance, ComparisonTyp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -625,17 +619,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(AreaMomentOfInertiaUnit unit) + public T As(AreaMomentOfInertiaUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -655,9 +649,14 @@ double IQuantity.As(Enum unit) if(!(unit is AreaMomentOfInertiaUnit unitAsAreaMomentOfInertiaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaMomentOfInertiaUnit)} is supported.", nameof(unit)); - return As(unitAsAreaMomentOfInertiaUnit); + var asValue = As(unitAsAreaMomentOfInertiaUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(AreaMomentOfInertiaUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -698,24 +697,30 @@ public AreaMomentOfInertia ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(AreaMomentOfInertiaUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(AreaMomentOfInertiaUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case AreaMomentOfInertiaUnit.CentimeterToTheFourth: return _value/1e8; - case AreaMomentOfInertiaUnit.DecimeterToTheFourth: return _value/1e4; - case AreaMomentOfInertiaUnit.FootToTheFourth: return _value*Math.Pow(0.3048, 4); - case AreaMomentOfInertiaUnit.InchToTheFourth: return _value*Math.Pow(2.54e-2, 4); - case AreaMomentOfInertiaUnit.MeterToTheFourth: return _value; - case AreaMomentOfInertiaUnit.MillimeterToTheFourth: return _value/1e12; + case AreaMomentOfInertiaUnit.CentimeterToTheFourth: return Value/1e8; + case AreaMomentOfInertiaUnit.DecimeterToTheFourth: return Value/1e4; + case AreaMomentOfInertiaUnit.FootToTheFourth: return Value*Math.Pow(0.3048, 4); + case AreaMomentOfInertiaUnit.InchToTheFourth: return Value*Math.Pow(2.54e-2, 4); + case AreaMomentOfInertiaUnit.MeterToTheFourth: return Value; + case AreaMomentOfInertiaUnit.MillimeterToTheFourth: return Value/1e12; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -732,10 +737,10 @@ internal AreaMomentOfInertia ToBaseUnit() return new AreaMomentOfInertia(baseUnitValue, BaseUnit); } - private double GetValueAs(AreaMomentOfInertiaUnit unit) + private T GetValueAs(AreaMomentOfInertiaUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -848,7 +853,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -863,37 +868,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -917,17 +922,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs index cc6016680d..33a20a9199 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Bit_rate /// - public partial struct BitRate : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct BitRate : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly decimal _value; - /// /// The unit this quantity was constructed with. /// @@ -89,12 +84,12 @@ static BitRate() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public BitRate(decimal value, BitRateUnit unit) + public BitRate(T value, BitRateUnit unit) { if(unit == BitRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = value; + Value = value; _unit = unit; } @@ -106,14 +101,14 @@ public BitRate(decimal value, BitRateUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public BitRate(decimal value, UnitSystem unitSystem) + public BitRate(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = value; + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -155,7 +150,7 @@ public BitRate(decimal value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit BitPerSecond. /// - public static BitRate Zero { get; } = new BitRate(0, BaseUnit); + public static BitRate Zero { get; } = new BitRate((T)0, BaseUnit); #endregion @@ -164,9 +159,9 @@ public BitRate(decimal value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public decimal Value => _value; + public T Value{ get; } - double IQuantity.Value => (double) _value; + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -196,132 +191,132 @@ public BitRate(decimal value, UnitSystem unitSystem) /// /// Get in BitsPerSecond. /// - public double BitsPerSecond => As(BitRateUnit.BitPerSecond); + public T BitsPerSecond => As(BitRateUnit.BitPerSecond); /// /// Get in BytesPerSecond. /// - public double BytesPerSecond => As(BitRateUnit.BytePerSecond); + public T BytesPerSecond => As(BitRateUnit.BytePerSecond); /// /// Get in ExabitsPerSecond. /// - public double ExabitsPerSecond => As(BitRateUnit.ExabitPerSecond); + public T ExabitsPerSecond => As(BitRateUnit.ExabitPerSecond); /// /// Get in ExabytesPerSecond. /// - public double ExabytesPerSecond => As(BitRateUnit.ExabytePerSecond); + public T ExabytesPerSecond => As(BitRateUnit.ExabytePerSecond); /// /// Get in ExbibitsPerSecond. /// - public double ExbibitsPerSecond => As(BitRateUnit.ExbibitPerSecond); + public T ExbibitsPerSecond => As(BitRateUnit.ExbibitPerSecond); /// /// Get in ExbibytesPerSecond. /// - public double ExbibytesPerSecond => As(BitRateUnit.ExbibytePerSecond); + public T ExbibytesPerSecond => As(BitRateUnit.ExbibytePerSecond); /// /// Get in GibibitsPerSecond. /// - public double GibibitsPerSecond => As(BitRateUnit.GibibitPerSecond); + public T GibibitsPerSecond => As(BitRateUnit.GibibitPerSecond); /// /// Get in GibibytesPerSecond. /// - public double GibibytesPerSecond => As(BitRateUnit.GibibytePerSecond); + public T GibibytesPerSecond => As(BitRateUnit.GibibytePerSecond); /// /// Get in GigabitsPerSecond. /// - public double GigabitsPerSecond => As(BitRateUnit.GigabitPerSecond); + public T GigabitsPerSecond => As(BitRateUnit.GigabitPerSecond); /// /// Get in GigabytesPerSecond. /// - public double GigabytesPerSecond => As(BitRateUnit.GigabytePerSecond); + public T GigabytesPerSecond => As(BitRateUnit.GigabytePerSecond); /// /// Get in KibibitsPerSecond. /// - public double KibibitsPerSecond => As(BitRateUnit.KibibitPerSecond); + public T KibibitsPerSecond => As(BitRateUnit.KibibitPerSecond); /// /// Get in KibibytesPerSecond. /// - public double KibibytesPerSecond => As(BitRateUnit.KibibytePerSecond); + public T KibibytesPerSecond => As(BitRateUnit.KibibytePerSecond); /// /// Get in KilobitsPerSecond. /// - public double KilobitsPerSecond => As(BitRateUnit.KilobitPerSecond); + public T KilobitsPerSecond => As(BitRateUnit.KilobitPerSecond); /// /// Get in KilobytesPerSecond. /// - public double KilobytesPerSecond => As(BitRateUnit.KilobytePerSecond); + public T KilobytesPerSecond => As(BitRateUnit.KilobytePerSecond); /// /// Get in MebibitsPerSecond. /// - public double MebibitsPerSecond => As(BitRateUnit.MebibitPerSecond); + public T MebibitsPerSecond => As(BitRateUnit.MebibitPerSecond); /// /// Get in MebibytesPerSecond. /// - public double MebibytesPerSecond => As(BitRateUnit.MebibytePerSecond); + public T MebibytesPerSecond => As(BitRateUnit.MebibytePerSecond); /// /// Get in MegabitsPerSecond. /// - public double MegabitsPerSecond => As(BitRateUnit.MegabitPerSecond); + public T MegabitsPerSecond => As(BitRateUnit.MegabitPerSecond); /// /// Get in MegabytesPerSecond. /// - public double MegabytesPerSecond => As(BitRateUnit.MegabytePerSecond); + public T MegabytesPerSecond => As(BitRateUnit.MegabytePerSecond); /// /// Get in PebibitsPerSecond. /// - public double PebibitsPerSecond => As(BitRateUnit.PebibitPerSecond); + public T PebibitsPerSecond => As(BitRateUnit.PebibitPerSecond); /// /// Get in PebibytesPerSecond. /// - public double PebibytesPerSecond => As(BitRateUnit.PebibytePerSecond); + public T PebibytesPerSecond => As(BitRateUnit.PebibytePerSecond); /// /// Get in PetabitsPerSecond. /// - public double PetabitsPerSecond => As(BitRateUnit.PetabitPerSecond); + public T PetabitsPerSecond => As(BitRateUnit.PetabitPerSecond); /// /// Get in PetabytesPerSecond. /// - public double PetabytesPerSecond => As(BitRateUnit.PetabytePerSecond); + public T PetabytesPerSecond => As(BitRateUnit.PetabytePerSecond); /// /// Get in TebibitsPerSecond. /// - public double TebibitsPerSecond => As(BitRateUnit.TebibitPerSecond); + public T TebibitsPerSecond => As(BitRateUnit.TebibitPerSecond); /// /// Get in TebibytesPerSecond. /// - public double TebibytesPerSecond => As(BitRateUnit.TebibytePerSecond); + public T TebibytesPerSecond => As(BitRateUnit.TebibytePerSecond); /// /// Get in TerabitsPerSecond. /// - public double TerabitsPerSecond => As(BitRateUnit.TerabitPerSecond); + public T TerabitsPerSecond => As(BitRateUnit.TerabitPerSecond); /// /// Get in TerabytesPerSecond. /// - public double TerabytesPerSecond => As(BitRateUnit.TerabytePerSecond); + public T TerabytesPerSecond => As(BitRateUnit.TerabytePerSecond); #endregion @@ -356,235 +351,209 @@ public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] IFormatProvid /// Get from BitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromBitsPerSecond(QuantityValue bitspersecond) + public static BitRate FromBitsPerSecond(T bitspersecond) { - decimal value = (decimal) bitspersecond; - return new BitRate(value, BitRateUnit.BitPerSecond); + return new BitRate(bitspersecond, BitRateUnit.BitPerSecond); } /// /// Get from BytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromBytesPerSecond(QuantityValue bytespersecond) + public static BitRate FromBytesPerSecond(T bytespersecond) { - decimal value = (decimal) bytespersecond; - return new BitRate(value, BitRateUnit.BytePerSecond); + return new BitRate(bytespersecond, BitRateUnit.BytePerSecond); } /// /// Get from ExabitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromExabitsPerSecond(QuantityValue exabitspersecond) + public static BitRate FromExabitsPerSecond(T exabitspersecond) { - decimal value = (decimal) exabitspersecond; - return new BitRate(value, BitRateUnit.ExabitPerSecond); + return new BitRate(exabitspersecond, BitRateUnit.ExabitPerSecond); } /// /// Get from ExabytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromExabytesPerSecond(QuantityValue exabytespersecond) + public static BitRate FromExabytesPerSecond(T exabytespersecond) { - decimal value = (decimal) exabytespersecond; - return new BitRate(value, BitRateUnit.ExabytePerSecond); + return new BitRate(exabytespersecond, BitRateUnit.ExabytePerSecond); } /// /// Get from ExbibitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromExbibitsPerSecond(QuantityValue exbibitspersecond) + public static BitRate FromExbibitsPerSecond(T exbibitspersecond) { - decimal value = (decimal) exbibitspersecond; - return new BitRate(value, BitRateUnit.ExbibitPerSecond); + return new BitRate(exbibitspersecond, BitRateUnit.ExbibitPerSecond); } /// /// Get from ExbibytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromExbibytesPerSecond(QuantityValue exbibytespersecond) + public static BitRate FromExbibytesPerSecond(T exbibytespersecond) { - decimal value = (decimal) exbibytespersecond; - return new BitRate(value, BitRateUnit.ExbibytePerSecond); + return new BitRate(exbibytespersecond, BitRateUnit.ExbibytePerSecond); } /// /// Get from GibibitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromGibibitsPerSecond(QuantityValue gibibitspersecond) + public static BitRate FromGibibitsPerSecond(T gibibitspersecond) { - decimal value = (decimal) gibibitspersecond; - return new BitRate(value, BitRateUnit.GibibitPerSecond); + return new BitRate(gibibitspersecond, BitRateUnit.GibibitPerSecond); } /// /// Get from GibibytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromGibibytesPerSecond(QuantityValue gibibytespersecond) + public static BitRate FromGibibytesPerSecond(T gibibytespersecond) { - decimal value = (decimal) gibibytespersecond; - return new BitRate(value, BitRateUnit.GibibytePerSecond); + return new BitRate(gibibytespersecond, BitRateUnit.GibibytePerSecond); } /// /// Get from GigabitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromGigabitsPerSecond(QuantityValue gigabitspersecond) + public static BitRate FromGigabitsPerSecond(T gigabitspersecond) { - decimal value = (decimal) gigabitspersecond; - return new BitRate(value, BitRateUnit.GigabitPerSecond); + return new BitRate(gigabitspersecond, BitRateUnit.GigabitPerSecond); } /// /// Get from GigabytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromGigabytesPerSecond(QuantityValue gigabytespersecond) + public static BitRate FromGigabytesPerSecond(T gigabytespersecond) { - decimal value = (decimal) gigabytespersecond; - return new BitRate(value, BitRateUnit.GigabytePerSecond); + return new BitRate(gigabytespersecond, BitRateUnit.GigabytePerSecond); } /// /// Get from KibibitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromKibibitsPerSecond(QuantityValue kibibitspersecond) + public static BitRate FromKibibitsPerSecond(T kibibitspersecond) { - decimal value = (decimal) kibibitspersecond; - return new BitRate(value, BitRateUnit.KibibitPerSecond); + return new BitRate(kibibitspersecond, BitRateUnit.KibibitPerSecond); } /// /// Get from KibibytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromKibibytesPerSecond(QuantityValue kibibytespersecond) + public static BitRate FromKibibytesPerSecond(T kibibytespersecond) { - decimal value = (decimal) kibibytespersecond; - return new BitRate(value, BitRateUnit.KibibytePerSecond); + return new BitRate(kibibytespersecond, BitRateUnit.KibibytePerSecond); } /// /// Get from KilobitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromKilobitsPerSecond(QuantityValue kilobitspersecond) + public static BitRate FromKilobitsPerSecond(T kilobitspersecond) { - decimal value = (decimal) kilobitspersecond; - return new BitRate(value, BitRateUnit.KilobitPerSecond); + return new BitRate(kilobitspersecond, BitRateUnit.KilobitPerSecond); } /// /// Get from KilobytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromKilobytesPerSecond(QuantityValue kilobytespersecond) + public static BitRate FromKilobytesPerSecond(T kilobytespersecond) { - decimal value = (decimal) kilobytespersecond; - return new BitRate(value, BitRateUnit.KilobytePerSecond); + return new BitRate(kilobytespersecond, BitRateUnit.KilobytePerSecond); } /// /// Get from MebibitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromMebibitsPerSecond(QuantityValue mebibitspersecond) + public static BitRate FromMebibitsPerSecond(T mebibitspersecond) { - decimal value = (decimal) mebibitspersecond; - return new BitRate(value, BitRateUnit.MebibitPerSecond); + return new BitRate(mebibitspersecond, BitRateUnit.MebibitPerSecond); } /// /// Get from MebibytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromMebibytesPerSecond(QuantityValue mebibytespersecond) + public static BitRate FromMebibytesPerSecond(T mebibytespersecond) { - decimal value = (decimal) mebibytespersecond; - return new BitRate(value, BitRateUnit.MebibytePerSecond); + return new BitRate(mebibytespersecond, BitRateUnit.MebibytePerSecond); } /// /// Get from MegabitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromMegabitsPerSecond(QuantityValue megabitspersecond) + public static BitRate FromMegabitsPerSecond(T megabitspersecond) { - decimal value = (decimal) megabitspersecond; - return new BitRate(value, BitRateUnit.MegabitPerSecond); + return new BitRate(megabitspersecond, BitRateUnit.MegabitPerSecond); } /// /// Get from MegabytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromMegabytesPerSecond(QuantityValue megabytespersecond) + public static BitRate FromMegabytesPerSecond(T megabytespersecond) { - decimal value = (decimal) megabytespersecond; - return new BitRate(value, BitRateUnit.MegabytePerSecond); + return new BitRate(megabytespersecond, BitRateUnit.MegabytePerSecond); } /// /// Get from PebibitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromPebibitsPerSecond(QuantityValue pebibitspersecond) + public static BitRate FromPebibitsPerSecond(T pebibitspersecond) { - decimal value = (decimal) pebibitspersecond; - return new BitRate(value, BitRateUnit.PebibitPerSecond); + return new BitRate(pebibitspersecond, BitRateUnit.PebibitPerSecond); } /// /// Get from PebibytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromPebibytesPerSecond(QuantityValue pebibytespersecond) + public static BitRate FromPebibytesPerSecond(T pebibytespersecond) { - decimal value = (decimal) pebibytespersecond; - return new BitRate(value, BitRateUnit.PebibytePerSecond); + return new BitRate(pebibytespersecond, BitRateUnit.PebibytePerSecond); } /// /// Get from PetabitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromPetabitsPerSecond(QuantityValue petabitspersecond) + public static BitRate FromPetabitsPerSecond(T petabitspersecond) { - decimal value = (decimal) petabitspersecond; - return new BitRate(value, BitRateUnit.PetabitPerSecond); + return new BitRate(petabitspersecond, BitRateUnit.PetabitPerSecond); } /// /// Get from PetabytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromPetabytesPerSecond(QuantityValue petabytespersecond) + public static BitRate FromPetabytesPerSecond(T petabytespersecond) { - decimal value = (decimal) petabytespersecond; - return new BitRate(value, BitRateUnit.PetabytePerSecond); + return new BitRate(petabytespersecond, BitRateUnit.PetabytePerSecond); } /// /// Get from TebibitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromTebibitsPerSecond(QuantityValue tebibitspersecond) + public static BitRate FromTebibitsPerSecond(T tebibitspersecond) { - decimal value = (decimal) tebibitspersecond; - return new BitRate(value, BitRateUnit.TebibitPerSecond); + return new BitRate(tebibitspersecond, BitRateUnit.TebibitPerSecond); } /// /// Get from TebibytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromTebibytesPerSecond(QuantityValue tebibytespersecond) + public static BitRate FromTebibytesPerSecond(T tebibytespersecond) { - decimal value = (decimal) tebibytespersecond; - return new BitRate(value, BitRateUnit.TebibytePerSecond); + return new BitRate(tebibytespersecond, BitRateUnit.TebibytePerSecond); } /// /// Get from TerabitsPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromTerabitsPerSecond(QuantityValue terabitspersecond) + public static BitRate FromTerabitsPerSecond(T terabitspersecond) { - decimal value = (decimal) terabitspersecond; - return new BitRate(value, BitRateUnit.TerabitPerSecond); + return new BitRate(terabitspersecond, BitRateUnit.TerabitPerSecond); } /// /// Get from TerabytesPerSecond. /// /// If value is NaN or Infinity. - public static BitRate FromTerabytesPerSecond(QuantityValue terabytespersecond) + public static BitRate FromTerabytesPerSecond(T terabytespersecond) { - decimal value = (decimal) terabytespersecond; - return new BitRate(value, BitRateUnit.TerabytePerSecond); + return new BitRate(terabytespersecond, BitRateUnit.TerabytePerSecond); } /// @@ -593,9 +562,9 @@ public static BitRate FromTerabytesPerSecond(QuantityValue terabytespersecond /// Value to convert from. /// Unit to convert from. /// unit value. - public static BitRate From(QuantityValue value, BitRateUnit fromUnit) + public static BitRate From(T value, BitRateUnit fromUnit) { - return new BitRate((decimal)value, fromUnit); + return new BitRate(value, fromUnit); } #endregion @@ -749,43 +718,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BitRat /// Negate the value. public static BitRate operator -(BitRate right) { - return new BitRate(-right.Value, right.Unit); + return new BitRate(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static BitRate operator +(BitRate left, BitRate right) { - return new BitRate(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new BitRate(value, left.Unit); } /// Get from subtracting two . public static BitRate operator -(BitRate left, BitRate right) { - return new BitRate(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new BitRate(value, left.Unit); } /// Get from multiplying value and . - public static BitRate operator *(decimal left, BitRate right) + public static BitRate operator *(T left, BitRate right) { - return new BitRate(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new BitRate(value, right.Unit); } /// Get from multiplying value and . - public static BitRate operator *(BitRate left, decimal right) + public static BitRate operator *(BitRate left, T right) { - return new BitRate(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new BitRate(value, left.Unit); } /// Get from dividing by value. - public static BitRate operator /(BitRate left, decimal right) + public static BitRate operator /(BitRate left, T right) { - return new BitRate(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new BitRate(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(BitRate left, BitRate right) + public static T operator /(BitRate left, BitRate right) { - return left.BitsPerSecond / right.BitsPerSecond; + return CompiledLambdas.Divide(left.BitsPerSecond, right.BitsPerSecond); } #endregion @@ -795,25 +769,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BitRat /// Returns true if less or equal to. public static bool operator <=(BitRate left, BitRate right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(BitRate left, BitRate right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(BitRate left, BitRate right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(BitRate left, BitRate right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -842,7 +816,7 @@ public int CompareTo(object obj) /// public int CompareTo(BitRate other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -859,7 +833,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(BitRate other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -907,10 +881,8 @@ public bool Equals(BitRate other, double tolerance, ComparisonType comparison if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -930,17 +902,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(BitRateUnit unit) + public T As(BitRateUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -960,9 +932,14 @@ double IQuantity.As(Enum unit) if(!(unit is BitRateUnit unitAsBitRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(BitRateUnit)} is supported.", nameof(unit)); - return As(unitAsBitRateUnit); + var asValue = As(unitAsBitRateUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(BitRateUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -1003,44 +980,50 @@ public BitRate ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(BitRateUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(BitRateUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private decimal GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case BitRateUnit.BitPerSecond: return _value; - case BitRateUnit.BytePerSecond: return _value*8m; - case BitRateUnit.ExabitPerSecond: return (_value) * 1e18m; - case BitRateUnit.ExabytePerSecond: return (_value*8m) * 1e18m; - case BitRateUnit.ExbibitPerSecond: return (_value) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); - case BitRateUnit.ExbibytePerSecond: return (_value*8m) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); - case BitRateUnit.GibibitPerSecond: return (_value) * (1024m * 1024 * 1024); - case BitRateUnit.GibibytePerSecond: return (_value*8m) * (1024m * 1024 * 1024); - case BitRateUnit.GigabitPerSecond: return (_value) * 1e9m; - case BitRateUnit.GigabytePerSecond: return (_value*8m) * 1e9m; - case BitRateUnit.KibibitPerSecond: return (_value) * 1024m; - case BitRateUnit.KibibytePerSecond: return (_value*8m) * 1024m; - case BitRateUnit.KilobitPerSecond: return (_value) * 1e3m; - case BitRateUnit.KilobytePerSecond: return (_value*8m) * 1e3m; - case BitRateUnit.MebibitPerSecond: return (_value) * (1024m * 1024); - case BitRateUnit.MebibytePerSecond: return (_value*8m) * (1024m * 1024); - case BitRateUnit.MegabitPerSecond: return (_value) * 1e6m; - case BitRateUnit.MegabytePerSecond: return (_value*8m) * 1e6m; - case BitRateUnit.PebibitPerSecond: return (_value) * (1024m * 1024 * 1024 * 1024 * 1024); - case BitRateUnit.PebibytePerSecond: return (_value*8m) * (1024m * 1024 * 1024 * 1024 * 1024); - case BitRateUnit.PetabitPerSecond: return (_value) * 1e15m; - case BitRateUnit.PetabytePerSecond: return (_value*8m) * 1e15m; - case BitRateUnit.TebibitPerSecond: return (_value) * (1024m * 1024 * 1024 * 1024); - case BitRateUnit.TebibytePerSecond: return (_value*8m) * (1024m * 1024 * 1024 * 1024); - case BitRateUnit.TerabitPerSecond: return (_value) * 1e12m; - case BitRateUnit.TerabytePerSecond: return (_value*8m) * 1e12m; + case BitRateUnit.BitPerSecond: return Value; + case BitRateUnit.BytePerSecond: return Value*8m; + case BitRateUnit.ExabitPerSecond: return (Value) * 1e18m; + case BitRateUnit.ExabytePerSecond: return (Value*8m) * 1e18m; + case BitRateUnit.ExbibitPerSecond: return (Value) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.ExbibytePerSecond: return (Value*8m) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.GibibitPerSecond: return (Value) * (1024m * 1024 * 1024); + case BitRateUnit.GibibytePerSecond: return (Value*8m) * (1024m * 1024 * 1024); + case BitRateUnit.GigabitPerSecond: return (Value) * 1e9m; + case BitRateUnit.GigabytePerSecond: return (Value*8m) * 1e9m; + case BitRateUnit.KibibitPerSecond: return (Value) * 1024m; + case BitRateUnit.KibibytePerSecond: return (Value*8m) * 1024m; + case BitRateUnit.KilobitPerSecond: return (Value) * 1e3m; + case BitRateUnit.KilobytePerSecond: return (Value*8m) * 1e3m; + case BitRateUnit.MebibitPerSecond: return (Value) * (1024m * 1024); + case BitRateUnit.MebibytePerSecond: return (Value*8m) * (1024m * 1024); + case BitRateUnit.MegabitPerSecond: return (Value) * 1e6m; + case BitRateUnit.MegabytePerSecond: return (Value*8m) * 1e6m; + case BitRateUnit.PebibitPerSecond: return (Value) * (1024m * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.PebibytePerSecond: return (Value*8m) * (1024m * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.PetabitPerSecond: return (Value) * 1e15m; + case BitRateUnit.PetabytePerSecond: return (Value*8m) * 1e15m; + case BitRateUnit.TebibitPerSecond: return (Value) * (1024m * 1024 * 1024 * 1024); + case BitRateUnit.TebibytePerSecond: return (Value*8m) * (1024m * 1024 * 1024 * 1024); + case BitRateUnit.TerabitPerSecond: return (Value) * 1e12m; + case BitRateUnit.TerabytePerSecond: return (Value*8m) * 1e12m; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -1057,10 +1040,10 @@ internal BitRate ToBaseUnit() return new BitRate(baseUnitValue, BaseUnit); } - private decimal GetValueAs(BitRateUnit unit) + private T GetValueAs(BitRateUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1193,7 +1176,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1208,37 +1191,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1262,17 +1245,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs index d0e02a9c69..25cecf8905 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Brake specific fuel consumption (BSFC) is a measure of the fuel efficiency of any prime mover that burns fuel and produces rotational, or shaft, power. It is typically used for comparing the efficiency of internal combustion engines with a shaft output. /// - public partial struct BrakeSpecificFuelConsumption : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct BrakeSpecificFuelConsumption : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -63,12 +58,12 @@ static BrakeSpecificFuelConsumption() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public BrakeSpecificFuelConsumption(double value, BrakeSpecificFuelConsumptionUnit unit) + public BrakeSpecificFuelConsumption(T value, BrakeSpecificFuelConsumptionUnit unit) { if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -80,14 +75,14 @@ public BrakeSpecificFuelConsumption(double value, BrakeSpecificFuelConsumptionUn /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public BrakeSpecificFuelConsumption(double value, UnitSystem unitSystem) + public BrakeSpecificFuelConsumption(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -129,7 +124,7 @@ public BrakeSpecificFuelConsumption(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerJoule. /// - public static BrakeSpecificFuelConsumption Zero { get; } = new BrakeSpecificFuelConsumption(0, BaseUnit); + public static BrakeSpecificFuelConsumption Zero { get; } = new BrakeSpecificFuelConsumption((T)0, BaseUnit); #endregion @@ -138,7 +133,9 @@ public BrakeSpecificFuelConsumption(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -168,17 +165,17 @@ public BrakeSpecificFuelConsumption(double value, UnitSystem unitSystem) /// /// Get in GramsPerKiloWattHour. /// - public double GramsPerKiloWattHour => As(BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour); + public T GramsPerKiloWattHour => As(BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour); /// /// Get in KilogramsPerJoule. /// - public double KilogramsPerJoule => As(BrakeSpecificFuelConsumptionUnit.KilogramPerJoule); + public T KilogramsPerJoule => As(BrakeSpecificFuelConsumptionUnit.KilogramPerJoule); /// /// Get in PoundsPerMechanicalHorsepowerHour. /// - public double PoundsPerMechanicalHorsepowerHour => As(BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour); + public T PoundsPerMechanicalHorsepowerHour => As(BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour); #endregion @@ -213,28 +210,25 @@ public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit, [Can /// Get from GramsPerKiloWattHour. /// /// If value is NaN or Infinity. - public static BrakeSpecificFuelConsumption FromGramsPerKiloWattHour(QuantityValue gramsperkilowatthour) + public static BrakeSpecificFuelConsumption FromGramsPerKiloWattHour(T gramsperkilowatthour) { - double value = (double) gramsperkilowatthour; - return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour); + return new BrakeSpecificFuelConsumption(gramsperkilowatthour, BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour); } /// /// Get from KilogramsPerJoule. /// /// If value is NaN or Infinity. - public static BrakeSpecificFuelConsumption FromKilogramsPerJoule(QuantityValue kilogramsperjoule) + public static BrakeSpecificFuelConsumption FromKilogramsPerJoule(T kilogramsperjoule) { - double value = (double) kilogramsperjoule; - return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule); + return new BrakeSpecificFuelConsumption(kilogramsperjoule, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule); } /// /// Get from PoundsPerMechanicalHorsepowerHour. /// /// If value is NaN or Infinity. - public static BrakeSpecificFuelConsumption FromPoundsPerMechanicalHorsepowerHour(QuantityValue poundspermechanicalhorsepowerhour) + public static BrakeSpecificFuelConsumption FromPoundsPerMechanicalHorsepowerHour(T poundspermechanicalhorsepowerhour) { - double value = (double) poundspermechanicalhorsepowerhour; - return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour); + return new BrakeSpecificFuelConsumption(poundspermechanicalhorsepowerhour, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour); } /// @@ -243,9 +237,9 @@ public static BrakeSpecificFuelConsumption FromPoundsPerMechanicalHorsepowerH /// Value to convert from. /// Unit to convert from. /// unit value. - public static BrakeSpecificFuelConsumption From(QuantityValue value, BrakeSpecificFuelConsumptionUnit fromUnit) + public static BrakeSpecificFuelConsumption From(T value, BrakeSpecificFuelConsumptionUnit fromUnit) { - return new BrakeSpecificFuelConsumption((double)value, fromUnit); + return new BrakeSpecificFuelConsumption(value, fromUnit); } #endregion @@ -399,43 +393,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BrakeS /// Negate the value. public static BrakeSpecificFuelConsumption operator -(BrakeSpecificFuelConsumption right) { - return new BrakeSpecificFuelConsumption(-right.Value, right.Unit); + return new BrakeSpecificFuelConsumption(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static BrakeSpecificFuelConsumption operator +(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { - return new BrakeSpecificFuelConsumption(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new BrakeSpecificFuelConsumption(value, left.Unit); } /// Get from subtracting two . public static BrakeSpecificFuelConsumption operator -(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { - return new BrakeSpecificFuelConsumption(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new BrakeSpecificFuelConsumption(value, left.Unit); } /// Get from multiplying value and . - public static BrakeSpecificFuelConsumption operator *(double left, BrakeSpecificFuelConsumption right) + public static BrakeSpecificFuelConsumption operator *(T left, BrakeSpecificFuelConsumption right) { - return new BrakeSpecificFuelConsumption(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new BrakeSpecificFuelConsumption(value, right.Unit); } /// Get from multiplying value and . - public static BrakeSpecificFuelConsumption operator *(BrakeSpecificFuelConsumption left, double right) + public static BrakeSpecificFuelConsumption operator *(BrakeSpecificFuelConsumption left, T right) { - return new BrakeSpecificFuelConsumption(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new BrakeSpecificFuelConsumption(value, left.Unit); } /// Get from dividing by value. - public static BrakeSpecificFuelConsumption operator /(BrakeSpecificFuelConsumption left, double right) + public static BrakeSpecificFuelConsumption operator /(BrakeSpecificFuelConsumption left, T right) { - return new BrakeSpecificFuelConsumption(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new BrakeSpecificFuelConsumption(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + public static T operator /(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { - return left.KilogramsPerJoule / right.KilogramsPerJoule; + return CompiledLambdas.Divide(left.KilogramsPerJoule, right.KilogramsPerJoule); } #endregion @@ -445,25 +444,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BrakeS /// Returns true if less or equal to. public static bool operator <=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -492,7 +491,7 @@ public int CompareTo(object obj) /// public int CompareTo(BrakeSpecificFuelConsumption other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -509,7 +508,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(BrakeSpecificFuelConsumption other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -557,10 +556,8 @@ public bool Equals(BrakeSpecificFuelConsumption other, double tolerance, Comp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -580,17 +577,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(BrakeSpecificFuelConsumptionUnit unit) + public T As(BrakeSpecificFuelConsumptionUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -610,9 +607,14 @@ double IQuantity.As(Enum unit) if(!(unit is BrakeSpecificFuelConsumptionUnit unitAsBrakeSpecificFuelConsumptionUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(BrakeSpecificFuelConsumptionUnit)} is supported.", nameof(unit)); - return As(unitAsBrakeSpecificFuelConsumptionUnit); + var asValue = As(unitAsBrakeSpecificFuelConsumptionUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(BrakeSpecificFuelConsumptionUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -653,21 +655,27 @@ public BrakeSpecificFuelConsumption ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(BrakeSpecificFuelConsumptionUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(BrakeSpecificFuelConsumptionUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour: return _value/3.6e9; - case BrakeSpecificFuelConsumptionUnit.KilogramPerJoule: return _value; - case BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour: return _value*1.689659410672e-7; + case BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour: return Value/3.6e9; + case BrakeSpecificFuelConsumptionUnit.KilogramPerJoule: return Value; + case BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour: return Value*1.689659410672e-7; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -684,10 +692,10 @@ internal BrakeSpecificFuelConsumption ToBaseUnit() return new BrakeSpecificFuelConsumption(baseUnitValue, BaseUnit); } - private double GetValueAs(BrakeSpecificFuelConsumptionUnit unit) + private T GetValueAs(BrakeSpecificFuelConsumptionUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -797,7 +805,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -812,37 +820,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -866,17 +874,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs index 16f9d455e0..194e9ba1c2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Capacitance /// - public partial struct Capacitance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Capacitance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -70,12 +65,12 @@ static Capacitance() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Capacitance(double value, CapacitanceUnit unit) + public Capacitance(T value, CapacitanceUnit unit) { if(unit == CapacitanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -87,14 +82,14 @@ public Capacitance(double value, CapacitanceUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Capacitance(double value, UnitSystem unitSystem) + public Capacitance(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -136,7 +131,7 @@ public Capacitance(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Farad. /// - public static Capacitance Zero { get; } = new Capacitance(0, BaseUnit); + public static Capacitance Zero { get; } = new Capacitance((T)0, BaseUnit); #endregion @@ -145,7 +140,9 @@ public Capacitance(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -175,37 +172,37 @@ public Capacitance(double value, UnitSystem unitSystem) /// /// Get in Farads. /// - public double Farads => As(CapacitanceUnit.Farad); + public T Farads => As(CapacitanceUnit.Farad); /// /// Get in Kilofarads. /// - public double Kilofarads => As(CapacitanceUnit.Kilofarad); + public T Kilofarads => As(CapacitanceUnit.Kilofarad); /// /// Get in Megafarads. /// - public double Megafarads => As(CapacitanceUnit.Megafarad); + public T Megafarads => As(CapacitanceUnit.Megafarad); /// /// Get in Microfarads. /// - public double Microfarads => As(CapacitanceUnit.Microfarad); + public T Microfarads => As(CapacitanceUnit.Microfarad); /// /// Get in Millifarads. /// - public double Millifarads => As(CapacitanceUnit.Millifarad); + public T Millifarads => As(CapacitanceUnit.Millifarad); /// /// Get in Nanofarads. /// - public double Nanofarads => As(CapacitanceUnit.Nanofarad); + public T Nanofarads => As(CapacitanceUnit.Nanofarad); /// /// Get in Picofarads. /// - public double Picofarads => As(CapacitanceUnit.Picofarad); + public T Picofarads => As(CapacitanceUnit.Picofarad); #endregion @@ -240,64 +237,57 @@ public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] IFormatPr /// Get from Farads. /// /// If value is NaN or Infinity. - public static Capacitance FromFarads(QuantityValue farads) + public static Capacitance FromFarads(T farads) { - double value = (double) farads; - return new Capacitance(value, CapacitanceUnit.Farad); + return new Capacitance(farads, CapacitanceUnit.Farad); } /// /// Get from Kilofarads. /// /// If value is NaN or Infinity. - public static Capacitance FromKilofarads(QuantityValue kilofarads) + public static Capacitance FromKilofarads(T kilofarads) { - double value = (double) kilofarads; - return new Capacitance(value, CapacitanceUnit.Kilofarad); + return new Capacitance(kilofarads, CapacitanceUnit.Kilofarad); } /// /// Get from Megafarads. /// /// If value is NaN or Infinity. - public static Capacitance FromMegafarads(QuantityValue megafarads) + public static Capacitance FromMegafarads(T megafarads) { - double value = (double) megafarads; - return new Capacitance(value, CapacitanceUnit.Megafarad); + return new Capacitance(megafarads, CapacitanceUnit.Megafarad); } /// /// Get from Microfarads. /// /// If value is NaN or Infinity. - public static Capacitance FromMicrofarads(QuantityValue microfarads) + public static Capacitance FromMicrofarads(T microfarads) { - double value = (double) microfarads; - return new Capacitance(value, CapacitanceUnit.Microfarad); + return new Capacitance(microfarads, CapacitanceUnit.Microfarad); } /// /// Get from Millifarads. /// /// If value is NaN or Infinity. - public static Capacitance FromMillifarads(QuantityValue millifarads) + public static Capacitance FromMillifarads(T millifarads) { - double value = (double) millifarads; - return new Capacitance(value, CapacitanceUnit.Millifarad); + return new Capacitance(millifarads, CapacitanceUnit.Millifarad); } /// /// Get from Nanofarads. /// /// If value is NaN or Infinity. - public static Capacitance FromNanofarads(QuantityValue nanofarads) + public static Capacitance FromNanofarads(T nanofarads) { - double value = (double) nanofarads; - return new Capacitance(value, CapacitanceUnit.Nanofarad); + return new Capacitance(nanofarads, CapacitanceUnit.Nanofarad); } /// /// Get from Picofarads. /// /// If value is NaN or Infinity. - public static Capacitance FromPicofarads(QuantityValue picofarads) + public static Capacitance FromPicofarads(T picofarads) { - double value = (double) picofarads; - return new Capacitance(value, CapacitanceUnit.Picofarad); + return new Capacitance(picofarads, CapacitanceUnit.Picofarad); } /// @@ -306,9 +296,9 @@ public static Capacitance FromPicofarads(QuantityValue picofarads) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Capacitance From(QuantityValue value, CapacitanceUnit fromUnit) + public static Capacitance From(T value, CapacitanceUnit fromUnit) { - return new Capacitance((double)value, fromUnit); + return new Capacitance(value, fromUnit); } #endregion @@ -462,43 +452,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Capaci /// Negate the value. public static Capacitance operator -(Capacitance right) { - return new Capacitance(-right.Value, right.Unit); + return new Capacitance(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Capacitance operator +(Capacitance left, Capacitance right) { - return new Capacitance(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Capacitance(value, left.Unit); } /// Get from subtracting two . public static Capacitance operator -(Capacitance left, Capacitance right) { - return new Capacitance(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Capacitance(value, left.Unit); } /// Get from multiplying value and . - public static Capacitance operator *(double left, Capacitance right) + public static Capacitance operator *(T left, Capacitance right) { - return new Capacitance(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Capacitance(value, right.Unit); } /// Get from multiplying value and . - public static Capacitance operator *(Capacitance left, double right) + public static Capacitance operator *(Capacitance left, T right) { - return new Capacitance(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Capacitance(value, left.Unit); } /// Get from dividing by value. - public static Capacitance operator /(Capacitance left, double right) + public static Capacitance operator /(Capacitance left, T right) { - return new Capacitance(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Capacitance(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Capacitance left, Capacitance right) + public static T operator /(Capacitance left, Capacitance right) { - return left.Farads / right.Farads; + return CompiledLambdas.Divide(left.Farads, right.Farads); } #endregion @@ -508,25 +503,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Capaci /// Returns true if less or equal to. public static bool operator <=(Capacitance left, Capacitance right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Capacitance left, Capacitance right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Capacitance left, Capacitance right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Capacitance left, Capacitance right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -555,7 +550,7 @@ public int CompareTo(object obj) /// public int CompareTo(Capacitance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -572,7 +567,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Capacitance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -620,10 +615,8 @@ public bool Equals(Capacitance other, double tolerance, ComparisonType compar if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -643,17 +636,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(CapacitanceUnit unit) + public T As(CapacitanceUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -673,9 +666,14 @@ double IQuantity.As(Enum unit) if(!(unit is CapacitanceUnit unitAsCapacitanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(CapacitanceUnit)} is supported.", nameof(unit)); - return As(unitAsCapacitanceUnit); + var asValue = As(unitAsCapacitanceUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(CapacitanceUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -716,25 +714,31 @@ public Capacitance ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(CapacitanceUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(CapacitanceUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case CapacitanceUnit.Farad: return _value; - case CapacitanceUnit.Kilofarad: return (_value) * 1e3d; - case CapacitanceUnit.Megafarad: return (_value) * 1e6d; - case CapacitanceUnit.Microfarad: return (_value) * 1e-6d; - case CapacitanceUnit.Millifarad: return (_value) * 1e-3d; - case CapacitanceUnit.Nanofarad: return (_value) * 1e-9d; - case CapacitanceUnit.Picofarad: return (_value) * 1e-12d; + case CapacitanceUnit.Farad: return Value; + case CapacitanceUnit.Kilofarad: return (Value) * 1e3d; + case CapacitanceUnit.Megafarad: return (Value) * 1e6d; + case CapacitanceUnit.Microfarad: return (Value) * 1e-6d; + case CapacitanceUnit.Millifarad: return (Value) * 1e-3d; + case CapacitanceUnit.Nanofarad: return (Value) * 1e-9d; + case CapacitanceUnit.Picofarad: return (Value) * 1e-12d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -751,10 +755,10 @@ internal Capacitance ToBaseUnit() return new Capacitance(baseUnitValue, BaseUnit); } - private double GetValueAs(CapacitanceUnit unit) + private T GetValueAs(CapacitanceUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -868,7 +872,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -883,37 +887,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -937,17 +941,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs index a26b38f1fe..e708d0fc93 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// A unit that represents a fractional change in size in response to a change in temperature. /// - public partial struct CoefficientOfThermalExpansion : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct CoefficientOfThermalExpansion : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -63,12 +58,12 @@ static CoefficientOfThermalExpansion() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public CoefficientOfThermalExpansion(double value, CoefficientOfThermalExpansionUnit unit) + public CoefficientOfThermalExpansion(T value, CoefficientOfThermalExpansionUnit unit) { if(unit == CoefficientOfThermalExpansionUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -80,14 +75,14 @@ public CoefficientOfThermalExpansion(double value, CoefficientOfThermalExpansion /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public CoefficientOfThermalExpansion(double value, UnitSystem unitSystem) + public CoefficientOfThermalExpansion(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -129,7 +124,7 @@ public CoefficientOfThermalExpansion(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit InverseKelvin. /// - public static CoefficientOfThermalExpansion Zero { get; } = new CoefficientOfThermalExpansion(0, BaseUnit); + public static CoefficientOfThermalExpansion Zero { get; } = new CoefficientOfThermalExpansion((T)0, BaseUnit); #endregion @@ -138,7 +133,9 @@ public CoefficientOfThermalExpansion(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -168,17 +165,17 @@ public CoefficientOfThermalExpansion(double value, UnitSystem unitSystem) /// /// Get in InverseDegreeCelsius. /// - public double InverseDegreeCelsius => As(CoefficientOfThermalExpansionUnit.InverseDegreeCelsius); + public T InverseDegreeCelsius => As(CoefficientOfThermalExpansionUnit.InverseDegreeCelsius); /// /// Get in InverseDegreeFahrenheit. /// - public double InverseDegreeFahrenheit => As(CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit); + public T InverseDegreeFahrenheit => As(CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit); /// /// Get in InverseKelvin. /// - public double InverseKelvin => As(CoefficientOfThermalExpansionUnit.InverseKelvin); + public T InverseKelvin => As(CoefficientOfThermalExpansionUnit.InverseKelvin); #endregion @@ -213,28 +210,25 @@ public static string GetAbbreviation(CoefficientOfThermalExpansionUnit unit, [Ca /// Get from InverseDegreeCelsius. /// /// If value is NaN or Infinity. - public static CoefficientOfThermalExpansion FromInverseDegreeCelsius(QuantityValue inversedegreecelsius) + public static CoefficientOfThermalExpansion FromInverseDegreeCelsius(T inversedegreecelsius) { - double value = (double) inversedegreecelsius; - return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseDegreeCelsius); + return new CoefficientOfThermalExpansion(inversedegreecelsius, CoefficientOfThermalExpansionUnit.InverseDegreeCelsius); } /// /// Get from InverseDegreeFahrenheit. /// /// If value is NaN or Infinity. - public static CoefficientOfThermalExpansion FromInverseDegreeFahrenheit(QuantityValue inversedegreefahrenheit) + public static CoefficientOfThermalExpansion FromInverseDegreeFahrenheit(T inversedegreefahrenheit) { - double value = (double) inversedegreefahrenheit; - return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit); + return new CoefficientOfThermalExpansion(inversedegreefahrenheit, CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit); } /// /// Get from InverseKelvin. /// /// If value is NaN or Infinity. - public static CoefficientOfThermalExpansion FromInverseKelvin(QuantityValue inversekelvin) + public static CoefficientOfThermalExpansion FromInverseKelvin(T inversekelvin) { - double value = (double) inversekelvin; - return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseKelvin); + return new CoefficientOfThermalExpansion(inversekelvin, CoefficientOfThermalExpansionUnit.InverseKelvin); } /// @@ -243,9 +237,9 @@ public static CoefficientOfThermalExpansion FromInverseKelvin(QuantityValue i /// Value to convert from. /// Unit to convert from. /// unit value. - public static CoefficientOfThermalExpansion From(QuantityValue value, CoefficientOfThermalExpansionUnit fromUnit) + public static CoefficientOfThermalExpansion From(T value, CoefficientOfThermalExpansionUnit fromUnit) { - return new CoefficientOfThermalExpansion((double)value, fromUnit); + return new CoefficientOfThermalExpansion(value, fromUnit); } #endregion @@ -399,43 +393,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Coeffi /// Negate the value. public static CoefficientOfThermalExpansion operator -(CoefficientOfThermalExpansion right) { - return new CoefficientOfThermalExpansion(-right.Value, right.Unit); + return new CoefficientOfThermalExpansion(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static CoefficientOfThermalExpansion operator +(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { - return new CoefficientOfThermalExpansion(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new CoefficientOfThermalExpansion(value, left.Unit); } /// Get from subtracting two . public static CoefficientOfThermalExpansion operator -(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { - return new CoefficientOfThermalExpansion(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new CoefficientOfThermalExpansion(value, left.Unit); } /// Get from multiplying value and . - public static CoefficientOfThermalExpansion operator *(double left, CoefficientOfThermalExpansion right) + public static CoefficientOfThermalExpansion operator *(T left, CoefficientOfThermalExpansion right) { - return new CoefficientOfThermalExpansion(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new CoefficientOfThermalExpansion(value, right.Unit); } /// Get from multiplying value and . - public static CoefficientOfThermalExpansion operator *(CoefficientOfThermalExpansion left, double right) + public static CoefficientOfThermalExpansion operator *(CoefficientOfThermalExpansion left, T right) { - return new CoefficientOfThermalExpansion(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new CoefficientOfThermalExpansion(value, left.Unit); } /// Get from dividing by value. - public static CoefficientOfThermalExpansion operator /(CoefficientOfThermalExpansion left, double right) + public static CoefficientOfThermalExpansion operator /(CoefficientOfThermalExpansion left, T right) { - return new CoefficientOfThermalExpansion(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new CoefficientOfThermalExpansion(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + public static T operator /(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { - return left.InverseKelvin / right.InverseKelvin; + return CompiledLambdas.Divide(left.InverseKelvin, right.InverseKelvin); } #endregion @@ -445,25 +444,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Coeffi /// Returns true if less or equal to. public static bool operator <=(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -492,7 +491,7 @@ public int CompareTo(object obj) /// public int CompareTo(CoefficientOfThermalExpansion other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -509,7 +508,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(CoefficientOfThermalExpansion other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -557,10 +556,8 @@ public bool Equals(CoefficientOfThermalExpansion other, double tolerance, Com if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -580,17 +577,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(CoefficientOfThermalExpansionUnit unit) + public T As(CoefficientOfThermalExpansionUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -610,9 +607,14 @@ double IQuantity.As(Enum unit) if(!(unit is CoefficientOfThermalExpansionUnit unitAsCoefficientOfThermalExpansionUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(CoefficientOfThermalExpansionUnit)} is supported.", nameof(unit)); - return As(unitAsCoefficientOfThermalExpansionUnit); + var asValue = As(unitAsCoefficientOfThermalExpansionUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(CoefficientOfThermalExpansionUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -653,21 +655,27 @@ public CoefficientOfThermalExpansion ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(CoefficientOfThermalExpansionUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(CoefficientOfThermalExpansionUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case CoefficientOfThermalExpansionUnit.InverseDegreeCelsius: return _value; - case CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit: return _value*5/9; - case CoefficientOfThermalExpansionUnit.InverseKelvin: return _value; + case CoefficientOfThermalExpansionUnit.InverseDegreeCelsius: return Value; + case CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit: return Value*5/9; + case CoefficientOfThermalExpansionUnit.InverseKelvin: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -684,10 +692,10 @@ internal CoefficientOfThermalExpansion ToBaseUnit() return new CoefficientOfThermalExpansion(baseUnitValue, BaseUnit); } - private double GetValueAs(CoefficientOfThermalExpansionUnit unit) + private T GetValueAs(CoefficientOfThermalExpansionUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -797,7 +805,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -812,37 +820,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -866,17 +874,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs index e45edc3283..6dc9ff994c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// http://en.wikipedia.org/wiki/Density /// - public partial struct Density : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Density : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -103,12 +98,12 @@ static Density() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Density(double value, DensityUnit unit) + public Density(T value, DensityUnit unit) { if(unit == DensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -120,14 +115,14 @@ public Density(double value, DensityUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Density(double value, UnitSystem unitSystem) + public Density(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -169,7 +164,7 @@ public Density(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerCubicMeter. /// - public static Density Zero { get; } = new Density(0, BaseUnit); + public static Density Zero { get; } = new Density((T)0, BaseUnit); #endregion @@ -178,7 +173,9 @@ public Density(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -208,202 +205,202 @@ public Density(double value, UnitSystem unitSystem) /// /// Get in CentigramsPerDeciLiter. /// - public double CentigramsPerDeciLiter => As(DensityUnit.CentigramPerDeciliter); + public T CentigramsPerDeciLiter => As(DensityUnit.CentigramPerDeciliter); /// /// Get in CentigramsPerLiter. /// - public double CentigramsPerLiter => As(DensityUnit.CentigramPerLiter); + public T CentigramsPerLiter => As(DensityUnit.CentigramPerLiter); /// /// Get in CentigramsPerMilliliter. /// - public double CentigramsPerMilliliter => As(DensityUnit.CentigramPerMilliliter); + public T CentigramsPerMilliliter => As(DensityUnit.CentigramPerMilliliter); /// /// Get in DecigramsPerDeciLiter. /// - public double DecigramsPerDeciLiter => As(DensityUnit.DecigramPerDeciliter); + public T DecigramsPerDeciLiter => As(DensityUnit.DecigramPerDeciliter); /// /// Get in DecigramsPerLiter. /// - public double DecigramsPerLiter => As(DensityUnit.DecigramPerLiter); + public T DecigramsPerLiter => As(DensityUnit.DecigramPerLiter); /// /// Get in DecigramsPerMilliliter. /// - public double DecigramsPerMilliliter => As(DensityUnit.DecigramPerMilliliter); + public T DecigramsPerMilliliter => As(DensityUnit.DecigramPerMilliliter); /// /// Get in GramsPerCubicCentimeter. /// - public double GramsPerCubicCentimeter => As(DensityUnit.GramPerCubicCentimeter); + public T GramsPerCubicCentimeter => As(DensityUnit.GramPerCubicCentimeter); /// /// Get in GramsPerCubicMeter. /// - public double GramsPerCubicMeter => As(DensityUnit.GramPerCubicMeter); + public T GramsPerCubicMeter => As(DensityUnit.GramPerCubicMeter); /// /// Get in GramsPerCubicMillimeter. /// - public double GramsPerCubicMillimeter => As(DensityUnit.GramPerCubicMillimeter); + public T GramsPerCubicMillimeter => As(DensityUnit.GramPerCubicMillimeter); /// /// Get in GramsPerDeciLiter. /// - public double GramsPerDeciLiter => As(DensityUnit.GramPerDeciliter); + public T GramsPerDeciLiter => As(DensityUnit.GramPerDeciliter); /// /// Get in GramsPerLiter. /// - public double GramsPerLiter => As(DensityUnit.GramPerLiter); + public T GramsPerLiter => As(DensityUnit.GramPerLiter); /// /// Get in GramsPerMilliliter. /// - public double GramsPerMilliliter => As(DensityUnit.GramPerMilliliter); + public T GramsPerMilliliter => As(DensityUnit.GramPerMilliliter); /// /// Get in KilogramsPerCubicCentimeter. /// - public double KilogramsPerCubicCentimeter => As(DensityUnit.KilogramPerCubicCentimeter); + public T KilogramsPerCubicCentimeter => As(DensityUnit.KilogramPerCubicCentimeter); /// /// Get in KilogramsPerCubicMeter. /// - public double KilogramsPerCubicMeter => As(DensityUnit.KilogramPerCubicMeter); + public T KilogramsPerCubicMeter => As(DensityUnit.KilogramPerCubicMeter); /// /// Get in KilogramsPerCubicMillimeter. /// - public double KilogramsPerCubicMillimeter => As(DensityUnit.KilogramPerCubicMillimeter); + public T KilogramsPerCubicMillimeter => As(DensityUnit.KilogramPerCubicMillimeter); /// /// Get in KilogramsPerLiter. /// - public double KilogramsPerLiter => As(DensityUnit.KilogramPerLiter); + public T KilogramsPerLiter => As(DensityUnit.KilogramPerLiter); /// /// Get in KilopoundsPerCubicFoot. /// - public double KilopoundsPerCubicFoot => As(DensityUnit.KilopoundPerCubicFoot); + public T KilopoundsPerCubicFoot => As(DensityUnit.KilopoundPerCubicFoot); /// /// Get in KilopoundsPerCubicInch. /// - public double KilopoundsPerCubicInch => As(DensityUnit.KilopoundPerCubicInch); + public T KilopoundsPerCubicInch => As(DensityUnit.KilopoundPerCubicInch); /// /// Get in MicrogramsPerCubicMeter. /// - public double MicrogramsPerCubicMeter => As(DensityUnit.MicrogramPerCubicMeter); + public T MicrogramsPerCubicMeter => As(DensityUnit.MicrogramPerCubicMeter); /// /// Get in MicrogramsPerDeciLiter. /// - public double MicrogramsPerDeciLiter => As(DensityUnit.MicrogramPerDeciliter); + public T MicrogramsPerDeciLiter => As(DensityUnit.MicrogramPerDeciliter); /// /// Get in MicrogramsPerLiter. /// - public double MicrogramsPerLiter => As(DensityUnit.MicrogramPerLiter); + public T MicrogramsPerLiter => As(DensityUnit.MicrogramPerLiter); /// /// Get in MicrogramsPerMilliliter. /// - public double MicrogramsPerMilliliter => As(DensityUnit.MicrogramPerMilliliter); + public T MicrogramsPerMilliliter => As(DensityUnit.MicrogramPerMilliliter); /// /// Get in MilligramsPerCubicMeter. /// - public double MilligramsPerCubicMeter => As(DensityUnit.MilligramPerCubicMeter); + public T MilligramsPerCubicMeter => As(DensityUnit.MilligramPerCubicMeter); /// /// Get in MilligramsPerDeciLiter. /// - public double MilligramsPerDeciLiter => As(DensityUnit.MilligramPerDeciliter); + public T MilligramsPerDeciLiter => As(DensityUnit.MilligramPerDeciliter); /// /// Get in MilligramsPerLiter. /// - public double MilligramsPerLiter => As(DensityUnit.MilligramPerLiter); + public T MilligramsPerLiter => As(DensityUnit.MilligramPerLiter); /// /// Get in MilligramsPerMilliliter. /// - public double MilligramsPerMilliliter => As(DensityUnit.MilligramPerMilliliter); + public T MilligramsPerMilliliter => As(DensityUnit.MilligramPerMilliliter); /// /// Get in NanogramsPerDeciLiter. /// - public double NanogramsPerDeciLiter => As(DensityUnit.NanogramPerDeciliter); + public T NanogramsPerDeciLiter => As(DensityUnit.NanogramPerDeciliter); /// /// Get in NanogramsPerLiter. /// - public double NanogramsPerLiter => As(DensityUnit.NanogramPerLiter); + public T NanogramsPerLiter => As(DensityUnit.NanogramPerLiter); /// /// Get in NanogramsPerMilliliter. /// - public double NanogramsPerMilliliter => As(DensityUnit.NanogramPerMilliliter); + public T NanogramsPerMilliliter => As(DensityUnit.NanogramPerMilliliter); /// /// Get in PicogramsPerDeciLiter. /// - public double PicogramsPerDeciLiter => As(DensityUnit.PicogramPerDeciliter); + public T PicogramsPerDeciLiter => As(DensityUnit.PicogramPerDeciliter); /// /// Get in PicogramsPerLiter. /// - public double PicogramsPerLiter => As(DensityUnit.PicogramPerLiter); + public T PicogramsPerLiter => As(DensityUnit.PicogramPerLiter); /// /// Get in PicogramsPerMilliliter. /// - public double PicogramsPerMilliliter => As(DensityUnit.PicogramPerMilliliter); + public T PicogramsPerMilliliter => As(DensityUnit.PicogramPerMilliliter); /// /// Get in PoundsPerCubicFoot. /// - public double PoundsPerCubicFoot => As(DensityUnit.PoundPerCubicFoot); + public T PoundsPerCubicFoot => As(DensityUnit.PoundPerCubicFoot); /// /// Get in PoundsPerCubicInch. /// - public double PoundsPerCubicInch => As(DensityUnit.PoundPerCubicInch); + public T PoundsPerCubicInch => As(DensityUnit.PoundPerCubicInch); /// /// Get in PoundsPerImperialGallon. /// - public double PoundsPerImperialGallon => As(DensityUnit.PoundPerImperialGallon); + public T PoundsPerImperialGallon => As(DensityUnit.PoundPerImperialGallon); /// /// Get in PoundsPerUSGallon. /// - public double PoundsPerUSGallon => As(DensityUnit.PoundPerUSGallon); + public T PoundsPerUSGallon => As(DensityUnit.PoundPerUSGallon); /// /// Get in SlugsPerCubicFoot. /// - public double SlugsPerCubicFoot => As(DensityUnit.SlugPerCubicFoot); + public T SlugsPerCubicFoot => As(DensityUnit.SlugPerCubicFoot); /// /// Get in TonnesPerCubicCentimeter. /// - public double TonnesPerCubicCentimeter => As(DensityUnit.TonnePerCubicCentimeter); + public T TonnesPerCubicCentimeter => As(DensityUnit.TonnePerCubicCentimeter); /// /// Get in TonnesPerCubicMeter. /// - public double TonnesPerCubicMeter => As(DensityUnit.TonnePerCubicMeter); + public T TonnesPerCubicMeter => As(DensityUnit.TonnePerCubicMeter); /// /// Get in TonnesPerCubicMillimeter. /// - public double TonnesPerCubicMillimeter => As(DensityUnit.TonnePerCubicMillimeter); + public T TonnesPerCubicMillimeter => As(DensityUnit.TonnePerCubicMillimeter); #endregion @@ -438,361 +435,321 @@ public static string GetAbbreviation(DensityUnit unit, [CanBeNull] IFormatProvid /// Get from CentigramsPerDeciLiter. /// /// If value is NaN or Infinity. - public static Density FromCentigramsPerDeciLiter(QuantityValue centigramsperdeciliter) + public static Density FromCentigramsPerDeciLiter(T centigramsperdeciliter) { - double value = (double) centigramsperdeciliter; - return new Density(value, DensityUnit.CentigramPerDeciliter); + return new Density(centigramsperdeciliter, DensityUnit.CentigramPerDeciliter); } /// /// Get from CentigramsPerLiter. /// /// If value is NaN or Infinity. - public static Density FromCentigramsPerLiter(QuantityValue centigramsperliter) + public static Density FromCentigramsPerLiter(T centigramsperliter) { - double value = (double) centigramsperliter; - return new Density(value, DensityUnit.CentigramPerLiter); + return new Density(centigramsperliter, DensityUnit.CentigramPerLiter); } /// /// Get from CentigramsPerMilliliter. /// /// If value is NaN or Infinity. - public static Density FromCentigramsPerMilliliter(QuantityValue centigramspermilliliter) + public static Density FromCentigramsPerMilliliter(T centigramspermilliliter) { - double value = (double) centigramspermilliliter; - return new Density(value, DensityUnit.CentigramPerMilliliter); + return new Density(centigramspermilliliter, DensityUnit.CentigramPerMilliliter); } /// /// Get from DecigramsPerDeciLiter. /// /// If value is NaN or Infinity. - public static Density FromDecigramsPerDeciLiter(QuantityValue decigramsperdeciliter) + public static Density FromDecigramsPerDeciLiter(T decigramsperdeciliter) { - double value = (double) decigramsperdeciliter; - return new Density(value, DensityUnit.DecigramPerDeciliter); + return new Density(decigramsperdeciliter, DensityUnit.DecigramPerDeciliter); } /// /// Get from DecigramsPerLiter. /// /// If value is NaN or Infinity. - public static Density FromDecigramsPerLiter(QuantityValue decigramsperliter) + public static Density FromDecigramsPerLiter(T decigramsperliter) { - double value = (double) decigramsperliter; - return new Density(value, DensityUnit.DecigramPerLiter); + return new Density(decigramsperliter, DensityUnit.DecigramPerLiter); } /// /// Get from DecigramsPerMilliliter. /// /// If value is NaN or Infinity. - public static Density FromDecigramsPerMilliliter(QuantityValue decigramspermilliliter) + public static Density FromDecigramsPerMilliliter(T decigramspermilliliter) { - double value = (double) decigramspermilliliter; - return new Density(value, DensityUnit.DecigramPerMilliliter); + return new Density(decigramspermilliliter, DensityUnit.DecigramPerMilliliter); } /// /// Get from GramsPerCubicCentimeter. /// /// If value is NaN or Infinity. - public static Density FromGramsPerCubicCentimeter(QuantityValue gramspercubiccentimeter) + public static Density FromGramsPerCubicCentimeter(T gramspercubiccentimeter) { - double value = (double) gramspercubiccentimeter; - return new Density(value, DensityUnit.GramPerCubicCentimeter); + return new Density(gramspercubiccentimeter, DensityUnit.GramPerCubicCentimeter); } /// /// Get from GramsPerCubicMeter. /// /// If value is NaN or Infinity. - public static Density FromGramsPerCubicMeter(QuantityValue gramspercubicmeter) + public static Density FromGramsPerCubicMeter(T gramspercubicmeter) { - double value = (double) gramspercubicmeter; - return new Density(value, DensityUnit.GramPerCubicMeter); + return new Density(gramspercubicmeter, DensityUnit.GramPerCubicMeter); } /// /// Get from GramsPerCubicMillimeter. /// /// If value is NaN or Infinity. - public static Density FromGramsPerCubicMillimeter(QuantityValue gramspercubicmillimeter) + public static Density FromGramsPerCubicMillimeter(T gramspercubicmillimeter) { - double value = (double) gramspercubicmillimeter; - return new Density(value, DensityUnit.GramPerCubicMillimeter); + return new Density(gramspercubicmillimeter, DensityUnit.GramPerCubicMillimeter); } /// /// Get from GramsPerDeciLiter. /// /// If value is NaN or Infinity. - public static Density FromGramsPerDeciLiter(QuantityValue gramsperdeciliter) + public static Density FromGramsPerDeciLiter(T gramsperdeciliter) { - double value = (double) gramsperdeciliter; - return new Density(value, DensityUnit.GramPerDeciliter); + return new Density(gramsperdeciliter, DensityUnit.GramPerDeciliter); } /// /// Get from GramsPerLiter. /// /// If value is NaN or Infinity. - public static Density FromGramsPerLiter(QuantityValue gramsperliter) + public static Density FromGramsPerLiter(T gramsperliter) { - double value = (double) gramsperliter; - return new Density(value, DensityUnit.GramPerLiter); + return new Density(gramsperliter, DensityUnit.GramPerLiter); } /// /// Get from GramsPerMilliliter. /// /// If value is NaN or Infinity. - public static Density FromGramsPerMilliliter(QuantityValue gramspermilliliter) + public static Density FromGramsPerMilliliter(T gramspermilliliter) { - double value = (double) gramspermilliliter; - return new Density(value, DensityUnit.GramPerMilliliter); + return new Density(gramspermilliliter, DensityUnit.GramPerMilliliter); } /// /// Get from KilogramsPerCubicCentimeter. /// /// If value is NaN or Infinity. - public static Density FromKilogramsPerCubicCentimeter(QuantityValue kilogramspercubiccentimeter) + public static Density FromKilogramsPerCubicCentimeter(T kilogramspercubiccentimeter) { - double value = (double) kilogramspercubiccentimeter; - return new Density(value, DensityUnit.KilogramPerCubicCentimeter); + return new Density(kilogramspercubiccentimeter, DensityUnit.KilogramPerCubicCentimeter); } /// /// Get from KilogramsPerCubicMeter. /// /// If value is NaN or Infinity. - public static Density FromKilogramsPerCubicMeter(QuantityValue kilogramspercubicmeter) + public static Density FromKilogramsPerCubicMeter(T kilogramspercubicmeter) { - double value = (double) kilogramspercubicmeter; - return new Density(value, DensityUnit.KilogramPerCubicMeter); + return new Density(kilogramspercubicmeter, DensityUnit.KilogramPerCubicMeter); } /// /// Get from KilogramsPerCubicMillimeter. /// /// If value is NaN or Infinity. - public static Density FromKilogramsPerCubicMillimeter(QuantityValue kilogramspercubicmillimeter) + public static Density FromKilogramsPerCubicMillimeter(T kilogramspercubicmillimeter) { - double value = (double) kilogramspercubicmillimeter; - return new Density(value, DensityUnit.KilogramPerCubicMillimeter); + return new Density(kilogramspercubicmillimeter, DensityUnit.KilogramPerCubicMillimeter); } /// /// Get from KilogramsPerLiter. /// /// If value is NaN or Infinity. - public static Density FromKilogramsPerLiter(QuantityValue kilogramsperliter) + public static Density FromKilogramsPerLiter(T kilogramsperliter) { - double value = (double) kilogramsperliter; - return new Density(value, DensityUnit.KilogramPerLiter); + return new Density(kilogramsperliter, DensityUnit.KilogramPerLiter); } /// /// Get from KilopoundsPerCubicFoot. /// /// If value is NaN or Infinity. - public static Density FromKilopoundsPerCubicFoot(QuantityValue kilopoundspercubicfoot) + public static Density FromKilopoundsPerCubicFoot(T kilopoundspercubicfoot) { - double value = (double) kilopoundspercubicfoot; - return new Density(value, DensityUnit.KilopoundPerCubicFoot); + return new Density(kilopoundspercubicfoot, DensityUnit.KilopoundPerCubicFoot); } /// /// Get from KilopoundsPerCubicInch. /// /// If value is NaN or Infinity. - public static Density FromKilopoundsPerCubicInch(QuantityValue kilopoundspercubicinch) + public static Density FromKilopoundsPerCubicInch(T kilopoundspercubicinch) { - double value = (double) kilopoundspercubicinch; - return new Density(value, DensityUnit.KilopoundPerCubicInch); + return new Density(kilopoundspercubicinch, DensityUnit.KilopoundPerCubicInch); } /// /// Get from MicrogramsPerCubicMeter. /// /// If value is NaN or Infinity. - public static Density FromMicrogramsPerCubicMeter(QuantityValue microgramspercubicmeter) + public static Density FromMicrogramsPerCubicMeter(T microgramspercubicmeter) { - double value = (double) microgramspercubicmeter; - return new Density(value, DensityUnit.MicrogramPerCubicMeter); + return new Density(microgramspercubicmeter, DensityUnit.MicrogramPerCubicMeter); } /// /// Get from MicrogramsPerDeciLiter. /// /// If value is NaN or Infinity. - public static Density FromMicrogramsPerDeciLiter(QuantityValue microgramsperdeciliter) + public static Density FromMicrogramsPerDeciLiter(T microgramsperdeciliter) { - double value = (double) microgramsperdeciliter; - return new Density(value, DensityUnit.MicrogramPerDeciliter); + return new Density(microgramsperdeciliter, DensityUnit.MicrogramPerDeciliter); } /// /// Get from MicrogramsPerLiter. /// /// If value is NaN or Infinity. - public static Density FromMicrogramsPerLiter(QuantityValue microgramsperliter) + public static Density FromMicrogramsPerLiter(T microgramsperliter) { - double value = (double) microgramsperliter; - return new Density(value, DensityUnit.MicrogramPerLiter); + return new Density(microgramsperliter, DensityUnit.MicrogramPerLiter); } /// /// Get from MicrogramsPerMilliliter. /// /// If value is NaN or Infinity. - public static Density FromMicrogramsPerMilliliter(QuantityValue microgramspermilliliter) + public static Density FromMicrogramsPerMilliliter(T microgramspermilliliter) { - double value = (double) microgramspermilliliter; - return new Density(value, DensityUnit.MicrogramPerMilliliter); + return new Density(microgramspermilliliter, DensityUnit.MicrogramPerMilliliter); } /// /// Get from MilligramsPerCubicMeter. /// /// If value is NaN or Infinity. - public static Density FromMilligramsPerCubicMeter(QuantityValue milligramspercubicmeter) + public static Density FromMilligramsPerCubicMeter(T milligramspercubicmeter) { - double value = (double) milligramspercubicmeter; - return new Density(value, DensityUnit.MilligramPerCubicMeter); + return new Density(milligramspercubicmeter, DensityUnit.MilligramPerCubicMeter); } /// /// Get from MilligramsPerDeciLiter. /// /// If value is NaN or Infinity. - public static Density FromMilligramsPerDeciLiter(QuantityValue milligramsperdeciliter) + public static Density FromMilligramsPerDeciLiter(T milligramsperdeciliter) { - double value = (double) milligramsperdeciliter; - return new Density(value, DensityUnit.MilligramPerDeciliter); + return new Density(milligramsperdeciliter, DensityUnit.MilligramPerDeciliter); } /// /// Get from MilligramsPerLiter. /// /// If value is NaN or Infinity. - public static Density FromMilligramsPerLiter(QuantityValue milligramsperliter) + public static Density FromMilligramsPerLiter(T milligramsperliter) { - double value = (double) milligramsperliter; - return new Density(value, DensityUnit.MilligramPerLiter); + return new Density(milligramsperliter, DensityUnit.MilligramPerLiter); } /// /// Get from MilligramsPerMilliliter. /// /// If value is NaN or Infinity. - public static Density FromMilligramsPerMilliliter(QuantityValue milligramspermilliliter) + public static Density FromMilligramsPerMilliliter(T milligramspermilliliter) { - double value = (double) milligramspermilliliter; - return new Density(value, DensityUnit.MilligramPerMilliliter); + return new Density(milligramspermilliliter, DensityUnit.MilligramPerMilliliter); } /// /// Get from NanogramsPerDeciLiter. /// /// If value is NaN or Infinity. - public static Density FromNanogramsPerDeciLiter(QuantityValue nanogramsperdeciliter) + public static Density FromNanogramsPerDeciLiter(T nanogramsperdeciliter) { - double value = (double) nanogramsperdeciliter; - return new Density(value, DensityUnit.NanogramPerDeciliter); + return new Density(nanogramsperdeciliter, DensityUnit.NanogramPerDeciliter); } /// /// Get from NanogramsPerLiter. /// /// If value is NaN or Infinity. - public static Density FromNanogramsPerLiter(QuantityValue nanogramsperliter) + public static Density FromNanogramsPerLiter(T nanogramsperliter) { - double value = (double) nanogramsperliter; - return new Density(value, DensityUnit.NanogramPerLiter); + return new Density(nanogramsperliter, DensityUnit.NanogramPerLiter); } /// /// Get from NanogramsPerMilliliter. /// /// If value is NaN or Infinity. - public static Density FromNanogramsPerMilliliter(QuantityValue nanogramspermilliliter) + public static Density FromNanogramsPerMilliliter(T nanogramspermilliliter) { - double value = (double) nanogramspermilliliter; - return new Density(value, DensityUnit.NanogramPerMilliliter); + return new Density(nanogramspermilliliter, DensityUnit.NanogramPerMilliliter); } /// /// Get from PicogramsPerDeciLiter. /// /// If value is NaN or Infinity. - public static Density FromPicogramsPerDeciLiter(QuantityValue picogramsperdeciliter) + public static Density FromPicogramsPerDeciLiter(T picogramsperdeciliter) { - double value = (double) picogramsperdeciliter; - return new Density(value, DensityUnit.PicogramPerDeciliter); + return new Density(picogramsperdeciliter, DensityUnit.PicogramPerDeciliter); } /// /// Get from PicogramsPerLiter. /// /// If value is NaN or Infinity. - public static Density FromPicogramsPerLiter(QuantityValue picogramsperliter) + public static Density FromPicogramsPerLiter(T picogramsperliter) { - double value = (double) picogramsperliter; - return new Density(value, DensityUnit.PicogramPerLiter); + return new Density(picogramsperliter, DensityUnit.PicogramPerLiter); } /// /// Get from PicogramsPerMilliliter. /// /// If value is NaN or Infinity. - public static Density FromPicogramsPerMilliliter(QuantityValue picogramspermilliliter) + public static Density FromPicogramsPerMilliliter(T picogramspermilliliter) { - double value = (double) picogramspermilliliter; - return new Density(value, DensityUnit.PicogramPerMilliliter); + return new Density(picogramspermilliliter, DensityUnit.PicogramPerMilliliter); } /// /// Get from PoundsPerCubicFoot. /// /// If value is NaN or Infinity. - public static Density FromPoundsPerCubicFoot(QuantityValue poundspercubicfoot) + public static Density FromPoundsPerCubicFoot(T poundspercubicfoot) { - double value = (double) poundspercubicfoot; - return new Density(value, DensityUnit.PoundPerCubicFoot); + return new Density(poundspercubicfoot, DensityUnit.PoundPerCubicFoot); } /// /// Get from PoundsPerCubicInch. /// /// If value is NaN or Infinity. - public static Density FromPoundsPerCubicInch(QuantityValue poundspercubicinch) + public static Density FromPoundsPerCubicInch(T poundspercubicinch) { - double value = (double) poundspercubicinch; - return new Density(value, DensityUnit.PoundPerCubicInch); + return new Density(poundspercubicinch, DensityUnit.PoundPerCubicInch); } /// /// Get from PoundsPerImperialGallon. /// /// If value is NaN or Infinity. - public static Density FromPoundsPerImperialGallon(QuantityValue poundsperimperialgallon) + public static Density FromPoundsPerImperialGallon(T poundsperimperialgallon) { - double value = (double) poundsperimperialgallon; - return new Density(value, DensityUnit.PoundPerImperialGallon); + return new Density(poundsperimperialgallon, DensityUnit.PoundPerImperialGallon); } /// /// Get from PoundsPerUSGallon. /// /// If value is NaN or Infinity. - public static Density FromPoundsPerUSGallon(QuantityValue poundsperusgallon) + public static Density FromPoundsPerUSGallon(T poundsperusgallon) { - double value = (double) poundsperusgallon; - return new Density(value, DensityUnit.PoundPerUSGallon); + return new Density(poundsperusgallon, DensityUnit.PoundPerUSGallon); } /// /// Get from SlugsPerCubicFoot. /// /// If value is NaN or Infinity. - public static Density FromSlugsPerCubicFoot(QuantityValue slugspercubicfoot) + public static Density FromSlugsPerCubicFoot(T slugspercubicfoot) { - double value = (double) slugspercubicfoot; - return new Density(value, DensityUnit.SlugPerCubicFoot); + return new Density(slugspercubicfoot, DensityUnit.SlugPerCubicFoot); } /// /// Get from TonnesPerCubicCentimeter. /// /// If value is NaN or Infinity. - public static Density FromTonnesPerCubicCentimeter(QuantityValue tonnespercubiccentimeter) + public static Density FromTonnesPerCubicCentimeter(T tonnespercubiccentimeter) { - double value = (double) tonnespercubiccentimeter; - return new Density(value, DensityUnit.TonnePerCubicCentimeter); + return new Density(tonnespercubiccentimeter, DensityUnit.TonnePerCubicCentimeter); } /// /// Get from TonnesPerCubicMeter. /// /// If value is NaN or Infinity. - public static Density FromTonnesPerCubicMeter(QuantityValue tonnespercubicmeter) + public static Density FromTonnesPerCubicMeter(T tonnespercubicmeter) { - double value = (double) tonnespercubicmeter; - return new Density(value, DensityUnit.TonnePerCubicMeter); + return new Density(tonnespercubicmeter, DensityUnit.TonnePerCubicMeter); } /// /// Get from TonnesPerCubicMillimeter. /// /// If value is NaN or Infinity. - public static Density FromTonnesPerCubicMillimeter(QuantityValue tonnespercubicmillimeter) + public static Density FromTonnesPerCubicMillimeter(T tonnespercubicmillimeter) { - double value = (double) tonnespercubicmillimeter; - return new Density(value, DensityUnit.TonnePerCubicMillimeter); + return new Density(tonnespercubicmillimeter, DensityUnit.TonnePerCubicMillimeter); } /// @@ -801,9 +758,9 @@ public static Density FromTonnesPerCubicMillimeter(QuantityValue tonnespercub /// Value to convert from. /// Unit to convert from. /// unit value. - public static Density From(QuantityValue value, DensityUnit fromUnit) + public static Density From(T value, DensityUnit fromUnit) { - return new Density((double)value, fromUnit); + return new Density(value, fromUnit); } #endregion @@ -957,43 +914,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Densit /// Negate the value. public static Density operator -(Density right) { - return new Density(-right.Value, right.Unit); + return new Density(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Density operator +(Density left, Density right) { - return new Density(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Density(value, left.Unit); } /// Get from subtracting two . public static Density operator -(Density left, Density right) { - return new Density(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Density(value, left.Unit); } /// Get from multiplying value and . - public static Density operator *(double left, Density right) + public static Density operator *(T left, Density right) { - return new Density(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Density(value, right.Unit); } /// Get from multiplying value and . - public static Density operator *(Density left, double right) + public static Density operator *(Density left, T right) { - return new Density(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Density(value, left.Unit); } /// Get from dividing by value. - public static Density operator /(Density left, double right) + public static Density operator /(Density left, T right) { - return new Density(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Density(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Density left, Density right) + public static T operator /(Density left, Density right) { - return left.KilogramsPerCubicMeter / right.KilogramsPerCubicMeter; + return CompiledLambdas.Divide(left.KilogramsPerCubicMeter, right.KilogramsPerCubicMeter); } #endregion @@ -1003,25 +965,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Densit /// Returns true if less or equal to. public static bool operator <=(Density left, Density right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Density left, Density right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Density left, Density right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Density left, Density right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -1050,7 +1012,7 @@ public int CompareTo(object obj) /// public int CompareTo(Density other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -1067,7 +1029,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Density other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1115,10 +1077,8 @@ public bool Equals(Density other, double tolerance, ComparisonType comparison if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -1138,17 +1098,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(DensityUnit unit) + public T As(DensityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1168,9 +1128,14 @@ double IQuantity.As(Enum unit) if(!(unit is DensityUnit unitAsDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DensityUnit)} is supported.", nameof(unit)); - return As(unitAsDensityUnit); + var asValue = As(unitAsDensityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(DensityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -1211,58 +1176,64 @@ public Density ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(DensityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(DensityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case DensityUnit.CentigramPerDeciliter: return (_value/1e-1) * 1e-2d; - case DensityUnit.CentigramPerLiter: return (_value/1) * 1e-2d; - case DensityUnit.CentigramPerMilliliter: return (_value/1e-3) * 1e-2d; - case DensityUnit.DecigramPerDeciliter: return (_value/1e-1) * 1e-1d; - case DensityUnit.DecigramPerLiter: return (_value/1) * 1e-1d; - case DensityUnit.DecigramPerMilliliter: return (_value/1e-3) * 1e-1d; - case DensityUnit.GramPerCubicCentimeter: return _value/1e-3; - case DensityUnit.GramPerCubicMeter: return _value/1e3; - case DensityUnit.GramPerCubicMillimeter: return _value/1e-6; - case DensityUnit.GramPerDeciliter: return _value/1e-1; - case DensityUnit.GramPerLiter: return _value/1; - case DensityUnit.GramPerMilliliter: return _value/1e-3; - case DensityUnit.KilogramPerCubicCentimeter: return (_value/1e-3) * 1e3d; - case DensityUnit.KilogramPerCubicMeter: return (_value/1e3) * 1e3d; - case DensityUnit.KilogramPerCubicMillimeter: return (_value/1e-6) * 1e3d; - case DensityUnit.KilogramPerLiter: return _value*1e3; - case DensityUnit.KilopoundPerCubicFoot: return (_value/0.062427961) * 1e3d; - case DensityUnit.KilopoundPerCubicInch: return (_value/3.6127298147753e-5) * 1e3d; - case DensityUnit.MicrogramPerCubicMeter: return (_value/1e3) * 1e-6d; - case DensityUnit.MicrogramPerDeciliter: return (_value/1e-1) * 1e-6d; - case DensityUnit.MicrogramPerLiter: return (_value/1) * 1e-6d; - case DensityUnit.MicrogramPerMilliliter: return (_value/1e-3) * 1e-6d; - case DensityUnit.MilligramPerCubicMeter: return (_value/1e3) * 1e-3d; - case DensityUnit.MilligramPerDeciliter: return (_value/1e-1) * 1e-3d; - case DensityUnit.MilligramPerLiter: return (_value/1) * 1e-3d; - case DensityUnit.MilligramPerMilliliter: return (_value/1e-3) * 1e-3d; - case DensityUnit.NanogramPerDeciliter: return (_value/1e-1) * 1e-9d; - case DensityUnit.NanogramPerLiter: return (_value/1) * 1e-9d; - case DensityUnit.NanogramPerMilliliter: return (_value/1e-3) * 1e-9d; - case DensityUnit.PicogramPerDeciliter: return (_value/1e-1) * 1e-12d; - case DensityUnit.PicogramPerLiter: return (_value/1) * 1e-12d; - case DensityUnit.PicogramPerMilliliter: return (_value/1e-3) * 1e-12d; - case DensityUnit.PoundPerCubicFoot: return _value/0.062427961; - case DensityUnit.PoundPerCubicInch: return _value/3.6127298147753e-5; - case DensityUnit.PoundPerImperialGallon: return _value*9.9776398e1; - case DensityUnit.PoundPerUSGallon: return _value*1.19826427e2; - case DensityUnit.SlugPerCubicFoot: return _value*515.378818; - case DensityUnit.TonnePerCubicCentimeter: return _value/1e-9; - case DensityUnit.TonnePerCubicMeter: return _value/0.001; - case DensityUnit.TonnePerCubicMillimeter: return _value/1e-12; + case DensityUnit.CentigramPerDeciliter: return (Value/1e-1) * 1e-2d; + case DensityUnit.CentigramPerLiter: return (Value/1) * 1e-2d; + case DensityUnit.CentigramPerMilliliter: return (Value/1e-3) * 1e-2d; + case DensityUnit.DecigramPerDeciliter: return (Value/1e-1) * 1e-1d; + case DensityUnit.DecigramPerLiter: return (Value/1) * 1e-1d; + case DensityUnit.DecigramPerMilliliter: return (Value/1e-3) * 1e-1d; + case DensityUnit.GramPerCubicCentimeter: return Value/1e-3; + case DensityUnit.GramPerCubicMeter: return Value/1e3; + case DensityUnit.GramPerCubicMillimeter: return Value/1e-6; + case DensityUnit.GramPerDeciliter: return Value/1e-1; + case DensityUnit.GramPerLiter: return Value/1; + case DensityUnit.GramPerMilliliter: return Value/1e-3; + case DensityUnit.KilogramPerCubicCentimeter: return (Value/1e-3) * 1e3d; + case DensityUnit.KilogramPerCubicMeter: return (Value/1e3) * 1e3d; + case DensityUnit.KilogramPerCubicMillimeter: return (Value/1e-6) * 1e3d; + case DensityUnit.KilogramPerLiter: return Value*1e3; + case DensityUnit.KilopoundPerCubicFoot: return (Value/0.062427961) * 1e3d; + case DensityUnit.KilopoundPerCubicInch: return (Value/3.6127298147753e-5) * 1e3d; + case DensityUnit.MicrogramPerCubicMeter: return (Value/1e3) * 1e-6d; + case DensityUnit.MicrogramPerDeciliter: return (Value/1e-1) * 1e-6d; + case DensityUnit.MicrogramPerLiter: return (Value/1) * 1e-6d; + case DensityUnit.MicrogramPerMilliliter: return (Value/1e-3) * 1e-6d; + case DensityUnit.MilligramPerCubicMeter: return (Value/1e3) * 1e-3d; + case DensityUnit.MilligramPerDeciliter: return (Value/1e-1) * 1e-3d; + case DensityUnit.MilligramPerLiter: return (Value/1) * 1e-3d; + case DensityUnit.MilligramPerMilliliter: return (Value/1e-3) * 1e-3d; + case DensityUnit.NanogramPerDeciliter: return (Value/1e-1) * 1e-9d; + case DensityUnit.NanogramPerLiter: return (Value/1) * 1e-9d; + case DensityUnit.NanogramPerMilliliter: return (Value/1e-3) * 1e-9d; + case DensityUnit.PicogramPerDeciliter: return (Value/1e-1) * 1e-12d; + case DensityUnit.PicogramPerLiter: return (Value/1) * 1e-12d; + case DensityUnit.PicogramPerMilliliter: return (Value/1e-3) * 1e-12d; + case DensityUnit.PoundPerCubicFoot: return Value/0.062427961; + case DensityUnit.PoundPerCubicInch: return Value/3.6127298147753e-5; + case DensityUnit.PoundPerImperialGallon: return Value*9.9776398e1; + case DensityUnit.PoundPerUSGallon: return Value*1.19826427e2; + case DensityUnit.SlugPerCubicFoot: return Value*515.378818; + case DensityUnit.TonnePerCubicCentimeter: return Value/1e-9; + case DensityUnit.TonnePerCubicMeter: return Value/0.001; + case DensityUnit.TonnePerCubicMillimeter: return Value/1e-12; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -1279,10 +1250,10 @@ internal Density ToBaseUnit() return new Density(baseUnitValue, BaseUnit); } - private double GetValueAs(DensityUnit unit) + private T GetValueAs(DensityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1429,7 +1400,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1444,37 +1415,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1498,17 +1469,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs index 1e10964efc..c3fbfa6cfa 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Time is a dimension in which events can be ordered from the past through the present into the future, and also the measure of durations of events and the intervals between them. /// - public partial struct Duration : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Duration : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -70,12 +65,12 @@ static Duration() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Duration(double value, DurationUnit unit) + public Duration(T value, DurationUnit unit) { if(unit == DurationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -87,14 +82,14 @@ public Duration(double value, DurationUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Duration(double value, UnitSystem unitSystem) + public Duration(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -136,7 +131,7 @@ public Duration(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Second. /// - public static Duration Zero { get; } = new Duration(0, BaseUnit); + public static Duration Zero { get; } = new Duration((T)0, BaseUnit); #endregion @@ -145,7 +140,9 @@ public Duration(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -175,52 +172,52 @@ public Duration(double value, UnitSystem unitSystem) /// /// Get in Days. /// - public double Days => As(DurationUnit.Day); + public T Days => As(DurationUnit.Day); /// /// Get in Hours. /// - public double Hours => As(DurationUnit.Hour); + public T Hours => As(DurationUnit.Hour); /// /// Get in Microseconds. /// - public double Microseconds => As(DurationUnit.Microsecond); + public T Microseconds => As(DurationUnit.Microsecond); /// /// Get in Milliseconds. /// - public double Milliseconds => As(DurationUnit.Millisecond); + public T Milliseconds => As(DurationUnit.Millisecond); /// /// Get in Minutes. /// - public double Minutes => As(DurationUnit.Minute); + public T Minutes => As(DurationUnit.Minute); /// /// Get in Months30. /// - public double Months30 => As(DurationUnit.Month30); + public T Months30 => As(DurationUnit.Month30); /// /// Get in Nanoseconds. /// - public double Nanoseconds => As(DurationUnit.Nanosecond); + public T Nanoseconds => As(DurationUnit.Nanosecond); /// /// Get in Seconds. /// - public double Seconds => As(DurationUnit.Second); + public T Seconds => As(DurationUnit.Second); /// /// Get in Weeks. /// - public double Weeks => As(DurationUnit.Week); + public T Weeks => As(DurationUnit.Week); /// /// Get in Years365. /// - public double Years365 => As(DurationUnit.Year365); + public T Years365 => As(DurationUnit.Year365); #endregion @@ -255,91 +252,81 @@ public static string GetAbbreviation(DurationUnit unit, [CanBeNull] IFormatProvi /// Get from Days. /// /// If value is NaN or Infinity. - public static Duration FromDays(QuantityValue days) + public static Duration FromDays(T days) { - double value = (double) days; - return new Duration(value, DurationUnit.Day); + return new Duration(days, DurationUnit.Day); } /// /// Get from Hours. /// /// If value is NaN or Infinity. - public static Duration FromHours(QuantityValue hours) + public static Duration FromHours(T hours) { - double value = (double) hours; - return new Duration(value, DurationUnit.Hour); + return new Duration(hours, DurationUnit.Hour); } /// /// Get from Microseconds. /// /// If value is NaN or Infinity. - public static Duration FromMicroseconds(QuantityValue microseconds) + public static Duration FromMicroseconds(T microseconds) { - double value = (double) microseconds; - return new Duration(value, DurationUnit.Microsecond); + return new Duration(microseconds, DurationUnit.Microsecond); } /// /// Get from Milliseconds. /// /// If value is NaN or Infinity. - public static Duration FromMilliseconds(QuantityValue milliseconds) + public static Duration FromMilliseconds(T milliseconds) { - double value = (double) milliseconds; - return new Duration(value, DurationUnit.Millisecond); + return new Duration(milliseconds, DurationUnit.Millisecond); } /// /// Get from Minutes. /// /// If value is NaN or Infinity. - public static Duration FromMinutes(QuantityValue minutes) + public static Duration FromMinutes(T minutes) { - double value = (double) minutes; - return new Duration(value, DurationUnit.Minute); + return new Duration(minutes, DurationUnit.Minute); } /// /// Get from Months30. /// /// If value is NaN or Infinity. - public static Duration FromMonths30(QuantityValue months30) + public static Duration FromMonths30(T months30) { - double value = (double) months30; - return new Duration(value, DurationUnit.Month30); + return new Duration(months30, DurationUnit.Month30); } /// /// Get from Nanoseconds. /// /// If value is NaN or Infinity. - public static Duration FromNanoseconds(QuantityValue nanoseconds) + public static Duration FromNanoseconds(T nanoseconds) { - double value = (double) nanoseconds; - return new Duration(value, DurationUnit.Nanosecond); + return new Duration(nanoseconds, DurationUnit.Nanosecond); } /// /// Get from Seconds. /// /// If value is NaN or Infinity. - public static Duration FromSeconds(QuantityValue seconds) + public static Duration FromSeconds(T seconds) { - double value = (double) seconds; - return new Duration(value, DurationUnit.Second); + return new Duration(seconds, DurationUnit.Second); } /// /// Get from Weeks. /// /// If value is NaN or Infinity. - public static Duration FromWeeks(QuantityValue weeks) + public static Duration FromWeeks(T weeks) { - double value = (double) weeks; - return new Duration(value, DurationUnit.Week); + return new Duration(weeks, DurationUnit.Week); } /// /// Get from Years365. /// /// If value is NaN or Infinity. - public static Duration FromYears365(QuantityValue years365) + public static Duration FromYears365(T years365) { - double value = (double) years365; - return new Duration(value, DurationUnit.Year365); + return new Duration(years365, DurationUnit.Year365); } /// @@ -348,9 +335,9 @@ public static Duration FromYears365(QuantityValue years365) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Duration From(QuantityValue value, DurationUnit fromUnit) + public static Duration From(T value, DurationUnit fromUnit) { - return new Duration((double)value, fromUnit); + return new Duration(value, fromUnit); } #endregion @@ -504,43 +491,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Durati /// Negate the value. public static Duration operator -(Duration right) { - return new Duration(-right.Value, right.Unit); + return new Duration(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Duration operator +(Duration left, Duration right) { - return new Duration(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Duration(value, left.Unit); } /// Get from subtracting two . public static Duration operator -(Duration left, Duration right) { - return new Duration(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Duration(value, left.Unit); } /// Get from multiplying value and . - public static Duration operator *(double left, Duration right) + public static Duration operator *(T left, Duration right) { - return new Duration(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Duration(value, right.Unit); } /// Get from multiplying value and . - public static Duration operator *(Duration left, double right) + public static Duration operator *(Duration left, T right) { - return new Duration(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Duration(value, left.Unit); } /// Get from dividing by value. - public static Duration operator /(Duration left, double right) + public static Duration operator /(Duration left, T right) { - return new Duration(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Duration(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Duration left, Duration right) + public static T operator /(Duration left, Duration right) { - return left.Seconds / right.Seconds; + return CompiledLambdas.Divide(left.Seconds, right.Seconds); } #endregion @@ -550,25 +542,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Durati /// Returns true if less or equal to. public static bool operator <=(Duration left, Duration right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Duration left, Duration right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Duration left, Duration right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Duration left, Duration right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -597,7 +589,7 @@ public int CompareTo(object obj) /// public int CompareTo(Duration other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -614,7 +606,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Duration other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -662,10 +654,8 @@ public bool Equals(Duration other, double tolerance, ComparisonType compariso if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -685,17 +675,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(DurationUnit unit) + public T As(DurationUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -715,9 +705,14 @@ double IQuantity.As(Enum unit) if(!(unit is DurationUnit unitAsDurationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DurationUnit)} is supported.", nameof(unit)); - return As(unitAsDurationUnit); + var asValue = As(unitAsDurationUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(DurationUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -758,28 +753,34 @@ public Duration ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(DurationUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(DurationUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case DurationUnit.Day: return _value*24*3600; - case DurationUnit.Hour: return _value*3600; - case DurationUnit.Microsecond: return (_value) * 1e-6d; - case DurationUnit.Millisecond: return (_value) * 1e-3d; - case DurationUnit.Minute: return _value*60; - case DurationUnit.Month30: return _value*30*24*3600; - case DurationUnit.Nanosecond: return (_value) * 1e-9d; - case DurationUnit.Second: return _value; - case DurationUnit.Week: return _value*7*24*3600; - case DurationUnit.Year365: return _value*365*24*3600; + case DurationUnit.Day: return Value*24*3600; + case DurationUnit.Hour: return Value*3600; + case DurationUnit.Microsecond: return (Value) * 1e-6d; + case DurationUnit.Millisecond: return (Value) * 1e-3d; + case DurationUnit.Minute: return Value*60; + case DurationUnit.Month30: return Value*30*24*3600; + case DurationUnit.Nanosecond: return (Value) * 1e-9d; + case DurationUnit.Second: return Value; + case DurationUnit.Week: return Value*7*24*3600; + case DurationUnit.Year365: return Value*365*24*3600; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -796,10 +797,10 @@ internal Duration ToBaseUnit() return new Duration(baseUnitValue, BaseUnit); } - private double GetValueAs(DurationUnit unit) + private T GetValueAs(DurationUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -916,7 +917,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -931,37 +932,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -985,17 +986,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs index 08094192af..7a32f6b4be 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Viscosity#Dynamic_.28shear.29_viscosity /// - public partial struct DynamicViscosity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct DynamicViscosity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -72,12 +67,12 @@ static DynamicViscosity() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public DynamicViscosity(double value, DynamicViscosityUnit unit) + public DynamicViscosity(T value, DynamicViscosityUnit unit) { if(unit == DynamicViscosityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -89,14 +84,14 @@ public DynamicViscosity(double value, DynamicViscosityUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public DynamicViscosity(double value, UnitSystem unitSystem) + public DynamicViscosity(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -138,7 +133,7 @@ public DynamicViscosity(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonSecondPerMeterSquared. /// - public static DynamicViscosity Zero { get; } = new DynamicViscosity(0, BaseUnit); + public static DynamicViscosity Zero { get; } = new DynamicViscosity((T)0, BaseUnit); #endregion @@ -147,7 +142,9 @@ public DynamicViscosity(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -177,47 +174,47 @@ public DynamicViscosity(double value, UnitSystem unitSystem) /// /// Get in Centipoise. /// - public double Centipoise => As(DynamicViscosityUnit.Centipoise); + public T Centipoise => As(DynamicViscosityUnit.Centipoise); /// /// Get in MicropascalSeconds. /// - public double MicropascalSeconds => As(DynamicViscosityUnit.MicropascalSecond); + public T MicropascalSeconds => As(DynamicViscosityUnit.MicropascalSecond); /// /// Get in MillipascalSeconds. /// - public double MillipascalSeconds => As(DynamicViscosityUnit.MillipascalSecond); + public T MillipascalSeconds => As(DynamicViscosityUnit.MillipascalSecond); /// /// Get in NewtonSecondsPerMeterSquared. /// - public double NewtonSecondsPerMeterSquared => As(DynamicViscosityUnit.NewtonSecondPerMeterSquared); + public T NewtonSecondsPerMeterSquared => As(DynamicViscosityUnit.NewtonSecondPerMeterSquared); /// /// Get in PascalSeconds. /// - public double PascalSeconds => As(DynamicViscosityUnit.PascalSecond); + public T PascalSeconds => As(DynamicViscosityUnit.PascalSecond); /// /// Get in Poise. /// - public double Poise => As(DynamicViscosityUnit.Poise); + public T Poise => As(DynamicViscosityUnit.Poise); /// /// Get in PoundsForceSecondPerSquareFoot. /// - public double PoundsForceSecondPerSquareFoot => As(DynamicViscosityUnit.PoundForceSecondPerSquareFoot); + public T PoundsForceSecondPerSquareFoot => As(DynamicViscosityUnit.PoundForceSecondPerSquareFoot); /// /// Get in PoundsForceSecondPerSquareInch. /// - public double PoundsForceSecondPerSquareInch => As(DynamicViscosityUnit.PoundForceSecondPerSquareInch); + public T PoundsForceSecondPerSquareInch => As(DynamicViscosityUnit.PoundForceSecondPerSquareInch); /// /// Get in Reyns. /// - public double Reyns => As(DynamicViscosityUnit.Reyn); + public T Reyns => As(DynamicViscosityUnit.Reyn); #endregion @@ -252,82 +249,73 @@ public static string GetAbbreviation(DynamicViscosityUnit unit, [CanBeNull] IFor /// Get from Centipoise. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromCentipoise(QuantityValue centipoise) + public static DynamicViscosity FromCentipoise(T centipoise) { - double value = (double) centipoise; - return new DynamicViscosity(value, DynamicViscosityUnit.Centipoise); + return new DynamicViscosity(centipoise, DynamicViscosityUnit.Centipoise); } /// /// Get from MicropascalSeconds. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromMicropascalSeconds(QuantityValue micropascalseconds) + public static DynamicViscosity FromMicropascalSeconds(T micropascalseconds) { - double value = (double) micropascalseconds; - return new DynamicViscosity(value, DynamicViscosityUnit.MicropascalSecond); + return new DynamicViscosity(micropascalseconds, DynamicViscosityUnit.MicropascalSecond); } /// /// Get from MillipascalSeconds. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromMillipascalSeconds(QuantityValue millipascalseconds) + public static DynamicViscosity FromMillipascalSeconds(T millipascalseconds) { - double value = (double) millipascalseconds; - return new DynamicViscosity(value, DynamicViscosityUnit.MillipascalSecond); + return new DynamicViscosity(millipascalseconds, DynamicViscosityUnit.MillipascalSecond); } /// /// Get from NewtonSecondsPerMeterSquared. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromNewtonSecondsPerMeterSquared(QuantityValue newtonsecondspermetersquared) + public static DynamicViscosity FromNewtonSecondsPerMeterSquared(T newtonsecondspermetersquared) { - double value = (double) newtonsecondspermetersquared; - return new DynamicViscosity(value, DynamicViscosityUnit.NewtonSecondPerMeterSquared); + return new DynamicViscosity(newtonsecondspermetersquared, DynamicViscosityUnit.NewtonSecondPerMeterSquared); } /// /// Get from PascalSeconds. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromPascalSeconds(QuantityValue pascalseconds) + public static DynamicViscosity FromPascalSeconds(T pascalseconds) { - double value = (double) pascalseconds; - return new DynamicViscosity(value, DynamicViscosityUnit.PascalSecond); + return new DynamicViscosity(pascalseconds, DynamicViscosityUnit.PascalSecond); } /// /// Get from Poise. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromPoise(QuantityValue poise) + public static DynamicViscosity FromPoise(T poise) { - double value = (double) poise; - return new DynamicViscosity(value, DynamicViscosityUnit.Poise); + return new DynamicViscosity(poise, DynamicViscosityUnit.Poise); } /// /// Get from PoundsForceSecondPerSquareFoot. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromPoundsForceSecondPerSquareFoot(QuantityValue poundsforcesecondpersquarefoot) + public static DynamicViscosity FromPoundsForceSecondPerSquareFoot(T poundsforcesecondpersquarefoot) { - double value = (double) poundsforcesecondpersquarefoot; - return new DynamicViscosity(value, DynamicViscosityUnit.PoundForceSecondPerSquareFoot); + return new DynamicViscosity(poundsforcesecondpersquarefoot, DynamicViscosityUnit.PoundForceSecondPerSquareFoot); } /// /// Get from PoundsForceSecondPerSquareInch. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromPoundsForceSecondPerSquareInch(QuantityValue poundsforcesecondpersquareinch) + public static DynamicViscosity FromPoundsForceSecondPerSquareInch(T poundsforcesecondpersquareinch) { - double value = (double) poundsforcesecondpersquareinch; - return new DynamicViscosity(value, DynamicViscosityUnit.PoundForceSecondPerSquareInch); + return new DynamicViscosity(poundsforcesecondpersquareinch, DynamicViscosityUnit.PoundForceSecondPerSquareInch); } /// /// Get from Reyns. /// /// If value is NaN or Infinity. - public static DynamicViscosity FromReyns(QuantityValue reyns) + public static DynamicViscosity FromReyns(T reyns) { - double value = (double) reyns; - return new DynamicViscosity(value, DynamicViscosityUnit.Reyn); + return new DynamicViscosity(reyns, DynamicViscosityUnit.Reyn); } /// @@ -336,9 +324,9 @@ public static DynamicViscosity FromReyns(QuantityValue reyns) /// Value to convert from. /// Unit to convert from. /// unit value. - public static DynamicViscosity From(QuantityValue value, DynamicViscosityUnit fromUnit) + public static DynamicViscosity From(T value, DynamicViscosityUnit fromUnit) { - return new DynamicViscosity((double)value, fromUnit); + return new DynamicViscosity(value, fromUnit); } #endregion @@ -492,43 +480,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Dynami /// Negate the value. public static DynamicViscosity operator -(DynamicViscosity right) { - return new DynamicViscosity(-right.Value, right.Unit); + return new DynamicViscosity(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static DynamicViscosity operator +(DynamicViscosity left, DynamicViscosity right) { - return new DynamicViscosity(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new DynamicViscosity(value, left.Unit); } /// Get from subtracting two . public static DynamicViscosity operator -(DynamicViscosity left, DynamicViscosity right) { - return new DynamicViscosity(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new DynamicViscosity(value, left.Unit); } /// Get from multiplying value and . - public static DynamicViscosity operator *(double left, DynamicViscosity right) + public static DynamicViscosity operator *(T left, DynamicViscosity right) { - return new DynamicViscosity(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new DynamicViscosity(value, right.Unit); } /// Get from multiplying value and . - public static DynamicViscosity operator *(DynamicViscosity left, double right) + public static DynamicViscosity operator *(DynamicViscosity left, T right) { - return new DynamicViscosity(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new DynamicViscosity(value, left.Unit); } /// Get from dividing by value. - public static DynamicViscosity operator /(DynamicViscosity left, double right) + public static DynamicViscosity operator /(DynamicViscosity left, T right) { - return new DynamicViscosity(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new DynamicViscosity(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(DynamicViscosity left, DynamicViscosity right) + public static T operator /(DynamicViscosity left, DynamicViscosity right) { - return left.NewtonSecondsPerMeterSquared / right.NewtonSecondsPerMeterSquared; + return CompiledLambdas.Divide(left.NewtonSecondsPerMeterSquared, right.NewtonSecondsPerMeterSquared); } #endregion @@ -538,25 +531,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Dynami /// Returns true if less or equal to. public static bool operator <=(DynamicViscosity left, DynamicViscosity right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(DynamicViscosity left, DynamicViscosity right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(DynamicViscosity left, DynamicViscosity right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(DynamicViscosity left, DynamicViscosity right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -585,7 +578,7 @@ public int CompareTo(object obj) /// public int CompareTo(DynamicViscosity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -602,7 +595,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(DynamicViscosity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -650,10 +643,8 @@ public bool Equals(DynamicViscosity other, double tolerance, ComparisonType c if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -673,17 +664,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(DynamicViscosityUnit unit) + public T As(DynamicViscosityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -703,9 +694,14 @@ double IQuantity.As(Enum unit) if(!(unit is DynamicViscosityUnit unitAsDynamicViscosityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DynamicViscosityUnit)} is supported.", nameof(unit)); - return As(unitAsDynamicViscosityUnit); + var asValue = As(unitAsDynamicViscosityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(DynamicViscosityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -746,27 +742,33 @@ public DynamicViscosity ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(DynamicViscosityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(DynamicViscosityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case DynamicViscosityUnit.Centipoise: return (_value/10) * 1e-2d; - case DynamicViscosityUnit.MicropascalSecond: return (_value) * 1e-6d; - case DynamicViscosityUnit.MillipascalSecond: return (_value) * 1e-3d; - case DynamicViscosityUnit.NewtonSecondPerMeterSquared: return _value; - case DynamicViscosityUnit.PascalSecond: return _value; - case DynamicViscosityUnit.Poise: return _value/10; - case DynamicViscosityUnit.PoundForceSecondPerSquareFoot: return _value * 4.7880258980335843e1; - case DynamicViscosityUnit.PoundForceSecondPerSquareInch: return _value * 6.8947572931683613e3; - case DynamicViscosityUnit.Reyn: return _value * 6.8947572931683613e3; + case DynamicViscosityUnit.Centipoise: return (Value/10) * 1e-2d; + case DynamicViscosityUnit.MicropascalSecond: return (Value) * 1e-6d; + case DynamicViscosityUnit.MillipascalSecond: return (Value) * 1e-3d; + case DynamicViscosityUnit.NewtonSecondPerMeterSquared: return Value; + case DynamicViscosityUnit.PascalSecond: return Value; + case DynamicViscosityUnit.Poise: return Value/10; + case DynamicViscosityUnit.PoundForceSecondPerSquareFoot: return Value * 4.7880258980335843e1; + case DynamicViscosityUnit.PoundForceSecondPerSquareInch: return Value * 6.8947572931683613e3; + case DynamicViscosityUnit.Reyn: return Value * 6.8947572931683613e3; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -783,10 +785,10 @@ internal DynamicViscosity ToBaseUnit() return new DynamicViscosity(baseUnitValue, BaseUnit); } - private double GetValueAs(DynamicViscosityUnit unit) + private T GetValueAs(DynamicViscosityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -902,7 +904,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -917,37 +919,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -971,17 +973,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs index ed0322de95..a95fcc2c81 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Electric admittance is a measure of how easily a circuit or device will allow a current to flow. It is defined as the inverse of impedance. The SI unit of admittance is the siemens (symbol S). /// - public partial struct ElectricAdmittance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ElectricAdmittance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -64,12 +59,12 @@ static ElectricAdmittance() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ElectricAdmittance(double value, ElectricAdmittanceUnit unit) + public ElectricAdmittance(T value, ElectricAdmittanceUnit unit) { if(unit == ElectricAdmittanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -81,14 +76,14 @@ public ElectricAdmittance(double value, ElectricAdmittanceUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ElectricAdmittance(double value, UnitSystem unitSystem) + public ElectricAdmittance(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -130,7 +125,7 @@ public ElectricAdmittance(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Siemens. /// - public static ElectricAdmittance Zero { get; } = new ElectricAdmittance(0, BaseUnit); + public static ElectricAdmittance Zero { get; } = new ElectricAdmittance((T)0, BaseUnit); #endregion @@ -139,7 +134,9 @@ public ElectricAdmittance(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -169,22 +166,22 @@ public ElectricAdmittance(double value, UnitSystem unitSystem) /// /// Get in Microsiemens. /// - public double Microsiemens => As(ElectricAdmittanceUnit.Microsiemens); + public T Microsiemens => As(ElectricAdmittanceUnit.Microsiemens); /// /// Get in Millisiemens. /// - public double Millisiemens => As(ElectricAdmittanceUnit.Millisiemens); + public T Millisiemens => As(ElectricAdmittanceUnit.Millisiemens); /// /// Get in Nanosiemens. /// - public double Nanosiemens => As(ElectricAdmittanceUnit.Nanosiemens); + public T Nanosiemens => As(ElectricAdmittanceUnit.Nanosiemens); /// /// Get in Siemens. /// - public double Siemens => As(ElectricAdmittanceUnit.Siemens); + public T Siemens => As(ElectricAdmittanceUnit.Siemens); #endregion @@ -219,37 +216,33 @@ public static string GetAbbreviation(ElectricAdmittanceUnit unit, [CanBeNull] IF /// Get from Microsiemens. /// /// If value is NaN or Infinity. - public static ElectricAdmittance FromMicrosiemens(QuantityValue microsiemens) + public static ElectricAdmittance FromMicrosiemens(T microsiemens) { - double value = (double) microsiemens; - return new ElectricAdmittance(value, ElectricAdmittanceUnit.Microsiemens); + return new ElectricAdmittance(microsiemens, ElectricAdmittanceUnit.Microsiemens); } /// /// Get from Millisiemens. /// /// If value is NaN or Infinity. - public static ElectricAdmittance FromMillisiemens(QuantityValue millisiemens) + public static ElectricAdmittance FromMillisiemens(T millisiemens) { - double value = (double) millisiemens; - return new ElectricAdmittance(value, ElectricAdmittanceUnit.Millisiemens); + return new ElectricAdmittance(millisiemens, ElectricAdmittanceUnit.Millisiemens); } /// /// Get from Nanosiemens. /// /// If value is NaN or Infinity. - public static ElectricAdmittance FromNanosiemens(QuantityValue nanosiemens) + public static ElectricAdmittance FromNanosiemens(T nanosiemens) { - double value = (double) nanosiemens; - return new ElectricAdmittance(value, ElectricAdmittanceUnit.Nanosiemens); + return new ElectricAdmittance(nanosiemens, ElectricAdmittanceUnit.Nanosiemens); } /// /// Get from Siemens. /// /// If value is NaN or Infinity. - public static ElectricAdmittance FromSiemens(QuantityValue siemens) + public static ElectricAdmittance FromSiemens(T siemens) { - double value = (double) siemens; - return new ElectricAdmittance(value, ElectricAdmittanceUnit.Siemens); + return new ElectricAdmittance(siemens, ElectricAdmittanceUnit.Siemens); } /// @@ -258,9 +251,9 @@ public static ElectricAdmittance FromSiemens(QuantityValue siemens) /// Value to convert from. /// Unit to convert from. /// unit value. - public static ElectricAdmittance From(QuantityValue value, ElectricAdmittanceUnit fromUnit) + public static ElectricAdmittance From(T value, ElectricAdmittanceUnit fromUnit) { - return new ElectricAdmittance((double)value, fromUnit); + return new ElectricAdmittance(value, fromUnit); } #endregion @@ -414,43 +407,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Negate the value. public static ElectricAdmittance operator -(ElectricAdmittance right) { - return new ElectricAdmittance(-right.Value, right.Unit); + return new ElectricAdmittance(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ElectricAdmittance operator +(ElectricAdmittance left, ElectricAdmittance right) { - return new ElectricAdmittance(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ElectricAdmittance(value, left.Unit); } /// Get from subtracting two . public static ElectricAdmittance operator -(ElectricAdmittance left, ElectricAdmittance right) { - return new ElectricAdmittance(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ElectricAdmittance(value, left.Unit); } /// Get from multiplying value and . - public static ElectricAdmittance operator *(double left, ElectricAdmittance right) + public static ElectricAdmittance operator *(T left, ElectricAdmittance right) { - return new ElectricAdmittance(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ElectricAdmittance(value, right.Unit); } /// Get from multiplying value and . - public static ElectricAdmittance operator *(ElectricAdmittance left, double right) + public static ElectricAdmittance operator *(ElectricAdmittance left, T right) { - return new ElectricAdmittance(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ElectricAdmittance(value, left.Unit); } /// Get from dividing by value. - public static ElectricAdmittance operator /(ElectricAdmittance left, double right) + public static ElectricAdmittance operator /(ElectricAdmittance left, T right) { - return new ElectricAdmittance(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ElectricAdmittance(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ElectricAdmittance left, ElectricAdmittance right) + public static T operator /(ElectricAdmittance left, ElectricAdmittance right) { - return left.Siemens / right.Siemens; + return CompiledLambdas.Divide(left.Siemens, right.Siemens); } #endregion @@ -460,25 +458,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Returns true if less or equal to. public static bool operator <=(ElectricAdmittance left, ElectricAdmittance right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ElectricAdmittance left, ElectricAdmittance right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ElectricAdmittance left, ElectricAdmittance right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ElectricAdmittance left, ElectricAdmittance right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -507,7 +505,7 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricAdmittance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -524,7 +522,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricAdmittance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -572,10 +570,8 @@ public bool Equals(ElectricAdmittance other, double tolerance, ComparisonType if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -595,17 +591,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricAdmittanceUnit unit) + public T As(ElectricAdmittanceUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -625,9 +621,14 @@ double IQuantity.As(Enum unit) if(!(unit is ElectricAdmittanceUnit unitAsElectricAdmittanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricAdmittanceUnit)} is supported.", nameof(unit)); - return As(unitAsElectricAdmittanceUnit); + var asValue = As(unitAsElectricAdmittanceUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ElectricAdmittanceUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -668,22 +669,28 @@ public ElectricAdmittance ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ElectricAdmittanceUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ElectricAdmittanceUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ElectricAdmittanceUnit.Microsiemens: return (_value) * 1e-6d; - case ElectricAdmittanceUnit.Millisiemens: return (_value) * 1e-3d; - case ElectricAdmittanceUnit.Nanosiemens: return (_value) * 1e-9d; - case ElectricAdmittanceUnit.Siemens: return _value; + case ElectricAdmittanceUnit.Microsiemens: return (Value) * 1e-6d; + case ElectricAdmittanceUnit.Millisiemens: return (Value) * 1e-3d; + case ElectricAdmittanceUnit.Nanosiemens: return (Value) * 1e-9d; + case ElectricAdmittanceUnit.Siemens: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -700,10 +707,10 @@ internal ElectricAdmittance ToBaseUnit() return new ElectricAdmittance(baseUnitValue, BaseUnit); } - private double GetValueAs(ElectricAdmittanceUnit unit) + private T GetValueAs(ElectricAdmittanceUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -814,7 +821,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -829,37 +836,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -883,17 +890,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs index 9fdba3f32b..5afb1d13cf 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electric_charge /// - public partial struct ElectricCharge : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ElectricCharge : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -68,12 +63,12 @@ static ElectricCharge() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ElectricCharge(double value, ElectricChargeUnit unit) + public ElectricCharge(T value, ElectricChargeUnit unit) { if(unit == ElectricChargeUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -85,14 +80,14 @@ public ElectricCharge(double value, ElectricChargeUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ElectricCharge(double value, UnitSystem unitSystem) + public ElectricCharge(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -134,7 +129,7 @@ public ElectricCharge(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Coulomb. /// - public static ElectricCharge Zero { get; } = new ElectricCharge(0, BaseUnit); + public static ElectricCharge Zero { get; } = new ElectricCharge((T)0, BaseUnit); #endregion @@ -143,7 +138,9 @@ public ElectricCharge(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -173,27 +170,27 @@ public ElectricCharge(double value, UnitSystem unitSystem) /// /// Get in AmpereHours. /// - public double AmpereHours => As(ElectricChargeUnit.AmpereHour); + public T AmpereHours => As(ElectricChargeUnit.AmpereHour); /// /// Get in Coulombs. /// - public double Coulombs => As(ElectricChargeUnit.Coulomb); + public T Coulombs => As(ElectricChargeUnit.Coulomb); /// /// Get in KiloampereHours. /// - public double KiloampereHours => As(ElectricChargeUnit.KiloampereHour); + public T KiloampereHours => As(ElectricChargeUnit.KiloampereHour); /// /// Get in MegaampereHours. /// - public double MegaampereHours => As(ElectricChargeUnit.MegaampereHour); + public T MegaampereHours => As(ElectricChargeUnit.MegaampereHour); /// /// Get in MilliampereHours. /// - public double MilliampereHours => As(ElectricChargeUnit.MilliampereHour); + public T MilliampereHours => As(ElectricChargeUnit.MilliampereHour); #endregion @@ -228,46 +225,41 @@ public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] IForma /// Get from AmpereHours. /// /// If value is NaN or Infinity. - public static ElectricCharge FromAmpereHours(QuantityValue amperehours) + public static ElectricCharge FromAmpereHours(T amperehours) { - double value = (double) amperehours; - return new ElectricCharge(value, ElectricChargeUnit.AmpereHour); + return new ElectricCharge(amperehours, ElectricChargeUnit.AmpereHour); } /// /// Get from Coulombs. /// /// If value is NaN or Infinity. - public static ElectricCharge FromCoulombs(QuantityValue coulombs) + public static ElectricCharge FromCoulombs(T coulombs) { - double value = (double) coulombs; - return new ElectricCharge(value, ElectricChargeUnit.Coulomb); + return new ElectricCharge(coulombs, ElectricChargeUnit.Coulomb); } /// /// Get from KiloampereHours. /// /// If value is NaN or Infinity. - public static ElectricCharge FromKiloampereHours(QuantityValue kiloamperehours) + public static ElectricCharge FromKiloampereHours(T kiloamperehours) { - double value = (double) kiloamperehours; - return new ElectricCharge(value, ElectricChargeUnit.KiloampereHour); + return new ElectricCharge(kiloamperehours, ElectricChargeUnit.KiloampereHour); } /// /// Get from MegaampereHours. /// /// If value is NaN or Infinity. - public static ElectricCharge FromMegaampereHours(QuantityValue megaamperehours) + public static ElectricCharge FromMegaampereHours(T megaamperehours) { - double value = (double) megaamperehours; - return new ElectricCharge(value, ElectricChargeUnit.MegaampereHour); + return new ElectricCharge(megaamperehours, ElectricChargeUnit.MegaampereHour); } /// /// Get from MilliampereHours. /// /// If value is NaN or Infinity. - public static ElectricCharge FromMilliampereHours(QuantityValue milliamperehours) + public static ElectricCharge FromMilliampereHours(T milliamperehours) { - double value = (double) milliamperehours; - return new ElectricCharge(value, ElectricChargeUnit.MilliampereHour); + return new ElectricCharge(milliamperehours, ElectricChargeUnit.MilliampereHour); } /// @@ -276,9 +268,9 @@ public static ElectricCharge FromMilliampereHours(QuantityValue milliampereho /// Value to convert from. /// Unit to convert from. /// unit value. - public static ElectricCharge From(QuantityValue value, ElectricChargeUnit fromUnit) + public static ElectricCharge From(T value, ElectricChargeUnit fromUnit) { - return new ElectricCharge((double)value, fromUnit); + return new ElectricCharge(value, fromUnit); } #endregion @@ -432,43 +424,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Negate the value. public static ElectricCharge operator -(ElectricCharge right) { - return new ElectricCharge(-right.Value, right.Unit); + return new ElectricCharge(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ElectricCharge operator +(ElectricCharge left, ElectricCharge right) { - return new ElectricCharge(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ElectricCharge(value, left.Unit); } /// Get from subtracting two . public static ElectricCharge operator -(ElectricCharge left, ElectricCharge right) { - return new ElectricCharge(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ElectricCharge(value, left.Unit); } /// Get from multiplying value and . - public static ElectricCharge operator *(double left, ElectricCharge right) + public static ElectricCharge operator *(T left, ElectricCharge right) { - return new ElectricCharge(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ElectricCharge(value, right.Unit); } /// Get from multiplying value and . - public static ElectricCharge operator *(ElectricCharge left, double right) + public static ElectricCharge operator *(ElectricCharge left, T right) { - return new ElectricCharge(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ElectricCharge(value, left.Unit); } /// Get from dividing by value. - public static ElectricCharge operator /(ElectricCharge left, double right) + public static ElectricCharge operator /(ElectricCharge left, T right) { - return new ElectricCharge(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ElectricCharge(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ElectricCharge left, ElectricCharge right) + public static T operator /(ElectricCharge left, ElectricCharge right) { - return left.Coulombs / right.Coulombs; + return CompiledLambdas.Divide(left.Coulombs, right.Coulombs); } #endregion @@ -478,25 +475,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Returns true if less or equal to. public static bool operator <=(ElectricCharge left, ElectricCharge right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ElectricCharge left, ElectricCharge right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ElectricCharge left, ElectricCharge right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ElectricCharge left, ElectricCharge right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -525,7 +522,7 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricCharge other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -542,7 +539,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricCharge other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -590,10 +587,8 @@ public bool Equals(ElectricCharge other, double tolerance, ComparisonType com if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -613,17 +608,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricChargeUnit unit) + public T As(ElectricChargeUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -643,9 +638,14 @@ double IQuantity.As(Enum unit) if(!(unit is ElectricChargeUnit unitAsElectricChargeUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricChargeUnit)} is supported.", nameof(unit)); - return As(unitAsElectricChargeUnit); + var asValue = As(unitAsElectricChargeUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ElectricChargeUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -686,23 +686,29 @@ public ElectricCharge ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ElectricChargeUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ElectricChargeUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ElectricChargeUnit.AmpereHour: return _value/2.77777777777e-4; - case ElectricChargeUnit.Coulomb: return _value; - case ElectricChargeUnit.KiloampereHour: return (_value/2.77777777777e-4) * 1e3d; - case ElectricChargeUnit.MegaampereHour: return (_value/2.77777777777e-4) * 1e6d; - case ElectricChargeUnit.MilliampereHour: return (_value/2.77777777777e-4) * 1e-3d; + case ElectricChargeUnit.AmpereHour: return Value/2.77777777777e-4; + case ElectricChargeUnit.Coulomb: return Value; + case ElectricChargeUnit.KiloampereHour: return (Value/2.77777777777e-4) * 1e3d; + case ElectricChargeUnit.MegaampereHour: return (Value/2.77777777777e-4) * 1e6d; + case ElectricChargeUnit.MilliampereHour: return (Value/2.77777777777e-4) * 1e-3d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -719,10 +725,10 @@ internal ElectricCharge ToBaseUnit() return new ElectricCharge(baseUnitValue, BaseUnit); } - private double GetValueAs(ElectricChargeUnit unit) + private T GetValueAs(ElectricChargeUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -834,7 +840,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -849,37 +855,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -903,17 +909,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs index e8f372bedc..95a5d88aa2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Charge_density /// - public partial struct ElectricChargeDensity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ElectricChargeDensity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -64,12 +59,12 @@ static ElectricChargeDensity() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ElectricChargeDensity(double value, ElectricChargeDensityUnit unit) + public ElectricChargeDensity(T value, ElectricChargeDensityUnit unit) { if(unit == ElectricChargeDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -81,14 +76,14 @@ public ElectricChargeDensity(double value, ElectricChargeDensityUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ElectricChargeDensity(double value, UnitSystem unitSystem) + public ElectricChargeDensity(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -130,7 +125,7 @@ public ElectricChargeDensity(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit CoulombPerCubicMeter. /// - public static ElectricChargeDensity Zero { get; } = new ElectricChargeDensity(0, BaseUnit); + public static ElectricChargeDensity Zero { get; } = new ElectricChargeDensity((T)0, BaseUnit); #endregion @@ -139,7 +134,9 @@ public ElectricChargeDensity(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -169,7 +166,7 @@ public ElectricChargeDensity(double value, UnitSystem unitSystem) /// /// Get in CoulombsPerCubicMeter. /// - public double CoulombsPerCubicMeter => As(ElectricChargeDensityUnit.CoulombPerCubicMeter); + public T CoulombsPerCubicMeter => As(ElectricChargeDensityUnit.CoulombPerCubicMeter); #endregion @@ -204,10 +201,9 @@ public static string GetAbbreviation(ElectricChargeDensityUnit unit, [CanBeNull] /// Get from CoulombsPerCubicMeter. /// /// If value is NaN or Infinity. - public static ElectricChargeDensity FromCoulombsPerCubicMeter(QuantityValue coulombspercubicmeter) + public static ElectricChargeDensity FromCoulombsPerCubicMeter(T coulombspercubicmeter) { - double value = (double) coulombspercubicmeter; - return new ElectricChargeDensity(value, ElectricChargeDensityUnit.CoulombPerCubicMeter); + return new ElectricChargeDensity(coulombspercubicmeter, ElectricChargeDensityUnit.CoulombPerCubicMeter); } /// @@ -216,9 +212,9 @@ public static ElectricChargeDensity FromCoulombsPerCubicMeter(QuantityValue c /// Value to convert from. /// Unit to convert from. /// unit value. - public static ElectricChargeDensity From(QuantityValue value, ElectricChargeDensityUnit fromUnit) + public static ElectricChargeDensity From(T value, ElectricChargeDensityUnit fromUnit) { - return new ElectricChargeDensity((double)value, fromUnit); + return new ElectricChargeDensity(value, fromUnit); } #endregion @@ -372,43 +368,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Negate the value. public static ElectricChargeDensity operator -(ElectricChargeDensity right) { - return new ElectricChargeDensity(-right.Value, right.Unit); + return new ElectricChargeDensity(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ElectricChargeDensity operator +(ElectricChargeDensity left, ElectricChargeDensity right) { - return new ElectricChargeDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ElectricChargeDensity(value, left.Unit); } /// Get from subtracting two . public static ElectricChargeDensity operator -(ElectricChargeDensity left, ElectricChargeDensity right) { - return new ElectricChargeDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ElectricChargeDensity(value, left.Unit); } /// Get from multiplying value and . - public static ElectricChargeDensity operator *(double left, ElectricChargeDensity right) + public static ElectricChargeDensity operator *(T left, ElectricChargeDensity right) { - return new ElectricChargeDensity(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ElectricChargeDensity(value, right.Unit); } /// Get from multiplying value and . - public static ElectricChargeDensity operator *(ElectricChargeDensity left, double right) + public static ElectricChargeDensity operator *(ElectricChargeDensity left, T right) { - return new ElectricChargeDensity(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ElectricChargeDensity(value, left.Unit); } /// Get from dividing by value. - public static ElectricChargeDensity operator /(ElectricChargeDensity left, double right) + public static ElectricChargeDensity operator /(ElectricChargeDensity left, T right) { - return new ElectricChargeDensity(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ElectricChargeDensity(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ElectricChargeDensity left, ElectricChargeDensity right) + public static T operator /(ElectricChargeDensity left, ElectricChargeDensity right) { - return left.CoulombsPerCubicMeter / right.CoulombsPerCubicMeter; + return CompiledLambdas.Divide(left.CoulombsPerCubicMeter, right.CoulombsPerCubicMeter); } #endregion @@ -418,25 +419,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Returns true if less or equal to. public static bool operator <=(ElectricChargeDensity left, ElectricChargeDensity right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ElectricChargeDensity left, ElectricChargeDensity right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ElectricChargeDensity left, ElectricChargeDensity right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ElectricChargeDensity left, ElectricChargeDensity right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -465,7 +466,7 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricChargeDensity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -482,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricChargeDensity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -530,10 +531,8 @@ public bool Equals(ElectricChargeDensity other, double tolerance, ComparisonT if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -553,17 +552,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricChargeDensityUnit unit) + public T As(ElectricChargeDensityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -583,9 +582,14 @@ double IQuantity.As(Enum unit) if(!(unit is ElectricChargeDensityUnit unitAsElectricChargeDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricChargeDensityUnit)} is supported.", nameof(unit)); - return As(unitAsElectricChargeDensityUnit); + var asValue = As(unitAsElectricChargeDensityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ElectricChargeDensityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -626,19 +630,25 @@ public ElectricChargeDensity ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ElectricChargeDensityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ElectricChargeDensityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ElectricChargeDensityUnit.CoulombPerCubicMeter: return _value; + case ElectricChargeDensityUnit.CoulombPerCubicMeter: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -655,10 +665,10 @@ internal ElectricChargeDensity ToBaseUnit() return new ElectricChargeDensity(baseUnitValue, BaseUnit); } - private double GetValueAs(ElectricChargeDensityUnit unit) + private T GetValueAs(ElectricChargeDensityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -766,7 +776,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -781,37 +791,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -835,17 +845,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs index 02e7e4ea42..7525ddd7db 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electrical_resistance_and_conductance /// - public partial struct ElectricConductance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ElectricConductance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -66,12 +61,12 @@ static ElectricConductance() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ElectricConductance(double value, ElectricConductanceUnit unit) + public ElectricConductance(T value, ElectricConductanceUnit unit) { if(unit == ElectricConductanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -83,14 +78,14 @@ public ElectricConductance(double value, ElectricConductanceUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ElectricConductance(double value, UnitSystem unitSystem) + public ElectricConductance(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -132,7 +127,7 @@ public ElectricConductance(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Siemens. /// - public static ElectricConductance Zero { get; } = new ElectricConductance(0, BaseUnit); + public static ElectricConductance Zero { get; } = new ElectricConductance((T)0, BaseUnit); #endregion @@ -141,7 +136,9 @@ public ElectricConductance(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -171,17 +168,17 @@ public ElectricConductance(double value, UnitSystem unitSystem) /// /// Get in Microsiemens. /// - public double Microsiemens => As(ElectricConductanceUnit.Microsiemens); + public T Microsiemens => As(ElectricConductanceUnit.Microsiemens); /// /// Get in Millisiemens. /// - public double Millisiemens => As(ElectricConductanceUnit.Millisiemens); + public T Millisiemens => As(ElectricConductanceUnit.Millisiemens); /// /// Get in Siemens. /// - public double Siemens => As(ElectricConductanceUnit.Siemens); + public T Siemens => As(ElectricConductanceUnit.Siemens); #endregion @@ -216,28 +213,25 @@ public static string GetAbbreviation(ElectricConductanceUnit unit, [CanBeNull] I /// Get from Microsiemens. /// /// If value is NaN or Infinity. - public static ElectricConductance FromMicrosiemens(QuantityValue microsiemens) + public static ElectricConductance FromMicrosiemens(T microsiemens) { - double value = (double) microsiemens; - return new ElectricConductance(value, ElectricConductanceUnit.Microsiemens); + return new ElectricConductance(microsiemens, ElectricConductanceUnit.Microsiemens); } /// /// Get from Millisiemens. /// /// If value is NaN or Infinity. - public static ElectricConductance FromMillisiemens(QuantityValue millisiemens) + public static ElectricConductance FromMillisiemens(T millisiemens) { - double value = (double) millisiemens; - return new ElectricConductance(value, ElectricConductanceUnit.Millisiemens); + return new ElectricConductance(millisiemens, ElectricConductanceUnit.Millisiemens); } /// /// Get from Siemens. /// /// If value is NaN or Infinity. - public static ElectricConductance FromSiemens(QuantityValue siemens) + public static ElectricConductance FromSiemens(T siemens) { - double value = (double) siemens; - return new ElectricConductance(value, ElectricConductanceUnit.Siemens); + return new ElectricConductance(siemens, ElectricConductanceUnit.Siemens); } /// @@ -246,9 +240,9 @@ public static ElectricConductance FromSiemens(QuantityValue siemens) /// Value to convert from. /// Unit to convert from. /// unit value. - public static ElectricConductance From(QuantityValue value, ElectricConductanceUnit fromUnit) + public static ElectricConductance From(T value, ElectricConductanceUnit fromUnit) { - return new ElectricConductance((double)value, fromUnit); + return new ElectricConductance(value, fromUnit); } #endregion @@ -402,43 +396,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Negate the value. public static ElectricConductance operator -(ElectricConductance right) { - return new ElectricConductance(-right.Value, right.Unit); + return new ElectricConductance(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ElectricConductance operator +(ElectricConductance left, ElectricConductance right) { - return new ElectricConductance(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ElectricConductance(value, left.Unit); } /// Get from subtracting two . public static ElectricConductance operator -(ElectricConductance left, ElectricConductance right) { - return new ElectricConductance(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ElectricConductance(value, left.Unit); } /// Get from multiplying value and . - public static ElectricConductance operator *(double left, ElectricConductance right) + public static ElectricConductance operator *(T left, ElectricConductance right) { - return new ElectricConductance(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ElectricConductance(value, right.Unit); } /// Get from multiplying value and . - public static ElectricConductance operator *(ElectricConductance left, double right) + public static ElectricConductance operator *(ElectricConductance left, T right) { - return new ElectricConductance(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ElectricConductance(value, left.Unit); } /// Get from dividing by value. - public static ElectricConductance operator /(ElectricConductance left, double right) + public static ElectricConductance operator /(ElectricConductance left, T right) { - return new ElectricConductance(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ElectricConductance(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ElectricConductance left, ElectricConductance right) + public static T operator /(ElectricConductance left, ElectricConductance right) { - return left.Siemens / right.Siemens; + return CompiledLambdas.Divide(left.Siemens, right.Siemens); } #endregion @@ -448,25 +447,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Returns true if less or equal to. public static bool operator <=(ElectricConductance left, ElectricConductance right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ElectricConductance left, ElectricConductance right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ElectricConductance left, ElectricConductance right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ElectricConductance left, ElectricConductance right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -495,7 +494,7 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricConductance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -512,7 +511,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricConductance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -560,10 +559,8 @@ public bool Equals(ElectricConductance other, double tolerance, ComparisonTyp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -583,17 +580,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricConductanceUnit unit) + public T As(ElectricConductanceUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -613,9 +610,14 @@ double IQuantity.As(Enum unit) if(!(unit is ElectricConductanceUnit unitAsElectricConductanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricConductanceUnit)} is supported.", nameof(unit)); - return As(unitAsElectricConductanceUnit); + var asValue = As(unitAsElectricConductanceUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ElectricConductanceUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -656,21 +658,27 @@ public ElectricConductance ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ElectricConductanceUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ElectricConductanceUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ElectricConductanceUnit.Microsiemens: return (_value) * 1e-6d; - case ElectricConductanceUnit.Millisiemens: return (_value) * 1e-3d; - case ElectricConductanceUnit.Siemens: return _value; + case ElectricConductanceUnit.Microsiemens: return (Value) * 1e-6d; + case ElectricConductanceUnit.Millisiemens: return (Value) * 1e-3d; + case ElectricConductanceUnit.Siemens: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -687,10 +695,10 @@ internal ElectricConductance ToBaseUnit() return new ElectricConductance(baseUnitValue, BaseUnit); } - private double GetValueAs(ElectricConductanceUnit unit) + private T GetValueAs(ElectricConductanceUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -800,7 +808,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -815,37 +823,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -869,17 +877,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs index e6d82bb005..88fbc7fe4c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity /// - public partial struct ElectricConductivity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ElectricConductivity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -66,12 +61,12 @@ static ElectricConductivity() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ElectricConductivity(double value, ElectricConductivityUnit unit) + public ElectricConductivity(T value, ElectricConductivityUnit unit) { if(unit == ElectricConductivityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -83,14 +78,14 @@ public ElectricConductivity(double value, ElectricConductivityUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ElectricConductivity(double value, UnitSystem unitSystem) + public ElectricConductivity(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -132,7 +127,7 @@ public ElectricConductivity(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit SiemensPerMeter. /// - public static ElectricConductivity Zero { get; } = new ElectricConductivity(0, BaseUnit); + public static ElectricConductivity Zero { get; } = new ElectricConductivity((T)0, BaseUnit); #endregion @@ -141,7 +136,9 @@ public ElectricConductivity(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -171,17 +168,17 @@ public ElectricConductivity(double value, UnitSystem unitSystem) /// /// Get in SiemensPerFoot. /// - public double SiemensPerFoot => As(ElectricConductivityUnit.SiemensPerFoot); + public T SiemensPerFoot => As(ElectricConductivityUnit.SiemensPerFoot); /// /// Get in SiemensPerInch. /// - public double SiemensPerInch => As(ElectricConductivityUnit.SiemensPerInch); + public T SiemensPerInch => As(ElectricConductivityUnit.SiemensPerInch); /// /// Get in SiemensPerMeter. /// - public double SiemensPerMeter => As(ElectricConductivityUnit.SiemensPerMeter); + public T SiemensPerMeter => As(ElectricConductivityUnit.SiemensPerMeter); #endregion @@ -216,28 +213,25 @@ public static string GetAbbreviation(ElectricConductivityUnit unit, [CanBeNull] /// Get from SiemensPerFoot. /// /// If value is NaN or Infinity. - public static ElectricConductivity FromSiemensPerFoot(QuantityValue siemensperfoot) + public static ElectricConductivity FromSiemensPerFoot(T siemensperfoot) { - double value = (double) siemensperfoot; - return new ElectricConductivity(value, ElectricConductivityUnit.SiemensPerFoot); + return new ElectricConductivity(siemensperfoot, ElectricConductivityUnit.SiemensPerFoot); } /// /// Get from SiemensPerInch. /// /// If value is NaN or Infinity. - public static ElectricConductivity FromSiemensPerInch(QuantityValue siemensperinch) + public static ElectricConductivity FromSiemensPerInch(T siemensperinch) { - double value = (double) siemensperinch; - return new ElectricConductivity(value, ElectricConductivityUnit.SiemensPerInch); + return new ElectricConductivity(siemensperinch, ElectricConductivityUnit.SiemensPerInch); } /// /// Get from SiemensPerMeter. /// /// If value is NaN or Infinity. - public static ElectricConductivity FromSiemensPerMeter(QuantityValue siemenspermeter) + public static ElectricConductivity FromSiemensPerMeter(T siemenspermeter) { - double value = (double) siemenspermeter; - return new ElectricConductivity(value, ElectricConductivityUnit.SiemensPerMeter); + return new ElectricConductivity(siemenspermeter, ElectricConductivityUnit.SiemensPerMeter); } /// @@ -246,9 +240,9 @@ public static ElectricConductivity FromSiemensPerMeter(QuantityValue siemensp /// Value to convert from. /// Unit to convert from. /// unit value. - public static ElectricConductivity From(QuantityValue value, ElectricConductivityUnit fromUnit) + public static ElectricConductivity From(T value, ElectricConductivityUnit fromUnit) { - return new ElectricConductivity((double)value, fromUnit); + return new ElectricConductivity(value, fromUnit); } #endregion @@ -402,43 +396,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Negate the value. public static ElectricConductivity operator -(ElectricConductivity right) { - return new ElectricConductivity(-right.Value, right.Unit); + return new ElectricConductivity(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ElectricConductivity operator +(ElectricConductivity left, ElectricConductivity right) { - return new ElectricConductivity(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ElectricConductivity(value, left.Unit); } /// Get from subtracting two . public static ElectricConductivity operator -(ElectricConductivity left, ElectricConductivity right) { - return new ElectricConductivity(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ElectricConductivity(value, left.Unit); } /// Get from multiplying value and . - public static ElectricConductivity operator *(double left, ElectricConductivity right) + public static ElectricConductivity operator *(T left, ElectricConductivity right) { - return new ElectricConductivity(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ElectricConductivity(value, right.Unit); } /// Get from multiplying value and . - public static ElectricConductivity operator *(ElectricConductivity left, double right) + public static ElectricConductivity operator *(ElectricConductivity left, T right) { - return new ElectricConductivity(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ElectricConductivity(value, left.Unit); } /// Get from dividing by value. - public static ElectricConductivity operator /(ElectricConductivity left, double right) + public static ElectricConductivity operator /(ElectricConductivity left, T right) { - return new ElectricConductivity(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ElectricConductivity(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ElectricConductivity left, ElectricConductivity right) + public static T operator /(ElectricConductivity left, ElectricConductivity right) { - return left.SiemensPerMeter / right.SiemensPerMeter; + return CompiledLambdas.Divide(left.SiemensPerMeter, right.SiemensPerMeter); } #endregion @@ -448,25 +447,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Returns true if less or equal to. public static bool operator <=(ElectricConductivity left, ElectricConductivity right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ElectricConductivity left, ElectricConductivity right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ElectricConductivity left, ElectricConductivity right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ElectricConductivity left, ElectricConductivity right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -495,7 +494,7 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricConductivity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -512,7 +511,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricConductivity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -560,10 +559,8 @@ public bool Equals(ElectricConductivity other, double tolerance, ComparisonTy if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -583,17 +580,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricConductivityUnit unit) + public T As(ElectricConductivityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -613,9 +610,14 @@ double IQuantity.As(Enum unit) if(!(unit is ElectricConductivityUnit unitAsElectricConductivityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricConductivityUnit)} is supported.", nameof(unit)); - return As(unitAsElectricConductivityUnit); + var asValue = As(unitAsElectricConductivityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ElectricConductivityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -656,21 +658,27 @@ public ElectricConductivity ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ElectricConductivityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ElectricConductivityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ElectricConductivityUnit.SiemensPerFoot: return _value * 3.2808398950131234; - case ElectricConductivityUnit.SiemensPerInch: return _value * 3.937007874015748e1; - case ElectricConductivityUnit.SiemensPerMeter: return _value; + case ElectricConductivityUnit.SiemensPerFoot: return Value * 3.2808398950131234; + case ElectricConductivityUnit.SiemensPerInch: return Value * 3.937007874015748e1; + case ElectricConductivityUnit.SiemensPerMeter: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -687,10 +695,10 @@ internal ElectricConductivity ToBaseUnit() return new ElectricConductivity(baseUnitValue, BaseUnit); } - private double GetValueAs(ElectricConductivityUnit unit) + private T GetValueAs(ElectricConductivityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -800,7 +808,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -815,37 +823,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -869,17 +877,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs index 067a497ca5..b82b4fc853 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// An electric current is a flow of electric charge. In electric circuits this charge is often carried by moving electrons in a wire. It can also be carried by ions in an electrolyte, or by both ions and electrons such as in a plasma. /// - public partial struct ElectricCurrent : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ElectricCurrent : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -68,12 +63,12 @@ static ElectricCurrent() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ElectricCurrent(double value, ElectricCurrentUnit unit) + public ElectricCurrent(T value, ElectricCurrentUnit unit) { if(unit == ElectricCurrentUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -85,14 +80,14 @@ public ElectricCurrent(double value, ElectricCurrentUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ElectricCurrent(double value, UnitSystem unitSystem) + public ElectricCurrent(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -134,7 +129,7 @@ public ElectricCurrent(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Ampere. /// - public static ElectricCurrent Zero { get; } = new ElectricCurrent(0, BaseUnit); + public static ElectricCurrent Zero { get; } = new ElectricCurrent((T)0, BaseUnit); #endregion @@ -143,7 +138,9 @@ public ElectricCurrent(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -173,42 +170,42 @@ public ElectricCurrent(double value, UnitSystem unitSystem) /// /// Get in Amperes. /// - public double Amperes => As(ElectricCurrentUnit.Ampere); + public T Amperes => As(ElectricCurrentUnit.Ampere); /// /// Get in Centiamperes. /// - public double Centiamperes => As(ElectricCurrentUnit.Centiampere); + public T Centiamperes => As(ElectricCurrentUnit.Centiampere); /// /// Get in Kiloamperes. /// - public double Kiloamperes => As(ElectricCurrentUnit.Kiloampere); + public T Kiloamperes => As(ElectricCurrentUnit.Kiloampere); /// /// Get in Megaamperes. /// - public double Megaamperes => As(ElectricCurrentUnit.Megaampere); + public T Megaamperes => As(ElectricCurrentUnit.Megaampere); /// /// Get in Microamperes. /// - public double Microamperes => As(ElectricCurrentUnit.Microampere); + public T Microamperes => As(ElectricCurrentUnit.Microampere); /// /// Get in Milliamperes. /// - public double Milliamperes => As(ElectricCurrentUnit.Milliampere); + public T Milliamperes => As(ElectricCurrentUnit.Milliampere); /// /// Get in Nanoamperes. /// - public double Nanoamperes => As(ElectricCurrentUnit.Nanoampere); + public T Nanoamperes => As(ElectricCurrentUnit.Nanoampere); /// /// Get in Picoamperes. /// - public double Picoamperes => As(ElectricCurrentUnit.Picoampere); + public T Picoamperes => As(ElectricCurrentUnit.Picoampere); #endregion @@ -243,73 +240,65 @@ public static string GetAbbreviation(ElectricCurrentUnit unit, [CanBeNull] IForm /// Get from Amperes. /// /// If value is NaN or Infinity. - public static ElectricCurrent FromAmperes(QuantityValue amperes) + public static ElectricCurrent FromAmperes(T amperes) { - double value = (double) amperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Ampere); + return new ElectricCurrent(amperes, ElectricCurrentUnit.Ampere); } /// /// Get from Centiamperes. /// /// If value is NaN or Infinity. - public static ElectricCurrent FromCentiamperes(QuantityValue centiamperes) + public static ElectricCurrent FromCentiamperes(T centiamperes) { - double value = (double) centiamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Centiampere); + return new ElectricCurrent(centiamperes, ElectricCurrentUnit.Centiampere); } /// /// Get from Kiloamperes. /// /// If value is NaN or Infinity. - public static ElectricCurrent FromKiloamperes(QuantityValue kiloamperes) + public static ElectricCurrent FromKiloamperes(T kiloamperes) { - double value = (double) kiloamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Kiloampere); + return new ElectricCurrent(kiloamperes, ElectricCurrentUnit.Kiloampere); } /// /// Get from Megaamperes. /// /// If value is NaN or Infinity. - public static ElectricCurrent FromMegaamperes(QuantityValue megaamperes) + public static ElectricCurrent FromMegaamperes(T megaamperes) { - double value = (double) megaamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Megaampere); + return new ElectricCurrent(megaamperes, ElectricCurrentUnit.Megaampere); } /// /// Get from Microamperes. /// /// If value is NaN or Infinity. - public static ElectricCurrent FromMicroamperes(QuantityValue microamperes) + public static ElectricCurrent FromMicroamperes(T microamperes) { - double value = (double) microamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Microampere); + return new ElectricCurrent(microamperes, ElectricCurrentUnit.Microampere); } /// /// Get from Milliamperes. /// /// If value is NaN or Infinity. - public static ElectricCurrent FromMilliamperes(QuantityValue milliamperes) + public static ElectricCurrent FromMilliamperes(T milliamperes) { - double value = (double) milliamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Milliampere); + return new ElectricCurrent(milliamperes, ElectricCurrentUnit.Milliampere); } /// /// Get from Nanoamperes. /// /// If value is NaN or Infinity. - public static ElectricCurrent FromNanoamperes(QuantityValue nanoamperes) + public static ElectricCurrent FromNanoamperes(T nanoamperes) { - double value = (double) nanoamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Nanoampere); + return new ElectricCurrent(nanoamperes, ElectricCurrentUnit.Nanoampere); } /// /// Get from Picoamperes. /// /// If value is NaN or Infinity. - public static ElectricCurrent FromPicoamperes(QuantityValue picoamperes) + public static ElectricCurrent FromPicoamperes(T picoamperes) { - double value = (double) picoamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Picoampere); + return new ElectricCurrent(picoamperes, ElectricCurrentUnit.Picoampere); } /// @@ -318,9 +307,9 @@ public static ElectricCurrent FromPicoamperes(QuantityValue picoamperes) /// Value to convert from. /// Unit to convert from. /// unit value. - public static ElectricCurrent From(QuantityValue value, ElectricCurrentUnit fromUnit) + public static ElectricCurrent From(T value, ElectricCurrentUnit fromUnit) { - return new ElectricCurrent((double)value, fromUnit); + return new ElectricCurrent(value, fromUnit); } #endregion @@ -474,43 +463,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Negate the value. public static ElectricCurrent operator -(ElectricCurrent right) { - return new ElectricCurrent(-right.Value, right.Unit); + return new ElectricCurrent(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ElectricCurrent operator +(ElectricCurrent left, ElectricCurrent right) { - return new ElectricCurrent(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ElectricCurrent(value, left.Unit); } /// Get from subtracting two . public static ElectricCurrent operator -(ElectricCurrent left, ElectricCurrent right) { - return new ElectricCurrent(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ElectricCurrent(value, left.Unit); } /// Get from multiplying value and . - public static ElectricCurrent operator *(double left, ElectricCurrent right) + public static ElectricCurrent operator *(T left, ElectricCurrent right) { - return new ElectricCurrent(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ElectricCurrent(value, right.Unit); } /// Get from multiplying value and . - public static ElectricCurrent operator *(ElectricCurrent left, double right) + public static ElectricCurrent operator *(ElectricCurrent left, T right) { - return new ElectricCurrent(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ElectricCurrent(value, left.Unit); } /// Get from dividing by value. - public static ElectricCurrent operator /(ElectricCurrent left, double right) + public static ElectricCurrent operator /(ElectricCurrent left, T right) { - return new ElectricCurrent(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ElectricCurrent(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ElectricCurrent left, ElectricCurrent right) + public static T operator /(ElectricCurrent left, ElectricCurrent right) { - return left.Amperes / right.Amperes; + return CompiledLambdas.Divide(left.Amperes, right.Amperes); } #endregion @@ -520,25 +514,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Returns true if less or equal to. public static bool operator <=(ElectricCurrent left, ElectricCurrent right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ElectricCurrent left, ElectricCurrent right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ElectricCurrent left, ElectricCurrent right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ElectricCurrent left, ElectricCurrent right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -567,7 +561,7 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricCurrent other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -584,7 +578,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricCurrent other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -632,10 +626,8 @@ public bool Equals(ElectricCurrent other, double tolerance, ComparisonType co if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -655,17 +647,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricCurrentUnit unit) + public T As(ElectricCurrentUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -685,9 +677,14 @@ double IQuantity.As(Enum unit) if(!(unit is ElectricCurrentUnit unitAsElectricCurrentUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentUnit)} is supported.", nameof(unit)); - return As(unitAsElectricCurrentUnit); + var asValue = As(unitAsElectricCurrentUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ElectricCurrentUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -728,26 +725,32 @@ public ElectricCurrent ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ElectricCurrentUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ElectricCurrentUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ElectricCurrentUnit.Ampere: return _value; - case ElectricCurrentUnit.Centiampere: return (_value) * 1e-2d; - case ElectricCurrentUnit.Kiloampere: return (_value) * 1e3d; - case ElectricCurrentUnit.Megaampere: return (_value) * 1e6d; - case ElectricCurrentUnit.Microampere: return (_value) * 1e-6d; - case ElectricCurrentUnit.Milliampere: return (_value) * 1e-3d; - case ElectricCurrentUnit.Nanoampere: return (_value) * 1e-9d; - case ElectricCurrentUnit.Picoampere: return (_value) * 1e-12d; + case ElectricCurrentUnit.Ampere: return Value; + case ElectricCurrentUnit.Centiampere: return (Value) * 1e-2d; + case ElectricCurrentUnit.Kiloampere: return (Value) * 1e3d; + case ElectricCurrentUnit.Megaampere: return (Value) * 1e6d; + case ElectricCurrentUnit.Microampere: return (Value) * 1e-6d; + case ElectricCurrentUnit.Milliampere: return (Value) * 1e-3d; + case ElectricCurrentUnit.Nanoampere: return (Value) * 1e-9d; + case ElectricCurrentUnit.Picoampere: return (Value) * 1e-12d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -764,10 +767,10 @@ internal ElectricCurrent ToBaseUnit() return new ElectricCurrent(baseUnitValue, BaseUnit); } - private double GetValueAs(ElectricCurrentUnit unit) + private T GetValueAs(ElectricCurrentUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -882,7 +885,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -897,37 +900,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -951,17 +954,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs index bc9213f80a..77406d4455 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Current_density /// - public partial struct ElectricCurrentDensity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ElectricCurrentDensity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -66,12 +61,12 @@ static ElectricCurrentDensity() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ElectricCurrentDensity(double value, ElectricCurrentDensityUnit unit) + public ElectricCurrentDensity(T value, ElectricCurrentDensityUnit unit) { if(unit == ElectricCurrentDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -83,14 +78,14 @@ public ElectricCurrentDensity(double value, ElectricCurrentDensityUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ElectricCurrentDensity(double value, UnitSystem unitSystem) + public ElectricCurrentDensity(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -132,7 +127,7 @@ public ElectricCurrentDensity(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerSquareMeter. /// - public static ElectricCurrentDensity Zero { get; } = new ElectricCurrentDensity(0, BaseUnit); + public static ElectricCurrentDensity Zero { get; } = new ElectricCurrentDensity((T)0, BaseUnit); #endregion @@ -141,7 +136,9 @@ public ElectricCurrentDensity(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -171,17 +168,17 @@ public ElectricCurrentDensity(double value, UnitSystem unitSystem) /// /// Get in AmperesPerSquareFoot. /// - public double AmperesPerSquareFoot => As(ElectricCurrentDensityUnit.AmperePerSquareFoot); + public T AmperesPerSquareFoot => As(ElectricCurrentDensityUnit.AmperePerSquareFoot); /// /// Get in AmperesPerSquareInch. /// - public double AmperesPerSquareInch => As(ElectricCurrentDensityUnit.AmperePerSquareInch); + public T AmperesPerSquareInch => As(ElectricCurrentDensityUnit.AmperePerSquareInch); /// /// Get in AmperesPerSquareMeter. /// - public double AmperesPerSquareMeter => As(ElectricCurrentDensityUnit.AmperePerSquareMeter); + public T AmperesPerSquareMeter => As(ElectricCurrentDensityUnit.AmperePerSquareMeter); #endregion @@ -216,28 +213,25 @@ public static string GetAbbreviation(ElectricCurrentDensityUnit unit, [CanBeNull /// Get from AmperesPerSquareFoot. /// /// If value is NaN or Infinity. - public static ElectricCurrentDensity FromAmperesPerSquareFoot(QuantityValue amperespersquarefoot) + public static ElectricCurrentDensity FromAmperesPerSquareFoot(T amperespersquarefoot) { - double value = (double) amperespersquarefoot; - return new ElectricCurrentDensity(value, ElectricCurrentDensityUnit.AmperePerSquareFoot); + return new ElectricCurrentDensity(amperespersquarefoot, ElectricCurrentDensityUnit.AmperePerSquareFoot); } /// /// Get from AmperesPerSquareInch. /// /// If value is NaN or Infinity. - public static ElectricCurrentDensity FromAmperesPerSquareInch(QuantityValue amperespersquareinch) + public static ElectricCurrentDensity FromAmperesPerSquareInch(T amperespersquareinch) { - double value = (double) amperespersquareinch; - return new ElectricCurrentDensity(value, ElectricCurrentDensityUnit.AmperePerSquareInch); + return new ElectricCurrentDensity(amperespersquareinch, ElectricCurrentDensityUnit.AmperePerSquareInch); } /// /// Get from AmperesPerSquareMeter. /// /// If value is NaN or Infinity. - public static ElectricCurrentDensity FromAmperesPerSquareMeter(QuantityValue amperespersquaremeter) + public static ElectricCurrentDensity FromAmperesPerSquareMeter(T amperespersquaremeter) { - double value = (double) amperespersquaremeter; - return new ElectricCurrentDensity(value, ElectricCurrentDensityUnit.AmperePerSquareMeter); + return new ElectricCurrentDensity(amperespersquaremeter, ElectricCurrentDensityUnit.AmperePerSquareMeter); } /// @@ -246,9 +240,9 @@ public static ElectricCurrentDensity FromAmperesPerSquareMeter(QuantityValue /// Value to convert from. /// Unit to convert from. /// unit value. - public static ElectricCurrentDensity From(QuantityValue value, ElectricCurrentDensityUnit fromUnit) + public static ElectricCurrentDensity From(T value, ElectricCurrentDensityUnit fromUnit) { - return new ElectricCurrentDensity((double)value, fromUnit); + return new ElectricCurrentDensity(value, fromUnit); } #endregion @@ -402,43 +396,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Negate the value. public static ElectricCurrentDensity operator -(ElectricCurrentDensity right) { - return new ElectricCurrentDensity(-right.Value, right.Unit); + return new ElectricCurrentDensity(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ElectricCurrentDensity operator +(ElectricCurrentDensity left, ElectricCurrentDensity right) { - return new ElectricCurrentDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ElectricCurrentDensity(value, left.Unit); } /// Get from subtracting two . public static ElectricCurrentDensity operator -(ElectricCurrentDensity left, ElectricCurrentDensity right) { - return new ElectricCurrentDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ElectricCurrentDensity(value, left.Unit); } /// Get from multiplying value and . - public static ElectricCurrentDensity operator *(double left, ElectricCurrentDensity right) + public static ElectricCurrentDensity operator *(T left, ElectricCurrentDensity right) { - return new ElectricCurrentDensity(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ElectricCurrentDensity(value, right.Unit); } /// Get from multiplying value and . - public static ElectricCurrentDensity operator *(ElectricCurrentDensity left, double right) + public static ElectricCurrentDensity operator *(ElectricCurrentDensity left, T right) { - return new ElectricCurrentDensity(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ElectricCurrentDensity(value, left.Unit); } /// Get from dividing by value. - public static ElectricCurrentDensity operator /(ElectricCurrentDensity left, double right) + public static ElectricCurrentDensity operator /(ElectricCurrentDensity left, T right) { - return new ElectricCurrentDensity(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ElectricCurrentDensity(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ElectricCurrentDensity left, ElectricCurrentDensity right) + public static T operator /(ElectricCurrentDensity left, ElectricCurrentDensity right) { - return left.AmperesPerSquareMeter / right.AmperesPerSquareMeter; + return CompiledLambdas.Divide(left.AmperesPerSquareMeter, right.AmperesPerSquareMeter); } #endregion @@ -448,25 +447,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Returns true if less or equal to. public static bool operator <=(ElectricCurrentDensity left, ElectricCurrentDensity right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ElectricCurrentDensity left, ElectricCurrentDensity right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ElectricCurrentDensity left, ElectricCurrentDensity right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ElectricCurrentDensity left, ElectricCurrentDensity right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -495,7 +494,7 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricCurrentDensity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -512,7 +511,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricCurrentDensity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -560,10 +559,8 @@ public bool Equals(ElectricCurrentDensity other, double tolerance, Comparison if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -583,17 +580,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricCurrentDensityUnit unit) + public T As(ElectricCurrentDensityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -613,9 +610,14 @@ double IQuantity.As(Enum unit) if(!(unit is ElectricCurrentDensityUnit unitAsElectricCurrentDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentDensityUnit)} is supported.", nameof(unit)); - return As(unitAsElectricCurrentDensityUnit); + var asValue = As(unitAsElectricCurrentDensityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ElectricCurrentDensityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -656,21 +658,27 @@ public ElectricCurrentDensity ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ElectricCurrentDensityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ElectricCurrentDensityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ElectricCurrentDensityUnit.AmperePerSquareFoot: return _value * 1.0763910416709722e1; - case ElectricCurrentDensityUnit.AmperePerSquareInch: return _value * 1.5500031000062000e3; - case ElectricCurrentDensityUnit.AmperePerSquareMeter: return _value; + case ElectricCurrentDensityUnit.AmperePerSquareFoot: return Value * 1.0763910416709722e1; + case ElectricCurrentDensityUnit.AmperePerSquareInch: return Value * 1.5500031000062000e3; + case ElectricCurrentDensityUnit.AmperePerSquareMeter: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -687,10 +695,10 @@ internal ElectricCurrentDensity ToBaseUnit() return new ElectricCurrentDensity(baseUnitValue, BaseUnit); } - private double GetValueAs(ElectricCurrentDensityUnit unit) + private T GetValueAs(ElectricCurrentDensityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -800,7 +808,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -815,37 +823,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -869,17 +877,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs index 76dffdcb8a..bd4de6762f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// In electromagnetism, the current gradient describes how the current changes in time. /// - public partial struct ElectricCurrentGradient : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ElectricCurrentGradient : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -61,12 +56,12 @@ static ElectricCurrentGradient() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ElectricCurrentGradient(double value, ElectricCurrentGradientUnit unit) + public ElectricCurrentGradient(T value, ElectricCurrentGradientUnit unit) { if(unit == ElectricCurrentGradientUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -78,14 +73,14 @@ public ElectricCurrentGradient(double value, ElectricCurrentGradientUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ElectricCurrentGradient(double value, UnitSystem unitSystem) + public ElectricCurrentGradient(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -127,7 +122,7 @@ public ElectricCurrentGradient(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerSecond. /// - public static ElectricCurrentGradient Zero { get; } = new ElectricCurrentGradient(0, BaseUnit); + public static ElectricCurrentGradient Zero { get; } = new ElectricCurrentGradient((T)0, BaseUnit); #endregion @@ -136,7 +131,9 @@ public ElectricCurrentGradient(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -166,7 +163,7 @@ public ElectricCurrentGradient(double value, UnitSystem unitSystem) /// /// Get in AmperesPerSecond. /// - public double AmperesPerSecond => As(ElectricCurrentGradientUnit.AmperePerSecond); + public T AmperesPerSecond => As(ElectricCurrentGradientUnit.AmperePerSecond); #endregion @@ -201,10 +198,9 @@ public static string GetAbbreviation(ElectricCurrentGradientUnit unit, [CanBeNul /// Get from AmperesPerSecond. /// /// If value is NaN or Infinity. - public static ElectricCurrentGradient FromAmperesPerSecond(QuantityValue amperespersecond) + public static ElectricCurrentGradient FromAmperesPerSecond(T amperespersecond) { - double value = (double) amperespersecond; - return new ElectricCurrentGradient(value, ElectricCurrentGradientUnit.AmperePerSecond); + return new ElectricCurrentGradient(amperespersecond, ElectricCurrentGradientUnit.AmperePerSecond); } /// @@ -213,9 +209,9 @@ public static ElectricCurrentGradient FromAmperesPerSecond(QuantityValue ampe /// Value to convert from. /// Unit to convert from. /// unit value. - public static ElectricCurrentGradient From(QuantityValue value, ElectricCurrentGradientUnit fromUnit) + public static ElectricCurrentGradient From(T value, ElectricCurrentGradientUnit fromUnit) { - return new ElectricCurrentGradient((double)value, fromUnit); + return new ElectricCurrentGradient(value, fromUnit); } #endregion @@ -369,43 +365,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Negate the value. public static ElectricCurrentGradient operator -(ElectricCurrentGradient right) { - return new ElectricCurrentGradient(-right.Value, right.Unit); + return new ElectricCurrentGradient(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ElectricCurrentGradient operator +(ElectricCurrentGradient left, ElectricCurrentGradient right) { - return new ElectricCurrentGradient(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ElectricCurrentGradient(value, left.Unit); } /// Get from subtracting two . public static ElectricCurrentGradient operator -(ElectricCurrentGradient left, ElectricCurrentGradient right) { - return new ElectricCurrentGradient(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ElectricCurrentGradient(value, left.Unit); } /// Get from multiplying value and . - public static ElectricCurrentGradient operator *(double left, ElectricCurrentGradient right) + public static ElectricCurrentGradient operator *(T left, ElectricCurrentGradient right) { - return new ElectricCurrentGradient(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ElectricCurrentGradient(value, right.Unit); } /// Get from multiplying value and . - public static ElectricCurrentGradient operator *(ElectricCurrentGradient left, double right) + public static ElectricCurrentGradient operator *(ElectricCurrentGradient left, T right) { - return new ElectricCurrentGradient(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ElectricCurrentGradient(value, left.Unit); } /// Get from dividing by value. - public static ElectricCurrentGradient operator /(ElectricCurrentGradient left, double right) + public static ElectricCurrentGradient operator /(ElectricCurrentGradient left, T right) { - return new ElectricCurrentGradient(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ElectricCurrentGradient(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ElectricCurrentGradient left, ElectricCurrentGradient right) + public static T operator /(ElectricCurrentGradient left, ElectricCurrentGradient right) { - return left.AmperesPerSecond / right.AmperesPerSecond; + return CompiledLambdas.Divide(left.AmperesPerSecond, right.AmperesPerSecond); } #endregion @@ -415,25 +416,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Returns true if less or equal to. public static bool operator <=(ElectricCurrentGradient left, ElectricCurrentGradient right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ElectricCurrentGradient left, ElectricCurrentGradient right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ElectricCurrentGradient left, ElectricCurrentGradient right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ElectricCurrentGradient left, ElectricCurrentGradient right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -462,7 +463,7 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricCurrentGradient other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -479,7 +480,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricCurrentGradient other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -527,10 +528,8 @@ public bool Equals(ElectricCurrentGradient other, double tolerance, Compariso if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -550,17 +549,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricCurrentGradientUnit unit) + public T As(ElectricCurrentGradientUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -580,9 +579,14 @@ double IQuantity.As(Enum unit) if(!(unit is ElectricCurrentGradientUnit unitAsElectricCurrentGradientUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentGradientUnit)} is supported.", nameof(unit)); - return As(unitAsElectricCurrentGradientUnit); + var asValue = As(unitAsElectricCurrentGradientUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ElectricCurrentGradientUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -623,19 +627,25 @@ public ElectricCurrentGradient ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ElectricCurrentGradientUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ElectricCurrentGradientUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ElectricCurrentGradientUnit.AmperePerSecond: return _value; + case ElectricCurrentGradientUnit.AmperePerSecond: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -652,10 +662,10 @@ internal ElectricCurrentGradient ToBaseUnit() return new ElectricCurrentGradient(baseUnitValue, BaseUnit); } - private double GetValueAs(ElectricCurrentGradientUnit unit) + private T GetValueAs(ElectricCurrentGradientUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -763,7 +773,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -778,37 +788,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -832,17 +842,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs index 2b54907115..8eeaaabfd6 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electric_field /// - public partial struct ElectricField : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ElectricField : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -64,12 +59,12 @@ static ElectricField() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ElectricField(double value, ElectricFieldUnit unit) + public ElectricField(T value, ElectricFieldUnit unit) { if(unit == ElectricFieldUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -81,14 +76,14 @@ public ElectricField(double value, ElectricFieldUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ElectricField(double value, UnitSystem unitSystem) + public ElectricField(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -130,7 +125,7 @@ public ElectricField(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltPerMeter. /// - public static ElectricField Zero { get; } = new ElectricField(0, BaseUnit); + public static ElectricField Zero { get; } = new ElectricField((T)0, BaseUnit); #endregion @@ -139,7 +134,9 @@ public ElectricField(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -169,7 +166,7 @@ public ElectricField(double value, UnitSystem unitSystem) /// /// Get in VoltsPerMeter. /// - public double VoltsPerMeter => As(ElectricFieldUnit.VoltPerMeter); + public T VoltsPerMeter => As(ElectricFieldUnit.VoltPerMeter); #endregion @@ -204,10 +201,9 @@ public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] IFormat /// Get from VoltsPerMeter. /// /// If value is NaN or Infinity. - public static ElectricField FromVoltsPerMeter(QuantityValue voltspermeter) + public static ElectricField FromVoltsPerMeter(T voltspermeter) { - double value = (double) voltspermeter; - return new ElectricField(value, ElectricFieldUnit.VoltPerMeter); + return new ElectricField(voltspermeter, ElectricFieldUnit.VoltPerMeter); } /// @@ -216,9 +212,9 @@ public static ElectricField FromVoltsPerMeter(QuantityValue voltspermeter) /// Value to convert from. /// Unit to convert from. /// unit value. - public static ElectricField From(QuantityValue value, ElectricFieldUnit fromUnit) + public static ElectricField From(T value, ElectricFieldUnit fromUnit) { - return new ElectricField((double)value, fromUnit); + return new ElectricField(value, fromUnit); } #endregion @@ -372,43 +368,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Negate the value. public static ElectricField operator -(ElectricField right) { - return new ElectricField(-right.Value, right.Unit); + return new ElectricField(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ElectricField operator +(ElectricField left, ElectricField right) { - return new ElectricField(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ElectricField(value, left.Unit); } /// Get from subtracting two . public static ElectricField operator -(ElectricField left, ElectricField right) { - return new ElectricField(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ElectricField(value, left.Unit); } /// Get from multiplying value and . - public static ElectricField operator *(double left, ElectricField right) + public static ElectricField operator *(T left, ElectricField right) { - return new ElectricField(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ElectricField(value, right.Unit); } /// Get from multiplying value and . - public static ElectricField operator *(ElectricField left, double right) + public static ElectricField operator *(ElectricField left, T right) { - return new ElectricField(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ElectricField(value, left.Unit); } /// Get from dividing by value. - public static ElectricField operator /(ElectricField left, double right) + public static ElectricField operator /(ElectricField left, T right) { - return new ElectricField(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ElectricField(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ElectricField left, ElectricField right) + public static T operator /(ElectricField left, ElectricField right) { - return left.VoltsPerMeter / right.VoltsPerMeter; + return CompiledLambdas.Divide(left.VoltsPerMeter, right.VoltsPerMeter); } #endregion @@ -418,25 +419,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Returns true if less or equal to. public static bool operator <=(ElectricField left, ElectricField right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ElectricField left, ElectricField right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ElectricField left, ElectricField right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ElectricField left, ElectricField right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -465,7 +466,7 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricField other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -482,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricField other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -530,10 +531,8 @@ public bool Equals(ElectricField other, double tolerance, ComparisonType comp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -553,17 +552,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricFieldUnit unit) + public T As(ElectricFieldUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -583,9 +582,14 @@ double IQuantity.As(Enum unit) if(!(unit is ElectricFieldUnit unitAsElectricFieldUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricFieldUnit)} is supported.", nameof(unit)); - return As(unitAsElectricFieldUnit); + var asValue = As(unitAsElectricFieldUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ElectricFieldUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -626,19 +630,25 @@ public ElectricField ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ElectricFieldUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ElectricFieldUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ElectricFieldUnit.VoltPerMeter: return _value; + case ElectricFieldUnit.VoltPerMeter: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -655,10 +665,10 @@ internal ElectricField ToBaseUnit() return new ElectricField(baseUnitValue, BaseUnit); } - private double GetValueAs(ElectricFieldUnit unit) + private T GetValueAs(ElectricFieldUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -766,7 +776,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -781,37 +791,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -835,17 +845,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs index 6cf5da815e..d7e795392e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Inductance /// - public partial struct ElectricInductance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ElectricInductance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -67,12 +62,12 @@ static ElectricInductance() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ElectricInductance(double value, ElectricInductanceUnit unit) + public ElectricInductance(T value, ElectricInductanceUnit unit) { if(unit == ElectricInductanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -84,14 +79,14 @@ public ElectricInductance(double value, ElectricInductanceUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ElectricInductance(double value, UnitSystem unitSystem) + public ElectricInductance(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -133,7 +128,7 @@ public ElectricInductance(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Henry. /// - public static ElectricInductance Zero { get; } = new ElectricInductance(0, BaseUnit); + public static ElectricInductance Zero { get; } = new ElectricInductance((T)0, BaseUnit); #endregion @@ -142,7 +137,9 @@ public ElectricInductance(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -172,22 +169,22 @@ public ElectricInductance(double value, UnitSystem unitSystem) /// /// Get in Henries. /// - public double Henries => As(ElectricInductanceUnit.Henry); + public T Henries => As(ElectricInductanceUnit.Henry); /// /// Get in Microhenries. /// - public double Microhenries => As(ElectricInductanceUnit.Microhenry); + public T Microhenries => As(ElectricInductanceUnit.Microhenry); /// /// Get in Millihenries. /// - public double Millihenries => As(ElectricInductanceUnit.Millihenry); + public T Millihenries => As(ElectricInductanceUnit.Millihenry); /// /// Get in Nanohenries. /// - public double Nanohenries => As(ElectricInductanceUnit.Nanohenry); + public T Nanohenries => As(ElectricInductanceUnit.Nanohenry); #endregion @@ -222,37 +219,33 @@ public static string GetAbbreviation(ElectricInductanceUnit unit, [CanBeNull] IF /// Get from Henries. /// /// If value is NaN or Infinity. - public static ElectricInductance FromHenries(QuantityValue henries) + public static ElectricInductance FromHenries(T henries) { - double value = (double) henries; - return new ElectricInductance(value, ElectricInductanceUnit.Henry); + return new ElectricInductance(henries, ElectricInductanceUnit.Henry); } /// /// Get from Microhenries. /// /// If value is NaN or Infinity. - public static ElectricInductance FromMicrohenries(QuantityValue microhenries) + public static ElectricInductance FromMicrohenries(T microhenries) { - double value = (double) microhenries; - return new ElectricInductance(value, ElectricInductanceUnit.Microhenry); + return new ElectricInductance(microhenries, ElectricInductanceUnit.Microhenry); } /// /// Get from Millihenries. /// /// If value is NaN or Infinity. - public static ElectricInductance FromMillihenries(QuantityValue millihenries) + public static ElectricInductance FromMillihenries(T millihenries) { - double value = (double) millihenries; - return new ElectricInductance(value, ElectricInductanceUnit.Millihenry); + return new ElectricInductance(millihenries, ElectricInductanceUnit.Millihenry); } /// /// Get from Nanohenries. /// /// If value is NaN or Infinity. - public static ElectricInductance FromNanohenries(QuantityValue nanohenries) + public static ElectricInductance FromNanohenries(T nanohenries) { - double value = (double) nanohenries; - return new ElectricInductance(value, ElectricInductanceUnit.Nanohenry); + return new ElectricInductance(nanohenries, ElectricInductanceUnit.Nanohenry); } /// @@ -261,9 +254,9 @@ public static ElectricInductance FromNanohenries(QuantityValue nanohenries) /// Value to convert from. /// Unit to convert from. /// unit value. - public static ElectricInductance From(QuantityValue value, ElectricInductanceUnit fromUnit) + public static ElectricInductance From(T value, ElectricInductanceUnit fromUnit) { - return new ElectricInductance((double)value, fromUnit); + return new ElectricInductance(value, fromUnit); } #endregion @@ -417,43 +410,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Negate the value. public static ElectricInductance operator -(ElectricInductance right) { - return new ElectricInductance(-right.Value, right.Unit); + return new ElectricInductance(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ElectricInductance operator +(ElectricInductance left, ElectricInductance right) { - return new ElectricInductance(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ElectricInductance(value, left.Unit); } /// Get from subtracting two . public static ElectricInductance operator -(ElectricInductance left, ElectricInductance right) { - return new ElectricInductance(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ElectricInductance(value, left.Unit); } /// Get from multiplying value and . - public static ElectricInductance operator *(double left, ElectricInductance right) + public static ElectricInductance operator *(T left, ElectricInductance right) { - return new ElectricInductance(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ElectricInductance(value, right.Unit); } /// Get from multiplying value and . - public static ElectricInductance operator *(ElectricInductance left, double right) + public static ElectricInductance operator *(ElectricInductance left, T right) { - return new ElectricInductance(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ElectricInductance(value, left.Unit); } /// Get from dividing by value. - public static ElectricInductance operator /(ElectricInductance left, double right) + public static ElectricInductance operator /(ElectricInductance left, T right) { - return new ElectricInductance(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ElectricInductance(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ElectricInductance left, ElectricInductance right) + public static T operator /(ElectricInductance left, ElectricInductance right) { - return left.Henries / right.Henries; + return CompiledLambdas.Divide(left.Henries, right.Henries); } #endregion @@ -463,25 +461,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Returns true if less or equal to. public static bool operator <=(ElectricInductance left, ElectricInductance right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ElectricInductance left, ElectricInductance right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ElectricInductance left, ElectricInductance right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ElectricInductance left, ElectricInductance right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -510,7 +508,7 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricInductance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -527,7 +525,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricInductance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -575,10 +573,8 @@ public bool Equals(ElectricInductance other, double tolerance, ComparisonType if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -598,17 +594,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricInductanceUnit unit) + public T As(ElectricInductanceUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -628,9 +624,14 @@ double IQuantity.As(Enum unit) if(!(unit is ElectricInductanceUnit unitAsElectricInductanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricInductanceUnit)} is supported.", nameof(unit)); - return As(unitAsElectricInductanceUnit); + var asValue = As(unitAsElectricInductanceUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ElectricInductanceUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -671,22 +672,28 @@ public ElectricInductance ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ElectricInductanceUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ElectricInductanceUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ElectricInductanceUnit.Henry: return _value; - case ElectricInductanceUnit.Microhenry: return (_value) * 1e-6d; - case ElectricInductanceUnit.Millihenry: return (_value) * 1e-3d; - case ElectricInductanceUnit.Nanohenry: return (_value) * 1e-9d; + case ElectricInductanceUnit.Henry: return Value; + case ElectricInductanceUnit.Microhenry: return (Value) * 1e-6d; + case ElectricInductanceUnit.Millihenry: return (Value) * 1e-3d; + case ElectricInductanceUnit.Nanohenry: return (Value) * 1e-9d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -703,10 +710,10 @@ internal ElectricInductance ToBaseUnit() return new ElectricInductance(baseUnitValue, BaseUnit); } - private double GetValueAs(ElectricInductanceUnit unit) + private T GetValueAs(ElectricInductanceUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -817,7 +824,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -832,37 +839,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -886,17 +893,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs index aaad50c91e..57172714ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// In classical electromagnetism, the electric potential (a scalar quantity denoted by Φ, ΦE or V and also called the electric field potential or the electrostatic potential) at a point is the amount of electric potential energy that a unitary point charge would have when located at that point. /// - public partial struct ElectricPotential : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ElectricPotential : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -65,12 +60,12 @@ static ElectricPotential() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ElectricPotential(double value, ElectricPotentialUnit unit) + public ElectricPotential(T value, ElectricPotentialUnit unit) { if(unit == ElectricPotentialUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -82,14 +77,14 @@ public ElectricPotential(double value, ElectricPotentialUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ElectricPotential(double value, UnitSystem unitSystem) + public ElectricPotential(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -131,7 +126,7 @@ public ElectricPotential(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Volt. /// - public static ElectricPotential Zero { get; } = new ElectricPotential(0, BaseUnit); + public static ElectricPotential Zero { get; } = new ElectricPotential((T)0, BaseUnit); #endregion @@ -140,7 +135,9 @@ public ElectricPotential(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -170,27 +167,27 @@ public ElectricPotential(double value, UnitSystem unitSystem) /// /// Get in Kilovolts. /// - public double Kilovolts => As(ElectricPotentialUnit.Kilovolt); + public T Kilovolts => As(ElectricPotentialUnit.Kilovolt); /// /// Get in Megavolts. /// - public double Megavolts => As(ElectricPotentialUnit.Megavolt); + public T Megavolts => As(ElectricPotentialUnit.Megavolt); /// /// Get in Microvolts. /// - public double Microvolts => As(ElectricPotentialUnit.Microvolt); + public T Microvolts => As(ElectricPotentialUnit.Microvolt); /// /// Get in Millivolts. /// - public double Millivolts => As(ElectricPotentialUnit.Millivolt); + public T Millivolts => As(ElectricPotentialUnit.Millivolt); /// /// Get in Volts. /// - public double Volts => As(ElectricPotentialUnit.Volt); + public T Volts => As(ElectricPotentialUnit.Volt); #endregion @@ -225,46 +222,41 @@ public static string GetAbbreviation(ElectricPotentialUnit unit, [CanBeNull] IFo /// Get from Kilovolts. /// /// If value is NaN or Infinity. - public static ElectricPotential FromKilovolts(QuantityValue kilovolts) + public static ElectricPotential FromKilovolts(T kilovolts) { - double value = (double) kilovolts; - return new ElectricPotential(value, ElectricPotentialUnit.Kilovolt); + return new ElectricPotential(kilovolts, ElectricPotentialUnit.Kilovolt); } /// /// Get from Megavolts. /// /// If value is NaN or Infinity. - public static ElectricPotential FromMegavolts(QuantityValue megavolts) + public static ElectricPotential FromMegavolts(T megavolts) { - double value = (double) megavolts; - return new ElectricPotential(value, ElectricPotentialUnit.Megavolt); + return new ElectricPotential(megavolts, ElectricPotentialUnit.Megavolt); } /// /// Get from Microvolts. /// /// If value is NaN or Infinity. - public static ElectricPotential FromMicrovolts(QuantityValue microvolts) + public static ElectricPotential FromMicrovolts(T microvolts) { - double value = (double) microvolts; - return new ElectricPotential(value, ElectricPotentialUnit.Microvolt); + return new ElectricPotential(microvolts, ElectricPotentialUnit.Microvolt); } /// /// Get from Millivolts. /// /// If value is NaN or Infinity. - public static ElectricPotential FromMillivolts(QuantityValue millivolts) + public static ElectricPotential FromMillivolts(T millivolts) { - double value = (double) millivolts; - return new ElectricPotential(value, ElectricPotentialUnit.Millivolt); + return new ElectricPotential(millivolts, ElectricPotentialUnit.Millivolt); } /// /// Get from Volts. /// /// If value is NaN or Infinity. - public static ElectricPotential FromVolts(QuantityValue volts) + public static ElectricPotential FromVolts(T volts) { - double value = (double) volts; - return new ElectricPotential(value, ElectricPotentialUnit.Volt); + return new ElectricPotential(volts, ElectricPotentialUnit.Volt); } /// @@ -273,9 +265,9 @@ public static ElectricPotential FromVolts(QuantityValue volts) /// Value to convert from. /// Unit to convert from. /// unit value. - public static ElectricPotential From(QuantityValue value, ElectricPotentialUnit fromUnit) + public static ElectricPotential From(T value, ElectricPotentialUnit fromUnit) { - return new ElectricPotential((double)value, fromUnit); + return new ElectricPotential(value, fromUnit); } #endregion @@ -429,43 +421,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Negate the value. public static ElectricPotential operator -(ElectricPotential right) { - return new ElectricPotential(-right.Value, right.Unit); + return new ElectricPotential(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ElectricPotential operator +(ElectricPotential left, ElectricPotential right) { - return new ElectricPotential(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ElectricPotential(value, left.Unit); } /// Get from subtracting two . public static ElectricPotential operator -(ElectricPotential left, ElectricPotential right) { - return new ElectricPotential(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ElectricPotential(value, left.Unit); } /// Get from multiplying value and . - public static ElectricPotential operator *(double left, ElectricPotential right) + public static ElectricPotential operator *(T left, ElectricPotential right) { - return new ElectricPotential(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ElectricPotential(value, right.Unit); } /// Get from multiplying value and . - public static ElectricPotential operator *(ElectricPotential left, double right) + public static ElectricPotential operator *(ElectricPotential left, T right) { - return new ElectricPotential(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ElectricPotential(value, left.Unit); } /// Get from dividing by value. - public static ElectricPotential operator /(ElectricPotential left, double right) + public static ElectricPotential operator /(ElectricPotential left, T right) { - return new ElectricPotential(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ElectricPotential(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ElectricPotential left, ElectricPotential right) + public static T operator /(ElectricPotential left, ElectricPotential right) { - return left.Volts / right.Volts; + return CompiledLambdas.Divide(left.Volts, right.Volts); } #endregion @@ -475,25 +472,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Returns true if less or equal to. public static bool operator <=(ElectricPotential left, ElectricPotential right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ElectricPotential left, ElectricPotential right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ElectricPotential left, ElectricPotential right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ElectricPotential left, ElectricPotential right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -522,7 +519,7 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricPotential other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -539,7 +536,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricPotential other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -587,10 +584,8 @@ public bool Equals(ElectricPotential other, double tolerance, ComparisonType if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -610,17 +605,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricPotentialUnit unit) + public T As(ElectricPotentialUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -640,9 +635,14 @@ double IQuantity.As(Enum unit) if(!(unit is ElectricPotentialUnit unitAsElectricPotentialUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialUnit)} is supported.", nameof(unit)); - return As(unitAsElectricPotentialUnit); + var asValue = As(unitAsElectricPotentialUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ElectricPotentialUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -683,23 +683,29 @@ public ElectricPotential ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ElectricPotentialUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ElectricPotentialUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ElectricPotentialUnit.Kilovolt: return (_value) * 1e3d; - case ElectricPotentialUnit.Megavolt: return (_value) * 1e6d; - case ElectricPotentialUnit.Microvolt: return (_value) * 1e-6d; - case ElectricPotentialUnit.Millivolt: return (_value) * 1e-3d; - case ElectricPotentialUnit.Volt: return _value; + case ElectricPotentialUnit.Kilovolt: return (Value) * 1e3d; + case ElectricPotentialUnit.Megavolt: return (Value) * 1e6d; + case ElectricPotentialUnit.Microvolt: return (Value) * 1e-6d; + case ElectricPotentialUnit.Millivolt: return (Value) * 1e-3d; + case ElectricPotentialUnit.Volt: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -716,10 +722,10 @@ internal ElectricPotential ToBaseUnit() return new ElectricPotential(baseUnitValue, BaseUnit); } - private double GetValueAs(ElectricPotentialUnit unit) + private T GetValueAs(ElectricPotentialUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -831,7 +837,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -846,37 +852,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -900,17 +906,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs index 45d84611c7..73391d2353 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// The Electric Potential of a system known to use Alternating Current. /// - public partial struct ElectricPotentialAc : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ElectricPotentialAc : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -65,12 +60,12 @@ static ElectricPotentialAc() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ElectricPotentialAc(double value, ElectricPotentialAcUnit unit) + public ElectricPotentialAc(T value, ElectricPotentialAcUnit unit) { if(unit == ElectricPotentialAcUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -82,14 +77,14 @@ public ElectricPotentialAc(double value, ElectricPotentialAcUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ElectricPotentialAc(double value, UnitSystem unitSystem) + public ElectricPotentialAc(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -131,7 +126,7 @@ public ElectricPotentialAc(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltAc. /// - public static ElectricPotentialAc Zero { get; } = new ElectricPotentialAc(0, BaseUnit); + public static ElectricPotentialAc Zero { get; } = new ElectricPotentialAc((T)0, BaseUnit); #endregion @@ -140,7 +135,9 @@ public ElectricPotentialAc(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -170,27 +167,27 @@ public ElectricPotentialAc(double value, UnitSystem unitSystem) /// /// Get in KilovoltsAc. /// - public double KilovoltsAc => As(ElectricPotentialAcUnit.KilovoltAc); + public T KilovoltsAc => As(ElectricPotentialAcUnit.KilovoltAc); /// /// Get in MegavoltsAc. /// - public double MegavoltsAc => As(ElectricPotentialAcUnit.MegavoltAc); + public T MegavoltsAc => As(ElectricPotentialAcUnit.MegavoltAc); /// /// Get in MicrovoltsAc. /// - public double MicrovoltsAc => As(ElectricPotentialAcUnit.MicrovoltAc); + public T MicrovoltsAc => As(ElectricPotentialAcUnit.MicrovoltAc); /// /// Get in MillivoltsAc. /// - public double MillivoltsAc => As(ElectricPotentialAcUnit.MillivoltAc); + public T MillivoltsAc => As(ElectricPotentialAcUnit.MillivoltAc); /// /// Get in VoltsAc. /// - public double VoltsAc => As(ElectricPotentialAcUnit.VoltAc); + public T VoltsAc => As(ElectricPotentialAcUnit.VoltAc); #endregion @@ -225,46 +222,41 @@ public static string GetAbbreviation(ElectricPotentialAcUnit unit, [CanBeNull] I /// Get from KilovoltsAc. /// /// If value is NaN or Infinity. - public static ElectricPotentialAc FromKilovoltsAc(QuantityValue kilovoltsac) + public static ElectricPotentialAc FromKilovoltsAc(T kilovoltsac) { - double value = (double) kilovoltsac; - return new ElectricPotentialAc(value, ElectricPotentialAcUnit.KilovoltAc); + return new ElectricPotentialAc(kilovoltsac, ElectricPotentialAcUnit.KilovoltAc); } /// /// Get from MegavoltsAc. /// /// If value is NaN or Infinity. - public static ElectricPotentialAc FromMegavoltsAc(QuantityValue megavoltsac) + public static ElectricPotentialAc FromMegavoltsAc(T megavoltsac) { - double value = (double) megavoltsac; - return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MegavoltAc); + return new ElectricPotentialAc(megavoltsac, ElectricPotentialAcUnit.MegavoltAc); } /// /// Get from MicrovoltsAc. /// /// If value is NaN or Infinity. - public static ElectricPotentialAc FromMicrovoltsAc(QuantityValue microvoltsac) + public static ElectricPotentialAc FromMicrovoltsAc(T microvoltsac) { - double value = (double) microvoltsac; - return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MicrovoltAc); + return new ElectricPotentialAc(microvoltsac, ElectricPotentialAcUnit.MicrovoltAc); } /// /// Get from MillivoltsAc. /// /// If value is NaN or Infinity. - public static ElectricPotentialAc FromMillivoltsAc(QuantityValue millivoltsac) + public static ElectricPotentialAc FromMillivoltsAc(T millivoltsac) { - double value = (double) millivoltsac; - return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MillivoltAc); + return new ElectricPotentialAc(millivoltsac, ElectricPotentialAcUnit.MillivoltAc); } /// /// Get from VoltsAc. /// /// If value is NaN or Infinity. - public static ElectricPotentialAc FromVoltsAc(QuantityValue voltsac) + public static ElectricPotentialAc FromVoltsAc(T voltsac) { - double value = (double) voltsac; - return new ElectricPotentialAc(value, ElectricPotentialAcUnit.VoltAc); + return new ElectricPotentialAc(voltsac, ElectricPotentialAcUnit.VoltAc); } /// @@ -273,9 +265,9 @@ public static ElectricPotentialAc FromVoltsAc(QuantityValue voltsac) /// Value to convert from. /// Unit to convert from. /// unit value. - public static ElectricPotentialAc From(QuantityValue value, ElectricPotentialAcUnit fromUnit) + public static ElectricPotentialAc From(T value, ElectricPotentialAcUnit fromUnit) { - return new ElectricPotentialAc((double)value, fromUnit); + return new ElectricPotentialAc(value, fromUnit); } #endregion @@ -429,43 +421,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Negate the value. public static ElectricPotentialAc operator -(ElectricPotentialAc right) { - return new ElectricPotentialAc(-right.Value, right.Unit); + return new ElectricPotentialAc(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ElectricPotentialAc operator +(ElectricPotentialAc left, ElectricPotentialAc right) { - return new ElectricPotentialAc(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ElectricPotentialAc(value, left.Unit); } /// Get from subtracting two . public static ElectricPotentialAc operator -(ElectricPotentialAc left, ElectricPotentialAc right) { - return new ElectricPotentialAc(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ElectricPotentialAc(value, left.Unit); } /// Get from multiplying value and . - public static ElectricPotentialAc operator *(double left, ElectricPotentialAc right) + public static ElectricPotentialAc operator *(T left, ElectricPotentialAc right) { - return new ElectricPotentialAc(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ElectricPotentialAc(value, right.Unit); } /// Get from multiplying value and . - public static ElectricPotentialAc operator *(ElectricPotentialAc left, double right) + public static ElectricPotentialAc operator *(ElectricPotentialAc left, T right) { - return new ElectricPotentialAc(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ElectricPotentialAc(value, left.Unit); } /// Get from dividing by value. - public static ElectricPotentialAc operator /(ElectricPotentialAc left, double right) + public static ElectricPotentialAc operator /(ElectricPotentialAc left, T right) { - return new ElectricPotentialAc(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ElectricPotentialAc(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ElectricPotentialAc left, ElectricPotentialAc right) + public static T operator /(ElectricPotentialAc left, ElectricPotentialAc right) { - return left.VoltsAc / right.VoltsAc; + return CompiledLambdas.Divide(left.VoltsAc, right.VoltsAc); } #endregion @@ -475,25 +472,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Returns true if less or equal to. public static bool operator <=(ElectricPotentialAc left, ElectricPotentialAc right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ElectricPotentialAc left, ElectricPotentialAc right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ElectricPotentialAc left, ElectricPotentialAc right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ElectricPotentialAc left, ElectricPotentialAc right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -522,7 +519,7 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricPotentialAc other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -539,7 +536,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricPotentialAc other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -587,10 +584,8 @@ public bool Equals(ElectricPotentialAc other, double tolerance, ComparisonTyp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -610,17 +605,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricPotentialAcUnit unit) + public T As(ElectricPotentialAcUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -640,9 +635,14 @@ double IQuantity.As(Enum unit) if(!(unit is ElectricPotentialAcUnit unitAsElectricPotentialAcUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialAcUnit)} is supported.", nameof(unit)); - return As(unitAsElectricPotentialAcUnit); + var asValue = As(unitAsElectricPotentialAcUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ElectricPotentialAcUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -683,23 +683,29 @@ public ElectricPotentialAc ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ElectricPotentialAcUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ElectricPotentialAcUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ElectricPotentialAcUnit.KilovoltAc: return (_value) * 1e3d; - case ElectricPotentialAcUnit.MegavoltAc: return (_value) * 1e6d; - case ElectricPotentialAcUnit.MicrovoltAc: return (_value) * 1e-6d; - case ElectricPotentialAcUnit.MillivoltAc: return (_value) * 1e-3d; - case ElectricPotentialAcUnit.VoltAc: return _value; + case ElectricPotentialAcUnit.KilovoltAc: return (Value) * 1e3d; + case ElectricPotentialAcUnit.MegavoltAc: return (Value) * 1e6d; + case ElectricPotentialAcUnit.MicrovoltAc: return (Value) * 1e-6d; + case ElectricPotentialAcUnit.MillivoltAc: return (Value) * 1e-3d; + case ElectricPotentialAcUnit.VoltAc: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -716,10 +722,10 @@ internal ElectricPotentialAc ToBaseUnit() return new ElectricPotentialAc(baseUnitValue, BaseUnit); } - private double GetValueAs(ElectricPotentialAcUnit unit) + private T GetValueAs(ElectricPotentialAcUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -831,7 +837,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -846,37 +852,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -900,17 +906,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs index 77516c6992..e9f433570e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// The Electric Potential of a system known to use Direct Current. /// - public partial struct ElectricPotentialDc : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ElectricPotentialDc : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -65,12 +60,12 @@ static ElectricPotentialDc() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ElectricPotentialDc(double value, ElectricPotentialDcUnit unit) + public ElectricPotentialDc(T value, ElectricPotentialDcUnit unit) { if(unit == ElectricPotentialDcUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -82,14 +77,14 @@ public ElectricPotentialDc(double value, ElectricPotentialDcUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ElectricPotentialDc(double value, UnitSystem unitSystem) + public ElectricPotentialDc(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -131,7 +126,7 @@ public ElectricPotentialDc(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltDc. /// - public static ElectricPotentialDc Zero { get; } = new ElectricPotentialDc(0, BaseUnit); + public static ElectricPotentialDc Zero { get; } = new ElectricPotentialDc((T)0, BaseUnit); #endregion @@ -140,7 +135,9 @@ public ElectricPotentialDc(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -170,27 +167,27 @@ public ElectricPotentialDc(double value, UnitSystem unitSystem) /// /// Get in KilovoltsDc. /// - public double KilovoltsDc => As(ElectricPotentialDcUnit.KilovoltDc); + public T KilovoltsDc => As(ElectricPotentialDcUnit.KilovoltDc); /// /// Get in MegavoltsDc. /// - public double MegavoltsDc => As(ElectricPotentialDcUnit.MegavoltDc); + public T MegavoltsDc => As(ElectricPotentialDcUnit.MegavoltDc); /// /// Get in MicrovoltsDc. /// - public double MicrovoltsDc => As(ElectricPotentialDcUnit.MicrovoltDc); + public T MicrovoltsDc => As(ElectricPotentialDcUnit.MicrovoltDc); /// /// Get in MillivoltsDc. /// - public double MillivoltsDc => As(ElectricPotentialDcUnit.MillivoltDc); + public T MillivoltsDc => As(ElectricPotentialDcUnit.MillivoltDc); /// /// Get in VoltsDc. /// - public double VoltsDc => As(ElectricPotentialDcUnit.VoltDc); + public T VoltsDc => As(ElectricPotentialDcUnit.VoltDc); #endregion @@ -225,46 +222,41 @@ public static string GetAbbreviation(ElectricPotentialDcUnit unit, [CanBeNull] I /// Get from KilovoltsDc. /// /// If value is NaN or Infinity. - public static ElectricPotentialDc FromKilovoltsDc(QuantityValue kilovoltsdc) + public static ElectricPotentialDc FromKilovoltsDc(T kilovoltsdc) { - double value = (double) kilovoltsdc; - return new ElectricPotentialDc(value, ElectricPotentialDcUnit.KilovoltDc); + return new ElectricPotentialDc(kilovoltsdc, ElectricPotentialDcUnit.KilovoltDc); } /// /// Get from MegavoltsDc. /// /// If value is NaN or Infinity. - public static ElectricPotentialDc FromMegavoltsDc(QuantityValue megavoltsdc) + public static ElectricPotentialDc FromMegavoltsDc(T megavoltsdc) { - double value = (double) megavoltsdc; - return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MegavoltDc); + return new ElectricPotentialDc(megavoltsdc, ElectricPotentialDcUnit.MegavoltDc); } /// /// Get from MicrovoltsDc. /// /// If value is NaN or Infinity. - public static ElectricPotentialDc FromMicrovoltsDc(QuantityValue microvoltsdc) + public static ElectricPotentialDc FromMicrovoltsDc(T microvoltsdc) { - double value = (double) microvoltsdc; - return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MicrovoltDc); + return new ElectricPotentialDc(microvoltsdc, ElectricPotentialDcUnit.MicrovoltDc); } /// /// Get from MillivoltsDc. /// /// If value is NaN or Infinity. - public static ElectricPotentialDc FromMillivoltsDc(QuantityValue millivoltsdc) + public static ElectricPotentialDc FromMillivoltsDc(T millivoltsdc) { - double value = (double) millivoltsdc; - return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MillivoltDc); + return new ElectricPotentialDc(millivoltsdc, ElectricPotentialDcUnit.MillivoltDc); } /// /// Get from VoltsDc. /// /// If value is NaN or Infinity. - public static ElectricPotentialDc FromVoltsDc(QuantityValue voltsdc) + public static ElectricPotentialDc FromVoltsDc(T voltsdc) { - double value = (double) voltsdc; - return new ElectricPotentialDc(value, ElectricPotentialDcUnit.VoltDc); + return new ElectricPotentialDc(voltsdc, ElectricPotentialDcUnit.VoltDc); } /// @@ -273,9 +265,9 @@ public static ElectricPotentialDc FromVoltsDc(QuantityValue voltsdc) /// Value to convert from. /// Unit to convert from. /// unit value. - public static ElectricPotentialDc From(QuantityValue value, ElectricPotentialDcUnit fromUnit) + public static ElectricPotentialDc From(T value, ElectricPotentialDcUnit fromUnit) { - return new ElectricPotentialDc((double)value, fromUnit); + return new ElectricPotentialDc(value, fromUnit); } #endregion @@ -429,43 +421,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Negate the value. public static ElectricPotentialDc operator -(ElectricPotentialDc right) { - return new ElectricPotentialDc(-right.Value, right.Unit); + return new ElectricPotentialDc(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ElectricPotentialDc operator +(ElectricPotentialDc left, ElectricPotentialDc right) { - return new ElectricPotentialDc(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ElectricPotentialDc(value, left.Unit); } /// Get from subtracting two . public static ElectricPotentialDc operator -(ElectricPotentialDc left, ElectricPotentialDc right) { - return new ElectricPotentialDc(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ElectricPotentialDc(value, left.Unit); } /// Get from multiplying value and . - public static ElectricPotentialDc operator *(double left, ElectricPotentialDc right) + public static ElectricPotentialDc operator *(T left, ElectricPotentialDc right) { - return new ElectricPotentialDc(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ElectricPotentialDc(value, right.Unit); } /// Get from multiplying value and . - public static ElectricPotentialDc operator *(ElectricPotentialDc left, double right) + public static ElectricPotentialDc operator *(ElectricPotentialDc left, T right) { - return new ElectricPotentialDc(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ElectricPotentialDc(value, left.Unit); } /// Get from dividing by value. - public static ElectricPotentialDc operator /(ElectricPotentialDc left, double right) + public static ElectricPotentialDc operator /(ElectricPotentialDc left, T right) { - return new ElectricPotentialDc(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ElectricPotentialDc(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ElectricPotentialDc left, ElectricPotentialDc right) + public static T operator /(ElectricPotentialDc left, ElectricPotentialDc right) { - return left.VoltsDc / right.VoltsDc; + return CompiledLambdas.Divide(left.VoltsDc, right.VoltsDc); } #endregion @@ -475,25 +472,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Returns true if less or equal to. public static bool operator <=(ElectricPotentialDc left, ElectricPotentialDc right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ElectricPotentialDc left, ElectricPotentialDc right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ElectricPotentialDc left, ElectricPotentialDc right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ElectricPotentialDc left, ElectricPotentialDc right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -522,7 +519,7 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricPotentialDc other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -539,7 +536,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricPotentialDc other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -587,10 +584,8 @@ public bool Equals(ElectricPotentialDc other, double tolerance, ComparisonTyp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -610,17 +605,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricPotentialDcUnit unit) + public T As(ElectricPotentialDcUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -640,9 +635,14 @@ double IQuantity.As(Enum unit) if(!(unit is ElectricPotentialDcUnit unitAsElectricPotentialDcUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialDcUnit)} is supported.", nameof(unit)); - return As(unitAsElectricPotentialDcUnit); + var asValue = As(unitAsElectricPotentialDcUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ElectricPotentialDcUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -683,23 +683,29 @@ public ElectricPotentialDc ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ElectricPotentialDcUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ElectricPotentialDcUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ElectricPotentialDcUnit.KilovoltDc: return (_value) * 1e3d; - case ElectricPotentialDcUnit.MegavoltDc: return (_value) * 1e6d; - case ElectricPotentialDcUnit.MicrovoltDc: return (_value) * 1e-6d; - case ElectricPotentialDcUnit.MillivoltDc: return (_value) * 1e-3d; - case ElectricPotentialDcUnit.VoltDc: return _value; + case ElectricPotentialDcUnit.KilovoltDc: return (Value) * 1e3d; + case ElectricPotentialDcUnit.MegavoltDc: return (Value) * 1e6d; + case ElectricPotentialDcUnit.MicrovoltDc: return (Value) * 1e-6d; + case ElectricPotentialDcUnit.MillivoltDc: return (Value) * 1e-3d; + case ElectricPotentialDcUnit.VoltDc: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -716,10 +722,10 @@ internal ElectricPotentialDc ToBaseUnit() return new ElectricPotentialDc(baseUnitValue, BaseUnit); } - private double GetValueAs(ElectricPotentialDcUnit unit) + private T GetValueAs(ElectricPotentialDcUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -831,7 +837,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -846,37 +852,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -900,17 +906,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs index 7e1a3603e8..cdd4857856 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// The electrical resistance of an electrical conductor is the opposition to the passage of an electric current through that conductor. /// - public partial struct ElectricResistance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ElectricResistance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -65,12 +60,12 @@ static ElectricResistance() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ElectricResistance(double value, ElectricResistanceUnit unit) + public ElectricResistance(T value, ElectricResistanceUnit unit) { if(unit == ElectricResistanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -82,14 +77,14 @@ public ElectricResistance(double value, ElectricResistanceUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ElectricResistance(double value, UnitSystem unitSystem) + public ElectricResistance(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -131,7 +126,7 @@ public ElectricResistance(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Ohm. /// - public static ElectricResistance Zero { get; } = new ElectricResistance(0, BaseUnit); + public static ElectricResistance Zero { get; } = new ElectricResistance((T)0, BaseUnit); #endregion @@ -140,7 +135,9 @@ public ElectricResistance(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -170,27 +167,27 @@ public ElectricResistance(double value, UnitSystem unitSystem) /// /// Get in Gigaohms. /// - public double Gigaohms => As(ElectricResistanceUnit.Gigaohm); + public T Gigaohms => As(ElectricResistanceUnit.Gigaohm); /// /// Get in Kiloohms. /// - public double Kiloohms => As(ElectricResistanceUnit.Kiloohm); + public T Kiloohms => As(ElectricResistanceUnit.Kiloohm); /// /// Get in Megaohms. /// - public double Megaohms => As(ElectricResistanceUnit.Megaohm); + public T Megaohms => As(ElectricResistanceUnit.Megaohm); /// /// Get in Milliohms. /// - public double Milliohms => As(ElectricResistanceUnit.Milliohm); + public T Milliohms => As(ElectricResistanceUnit.Milliohm); /// /// Get in Ohms. /// - public double Ohms => As(ElectricResistanceUnit.Ohm); + public T Ohms => As(ElectricResistanceUnit.Ohm); #endregion @@ -225,46 +222,41 @@ public static string GetAbbreviation(ElectricResistanceUnit unit, [CanBeNull] IF /// Get from Gigaohms. /// /// If value is NaN or Infinity. - public static ElectricResistance FromGigaohms(QuantityValue gigaohms) + public static ElectricResistance FromGigaohms(T gigaohms) { - double value = (double) gigaohms; - return new ElectricResistance(value, ElectricResistanceUnit.Gigaohm); + return new ElectricResistance(gigaohms, ElectricResistanceUnit.Gigaohm); } /// /// Get from Kiloohms. /// /// If value is NaN or Infinity. - public static ElectricResistance FromKiloohms(QuantityValue kiloohms) + public static ElectricResistance FromKiloohms(T kiloohms) { - double value = (double) kiloohms; - return new ElectricResistance(value, ElectricResistanceUnit.Kiloohm); + return new ElectricResistance(kiloohms, ElectricResistanceUnit.Kiloohm); } /// /// Get from Megaohms. /// /// If value is NaN or Infinity. - public static ElectricResistance FromMegaohms(QuantityValue megaohms) + public static ElectricResistance FromMegaohms(T megaohms) { - double value = (double) megaohms; - return new ElectricResistance(value, ElectricResistanceUnit.Megaohm); + return new ElectricResistance(megaohms, ElectricResistanceUnit.Megaohm); } /// /// Get from Milliohms. /// /// If value is NaN or Infinity. - public static ElectricResistance FromMilliohms(QuantityValue milliohms) + public static ElectricResistance FromMilliohms(T milliohms) { - double value = (double) milliohms; - return new ElectricResistance(value, ElectricResistanceUnit.Milliohm); + return new ElectricResistance(milliohms, ElectricResistanceUnit.Milliohm); } /// /// Get from Ohms. /// /// If value is NaN or Infinity. - public static ElectricResistance FromOhms(QuantityValue ohms) + public static ElectricResistance FromOhms(T ohms) { - double value = (double) ohms; - return new ElectricResistance(value, ElectricResistanceUnit.Ohm); + return new ElectricResistance(ohms, ElectricResistanceUnit.Ohm); } /// @@ -273,9 +265,9 @@ public static ElectricResistance FromOhms(QuantityValue ohms) /// Value to convert from. /// Unit to convert from. /// unit value. - public static ElectricResistance From(QuantityValue value, ElectricResistanceUnit fromUnit) + public static ElectricResistance From(T value, ElectricResistanceUnit fromUnit) { - return new ElectricResistance((double)value, fromUnit); + return new ElectricResistance(value, fromUnit); } #endregion @@ -429,43 +421,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Negate the value. public static ElectricResistance operator -(ElectricResistance right) { - return new ElectricResistance(-right.Value, right.Unit); + return new ElectricResistance(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ElectricResistance operator +(ElectricResistance left, ElectricResistance right) { - return new ElectricResistance(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ElectricResistance(value, left.Unit); } /// Get from subtracting two . public static ElectricResistance operator -(ElectricResistance left, ElectricResistance right) { - return new ElectricResistance(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ElectricResistance(value, left.Unit); } /// Get from multiplying value and . - public static ElectricResistance operator *(double left, ElectricResistance right) + public static ElectricResistance operator *(T left, ElectricResistance right) { - return new ElectricResistance(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ElectricResistance(value, right.Unit); } /// Get from multiplying value and . - public static ElectricResistance operator *(ElectricResistance left, double right) + public static ElectricResistance operator *(ElectricResistance left, T right) { - return new ElectricResistance(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ElectricResistance(value, left.Unit); } /// Get from dividing by value. - public static ElectricResistance operator /(ElectricResistance left, double right) + public static ElectricResistance operator /(ElectricResistance left, T right) { - return new ElectricResistance(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ElectricResistance(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ElectricResistance left, ElectricResistance right) + public static T operator /(ElectricResistance left, ElectricResistance right) { - return left.Ohms / right.Ohms; + return CompiledLambdas.Divide(left.Ohms, right.Ohms); } #endregion @@ -475,25 +472,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Returns true if less or equal to. public static bool operator <=(ElectricResistance left, ElectricResistance right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ElectricResistance left, ElectricResistance right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ElectricResistance left, ElectricResistance right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ElectricResistance left, ElectricResistance right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -522,7 +519,7 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricResistance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -539,7 +536,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricResistance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -587,10 +584,8 @@ public bool Equals(ElectricResistance other, double tolerance, ComparisonType if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -610,17 +605,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricResistanceUnit unit) + public T As(ElectricResistanceUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -640,9 +635,14 @@ double IQuantity.As(Enum unit) if(!(unit is ElectricResistanceUnit unitAsElectricResistanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricResistanceUnit)} is supported.", nameof(unit)); - return As(unitAsElectricResistanceUnit); + var asValue = As(unitAsElectricResistanceUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ElectricResistanceUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -683,23 +683,29 @@ public ElectricResistance ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ElectricResistanceUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ElectricResistanceUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ElectricResistanceUnit.Gigaohm: return (_value) * 1e9d; - case ElectricResistanceUnit.Kiloohm: return (_value) * 1e3d; - case ElectricResistanceUnit.Megaohm: return (_value) * 1e6d; - case ElectricResistanceUnit.Milliohm: return (_value) * 1e-3d; - case ElectricResistanceUnit.Ohm: return _value; + case ElectricResistanceUnit.Gigaohm: return (Value) * 1e9d; + case ElectricResistanceUnit.Kiloohm: return (Value) * 1e3d; + case ElectricResistanceUnit.Megaohm: return (Value) * 1e6d; + case ElectricResistanceUnit.Milliohm: return (Value) * 1e-3d; + case ElectricResistanceUnit.Ohm: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -716,10 +722,10 @@ internal ElectricResistance ToBaseUnit() return new ElectricResistance(baseUnitValue, BaseUnit); } - private double GetValueAs(ElectricResistanceUnit unit) + private T GetValueAs(ElectricResistanceUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -831,7 +837,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -846,37 +852,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -900,17 +906,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs index af86c47b82..e0bc578201 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity /// - public partial struct ElectricResistivity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ElectricResistivity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -77,12 +72,12 @@ static ElectricResistivity() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ElectricResistivity(double value, ElectricResistivityUnit unit) + public ElectricResistivity(T value, ElectricResistivityUnit unit) { if(unit == ElectricResistivityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -94,14 +89,14 @@ public ElectricResistivity(double value, ElectricResistivityUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ElectricResistivity(double value, UnitSystem unitSystem) + public ElectricResistivity(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -143,7 +138,7 @@ public ElectricResistivity(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit OhmMeter. /// - public static ElectricResistivity Zero { get; } = new ElectricResistivity(0, BaseUnit); + public static ElectricResistivity Zero { get; } = new ElectricResistivity((T)0, BaseUnit); #endregion @@ -152,7 +147,9 @@ public ElectricResistivity(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -182,72 +179,72 @@ public ElectricResistivity(double value, UnitSystem unitSystem) /// /// Get in KiloohmsCentimeter. /// - public double KiloohmsCentimeter => As(ElectricResistivityUnit.KiloohmCentimeter); + public T KiloohmsCentimeter => As(ElectricResistivityUnit.KiloohmCentimeter); /// /// Get in KiloohmMeters. /// - public double KiloohmMeters => As(ElectricResistivityUnit.KiloohmMeter); + public T KiloohmMeters => As(ElectricResistivityUnit.KiloohmMeter); /// /// Get in MegaohmsCentimeter. /// - public double MegaohmsCentimeter => As(ElectricResistivityUnit.MegaohmCentimeter); + public T MegaohmsCentimeter => As(ElectricResistivityUnit.MegaohmCentimeter); /// /// Get in MegaohmMeters. /// - public double MegaohmMeters => As(ElectricResistivityUnit.MegaohmMeter); + public T MegaohmMeters => As(ElectricResistivityUnit.MegaohmMeter); /// /// Get in MicroohmsCentimeter. /// - public double MicroohmsCentimeter => As(ElectricResistivityUnit.MicroohmCentimeter); + public T MicroohmsCentimeter => As(ElectricResistivityUnit.MicroohmCentimeter); /// /// Get in MicroohmMeters. /// - public double MicroohmMeters => As(ElectricResistivityUnit.MicroohmMeter); + public T MicroohmMeters => As(ElectricResistivityUnit.MicroohmMeter); /// /// Get in MilliohmsCentimeter. /// - public double MilliohmsCentimeter => As(ElectricResistivityUnit.MilliohmCentimeter); + public T MilliohmsCentimeter => As(ElectricResistivityUnit.MilliohmCentimeter); /// /// Get in MilliohmMeters. /// - public double MilliohmMeters => As(ElectricResistivityUnit.MilliohmMeter); + public T MilliohmMeters => As(ElectricResistivityUnit.MilliohmMeter); /// /// Get in NanoohmsCentimeter. /// - public double NanoohmsCentimeter => As(ElectricResistivityUnit.NanoohmCentimeter); + public T NanoohmsCentimeter => As(ElectricResistivityUnit.NanoohmCentimeter); /// /// Get in NanoohmMeters. /// - public double NanoohmMeters => As(ElectricResistivityUnit.NanoohmMeter); + public T NanoohmMeters => As(ElectricResistivityUnit.NanoohmMeter); /// /// Get in OhmsCentimeter. /// - public double OhmsCentimeter => As(ElectricResistivityUnit.OhmCentimeter); + public T OhmsCentimeter => As(ElectricResistivityUnit.OhmCentimeter); /// /// Get in OhmMeters. /// - public double OhmMeters => As(ElectricResistivityUnit.OhmMeter); + public T OhmMeters => As(ElectricResistivityUnit.OhmMeter); /// /// Get in PicoohmsCentimeter. /// - public double PicoohmsCentimeter => As(ElectricResistivityUnit.PicoohmCentimeter); + public T PicoohmsCentimeter => As(ElectricResistivityUnit.PicoohmCentimeter); /// /// Get in PicoohmMeters. /// - public double PicoohmMeters => As(ElectricResistivityUnit.PicoohmMeter); + public T PicoohmMeters => As(ElectricResistivityUnit.PicoohmMeter); #endregion @@ -282,127 +279,113 @@ public static string GetAbbreviation(ElectricResistivityUnit unit, [CanBeNull] I /// Get from KiloohmsCentimeter. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromKiloohmsCentimeter(QuantityValue kiloohmscentimeter) + public static ElectricResistivity FromKiloohmsCentimeter(T kiloohmscentimeter) { - double value = (double) kiloohmscentimeter; - return new ElectricResistivity(value, ElectricResistivityUnit.KiloohmCentimeter); + return new ElectricResistivity(kiloohmscentimeter, ElectricResistivityUnit.KiloohmCentimeter); } /// /// Get from KiloohmMeters. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromKiloohmMeters(QuantityValue kiloohmmeters) + public static ElectricResistivity FromKiloohmMeters(T kiloohmmeters) { - double value = (double) kiloohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.KiloohmMeter); + return new ElectricResistivity(kiloohmmeters, ElectricResistivityUnit.KiloohmMeter); } /// /// Get from MegaohmsCentimeter. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromMegaohmsCentimeter(QuantityValue megaohmscentimeter) + public static ElectricResistivity FromMegaohmsCentimeter(T megaohmscentimeter) { - double value = (double) megaohmscentimeter; - return new ElectricResistivity(value, ElectricResistivityUnit.MegaohmCentimeter); + return new ElectricResistivity(megaohmscentimeter, ElectricResistivityUnit.MegaohmCentimeter); } /// /// Get from MegaohmMeters. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromMegaohmMeters(QuantityValue megaohmmeters) + public static ElectricResistivity FromMegaohmMeters(T megaohmmeters) { - double value = (double) megaohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.MegaohmMeter); + return new ElectricResistivity(megaohmmeters, ElectricResistivityUnit.MegaohmMeter); } /// /// Get from MicroohmsCentimeter. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromMicroohmsCentimeter(QuantityValue microohmscentimeter) + public static ElectricResistivity FromMicroohmsCentimeter(T microohmscentimeter) { - double value = (double) microohmscentimeter; - return new ElectricResistivity(value, ElectricResistivityUnit.MicroohmCentimeter); + return new ElectricResistivity(microohmscentimeter, ElectricResistivityUnit.MicroohmCentimeter); } /// /// Get from MicroohmMeters. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromMicroohmMeters(QuantityValue microohmmeters) + public static ElectricResistivity FromMicroohmMeters(T microohmmeters) { - double value = (double) microohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.MicroohmMeter); + return new ElectricResistivity(microohmmeters, ElectricResistivityUnit.MicroohmMeter); } /// /// Get from MilliohmsCentimeter. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromMilliohmsCentimeter(QuantityValue milliohmscentimeter) + public static ElectricResistivity FromMilliohmsCentimeter(T milliohmscentimeter) { - double value = (double) milliohmscentimeter; - return new ElectricResistivity(value, ElectricResistivityUnit.MilliohmCentimeter); + return new ElectricResistivity(milliohmscentimeter, ElectricResistivityUnit.MilliohmCentimeter); } /// /// Get from MilliohmMeters. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromMilliohmMeters(QuantityValue milliohmmeters) + public static ElectricResistivity FromMilliohmMeters(T milliohmmeters) { - double value = (double) milliohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.MilliohmMeter); + return new ElectricResistivity(milliohmmeters, ElectricResistivityUnit.MilliohmMeter); } /// /// Get from NanoohmsCentimeter. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromNanoohmsCentimeter(QuantityValue nanoohmscentimeter) + public static ElectricResistivity FromNanoohmsCentimeter(T nanoohmscentimeter) { - double value = (double) nanoohmscentimeter; - return new ElectricResistivity(value, ElectricResistivityUnit.NanoohmCentimeter); + return new ElectricResistivity(nanoohmscentimeter, ElectricResistivityUnit.NanoohmCentimeter); } /// /// Get from NanoohmMeters. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromNanoohmMeters(QuantityValue nanoohmmeters) + public static ElectricResistivity FromNanoohmMeters(T nanoohmmeters) { - double value = (double) nanoohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.NanoohmMeter); + return new ElectricResistivity(nanoohmmeters, ElectricResistivityUnit.NanoohmMeter); } /// /// Get from OhmsCentimeter. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromOhmsCentimeter(QuantityValue ohmscentimeter) + public static ElectricResistivity FromOhmsCentimeter(T ohmscentimeter) { - double value = (double) ohmscentimeter; - return new ElectricResistivity(value, ElectricResistivityUnit.OhmCentimeter); + return new ElectricResistivity(ohmscentimeter, ElectricResistivityUnit.OhmCentimeter); } /// /// Get from OhmMeters. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromOhmMeters(QuantityValue ohmmeters) + public static ElectricResistivity FromOhmMeters(T ohmmeters) { - double value = (double) ohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.OhmMeter); + return new ElectricResistivity(ohmmeters, ElectricResistivityUnit.OhmMeter); } /// /// Get from PicoohmsCentimeter. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromPicoohmsCentimeter(QuantityValue picoohmscentimeter) + public static ElectricResistivity FromPicoohmsCentimeter(T picoohmscentimeter) { - double value = (double) picoohmscentimeter; - return new ElectricResistivity(value, ElectricResistivityUnit.PicoohmCentimeter); + return new ElectricResistivity(picoohmscentimeter, ElectricResistivityUnit.PicoohmCentimeter); } /// /// Get from PicoohmMeters. /// /// If value is NaN or Infinity. - public static ElectricResistivity FromPicoohmMeters(QuantityValue picoohmmeters) + public static ElectricResistivity FromPicoohmMeters(T picoohmmeters) { - double value = (double) picoohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.PicoohmMeter); + return new ElectricResistivity(picoohmmeters, ElectricResistivityUnit.PicoohmMeter); } /// @@ -411,9 +394,9 @@ public static ElectricResistivity FromPicoohmMeters(QuantityValue picoohmmete /// Value to convert from. /// Unit to convert from. /// unit value. - public static ElectricResistivity From(QuantityValue value, ElectricResistivityUnit fromUnit) + public static ElectricResistivity From(T value, ElectricResistivityUnit fromUnit) { - return new ElectricResistivity((double)value, fromUnit); + return new ElectricResistivity(value, fromUnit); } #endregion @@ -567,43 +550,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Negate the value. public static ElectricResistivity operator -(ElectricResistivity right) { - return new ElectricResistivity(-right.Value, right.Unit); + return new ElectricResistivity(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ElectricResistivity operator +(ElectricResistivity left, ElectricResistivity right) { - return new ElectricResistivity(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ElectricResistivity(value, left.Unit); } /// Get from subtracting two . public static ElectricResistivity operator -(ElectricResistivity left, ElectricResistivity right) { - return new ElectricResistivity(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ElectricResistivity(value, left.Unit); } /// Get from multiplying value and . - public static ElectricResistivity operator *(double left, ElectricResistivity right) + public static ElectricResistivity operator *(T left, ElectricResistivity right) { - return new ElectricResistivity(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ElectricResistivity(value, right.Unit); } /// Get from multiplying value and . - public static ElectricResistivity operator *(ElectricResistivity left, double right) + public static ElectricResistivity operator *(ElectricResistivity left, T right) { - return new ElectricResistivity(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ElectricResistivity(value, left.Unit); } /// Get from dividing by value. - public static ElectricResistivity operator /(ElectricResistivity left, double right) + public static ElectricResistivity operator /(ElectricResistivity left, T right) { - return new ElectricResistivity(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ElectricResistivity(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ElectricResistivity left, ElectricResistivity right) + public static T operator /(ElectricResistivity left, ElectricResistivity right) { - return left.OhmMeters / right.OhmMeters; + return CompiledLambdas.Divide(left.OhmMeters, right.OhmMeters); } #endregion @@ -613,25 +601,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Returns true if less or equal to. public static bool operator <=(ElectricResistivity left, ElectricResistivity right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ElectricResistivity left, ElectricResistivity right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ElectricResistivity left, ElectricResistivity right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ElectricResistivity left, ElectricResistivity right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -660,7 +648,7 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricResistivity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -677,7 +665,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricResistivity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -725,10 +713,8 @@ public bool Equals(ElectricResistivity other, double tolerance, ComparisonTyp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -748,17 +734,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricResistivityUnit unit) + public T As(ElectricResistivityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -778,9 +764,14 @@ double IQuantity.As(Enum unit) if(!(unit is ElectricResistivityUnit unitAsElectricResistivityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricResistivityUnit)} is supported.", nameof(unit)); - return As(unitAsElectricResistivityUnit); + var asValue = As(unitAsElectricResistivityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ElectricResistivityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -821,32 +812,38 @@ public ElectricResistivity ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ElectricResistivityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ElectricResistivityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ElectricResistivityUnit.KiloohmCentimeter: return (_value/100) * 1e3d; - case ElectricResistivityUnit.KiloohmMeter: return (_value) * 1e3d; - case ElectricResistivityUnit.MegaohmCentimeter: return (_value/100) * 1e6d; - case ElectricResistivityUnit.MegaohmMeter: return (_value) * 1e6d; - case ElectricResistivityUnit.MicroohmCentimeter: return (_value/100) * 1e-6d; - case ElectricResistivityUnit.MicroohmMeter: return (_value) * 1e-6d; - case ElectricResistivityUnit.MilliohmCentimeter: return (_value/100) * 1e-3d; - case ElectricResistivityUnit.MilliohmMeter: return (_value) * 1e-3d; - case ElectricResistivityUnit.NanoohmCentimeter: return (_value/100) * 1e-9d; - case ElectricResistivityUnit.NanoohmMeter: return (_value) * 1e-9d; - case ElectricResistivityUnit.OhmCentimeter: return _value/100; - case ElectricResistivityUnit.OhmMeter: return _value; - case ElectricResistivityUnit.PicoohmCentimeter: return (_value/100) * 1e-12d; - case ElectricResistivityUnit.PicoohmMeter: return (_value) * 1e-12d; + case ElectricResistivityUnit.KiloohmCentimeter: return (Value/100) * 1e3d; + case ElectricResistivityUnit.KiloohmMeter: return (Value) * 1e3d; + case ElectricResistivityUnit.MegaohmCentimeter: return (Value/100) * 1e6d; + case ElectricResistivityUnit.MegaohmMeter: return (Value) * 1e6d; + case ElectricResistivityUnit.MicroohmCentimeter: return (Value/100) * 1e-6d; + case ElectricResistivityUnit.MicroohmMeter: return (Value) * 1e-6d; + case ElectricResistivityUnit.MilliohmCentimeter: return (Value/100) * 1e-3d; + case ElectricResistivityUnit.MilliohmMeter: return (Value) * 1e-3d; + case ElectricResistivityUnit.NanoohmCentimeter: return (Value/100) * 1e-9d; + case ElectricResistivityUnit.NanoohmMeter: return (Value) * 1e-9d; + case ElectricResistivityUnit.OhmCentimeter: return Value/100; + case ElectricResistivityUnit.OhmMeter: return Value; + case ElectricResistivityUnit.PicoohmCentimeter: return (Value/100) * 1e-12d; + case ElectricResistivityUnit.PicoohmMeter: return (Value) * 1e-12d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -863,10 +860,10 @@ internal ElectricResistivity ToBaseUnit() return new ElectricResistivity(baseUnitValue, BaseUnit); } - private double GetValueAs(ElectricResistivityUnit unit) + private T GetValueAs(ElectricResistivityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -987,7 +984,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1002,37 +999,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1056,17 +1053,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs index 4aac29bd16..b86f3edbe0 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Charge_density /// - public partial struct ElectricSurfaceChargeDensity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ElectricSurfaceChargeDensity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -66,12 +61,12 @@ static ElectricSurfaceChargeDensity() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ElectricSurfaceChargeDensity(double value, ElectricSurfaceChargeDensityUnit unit) + public ElectricSurfaceChargeDensity(T value, ElectricSurfaceChargeDensityUnit unit) { if(unit == ElectricSurfaceChargeDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -83,14 +78,14 @@ public ElectricSurfaceChargeDensity(double value, ElectricSurfaceChargeDensityUn /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ElectricSurfaceChargeDensity(double value, UnitSystem unitSystem) + public ElectricSurfaceChargeDensity(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -132,7 +127,7 @@ public ElectricSurfaceChargeDensity(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit CoulombPerSquareMeter. /// - public static ElectricSurfaceChargeDensity Zero { get; } = new ElectricSurfaceChargeDensity(0, BaseUnit); + public static ElectricSurfaceChargeDensity Zero { get; } = new ElectricSurfaceChargeDensity((T)0, BaseUnit); #endregion @@ -141,7 +136,9 @@ public ElectricSurfaceChargeDensity(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -171,17 +168,17 @@ public ElectricSurfaceChargeDensity(double value, UnitSystem unitSystem) /// /// Get in CoulombsPerSquareCentimeter. /// - public double CoulombsPerSquareCentimeter => As(ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter); + public T CoulombsPerSquareCentimeter => As(ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter); /// /// Get in CoulombsPerSquareInch. /// - public double CoulombsPerSquareInch => As(ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch); + public T CoulombsPerSquareInch => As(ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch); /// /// Get in CoulombsPerSquareMeter. /// - public double CoulombsPerSquareMeter => As(ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter); + public T CoulombsPerSquareMeter => As(ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter); #endregion @@ -216,28 +213,25 @@ public static string GetAbbreviation(ElectricSurfaceChargeDensityUnit unit, [Can /// Get from CoulombsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static ElectricSurfaceChargeDensity FromCoulombsPerSquareCentimeter(QuantityValue coulombspersquarecentimeter) + public static ElectricSurfaceChargeDensity FromCoulombsPerSquareCentimeter(T coulombspersquarecentimeter) { - double value = (double) coulombspersquarecentimeter; - return new ElectricSurfaceChargeDensity(value, ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter); + return new ElectricSurfaceChargeDensity(coulombspersquarecentimeter, ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter); } /// /// Get from CoulombsPerSquareInch. /// /// If value is NaN or Infinity. - public static ElectricSurfaceChargeDensity FromCoulombsPerSquareInch(QuantityValue coulombspersquareinch) + public static ElectricSurfaceChargeDensity FromCoulombsPerSquareInch(T coulombspersquareinch) { - double value = (double) coulombspersquareinch; - return new ElectricSurfaceChargeDensity(value, ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch); + return new ElectricSurfaceChargeDensity(coulombspersquareinch, ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch); } /// /// Get from CoulombsPerSquareMeter. /// /// If value is NaN or Infinity. - public static ElectricSurfaceChargeDensity FromCoulombsPerSquareMeter(QuantityValue coulombspersquaremeter) + public static ElectricSurfaceChargeDensity FromCoulombsPerSquareMeter(T coulombspersquaremeter) { - double value = (double) coulombspersquaremeter; - return new ElectricSurfaceChargeDensity(value, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter); + return new ElectricSurfaceChargeDensity(coulombspersquaremeter, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter); } /// @@ -246,9 +240,9 @@ public static ElectricSurfaceChargeDensity FromCoulombsPerSquareMeter(Quantit /// Value to convert from. /// Unit to convert from. /// unit value. - public static ElectricSurfaceChargeDensity From(QuantityValue value, ElectricSurfaceChargeDensityUnit fromUnit) + public static ElectricSurfaceChargeDensity From(T value, ElectricSurfaceChargeDensityUnit fromUnit) { - return new ElectricSurfaceChargeDensity((double)value, fromUnit); + return new ElectricSurfaceChargeDensity(value, fromUnit); } #endregion @@ -402,43 +396,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Negate the value. public static ElectricSurfaceChargeDensity operator -(ElectricSurfaceChargeDensity right) { - return new ElectricSurfaceChargeDensity(-right.Value, right.Unit); + return new ElectricSurfaceChargeDensity(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ElectricSurfaceChargeDensity operator +(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { - return new ElectricSurfaceChargeDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ElectricSurfaceChargeDensity(value, left.Unit); } /// Get from subtracting two . public static ElectricSurfaceChargeDensity operator -(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { - return new ElectricSurfaceChargeDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ElectricSurfaceChargeDensity(value, left.Unit); } /// Get from multiplying value and . - public static ElectricSurfaceChargeDensity operator *(double left, ElectricSurfaceChargeDensity right) + public static ElectricSurfaceChargeDensity operator *(T left, ElectricSurfaceChargeDensity right) { - return new ElectricSurfaceChargeDensity(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ElectricSurfaceChargeDensity(value, right.Unit); } /// Get from multiplying value and . - public static ElectricSurfaceChargeDensity operator *(ElectricSurfaceChargeDensity left, double right) + public static ElectricSurfaceChargeDensity operator *(ElectricSurfaceChargeDensity left, T right) { - return new ElectricSurfaceChargeDensity(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ElectricSurfaceChargeDensity(value, left.Unit); } /// Get from dividing by value. - public static ElectricSurfaceChargeDensity operator /(ElectricSurfaceChargeDensity left, double right) + public static ElectricSurfaceChargeDensity operator /(ElectricSurfaceChargeDensity left, T right) { - return new ElectricSurfaceChargeDensity(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ElectricSurfaceChargeDensity(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) + public static T operator /(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { - return left.CoulombsPerSquareMeter / right.CoulombsPerSquareMeter; + return CompiledLambdas.Divide(left.CoulombsPerSquareMeter, right.CoulombsPerSquareMeter); } #endregion @@ -448,25 +447,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Returns true if less or equal to. public static bool operator <=(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -495,7 +494,7 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricSurfaceChargeDensity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -512,7 +511,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricSurfaceChargeDensity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -560,10 +559,8 @@ public bool Equals(ElectricSurfaceChargeDensity other, double tolerance, Comp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -583,17 +580,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricSurfaceChargeDensityUnit unit) + public T As(ElectricSurfaceChargeDensityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -613,9 +610,14 @@ double IQuantity.As(Enum unit) if(!(unit is ElectricSurfaceChargeDensityUnit unitAsElectricSurfaceChargeDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricSurfaceChargeDensityUnit)} is supported.", nameof(unit)); - return As(unitAsElectricSurfaceChargeDensityUnit); + var asValue = As(unitAsElectricSurfaceChargeDensityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ElectricSurfaceChargeDensityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -656,21 +658,27 @@ public ElectricSurfaceChargeDensity ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ElectricSurfaceChargeDensityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ElectricSurfaceChargeDensityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter: return _value * 1.0e4; - case ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch: return _value * 1.5500031000062000e3; - case ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter: return _value; + case ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter: return Value * 1.0e4; + case ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch: return Value * 1.5500031000062000e3; + case ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -687,10 +695,10 @@ internal ElectricSurfaceChargeDensity ToBaseUnit() return new ElectricSurfaceChargeDensity(baseUnitValue, BaseUnit); } - private double GetValueAs(ElectricSurfaceChargeDensityUnit unit) + private T GetValueAs(ElectricSurfaceChargeDensityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -800,7 +808,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -815,37 +823,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -869,17 +877,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs index 213db45106..65db5e5a0c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// The joule, symbol J, is a derived unit of energy, work, or amount of heat in the International System of Units. It is equal to the energy transferred (or work done) when applying a force of one newton through a distance of one metre (1 newton metre or N·m), or in passing an electric current of one ampere through a resistance of one ohm for one second. Many other units of energy are included. Please do not confuse this definition of the calorie with the one colloquially used by the food industry, the large calorie, which is equivalent to 1 kcal. Thermochemical definition of the calorie is used. For BTU, the IT definition is used. /// - public partial struct Energy : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Energy : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -84,12 +79,12 @@ static Energy() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Energy(double value, EnergyUnit unit) + public Energy(T value, EnergyUnit unit) { if(unit == EnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -101,14 +96,14 @@ public Energy(double value, EnergyUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Energy(double value, UnitSystem unitSystem) + public Energy(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -150,7 +145,7 @@ public Energy(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Joule. /// - public static Energy Zero { get; } = new Energy(0, BaseUnit); + public static Energy Zero { get; } = new Energy((T)0, BaseUnit); #endregion @@ -159,7 +154,9 @@ public Energy(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -189,122 +186,122 @@ public Energy(double value, UnitSystem unitSystem) /// /// Get in BritishThermalUnits. /// - public double BritishThermalUnits => As(EnergyUnit.BritishThermalUnit); + public T BritishThermalUnits => As(EnergyUnit.BritishThermalUnit); /// /// Get in Calories. /// - public double Calories => As(EnergyUnit.Calorie); + public T Calories => As(EnergyUnit.Calorie); /// /// Get in DecathermsEc. /// - public double DecathermsEc => As(EnergyUnit.DecathermEc); + public T DecathermsEc => As(EnergyUnit.DecathermEc); /// /// Get in DecathermsImperial. /// - public double DecathermsImperial => As(EnergyUnit.DecathermImperial); + public T DecathermsImperial => As(EnergyUnit.DecathermImperial); /// /// Get in DecathermsUs. /// - public double DecathermsUs => As(EnergyUnit.DecathermUs); + public T DecathermsUs => As(EnergyUnit.DecathermUs); /// /// Get in ElectronVolts. /// - public double ElectronVolts => As(EnergyUnit.ElectronVolt); + public T ElectronVolts => As(EnergyUnit.ElectronVolt); /// /// Get in Ergs. /// - public double Ergs => As(EnergyUnit.Erg); + public T Ergs => As(EnergyUnit.Erg); /// /// Get in FootPounds. /// - public double FootPounds => As(EnergyUnit.FootPound); + public T FootPounds => As(EnergyUnit.FootPound); /// /// Get in GigabritishThermalUnits. /// - public double GigabritishThermalUnits => As(EnergyUnit.GigabritishThermalUnit); + public T GigabritishThermalUnits => As(EnergyUnit.GigabritishThermalUnit); /// /// Get in GigawattHours. /// - public double GigawattHours => As(EnergyUnit.GigawattHour); + public T GigawattHours => As(EnergyUnit.GigawattHour); /// /// Get in Joules. /// - public double Joules => As(EnergyUnit.Joule); + public T Joules => As(EnergyUnit.Joule); /// /// Get in KilobritishThermalUnits. /// - public double KilobritishThermalUnits => As(EnergyUnit.KilobritishThermalUnit); + public T KilobritishThermalUnits => As(EnergyUnit.KilobritishThermalUnit); /// /// Get in Kilocalories. /// - public double Kilocalories => As(EnergyUnit.Kilocalorie); + public T Kilocalories => As(EnergyUnit.Kilocalorie); /// /// Get in Kilojoules. /// - public double Kilojoules => As(EnergyUnit.Kilojoule); + public T Kilojoules => As(EnergyUnit.Kilojoule); /// /// Get in KilowattHours. /// - public double KilowattHours => As(EnergyUnit.KilowattHour); + public T KilowattHours => As(EnergyUnit.KilowattHour); /// /// Get in MegabritishThermalUnits. /// - public double MegabritishThermalUnits => As(EnergyUnit.MegabritishThermalUnit); + public T MegabritishThermalUnits => As(EnergyUnit.MegabritishThermalUnit); /// /// Get in Megajoules. /// - public double Megajoules => As(EnergyUnit.Megajoule); + public T Megajoules => As(EnergyUnit.Megajoule); /// /// Get in MegawattHours. /// - public double MegawattHours => As(EnergyUnit.MegawattHour); + public T MegawattHours => As(EnergyUnit.MegawattHour); /// /// Get in Millijoules. /// - public double Millijoules => As(EnergyUnit.Millijoule); + public T Millijoules => As(EnergyUnit.Millijoule); /// /// Get in TerawattHours. /// - public double TerawattHours => As(EnergyUnit.TerawattHour); + public T TerawattHours => As(EnergyUnit.TerawattHour); /// /// Get in ThermsEc. /// - public double ThermsEc => As(EnergyUnit.ThermEc); + public T ThermsEc => As(EnergyUnit.ThermEc); /// /// Get in ThermsImperial. /// - public double ThermsImperial => As(EnergyUnit.ThermImperial); + public T ThermsImperial => As(EnergyUnit.ThermImperial); /// /// Get in ThermsUs. /// - public double ThermsUs => As(EnergyUnit.ThermUs); + public T ThermsUs => As(EnergyUnit.ThermUs); /// /// Get in WattHours. /// - public double WattHours => As(EnergyUnit.WattHour); + public T WattHours => As(EnergyUnit.WattHour); #endregion @@ -339,217 +336,193 @@ public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] IFormatProvide /// Get from BritishThermalUnits. /// /// If value is NaN or Infinity. - public static Energy FromBritishThermalUnits(QuantityValue britishthermalunits) + public static Energy FromBritishThermalUnits(T britishthermalunits) { - double value = (double) britishthermalunits; - return new Energy(value, EnergyUnit.BritishThermalUnit); + return new Energy(britishthermalunits, EnergyUnit.BritishThermalUnit); } /// /// Get from Calories. /// /// If value is NaN or Infinity. - public static Energy FromCalories(QuantityValue calories) + public static Energy FromCalories(T calories) { - double value = (double) calories; - return new Energy(value, EnergyUnit.Calorie); + return new Energy(calories, EnergyUnit.Calorie); } /// /// Get from DecathermsEc. /// /// If value is NaN or Infinity. - public static Energy FromDecathermsEc(QuantityValue decathermsec) + public static Energy FromDecathermsEc(T decathermsec) { - double value = (double) decathermsec; - return new Energy(value, EnergyUnit.DecathermEc); + return new Energy(decathermsec, EnergyUnit.DecathermEc); } /// /// Get from DecathermsImperial. /// /// If value is NaN or Infinity. - public static Energy FromDecathermsImperial(QuantityValue decathermsimperial) + public static Energy FromDecathermsImperial(T decathermsimperial) { - double value = (double) decathermsimperial; - return new Energy(value, EnergyUnit.DecathermImperial); + return new Energy(decathermsimperial, EnergyUnit.DecathermImperial); } /// /// Get from DecathermsUs. /// /// If value is NaN or Infinity. - public static Energy FromDecathermsUs(QuantityValue decathermsus) + public static Energy FromDecathermsUs(T decathermsus) { - double value = (double) decathermsus; - return new Energy(value, EnergyUnit.DecathermUs); + return new Energy(decathermsus, EnergyUnit.DecathermUs); } /// /// Get from ElectronVolts. /// /// If value is NaN or Infinity. - public static Energy FromElectronVolts(QuantityValue electronvolts) + public static Energy FromElectronVolts(T electronvolts) { - double value = (double) electronvolts; - return new Energy(value, EnergyUnit.ElectronVolt); + return new Energy(electronvolts, EnergyUnit.ElectronVolt); } /// /// Get from Ergs. /// /// If value is NaN or Infinity. - public static Energy FromErgs(QuantityValue ergs) + public static Energy FromErgs(T ergs) { - double value = (double) ergs; - return new Energy(value, EnergyUnit.Erg); + return new Energy(ergs, EnergyUnit.Erg); } /// /// Get from FootPounds. /// /// If value is NaN or Infinity. - public static Energy FromFootPounds(QuantityValue footpounds) + public static Energy FromFootPounds(T footpounds) { - double value = (double) footpounds; - return new Energy(value, EnergyUnit.FootPound); + return new Energy(footpounds, EnergyUnit.FootPound); } /// /// Get from GigabritishThermalUnits. /// /// If value is NaN or Infinity. - public static Energy FromGigabritishThermalUnits(QuantityValue gigabritishthermalunits) + public static Energy FromGigabritishThermalUnits(T gigabritishthermalunits) { - double value = (double) gigabritishthermalunits; - return new Energy(value, EnergyUnit.GigabritishThermalUnit); + return new Energy(gigabritishthermalunits, EnergyUnit.GigabritishThermalUnit); } /// /// Get from GigawattHours. /// /// If value is NaN or Infinity. - public static Energy FromGigawattHours(QuantityValue gigawatthours) + public static Energy FromGigawattHours(T gigawatthours) { - double value = (double) gigawatthours; - return new Energy(value, EnergyUnit.GigawattHour); + return new Energy(gigawatthours, EnergyUnit.GigawattHour); } /// /// Get from Joules. /// /// If value is NaN or Infinity. - public static Energy FromJoules(QuantityValue joules) + public static Energy FromJoules(T joules) { - double value = (double) joules; - return new Energy(value, EnergyUnit.Joule); + return new Energy(joules, EnergyUnit.Joule); } /// /// Get from KilobritishThermalUnits. /// /// If value is NaN or Infinity. - public static Energy FromKilobritishThermalUnits(QuantityValue kilobritishthermalunits) + public static Energy FromKilobritishThermalUnits(T kilobritishthermalunits) { - double value = (double) kilobritishthermalunits; - return new Energy(value, EnergyUnit.KilobritishThermalUnit); + return new Energy(kilobritishthermalunits, EnergyUnit.KilobritishThermalUnit); } /// /// Get from Kilocalories. /// /// If value is NaN or Infinity. - public static Energy FromKilocalories(QuantityValue kilocalories) + public static Energy FromKilocalories(T kilocalories) { - double value = (double) kilocalories; - return new Energy(value, EnergyUnit.Kilocalorie); + return new Energy(kilocalories, EnergyUnit.Kilocalorie); } /// /// Get from Kilojoules. /// /// If value is NaN or Infinity. - public static Energy FromKilojoules(QuantityValue kilojoules) + public static Energy FromKilojoules(T kilojoules) { - double value = (double) kilojoules; - return new Energy(value, EnergyUnit.Kilojoule); + return new Energy(kilojoules, EnergyUnit.Kilojoule); } /// /// Get from KilowattHours. /// /// If value is NaN or Infinity. - public static Energy FromKilowattHours(QuantityValue kilowatthours) + public static Energy FromKilowattHours(T kilowatthours) { - double value = (double) kilowatthours; - return new Energy(value, EnergyUnit.KilowattHour); + return new Energy(kilowatthours, EnergyUnit.KilowattHour); } /// /// Get from MegabritishThermalUnits. /// /// If value is NaN or Infinity. - public static Energy FromMegabritishThermalUnits(QuantityValue megabritishthermalunits) + public static Energy FromMegabritishThermalUnits(T megabritishthermalunits) { - double value = (double) megabritishthermalunits; - return new Energy(value, EnergyUnit.MegabritishThermalUnit); + return new Energy(megabritishthermalunits, EnergyUnit.MegabritishThermalUnit); } /// /// Get from Megajoules. /// /// If value is NaN or Infinity. - public static Energy FromMegajoules(QuantityValue megajoules) + public static Energy FromMegajoules(T megajoules) { - double value = (double) megajoules; - return new Energy(value, EnergyUnit.Megajoule); + return new Energy(megajoules, EnergyUnit.Megajoule); } /// /// Get from MegawattHours. /// /// If value is NaN or Infinity. - public static Energy FromMegawattHours(QuantityValue megawatthours) + public static Energy FromMegawattHours(T megawatthours) { - double value = (double) megawatthours; - return new Energy(value, EnergyUnit.MegawattHour); + return new Energy(megawatthours, EnergyUnit.MegawattHour); } /// /// Get from Millijoules. /// /// If value is NaN or Infinity. - public static Energy FromMillijoules(QuantityValue millijoules) + public static Energy FromMillijoules(T millijoules) { - double value = (double) millijoules; - return new Energy(value, EnergyUnit.Millijoule); + return new Energy(millijoules, EnergyUnit.Millijoule); } /// /// Get from TerawattHours. /// /// If value is NaN or Infinity. - public static Energy FromTerawattHours(QuantityValue terawatthours) + public static Energy FromTerawattHours(T terawatthours) { - double value = (double) terawatthours; - return new Energy(value, EnergyUnit.TerawattHour); + return new Energy(terawatthours, EnergyUnit.TerawattHour); } /// /// Get from ThermsEc. /// /// If value is NaN or Infinity. - public static Energy FromThermsEc(QuantityValue thermsec) + public static Energy FromThermsEc(T thermsec) { - double value = (double) thermsec; - return new Energy(value, EnergyUnit.ThermEc); + return new Energy(thermsec, EnergyUnit.ThermEc); } /// /// Get from ThermsImperial. /// /// If value is NaN or Infinity. - public static Energy FromThermsImperial(QuantityValue thermsimperial) + public static Energy FromThermsImperial(T thermsimperial) { - double value = (double) thermsimperial; - return new Energy(value, EnergyUnit.ThermImperial); + return new Energy(thermsimperial, EnergyUnit.ThermImperial); } /// /// Get from ThermsUs. /// /// If value is NaN or Infinity. - public static Energy FromThermsUs(QuantityValue thermsus) + public static Energy FromThermsUs(T thermsus) { - double value = (double) thermsus; - return new Energy(value, EnergyUnit.ThermUs); + return new Energy(thermsus, EnergyUnit.ThermUs); } /// /// Get from WattHours. /// /// If value is NaN or Infinity. - public static Energy FromWattHours(QuantityValue watthours) + public static Energy FromWattHours(T watthours) { - double value = (double) watthours; - return new Energy(value, EnergyUnit.WattHour); + return new Energy(watthours, EnergyUnit.WattHour); } /// @@ -558,9 +531,9 @@ public static Energy FromWattHours(QuantityValue watthours) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Energy From(QuantityValue value, EnergyUnit fromUnit) + public static Energy From(T value, EnergyUnit fromUnit) { - return new Energy((double)value, fromUnit); + return new Energy(value, fromUnit); } #endregion @@ -714,43 +687,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Energy /// Negate the value. public static Energy operator -(Energy right) { - return new Energy(-right.Value, right.Unit); + return new Energy(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Energy operator +(Energy left, Energy right) { - return new Energy(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Energy(value, left.Unit); } /// Get from subtracting two . public static Energy operator -(Energy left, Energy right) { - return new Energy(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Energy(value, left.Unit); } /// Get from multiplying value and . - public static Energy operator *(double left, Energy right) + public static Energy operator *(T left, Energy right) { - return new Energy(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Energy(value, right.Unit); } /// Get from multiplying value and . - public static Energy operator *(Energy left, double right) + public static Energy operator *(Energy left, T right) { - return new Energy(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Energy(value, left.Unit); } /// Get from dividing by value. - public static Energy operator /(Energy left, double right) + public static Energy operator /(Energy left, T right) { - return new Energy(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Energy(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Energy left, Energy right) + public static T operator /(Energy left, Energy right) { - return left.Joules / right.Joules; + return CompiledLambdas.Divide(left.Joules, right.Joules); } #endregion @@ -760,25 +738,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Energy /// Returns true if less or equal to. public static bool operator <=(Energy left, Energy right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Energy left, Energy right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Energy left, Energy right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Energy left, Energy right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -807,7 +785,7 @@ public int CompareTo(object obj) /// public int CompareTo(Energy other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -824,7 +802,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Energy other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -872,10 +850,8 @@ public bool Equals(Energy other, double tolerance, ComparisonType comparisonT if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -895,17 +871,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(EnergyUnit unit) + public T As(EnergyUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -925,9 +901,14 @@ double IQuantity.As(Enum unit) if(!(unit is EnergyUnit unitAsEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(EnergyUnit)} is supported.", nameof(unit)); - return As(unitAsEnergyUnit); + var asValue = As(unitAsEnergyUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(EnergyUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -968,42 +949,48 @@ public Energy ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(EnergyUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(EnergyUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case EnergyUnit.BritishThermalUnit: return _value*1055.05585262; - case EnergyUnit.Calorie: return _value*4.184; - case EnergyUnit.DecathermEc: return (_value*1.05505585262e8) * 1e1d; - case EnergyUnit.DecathermImperial: return (_value*1.05505585257348e8) * 1e1d; - case EnergyUnit.DecathermUs: return (_value*1.054804e8) * 1e1d; - case EnergyUnit.ElectronVolt: return _value*1.602176565e-19; - case EnergyUnit.Erg: return _value*1e-7; - case EnergyUnit.FootPound: return _value*1.355817948; - case EnergyUnit.GigabritishThermalUnit: return (_value*1055.05585262) * 1e9d; - case EnergyUnit.GigawattHour: return (_value*3600d) * 1e9d; - case EnergyUnit.Joule: return _value; - case EnergyUnit.KilobritishThermalUnit: return (_value*1055.05585262) * 1e3d; - case EnergyUnit.Kilocalorie: return (_value*4.184) * 1e3d; - case EnergyUnit.Kilojoule: return (_value) * 1e3d; - case EnergyUnit.KilowattHour: return (_value*3600d) * 1e3d; - case EnergyUnit.MegabritishThermalUnit: return (_value*1055.05585262) * 1e6d; - case EnergyUnit.Megajoule: return (_value) * 1e6d; - case EnergyUnit.MegawattHour: return (_value*3600d) * 1e6d; - case EnergyUnit.Millijoule: return (_value) * 1e-3d; - case EnergyUnit.TerawattHour: return (_value*3600d) * 1e12d; - case EnergyUnit.ThermEc: return _value*1.05505585262e8; - case EnergyUnit.ThermImperial: return _value*1.05505585257348e8; - case EnergyUnit.ThermUs: return _value*1.054804e8; - case EnergyUnit.WattHour: return _value*3600d; + case EnergyUnit.BritishThermalUnit: return Value*1055.05585262; + case EnergyUnit.Calorie: return Value*4.184; + case EnergyUnit.DecathermEc: return (Value*1.05505585262e8) * 1e1d; + case EnergyUnit.DecathermImperial: return (Value*1.05505585257348e8) * 1e1d; + case EnergyUnit.DecathermUs: return (Value*1.054804e8) * 1e1d; + case EnergyUnit.ElectronVolt: return Value*1.602176565e-19; + case EnergyUnit.Erg: return Value*1e-7; + case EnergyUnit.FootPound: return Value*1.355817948; + case EnergyUnit.GigabritishThermalUnit: return (Value*1055.05585262) * 1e9d; + case EnergyUnit.GigawattHour: return (Value*3600d) * 1e9d; + case EnergyUnit.Joule: return Value; + case EnergyUnit.KilobritishThermalUnit: return (Value*1055.05585262) * 1e3d; + case EnergyUnit.Kilocalorie: return (Value*4.184) * 1e3d; + case EnergyUnit.Kilojoule: return (Value) * 1e3d; + case EnergyUnit.KilowattHour: return (Value*3600d) * 1e3d; + case EnergyUnit.MegabritishThermalUnit: return (Value*1055.05585262) * 1e6d; + case EnergyUnit.Megajoule: return (Value) * 1e6d; + case EnergyUnit.MegawattHour: return (Value*3600d) * 1e6d; + case EnergyUnit.Millijoule: return (Value) * 1e-3d; + case EnergyUnit.TerawattHour: return (Value*3600d) * 1e12d; + case EnergyUnit.ThermEc: return Value*1.05505585262e8; + case EnergyUnit.ThermImperial: return Value*1.05505585257348e8; + case EnergyUnit.ThermUs: return Value*1.054804e8; + case EnergyUnit.WattHour: return Value*3600d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -1020,10 +1007,10 @@ internal Energy ToBaseUnit() return new Energy(baseUnitValue, BaseUnit); } - private double GetValueAs(EnergyUnit unit) + private T GetValueAs(EnergyUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1154,7 +1141,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1169,37 +1156,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1223,17 +1210,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs index 307bcd3a29..d05fbc80cb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Entropy is an important concept in the branch of science known as thermodynamics. The idea of "irreversibility" is central to the understanding of entropy. It is often said that entropy is an expression of the disorder, or randomness of a system, or of our lack of information about it. Entropy is an extensive property. It has the dimension of energy divided by temperature, which has a unit of joules per kelvin (J/K) in the International System of Units /// - public partial struct Entropy : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Entropy : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -67,12 +62,12 @@ static Entropy() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Entropy(double value, EntropyUnit unit) + public Entropy(T value, EntropyUnit unit) { if(unit == EntropyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -84,14 +79,14 @@ public Entropy(double value, EntropyUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Entropy(double value, UnitSystem unitSystem) + public Entropy(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -133,7 +128,7 @@ public Entropy(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKelvin. /// - public static Entropy Zero { get; } = new Entropy(0, BaseUnit); + public static Entropy Zero { get; } = new Entropy((T)0, BaseUnit); #endregion @@ -142,7 +137,9 @@ public Entropy(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -172,37 +169,37 @@ public Entropy(double value, UnitSystem unitSystem) /// /// Get in CaloriesPerKelvin. /// - public double CaloriesPerKelvin => As(EntropyUnit.CaloriePerKelvin); + public T CaloriesPerKelvin => As(EntropyUnit.CaloriePerKelvin); /// /// Get in JoulesPerDegreeCelsius. /// - public double JoulesPerDegreeCelsius => As(EntropyUnit.JoulePerDegreeCelsius); + public T JoulesPerDegreeCelsius => As(EntropyUnit.JoulePerDegreeCelsius); /// /// Get in JoulesPerKelvin. /// - public double JoulesPerKelvin => As(EntropyUnit.JoulePerKelvin); + public T JoulesPerKelvin => As(EntropyUnit.JoulePerKelvin); /// /// Get in KilocaloriesPerKelvin. /// - public double KilocaloriesPerKelvin => As(EntropyUnit.KilocaloriePerKelvin); + public T KilocaloriesPerKelvin => As(EntropyUnit.KilocaloriePerKelvin); /// /// Get in KilojoulesPerDegreeCelsius. /// - public double KilojoulesPerDegreeCelsius => As(EntropyUnit.KilojoulePerDegreeCelsius); + public T KilojoulesPerDegreeCelsius => As(EntropyUnit.KilojoulePerDegreeCelsius); /// /// Get in KilojoulesPerKelvin. /// - public double KilojoulesPerKelvin => As(EntropyUnit.KilojoulePerKelvin); + public T KilojoulesPerKelvin => As(EntropyUnit.KilojoulePerKelvin); /// /// Get in MegajoulesPerKelvin. /// - public double MegajoulesPerKelvin => As(EntropyUnit.MegajoulePerKelvin); + public T MegajoulesPerKelvin => As(EntropyUnit.MegajoulePerKelvin); #endregion @@ -237,64 +234,57 @@ public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] IFormatProvid /// Get from CaloriesPerKelvin. /// /// If value is NaN or Infinity. - public static Entropy FromCaloriesPerKelvin(QuantityValue caloriesperkelvin) + public static Entropy FromCaloriesPerKelvin(T caloriesperkelvin) { - double value = (double) caloriesperkelvin; - return new Entropy(value, EntropyUnit.CaloriePerKelvin); + return new Entropy(caloriesperkelvin, EntropyUnit.CaloriePerKelvin); } /// /// Get from JoulesPerDegreeCelsius. /// /// If value is NaN or Infinity. - public static Entropy FromJoulesPerDegreeCelsius(QuantityValue joulesperdegreecelsius) + public static Entropy FromJoulesPerDegreeCelsius(T joulesperdegreecelsius) { - double value = (double) joulesperdegreecelsius; - return new Entropy(value, EntropyUnit.JoulePerDegreeCelsius); + return new Entropy(joulesperdegreecelsius, EntropyUnit.JoulePerDegreeCelsius); } /// /// Get from JoulesPerKelvin. /// /// If value is NaN or Infinity. - public static Entropy FromJoulesPerKelvin(QuantityValue joulesperkelvin) + public static Entropy FromJoulesPerKelvin(T joulesperkelvin) { - double value = (double) joulesperkelvin; - return new Entropy(value, EntropyUnit.JoulePerKelvin); + return new Entropy(joulesperkelvin, EntropyUnit.JoulePerKelvin); } /// /// Get from KilocaloriesPerKelvin. /// /// If value is NaN or Infinity. - public static Entropy FromKilocaloriesPerKelvin(QuantityValue kilocaloriesperkelvin) + public static Entropy FromKilocaloriesPerKelvin(T kilocaloriesperkelvin) { - double value = (double) kilocaloriesperkelvin; - return new Entropy(value, EntropyUnit.KilocaloriePerKelvin); + return new Entropy(kilocaloriesperkelvin, EntropyUnit.KilocaloriePerKelvin); } /// /// Get from KilojoulesPerDegreeCelsius. /// /// If value is NaN or Infinity. - public static Entropy FromKilojoulesPerDegreeCelsius(QuantityValue kilojoulesperdegreecelsius) + public static Entropy FromKilojoulesPerDegreeCelsius(T kilojoulesperdegreecelsius) { - double value = (double) kilojoulesperdegreecelsius; - return new Entropy(value, EntropyUnit.KilojoulePerDegreeCelsius); + return new Entropy(kilojoulesperdegreecelsius, EntropyUnit.KilojoulePerDegreeCelsius); } /// /// Get from KilojoulesPerKelvin. /// /// If value is NaN or Infinity. - public static Entropy FromKilojoulesPerKelvin(QuantityValue kilojoulesperkelvin) + public static Entropy FromKilojoulesPerKelvin(T kilojoulesperkelvin) { - double value = (double) kilojoulesperkelvin; - return new Entropy(value, EntropyUnit.KilojoulePerKelvin); + return new Entropy(kilojoulesperkelvin, EntropyUnit.KilojoulePerKelvin); } /// /// Get from MegajoulesPerKelvin. /// /// If value is NaN or Infinity. - public static Entropy FromMegajoulesPerKelvin(QuantityValue megajoulesperkelvin) + public static Entropy FromMegajoulesPerKelvin(T megajoulesperkelvin) { - double value = (double) megajoulesperkelvin; - return new Entropy(value, EntropyUnit.MegajoulePerKelvin); + return new Entropy(megajoulesperkelvin, EntropyUnit.MegajoulePerKelvin); } /// @@ -303,9 +293,9 @@ public static Entropy FromMegajoulesPerKelvin(QuantityValue megajoulesperkelv /// Value to convert from. /// Unit to convert from. /// unit value. - public static Entropy From(QuantityValue value, EntropyUnit fromUnit) + public static Entropy From(T value, EntropyUnit fromUnit) { - return new Entropy((double)value, fromUnit); + return new Entropy(value, fromUnit); } #endregion @@ -459,43 +449,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Entrop /// Negate the value. public static Entropy operator -(Entropy right) { - return new Entropy(-right.Value, right.Unit); + return new Entropy(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Entropy operator +(Entropy left, Entropy right) { - return new Entropy(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Entropy(value, left.Unit); } /// Get from subtracting two . public static Entropy operator -(Entropy left, Entropy right) { - return new Entropy(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Entropy(value, left.Unit); } /// Get from multiplying value and . - public static Entropy operator *(double left, Entropy right) + public static Entropy operator *(T left, Entropy right) { - return new Entropy(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Entropy(value, right.Unit); } /// Get from multiplying value and . - public static Entropy operator *(Entropy left, double right) + public static Entropy operator *(Entropy left, T right) { - return new Entropy(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Entropy(value, left.Unit); } /// Get from dividing by value. - public static Entropy operator /(Entropy left, double right) + public static Entropy operator /(Entropy left, T right) { - return new Entropy(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Entropy(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Entropy left, Entropy right) + public static T operator /(Entropy left, Entropy right) { - return left.JoulesPerKelvin / right.JoulesPerKelvin; + return CompiledLambdas.Divide(left.JoulesPerKelvin, right.JoulesPerKelvin); } #endregion @@ -505,25 +500,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Entrop /// Returns true if less or equal to. public static bool operator <=(Entropy left, Entropy right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Entropy left, Entropy right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Entropy left, Entropy right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Entropy left, Entropy right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -552,7 +547,7 @@ public int CompareTo(object obj) /// public int CompareTo(Entropy other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -569,7 +564,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Entropy other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -617,10 +612,8 @@ public bool Equals(Entropy other, double tolerance, ComparisonType comparison if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -640,17 +633,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(EntropyUnit unit) + public T As(EntropyUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -670,9 +663,14 @@ double IQuantity.As(Enum unit) if(!(unit is EntropyUnit unitAsEntropyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(EntropyUnit)} is supported.", nameof(unit)); - return As(unitAsEntropyUnit); + var asValue = As(unitAsEntropyUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(EntropyUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -713,25 +711,31 @@ public Entropy ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(EntropyUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(EntropyUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case EntropyUnit.CaloriePerKelvin: return _value*4.184; - case EntropyUnit.JoulePerDegreeCelsius: return _value; - case EntropyUnit.JoulePerKelvin: return _value; - case EntropyUnit.KilocaloriePerKelvin: return (_value*4.184) * 1e3d; - case EntropyUnit.KilojoulePerDegreeCelsius: return (_value) * 1e3d; - case EntropyUnit.KilojoulePerKelvin: return (_value) * 1e3d; - case EntropyUnit.MegajoulePerKelvin: return (_value) * 1e6d; + case EntropyUnit.CaloriePerKelvin: return Value*4.184; + case EntropyUnit.JoulePerDegreeCelsius: return Value; + case EntropyUnit.JoulePerKelvin: return Value; + case EntropyUnit.KilocaloriePerKelvin: return (Value*4.184) * 1e3d; + case EntropyUnit.KilojoulePerDegreeCelsius: return (Value) * 1e3d; + case EntropyUnit.KilojoulePerKelvin: return (Value) * 1e3d; + case EntropyUnit.MegajoulePerKelvin: return (Value) * 1e6d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -748,10 +752,10 @@ internal Entropy ToBaseUnit() return new Entropy(baseUnitValue, BaseUnit); } - private double GetValueAs(EntropyUnit unit) + private T GetValueAs(EntropyUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -865,7 +869,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -880,37 +884,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -934,17 +938,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Force.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.g.cs index 9f2dc7c9de..245bccd940 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// In physics, a force is any influence that causes an object to undergo a certain change, either concerning its movement, direction, or geometrical construction. In other words, a force can cause an object with mass to change its velocity (which includes to begin moving from a state of rest), i.e., to accelerate, or a flexible object to deform, or both. Force can also be described by intuitive concepts such as a push or a pull. A force has both magnitude and direction, making it a vector quantity. It is measured in the SI unit of newtons and represented by the symbol F. /// - public partial struct Force : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Force : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -73,12 +68,12 @@ static Force() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Force(double value, ForceUnit unit) + public Force(T value, ForceUnit unit) { if(unit == ForceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -90,14 +85,14 @@ public Force(double value, ForceUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Force(double value, UnitSystem unitSystem) + public Force(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -139,7 +134,7 @@ public Force(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Newton. /// - public static Force Zero { get; } = new Force(0, BaseUnit); + public static Force Zero { get; } = new Force((T)0, BaseUnit); #endregion @@ -148,7 +143,9 @@ public Force(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -178,67 +175,67 @@ public Force(double value, UnitSystem unitSystem) /// /// Get in Decanewtons. /// - public double Decanewtons => As(ForceUnit.Decanewton); + public T Decanewtons => As(ForceUnit.Decanewton); /// /// Get in Dyne. /// - public double Dyne => As(ForceUnit.Dyn); + public T Dyne => As(ForceUnit.Dyn); /// /// Get in KilogramsForce. /// - public double KilogramsForce => As(ForceUnit.KilogramForce); + public T KilogramsForce => As(ForceUnit.KilogramForce); /// /// Get in Kilonewtons. /// - public double Kilonewtons => As(ForceUnit.Kilonewton); + public T Kilonewtons => As(ForceUnit.Kilonewton); /// /// Get in KiloPonds. /// - public double KiloPonds => As(ForceUnit.KiloPond); + public T KiloPonds => As(ForceUnit.KiloPond); /// /// Get in Meganewtons. /// - public double Meganewtons => As(ForceUnit.Meganewton); + public T Meganewtons => As(ForceUnit.Meganewton); /// /// Get in Micronewtons. /// - public double Micronewtons => As(ForceUnit.Micronewton); + public T Micronewtons => As(ForceUnit.Micronewton); /// /// Get in Millinewtons. /// - public double Millinewtons => As(ForceUnit.Millinewton); + public T Millinewtons => As(ForceUnit.Millinewton); /// /// Get in Newtons. /// - public double Newtons => As(ForceUnit.Newton); + public T Newtons => As(ForceUnit.Newton); /// /// Get in OunceForce. /// - public double OunceForce => As(ForceUnit.OunceForce); + public T OunceForce => As(ForceUnit.OunceForce); /// /// Get in Poundals. /// - public double Poundals => As(ForceUnit.Poundal); + public T Poundals => As(ForceUnit.Poundal); /// /// Get in PoundsForce. /// - public double PoundsForce => As(ForceUnit.PoundForce); + public T PoundsForce => As(ForceUnit.PoundForce); /// /// Get in TonnesForce. /// - public double TonnesForce => As(ForceUnit.TonneForce); + public T TonnesForce => As(ForceUnit.TonneForce); #endregion @@ -273,118 +270,105 @@ public static string GetAbbreviation(ForceUnit unit, [CanBeNull] IFormatProvider /// Get from Decanewtons. /// /// If value is NaN or Infinity. - public static Force FromDecanewtons(QuantityValue decanewtons) + public static Force FromDecanewtons(T decanewtons) { - double value = (double) decanewtons; - return new Force(value, ForceUnit.Decanewton); + return new Force(decanewtons, ForceUnit.Decanewton); } /// /// Get from Dyne. /// /// If value is NaN or Infinity. - public static Force FromDyne(QuantityValue dyne) + public static Force FromDyne(T dyne) { - double value = (double) dyne; - return new Force(value, ForceUnit.Dyn); + return new Force(dyne, ForceUnit.Dyn); } /// /// Get from KilogramsForce. /// /// If value is NaN or Infinity. - public static Force FromKilogramsForce(QuantityValue kilogramsforce) + public static Force FromKilogramsForce(T kilogramsforce) { - double value = (double) kilogramsforce; - return new Force(value, ForceUnit.KilogramForce); + return new Force(kilogramsforce, ForceUnit.KilogramForce); } /// /// Get from Kilonewtons. /// /// If value is NaN or Infinity. - public static Force FromKilonewtons(QuantityValue kilonewtons) + public static Force FromKilonewtons(T kilonewtons) { - double value = (double) kilonewtons; - return new Force(value, ForceUnit.Kilonewton); + return new Force(kilonewtons, ForceUnit.Kilonewton); } /// /// Get from KiloPonds. /// /// If value is NaN or Infinity. - public static Force FromKiloPonds(QuantityValue kiloponds) + public static Force FromKiloPonds(T kiloponds) { - double value = (double) kiloponds; - return new Force(value, ForceUnit.KiloPond); + return new Force(kiloponds, ForceUnit.KiloPond); } /// /// Get from Meganewtons. /// /// If value is NaN or Infinity. - public static Force FromMeganewtons(QuantityValue meganewtons) + public static Force FromMeganewtons(T meganewtons) { - double value = (double) meganewtons; - return new Force(value, ForceUnit.Meganewton); + return new Force(meganewtons, ForceUnit.Meganewton); } /// /// Get from Micronewtons. /// /// If value is NaN or Infinity. - public static Force FromMicronewtons(QuantityValue micronewtons) + public static Force FromMicronewtons(T micronewtons) { - double value = (double) micronewtons; - return new Force(value, ForceUnit.Micronewton); + return new Force(micronewtons, ForceUnit.Micronewton); } /// /// Get from Millinewtons. /// /// If value is NaN or Infinity. - public static Force FromMillinewtons(QuantityValue millinewtons) + public static Force FromMillinewtons(T millinewtons) { - double value = (double) millinewtons; - return new Force(value, ForceUnit.Millinewton); + return new Force(millinewtons, ForceUnit.Millinewton); } /// /// Get from Newtons. /// /// If value is NaN or Infinity. - public static Force FromNewtons(QuantityValue newtons) + public static Force FromNewtons(T newtons) { - double value = (double) newtons; - return new Force(value, ForceUnit.Newton); + return new Force(newtons, ForceUnit.Newton); } /// /// Get from OunceForce. /// /// If value is NaN or Infinity. - public static Force FromOunceForce(QuantityValue ounceforce) + public static Force FromOunceForce(T ounceforce) { - double value = (double) ounceforce; - return new Force(value, ForceUnit.OunceForce); + return new Force(ounceforce, ForceUnit.OunceForce); } /// /// Get from Poundals. /// /// If value is NaN or Infinity. - public static Force FromPoundals(QuantityValue poundals) + public static Force FromPoundals(T poundals) { - double value = (double) poundals; - return new Force(value, ForceUnit.Poundal); + return new Force(poundals, ForceUnit.Poundal); } /// /// Get from PoundsForce. /// /// If value is NaN or Infinity. - public static Force FromPoundsForce(QuantityValue poundsforce) + public static Force FromPoundsForce(T poundsforce) { - double value = (double) poundsforce; - return new Force(value, ForceUnit.PoundForce); + return new Force(poundsforce, ForceUnit.PoundForce); } /// /// Get from TonnesForce. /// /// If value is NaN or Infinity. - public static Force FromTonnesForce(QuantityValue tonnesforce) + public static Force FromTonnesForce(T tonnesforce) { - double value = (double) tonnesforce; - return new Force(value, ForceUnit.TonneForce); + return new Force(tonnesforce, ForceUnit.TonneForce); } /// @@ -393,9 +377,9 @@ public static Force FromTonnesForce(QuantityValue tonnesforce) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Force From(QuantityValue value, ForceUnit fromUnit) + public static Force From(T value, ForceUnit fromUnit) { - return new Force((double)value, fromUnit); + return new Force(value, fromUnit); } #endregion @@ -549,43 +533,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceU /// Negate the value. public static Force operator -(Force right) { - return new Force(-right.Value, right.Unit); + return new Force(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Force operator +(Force left, Force right) { - return new Force(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Force(value, left.Unit); } /// Get from subtracting two . public static Force operator -(Force left, Force right) { - return new Force(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Force(value, left.Unit); } /// Get from multiplying value and . - public static Force operator *(double left, Force right) + public static Force operator *(T left, Force right) { - return new Force(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Force(value, right.Unit); } /// Get from multiplying value and . - public static Force operator *(Force left, double right) + public static Force operator *(Force left, T right) { - return new Force(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Force(value, left.Unit); } /// Get from dividing by value. - public static Force operator /(Force left, double right) + public static Force operator /(Force left, T right) { - return new Force(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Force(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Force left, Force right) + public static T operator /(Force left, Force right) { - return left.Newtons / right.Newtons; + return CompiledLambdas.Divide(left.Newtons, right.Newtons); } #endregion @@ -595,25 +584,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceU /// Returns true if less or equal to. public static bool operator <=(Force left, Force right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Force left, Force right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Force left, Force right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Force left, Force right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -642,7 +631,7 @@ public int CompareTo(object obj) /// public int CompareTo(Force other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -659,7 +648,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Force other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -707,10 +696,8 @@ public bool Equals(Force other, double tolerance, ComparisonType comparisonTy if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -730,17 +717,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ForceUnit unit) + public T As(ForceUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -760,9 +747,14 @@ double IQuantity.As(Enum unit) if(!(unit is ForceUnit unitAsForceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForceUnit)} is supported.", nameof(unit)); - return As(unitAsForceUnit); + var asValue = As(unitAsForceUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ForceUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -803,31 +795,37 @@ public Force ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ForceUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ForceUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ForceUnit.Decanewton: return (_value) * 1e1d; - case ForceUnit.Dyn: return _value/1e5; - case ForceUnit.KilogramForce: return _value*9.80665002864; - case ForceUnit.Kilonewton: return (_value) * 1e3d; - case ForceUnit.KiloPond: return _value*9.80665002864; - case ForceUnit.Meganewton: return (_value) * 1e6d; - case ForceUnit.Micronewton: return (_value) * 1e-6d; - case ForceUnit.Millinewton: return (_value) * 1e-3d; - case ForceUnit.Newton: return _value; - case ForceUnit.OunceForce: return _value*2.780138509537812e-1; - case ForceUnit.Poundal: return _value*0.13825502798973041652092282466083; - case ForceUnit.PoundForce: return _value*4.4482216152605095551842641431421; - case ForceUnit.TonneForce: return _value*9.80665002864e3; + case ForceUnit.Decanewton: return (Value) * 1e1d; + case ForceUnit.Dyn: return Value/1e5; + case ForceUnit.KilogramForce: return Value*9.80665002864; + case ForceUnit.Kilonewton: return (Value) * 1e3d; + case ForceUnit.KiloPond: return Value*9.80665002864; + case ForceUnit.Meganewton: return (Value) * 1e6d; + case ForceUnit.Micronewton: return (Value) * 1e-6d; + case ForceUnit.Millinewton: return (Value) * 1e-3d; + case ForceUnit.Newton: return Value; + case ForceUnit.OunceForce: return Value*2.780138509537812e-1; + case ForceUnit.Poundal: return Value*0.13825502798973041652092282466083; + case ForceUnit.PoundForce: return Value*4.4482216152605095551842641431421; + case ForceUnit.TonneForce: return Value*9.80665002864e3; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -844,10 +842,10 @@ internal Force ToBaseUnit() return new Force(baseUnitValue, BaseUnit); } - private double GetValueAs(ForceUnit unit) + private T GetValueAs(ForceUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -967,7 +965,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -982,37 +980,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1036,17 +1034,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs index c1d57b7949..c252a5759e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Force change rate is the ratio of the force change to the time during which the change occurred (value of force changes per unit time). /// - public partial struct ForceChangeRate : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ForceChangeRate : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -71,12 +66,12 @@ static ForceChangeRate() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ForceChangeRate(double value, ForceChangeRateUnit unit) + public ForceChangeRate(T value, ForceChangeRateUnit unit) { if(unit == ForceChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -88,14 +83,14 @@ public ForceChangeRate(double value, ForceChangeRateUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ForceChangeRate(double value, UnitSystem unitSystem) + public ForceChangeRate(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -137,7 +132,7 @@ public ForceChangeRate(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerSecond. /// - public static ForceChangeRate Zero { get; } = new ForceChangeRate(0, BaseUnit); + public static ForceChangeRate Zero { get; } = new ForceChangeRate((T)0, BaseUnit); #endregion @@ -146,7 +141,9 @@ public ForceChangeRate(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -176,57 +173,57 @@ public ForceChangeRate(double value, UnitSystem unitSystem) /// /// Get in CentinewtonsPerSecond. /// - public double CentinewtonsPerSecond => As(ForceChangeRateUnit.CentinewtonPerSecond); + public T CentinewtonsPerSecond => As(ForceChangeRateUnit.CentinewtonPerSecond); /// /// Get in DecanewtonsPerMinute. /// - public double DecanewtonsPerMinute => As(ForceChangeRateUnit.DecanewtonPerMinute); + public T DecanewtonsPerMinute => As(ForceChangeRateUnit.DecanewtonPerMinute); /// /// Get in DecanewtonsPerSecond. /// - public double DecanewtonsPerSecond => As(ForceChangeRateUnit.DecanewtonPerSecond); + public T DecanewtonsPerSecond => As(ForceChangeRateUnit.DecanewtonPerSecond); /// /// Get in DecinewtonsPerSecond. /// - public double DecinewtonsPerSecond => As(ForceChangeRateUnit.DecinewtonPerSecond); + public T DecinewtonsPerSecond => As(ForceChangeRateUnit.DecinewtonPerSecond); /// /// Get in KilonewtonsPerMinute. /// - public double KilonewtonsPerMinute => As(ForceChangeRateUnit.KilonewtonPerMinute); + public T KilonewtonsPerMinute => As(ForceChangeRateUnit.KilonewtonPerMinute); /// /// Get in KilonewtonsPerSecond. /// - public double KilonewtonsPerSecond => As(ForceChangeRateUnit.KilonewtonPerSecond); + public T KilonewtonsPerSecond => As(ForceChangeRateUnit.KilonewtonPerSecond); /// /// Get in MicronewtonsPerSecond. /// - public double MicronewtonsPerSecond => As(ForceChangeRateUnit.MicronewtonPerSecond); + public T MicronewtonsPerSecond => As(ForceChangeRateUnit.MicronewtonPerSecond); /// /// Get in MillinewtonsPerSecond. /// - public double MillinewtonsPerSecond => As(ForceChangeRateUnit.MillinewtonPerSecond); + public T MillinewtonsPerSecond => As(ForceChangeRateUnit.MillinewtonPerSecond); /// /// Get in NanonewtonsPerSecond. /// - public double NanonewtonsPerSecond => As(ForceChangeRateUnit.NanonewtonPerSecond); + public T NanonewtonsPerSecond => As(ForceChangeRateUnit.NanonewtonPerSecond); /// /// Get in NewtonsPerMinute. /// - public double NewtonsPerMinute => As(ForceChangeRateUnit.NewtonPerMinute); + public T NewtonsPerMinute => As(ForceChangeRateUnit.NewtonPerMinute); /// /// Get in NewtonsPerSecond. /// - public double NewtonsPerSecond => As(ForceChangeRateUnit.NewtonPerSecond); + public T NewtonsPerSecond => As(ForceChangeRateUnit.NewtonPerSecond); #endregion @@ -261,100 +258,89 @@ public static string GetAbbreviation(ForceChangeRateUnit unit, [CanBeNull] IForm /// Get from CentinewtonsPerSecond. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromCentinewtonsPerSecond(QuantityValue centinewtonspersecond) + public static ForceChangeRate FromCentinewtonsPerSecond(T centinewtonspersecond) { - double value = (double) centinewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.CentinewtonPerSecond); + return new ForceChangeRate(centinewtonspersecond, ForceChangeRateUnit.CentinewtonPerSecond); } /// /// Get from DecanewtonsPerMinute. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromDecanewtonsPerMinute(QuantityValue decanewtonsperminute) + public static ForceChangeRate FromDecanewtonsPerMinute(T decanewtonsperminute) { - double value = (double) decanewtonsperminute; - return new ForceChangeRate(value, ForceChangeRateUnit.DecanewtonPerMinute); + return new ForceChangeRate(decanewtonsperminute, ForceChangeRateUnit.DecanewtonPerMinute); } /// /// Get from DecanewtonsPerSecond. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromDecanewtonsPerSecond(QuantityValue decanewtonspersecond) + public static ForceChangeRate FromDecanewtonsPerSecond(T decanewtonspersecond) { - double value = (double) decanewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.DecanewtonPerSecond); + return new ForceChangeRate(decanewtonspersecond, ForceChangeRateUnit.DecanewtonPerSecond); } /// /// Get from DecinewtonsPerSecond. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromDecinewtonsPerSecond(QuantityValue decinewtonspersecond) + public static ForceChangeRate FromDecinewtonsPerSecond(T decinewtonspersecond) { - double value = (double) decinewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.DecinewtonPerSecond); + return new ForceChangeRate(decinewtonspersecond, ForceChangeRateUnit.DecinewtonPerSecond); } /// /// Get from KilonewtonsPerMinute. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromKilonewtonsPerMinute(QuantityValue kilonewtonsperminute) + public static ForceChangeRate FromKilonewtonsPerMinute(T kilonewtonsperminute) { - double value = (double) kilonewtonsperminute; - return new ForceChangeRate(value, ForceChangeRateUnit.KilonewtonPerMinute); + return new ForceChangeRate(kilonewtonsperminute, ForceChangeRateUnit.KilonewtonPerMinute); } /// /// Get from KilonewtonsPerSecond. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromKilonewtonsPerSecond(QuantityValue kilonewtonspersecond) + public static ForceChangeRate FromKilonewtonsPerSecond(T kilonewtonspersecond) { - double value = (double) kilonewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.KilonewtonPerSecond); + return new ForceChangeRate(kilonewtonspersecond, ForceChangeRateUnit.KilonewtonPerSecond); } /// /// Get from MicronewtonsPerSecond. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromMicronewtonsPerSecond(QuantityValue micronewtonspersecond) + public static ForceChangeRate FromMicronewtonsPerSecond(T micronewtonspersecond) { - double value = (double) micronewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.MicronewtonPerSecond); + return new ForceChangeRate(micronewtonspersecond, ForceChangeRateUnit.MicronewtonPerSecond); } /// /// Get from MillinewtonsPerSecond. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromMillinewtonsPerSecond(QuantityValue millinewtonspersecond) + public static ForceChangeRate FromMillinewtonsPerSecond(T millinewtonspersecond) { - double value = (double) millinewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.MillinewtonPerSecond); + return new ForceChangeRate(millinewtonspersecond, ForceChangeRateUnit.MillinewtonPerSecond); } /// /// Get from NanonewtonsPerSecond. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromNanonewtonsPerSecond(QuantityValue nanonewtonspersecond) + public static ForceChangeRate FromNanonewtonsPerSecond(T nanonewtonspersecond) { - double value = (double) nanonewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.NanonewtonPerSecond); + return new ForceChangeRate(nanonewtonspersecond, ForceChangeRateUnit.NanonewtonPerSecond); } /// /// Get from NewtonsPerMinute. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromNewtonsPerMinute(QuantityValue newtonsperminute) + public static ForceChangeRate FromNewtonsPerMinute(T newtonsperminute) { - double value = (double) newtonsperminute; - return new ForceChangeRate(value, ForceChangeRateUnit.NewtonPerMinute); + return new ForceChangeRate(newtonsperminute, ForceChangeRateUnit.NewtonPerMinute); } /// /// Get from NewtonsPerSecond. /// /// If value is NaN or Infinity. - public static ForceChangeRate FromNewtonsPerSecond(QuantityValue newtonspersecond) + public static ForceChangeRate FromNewtonsPerSecond(T newtonspersecond) { - double value = (double) newtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.NewtonPerSecond); + return new ForceChangeRate(newtonspersecond, ForceChangeRateUnit.NewtonPerSecond); } /// @@ -363,9 +349,9 @@ public static ForceChangeRate FromNewtonsPerSecond(QuantityValue newtonsperse /// Value to convert from. /// Unit to convert from. /// unit value. - public static ForceChangeRate From(QuantityValue value, ForceChangeRateUnit fromUnit) + public static ForceChangeRate From(T value, ForceChangeRateUnit fromUnit) { - return new ForceChangeRate((double)value, fromUnit); + return new ForceChangeRate(value, fromUnit); } #endregion @@ -519,43 +505,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceC /// Negate the value. public static ForceChangeRate operator -(ForceChangeRate right) { - return new ForceChangeRate(-right.Value, right.Unit); + return new ForceChangeRate(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ForceChangeRate operator +(ForceChangeRate left, ForceChangeRate right) { - return new ForceChangeRate(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ForceChangeRate(value, left.Unit); } /// Get from subtracting two . public static ForceChangeRate operator -(ForceChangeRate left, ForceChangeRate right) { - return new ForceChangeRate(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ForceChangeRate(value, left.Unit); } /// Get from multiplying value and . - public static ForceChangeRate operator *(double left, ForceChangeRate right) + public static ForceChangeRate operator *(T left, ForceChangeRate right) { - return new ForceChangeRate(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ForceChangeRate(value, right.Unit); } /// Get from multiplying value and . - public static ForceChangeRate operator *(ForceChangeRate left, double right) + public static ForceChangeRate operator *(ForceChangeRate left, T right) { - return new ForceChangeRate(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ForceChangeRate(value, left.Unit); } /// Get from dividing by value. - public static ForceChangeRate operator /(ForceChangeRate left, double right) + public static ForceChangeRate operator /(ForceChangeRate left, T right) { - return new ForceChangeRate(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ForceChangeRate(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ForceChangeRate left, ForceChangeRate right) + public static T operator /(ForceChangeRate left, ForceChangeRate right) { - return left.NewtonsPerSecond / right.NewtonsPerSecond; + return CompiledLambdas.Divide(left.NewtonsPerSecond, right.NewtonsPerSecond); } #endregion @@ -565,25 +556,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceC /// Returns true if less or equal to. public static bool operator <=(ForceChangeRate left, ForceChangeRate right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ForceChangeRate left, ForceChangeRate right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ForceChangeRate left, ForceChangeRate right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ForceChangeRate left, ForceChangeRate right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -612,7 +603,7 @@ public int CompareTo(object obj) /// public int CompareTo(ForceChangeRate other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -629,7 +620,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ForceChangeRate other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -677,10 +668,8 @@ public bool Equals(ForceChangeRate other, double tolerance, ComparisonType co if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -700,17 +689,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ForceChangeRateUnit unit) + public T As(ForceChangeRateUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -730,9 +719,14 @@ double IQuantity.As(Enum unit) if(!(unit is ForceChangeRateUnit unitAsForceChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForceChangeRateUnit)} is supported.", nameof(unit)); - return As(unitAsForceChangeRateUnit); + var asValue = As(unitAsForceChangeRateUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ForceChangeRateUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -773,29 +767,35 @@ public ForceChangeRate ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ForceChangeRateUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ForceChangeRateUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ForceChangeRateUnit.CentinewtonPerSecond: return (_value) * 1e-2d; - case ForceChangeRateUnit.DecanewtonPerMinute: return (_value/60) * 1e1d; - case ForceChangeRateUnit.DecanewtonPerSecond: return (_value) * 1e1d; - case ForceChangeRateUnit.DecinewtonPerSecond: return (_value) * 1e-1d; - case ForceChangeRateUnit.KilonewtonPerMinute: return (_value/60) * 1e3d; - case ForceChangeRateUnit.KilonewtonPerSecond: return (_value) * 1e3d; - case ForceChangeRateUnit.MicronewtonPerSecond: return (_value) * 1e-6d; - case ForceChangeRateUnit.MillinewtonPerSecond: return (_value) * 1e-3d; - case ForceChangeRateUnit.NanonewtonPerSecond: return (_value) * 1e-9d; - case ForceChangeRateUnit.NewtonPerMinute: return _value/60; - case ForceChangeRateUnit.NewtonPerSecond: return _value; + case ForceChangeRateUnit.CentinewtonPerSecond: return (Value) * 1e-2d; + case ForceChangeRateUnit.DecanewtonPerMinute: return (Value/60) * 1e1d; + case ForceChangeRateUnit.DecanewtonPerSecond: return (Value) * 1e1d; + case ForceChangeRateUnit.DecinewtonPerSecond: return (Value) * 1e-1d; + case ForceChangeRateUnit.KilonewtonPerMinute: return (Value/60) * 1e3d; + case ForceChangeRateUnit.KilonewtonPerSecond: return (Value) * 1e3d; + case ForceChangeRateUnit.MicronewtonPerSecond: return (Value) * 1e-6d; + case ForceChangeRateUnit.MillinewtonPerSecond: return (Value) * 1e-3d; + case ForceChangeRateUnit.NanonewtonPerSecond: return (Value) * 1e-9d; + case ForceChangeRateUnit.NewtonPerMinute: return Value/60; + case ForceChangeRateUnit.NewtonPerSecond: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -812,10 +812,10 @@ internal ForceChangeRate ToBaseUnit() return new ForceChangeRate(baseUnitValue, BaseUnit); } - private double GetValueAs(ForceChangeRateUnit unit) + private T GetValueAs(ForceChangeRateUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -933,7 +933,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -948,37 +948,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1002,17 +1002,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs index 5a8953daba..babbb766aa 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// The magnitude of force per unit length. /// - public partial struct ForcePerLength : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ForcePerLength : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -72,12 +67,12 @@ static ForcePerLength() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ForcePerLength(double value, ForcePerLengthUnit unit) + public ForcePerLength(T value, ForcePerLengthUnit unit) { if(unit == ForcePerLengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -89,14 +84,14 @@ public ForcePerLength(double value, ForcePerLengthUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ForcePerLength(double value, UnitSystem unitSystem) + public ForcePerLength(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -138,7 +133,7 @@ public ForcePerLength(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerMeter. /// - public static ForcePerLength Zero { get; } = new ForcePerLength(0, BaseUnit); + public static ForcePerLength Zero { get; } = new ForcePerLength((T)0, BaseUnit); #endregion @@ -147,7 +142,9 @@ public ForcePerLength(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -177,62 +174,62 @@ public ForcePerLength(double value, UnitSystem unitSystem) /// /// Get in CentinewtonsPerMeter. /// - public double CentinewtonsPerMeter => As(ForcePerLengthUnit.CentinewtonPerMeter); + public T CentinewtonsPerMeter => As(ForcePerLengthUnit.CentinewtonPerMeter); /// /// Get in DecinewtonsPerMeter. /// - public double DecinewtonsPerMeter => As(ForcePerLengthUnit.DecinewtonPerMeter); + public T DecinewtonsPerMeter => As(ForcePerLengthUnit.DecinewtonPerMeter); /// /// Get in KilogramsForcePerMeter. /// - public double KilogramsForcePerMeter => As(ForcePerLengthUnit.KilogramForcePerMeter); + public T KilogramsForcePerMeter => As(ForcePerLengthUnit.KilogramForcePerMeter); /// /// Get in KilonewtonsPerMeter. /// - public double KilonewtonsPerMeter => As(ForcePerLengthUnit.KilonewtonPerMeter); + public T KilonewtonsPerMeter => As(ForcePerLengthUnit.KilonewtonPerMeter); /// /// Get in MeganewtonsPerMeter. /// - public double MeganewtonsPerMeter => As(ForcePerLengthUnit.MeganewtonPerMeter); + public T MeganewtonsPerMeter => As(ForcePerLengthUnit.MeganewtonPerMeter); /// /// Get in MicronewtonsPerMeter. /// - public double MicronewtonsPerMeter => As(ForcePerLengthUnit.MicronewtonPerMeter); + public T MicronewtonsPerMeter => As(ForcePerLengthUnit.MicronewtonPerMeter); /// /// Get in MillinewtonsPerMeter. /// - public double MillinewtonsPerMeter => As(ForcePerLengthUnit.MillinewtonPerMeter); + public T MillinewtonsPerMeter => As(ForcePerLengthUnit.MillinewtonPerMeter); /// /// Get in NanonewtonsPerMeter. /// - public double NanonewtonsPerMeter => As(ForcePerLengthUnit.NanonewtonPerMeter); + public T NanonewtonsPerMeter => As(ForcePerLengthUnit.NanonewtonPerMeter); /// /// Get in NewtonsPerMeter. /// - public double NewtonsPerMeter => As(ForcePerLengthUnit.NewtonPerMeter); + public T NewtonsPerMeter => As(ForcePerLengthUnit.NewtonPerMeter); /// /// Get in PoundsForcePerFoot. /// - public double PoundsForcePerFoot => As(ForcePerLengthUnit.PoundForcePerFoot); + public T PoundsForcePerFoot => As(ForcePerLengthUnit.PoundForcePerFoot); /// /// Get in PoundsForcePerInch. /// - public double PoundsForcePerInch => As(ForcePerLengthUnit.PoundForcePerInch); + public T PoundsForcePerInch => As(ForcePerLengthUnit.PoundForcePerInch); /// /// Get in PoundsForcePerYard. /// - public double PoundsForcePerYard => As(ForcePerLengthUnit.PoundForcePerYard); + public T PoundsForcePerYard => As(ForcePerLengthUnit.PoundForcePerYard); #endregion @@ -267,109 +264,97 @@ public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] IForma /// Get from CentinewtonsPerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromCentinewtonsPerMeter(QuantityValue centinewtonspermeter) + public static ForcePerLength FromCentinewtonsPerMeter(T centinewtonspermeter) { - double value = (double) centinewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.CentinewtonPerMeter); + return new ForcePerLength(centinewtonspermeter, ForcePerLengthUnit.CentinewtonPerMeter); } /// /// Get from DecinewtonsPerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromDecinewtonsPerMeter(QuantityValue decinewtonspermeter) + public static ForcePerLength FromDecinewtonsPerMeter(T decinewtonspermeter) { - double value = (double) decinewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.DecinewtonPerMeter); + return new ForcePerLength(decinewtonspermeter, ForcePerLengthUnit.DecinewtonPerMeter); } /// /// Get from KilogramsForcePerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromKilogramsForcePerMeter(QuantityValue kilogramsforcepermeter) + public static ForcePerLength FromKilogramsForcePerMeter(T kilogramsforcepermeter) { - double value = (double) kilogramsforcepermeter; - return new ForcePerLength(value, ForcePerLengthUnit.KilogramForcePerMeter); + return new ForcePerLength(kilogramsforcepermeter, ForcePerLengthUnit.KilogramForcePerMeter); } /// /// Get from KilonewtonsPerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromKilonewtonsPerMeter(QuantityValue kilonewtonspermeter) + public static ForcePerLength FromKilonewtonsPerMeter(T kilonewtonspermeter) { - double value = (double) kilonewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.KilonewtonPerMeter); + return new ForcePerLength(kilonewtonspermeter, ForcePerLengthUnit.KilonewtonPerMeter); } /// /// Get from MeganewtonsPerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromMeganewtonsPerMeter(QuantityValue meganewtonspermeter) + public static ForcePerLength FromMeganewtonsPerMeter(T meganewtonspermeter) { - double value = (double) meganewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.MeganewtonPerMeter); + return new ForcePerLength(meganewtonspermeter, ForcePerLengthUnit.MeganewtonPerMeter); } /// /// Get from MicronewtonsPerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromMicronewtonsPerMeter(QuantityValue micronewtonspermeter) + public static ForcePerLength FromMicronewtonsPerMeter(T micronewtonspermeter) { - double value = (double) micronewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.MicronewtonPerMeter); + return new ForcePerLength(micronewtonspermeter, ForcePerLengthUnit.MicronewtonPerMeter); } /// /// Get from MillinewtonsPerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromMillinewtonsPerMeter(QuantityValue millinewtonspermeter) + public static ForcePerLength FromMillinewtonsPerMeter(T millinewtonspermeter) { - double value = (double) millinewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.MillinewtonPerMeter); + return new ForcePerLength(millinewtonspermeter, ForcePerLengthUnit.MillinewtonPerMeter); } /// /// Get from NanonewtonsPerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromNanonewtonsPerMeter(QuantityValue nanonewtonspermeter) + public static ForcePerLength FromNanonewtonsPerMeter(T nanonewtonspermeter) { - double value = (double) nanonewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.NanonewtonPerMeter); + return new ForcePerLength(nanonewtonspermeter, ForcePerLengthUnit.NanonewtonPerMeter); } /// /// Get from NewtonsPerMeter. /// /// If value is NaN or Infinity. - public static ForcePerLength FromNewtonsPerMeter(QuantityValue newtonspermeter) + public static ForcePerLength FromNewtonsPerMeter(T newtonspermeter) { - double value = (double) newtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.NewtonPerMeter); + return new ForcePerLength(newtonspermeter, ForcePerLengthUnit.NewtonPerMeter); } /// /// Get from PoundsForcePerFoot. /// /// If value is NaN or Infinity. - public static ForcePerLength FromPoundsForcePerFoot(QuantityValue poundsforceperfoot) + public static ForcePerLength FromPoundsForcePerFoot(T poundsforceperfoot) { - double value = (double) poundsforceperfoot; - return new ForcePerLength(value, ForcePerLengthUnit.PoundForcePerFoot); + return new ForcePerLength(poundsforceperfoot, ForcePerLengthUnit.PoundForcePerFoot); } /// /// Get from PoundsForcePerInch. /// /// If value is NaN or Infinity. - public static ForcePerLength FromPoundsForcePerInch(QuantityValue poundsforceperinch) + public static ForcePerLength FromPoundsForcePerInch(T poundsforceperinch) { - double value = (double) poundsforceperinch; - return new ForcePerLength(value, ForcePerLengthUnit.PoundForcePerInch); + return new ForcePerLength(poundsforceperinch, ForcePerLengthUnit.PoundForcePerInch); } /// /// Get from PoundsForcePerYard. /// /// If value is NaN or Infinity. - public static ForcePerLength FromPoundsForcePerYard(QuantityValue poundsforceperyard) + public static ForcePerLength FromPoundsForcePerYard(T poundsforceperyard) { - double value = (double) poundsforceperyard; - return new ForcePerLength(value, ForcePerLengthUnit.PoundForcePerYard); + return new ForcePerLength(poundsforceperyard, ForcePerLengthUnit.PoundForcePerYard); } /// @@ -378,9 +363,9 @@ public static ForcePerLength FromPoundsForcePerYard(QuantityValue poundsforce /// Value to convert from. /// Unit to convert from. /// unit value. - public static ForcePerLength From(QuantityValue value, ForcePerLengthUnit fromUnit) + public static ForcePerLength From(T value, ForcePerLengthUnit fromUnit) { - return new ForcePerLength((double)value, fromUnit); + return new ForcePerLength(value, fromUnit); } #endregion @@ -534,43 +519,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceP /// Negate the value. public static ForcePerLength operator -(ForcePerLength right) { - return new ForcePerLength(-right.Value, right.Unit); + return new ForcePerLength(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ForcePerLength operator +(ForcePerLength left, ForcePerLength right) { - return new ForcePerLength(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ForcePerLength(value, left.Unit); } /// Get from subtracting two . public static ForcePerLength operator -(ForcePerLength left, ForcePerLength right) { - return new ForcePerLength(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ForcePerLength(value, left.Unit); } /// Get from multiplying value and . - public static ForcePerLength operator *(double left, ForcePerLength right) + public static ForcePerLength operator *(T left, ForcePerLength right) { - return new ForcePerLength(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ForcePerLength(value, right.Unit); } /// Get from multiplying value and . - public static ForcePerLength operator *(ForcePerLength left, double right) + public static ForcePerLength operator *(ForcePerLength left, T right) { - return new ForcePerLength(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ForcePerLength(value, left.Unit); } /// Get from dividing by value. - public static ForcePerLength operator /(ForcePerLength left, double right) + public static ForcePerLength operator /(ForcePerLength left, T right) { - return new ForcePerLength(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ForcePerLength(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ForcePerLength left, ForcePerLength right) + public static T operator /(ForcePerLength left, ForcePerLength right) { - return left.NewtonsPerMeter / right.NewtonsPerMeter; + return CompiledLambdas.Divide(left.NewtonsPerMeter, right.NewtonsPerMeter); } #endregion @@ -580,25 +570,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceP /// Returns true if less or equal to. public static bool operator <=(ForcePerLength left, ForcePerLength right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ForcePerLength left, ForcePerLength right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ForcePerLength left, ForcePerLength right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ForcePerLength left, ForcePerLength right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -627,7 +617,7 @@ public int CompareTo(object obj) /// public int CompareTo(ForcePerLength other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -644,7 +634,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ForcePerLength other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -692,10 +682,8 @@ public bool Equals(ForcePerLength other, double tolerance, ComparisonType com if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -715,17 +703,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ForcePerLengthUnit unit) + public T As(ForcePerLengthUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -745,9 +733,14 @@ double IQuantity.As(Enum unit) if(!(unit is ForcePerLengthUnit unitAsForcePerLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForcePerLengthUnit)} is supported.", nameof(unit)); - return As(unitAsForcePerLengthUnit); + var asValue = As(unitAsForcePerLengthUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ForcePerLengthUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -788,30 +781,36 @@ public ForcePerLength ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ForcePerLengthUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ForcePerLengthUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ForcePerLengthUnit.CentinewtonPerMeter: return (_value) * 1e-2d; - case ForcePerLengthUnit.DecinewtonPerMeter: return (_value) * 1e-1d; - case ForcePerLengthUnit.KilogramForcePerMeter: return _value*9.80665002864; - case ForcePerLengthUnit.KilonewtonPerMeter: return (_value) * 1e3d; - case ForcePerLengthUnit.MeganewtonPerMeter: return (_value) * 1e6d; - case ForcePerLengthUnit.MicronewtonPerMeter: return (_value) * 1e-6d; - case ForcePerLengthUnit.MillinewtonPerMeter: return (_value) * 1e-3d; - case ForcePerLengthUnit.NanonewtonPerMeter: return (_value) * 1e-9d; - case ForcePerLengthUnit.NewtonPerMeter: return _value; - case ForcePerLengthUnit.PoundForcePerFoot: return _value*14.59390292; - case ForcePerLengthUnit.PoundForcePerInch: return _value*1.75126835e2; - case ForcePerLengthUnit.PoundForcePerYard: return _value*4.864634307; + case ForcePerLengthUnit.CentinewtonPerMeter: return (Value) * 1e-2d; + case ForcePerLengthUnit.DecinewtonPerMeter: return (Value) * 1e-1d; + case ForcePerLengthUnit.KilogramForcePerMeter: return Value*9.80665002864; + case ForcePerLengthUnit.KilonewtonPerMeter: return (Value) * 1e3d; + case ForcePerLengthUnit.MeganewtonPerMeter: return (Value) * 1e6d; + case ForcePerLengthUnit.MicronewtonPerMeter: return (Value) * 1e-6d; + case ForcePerLengthUnit.MillinewtonPerMeter: return (Value) * 1e-3d; + case ForcePerLengthUnit.NanonewtonPerMeter: return (Value) * 1e-9d; + case ForcePerLengthUnit.NewtonPerMeter: return Value; + case ForcePerLengthUnit.PoundForcePerFoot: return Value*14.59390292; + case ForcePerLengthUnit.PoundForcePerInch: return Value*1.75126835e2; + case ForcePerLengthUnit.PoundForcePerYard: return Value*4.864634307; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -828,10 +827,10 @@ internal ForcePerLength ToBaseUnit() return new ForcePerLength(baseUnitValue, BaseUnit); } - private double GetValueAs(ForcePerLengthUnit unit) + private T GetValueAs(ForcePerLengthUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -950,7 +949,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -965,37 +964,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1019,17 +1018,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs index a5fe2621bf..d64c03ad2b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// The number of occurrences of a repeating event per unit time. /// - public partial struct Frequency : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Frequency : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -69,12 +64,12 @@ static Frequency() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Frequency(double value, FrequencyUnit unit) + public Frequency(T value, FrequencyUnit unit) { if(unit == FrequencyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -86,14 +81,14 @@ public Frequency(double value, FrequencyUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Frequency(double value, UnitSystem unitSystem) + public Frequency(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -135,7 +130,7 @@ public Frequency(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Hertz. /// - public static Frequency Zero { get; } = new Frequency(0, BaseUnit); + public static Frequency Zero { get; } = new Frequency((T)0, BaseUnit); #endregion @@ -144,7 +139,9 @@ public Frequency(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -174,47 +171,47 @@ public Frequency(double value, UnitSystem unitSystem) /// /// Get in BeatsPerMinute. /// - public double BeatsPerMinute => As(FrequencyUnit.BeatPerMinute); + public T BeatsPerMinute => As(FrequencyUnit.BeatPerMinute); /// /// Get in CyclesPerHour. /// - public double CyclesPerHour => As(FrequencyUnit.CyclePerHour); + public T CyclesPerHour => As(FrequencyUnit.CyclePerHour); /// /// Get in CyclesPerMinute. /// - public double CyclesPerMinute => As(FrequencyUnit.CyclePerMinute); + public T CyclesPerMinute => As(FrequencyUnit.CyclePerMinute); /// /// Get in Gigahertz. /// - public double Gigahertz => As(FrequencyUnit.Gigahertz); + public T Gigahertz => As(FrequencyUnit.Gigahertz); /// /// Get in Hertz. /// - public double Hertz => As(FrequencyUnit.Hertz); + public T Hertz => As(FrequencyUnit.Hertz); /// /// Get in Kilohertz. /// - public double Kilohertz => As(FrequencyUnit.Kilohertz); + public T Kilohertz => As(FrequencyUnit.Kilohertz); /// /// Get in Megahertz. /// - public double Megahertz => As(FrequencyUnit.Megahertz); + public T Megahertz => As(FrequencyUnit.Megahertz); /// /// Get in RadiansPerSecond. /// - public double RadiansPerSecond => As(FrequencyUnit.RadianPerSecond); + public T RadiansPerSecond => As(FrequencyUnit.RadianPerSecond); /// /// Get in Terahertz. /// - public double Terahertz => As(FrequencyUnit.Terahertz); + public T Terahertz => As(FrequencyUnit.Terahertz); #endregion @@ -249,82 +246,73 @@ public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] IFormatProv /// Get from BeatsPerMinute. /// /// If value is NaN or Infinity. - public static Frequency FromBeatsPerMinute(QuantityValue beatsperminute) + public static Frequency FromBeatsPerMinute(T beatsperminute) { - double value = (double) beatsperminute; - return new Frequency(value, FrequencyUnit.BeatPerMinute); + return new Frequency(beatsperminute, FrequencyUnit.BeatPerMinute); } /// /// Get from CyclesPerHour. /// /// If value is NaN or Infinity. - public static Frequency FromCyclesPerHour(QuantityValue cyclesperhour) + public static Frequency FromCyclesPerHour(T cyclesperhour) { - double value = (double) cyclesperhour; - return new Frequency(value, FrequencyUnit.CyclePerHour); + return new Frequency(cyclesperhour, FrequencyUnit.CyclePerHour); } /// /// Get from CyclesPerMinute. /// /// If value is NaN or Infinity. - public static Frequency FromCyclesPerMinute(QuantityValue cyclesperminute) + public static Frequency FromCyclesPerMinute(T cyclesperminute) { - double value = (double) cyclesperminute; - return new Frequency(value, FrequencyUnit.CyclePerMinute); + return new Frequency(cyclesperminute, FrequencyUnit.CyclePerMinute); } /// /// Get from Gigahertz. /// /// If value is NaN or Infinity. - public static Frequency FromGigahertz(QuantityValue gigahertz) + public static Frequency FromGigahertz(T gigahertz) { - double value = (double) gigahertz; - return new Frequency(value, FrequencyUnit.Gigahertz); + return new Frequency(gigahertz, FrequencyUnit.Gigahertz); } /// /// Get from Hertz. /// /// If value is NaN or Infinity. - public static Frequency FromHertz(QuantityValue hertz) + public static Frequency FromHertz(T hertz) { - double value = (double) hertz; - return new Frequency(value, FrequencyUnit.Hertz); + return new Frequency(hertz, FrequencyUnit.Hertz); } /// /// Get from Kilohertz. /// /// If value is NaN or Infinity. - public static Frequency FromKilohertz(QuantityValue kilohertz) + public static Frequency FromKilohertz(T kilohertz) { - double value = (double) kilohertz; - return new Frequency(value, FrequencyUnit.Kilohertz); + return new Frequency(kilohertz, FrequencyUnit.Kilohertz); } /// /// Get from Megahertz. /// /// If value is NaN or Infinity. - public static Frequency FromMegahertz(QuantityValue megahertz) + public static Frequency FromMegahertz(T megahertz) { - double value = (double) megahertz; - return new Frequency(value, FrequencyUnit.Megahertz); + return new Frequency(megahertz, FrequencyUnit.Megahertz); } /// /// Get from RadiansPerSecond. /// /// If value is NaN or Infinity. - public static Frequency FromRadiansPerSecond(QuantityValue radianspersecond) + public static Frequency FromRadiansPerSecond(T radianspersecond) { - double value = (double) radianspersecond; - return new Frequency(value, FrequencyUnit.RadianPerSecond); + return new Frequency(radianspersecond, FrequencyUnit.RadianPerSecond); } /// /// Get from Terahertz. /// /// If value is NaN or Infinity. - public static Frequency FromTerahertz(QuantityValue terahertz) + public static Frequency FromTerahertz(T terahertz) { - double value = (double) terahertz; - return new Frequency(value, FrequencyUnit.Terahertz); + return new Frequency(terahertz, FrequencyUnit.Terahertz); } /// @@ -333,9 +321,9 @@ public static Frequency FromTerahertz(QuantityValue terahertz) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Frequency From(QuantityValue value, FrequencyUnit fromUnit) + public static Frequency From(T value, FrequencyUnit fromUnit) { - return new Frequency((double)value, fromUnit); + return new Frequency(value, fromUnit); } #endregion @@ -489,43 +477,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Freque /// Negate the value. public static Frequency operator -(Frequency right) { - return new Frequency(-right.Value, right.Unit); + return new Frequency(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Frequency operator +(Frequency left, Frequency right) { - return new Frequency(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Frequency(value, left.Unit); } /// Get from subtracting two . public static Frequency operator -(Frequency left, Frequency right) { - return new Frequency(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Frequency(value, left.Unit); } /// Get from multiplying value and . - public static Frequency operator *(double left, Frequency right) + public static Frequency operator *(T left, Frequency right) { - return new Frequency(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Frequency(value, right.Unit); } /// Get from multiplying value and . - public static Frequency operator *(Frequency left, double right) + public static Frequency operator *(Frequency left, T right) { - return new Frequency(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Frequency(value, left.Unit); } /// Get from dividing by value. - public static Frequency operator /(Frequency left, double right) + public static Frequency operator /(Frequency left, T right) { - return new Frequency(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Frequency(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Frequency left, Frequency right) + public static T operator /(Frequency left, Frequency right) { - return left.Hertz / right.Hertz; + return CompiledLambdas.Divide(left.Hertz, right.Hertz); } #endregion @@ -535,25 +528,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Freque /// Returns true if less or equal to. public static bool operator <=(Frequency left, Frequency right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Frequency left, Frequency right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Frequency left, Frequency right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Frequency left, Frequency right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -582,7 +575,7 @@ public int CompareTo(object obj) /// public int CompareTo(Frequency other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -599,7 +592,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Frequency other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -647,10 +640,8 @@ public bool Equals(Frequency other, double tolerance, ComparisonType comparis if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -670,17 +661,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(FrequencyUnit unit) + public T As(FrequencyUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -700,9 +691,14 @@ double IQuantity.As(Enum unit) if(!(unit is FrequencyUnit unitAsFrequencyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(FrequencyUnit)} is supported.", nameof(unit)); - return As(unitAsFrequencyUnit); + var asValue = As(unitAsFrequencyUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(FrequencyUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -743,27 +739,33 @@ public Frequency ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(FrequencyUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(FrequencyUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case FrequencyUnit.BeatPerMinute: return _value/60; - case FrequencyUnit.CyclePerHour: return _value/3600; - case FrequencyUnit.CyclePerMinute: return _value/60; - case FrequencyUnit.Gigahertz: return (_value) * 1e9d; - case FrequencyUnit.Hertz: return _value; - case FrequencyUnit.Kilohertz: return (_value) * 1e3d; - case FrequencyUnit.Megahertz: return (_value) * 1e6d; - case FrequencyUnit.RadianPerSecond: return _value/6.2831853072; - case FrequencyUnit.Terahertz: return (_value) * 1e12d; + case FrequencyUnit.BeatPerMinute: return Value/60; + case FrequencyUnit.CyclePerHour: return Value/3600; + case FrequencyUnit.CyclePerMinute: return Value/60; + case FrequencyUnit.Gigahertz: return (Value) * 1e9d; + case FrequencyUnit.Hertz: return Value; + case FrequencyUnit.Kilohertz: return (Value) * 1e3d; + case FrequencyUnit.Megahertz: return (Value) * 1e6d; + case FrequencyUnit.RadianPerSecond: return Value/6.2831853072; + case FrequencyUnit.Terahertz: return (Value) * 1e12d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -780,10 +782,10 @@ internal Frequency ToBaseUnit() return new Frequency(baseUnitValue, BaseUnit); } - private double GetValueAs(FrequencyUnit unit) + private T GetValueAs(FrequencyUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -899,7 +901,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -914,37 +916,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -968,17 +970,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs index 649d5f5db6..00e5617699 100644 --- a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Fuel_efficiency /// - public partial struct FuelEfficiency : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct FuelEfficiency : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -67,12 +62,12 @@ static FuelEfficiency() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public FuelEfficiency(double value, FuelEfficiencyUnit unit) + public FuelEfficiency(T value, FuelEfficiencyUnit unit) { if(unit == FuelEfficiencyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -84,14 +79,14 @@ public FuelEfficiency(double value, FuelEfficiencyUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public FuelEfficiency(double value, UnitSystem unitSystem) + public FuelEfficiency(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -133,7 +128,7 @@ public FuelEfficiency(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit LiterPer100Kilometers. /// - public static FuelEfficiency Zero { get; } = new FuelEfficiency(0, BaseUnit); + public static FuelEfficiency Zero { get; } = new FuelEfficiency((T)0, BaseUnit); #endregion @@ -142,7 +137,9 @@ public FuelEfficiency(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -172,22 +169,22 @@ public FuelEfficiency(double value, UnitSystem unitSystem) /// /// Get in KilometersPerLiters. /// - public double KilometersPerLiters => As(FuelEfficiencyUnit.KilometerPerLiter); + public T KilometersPerLiters => As(FuelEfficiencyUnit.KilometerPerLiter); /// /// Get in LitersPer100Kilometers. /// - public double LitersPer100Kilometers => As(FuelEfficiencyUnit.LiterPer100Kilometers); + public T LitersPer100Kilometers => As(FuelEfficiencyUnit.LiterPer100Kilometers); /// /// Get in MilesPerUkGallon. /// - public double MilesPerUkGallon => As(FuelEfficiencyUnit.MilePerUkGallon); + public T MilesPerUkGallon => As(FuelEfficiencyUnit.MilePerUkGallon); /// /// Get in MilesPerUsGallon. /// - public double MilesPerUsGallon => As(FuelEfficiencyUnit.MilePerUsGallon); + public T MilesPerUsGallon => As(FuelEfficiencyUnit.MilePerUsGallon); #endregion @@ -222,37 +219,33 @@ public static string GetAbbreviation(FuelEfficiencyUnit unit, [CanBeNull] IForma /// Get from KilometersPerLiters. /// /// If value is NaN or Infinity. - public static FuelEfficiency FromKilometersPerLiters(QuantityValue kilometersperliters) + public static FuelEfficiency FromKilometersPerLiters(T kilometersperliters) { - double value = (double) kilometersperliters; - return new FuelEfficiency(value, FuelEfficiencyUnit.KilometerPerLiter); + return new FuelEfficiency(kilometersperliters, FuelEfficiencyUnit.KilometerPerLiter); } /// /// Get from LitersPer100Kilometers. /// /// If value is NaN or Infinity. - public static FuelEfficiency FromLitersPer100Kilometers(QuantityValue litersper100kilometers) + public static FuelEfficiency FromLitersPer100Kilometers(T litersper100kilometers) { - double value = (double) litersper100kilometers; - return new FuelEfficiency(value, FuelEfficiencyUnit.LiterPer100Kilometers); + return new FuelEfficiency(litersper100kilometers, FuelEfficiencyUnit.LiterPer100Kilometers); } /// /// Get from MilesPerUkGallon. /// /// If value is NaN or Infinity. - public static FuelEfficiency FromMilesPerUkGallon(QuantityValue milesperukgallon) + public static FuelEfficiency FromMilesPerUkGallon(T milesperukgallon) { - double value = (double) milesperukgallon; - return new FuelEfficiency(value, FuelEfficiencyUnit.MilePerUkGallon); + return new FuelEfficiency(milesperukgallon, FuelEfficiencyUnit.MilePerUkGallon); } /// /// Get from MilesPerUsGallon. /// /// If value is NaN or Infinity. - public static FuelEfficiency FromMilesPerUsGallon(QuantityValue milesperusgallon) + public static FuelEfficiency FromMilesPerUsGallon(T milesperusgallon) { - double value = (double) milesperusgallon; - return new FuelEfficiency(value, FuelEfficiencyUnit.MilePerUsGallon); + return new FuelEfficiency(milesperusgallon, FuelEfficiencyUnit.MilePerUsGallon); } /// @@ -261,9 +254,9 @@ public static FuelEfficiency FromMilesPerUsGallon(QuantityValue milesperusgal /// Value to convert from. /// Unit to convert from. /// unit value. - public static FuelEfficiency From(QuantityValue value, FuelEfficiencyUnit fromUnit) + public static FuelEfficiency From(T value, FuelEfficiencyUnit fromUnit) { - return new FuelEfficiency((double)value, fromUnit); + return new FuelEfficiency(value, fromUnit); } #endregion @@ -417,43 +410,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out FuelEf /// Negate the value. public static FuelEfficiency operator -(FuelEfficiency right) { - return new FuelEfficiency(-right.Value, right.Unit); + return new FuelEfficiency(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static FuelEfficiency operator +(FuelEfficiency left, FuelEfficiency right) { - return new FuelEfficiency(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new FuelEfficiency(value, left.Unit); } /// Get from subtracting two . public static FuelEfficiency operator -(FuelEfficiency left, FuelEfficiency right) { - return new FuelEfficiency(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new FuelEfficiency(value, left.Unit); } /// Get from multiplying value and . - public static FuelEfficiency operator *(double left, FuelEfficiency right) + public static FuelEfficiency operator *(T left, FuelEfficiency right) { - return new FuelEfficiency(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new FuelEfficiency(value, right.Unit); } /// Get from multiplying value and . - public static FuelEfficiency operator *(FuelEfficiency left, double right) + public static FuelEfficiency operator *(FuelEfficiency left, T right) { - return new FuelEfficiency(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new FuelEfficiency(value, left.Unit); } /// Get from dividing by value. - public static FuelEfficiency operator /(FuelEfficiency left, double right) + public static FuelEfficiency operator /(FuelEfficiency left, T right) { - return new FuelEfficiency(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new FuelEfficiency(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(FuelEfficiency left, FuelEfficiency right) + public static T operator /(FuelEfficiency left, FuelEfficiency right) { - return left.LitersPer100Kilometers / right.LitersPer100Kilometers; + return CompiledLambdas.Divide(left.LitersPer100Kilometers, right.LitersPer100Kilometers); } #endregion @@ -463,25 +461,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out FuelEf /// Returns true if less or equal to. public static bool operator <=(FuelEfficiency left, FuelEfficiency right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(FuelEfficiency left, FuelEfficiency right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(FuelEfficiency left, FuelEfficiency right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(FuelEfficiency left, FuelEfficiency right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -510,7 +508,7 @@ public int CompareTo(object obj) /// public int CompareTo(FuelEfficiency other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -527,7 +525,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(FuelEfficiency other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -575,10 +573,8 @@ public bool Equals(FuelEfficiency other, double tolerance, ComparisonType com if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -598,17 +594,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(FuelEfficiencyUnit unit) + public T As(FuelEfficiencyUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -628,9 +624,14 @@ double IQuantity.As(Enum unit) if(!(unit is FuelEfficiencyUnit unitAsFuelEfficiencyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(FuelEfficiencyUnit)} is supported.", nameof(unit)); - return As(unitAsFuelEfficiencyUnit); + var asValue = As(unitAsFuelEfficiencyUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(FuelEfficiencyUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -671,22 +672,28 @@ public FuelEfficiency ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(FuelEfficiencyUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(FuelEfficiencyUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case FuelEfficiencyUnit.KilometerPerLiter: return 100/_value; - case FuelEfficiencyUnit.LiterPer100Kilometers: return _value; - case FuelEfficiencyUnit.MilePerUkGallon: return (100*4.54609188)/(1.609344*_value); - case FuelEfficiencyUnit.MilePerUsGallon: return (100*3.785411784)/(1.609344*_value); + case FuelEfficiencyUnit.KilometerPerLiter: return 100/Value; + case FuelEfficiencyUnit.LiterPer100Kilometers: return Value; + case FuelEfficiencyUnit.MilePerUkGallon: return (100*4.54609188)/(1.609344*Value); + case FuelEfficiencyUnit.MilePerUsGallon: return (100*3.785411784)/(1.609344*Value); default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -703,10 +710,10 @@ internal FuelEfficiency ToBaseUnit() return new FuelEfficiency(baseUnitValue, BaseUnit); } - private double GetValueAs(FuelEfficiencyUnit unit) + private T GetValueAs(FuelEfficiencyUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -817,7 +824,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -832,37 +839,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -886,17 +893,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs index 829f84addf..be33484ba0 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Heat flux is the flow of energy per unit of area per unit of time /// - public partial struct HeatFlux : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct HeatFlux : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -78,12 +73,12 @@ static HeatFlux() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public HeatFlux(double value, HeatFluxUnit unit) + public HeatFlux(T value, HeatFluxUnit unit) { if(unit == HeatFluxUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -95,14 +90,14 @@ public HeatFlux(double value, HeatFluxUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public HeatFlux(double value, UnitSystem unitSystem) + public HeatFlux(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -144,7 +139,7 @@ public HeatFlux(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeter. /// - public static HeatFlux Zero { get; } = new HeatFlux(0, BaseUnit); + public static HeatFlux Zero { get; } = new HeatFlux((T)0, BaseUnit); #endregion @@ -153,7 +148,9 @@ public HeatFlux(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -183,92 +180,92 @@ public HeatFlux(double value, UnitSystem unitSystem) /// /// Get in BtusPerHourSquareFoot. /// - public double BtusPerHourSquareFoot => As(HeatFluxUnit.BtuPerHourSquareFoot); + public T BtusPerHourSquareFoot => As(HeatFluxUnit.BtuPerHourSquareFoot); /// /// Get in BtusPerMinuteSquareFoot. /// - public double BtusPerMinuteSquareFoot => As(HeatFluxUnit.BtuPerMinuteSquareFoot); + public T BtusPerMinuteSquareFoot => As(HeatFluxUnit.BtuPerMinuteSquareFoot); /// /// Get in BtusPerSecondSquareFoot. /// - public double BtusPerSecondSquareFoot => As(HeatFluxUnit.BtuPerSecondSquareFoot); + public T BtusPerSecondSquareFoot => As(HeatFluxUnit.BtuPerSecondSquareFoot); /// /// Get in BtusPerSecondSquareInch. /// - public double BtusPerSecondSquareInch => As(HeatFluxUnit.BtuPerSecondSquareInch); + public T BtusPerSecondSquareInch => As(HeatFluxUnit.BtuPerSecondSquareInch); /// /// Get in CaloriesPerSecondSquareCentimeter. /// - public double CaloriesPerSecondSquareCentimeter => As(HeatFluxUnit.CaloriePerSecondSquareCentimeter); + public T CaloriesPerSecondSquareCentimeter => As(HeatFluxUnit.CaloriePerSecondSquareCentimeter); /// /// Get in CentiwattsPerSquareMeter. /// - public double CentiwattsPerSquareMeter => As(HeatFluxUnit.CentiwattPerSquareMeter); + public T CentiwattsPerSquareMeter => As(HeatFluxUnit.CentiwattPerSquareMeter); /// /// Get in DeciwattsPerSquareMeter. /// - public double DeciwattsPerSquareMeter => As(HeatFluxUnit.DeciwattPerSquareMeter); + public T DeciwattsPerSquareMeter => As(HeatFluxUnit.DeciwattPerSquareMeter); /// /// Get in KilocaloriesPerHourSquareMeter. /// - public double KilocaloriesPerHourSquareMeter => As(HeatFluxUnit.KilocaloriePerHourSquareMeter); + public T KilocaloriesPerHourSquareMeter => As(HeatFluxUnit.KilocaloriePerHourSquareMeter); /// /// Get in KilocaloriesPerSecondSquareCentimeter. /// - public double KilocaloriesPerSecondSquareCentimeter => As(HeatFluxUnit.KilocaloriePerSecondSquareCentimeter); + public T KilocaloriesPerSecondSquareCentimeter => As(HeatFluxUnit.KilocaloriePerSecondSquareCentimeter); /// /// Get in KilowattsPerSquareMeter. /// - public double KilowattsPerSquareMeter => As(HeatFluxUnit.KilowattPerSquareMeter); + public T KilowattsPerSquareMeter => As(HeatFluxUnit.KilowattPerSquareMeter); /// /// Get in MicrowattsPerSquareMeter. /// - public double MicrowattsPerSquareMeter => As(HeatFluxUnit.MicrowattPerSquareMeter); + public T MicrowattsPerSquareMeter => As(HeatFluxUnit.MicrowattPerSquareMeter); /// /// Get in MilliwattsPerSquareMeter. /// - public double MilliwattsPerSquareMeter => As(HeatFluxUnit.MilliwattPerSquareMeter); + public T MilliwattsPerSquareMeter => As(HeatFluxUnit.MilliwattPerSquareMeter); /// /// Get in NanowattsPerSquareMeter. /// - public double NanowattsPerSquareMeter => As(HeatFluxUnit.NanowattPerSquareMeter); + public T NanowattsPerSquareMeter => As(HeatFluxUnit.NanowattPerSquareMeter); /// /// Get in PoundsForcePerFootSecond. /// - public double PoundsForcePerFootSecond => As(HeatFluxUnit.PoundForcePerFootSecond); + public T PoundsForcePerFootSecond => As(HeatFluxUnit.PoundForcePerFootSecond); /// /// Get in PoundsPerSecondCubed. /// - public double PoundsPerSecondCubed => As(HeatFluxUnit.PoundPerSecondCubed); + public T PoundsPerSecondCubed => As(HeatFluxUnit.PoundPerSecondCubed); /// /// Get in WattsPerSquareFoot. /// - public double WattsPerSquareFoot => As(HeatFluxUnit.WattPerSquareFoot); + public T WattsPerSquareFoot => As(HeatFluxUnit.WattPerSquareFoot); /// /// Get in WattsPerSquareInch. /// - public double WattsPerSquareInch => As(HeatFluxUnit.WattPerSquareInch); + public T WattsPerSquareInch => As(HeatFluxUnit.WattPerSquareInch); /// /// Get in WattsPerSquareMeter. /// - public double WattsPerSquareMeter => As(HeatFluxUnit.WattPerSquareMeter); + public T WattsPerSquareMeter => As(HeatFluxUnit.WattPerSquareMeter); #endregion @@ -303,163 +300,145 @@ public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] IFormatProvi /// Get from BtusPerHourSquareFoot. /// /// If value is NaN or Infinity. - public static HeatFlux FromBtusPerHourSquareFoot(QuantityValue btusperhoursquarefoot) + public static HeatFlux FromBtusPerHourSquareFoot(T btusperhoursquarefoot) { - double value = (double) btusperhoursquarefoot; - return new HeatFlux(value, HeatFluxUnit.BtuPerHourSquareFoot); + return new HeatFlux(btusperhoursquarefoot, HeatFluxUnit.BtuPerHourSquareFoot); } /// /// Get from BtusPerMinuteSquareFoot. /// /// If value is NaN or Infinity. - public static HeatFlux FromBtusPerMinuteSquareFoot(QuantityValue btusperminutesquarefoot) + public static HeatFlux FromBtusPerMinuteSquareFoot(T btusperminutesquarefoot) { - double value = (double) btusperminutesquarefoot; - return new HeatFlux(value, HeatFluxUnit.BtuPerMinuteSquareFoot); + return new HeatFlux(btusperminutesquarefoot, HeatFluxUnit.BtuPerMinuteSquareFoot); } /// /// Get from BtusPerSecondSquareFoot. /// /// If value is NaN or Infinity. - public static HeatFlux FromBtusPerSecondSquareFoot(QuantityValue btuspersecondsquarefoot) + public static HeatFlux FromBtusPerSecondSquareFoot(T btuspersecondsquarefoot) { - double value = (double) btuspersecondsquarefoot; - return new HeatFlux(value, HeatFluxUnit.BtuPerSecondSquareFoot); + return new HeatFlux(btuspersecondsquarefoot, HeatFluxUnit.BtuPerSecondSquareFoot); } /// /// Get from BtusPerSecondSquareInch. /// /// If value is NaN or Infinity. - public static HeatFlux FromBtusPerSecondSquareInch(QuantityValue btuspersecondsquareinch) + public static HeatFlux FromBtusPerSecondSquareInch(T btuspersecondsquareinch) { - double value = (double) btuspersecondsquareinch; - return new HeatFlux(value, HeatFluxUnit.BtuPerSecondSquareInch); + return new HeatFlux(btuspersecondsquareinch, HeatFluxUnit.BtuPerSecondSquareInch); } /// /// Get from CaloriesPerSecondSquareCentimeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromCaloriesPerSecondSquareCentimeter(QuantityValue caloriespersecondsquarecentimeter) + public static HeatFlux FromCaloriesPerSecondSquareCentimeter(T caloriespersecondsquarecentimeter) { - double value = (double) caloriespersecondsquarecentimeter; - return new HeatFlux(value, HeatFluxUnit.CaloriePerSecondSquareCentimeter); + return new HeatFlux(caloriespersecondsquarecentimeter, HeatFluxUnit.CaloriePerSecondSquareCentimeter); } /// /// Get from CentiwattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromCentiwattsPerSquareMeter(QuantityValue centiwattspersquaremeter) + public static HeatFlux FromCentiwattsPerSquareMeter(T centiwattspersquaremeter) { - double value = (double) centiwattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.CentiwattPerSquareMeter); + return new HeatFlux(centiwattspersquaremeter, HeatFluxUnit.CentiwattPerSquareMeter); } /// /// Get from DeciwattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromDeciwattsPerSquareMeter(QuantityValue deciwattspersquaremeter) + public static HeatFlux FromDeciwattsPerSquareMeter(T deciwattspersquaremeter) { - double value = (double) deciwattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.DeciwattPerSquareMeter); + return new HeatFlux(deciwattspersquaremeter, HeatFluxUnit.DeciwattPerSquareMeter); } /// /// Get from KilocaloriesPerHourSquareMeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromKilocaloriesPerHourSquareMeter(QuantityValue kilocaloriesperhoursquaremeter) + public static HeatFlux FromKilocaloriesPerHourSquareMeter(T kilocaloriesperhoursquaremeter) { - double value = (double) kilocaloriesperhoursquaremeter; - return new HeatFlux(value, HeatFluxUnit.KilocaloriePerHourSquareMeter); + return new HeatFlux(kilocaloriesperhoursquaremeter, HeatFluxUnit.KilocaloriePerHourSquareMeter); } /// /// Get from KilocaloriesPerSecondSquareCentimeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromKilocaloriesPerSecondSquareCentimeter(QuantityValue kilocaloriespersecondsquarecentimeter) + public static HeatFlux FromKilocaloriesPerSecondSquareCentimeter(T kilocaloriespersecondsquarecentimeter) { - double value = (double) kilocaloriespersecondsquarecentimeter; - return new HeatFlux(value, HeatFluxUnit.KilocaloriePerSecondSquareCentimeter); + return new HeatFlux(kilocaloriespersecondsquarecentimeter, HeatFluxUnit.KilocaloriePerSecondSquareCentimeter); } /// /// Get from KilowattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromKilowattsPerSquareMeter(QuantityValue kilowattspersquaremeter) + public static HeatFlux FromKilowattsPerSquareMeter(T kilowattspersquaremeter) { - double value = (double) kilowattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.KilowattPerSquareMeter); + return new HeatFlux(kilowattspersquaremeter, HeatFluxUnit.KilowattPerSquareMeter); } /// /// Get from MicrowattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromMicrowattsPerSquareMeter(QuantityValue microwattspersquaremeter) + public static HeatFlux FromMicrowattsPerSquareMeter(T microwattspersquaremeter) { - double value = (double) microwattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.MicrowattPerSquareMeter); + return new HeatFlux(microwattspersquaremeter, HeatFluxUnit.MicrowattPerSquareMeter); } /// /// Get from MilliwattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromMilliwattsPerSquareMeter(QuantityValue milliwattspersquaremeter) + public static HeatFlux FromMilliwattsPerSquareMeter(T milliwattspersquaremeter) { - double value = (double) milliwattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.MilliwattPerSquareMeter); + return new HeatFlux(milliwattspersquaremeter, HeatFluxUnit.MilliwattPerSquareMeter); } /// /// Get from NanowattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromNanowattsPerSquareMeter(QuantityValue nanowattspersquaremeter) + public static HeatFlux FromNanowattsPerSquareMeter(T nanowattspersquaremeter) { - double value = (double) nanowattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.NanowattPerSquareMeter); + return new HeatFlux(nanowattspersquaremeter, HeatFluxUnit.NanowattPerSquareMeter); } /// /// Get from PoundsForcePerFootSecond. /// /// If value is NaN or Infinity. - public static HeatFlux FromPoundsForcePerFootSecond(QuantityValue poundsforceperfootsecond) + public static HeatFlux FromPoundsForcePerFootSecond(T poundsforceperfootsecond) { - double value = (double) poundsforceperfootsecond; - return new HeatFlux(value, HeatFluxUnit.PoundForcePerFootSecond); + return new HeatFlux(poundsforceperfootsecond, HeatFluxUnit.PoundForcePerFootSecond); } /// /// Get from PoundsPerSecondCubed. /// /// If value is NaN or Infinity. - public static HeatFlux FromPoundsPerSecondCubed(QuantityValue poundspersecondcubed) + public static HeatFlux FromPoundsPerSecondCubed(T poundspersecondcubed) { - double value = (double) poundspersecondcubed; - return new HeatFlux(value, HeatFluxUnit.PoundPerSecondCubed); + return new HeatFlux(poundspersecondcubed, HeatFluxUnit.PoundPerSecondCubed); } /// /// Get from WattsPerSquareFoot. /// /// If value is NaN or Infinity. - public static HeatFlux FromWattsPerSquareFoot(QuantityValue wattspersquarefoot) + public static HeatFlux FromWattsPerSquareFoot(T wattspersquarefoot) { - double value = (double) wattspersquarefoot; - return new HeatFlux(value, HeatFluxUnit.WattPerSquareFoot); + return new HeatFlux(wattspersquarefoot, HeatFluxUnit.WattPerSquareFoot); } /// /// Get from WattsPerSquareInch. /// /// If value is NaN or Infinity. - public static HeatFlux FromWattsPerSquareInch(QuantityValue wattspersquareinch) + public static HeatFlux FromWattsPerSquareInch(T wattspersquareinch) { - double value = (double) wattspersquareinch; - return new HeatFlux(value, HeatFluxUnit.WattPerSquareInch); + return new HeatFlux(wattspersquareinch, HeatFluxUnit.WattPerSquareInch); } /// /// Get from WattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static HeatFlux FromWattsPerSquareMeter(QuantityValue wattspersquaremeter) + public static HeatFlux FromWattsPerSquareMeter(T wattspersquaremeter) { - double value = (double) wattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.WattPerSquareMeter); + return new HeatFlux(wattspersquaremeter, HeatFluxUnit.WattPerSquareMeter); } /// @@ -468,9 +447,9 @@ public static HeatFlux FromWattsPerSquareMeter(QuantityValue wattspersquareme /// Value to convert from. /// Unit to convert from. /// unit value. - public static HeatFlux From(QuantityValue value, HeatFluxUnit fromUnit) + public static HeatFlux From(T value, HeatFluxUnit fromUnit) { - return new HeatFlux((double)value, fromUnit); + return new HeatFlux(value, fromUnit); } #endregion @@ -624,43 +603,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out HeatFl /// Negate the value. public static HeatFlux operator -(HeatFlux right) { - return new HeatFlux(-right.Value, right.Unit); + return new HeatFlux(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static HeatFlux operator +(HeatFlux left, HeatFlux right) { - return new HeatFlux(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new HeatFlux(value, left.Unit); } /// Get from subtracting two . public static HeatFlux operator -(HeatFlux left, HeatFlux right) { - return new HeatFlux(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new HeatFlux(value, left.Unit); } /// Get from multiplying value and . - public static HeatFlux operator *(double left, HeatFlux right) + public static HeatFlux operator *(T left, HeatFlux right) { - return new HeatFlux(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new HeatFlux(value, right.Unit); } /// Get from multiplying value and . - public static HeatFlux operator *(HeatFlux left, double right) + public static HeatFlux operator *(HeatFlux left, T right) { - return new HeatFlux(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new HeatFlux(value, left.Unit); } /// Get from dividing by value. - public static HeatFlux operator /(HeatFlux left, double right) + public static HeatFlux operator /(HeatFlux left, T right) { - return new HeatFlux(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new HeatFlux(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(HeatFlux left, HeatFlux right) + public static T operator /(HeatFlux left, HeatFlux right) { - return left.WattsPerSquareMeter / right.WattsPerSquareMeter; + return CompiledLambdas.Divide(left.WattsPerSquareMeter, right.WattsPerSquareMeter); } #endregion @@ -670,25 +654,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out HeatFl /// Returns true if less or equal to. public static bool operator <=(HeatFlux left, HeatFlux right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(HeatFlux left, HeatFlux right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(HeatFlux left, HeatFlux right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(HeatFlux left, HeatFlux right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -717,7 +701,7 @@ public int CompareTo(object obj) /// public int CompareTo(HeatFlux other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -734,7 +718,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(HeatFlux other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -782,10 +766,8 @@ public bool Equals(HeatFlux other, double tolerance, ComparisonType compariso if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -805,17 +787,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(HeatFluxUnit unit) + public T As(HeatFluxUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -835,9 +817,14 @@ double IQuantity.As(Enum unit) if(!(unit is HeatFluxUnit unitAsHeatFluxUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(HeatFluxUnit)} is supported.", nameof(unit)); - return As(unitAsHeatFluxUnit); + var asValue = As(unitAsHeatFluxUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(HeatFluxUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -878,36 +865,42 @@ public HeatFlux ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(HeatFluxUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(HeatFluxUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case HeatFluxUnit.BtuPerHourSquareFoot: return _value*3.15459075; - case HeatFluxUnit.BtuPerMinuteSquareFoot: return _value*1.89275445e2; - case HeatFluxUnit.BtuPerSecondSquareFoot: return _value*1.13565267e4; - case HeatFluxUnit.BtuPerSecondSquareInch: return _value*1.63533984e6; - case HeatFluxUnit.CaloriePerSecondSquareCentimeter: return _value*4.1868e4; - case HeatFluxUnit.CentiwattPerSquareMeter: return (_value) * 1e-2d; - case HeatFluxUnit.DeciwattPerSquareMeter: return (_value) * 1e-1d; - case HeatFluxUnit.KilocaloriePerHourSquareMeter: return _value*1.163; - case HeatFluxUnit.KilocaloriePerSecondSquareCentimeter: return (_value*4.1868e4) * 1e3d; - case HeatFluxUnit.KilowattPerSquareMeter: return (_value) * 1e3d; - case HeatFluxUnit.MicrowattPerSquareMeter: return (_value) * 1e-6d; - case HeatFluxUnit.MilliwattPerSquareMeter: return (_value) * 1e-3d; - case HeatFluxUnit.NanowattPerSquareMeter: return (_value) * 1e-9d; - case HeatFluxUnit.PoundForcePerFootSecond: return _value*1.459390293720636e1; - case HeatFluxUnit.PoundPerSecondCubed: return _value*4.5359237e-1; - case HeatFluxUnit.WattPerSquareFoot: return _value*1.07639e1; - case HeatFluxUnit.WattPerSquareInch: return _value*1.5500031e3; - case HeatFluxUnit.WattPerSquareMeter: return _value; + case HeatFluxUnit.BtuPerHourSquareFoot: return Value*3.15459075; + case HeatFluxUnit.BtuPerMinuteSquareFoot: return Value*1.89275445e2; + case HeatFluxUnit.BtuPerSecondSquareFoot: return Value*1.13565267e4; + case HeatFluxUnit.BtuPerSecondSquareInch: return Value*1.63533984e6; + case HeatFluxUnit.CaloriePerSecondSquareCentimeter: return Value*4.1868e4; + case HeatFluxUnit.CentiwattPerSquareMeter: return (Value) * 1e-2d; + case HeatFluxUnit.DeciwattPerSquareMeter: return (Value) * 1e-1d; + case HeatFluxUnit.KilocaloriePerHourSquareMeter: return Value*1.163; + case HeatFluxUnit.KilocaloriePerSecondSquareCentimeter: return (Value*4.1868e4) * 1e3d; + case HeatFluxUnit.KilowattPerSquareMeter: return (Value) * 1e3d; + case HeatFluxUnit.MicrowattPerSquareMeter: return (Value) * 1e-6d; + case HeatFluxUnit.MilliwattPerSquareMeter: return (Value) * 1e-3d; + case HeatFluxUnit.NanowattPerSquareMeter: return (Value) * 1e-9d; + case HeatFluxUnit.PoundForcePerFootSecond: return Value*1.459390293720636e1; + case HeatFluxUnit.PoundPerSecondCubed: return Value*4.5359237e-1; + case HeatFluxUnit.WattPerSquareFoot: return Value*1.07639e1; + case HeatFluxUnit.WattPerSquareInch: return Value*1.5500031e3; + case HeatFluxUnit.WattPerSquareMeter: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -924,10 +917,10 @@ internal HeatFlux ToBaseUnit() return new HeatFlux(baseUnitValue, BaseUnit); } - private double GetValueAs(HeatFluxUnit unit) + private T GetValueAs(HeatFluxUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1052,7 +1045,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1067,37 +1060,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1121,17 +1114,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs index bd7aeefba7..1bbc32aca6 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// The heat transfer coefficient or film coefficient, or film effectiveness, in thermodynamics and in mechanics is the proportionality constant between the heat flux and the thermodynamic driving force for the flow of heat (i.e., the temperature difference, ΔT) /// - public partial struct HeatTransferCoefficient : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct HeatTransferCoefficient : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -63,12 +58,12 @@ static HeatTransferCoefficient() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public HeatTransferCoefficient(double value, HeatTransferCoefficientUnit unit) + public HeatTransferCoefficient(T value, HeatTransferCoefficientUnit unit) { if(unit == HeatTransferCoefficientUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -80,14 +75,14 @@ public HeatTransferCoefficient(double value, HeatTransferCoefficientUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public HeatTransferCoefficient(double value, UnitSystem unitSystem) + public HeatTransferCoefficient(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -129,7 +124,7 @@ public HeatTransferCoefficient(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeterKelvin. /// - public static HeatTransferCoefficient Zero { get; } = new HeatTransferCoefficient(0, BaseUnit); + public static HeatTransferCoefficient Zero { get; } = new HeatTransferCoefficient((T)0, BaseUnit); #endregion @@ -138,7 +133,9 @@ public HeatTransferCoefficient(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -168,17 +165,17 @@ public HeatTransferCoefficient(double value, UnitSystem unitSystem) /// /// Get in BtusPerSquareFootDegreeFahrenheit. /// - public double BtusPerSquareFootDegreeFahrenheit => As(HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit); + public T BtusPerSquareFootDegreeFahrenheit => As(HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit); /// /// Get in WattsPerSquareMeterCelsius. /// - public double WattsPerSquareMeterCelsius => As(HeatTransferCoefficientUnit.WattPerSquareMeterCelsius); + public T WattsPerSquareMeterCelsius => As(HeatTransferCoefficientUnit.WattPerSquareMeterCelsius); /// /// Get in WattsPerSquareMeterKelvin. /// - public double WattsPerSquareMeterKelvin => As(HeatTransferCoefficientUnit.WattPerSquareMeterKelvin); + public T WattsPerSquareMeterKelvin => As(HeatTransferCoefficientUnit.WattPerSquareMeterKelvin); #endregion @@ -213,28 +210,25 @@ public static string GetAbbreviation(HeatTransferCoefficientUnit unit, [CanBeNul /// Get from BtusPerSquareFootDegreeFahrenheit. /// /// If value is NaN or Infinity. - public static HeatTransferCoefficient FromBtusPerSquareFootDegreeFahrenheit(QuantityValue btuspersquarefootdegreefahrenheit) + public static HeatTransferCoefficient FromBtusPerSquareFootDegreeFahrenheit(T btuspersquarefootdegreefahrenheit) { - double value = (double) btuspersquarefootdegreefahrenheit; - return new HeatTransferCoefficient(value, HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit); + return new HeatTransferCoefficient(btuspersquarefootdegreefahrenheit, HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit); } /// /// Get from WattsPerSquareMeterCelsius. /// /// If value is NaN or Infinity. - public static HeatTransferCoefficient FromWattsPerSquareMeterCelsius(QuantityValue wattspersquaremetercelsius) + public static HeatTransferCoefficient FromWattsPerSquareMeterCelsius(T wattspersquaremetercelsius) { - double value = (double) wattspersquaremetercelsius; - return new HeatTransferCoefficient(value, HeatTransferCoefficientUnit.WattPerSquareMeterCelsius); + return new HeatTransferCoefficient(wattspersquaremetercelsius, HeatTransferCoefficientUnit.WattPerSquareMeterCelsius); } /// /// Get from WattsPerSquareMeterKelvin. /// /// If value is NaN or Infinity. - public static HeatTransferCoefficient FromWattsPerSquareMeterKelvin(QuantityValue wattspersquaremeterkelvin) + public static HeatTransferCoefficient FromWattsPerSquareMeterKelvin(T wattspersquaremeterkelvin) { - double value = (double) wattspersquaremeterkelvin; - return new HeatTransferCoefficient(value, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin); + return new HeatTransferCoefficient(wattspersquaremeterkelvin, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin); } /// @@ -243,9 +237,9 @@ public static HeatTransferCoefficient FromWattsPerSquareMeterKelvin(QuantityV /// Value to convert from. /// Unit to convert from. /// unit value. - public static HeatTransferCoefficient From(QuantityValue value, HeatTransferCoefficientUnit fromUnit) + public static HeatTransferCoefficient From(T value, HeatTransferCoefficientUnit fromUnit) { - return new HeatTransferCoefficient((double)value, fromUnit); + return new HeatTransferCoefficient(value, fromUnit); } #endregion @@ -399,43 +393,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out HeatTr /// Negate the value. public static HeatTransferCoefficient operator -(HeatTransferCoefficient right) { - return new HeatTransferCoefficient(-right.Value, right.Unit); + return new HeatTransferCoefficient(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static HeatTransferCoefficient operator +(HeatTransferCoefficient left, HeatTransferCoefficient right) { - return new HeatTransferCoefficient(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new HeatTransferCoefficient(value, left.Unit); } /// Get from subtracting two . public static HeatTransferCoefficient operator -(HeatTransferCoefficient left, HeatTransferCoefficient right) { - return new HeatTransferCoefficient(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new HeatTransferCoefficient(value, left.Unit); } /// Get from multiplying value and . - public static HeatTransferCoefficient operator *(double left, HeatTransferCoefficient right) + public static HeatTransferCoefficient operator *(T left, HeatTransferCoefficient right) { - return new HeatTransferCoefficient(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new HeatTransferCoefficient(value, right.Unit); } /// Get from multiplying value and . - public static HeatTransferCoefficient operator *(HeatTransferCoefficient left, double right) + public static HeatTransferCoefficient operator *(HeatTransferCoefficient left, T right) { - return new HeatTransferCoefficient(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new HeatTransferCoefficient(value, left.Unit); } /// Get from dividing by value. - public static HeatTransferCoefficient operator /(HeatTransferCoefficient left, double right) + public static HeatTransferCoefficient operator /(HeatTransferCoefficient left, T right) { - return new HeatTransferCoefficient(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new HeatTransferCoefficient(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(HeatTransferCoefficient left, HeatTransferCoefficient right) + public static T operator /(HeatTransferCoefficient left, HeatTransferCoefficient right) { - return left.WattsPerSquareMeterKelvin / right.WattsPerSquareMeterKelvin; + return CompiledLambdas.Divide(left.WattsPerSquareMeterKelvin, right.WattsPerSquareMeterKelvin); } #endregion @@ -445,25 +444,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out HeatTr /// Returns true if less or equal to. public static bool operator <=(HeatTransferCoefficient left, HeatTransferCoefficient right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(HeatTransferCoefficient left, HeatTransferCoefficient right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(HeatTransferCoefficient left, HeatTransferCoefficient right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(HeatTransferCoefficient left, HeatTransferCoefficient right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -492,7 +491,7 @@ public int CompareTo(object obj) /// public int CompareTo(HeatTransferCoefficient other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -509,7 +508,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(HeatTransferCoefficient other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -557,10 +556,8 @@ public bool Equals(HeatTransferCoefficient other, double tolerance, Compariso if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -580,17 +577,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(HeatTransferCoefficientUnit unit) + public T As(HeatTransferCoefficientUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -610,9 +607,14 @@ double IQuantity.As(Enum unit) if(!(unit is HeatTransferCoefficientUnit unitAsHeatTransferCoefficientUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(HeatTransferCoefficientUnit)} is supported.", nameof(unit)); - return As(unitAsHeatTransferCoefficientUnit); + var asValue = As(unitAsHeatTransferCoefficientUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(HeatTransferCoefficientUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -653,21 +655,27 @@ public HeatTransferCoefficient ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(HeatTransferCoefficientUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(HeatTransferCoefficientUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit: return _value * 5.6782633411134878; - case HeatTransferCoefficientUnit.WattPerSquareMeterCelsius: return _value; - case HeatTransferCoefficientUnit.WattPerSquareMeterKelvin: return _value; + case HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit: return Value * 5.6782633411134878; + case HeatTransferCoefficientUnit.WattPerSquareMeterCelsius: return Value; + case HeatTransferCoefficientUnit.WattPerSquareMeterKelvin: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -684,10 +692,10 @@ internal HeatTransferCoefficient ToBaseUnit() return new HeatTransferCoefficient(baseUnitValue, BaseUnit); } - private double GetValueAs(HeatTransferCoefficientUnit unit) + private T GetValueAs(HeatTransferCoefficientUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -797,7 +805,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -812,37 +820,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -866,17 +874,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs index e05c60e5c9..7a9f42d2cc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Illuminance /// - public partial struct Illuminance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Illuminance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -67,12 +62,12 @@ static Illuminance() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Illuminance(double value, IlluminanceUnit unit) + public Illuminance(T value, IlluminanceUnit unit) { if(unit == IlluminanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -84,14 +79,14 @@ public Illuminance(double value, IlluminanceUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Illuminance(double value, UnitSystem unitSystem) + public Illuminance(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -133,7 +128,7 @@ public Illuminance(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Lux. /// - public static Illuminance Zero { get; } = new Illuminance(0, BaseUnit); + public static Illuminance Zero { get; } = new Illuminance((T)0, BaseUnit); #endregion @@ -142,7 +137,9 @@ public Illuminance(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -172,22 +169,22 @@ public Illuminance(double value, UnitSystem unitSystem) /// /// Get in Kilolux. /// - public double Kilolux => As(IlluminanceUnit.Kilolux); + public T Kilolux => As(IlluminanceUnit.Kilolux); /// /// Get in Lux. /// - public double Lux => As(IlluminanceUnit.Lux); + public T Lux => As(IlluminanceUnit.Lux); /// /// Get in Megalux. /// - public double Megalux => As(IlluminanceUnit.Megalux); + public T Megalux => As(IlluminanceUnit.Megalux); /// /// Get in Millilux. /// - public double Millilux => As(IlluminanceUnit.Millilux); + public T Millilux => As(IlluminanceUnit.Millilux); #endregion @@ -222,37 +219,33 @@ public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] IFormatPr /// Get from Kilolux. /// /// If value is NaN or Infinity. - public static Illuminance FromKilolux(QuantityValue kilolux) + public static Illuminance FromKilolux(T kilolux) { - double value = (double) kilolux; - return new Illuminance(value, IlluminanceUnit.Kilolux); + return new Illuminance(kilolux, IlluminanceUnit.Kilolux); } /// /// Get from Lux. /// /// If value is NaN or Infinity. - public static Illuminance FromLux(QuantityValue lux) + public static Illuminance FromLux(T lux) { - double value = (double) lux; - return new Illuminance(value, IlluminanceUnit.Lux); + return new Illuminance(lux, IlluminanceUnit.Lux); } /// /// Get from Megalux. /// /// If value is NaN or Infinity. - public static Illuminance FromMegalux(QuantityValue megalux) + public static Illuminance FromMegalux(T megalux) { - double value = (double) megalux; - return new Illuminance(value, IlluminanceUnit.Megalux); + return new Illuminance(megalux, IlluminanceUnit.Megalux); } /// /// Get from Millilux. /// /// If value is NaN or Infinity. - public static Illuminance FromMillilux(QuantityValue millilux) + public static Illuminance FromMillilux(T millilux) { - double value = (double) millilux; - return new Illuminance(value, IlluminanceUnit.Millilux); + return new Illuminance(millilux, IlluminanceUnit.Millilux); } /// @@ -261,9 +254,9 @@ public static Illuminance FromMillilux(QuantityValue millilux) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Illuminance From(QuantityValue value, IlluminanceUnit fromUnit) + public static Illuminance From(T value, IlluminanceUnit fromUnit) { - return new Illuminance((double)value, fromUnit); + return new Illuminance(value, fromUnit); } #endregion @@ -417,43 +410,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Illumi /// Negate the value. public static Illuminance operator -(Illuminance right) { - return new Illuminance(-right.Value, right.Unit); + return new Illuminance(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Illuminance operator +(Illuminance left, Illuminance right) { - return new Illuminance(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Illuminance(value, left.Unit); } /// Get from subtracting two . public static Illuminance operator -(Illuminance left, Illuminance right) { - return new Illuminance(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Illuminance(value, left.Unit); } /// Get from multiplying value and . - public static Illuminance operator *(double left, Illuminance right) + public static Illuminance operator *(T left, Illuminance right) { - return new Illuminance(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Illuminance(value, right.Unit); } /// Get from multiplying value and . - public static Illuminance operator *(Illuminance left, double right) + public static Illuminance operator *(Illuminance left, T right) { - return new Illuminance(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Illuminance(value, left.Unit); } /// Get from dividing by value. - public static Illuminance operator /(Illuminance left, double right) + public static Illuminance operator /(Illuminance left, T right) { - return new Illuminance(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Illuminance(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Illuminance left, Illuminance right) + public static T operator /(Illuminance left, Illuminance right) { - return left.Lux / right.Lux; + return CompiledLambdas.Divide(left.Lux, right.Lux); } #endregion @@ -463,25 +461,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Illumi /// Returns true if less or equal to. public static bool operator <=(Illuminance left, Illuminance right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Illuminance left, Illuminance right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Illuminance left, Illuminance right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Illuminance left, Illuminance right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -510,7 +508,7 @@ public int CompareTo(object obj) /// public int CompareTo(Illuminance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -527,7 +525,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Illuminance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -575,10 +573,8 @@ public bool Equals(Illuminance other, double tolerance, ComparisonType compar if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -598,17 +594,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(IlluminanceUnit unit) + public T As(IlluminanceUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -628,9 +624,14 @@ double IQuantity.As(Enum unit) if(!(unit is IlluminanceUnit unitAsIlluminanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IlluminanceUnit)} is supported.", nameof(unit)); - return As(unitAsIlluminanceUnit); + var asValue = As(unitAsIlluminanceUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(IlluminanceUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -671,22 +672,28 @@ public Illuminance ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(IlluminanceUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(IlluminanceUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case IlluminanceUnit.Kilolux: return (_value) * 1e3d; - case IlluminanceUnit.Lux: return _value; - case IlluminanceUnit.Megalux: return (_value) * 1e6d; - case IlluminanceUnit.Millilux: return (_value) * 1e-3d; + case IlluminanceUnit.Kilolux: return (Value) * 1e3d; + case IlluminanceUnit.Lux: return Value; + case IlluminanceUnit.Megalux: return (Value) * 1e6d; + case IlluminanceUnit.Millilux: return (Value) * 1e-3d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -703,10 +710,10 @@ internal Illuminance ToBaseUnit() return new Illuminance(baseUnitValue, BaseUnit); } - private double GetValueAs(IlluminanceUnit unit) + private T GetValueAs(IlluminanceUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -817,7 +824,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -832,37 +839,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -886,17 +893,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Information.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.g.cs index 7aaf9017ad..066f7ce7fe 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// In computing and telecommunications, a unit of information is the capacity of some standard data storage system or communication channel, used to measure the capacities of other systems and channels. In information theory, units of information are also used to measure the information contents or entropy of random variables. /// - public partial struct Information : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Information : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly decimal _value; - /// /// The unit this quantity was constructed with. /// @@ -86,12 +81,12 @@ static Information() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Information(decimal value, InformationUnit unit) + public Information(T value, InformationUnit unit) { if(unit == InformationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = value; + Value = value; _unit = unit; } @@ -103,14 +98,14 @@ public Information(decimal value, InformationUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Information(decimal value, UnitSystem unitSystem) + public Information(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = value; + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -152,7 +147,7 @@ public Information(decimal value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Bit. /// - public static Information Zero { get; } = new Information(0, BaseUnit); + public static Information Zero { get; } = new Information((T)0, BaseUnit); #endregion @@ -161,9 +156,9 @@ public Information(decimal value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public decimal Value => _value; + public T Value{ get; } - double IQuantity.Value => (double) _value; + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -193,132 +188,132 @@ public Information(decimal value, UnitSystem unitSystem) /// /// Get in Bits. /// - public double Bits => As(InformationUnit.Bit); + public T Bits => As(InformationUnit.Bit); /// /// Get in Bytes. /// - public double Bytes => As(InformationUnit.Byte); + public T Bytes => As(InformationUnit.Byte); /// /// Get in Exabits. /// - public double Exabits => As(InformationUnit.Exabit); + public T Exabits => As(InformationUnit.Exabit); /// /// Get in Exabytes. /// - public double Exabytes => As(InformationUnit.Exabyte); + public T Exabytes => As(InformationUnit.Exabyte); /// /// Get in Exbibits. /// - public double Exbibits => As(InformationUnit.Exbibit); + public T Exbibits => As(InformationUnit.Exbibit); /// /// Get in Exbibytes. /// - public double Exbibytes => As(InformationUnit.Exbibyte); + public T Exbibytes => As(InformationUnit.Exbibyte); /// /// Get in Gibibits. /// - public double Gibibits => As(InformationUnit.Gibibit); + public T Gibibits => As(InformationUnit.Gibibit); /// /// Get in Gibibytes. /// - public double Gibibytes => As(InformationUnit.Gibibyte); + public T Gibibytes => As(InformationUnit.Gibibyte); /// /// Get in Gigabits. /// - public double Gigabits => As(InformationUnit.Gigabit); + public T Gigabits => As(InformationUnit.Gigabit); /// /// Get in Gigabytes. /// - public double Gigabytes => As(InformationUnit.Gigabyte); + public T Gigabytes => As(InformationUnit.Gigabyte); /// /// Get in Kibibits. /// - public double Kibibits => As(InformationUnit.Kibibit); + public T Kibibits => As(InformationUnit.Kibibit); /// /// Get in Kibibytes. /// - public double Kibibytes => As(InformationUnit.Kibibyte); + public T Kibibytes => As(InformationUnit.Kibibyte); /// /// Get in Kilobits. /// - public double Kilobits => As(InformationUnit.Kilobit); + public T Kilobits => As(InformationUnit.Kilobit); /// /// Get in Kilobytes. /// - public double Kilobytes => As(InformationUnit.Kilobyte); + public T Kilobytes => As(InformationUnit.Kilobyte); /// /// Get in Mebibits. /// - public double Mebibits => As(InformationUnit.Mebibit); + public T Mebibits => As(InformationUnit.Mebibit); /// /// Get in Mebibytes. /// - public double Mebibytes => As(InformationUnit.Mebibyte); + public T Mebibytes => As(InformationUnit.Mebibyte); /// /// Get in Megabits. /// - public double Megabits => As(InformationUnit.Megabit); + public T Megabits => As(InformationUnit.Megabit); /// /// Get in Megabytes. /// - public double Megabytes => As(InformationUnit.Megabyte); + public T Megabytes => As(InformationUnit.Megabyte); /// /// Get in Pebibits. /// - public double Pebibits => As(InformationUnit.Pebibit); + public T Pebibits => As(InformationUnit.Pebibit); /// /// Get in Pebibytes. /// - public double Pebibytes => As(InformationUnit.Pebibyte); + public T Pebibytes => As(InformationUnit.Pebibyte); /// /// Get in Petabits. /// - public double Petabits => As(InformationUnit.Petabit); + public T Petabits => As(InformationUnit.Petabit); /// /// Get in Petabytes. /// - public double Petabytes => As(InformationUnit.Petabyte); + public T Petabytes => As(InformationUnit.Petabyte); /// /// Get in Tebibits. /// - public double Tebibits => As(InformationUnit.Tebibit); + public T Tebibits => As(InformationUnit.Tebibit); /// /// Get in Tebibytes. /// - public double Tebibytes => As(InformationUnit.Tebibyte); + public T Tebibytes => As(InformationUnit.Tebibyte); /// /// Get in Terabits. /// - public double Terabits => As(InformationUnit.Terabit); + public T Terabits => As(InformationUnit.Terabit); /// /// Get in Terabytes. /// - public double Terabytes => As(InformationUnit.Terabyte); + public T Terabytes => As(InformationUnit.Terabyte); #endregion @@ -353,235 +348,209 @@ public static string GetAbbreviation(InformationUnit unit, [CanBeNull] IFormatPr /// Get from Bits. /// /// If value is NaN or Infinity. - public static Information FromBits(QuantityValue bits) + public static Information FromBits(T bits) { - decimal value = (decimal) bits; - return new Information(value, InformationUnit.Bit); + return new Information(bits, InformationUnit.Bit); } /// /// Get from Bytes. /// /// If value is NaN or Infinity. - public static Information FromBytes(QuantityValue bytes) + public static Information FromBytes(T bytes) { - decimal value = (decimal) bytes; - return new Information(value, InformationUnit.Byte); + return new Information(bytes, InformationUnit.Byte); } /// /// Get from Exabits. /// /// If value is NaN or Infinity. - public static Information FromExabits(QuantityValue exabits) + public static Information FromExabits(T exabits) { - decimal value = (decimal) exabits; - return new Information(value, InformationUnit.Exabit); + return new Information(exabits, InformationUnit.Exabit); } /// /// Get from Exabytes. /// /// If value is NaN or Infinity. - public static Information FromExabytes(QuantityValue exabytes) + public static Information FromExabytes(T exabytes) { - decimal value = (decimal) exabytes; - return new Information(value, InformationUnit.Exabyte); + return new Information(exabytes, InformationUnit.Exabyte); } /// /// Get from Exbibits. /// /// If value is NaN or Infinity. - public static Information FromExbibits(QuantityValue exbibits) + public static Information FromExbibits(T exbibits) { - decimal value = (decimal) exbibits; - return new Information(value, InformationUnit.Exbibit); + return new Information(exbibits, InformationUnit.Exbibit); } /// /// Get from Exbibytes. /// /// If value is NaN or Infinity. - public static Information FromExbibytes(QuantityValue exbibytes) + public static Information FromExbibytes(T exbibytes) { - decimal value = (decimal) exbibytes; - return new Information(value, InformationUnit.Exbibyte); + return new Information(exbibytes, InformationUnit.Exbibyte); } /// /// Get from Gibibits. /// /// If value is NaN or Infinity. - public static Information FromGibibits(QuantityValue gibibits) + public static Information FromGibibits(T gibibits) { - decimal value = (decimal) gibibits; - return new Information(value, InformationUnit.Gibibit); + return new Information(gibibits, InformationUnit.Gibibit); } /// /// Get from Gibibytes. /// /// If value is NaN or Infinity. - public static Information FromGibibytes(QuantityValue gibibytes) + public static Information FromGibibytes(T gibibytes) { - decimal value = (decimal) gibibytes; - return new Information(value, InformationUnit.Gibibyte); + return new Information(gibibytes, InformationUnit.Gibibyte); } /// /// Get from Gigabits. /// /// If value is NaN or Infinity. - public static Information FromGigabits(QuantityValue gigabits) + public static Information FromGigabits(T gigabits) { - decimal value = (decimal) gigabits; - return new Information(value, InformationUnit.Gigabit); + return new Information(gigabits, InformationUnit.Gigabit); } /// /// Get from Gigabytes. /// /// If value is NaN or Infinity. - public static Information FromGigabytes(QuantityValue gigabytes) + public static Information FromGigabytes(T gigabytes) { - decimal value = (decimal) gigabytes; - return new Information(value, InformationUnit.Gigabyte); + return new Information(gigabytes, InformationUnit.Gigabyte); } /// /// Get from Kibibits. /// /// If value is NaN or Infinity. - public static Information FromKibibits(QuantityValue kibibits) + public static Information FromKibibits(T kibibits) { - decimal value = (decimal) kibibits; - return new Information(value, InformationUnit.Kibibit); + return new Information(kibibits, InformationUnit.Kibibit); } /// /// Get from Kibibytes. /// /// If value is NaN or Infinity. - public static Information FromKibibytes(QuantityValue kibibytes) + public static Information FromKibibytes(T kibibytes) { - decimal value = (decimal) kibibytes; - return new Information(value, InformationUnit.Kibibyte); + return new Information(kibibytes, InformationUnit.Kibibyte); } /// /// Get from Kilobits. /// /// If value is NaN or Infinity. - public static Information FromKilobits(QuantityValue kilobits) + public static Information FromKilobits(T kilobits) { - decimal value = (decimal) kilobits; - return new Information(value, InformationUnit.Kilobit); + return new Information(kilobits, InformationUnit.Kilobit); } /// /// Get from Kilobytes. /// /// If value is NaN or Infinity. - public static Information FromKilobytes(QuantityValue kilobytes) + public static Information FromKilobytes(T kilobytes) { - decimal value = (decimal) kilobytes; - return new Information(value, InformationUnit.Kilobyte); + return new Information(kilobytes, InformationUnit.Kilobyte); } /// /// Get from Mebibits. /// /// If value is NaN or Infinity. - public static Information FromMebibits(QuantityValue mebibits) + public static Information FromMebibits(T mebibits) { - decimal value = (decimal) mebibits; - return new Information(value, InformationUnit.Mebibit); + return new Information(mebibits, InformationUnit.Mebibit); } /// /// Get from Mebibytes. /// /// If value is NaN or Infinity. - public static Information FromMebibytes(QuantityValue mebibytes) + public static Information FromMebibytes(T mebibytes) { - decimal value = (decimal) mebibytes; - return new Information(value, InformationUnit.Mebibyte); + return new Information(mebibytes, InformationUnit.Mebibyte); } /// /// Get from Megabits. /// /// If value is NaN or Infinity. - public static Information FromMegabits(QuantityValue megabits) + public static Information FromMegabits(T megabits) { - decimal value = (decimal) megabits; - return new Information(value, InformationUnit.Megabit); + return new Information(megabits, InformationUnit.Megabit); } /// /// Get from Megabytes. /// /// If value is NaN or Infinity. - public static Information FromMegabytes(QuantityValue megabytes) + public static Information FromMegabytes(T megabytes) { - decimal value = (decimal) megabytes; - return new Information(value, InformationUnit.Megabyte); + return new Information(megabytes, InformationUnit.Megabyte); } /// /// Get from Pebibits. /// /// If value is NaN or Infinity. - public static Information FromPebibits(QuantityValue pebibits) + public static Information FromPebibits(T pebibits) { - decimal value = (decimal) pebibits; - return new Information(value, InformationUnit.Pebibit); + return new Information(pebibits, InformationUnit.Pebibit); } /// /// Get from Pebibytes. /// /// If value is NaN or Infinity. - public static Information FromPebibytes(QuantityValue pebibytes) + public static Information FromPebibytes(T pebibytes) { - decimal value = (decimal) pebibytes; - return new Information(value, InformationUnit.Pebibyte); + return new Information(pebibytes, InformationUnit.Pebibyte); } /// /// Get from Petabits. /// /// If value is NaN or Infinity. - public static Information FromPetabits(QuantityValue petabits) + public static Information FromPetabits(T petabits) { - decimal value = (decimal) petabits; - return new Information(value, InformationUnit.Petabit); + return new Information(petabits, InformationUnit.Petabit); } /// /// Get from Petabytes. /// /// If value is NaN or Infinity. - public static Information FromPetabytes(QuantityValue petabytes) + public static Information FromPetabytes(T petabytes) { - decimal value = (decimal) petabytes; - return new Information(value, InformationUnit.Petabyte); + return new Information(petabytes, InformationUnit.Petabyte); } /// /// Get from Tebibits. /// /// If value is NaN or Infinity. - public static Information FromTebibits(QuantityValue tebibits) + public static Information FromTebibits(T tebibits) { - decimal value = (decimal) tebibits; - return new Information(value, InformationUnit.Tebibit); + return new Information(tebibits, InformationUnit.Tebibit); } /// /// Get from Tebibytes. /// /// If value is NaN or Infinity. - public static Information FromTebibytes(QuantityValue tebibytes) + public static Information FromTebibytes(T tebibytes) { - decimal value = (decimal) tebibytes; - return new Information(value, InformationUnit.Tebibyte); + return new Information(tebibytes, InformationUnit.Tebibyte); } /// /// Get from Terabits. /// /// If value is NaN or Infinity. - public static Information FromTerabits(QuantityValue terabits) + public static Information FromTerabits(T terabits) { - decimal value = (decimal) terabits; - return new Information(value, InformationUnit.Terabit); + return new Information(terabits, InformationUnit.Terabit); } /// /// Get from Terabytes. /// /// If value is NaN or Infinity. - public static Information FromTerabytes(QuantityValue terabytes) + public static Information FromTerabytes(T terabytes) { - decimal value = (decimal) terabytes; - return new Information(value, InformationUnit.Terabyte); + return new Information(terabytes, InformationUnit.Terabyte); } /// @@ -590,9 +559,9 @@ public static Information FromTerabytes(QuantityValue terabytes) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Information From(QuantityValue value, InformationUnit fromUnit) + public static Information From(T value, InformationUnit fromUnit) { - return new Information((decimal)value, fromUnit); + return new Information(value, fromUnit); } #endregion @@ -746,43 +715,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Inform /// Negate the value. public static Information operator -(Information right) { - return new Information(-right.Value, right.Unit); + return new Information(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Information operator +(Information left, Information right) { - return new Information(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Information(value, left.Unit); } /// Get from subtracting two . public static Information operator -(Information left, Information right) { - return new Information(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Information(value, left.Unit); } /// Get from multiplying value and . - public static Information operator *(decimal left, Information right) + public static Information operator *(T left, Information right) { - return new Information(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Information(value, right.Unit); } /// Get from multiplying value and . - public static Information operator *(Information left, decimal right) + public static Information operator *(Information left, T right) { - return new Information(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Information(value, left.Unit); } /// Get from dividing by value. - public static Information operator /(Information left, decimal right) + public static Information operator /(Information left, T right) { - return new Information(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Information(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Information left, Information right) + public static T operator /(Information left, Information right) { - return left.Bits / right.Bits; + return CompiledLambdas.Divide(left.Bits, right.Bits); } #endregion @@ -792,25 +766,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Inform /// Returns true if less or equal to. public static bool operator <=(Information left, Information right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Information left, Information right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Information left, Information right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Information left, Information right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -839,7 +813,7 @@ public int CompareTo(object obj) /// public int CompareTo(Information other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -856,7 +830,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Information other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -904,10 +878,8 @@ public bool Equals(Information other, double tolerance, ComparisonType compar if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -927,17 +899,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(InformationUnit unit) + public T As(InformationUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -957,9 +929,14 @@ double IQuantity.As(Enum unit) if(!(unit is InformationUnit unitAsInformationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(InformationUnit)} is supported.", nameof(unit)); - return As(unitAsInformationUnit); + var asValue = As(unitAsInformationUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(InformationUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -1000,44 +977,50 @@ public Information ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(InformationUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(InformationUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private decimal GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case InformationUnit.Bit: return _value; - case InformationUnit.Byte: return _value*8m; - case InformationUnit.Exabit: return (_value) * 1e18m; - case InformationUnit.Exabyte: return (_value*8m) * 1e18m; - case InformationUnit.Exbibit: return (_value) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); - case InformationUnit.Exbibyte: return (_value*8m) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); - case InformationUnit.Gibibit: return (_value) * (1024m * 1024 * 1024); - case InformationUnit.Gibibyte: return (_value*8m) * (1024m * 1024 * 1024); - case InformationUnit.Gigabit: return (_value) * 1e9m; - case InformationUnit.Gigabyte: return (_value*8m) * 1e9m; - case InformationUnit.Kibibit: return (_value) * 1024m; - case InformationUnit.Kibibyte: return (_value*8m) * 1024m; - case InformationUnit.Kilobit: return (_value) * 1e3m; - case InformationUnit.Kilobyte: return (_value*8m) * 1e3m; - case InformationUnit.Mebibit: return (_value) * (1024m * 1024); - case InformationUnit.Mebibyte: return (_value*8m) * (1024m * 1024); - case InformationUnit.Megabit: return (_value) * 1e6m; - case InformationUnit.Megabyte: return (_value*8m) * 1e6m; - case InformationUnit.Pebibit: return (_value) * (1024m * 1024 * 1024 * 1024 * 1024); - case InformationUnit.Pebibyte: return (_value*8m) * (1024m * 1024 * 1024 * 1024 * 1024); - case InformationUnit.Petabit: return (_value) * 1e15m; - case InformationUnit.Petabyte: return (_value*8m) * 1e15m; - case InformationUnit.Tebibit: return (_value) * (1024m * 1024 * 1024 * 1024); - case InformationUnit.Tebibyte: return (_value*8m) * (1024m * 1024 * 1024 * 1024); - case InformationUnit.Terabit: return (_value) * 1e12m; - case InformationUnit.Terabyte: return (_value*8m) * 1e12m; + case InformationUnit.Bit: return Value; + case InformationUnit.Byte: return Value*8m; + case InformationUnit.Exabit: return (Value) * 1e18m; + case InformationUnit.Exabyte: return (Value*8m) * 1e18m; + case InformationUnit.Exbibit: return (Value) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Exbibyte: return (Value*8m) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Gibibit: return (Value) * (1024m * 1024 * 1024); + case InformationUnit.Gibibyte: return (Value*8m) * (1024m * 1024 * 1024); + case InformationUnit.Gigabit: return (Value) * 1e9m; + case InformationUnit.Gigabyte: return (Value*8m) * 1e9m; + case InformationUnit.Kibibit: return (Value) * 1024m; + case InformationUnit.Kibibyte: return (Value*8m) * 1024m; + case InformationUnit.Kilobit: return (Value) * 1e3m; + case InformationUnit.Kilobyte: return (Value*8m) * 1e3m; + case InformationUnit.Mebibit: return (Value) * (1024m * 1024); + case InformationUnit.Mebibyte: return (Value*8m) * (1024m * 1024); + case InformationUnit.Megabit: return (Value) * 1e6m; + case InformationUnit.Megabyte: return (Value*8m) * 1e6m; + case InformationUnit.Pebibit: return (Value) * (1024m * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Pebibyte: return (Value*8m) * (1024m * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Petabit: return (Value) * 1e15m; + case InformationUnit.Petabyte: return (Value*8m) * 1e15m; + case InformationUnit.Tebibit: return (Value) * (1024m * 1024 * 1024 * 1024); + case InformationUnit.Tebibyte: return (Value*8m) * (1024m * 1024 * 1024 * 1024); + case InformationUnit.Terabit: return (Value) * 1e12m; + case InformationUnit.Terabyte: return (Value*8m) * 1e12m; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -1054,10 +1037,10 @@ internal Information ToBaseUnit() return new Information(baseUnitValue, BaseUnit); } - private decimal GetValueAs(InformationUnit unit) + private T GetValueAs(InformationUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1190,7 +1173,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1205,37 +1188,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1259,17 +1242,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs index 118b2ebfdd..c6c57d9327 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Irradiance is the intensity of ultraviolet (UV) or visible light incident on a surface. /// - public partial struct Irradiance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Irradiance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -74,12 +69,12 @@ static Irradiance() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Irradiance(double value, IrradianceUnit unit) + public Irradiance(T value, IrradianceUnit unit) { if(unit == IrradianceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -91,14 +86,14 @@ public Irradiance(double value, IrradianceUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Irradiance(double value, UnitSystem unitSystem) + public Irradiance(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -140,7 +135,7 @@ public Irradiance(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeter. /// - public static Irradiance Zero { get; } = new Irradiance(0, BaseUnit); + public static Irradiance Zero { get; } = new Irradiance((T)0, BaseUnit); #endregion @@ -149,7 +144,9 @@ public Irradiance(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -179,72 +176,72 @@ public Irradiance(double value, UnitSystem unitSystem) /// /// Get in KilowattsPerSquareCentimeter. /// - public double KilowattsPerSquareCentimeter => As(IrradianceUnit.KilowattPerSquareCentimeter); + public T KilowattsPerSquareCentimeter => As(IrradianceUnit.KilowattPerSquareCentimeter); /// /// Get in KilowattsPerSquareMeter. /// - public double KilowattsPerSquareMeter => As(IrradianceUnit.KilowattPerSquareMeter); + public T KilowattsPerSquareMeter => As(IrradianceUnit.KilowattPerSquareMeter); /// /// Get in MegawattsPerSquareCentimeter. /// - public double MegawattsPerSquareCentimeter => As(IrradianceUnit.MegawattPerSquareCentimeter); + public T MegawattsPerSquareCentimeter => As(IrradianceUnit.MegawattPerSquareCentimeter); /// /// Get in MegawattsPerSquareMeter. /// - public double MegawattsPerSquareMeter => As(IrradianceUnit.MegawattPerSquareMeter); + public T MegawattsPerSquareMeter => As(IrradianceUnit.MegawattPerSquareMeter); /// /// Get in MicrowattsPerSquareCentimeter. /// - public double MicrowattsPerSquareCentimeter => As(IrradianceUnit.MicrowattPerSquareCentimeter); + public T MicrowattsPerSquareCentimeter => As(IrradianceUnit.MicrowattPerSquareCentimeter); /// /// Get in MicrowattsPerSquareMeter. /// - public double MicrowattsPerSquareMeter => As(IrradianceUnit.MicrowattPerSquareMeter); + public T MicrowattsPerSquareMeter => As(IrradianceUnit.MicrowattPerSquareMeter); /// /// Get in MilliwattsPerSquareCentimeter. /// - public double MilliwattsPerSquareCentimeter => As(IrradianceUnit.MilliwattPerSquareCentimeter); + public T MilliwattsPerSquareCentimeter => As(IrradianceUnit.MilliwattPerSquareCentimeter); /// /// Get in MilliwattsPerSquareMeter. /// - public double MilliwattsPerSquareMeter => As(IrradianceUnit.MilliwattPerSquareMeter); + public T MilliwattsPerSquareMeter => As(IrradianceUnit.MilliwattPerSquareMeter); /// /// Get in NanowattsPerSquareCentimeter. /// - public double NanowattsPerSquareCentimeter => As(IrradianceUnit.NanowattPerSquareCentimeter); + public T NanowattsPerSquareCentimeter => As(IrradianceUnit.NanowattPerSquareCentimeter); /// /// Get in NanowattsPerSquareMeter. /// - public double NanowattsPerSquareMeter => As(IrradianceUnit.NanowattPerSquareMeter); + public T NanowattsPerSquareMeter => As(IrradianceUnit.NanowattPerSquareMeter); /// /// Get in PicowattsPerSquareCentimeter. /// - public double PicowattsPerSquareCentimeter => As(IrradianceUnit.PicowattPerSquareCentimeter); + public T PicowattsPerSquareCentimeter => As(IrradianceUnit.PicowattPerSquareCentimeter); /// /// Get in PicowattsPerSquareMeter. /// - public double PicowattsPerSquareMeter => As(IrradianceUnit.PicowattPerSquareMeter); + public T PicowattsPerSquareMeter => As(IrradianceUnit.PicowattPerSquareMeter); /// /// Get in WattsPerSquareCentimeter. /// - public double WattsPerSquareCentimeter => As(IrradianceUnit.WattPerSquareCentimeter); + public T WattsPerSquareCentimeter => As(IrradianceUnit.WattPerSquareCentimeter); /// /// Get in WattsPerSquareMeter. /// - public double WattsPerSquareMeter => As(IrradianceUnit.WattPerSquareMeter); + public T WattsPerSquareMeter => As(IrradianceUnit.WattPerSquareMeter); #endregion @@ -279,127 +276,113 @@ public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] IFormatPro /// Get from KilowattsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiance FromKilowattsPerSquareCentimeter(QuantityValue kilowattspersquarecentimeter) + public static Irradiance FromKilowattsPerSquareCentimeter(T kilowattspersquarecentimeter) { - double value = (double) kilowattspersquarecentimeter; - return new Irradiance(value, IrradianceUnit.KilowattPerSquareCentimeter); + return new Irradiance(kilowattspersquarecentimeter, IrradianceUnit.KilowattPerSquareCentimeter); } /// /// Get from KilowattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiance FromKilowattsPerSquareMeter(QuantityValue kilowattspersquaremeter) + public static Irradiance FromKilowattsPerSquareMeter(T kilowattspersquaremeter) { - double value = (double) kilowattspersquaremeter; - return new Irradiance(value, IrradianceUnit.KilowattPerSquareMeter); + return new Irradiance(kilowattspersquaremeter, IrradianceUnit.KilowattPerSquareMeter); } /// /// Get from MegawattsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiance FromMegawattsPerSquareCentimeter(QuantityValue megawattspersquarecentimeter) + public static Irradiance FromMegawattsPerSquareCentimeter(T megawattspersquarecentimeter) { - double value = (double) megawattspersquarecentimeter; - return new Irradiance(value, IrradianceUnit.MegawattPerSquareCentimeter); + return new Irradiance(megawattspersquarecentimeter, IrradianceUnit.MegawattPerSquareCentimeter); } /// /// Get from MegawattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiance FromMegawattsPerSquareMeter(QuantityValue megawattspersquaremeter) + public static Irradiance FromMegawattsPerSquareMeter(T megawattspersquaremeter) { - double value = (double) megawattspersquaremeter; - return new Irradiance(value, IrradianceUnit.MegawattPerSquareMeter); + return new Irradiance(megawattspersquaremeter, IrradianceUnit.MegawattPerSquareMeter); } /// /// Get from MicrowattsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiance FromMicrowattsPerSquareCentimeter(QuantityValue microwattspersquarecentimeter) + public static Irradiance FromMicrowattsPerSquareCentimeter(T microwattspersquarecentimeter) { - double value = (double) microwattspersquarecentimeter; - return new Irradiance(value, IrradianceUnit.MicrowattPerSquareCentimeter); + return new Irradiance(microwattspersquarecentimeter, IrradianceUnit.MicrowattPerSquareCentimeter); } /// /// Get from MicrowattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiance FromMicrowattsPerSquareMeter(QuantityValue microwattspersquaremeter) + public static Irradiance FromMicrowattsPerSquareMeter(T microwattspersquaremeter) { - double value = (double) microwattspersquaremeter; - return new Irradiance(value, IrradianceUnit.MicrowattPerSquareMeter); + return new Irradiance(microwattspersquaremeter, IrradianceUnit.MicrowattPerSquareMeter); } /// /// Get from MilliwattsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiance FromMilliwattsPerSquareCentimeter(QuantityValue milliwattspersquarecentimeter) + public static Irradiance FromMilliwattsPerSquareCentimeter(T milliwattspersquarecentimeter) { - double value = (double) milliwattspersquarecentimeter; - return new Irradiance(value, IrradianceUnit.MilliwattPerSquareCentimeter); + return new Irradiance(milliwattspersquarecentimeter, IrradianceUnit.MilliwattPerSquareCentimeter); } /// /// Get from MilliwattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiance FromMilliwattsPerSquareMeter(QuantityValue milliwattspersquaremeter) + public static Irradiance FromMilliwattsPerSquareMeter(T milliwattspersquaremeter) { - double value = (double) milliwattspersquaremeter; - return new Irradiance(value, IrradianceUnit.MilliwattPerSquareMeter); + return new Irradiance(milliwattspersquaremeter, IrradianceUnit.MilliwattPerSquareMeter); } /// /// Get from NanowattsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiance FromNanowattsPerSquareCentimeter(QuantityValue nanowattspersquarecentimeter) + public static Irradiance FromNanowattsPerSquareCentimeter(T nanowattspersquarecentimeter) { - double value = (double) nanowattspersquarecentimeter; - return new Irradiance(value, IrradianceUnit.NanowattPerSquareCentimeter); + return new Irradiance(nanowattspersquarecentimeter, IrradianceUnit.NanowattPerSquareCentimeter); } /// /// Get from NanowattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiance FromNanowattsPerSquareMeter(QuantityValue nanowattspersquaremeter) + public static Irradiance FromNanowattsPerSquareMeter(T nanowattspersquaremeter) { - double value = (double) nanowattspersquaremeter; - return new Irradiance(value, IrradianceUnit.NanowattPerSquareMeter); + return new Irradiance(nanowattspersquaremeter, IrradianceUnit.NanowattPerSquareMeter); } /// /// Get from PicowattsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiance FromPicowattsPerSquareCentimeter(QuantityValue picowattspersquarecentimeter) + public static Irradiance FromPicowattsPerSquareCentimeter(T picowattspersquarecentimeter) { - double value = (double) picowattspersquarecentimeter; - return new Irradiance(value, IrradianceUnit.PicowattPerSquareCentimeter); + return new Irradiance(picowattspersquarecentimeter, IrradianceUnit.PicowattPerSquareCentimeter); } /// /// Get from PicowattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiance FromPicowattsPerSquareMeter(QuantityValue picowattspersquaremeter) + public static Irradiance FromPicowattsPerSquareMeter(T picowattspersquaremeter) { - double value = (double) picowattspersquaremeter; - return new Irradiance(value, IrradianceUnit.PicowattPerSquareMeter); + return new Irradiance(picowattspersquaremeter, IrradianceUnit.PicowattPerSquareMeter); } /// /// Get from WattsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiance FromWattsPerSquareCentimeter(QuantityValue wattspersquarecentimeter) + public static Irradiance FromWattsPerSquareCentimeter(T wattspersquarecentimeter) { - double value = (double) wattspersquarecentimeter; - return new Irradiance(value, IrradianceUnit.WattPerSquareCentimeter); + return new Irradiance(wattspersquarecentimeter, IrradianceUnit.WattPerSquareCentimeter); } /// /// Get from WattsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiance FromWattsPerSquareMeter(QuantityValue wattspersquaremeter) + public static Irradiance FromWattsPerSquareMeter(T wattspersquaremeter) { - double value = (double) wattspersquaremeter; - return new Irradiance(value, IrradianceUnit.WattPerSquareMeter); + return new Irradiance(wattspersquaremeter, IrradianceUnit.WattPerSquareMeter); } /// @@ -408,9 +391,9 @@ public static Irradiance FromWattsPerSquareMeter(QuantityValue wattspersquare /// Value to convert from. /// Unit to convert from. /// unit value. - public static Irradiance From(QuantityValue value, IrradianceUnit fromUnit) + public static Irradiance From(T value, IrradianceUnit fromUnit) { - return new Irradiance((double)value, fromUnit); + return new Irradiance(value, fromUnit); } #endregion @@ -564,43 +547,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Irradi /// Negate the value. public static Irradiance operator -(Irradiance right) { - return new Irradiance(-right.Value, right.Unit); + return new Irradiance(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Irradiance operator +(Irradiance left, Irradiance right) { - return new Irradiance(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Irradiance(value, left.Unit); } /// Get from subtracting two . public static Irradiance operator -(Irradiance left, Irradiance right) { - return new Irradiance(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Irradiance(value, left.Unit); } /// Get from multiplying value and . - public static Irradiance operator *(double left, Irradiance right) + public static Irradiance operator *(T left, Irradiance right) { - return new Irradiance(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Irradiance(value, right.Unit); } /// Get from multiplying value and . - public static Irradiance operator *(Irradiance left, double right) + public static Irradiance operator *(Irradiance left, T right) { - return new Irradiance(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Irradiance(value, left.Unit); } /// Get from dividing by value. - public static Irradiance operator /(Irradiance left, double right) + public static Irradiance operator /(Irradiance left, T right) { - return new Irradiance(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Irradiance(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Irradiance left, Irradiance right) + public static T operator /(Irradiance left, Irradiance right) { - return left.WattsPerSquareMeter / right.WattsPerSquareMeter; + return CompiledLambdas.Divide(left.WattsPerSquareMeter, right.WattsPerSquareMeter); } #endregion @@ -610,25 +598,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Irradi /// Returns true if less or equal to. public static bool operator <=(Irradiance left, Irradiance right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Irradiance left, Irradiance right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Irradiance left, Irradiance right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Irradiance left, Irradiance right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -657,7 +645,7 @@ public int CompareTo(object obj) /// public int CompareTo(Irradiance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -674,7 +662,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Irradiance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -722,10 +710,8 @@ public bool Equals(Irradiance other, double tolerance, ComparisonType compari if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -745,17 +731,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(IrradianceUnit unit) + public T As(IrradianceUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -775,9 +761,14 @@ double IQuantity.As(Enum unit) if(!(unit is IrradianceUnit unitAsIrradianceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IrradianceUnit)} is supported.", nameof(unit)); - return As(unitAsIrradianceUnit); + var asValue = As(unitAsIrradianceUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(IrradianceUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -818,32 +809,38 @@ public Irradiance ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(IrradianceUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(IrradianceUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case IrradianceUnit.KilowattPerSquareCentimeter: return (_value*10000) * 1e3d; - case IrradianceUnit.KilowattPerSquareMeter: return (_value) * 1e3d; - case IrradianceUnit.MegawattPerSquareCentimeter: return (_value*10000) * 1e6d; - case IrradianceUnit.MegawattPerSquareMeter: return (_value) * 1e6d; - case IrradianceUnit.MicrowattPerSquareCentimeter: return (_value*10000) * 1e-6d; - case IrradianceUnit.MicrowattPerSquareMeter: return (_value) * 1e-6d; - case IrradianceUnit.MilliwattPerSquareCentimeter: return (_value*10000) * 1e-3d; - case IrradianceUnit.MilliwattPerSquareMeter: return (_value) * 1e-3d; - case IrradianceUnit.NanowattPerSquareCentimeter: return (_value*10000) * 1e-9d; - case IrradianceUnit.NanowattPerSquareMeter: return (_value) * 1e-9d; - case IrradianceUnit.PicowattPerSquareCentimeter: return (_value*10000) * 1e-12d; - case IrradianceUnit.PicowattPerSquareMeter: return (_value) * 1e-12d; - case IrradianceUnit.WattPerSquareCentimeter: return _value*10000; - case IrradianceUnit.WattPerSquareMeter: return _value; + case IrradianceUnit.KilowattPerSquareCentimeter: return (Value*10000) * 1e3d; + case IrradianceUnit.KilowattPerSquareMeter: return (Value) * 1e3d; + case IrradianceUnit.MegawattPerSquareCentimeter: return (Value*10000) * 1e6d; + case IrradianceUnit.MegawattPerSquareMeter: return (Value) * 1e6d; + case IrradianceUnit.MicrowattPerSquareCentimeter: return (Value*10000) * 1e-6d; + case IrradianceUnit.MicrowattPerSquareMeter: return (Value) * 1e-6d; + case IrradianceUnit.MilliwattPerSquareCentimeter: return (Value*10000) * 1e-3d; + case IrradianceUnit.MilliwattPerSquareMeter: return (Value) * 1e-3d; + case IrradianceUnit.NanowattPerSquareCentimeter: return (Value*10000) * 1e-9d; + case IrradianceUnit.NanowattPerSquareMeter: return (Value) * 1e-9d; + case IrradianceUnit.PicowattPerSquareCentimeter: return (Value*10000) * 1e-12d; + case IrradianceUnit.PicowattPerSquareMeter: return (Value) * 1e-12d; + case IrradianceUnit.WattPerSquareCentimeter: return Value*10000; + case IrradianceUnit.WattPerSquareMeter: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -860,10 +857,10 @@ internal Irradiance ToBaseUnit() return new Irradiance(baseUnitValue, BaseUnit); } - private double GetValueAs(IrradianceUnit unit) + private T GetValueAs(IrradianceUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -984,7 +981,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -999,37 +996,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1053,17 +1050,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs index 060f3593a0..ce9796678f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Irradiation /// - public partial struct Irradiation : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Irradiation : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -70,12 +65,12 @@ static Irradiation() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Irradiation(double value, IrradiationUnit unit) + public Irradiation(T value, IrradiationUnit unit) { if(unit == IrradiationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -87,14 +82,14 @@ public Irradiation(double value, IrradiationUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Irradiation(double value, UnitSystem unitSystem) + public Irradiation(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -136,7 +131,7 @@ public Irradiation(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerSquareMeter. /// - public static Irradiation Zero { get; } = new Irradiation(0, BaseUnit); + public static Irradiation Zero { get; } = new Irradiation((T)0, BaseUnit); #endregion @@ -145,7 +140,9 @@ public Irradiation(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -175,37 +172,37 @@ public Irradiation(double value, UnitSystem unitSystem) /// /// Get in JoulesPerSquareCentimeter. /// - public double JoulesPerSquareCentimeter => As(IrradiationUnit.JoulePerSquareCentimeter); + public T JoulesPerSquareCentimeter => As(IrradiationUnit.JoulePerSquareCentimeter); /// /// Get in JoulesPerSquareMeter. /// - public double JoulesPerSquareMeter => As(IrradiationUnit.JoulePerSquareMeter); + public T JoulesPerSquareMeter => As(IrradiationUnit.JoulePerSquareMeter); /// /// Get in JoulesPerSquareMillimeter. /// - public double JoulesPerSquareMillimeter => As(IrradiationUnit.JoulePerSquareMillimeter); + public T JoulesPerSquareMillimeter => As(IrradiationUnit.JoulePerSquareMillimeter); /// /// Get in KilojoulesPerSquareMeter. /// - public double KilojoulesPerSquareMeter => As(IrradiationUnit.KilojoulePerSquareMeter); + public T KilojoulesPerSquareMeter => As(IrradiationUnit.KilojoulePerSquareMeter); /// /// Get in KilowattHoursPerSquareMeter. /// - public double KilowattHoursPerSquareMeter => As(IrradiationUnit.KilowattHourPerSquareMeter); + public T KilowattHoursPerSquareMeter => As(IrradiationUnit.KilowattHourPerSquareMeter); /// /// Get in MillijoulesPerSquareCentimeter. /// - public double MillijoulesPerSquareCentimeter => As(IrradiationUnit.MillijoulePerSquareCentimeter); + public T MillijoulesPerSquareCentimeter => As(IrradiationUnit.MillijoulePerSquareCentimeter); /// /// Get in WattHoursPerSquareMeter. /// - public double WattHoursPerSquareMeter => As(IrradiationUnit.WattHourPerSquareMeter); + public T WattHoursPerSquareMeter => As(IrradiationUnit.WattHourPerSquareMeter); #endregion @@ -240,64 +237,57 @@ public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] IFormatPr /// Get from JoulesPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiation FromJoulesPerSquareCentimeter(QuantityValue joulespersquarecentimeter) + public static Irradiation FromJoulesPerSquareCentimeter(T joulespersquarecentimeter) { - double value = (double) joulespersquarecentimeter; - return new Irradiation(value, IrradiationUnit.JoulePerSquareCentimeter); + return new Irradiation(joulespersquarecentimeter, IrradiationUnit.JoulePerSquareCentimeter); } /// /// Get from JoulesPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiation FromJoulesPerSquareMeter(QuantityValue joulespersquaremeter) + public static Irradiation FromJoulesPerSquareMeter(T joulespersquaremeter) { - double value = (double) joulespersquaremeter; - return new Irradiation(value, IrradiationUnit.JoulePerSquareMeter); + return new Irradiation(joulespersquaremeter, IrradiationUnit.JoulePerSquareMeter); } /// /// Get from JoulesPerSquareMillimeter. /// /// If value is NaN or Infinity. - public static Irradiation FromJoulesPerSquareMillimeter(QuantityValue joulespersquaremillimeter) + public static Irradiation FromJoulesPerSquareMillimeter(T joulespersquaremillimeter) { - double value = (double) joulespersquaremillimeter; - return new Irradiation(value, IrradiationUnit.JoulePerSquareMillimeter); + return new Irradiation(joulespersquaremillimeter, IrradiationUnit.JoulePerSquareMillimeter); } /// /// Get from KilojoulesPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiation FromKilojoulesPerSquareMeter(QuantityValue kilojoulespersquaremeter) + public static Irradiation FromKilojoulesPerSquareMeter(T kilojoulespersquaremeter) { - double value = (double) kilojoulespersquaremeter; - return new Irradiation(value, IrradiationUnit.KilojoulePerSquareMeter); + return new Irradiation(kilojoulespersquaremeter, IrradiationUnit.KilojoulePerSquareMeter); } /// /// Get from KilowattHoursPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiation FromKilowattHoursPerSquareMeter(QuantityValue kilowatthourspersquaremeter) + public static Irradiation FromKilowattHoursPerSquareMeter(T kilowatthourspersquaremeter) { - double value = (double) kilowatthourspersquaremeter; - return new Irradiation(value, IrradiationUnit.KilowattHourPerSquareMeter); + return new Irradiation(kilowatthourspersquaremeter, IrradiationUnit.KilowattHourPerSquareMeter); } /// /// Get from MillijoulesPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Irradiation FromMillijoulesPerSquareCentimeter(QuantityValue millijoulespersquarecentimeter) + public static Irradiation FromMillijoulesPerSquareCentimeter(T millijoulespersquarecentimeter) { - double value = (double) millijoulespersquarecentimeter; - return new Irradiation(value, IrradiationUnit.MillijoulePerSquareCentimeter); + return new Irradiation(millijoulespersquarecentimeter, IrradiationUnit.MillijoulePerSquareCentimeter); } /// /// Get from WattHoursPerSquareMeter. /// /// If value is NaN or Infinity. - public static Irradiation FromWattHoursPerSquareMeter(QuantityValue watthourspersquaremeter) + public static Irradiation FromWattHoursPerSquareMeter(T watthourspersquaremeter) { - double value = (double) watthourspersquaremeter; - return new Irradiation(value, IrradiationUnit.WattHourPerSquareMeter); + return new Irradiation(watthourspersquaremeter, IrradiationUnit.WattHourPerSquareMeter); } /// @@ -306,9 +296,9 @@ public static Irradiation FromWattHoursPerSquareMeter(QuantityValue watthours /// Value to convert from. /// Unit to convert from. /// unit value. - public static Irradiation From(QuantityValue value, IrradiationUnit fromUnit) + public static Irradiation From(T value, IrradiationUnit fromUnit) { - return new Irradiation((double)value, fromUnit); + return new Irradiation(value, fromUnit); } #endregion @@ -462,43 +452,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Irradi /// Negate the value. public static Irradiation operator -(Irradiation right) { - return new Irradiation(-right.Value, right.Unit); + return new Irradiation(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Irradiation operator +(Irradiation left, Irradiation right) { - return new Irradiation(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Irradiation(value, left.Unit); } /// Get from subtracting two . public static Irradiation operator -(Irradiation left, Irradiation right) { - return new Irradiation(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Irradiation(value, left.Unit); } /// Get from multiplying value and . - public static Irradiation operator *(double left, Irradiation right) + public static Irradiation operator *(T left, Irradiation right) { - return new Irradiation(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Irradiation(value, right.Unit); } /// Get from multiplying value and . - public static Irradiation operator *(Irradiation left, double right) + public static Irradiation operator *(Irradiation left, T right) { - return new Irradiation(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Irradiation(value, left.Unit); } /// Get from dividing by value. - public static Irradiation operator /(Irradiation left, double right) + public static Irradiation operator /(Irradiation left, T right) { - return new Irradiation(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Irradiation(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Irradiation left, Irradiation right) + public static T operator /(Irradiation left, Irradiation right) { - return left.JoulesPerSquareMeter / right.JoulesPerSquareMeter; + return CompiledLambdas.Divide(left.JoulesPerSquareMeter, right.JoulesPerSquareMeter); } #endregion @@ -508,25 +503,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Irradi /// Returns true if less or equal to. public static bool operator <=(Irradiation left, Irradiation right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Irradiation left, Irradiation right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Irradiation left, Irradiation right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Irradiation left, Irradiation right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -555,7 +550,7 @@ public int CompareTo(object obj) /// public int CompareTo(Irradiation other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -572,7 +567,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Irradiation other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -620,10 +615,8 @@ public bool Equals(Irradiation other, double tolerance, ComparisonType compar if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -643,17 +636,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(IrradiationUnit unit) + public T As(IrradiationUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -673,9 +666,14 @@ double IQuantity.As(Enum unit) if(!(unit is IrradiationUnit unitAsIrradiationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IrradiationUnit)} is supported.", nameof(unit)); - return As(unitAsIrradiationUnit); + var asValue = As(unitAsIrradiationUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(IrradiationUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -716,25 +714,31 @@ public Irradiation ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(IrradiationUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(IrradiationUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case IrradiationUnit.JoulePerSquareCentimeter: return _value*1e4; - case IrradiationUnit.JoulePerSquareMeter: return _value; - case IrradiationUnit.JoulePerSquareMillimeter: return _value*1e6; - case IrradiationUnit.KilojoulePerSquareMeter: return (_value) * 1e3d; - case IrradiationUnit.KilowattHourPerSquareMeter: return (_value*3600d) * 1e3d; - case IrradiationUnit.MillijoulePerSquareCentimeter: return (_value*1e4) * 1e-3d; - case IrradiationUnit.WattHourPerSquareMeter: return _value*3600d; + case IrradiationUnit.JoulePerSquareCentimeter: return Value*1e4; + case IrradiationUnit.JoulePerSquareMeter: return Value; + case IrradiationUnit.JoulePerSquareMillimeter: return Value*1e6; + case IrradiationUnit.KilojoulePerSquareMeter: return (Value) * 1e3d; + case IrradiationUnit.KilowattHourPerSquareMeter: return (Value*3600d) * 1e3d; + case IrradiationUnit.MillijoulePerSquareCentimeter: return (Value*1e4) * 1e-3d; + case IrradiationUnit.WattHourPerSquareMeter: return Value*3600d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -751,10 +755,10 @@ internal Irradiation ToBaseUnit() return new Irradiation(baseUnitValue, BaseUnit); } - private double GetValueAs(IrradiationUnit unit) + private T GetValueAs(IrradiationUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -868,7 +872,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -883,37 +887,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -937,17 +941,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs index e5d18852ca..7e0386e975 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// http://en.wikipedia.org/wiki/Viscosity /// - public partial struct KinematicViscosity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct KinematicViscosity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -71,12 +66,12 @@ static KinematicViscosity() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public KinematicViscosity(double value, KinematicViscosityUnit unit) + public KinematicViscosity(T value, KinematicViscosityUnit unit) { if(unit == KinematicViscosityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -88,14 +83,14 @@ public KinematicViscosity(double value, KinematicViscosityUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public KinematicViscosity(double value, UnitSystem unitSystem) + public KinematicViscosity(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -137,7 +132,7 @@ public KinematicViscosity(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeterPerSecond. /// - public static KinematicViscosity Zero { get; } = new KinematicViscosity(0, BaseUnit); + public static KinematicViscosity Zero { get; } = new KinematicViscosity((T)0, BaseUnit); #endregion @@ -146,7 +141,9 @@ public KinematicViscosity(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -176,42 +173,42 @@ public KinematicViscosity(double value, UnitSystem unitSystem) /// /// Get in Centistokes. /// - public double Centistokes => As(KinematicViscosityUnit.Centistokes); + public T Centistokes => As(KinematicViscosityUnit.Centistokes); /// /// Get in Decistokes. /// - public double Decistokes => As(KinematicViscosityUnit.Decistokes); + public T Decistokes => As(KinematicViscosityUnit.Decistokes); /// /// Get in Kilostokes. /// - public double Kilostokes => As(KinematicViscosityUnit.Kilostokes); + public T Kilostokes => As(KinematicViscosityUnit.Kilostokes); /// /// Get in Microstokes. /// - public double Microstokes => As(KinematicViscosityUnit.Microstokes); + public T Microstokes => As(KinematicViscosityUnit.Microstokes); /// /// Get in Millistokes. /// - public double Millistokes => As(KinematicViscosityUnit.Millistokes); + public T Millistokes => As(KinematicViscosityUnit.Millistokes); /// /// Get in Nanostokes. /// - public double Nanostokes => As(KinematicViscosityUnit.Nanostokes); + public T Nanostokes => As(KinematicViscosityUnit.Nanostokes); /// /// Get in SquareMetersPerSecond. /// - public double SquareMetersPerSecond => As(KinematicViscosityUnit.SquareMeterPerSecond); + public T SquareMetersPerSecond => As(KinematicViscosityUnit.SquareMeterPerSecond); /// /// Get in Stokes. /// - public double Stokes => As(KinematicViscosityUnit.Stokes); + public T Stokes => As(KinematicViscosityUnit.Stokes); #endregion @@ -246,73 +243,65 @@ public static string GetAbbreviation(KinematicViscosityUnit unit, [CanBeNull] IF /// Get from Centistokes. /// /// If value is NaN or Infinity. - public static KinematicViscosity FromCentistokes(QuantityValue centistokes) + public static KinematicViscosity FromCentistokes(T centistokes) { - double value = (double) centistokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Centistokes); + return new KinematicViscosity(centistokes, KinematicViscosityUnit.Centistokes); } /// /// Get from Decistokes. /// /// If value is NaN or Infinity. - public static KinematicViscosity FromDecistokes(QuantityValue decistokes) + public static KinematicViscosity FromDecistokes(T decistokes) { - double value = (double) decistokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Decistokes); + return new KinematicViscosity(decistokes, KinematicViscosityUnit.Decistokes); } /// /// Get from Kilostokes. /// /// If value is NaN or Infinity. - public static KinematicViscosity FromKilostokes(QuantityValue kilostokes) + public static KinematicViscosity FromKilostokes(T kilostokes) { - double value = (double) kilostokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Kilostokes); + return new KinematicViscosity(kilostokes, KinematicViscosityUnit.Kilostokes); } /// /// Get from Microstokes. /// /// If value is NaN or Infinity. - public static KinematicViscosity FromMicrostokes(QuantityValue microstokes) + public static KinematicViscosity FromMicrostokes(T microstokes) { - double value = (double) microstokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Microstokes); + return new KinematicViscosity(microstokes, KinematicViscosityUnit.Microstokes); } /// /// Get from Millistokes. /// /// If value is NaN or Infinity. - public static KinematicViscosity FromMillistokes(QuantityValue millistokes) + public static KinematicViscosity FromMillistokes(T millistokes) { - double value = (double) millistokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Millistokes); + return new KinematicViscosity(millistokes, KinematicViscosityUnit.Millistokes); } /// /// Get from Nanostokes. /// /// If value is NaN or Infinity. - public static KinematicViscosity FromNanostokes(QuantityValue nanostokes) + public static KinematicViscosity FromNanostokes(T nanostokes) { - double value = (double) nanostokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Nanostokes); + return new KinematicViscosity(nanostokes, KinematicViscosityUnit.Nanostokes); } /// /// Get from SquareMetersPerSecond. /// /// If value is NaN or Infinity. - public static KinematicViscosity FromSquareMetersPerSecond(QuantityValue squaremeterspersecond) + public static KinematicViscosity FromSquareMetersPerSecond(T squaremeterspersecond) { - double value = (double) squaremeterspersecond; - return new KinematicViscosity(value, KinematicViscosityUnit.SquareMeterPerSecond); + return new KinematicViscosity(squaremeterspersecond, KinematicViscosityUnit.SquareMeterPerSecond); } /// /// Get from Stokes. /// /// If value is NaN or Infinity. - public static KinematicViscosity FromStokes(QuantityValue stokes) + public static KinematicViscosity FromStokes(T stokes) { - double value = (double) stokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Stokes); + return new KinematicViscosity(stokes, KinematicViscosityUnit.Stokes); } /// @@ -321,9 +310,9 @@ public static KinematicViscosity FromStokes(QuantityValue stokes) /// Value to convert from. /// Unit to convert from. /// unit value. - public static KinematicViscosity From(QuantityValue value, KinematicViscosityUnit fromUnit) + public static KinematicViscosity From(T value, KinematicViscosityUnit fromUnit) { - return new KinematicViscosity((double)value, fromUnit); + return new KinematicViscosity(value, fromUnit); } #endregion @@ -477,43 +466,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Kinema /// Negate the value. public static KinematicViscosity operator -(KinematicViscosity right) { - return new KinematicViscosity(-right.Value, right.Unit); + return new KinematicViscosity(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static KinematicViscosity operator +(KinematicViscosity left, KinematicViscosity right) { - return new KinematicViscosity(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new KinematicViscosity(value, left.Unit); } /// Get from subtracting two . public static KinematicViscosity operator -(KinematicViscosity left, KinematicViscosity right) { - return new KinematicViscosity(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new KinematicViscosity(value, left.Unit); } /// Get from multiplying value and . - public static KinematicViscosity operator *(double left, KinematicViscosity right) + public static KinematicViscosity operator *(T left, KinematicViscosity right) { - return new KinematicViscosity(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new KinematicViscosity(value, right.Unit); } /// Get from multiplying value and . - public static KinematicViscosity operator *(KinematicViscosity left, double right) + public static KinematicViscosity operator *(KinematicViscosity left, T right) { - return new KinematicViscosity(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new KinematicViscosity(value, left.Unit); } /// Get from dividing by value. - public static KinematicViscosity operator /(KinematicViscosity left, double right) + public static KinematicViscosity operator /(KinematicViscosity left, T right) { - return new KinematicViscosity(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new KinematicViscosity(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(KinematicViscosity left, KinematicViscosity right) + public static T operator /(KinematicViscosity left, KinematicViscosity right) { - return left.SquareMetersPerSecond / right.SquareMetersPerSecond; + return CompiledLambdas.Divide(left.SquareMetersPerSecond, right.SquareMetersPerSecond); } #endregion @@ -523,25 +517,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Kinema /// Returns true if less or equal to. public static bool operator <=(KinematicViscosity left, KinematicViscosity right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(KinematicViscosity left, KinematicViscosity right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(KinematicViscosity left, KinematicViscosity right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(KinematicViscosity left, KinematicViscosity right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -570,7 +564,7 @@ public int CompareTo(object obj) /// public int CompareTo(KinematicViscosity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -587,7 +581,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(KinematicViscosity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -635,10 +629,8 @@ public bool Equals(KinematicViscosity other, double tolerance, ComparisonType if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -658,17 +650,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(KinematicViscosityUnit unit) + public T As(KinematicViscosityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -688,9 +680,14 @@ double IQuantity.As(Enum unit) if(!(unit is KinematicViscosityUnit unitAsKinematicViscosityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(KinematicViscosityUnit)} is supported.", nameof(unit)); - return As(unitAsKinematicViscosityUnit); + var asValue = As(unitAsKinematicViscosityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(KinematicViscosityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -731,26 +728,32 @@ public KinematicViscosity ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(KinematicViscosityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(KinematicViscosityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case KinematicViscosityUnit.Centistokes: return (_value/1e4) * 1e-2d; - case KinematicViscosityUnit.Decistokes: return (_value/1e4) * 1e-1d; - case KinematicViscosityUnit.Kilostokes: return (_value/1e4) * 1e3d; - case KinematicViscosityUnit.Microstokes: return (_value/1e4) * 1e-6d; - case KinematicViscosityUnit.Millistokes: return (_value/1e4) * 1e-3d; - case KinematicViscosityUnit.Nanostokes: return (_value/1e4) * 1e-9d; - case KinematicViscosityUnit.SquareMeterPerSecond: return _value; - case KinematicViscosityUnit.Stokes: return _value/1e4; + case KinematicViscosityUnit.Centistokes: return (Value/1e4) * 1e-2d; + case KinematicViscosityUnit.Decistokes: return (Value/1e4) * 1e-1d; + case KinematicViscosityUnit.Kilostokes: return (Value/1e4) * 1e3d; + case KinematicViscosityUnit.Microstokes: return (Value/1e4) * 1e-6d; + case KinematicViscosityUnit.Millistokes: return (Value/1e4) * 1e-3d; + case KinematicViscosityUnit.Nanostokes: return (Value/1e4) * 1e-9d; + case KinematicViscosityUnit.SquareMeterPerSecond: return Value; + case KinematicViscosityUnit.Stokes: return Value/1e4; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -767,10 +770,10 @@ internal KinematicViscosity ToBaseUnit() return new KinematicViscosity(baseUnitValue, BaseUnit); } - private double GetValueAs(KinematicViscosityUnit unit) + private T GetValueAs(KinematicViscosityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -885,7 +888,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -900,37 +903,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -954,17 +957,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs index b2052d4023..8cd62d9307 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Lapse rate is the rate at which Earth's atmospheric temperature decreases with an increase in altitude, or increases with the decrease in altitude. /// - public partial struct LapseRate : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct LapseRate : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -61,12 +56,12 @@ static LapseRate() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public LapseRate(double value, LapseRateUnit unit) + public LapseRate(T value, LapseRateUnit unit) { if(unit == LapseRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -78,14 +73,14 @@ public LapseRate(double value, LapseRateUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public LapseRate(double value, UnitSystem unitSystem) + public LapseRate(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -127,7 +122,7 @@ public LapseRate(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit DegreeCelsiusPerKilometer. /// - public static LapseRate Zero { get; } = new LapseRate(0, BaseUnit); + public static LapseRate Zero { get; } = new LapseRate((T)0, BaseUnit); #endregion @@ -136,7 +131,9 @@ public LapseRate(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -166,7 +163,7 @@ public LapseRate(double value, UnitSystem unitSystem) /// /// Get in DegreesCelciusPerKilometer. /// - public double DegreesCelciusPerKilometer => As(LapseRateUnit.DegreeCelsiusPerKilometer); + public T DegreesCelciusPerKilometer => As(LapseRateUnit.DegreeCelsiusPerKilometer); #endregion @@ -201,10 +198,9 @@ public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] IFormatProv /// Get from DegreesCelciusPerKilometer. /// /// If value is NaN or Infinity. - public static LapseRate FromDegreesCelciusPerKilometer(QuantityValue degreescelciusperkilometer) + public static LapseRate FromDegreesCelciusPerKilometer(T degreescelciusperkilometer) { - double value = (double) degreescelciusperkilometer; - return new LapseRate(value, LapseRateUnit.DegreeCelsiusPerKilometer); + return new LapseRate(degreescelciusperkilometer, LapseRateUnit.DegreeCelsiusPerKilometer); } /// @@ -213,9 +209,9 @@ public static LapseRate FromDegreesCelciusPerKilometer(QuantityValue degreesc /// Value to convert from. /// Unit to convert from. /// unit value. - public static LapseRate From(QuantityValue value, LapseRateUnit fromUnit) + public static LapseRate From(T value, LapseRateUnit fromUnit) { - return new LapseRate((double)value, fromUnit); + return new LapseRate(value, fromUnit); } #endregion @@ -369,43 +365,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out LapseR /// Negate the value. public static LapseRate operator -(LapseRate right) { - return new LapseRate(-right.Value, right.Unit); + return new LapseRate(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static LapseRate operator +(LapseRate left, LapseRate right) { - return new LapseRate(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new LapseRate(value, left.Unit); } /// Get from subtracting two . public static LapseRate operator -(LapseRate left, LapseRate right) { - return new LapseRate(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new LapseRate(value, left.Unit); } /// Get from multiplying value and . - public static LapseRate operator *(double left, LapseRate right) + public static LapseRate operator *(T left, LapseRate right) { - return new LapseRate(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new LapseRate(value, right.Unit); } /// Get from multiplying value and . - public static LapseRate operator *(LapseRate left, double right) + public static LapseRate operator *(LapseRate left, T right) { - return new LapseRate(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new LapseRate(value, left.Unit); } /// Get from dividing by value. - public static LapseRate operator /(LapseRate left, double right) + public static LapseRate operator /(LapseRate left, T right) { - return new LapseRate(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new LapseRate(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(LapseRate left, LapseRate right) + public static T operator /(LapseRate left, LapseRate right) { - return left.DegreesCelciusPerKilometer / right.DegreesCelciusPerKilometer; + return CompiledLambdas.Divide(left.DegreesCelciusPerKilometer, right.DegreesCelciusPerKilometer); } #endregion @@ -415,25 +416,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out LapseR /// Returns true if less or equal to. public static bool operator <=(LapseRate left, LapseRate right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(LapseRate left, LapseRate right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(LapseRate left, LapseRate right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(LapseRate left, LapseRate right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -462,7 +463,7 @@ public int CompareTo(object obj) /// public int CompareTo(LapseRate other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -479,7 +480,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(LapseRate other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -527,10 +528,8 @@ public bool Equals(LapseRate other, double tolerance, ComparisonType comparis if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -550,17 +549,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(LapseRateUnit unit) + public T As(LapseRateUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -580,9 +579,14 @@ double IQuantity.As(Enum unit) if(!(unit is LapseRateUnit unitAsLapseRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LapseRateUnit)} is supported.", nameof(unit)); - return As(unitAsLapseRateUnit); + var asValue = As(unitAsLapseRateUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(LapseRateUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -623,19 +627,25 @@ public LapseRate ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(LapseRateUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(LapseRateUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case LapseRateUnit.DegreeCelsiusPerKilometer: return _value; + case LapseRateUnit.DegreeCelsiusPerKilometer: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -652,10 +662,10 @@ internal LapseRate ToBaseUnit() return new LapseRate(baseUnitValue, BaseUnit); } - private double GetValueAs(LapseRateUnit unit) + private T GetValueAs(LapseRateUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -763,7 +773,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -778,37 +788,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -832,17 +842,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs index a73cd7d2d7..ad9ed1fb24 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Many different units of length have been used around the world. The main units in modern use are U.S. customary units in the United States and the Metric system elsewhere. British Imperial units are still used for some purposes in the United Kingdom and some other countries. The metric system is sub-divided into SI and non-SI units. /// - public partial struct Length : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Length : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -92,12 +87,12 @@ static Length() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Length(double value, LengthUnit unit) + public Length(T value, LengthUnit unit) { if(unit == LengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -109,14 +104,14 @@ public Length(double value, LengthUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Length(double value, UnitSystem unitSystem) + public Length(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -158,7 +153,7 @@ public Length(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Meter. /// - public static Length Zero { get; } = new Length(0, BaseUnit); + public static Length Zero { get; } = new Length((T)0, BaseUnit); #endregion @@ -167,7 +162,9 @@ public Length(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -197,162 +194,162 @@ public Length(double value, UnitSystem unitSystem) /// /// Get in AstronomicalUnits. /// - public double AstronomicalUnits => As(LengthUnit.AstronomicalUnit); + public T AstronomicalUnits => As(LengthUnit.AstronomicalUnit); /// /// Get in Centimeters. /// - public double Centimeters => As(LengthUnit.Centimeter); + public T Centimeters => As(LengthUnit.Centimeter); /// /// Get in Decimeters. /// - public double Decimeters => As(LengthUnit.Decimeter); + public T Decimeters => As(LengthUnit.Decimeter); /// /// Get in DtpPicas. /// - public double DtpPicas => As(LengthUnit.DtpPica); + public T DtpPicas => As(LengthUnit.DtpPica); /// /// Get in DtpPoints. /// - public double DtpPoints => As(LengthUnit.DtpPoint); + public T DtpPoints => As(LengthUnit.DtpPoint); /// /// Get in Fathoms. /// - public double Fathoms => As(LengthUnit.Fathom); + public T Fathoms => As(LengthUnit.Fathom); /// /// Get in Feet. /// - public double Feet => As(LengthUnit.Foot); + public T Feet => As(LengthUnit.Foot); /// /// Get in Hands. /// - public double Hands => As(LengthUnit.Hand); + public T Hands => As(LengthUnit.Hand); /// /// Get in Hectometers. /// - public double Hectometers => As(LengthUnit.Hectometer); + public T Hectometers => As(LengthUnit.Hectometer); /// /// Get in Inches. /// - public double Inches => As(LengthUnit.Inch); + public T Inches => As(LengthUnit.Inch); /// /// Get in KilolightYears. /// - public double KilolightYears => As(LengthUnit.KilolightYear); + public T KilolightYears => As(LengthUnit.KilolightYear); /// /// Get in Kilometers. /// - public double Kilometers => As(LengthUnit.Kilometer); + public T Kilometers => As(LengthUnit.Kilometer); /// /// Get in Kiloparsecs. /// - public double Kiloparsecs => As(LengthUnit.Kiloparsec); + public T Kiloparsecs => As(LengthUnit.Kiloparsec); /// /// Get in LightYears. /// - public double LightYears => As(LengthUnit.LightYear); + public T LightYears => As(LengthUnit.LightYear); /// /// Get in MegalightYears. /// - public double MegalightYears => As(LengthUnit.MegalightYear); + public T MegalightYears => As(LengthUnit.MegalightYear); /// /// Get in Megaparsecs. /// - public double Megaparsecs => As(LengthUnit.Megaparsec); + public T Megaparsecs => As(LengthUnit.Megaparsec); /// /// Get in Meters. /// - public double Meters => As(LengthUnit.Meter); + public T Meters => As(LengthUnit.Meter); /// /// Get in Microinches. /// - public double Microinches => As(LengthUnit.Microinch); + public T Microinches => As(LengthUnit.Microinch); /// /// Get in Micrometers. /// - public double Micrometers => As(LengthUnit.Micrometer); + public T Micrometers => As(LengthUnit.Micrometer); /// /// Get in Mils. /// - public double Mils => As(LengthUnit.Mil); + public T Mils => As(LengthUnit.Mil); /// /// Get in Miles. /// - public double Miles => As(LengthUnit.Mile); + public T Miles => As(LengthUnit.Mile); /// /// Get in Millimeters. /// - public double Millimeters => As(LengthUnit.Millimeter); + public T Millimeters => As(LengthUnit.Millimeter); /// /// Get in Nanometers. /// - public double Nanometers => As(LengthUnit.Nanometer); + public T Nanometers => As(LengthUnit.Nanometer); /// /// Get in NauticalMiles. /// - public double NauticalMiles => As(LengthUnit.NauticalMile); + public T NauticalMiles => As(LengthUnit.NauticalMile); /// /// Get in Parsecs. /// - public double Parsecs => As(LengthUnit.Parsec); + public T Parsecs => As(LengthUnit.Parsec); /// /// Get in PrinterPicas. /// - public double PrinterPicas => As(LengthUnit.PrinterPica); + public T PrinterPicas => As(LengthUnit.PrinterPica); /// /// Get in PrinterPoints. /// - public double PrinterPoints => As(LengthUnit.PrinterPoint); + public T PrinterPoints => As(LengthUnit.PrinterPoint); /// /// Get in Shackles. /// - public double Shackles => As(LengthUnit.Shackle); + public T Shackles => As(LengthUnit.Shackle); /// /// Get in SolarRadiuses. /// - public double SolarRadiuses => As(LengthUnit.SolarRadius); + public T SolarRadiuses => As(LengthUnit.SolarRadius); /// /// Get in Twips. /// - public double Twips => As(LengthUnit.Twip); + public T Twips => As(LengthUnit.Twip); /// /// Get in UsSurveyFeet. /// - public double UsSurveyFeet => As(LengthUnit.UsSurveyFoot); + public T UsSurveyFeet => As(LengthUnit.UsSurveyFoot); /// /// Get in Yards. /// - public double Yards => As(LengthUnit.Yard); + public T Yards => As(LengthUnit.Yard); #endregion @@ -387,289 +384,257 @@ public static string GetAbbreviation(LengthUnit unit, [CanBeNull] IFormatProvide /// Get from AstronomicalUnits. /// /// If value is NaN or Infinity. - public static Length FromAstronomicalUnits(QuantityValue astronomicalunits) + public static Length FromAstronomicalUnits(T astronomicalunits) { - double value = (double) astronomicalunits; - return new Length(value, LengthUnit.AstronomicalUnit); + return new Length(astronomicalunits, LengthUnit.AstronomicalUnit); } /// /// Get from Centimeters. /// /// If value is NaN or Infinity. - public static Length FromCentimeters(QuantityValue centimeters) + public static Length FromCentimeters(T centimeters) { - double value = (double) centimeters; - return new Length(value, LengthUnit.Centimeter); + return new Length(centimeters, LengthUnit.Centimeter); } /// /// Get from Decimeters. /// /// If value is NaN or Infinity. - public static Length FromDecimeters(QuantityValue decimeters) + public static Length FromDecimeters(T decimeters) { - double value = (double) decimeters; - return new Length(value, LengthUnit.Decimeter); + return new Length(decimeters, LengthUnit.Decimeter); } /// /// Get from DtpPicas. /// /// If value is NaN or Infinity. - public static Length FromDtpPicas(QuantityValue dtppicas) + public static Length FromDtpPicas(T dtppicas) { - double value = (double) dtppicas; - return new Length(value, LengthUnit.DtpPica); + return new Length(dtppicas, LengthUnit.DtpPica); } /// /// Get from DtpPoints. /// /// If value is NaN or Infinity. - public static Length FromDtpPoints(QuantityValue dtppoints) + public static Length FromDtpPoints(T dtppoints) { - double value = (double) dtppoints; - return new Length(value, LengthUnit.DtpPoint); + return new Length(dtppoints, LengthUnit.DtpPoint); } /// /// Get from Fathoms. /// /// If value is NaN or Infinity. - public static Length FromFathoms(QuantityValue fathoms) + public static Length FromFathoms(T fathoms) { - double value = (double) fathoms; - return new Length(value, LengthUnit.Fathom); + return new Length(fathoms, LengthUnit.Fathom); } /// /// Get from Feet. /// /// If value is NaN or Infinity. - public static Length FromFeet(QuantityValue feet) + public static Length FromFeet(T feet) { - double value = (double) feet; - return new Length(value, LengthUnit.Foot); + return new Length(feet, LengthUnit.Foot); } /// /// Get from Hands. /// /// If value is NaN or Infinity. - public static Length FromHands(QuantityValue hands) + public static Length FromHands(T hands) { - double value = (double) hands; - return new Length(value, LengthUnit.Hand); + return new Length(hands, LengthUnit.Hand); } /// /// Get from Hectometers. /// /// If value is NaN or Infinity. - public static Length FromHectometers(QuantityValue hectometers) + public static Length FromHectometers(T hectometers) { - double value = (double) hectometers; - return new Length(value, LengthUnit.Hectometer); + return new Length(hectometers, LengthUnit.Hectometer); } /// /// Get from Inches. /// /// If value is NaN or Infinity. - public static Length FromInches(QuantityValue inches) + public static Length FromInches(T inches) { - double value = (double) inches; - return new Length(value, LengthUnit.Inch); + return new Length(inches, LengthUnit.Inch); } /// /// Get from KilolightYears. /// /// If value is NaN or Infinity. - public static Length FromKilolightYears(QuantityValue kilolightyears) + public static Length FromKilolightYears(T kilolightyears) { - double value = (double) kilolightyears; - return new Length(value, LengthUnit.KilolightYear); + return new Length(kilolightyears, LengthUnit.KilolightYear); } /// /// Get from Kilometers. /// /// If value is NaN or Infinity. - public static Length FromKilometers(QuantityValue kilometers) + public static Length FromKilometers(T kilometers) { - double value = (double) kilometers; - return new Length(value, LengthUnit.Kilometer); + return new Length(kilometers, LengthUnit.Kilometer); } /// /// Get from Kiloparsecs. /// /// If value is NaN or Infinity. - public static Length FromKiloparsecs(QuantityValue kiloparsecs) + public static Length FromKiloparsecs(T kiloparsecs) { - double value = (double) kiloparsecs; - return new Length(value, LengthUnit.Kiloparsec); + return new Length(kiloparsecs, LengthUnit.Kiloparsec); } /// /// Get from LightYears. /// /// If value is NaN or Infinity. - public static Length FromLightYears(QuantityValue lightyears) + public static Length FromLightYears(T lightyears) { - double value = (double) lightyears; - return new Length(value, LengthUnit.LightYear); + return new Length(lightyears, LengthUnit.LightYear); } /// /// Get from MegalightYears. /// /// If value is NaN or Infinity. - public static Length FromMegalightYears(QuantityValue megalightyears) + public static Length FromMegalightYears(T megalightyears) { - double value = (double) megalightyears; - return new Length(value, LengthUnit.MegalightYear); + return new Length(megalightyears, LengthUnit.MegalightYear); } /// /// Get from Megaparsecs. /// /// If value is NaN or Infinity. - public static Length FromMegaparsecs(QuantityValue megaparsecs) + public static Length FromMegaparsecs(T megaparsecs) { - double value = (double) megaparsecs; - return new Length(value, LengthUnit.Megaparsec); + return new Length(megaparsecs, LengthUnit.Megaparsec); } /// /// Get from Meters. /// /// If value is NaN or Infinity. - public static Length FromMeters(QuantityValue meters) + public static Length FromMeters(T meters) { - double value = (double) meters; - return new Length(value, LengthUnit.Meter); + return new Length(meters, LengthUnit.Meter); } /// /// Get from Microinches. /// /// If value is NaN or Infinity. - public static Length FromMicroinches(QuantityValue microinches) + public static Length FromMicroinches(T microinches) { - double value = (double) microinches; - return new Length(value, LengthUnit.Microinch); + return new Length(microinches, LengthUnit.Microinch); } /// /// Get from Micrometers. /// /// If value is NaN or Infinity. - public static Length FromMicrometers(QuantityValue micrometers) + public static Length FromMicrometers(T micrometers) { - double value = (double) micrometers; - return new Length(value, LengthUnit.Micrometer); + return new Length(micrometers, LengthUnit.Micrometer); } /// /// Get from Mils. /// /// If value is NaN or Infinity. - public static Length FromMils(QuantityValue mils) + public static Length FromMils(T mils) { - double value = (double) mils; - return new Length(value, LengthUnit.Mil); + return new Length(mils, LengthUnit.Mil); } /// /// Get from Miles. /// /// If value is NaN or Infinity. - public static Length FromMiles(QuantityValue miles) + public static Length FromMiles(T miles) { - double value = (double) miles; - return new Length(value, LengthUnit.Mile); + return new Length(miles, LengthUnit.Mile); } /// /// Get from Millimeters. /// /// If value is NaN or Infinity. - public static Length FromMillimeters(QuantityValue millimeters) + public static Length FromMillimeters(T millimeters) { - double value = (double) millimeters; - return new Length(value, LengthUnit.Millimeter); + return new Length(millimeters, LengthUnit.Millimeter); } /// /// Get from Nanometers. /// /// If value is NaN or Infinity. - public static Length FromNanometers(QuantityValue nanometers) + public static Length FromNanometers(T nanometers) { - double value = (double) nanometers; - return new Length(value, LengthUnit.Nanometer); + return new Length(nanometers, LengthUnit.Nanometer); } /// /// Get from NauticalMiles. /// /// If value is NaN or Infinity. - public static Length FromNauticalMiles(QuantityValue nauticalmiles) + public static Length FromNauticalMiles(T nauticalmiles) { - double value = (double) nauticalmiles; - return new Length(value, LengthUnit.NauticalMile); + return new Length(nauticalmiles, LengthUnit.NauticalMile); } /// /// Get from Parsecs. /// /// If value is NaN or Infinity. - public static Length FromParsecs(QuantityValue parsecs) + public static Length FromParsecs(T parsecs) { - double value = (double) parsecs; - return new Length(value, LengthUnit.Parsec); + return new Length(parsecs, LengthUnit.Parsec); } /// /// Get from PrinterPicas. /// /// If value is NaN or Infinity. - public static Length FromPrinterPicas(QuantityValue printerpicas) + public static Length FromPrinterPicas(T printerpicas) { - double value = (double) printerpicas; - return new Length(value, LengthUnit.PrinterPica); + return new Length(printerpicas, LengthUnit.PrinterPica); } /// /// Get from PrinterPoints. /// /// If value is NaN or Infinity. - public static Length FromPrinterPoints(QuantityValue printerpoints) + public static Length FromPrinterPoints(T printerpoints) { - double value = (double) printerpoints; - return new Length(value, LengthUnit.PrinterPoint); + return new Length(printerpoints, LengthUnit.PrinterPoint); } /// /// Get from Shackles. /// /// If value is NaN or Infinity. - public static Length FromShackles(QuantityValue shackles) + public static Length FromShackles(T shackles) { - double value = (double) shackles; - return new Length(value, LengthUnit.Shackle); + return new Length(shackles, LengthUnit.Shackle); } /// /// Get from SolarRadiuses. /// /// If value is NaN or Infinity. - public static Length FromSolarRadiuses(QuantityValue solarradiuses) + public static Length FromSolarRadiuses(T solarradiuses) { - double value = (double) solarradiuses; - return new Length(value, LengthUnit.SolarRadius); + return new Length(solarradiuses, LengthUnit.SolarRadius); } /// /// Get from Twips. /// /// If value is NaN or Infinity. - public static Length FromTwips(QuantityValue twips) + public static Length FromTwips(T twips) { - double value = (double) twips; - return new Length(value, LengthUnit.Twip); + return new Length(twips, LengthUnit.Twip); } /// /// Get from UsSurveyFeet. /// /// If value is NaN or Infinity. - public static Length FromUsSurveyFeet(QuantityValue ussurveyfeet) + public static Length FromUsSurveyFeet(T ussurveyfeet) { - double value = (double) ussurveyfeet; - return new Length(value, LengthUnit.UsSurveyFoot); + return new Length(ussurveyfeet, LengthUnit.UsSurveyFoot); } /// /// Get from Yards. /// /// If value is NaN or Infinity. - public static Length FromYards(QuantityValue yards) + public static Length FromYards(T yards) { - double value = (double) yards; - return new Length(value, LengthUnit.Yard); + return new Length(yards, LengthUnit.Yard); } /// @@ -678,9 +643,9 @@ public static Length FromYards(QuantityValue yards) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Length From(QuantityValue value, LengthUnit fromUnit) + public static Length From(T value, LengthUnit fromUnit) { - return new Length((double)value, fromUnit); + return new Length(value, fromUnit); } #endregion @@ -834,43 +799,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Length /// Negate the value. public static Length operator -(Length right) { - return new Length(-right.Value, right.Unit); + return new Length(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Length operator +(Length left, Length right) { - return new Length(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Length(value, left.Unit); } /// Get from subtracting two . public static Length operator -(Length left, Length right) { - return new Length(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Length(value, left.Unit); } /// Get from multiplying value and . - public static Length operator *(double left, Length right) + public static Length operator *(T left, Length right) { - return new Length(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Length(value, right.Unit); } /// Get from multiplying value and . - public static Length operator *(Length left, double right) + public static Length operator *(Length left, T right) { - return new Length(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Length(value, left.Unit); } /// Get from dividing by value. - public static Length operator /(Length left, double right) + public static Length operator /(Length left, T right) { - return new Length(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Length(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Length left, Length right) + public static T operator /(Length left, Length right) { - return left.Meters / right.Meters; + return CompiledLambdas.Divide(left.Meters, right.Meters); } #endregion @@ -880,25 +850,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Length /// Returns true if less or equal to. public static bool operator <=(Length left, Length right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Length left, Length right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Length left, Length right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Length left, Length right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -927,7 +897,7 @@ public int CompareTo(object obj) /// public int CompareTo(Length other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -944,7 +914,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Length other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -992,10 +962,8 @@ public bool Equals(Length other, double tolerance, ComparisonType comparisonT if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -1015,17 +983,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(LengthUnit unit) + public T As(LengthUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1045,9 +1013,14 @@ double IQuantity.As(Enum unit) if(!(unit is LengthUnit unitAsLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LengthUnit)} is supported.", nameof(unit)); - return As(unitAsLengthUnit); + var asValue = As(unitAsLengthUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(LengthUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -1088,50 +1061,56 @@ public Length ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(LengthUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(LengthUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case LengthUnit.AstronomicalUnit: return _value * 1.4959787070e11; - case LengthUnit.Centimeter: return (_value) * 1e-2d; - case LengthUnit.Decimeter: return (_value) * 1e-1d; - case LengthUnit.DtpPica: return _value/236.220472441; - case LengthUnit.DtpPoint: return (_value/72)*2.54e-2; - case LengthUnit.Fathom: return _value*1.8288; - case LengthUnit.Foot: return _value*0.3048; - case LengthUnit.Hand: return _value * 1.016e-1; - case LengthUnit.Hectometer: return (_value) * 1e2d; - case LengthUnit.Inch: return _value*2.54e-2; - case LengthUnit.KilolightYear: return (_value * 9.46073047258e15) * 1e3d; - case LengthUnit.Kilometer: return (_value) * 1e3d; - case LengthUnit.Kiloparsec: return (_value * 3.08567758128e16) * 1e3d; - case LengthUnit.LightYear: return _value * 9.46073047258e15; - case LengthUnit.MegalightYear: return (_value * 9.46073047258e15) * 1e6d; - case LengthUnit.Megaparsec: return (_value * 3.08567758128e16) * 1e6d; - case LengthUnit.Meter: return _value; - case LengthUnit.Microinch: return _value*2.54e-8; - case LengthUnit.Micrometer: return (_value) * 1e-6d; - case LengthUnit.Mil: return _value*2.54e-5; - case LengthUnit.Mile: return _value*1609.34; - case LengthUnit.Millimeter: return (_value) * 1e-3d; - case LengthUnit.Nanometer: return (_value) * 1e-9d; - case LengthUnit.NauticalMile: return _value*1852; - case LengthUnit.Parsec: return _value * 3.08567758128e16; - case LengthUnit.PrinterPica: return _value/237.106301584; - case LengthUnit.PrinterPoint: return (_value/72.27)*2.54e-2; - case LengthUnit.Shackle: return _value*27.432; - case LengthUnit.SolarRadius: return _value * 6.95510000E+08; - case LengthUnit.Twip: return _value/56692.913385826; - case LengthUnit.UsSurveyFoot: return _value*1200/3937; - case LengthUnit.Yard: return _value*0.9144; + case LengthUnit.AstronomicalUnit: return Value * 1.4959787070e11; + case LengthUnit.Centimeter: return (Value) * 1e-2d; + case LengthUnit.Decimeter: return (Value) * 1e-1d; + case LengthUnit.DtpPica: return Value/236.220472441; + case LengthUnit.DtpPoint: return (Value/72)*2.54e-2; + case LengthUnit.Fathom: return Value*1.8288; + case LengthUnit.Foot: return Value*0.3048; + case LengthUnit.Hand: return Value * 1.016e-1; + case LengthUnit.Hectometer: return (Value) * 1e2d; + case LengthUnit.Inch: return Value*2.54e-2; + case LengthUnit.KilolightYear: return (Value * 9.46073047258e15) * 1e3d; + case LengthUnit.Kilometer: return (Value) * 1e3d; + case LengthUnit.Kiloparsec: return (Value * 3.08567758128e16) * 1e3d; + case LengthUnit.LightYear: return Value * 9.46073047258e15; + case LengthUnit.MegalightYear: return (Value * 9.46073047258e15) * 1e6d; + case LengthUnit.Megaparsec: return (Value * 3.08567758128e16) * 1e6d; + case LengthUnit.Meter: return Value; + case LengthUnit.Microinch: return Value*2.54e-8; + case LengthUnit.Micrometer: return (Value) * 1e-6d; + case LengthUnit.Mil: return Value*2.54e-5; + case LengthUnit.Mile: return Value*1609.34; + case LengthUnit.Millimeter: return (Value) * 1e-3d; + case LengthUnit.Nanometer: return (Value) * 1e-9d; + case LengthUnit.NauticalMile: return Value*1852; + case LengthUnit.Parsec: return Value * 3.08567758128e16; + case LengthUnit.PrinterPica: return Value/237.106301584; + case LengthUnit.PrinterPoint: return (Value/72.27)*2.54e-2; + case LengthUnit.Shackle: return Value*27.432; + case LengthUnit.SolarRadius: return Value * 6.95510000E+08; + case LengthUnit.Twip: return Value/56692.913385826; + case LengthUnit.UsSurveyFoot: return Value*1200/3937; + case LengthUnit.Yard: return Value*0.9144; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -1148,10 +1127,10 @@ internal Length ToBaseUnit() return new Length(baseUnitValue, BaseUnit); } - private double GetValueAs(LengthUnit unit) + private T GetValueAs(LengthUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1290,7 +1269,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1305,37 +1284,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1359,17 +1338,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Level.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.g.cs index 828b410167..d7a878f0d8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Level is the logarithm of the ratio of a quantity Q to a reference value of that quantity, Q₀, expressed in dimensionless units. /// - public partial struct Level : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Level : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -62,12 +57,12 @@ static Level() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Level(double value, LevelUnit unit) + public Level(T value, LevelUnit unit) { if(unit == LevelUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -79,14 +74,14 @@ public Level(double value, LevelUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Level(double value, UnitSystem unitSystem) + public Level(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -128,7 +123,7 @@ public Level(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Decibel. /// - public static Level Zero { get; } = new Level(0, BaseUnit); + public static Level Zero { get; } = new Level((T)0, BaseUnit); #endregion @@ -137,7 +132,9 @@ public Level(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -167,12 +164,12 @@ public Level(double value, UnitSystem unitSystem) /// /// Get in Decibels. /// - public double Decibels => As(LevelUnit.Decibel); + public T Decibels => As(LevelUnit.Decibel); /// /// Get in Nepers. /// - public double Nepers => As(LevelUnit.Neper); + public T Nepers => As(LevelUnit.Neper); #endregion @@ -207,19 +204,17 @@ public static string GetAbbreviation(LevelUnit unit, [CanBeNull] IFormatProvider /// Get from Decibels. /// /// If value is NaN or Infinity. - public static Level FromDecibels(QuantityValue decibels) + public static Level FromDecibels(T decibels) { - double value = (double) decibels; - return new Level(value, LevelUnit.Decibel); + return new Level(decibels, LevelUnit.Decibel); } /// /// Get from Nepers. /// /// If value is NaN or Infinity. - public static Level FromNepers(QuantityValue nepers) + public static Level FromNepers(T nepers) { - double value = (double) nepers; - return new Level(value, LevelUnit.Neper); + return new Level(nepers, LevelUnit.Neper); } /// @@ -228,9 +223,9 @@ public static Level FromNepers(QuantityValue nepers) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Level From(QuantityValue value, LevelUnit fromUnit) + public static Level From(T value, LevelUnit fromUnit) { - return new Level((double)value, fromUnit); + return new Level(value, fromUnit); } #endregion @@ -438,25 +433,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out LevelU /// Returns true if less or equal to. public static bool operator <=(Level left, Level right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Level left, Level right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Level left, Level right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Level left, Level right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -485,7 +480,7 @@ public int CompareTo(object obj) /// public int CompareTo(Level other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -502,7 +497,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Level other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -550,10 +545,8 @@ public bool Equals(Level other, double tolerance, ComparisonType comparisonTy if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -573,17 +566,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(LevelUnit unit) + public T As(LevelUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -603,9 +596,14 @@ double IQuantity.As(Enum unit) if(!(unit is LevelUnit unitAsLevelUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LevelUnit)} is supported.", nameof(unit)); - return As(unitAsLevelUnit); + var asValue = As(unitAsLevelUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(LevelUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -646,20 +644,26 @@ public Level ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(LevelUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(LevelUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case LevelUnit.Decibel: return _value; - case LevelUnit.Neper: return (1/0.115129254)*_value; + case LevelUnit.Decibel: return Value; + case LevelUnit.Neper: return (1/0.115129254)*Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -676,10 +680,10 @@ internal Level ToBaseUnit() return new Level(baseUnitValue, BaseUnit); } - private double GetValueAs(LevelUnit unit) + private T GetValueAs(LevelUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -788,7 +792,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -803,37 +807,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -857,17 +861,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs index cd6cf643cb..2b826cb1e1 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// http://en.wikipedia.org/wiki/Linear_density /// - public partial struct LinearDensity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct LinearDensity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -66,12 +61,12 @@ static LinearDensity() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public LinearDensity(double value, LinearDensityUnit unit) + public LinearDensity(T value, LinearDensityUnit unit) { if(unit == LinearDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -83,14 +78,14 @@ public LinearDensity(double value, LinearDensityUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public LinearDensity(double value, UnitSystem unitSystem) + public LinearDensity(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -132,7 +127,7 @@ public LinearDensity(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerMeter. /// - public static LinearDensity Zero { get; } = new LinearDensity(0, BaseUnit); + public static LinearDensity Zero { get; } = new LinearDensity((T)0, BaseUnit); #endregion @@ -141,7 +136,9 @@ public LinearDensity(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -171,17 +168,17 @@ public LinearDensity(double value, UnitSystem unitSystem) /// /// Get in GramsPerMeter. /// - public double GramsPerMeter => As(LinearDensityUnit.GramPerMeter); + public T GramsPerMeter => As(LinearDensityUnit.GramPerMeter); /// /// Get in KilogramsPerMeter. /// - public double KilogramsPerMeter => As(LinearDensityUnit.KilogramPerMeter); + public T KilogramsPerMeter => As(LinearDensityUnit.KilogramPerMeter); /// /// Get in PoundsPerFoot. /// - public double PoundsPerFoot => As(LinearDensityUnit.PoundPerFoot); + public T PoundsPerFoot => As(LinearDensityUnit.PoundPerFoot); #endregion @@ -216,28 +213,25 @@ public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] IFormat /// Get from GramsPerMeter. /// /// If value is NaN or Infinity. - public static LinearDensity FromGramsPerMeter(QuantityValue gramspermeter) + public static LinearDensity FromGramsPerMeter(T gramspermeter) { - double value = (double) gramspermeter; - return new LinearDensity(value, LinearDensityUnit.GramPerMeter); + return new LinearDensity(gramspermeter, LinearDensityUnit.GramPerMeter); } /// /// Get from KilogramsPerMeter. /// /// If value is NaN or Infinity. - public static LinearDensity FromKilogramsPerMeter(QuantityValue kilogramspermeter) + public static LinearDensity FromKilogramsPerMeter(T kilogramspermeter) { - double value = (double) kilogramspermeter; - return new LinearDensity(value, LinearDensityUnit.KilogramPerMeter); + return new LinearDensity(kilogramspermeter, LinearDensityUnit.KilogramPerMeter); } /// /// Get from PoundsPerFoot. /// /// If value is NaN or Infinity. - public static LinearDensity FromPoundsPerFoot(QuantityValue poundsperfoot) + public static LinearDensity FromPoundsPerFoot(T poundsperfoot) { - double value = (double) poundsperfoot; - return new LinearDensity(value, LinearDensityUnit.PoundPerFoot); + return new LinearDensity(poundsperfoot, LinearDensityUnit.PoundPerFoot); } /// @@ -246,9 +240,9 @@ public static LinearDensity FromPoundsPerFoot(QuantityValue poundsperfoot) /// Value to convert from. /// Unit to convert from. /// unit value. - public static LinearDensity From(QuantityValue value, LinearDensityUnit fromUnit) + public static LinearDensity From(T value, LinearDensityUnit fromUnit) { - return new LinearDensity((double)value, fromUnit); + return new LinearDensity(value, fromUnit); } #endregion @@ -402,43 +396,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Linear /// Negate the value. public static LinearDensity operator -(LinearDensity right) { - return new LinearDensity(-right.Value, right.Unit); + return new LinearDensity(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static LinearDensity operator +(LinearDensity left, LinearDensity right) { - return new LinearDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new LinearDensity(value, left.Unit); } /// Get from subtracting two . public static LinearDensity operator -(LinearDensity left, LinearDensity right) { - return new LinearDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new LinearDensity(value, left.Unit); } /// Get from multiplying value and . - public static LinearDensity operator *(double left, LinearDensity right) + public static LinearDensity operator *(T left, LinearDensity right) { - return new LinearDensity(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new LinearDensity(value, right.Unit); } /// Get from multiplying value and . - public static LinearDensity operator *(LinearDensity left, double right) + public static LinearDensity operator *(LinearDensity left, T right) { - return new LinearDensity(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new LinearDensity(value, left.Unit); } /// Get from dividing by value. - public static LinearDensity operator /(LinearDensity left, double right) + public static LinearDensity operator /(LinearDensity left, T right) { - return new LinearDensity(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new LinearDensity(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(LinearDensity left, LinearDensity right) + public static T operator /(LinearDensity left, LinearDensity right) { - return left.KilogramsPerMeter / right.KilogramsPerMeter; + return CompiledLambdas.Divide(left.KilogramsPerMeter, right.KilogramsPerMeter); } #endregion @@ -448,25 +447,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Linear /// Returns true if less or equal to. public static bool operator <=(LinearDensity left, LinearDensity right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(LinearDensity left, LinearDensity right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(LinearDensity left, LinearDensity right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(LinearDensity left, LinearDensity right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -495,7 +494,7 @@ public int CompareTo(object obj) /// public int CompareTo(LinearDensity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -512,7 +511,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(LinearDensity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -560,10 +559,8 @@ public bool Equals(LinearDensity other, double tolerance, ComparisonType comp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -583,17 +580,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(LinearDensityUnit unit) + public T As(LinearDensityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -613,9 +610,14 @@ double IQuantity.As(Enum unit) if(!(unit is LinearDensityUnit unitAsLinearDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LinearDensityUnit)} is supported.", nameof(unit)); - return As(unitAsLinearDensityUnit); + var asValue = As(unitAsLinearDensityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(LinearDensityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -656,21 +658,27 @@ public LinearDensity ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(LinearDensityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(LinearDensityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case LinearDensityUnit.GramPerMeter: return _value*1e-3; - case LinearDensityUnit.KilogramPerMeter: return (_value*1e-3) * 1e3d; - case LinearDensityUnit.PoundPerFoot: return _value*1.48816394; + case LinearDensityUnit.GramPerMeter: return Value*1e-3; + case LinearDensityUnit.KilogramPerMeter: return (Value*1e-3) * 1e3d; + case LinearDensityUnit.PoundPerFoot: return Value*1.48816394; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -687,10 +695,10 @@ internal LinearDensity ToBaseUnit() return new LinearDensity(baseUnitValue, BaseUnit); } - private double GetValueAs(LinearDensityUnit unit) + private T GetValueAs(LinearDensityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -800,7 +808,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -815,37 +823,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -869,17 +877,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs index 6cac18ef64..9e2057661a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Luminosity /// - public partial struct Luminosity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Luminosity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -77,12 +72,12 @@ static Luminosity() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Luminosity(double value, LuminosityUnit unit) + public Luminosity(T value, LuminosityUnit unit) { if(unit == LuminosityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -94,14 +89,14 @@ public Luminosity(double value, LuminosityUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Luminosity(double value, UnitSystem unitSystem) + public Luminosity(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -143,7 +138,7 @@ public Luminosity(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Watt. /// - public static Luminosity Zero { get; } = new Luminosity(0, BaseUnit); + public static Luminosity Zero { get; } = new Luminosity((T)0, BaseUnit); #endregion @@ -152,7 +147,9 @@ public Luminosity(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -182,72 +179,72 @@ public Luminosity(double value, UnitSystem unitSystem) /// /// Get in Decawatts. /// - public double Decawatts => As(LuminosityUnit.Decawatt); + public T Decawatts => As(LuminosityUnit.Decawatt); /// /// Get in Deciwatts. /// - public double Deciwatts => As(LuminosityUnit.Deciwatt); + public T Deciwatts => As(LuminosityUnit.Deciwatt); /// /// Get in Femtowatts. /// - public double Femtowatts => As(LuminosityUnit.Femtowatt); + public T Femtowatts => As(LuminosityUnit.Femtowatt); /// /// Get in Gigawatts. /// - public double Gigawatts => As(LuminosityUnit.Gigawatt); + public T Gigawatts => As(LuminosityUnit.Gigawatt); /// /// Get in Kilowatts. /// - public double Kilowatts => As(LuminosityUnit.Kilowatt); + public T Kilowatts => As(LuminosityUnit.Kilowatt); /// /// Get in Megawatts. /// - public double Megawatts => As(LuminosityUnit.Megawatt); + public T Megawatts => As(LuminosityUnit.Megawatt); /// /// Get in Microwatts. /// - public double Microwatts => As(LuminosityUnit.Microwatt); + public T Microwatts => As(LuminosityUnit.Microwatt); /// /// Get in Milliwatts. /// - public double Milliwatts => As(LuminosityUnit.Milliwatt); + public T Milliwatts => As(LuminosityUnit.Milliwatt); /// /// Get in Nanowatts. /// - public double Nanowatts => As(LuminosityUnit.Nanowatt); + public T Nanowatts => As(LuminosityUnit.Nanowatt); /// /// Get in Petawatts. /// - public double Petawatts => As(LuminosityUnit.Petawatt); + public T Petawatts => As(LuminosityUnit.Petawatt); /// /// Get in Picowatts. /// - public double Picowatts => As(LuminosityUnit.Picowatt); + public T Picowatts => As(LuminosityUnit.Picowatt); /// /// Get in SolarLuminosities. /// - public double SolarLuminosities => As(LuminosityUnit.SolarLuminosity); + public T SolarLuminosities => As(LuminosityUnit.SolarLuminosity); /// /// Get in Terawatts. /// - public double Terawatts => As(LuminosityUnit.Terawatt); + public T Terawatts => As(LuminosityUnit.Terawatt); /// /// Get in Watts. /// - public double Watts => As(LuminosityUnit.Watt); + public T Watts => As(LuminosityUnit.Watt); #endregion @@ -282,127 +279,113 @@ public static string GetAbbreviation(LuminosityUnit unit, [CanBeNull] IFormatPro /// Get from Decawatts. /// /// If value is NaN or Infinity. - public static Luminosity FromDecawatts(QuantityValue decawatts) + public static Luminosity FromDecawatts(T decawatts) { - double value = (double) decawatts; - return new Luminosity(value, LuminosityUnit.Decawatt); + return new Luminosity(decawatts, LuminosityUnit.Decawatt); } /// /// Get from Deciwatts. /// /// If value is NaN or Infinity. - public static Luminosity FromDeciwatts(QuantityValue deciwatts) + public static Luminosity FromDeciwatts(T deciwatts) { - double value = (double) deciwatts; - return new Luminosity(value, LuminosityUnit.Deciwatt); + return new Luminosity(deciwatts, LuminosityUnit.Deciwatt); } /// /// Get from Femtowatts. /// /// If value is NaN or Infinity. - public static Luminosity FromFemtowatts(QuantityValue femtowatts) + public static Luminosity FromFemtowatts(T femtowatts) { - double value = (double) femtowatts; - return new Luminosity(value, LuminosityUnit.Femtowatt); + return new Luminosity(femtowatts, LuminosityUnit.Femtowatt); } /// /// Get from Gigawatts. /// /// If value is NaN or Infinity. - public static Luminosity FromGigawatts(QuantityValue gigawatts) + public static Luminosity FromGigawatts(T gigawatts) { - double value = (double) gigawatts; - return new Luminosity(value, LuminosityUnit.Gigawatt); + return new Luminosity(gigawatts, LuminosityUnit.Gigawatt); } /// /// Get from Kilowatts. /// /// If value is NaN or Infinity. - public static Luminosity FromKilowatts(QuantityValue kilowatts) + public static Luminosity FromKilowatts(T kilowatts) { - double value = (double) kilowatts; - return new Luminosity(value, LuminosityUnit.Kilowatt); + return new Luminosity(kilowatts, LuminosityUnit.Kilowatt); } /// /// Get from Megawatts. /// /// If value is NaN or Infinity. - public static Luminosity FromMegawatts(QuantityValue megawatts) + public static Luminosity FromMegawatts(T megawatts) { - double value = (double) megawatts; - return new Luminosity(value, LuminosityUnit.Megawatt); + return new Luminosity(megawatts, LuminosityUnit.Megawatt); } /// /// Get from Microwatts. /// /// If value is NaN or Infinity. - public static Luminosity FromMicrowatts(QuantityValue microwatts) + public static Luminosity FromMicrowatts(T microwatts) { - double value = (double) microwatts; - return new Luminosity(value, LuminosityUnit.Microwatt); + return new Luminosity(microwatts, LuminosityUnit.Microwatt); } /// /// Get from Milliwatts. /// /// If value is NaN or Infinity. - public static Luminosity FromMilliwatts(QuantityValue milliwatts) + public static Luminosity FromMilliwatts(T milliwatts) { - double value = (double) milliwatts; - return new Luminosity(value, LuminosityUnit.Milliwatt); + return new Luminosity(milliwatts, LuminosityUnit.Milliwatt); } /// /// Get from Nanowatts. /// /// If value is NaN or Infinity. - public static Luminosity FromNanowatts(QuantityValue nanowatts) + public static Luminosity FromNanowatts(T nanowatts) { - double value = (double) nanowatts; - return new Luminosity(value, LuminosityUnit.Nanowatt); + return new Luminosity(nanowatts, LuminosityUnit.Nanowatt); } /// /// Get from Petawatts. /// /// If value is NaN or Infinity. - public static Luminosity FromPetawatts(QuantityValue petawatts) + public static Luminosity FromPetawatts(T petawatts) { - double value = (double) petawatts; - return new Luminosity(value, LuminosityUnit.Petawatt); + return new Luminosity(petawatts, LuminosityUnit.Petawatt); } /// /// Get from Picowatts. /// /// If value is NaN or Infinity. - public static Luminosity FromPicowatts(QuantityValue picowatts) + public static Luminosity FromPicowatts(T picowatts) { - double value = (double) picowatts; - return new Luminosity(value, LuminosityUnit.Picowatt); + return new Luminosity(picowatts, LuminosityUnit.Picowatt); } /// /// Get from SolarLuminosities. /// /// If value is NaN or Infinity. - public static Luminosity FromSolarLuminosities(QuantityValue solarluminosities) + public static Luminosity FromSolarLuminosities(T solarluminosities) { - double value = (double) solarluminosities; - return new Luminosity(value, LuminosityUnit.SolarLuminosity); + return new Luminosity(solarluminosities, LuminosityUnit.SolarLuminosity); } /// /// Get from Terawatts. /// /// If value is NaN or Infinity. - public static Luminosity FromTerawatts(QuantityValue terawatts) + public static Luminosity FromTerawatts(T terawatts) { - double value = (double) terawatts; - return new Luminosity(value, LuminosityUnit.Terawatt); + return new Luminosity(terawatts, LuminosityUnit.Terawatt); } /// /// Get from Watts. /// /// If value is NaN or Infinity. - public static Luminosity FromWatts(QuantityValue watts) + public static Luminosity FromWatts(T watts) { - double value = (double) watts; - return new Luminosity(value, LuminosityUnit.Watt); + return new Luminosity(watts, LuminosityUnit.Watt); } /// @@ -411,9 +394,9 @@ public static Luminosity FromWatts(QuantityValue watts) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Luminosity From(QuantityValue value, LuminosityUnit fromUnit) + public static Luminosity From(T value, LuminosityUnit fromUnit) { - return new Luminosity((double)value, fromUnit); + return new Luminosity(value, fromUnit); } #endregion @@ -567,43 +550,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino /// Negate the value. public static Luminosity operator -(Luminosity right) { - return new Luminosity(-right.Value, right.Unit); + return new Luminosity(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Luminosity operator +(Luminosity left, Luminosity right) { - return new Luminosity(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Luminosity(value, left.Unit); } /// Get from subtracting two . public static Luminosity operator -(Luminosity left, Luminosity right) { - return new Luminosity(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Luminosity(value, left.Unit); } /// Get from multiplying value and . - public static Luminosity operator *(double left, Luminosity right) + public static Luminosity operator *(T left, Luminosity right) { - return new Luminosity(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Luminosity(value, right.Unit); } /// Get from multiplying value and . - public static Luminosity operator *(Luminosity left, double right) + public static Luminosity operator *(Luminosity left, T right) { - return new Luminosity(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Luminosity(value, left.Unit); } /// Get from dividing by value. - public static Luminosity operator /(Luminosity left, double right) + public static Luminosity operator /(Luminosity left, T right) { - return new Luminosity(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Luminosity(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Luminosity left, Luminosity right) + public static T operator /(Luminosity left, Luminosity right) { - return left.Watts / right.Watts; + return CompiledLambdas.Divide(left.Watts, right.Watts); } #endregion @@ -613,25 +601,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino /// Returns true if less or equal to. public static bool operator <=(Luminosity left, Luminosity right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Luminosity left, Luminosity right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Luminosity left, Luminosity right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Luminosity left, Luminosity right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -660,7 +648,7 @@ public int CompareTo(object obj) /// public int CompareTo(Luminosity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -677,7 +665,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Luminosity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -725,10 +713,8 @@ public bool Equals(Luminosity other, double tolerance, ComparisonType compari if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -748,17 +734,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(LuminosityUnit unit) + public T As(LuminosityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -778,9 +764,14 @@ double IQuantity.As(Enum unit) if(!(unit is LuminosityUnit unitAsLuminosityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminosityUnit)} is supported.", nameof(unit)); - return As(unitAsLuminosityUnit); + var asValue = As(unitAsLuminosityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(LuminosityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -821,32 +812,38 @@ public Luminosity ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(LuminosityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(LuminosityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case LuminosityUnit.Decawatt: return (_value) * 1e1d; - case LuminosityUnit.Deciwatt: return (_value) * 1e-1d; - case LuminosityUnit.Femtowatt: return (_value) * 1e-15d; - case LuminosityUnit.Gigawatt: return (_value) * 1e9d; - case LuminosityUnit.Kilowatt: return (_value) * 1e3d; - case LuminosityUnit.Megawatt: return (_value) * 1e6d; - case LuminosityUnit.Microwatt: return (_value) * 1e-6d; - case LuminosityUnit.Milliwatt: return (_value) * 1e-3d; - case LuminosityUnit.Nanowatt: return (_value) * 1e-9d; - case LuminosityUnit.Petawatt: return (_value) * 1e15d; - case LuminosityUnit.Picowatt: return (_value) * 1e-12d; - case LuminosityUnit.SolarLuminosity: return _value * 3.846e26; - case LuminosityUnit.Terawatt: return (_value) * 1e12d; - case LuminosityUnit.Watt: return _value; + case LuminosityUnit.Decawatt: return (Value) * 1e1d; + case LuminosityUnit.Deciwatt: return (Value) * 1e-1d; + case LuminosityUnit.Femtowatt: return (Value) * 1e-15d; + case LuminosityUnit.Gigawatt: return (Value) * 1e9d; + case LuminosityUnit.Kilowatt: return (Value) * 1e3d; + case LuminosityUnit.Megawatt: return (Value) * 1e6d; + case LuminosityUnit.Microwatt: return (Value) * 1e-6d; + case LuminosityUnit.Milliwatt: return (Value) * 1e-3d; + case LuminosityUnit.Nanowatt: return (Value) * 1e-9d; + case LuminosityUnit.Petawatt: return (Value) * 1e15d; + case LuminosityUnit.Picowatt: return (Value) * 1e-12d; + case LuminosityUnit.SolarLuminosity: return Value * 3.846e26; + case LuminosityUnit.Terawatt: return (Value) * 1e12d; + case LuminosityUnit.Watt: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -863,10 +860,10 @@ internal Luminosity ToBaseUnit() return new Luminosity(baseUnitValue, BaseUnit); } - private double GetValueAs(LuminosityUnit unit) + private T GetValueAs(LuminosityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -987,7 +984,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1002,37 +999,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1056,17 +1053,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs index dd8a739de8..064ce7462a 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Luminous_flux /// - public partial struct LuminousFlux : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct LuminousFlux : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -64,12 +59,12 @@ static LuminousFlux() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public LuminousFlux(double value, LuminousFluxUnit unit) + public LuminousFlux(T value, LuminousFluxUnit unit) { if(unit == LuminousFluxUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -81,14 +76,14 @@ public LuminousFlux(double value, LuminousFluxUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public LuminousFlux(double value, UnitSystem unitSystem) + public LuminousFlux(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -130,7 +125,7 @@ public LuminousFlux(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Lumen. /// - public static LuminousFlux Zero { get; } = new LuminousFlux(0, BaseUnit); + public static LuminousFlux Zero { get; } = new LuminousFlux((T)0, BaseUnit); #endregion @@ -139,7 +134,9 @@ public LuminousFlux(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -169,7 +166,7 @@ public LuminousFlux(double value, UnitSystem unitSystem) /// /// Get in Lumens. /// - public double Lumens => As(LuminousFluxUnit.Lumen); + public T Lumens => As(LuminousFluxUnit.Lumen); #endregion @@ -204,10 +201,9 @@ public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] IFormatP /// Get from Lumens. /// /// If value is NaN or Infinity. - public static LuminousFlux FromLumens(QuantityValue lumens) + public static LuminousFlux FromLumens(T lumens) { - double value = (double) lumens; - return new LuminousFlux(value, LuminousFluxUnit.Lumen); + return new LuminousFlux(lumens, LuminousFluxUnit.Lumen); } /// @@ -216,9 +212,9 @@ public static LuminousFlux FromLumens(QuantityValue lumens) /// Value to convert from. /// Unit to convert from. /// unit value. - public static LuminousFlux From(QuantityValue value, LuminousFluxUnit fromUnit) + public static LuminousFlux From(T value, LuminousFluxUnit fromUnit) { - return new LuminousFlux((double)value, fromUnit); + return new LuminousFlux(value, fromUnit); } #endregion @@ -372,43 +368,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino /// Negate the value. public static LuminousFlux operator -(LuminousFlux right) { - return new LuminousFlux(-right.Value, right.Unit); + return new LuminousFlux(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static LuminousFlux operator +(LuminousFlux left, LuminousFlux right) { - return new LuminousFlux(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new LuminousFlux(value, left.Unit); } /// Get from subtracting two . public static LuminousFlux operator -(LuminousFlux left, LuminousFlux right) { - return new LuminousFlux(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new LuminousFlux(value, left.Unit); } /// Get from multiplying value and . - public static LuminousFlux operator *(double left, LuminousFlux right) + public static LuminousFlux operator *(T left, LuminousFlux right) { - return new LuminousFlux(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new LuminousFlux(value, right.Unit); } /// Get from multiplying value and . - public static LuminousFlux operator *(LuminousFlux left, double right) + public static LuminousFlux operator *(LuminousFlux left, T right) { - return new LuminousFlux(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new LuminousFlux(value, left.Unit); } /// Get from dividing by value. - public static LuminousFlux operator /(LuminousFlux left, double right) + public static LuminousFlux operator /(LuminousFlux left, T right) { - return new LuminousFlux(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new LuminousFlux(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(LuminousFlux left, LuminousFlux right) + public static T operator /(LuminousFlux left, LuminousFlux right) { - return left.Lumens / right.Lumens; + return CompiledLambdas.Divide(left.Lumens, right.Lumens); } #endregion @@ -418,25 +419,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino /// Returns true if less or equal to. public static bool operator <=(LuminousFlux left, LuminousFlux right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(LuminousFlux left, LuminousFlux right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(LuminousFlux left, LuminousFlux right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(LuminousFlux left, LuminousFlux right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -465,7 +466,7 @@ public int CompareTo(object obj) /// public int CompareTo(LuminousFlux other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -482,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(LuminousFlux other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -530,10 +531,8 @@ public bool Equals(LuminousFlux other, double tolerance, ComparisonType compa if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -553,17 +552,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(LuminousFluxUnit unit) + public T As(LuminousFluxUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -583,9 +582,14 @@ double IQuantity.As(Enum unit) if(!(unit is LuminousFluxUnit unitAsLuminousFluxUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminousFluxUnit)} is supported.", nameof(unit)); - return As(unitAsLuminousFluxUnit); + var asValue = As(unitAsLuminousFluxUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(LuminousFluxUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -626,19 +630,25 @@ public LuminousFlux ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(LuminousFluxUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(LuminousFluxUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case LuminousFluxUnit.Lumen: return _value; + case LuminousFluxUnit.Lumen: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -655,10 +665,10 @@ internal LuminousFlux ToBaseUnit() return new LuminousFlux(baseUnitValue, BaseUnit); } - private double GetValueAs(LuminousFluxUnit unit) + private T GetValueAs(LuminousFluxUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -766,7 +776,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -781,37 +791,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -835,17 +845,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs index de5b80f576..8ae98a4d57 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Luminous_intensity /// - public partial struct LuminousIntensity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct LuminousIntensity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -64,12 +59,12 @@ static LuminousIntensity() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public LuminousIntensity(double value, LuminousIntensityUnit unit) + public LuminousIntensity(T value, LuminousIntensityUnit unit) { if(unit == LuminousIntensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -81,14 +76,14 @@ public LuminousIntensity(double value, LuminousIntensityUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public LuminousIntensity(double value, UnitSystem unitSystem) + public LuminousIntensity(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -130,7 +125,7 @@ public LuminousIntensity(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Candela. /// - public static LuminousIntensity Zero { get; } = new LuminousIntensity(0, BaseUnit); + public static LuminousIntensity Zero { get; } = new LuminousIntensity((T)0, BaseUnit); #endregion @@ -139,7 +134,9 @@ public LuminousIntensity(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -169,7 +166,7 @@ public LuminousIntensity(double value, UnitSystem unitSystem) /// /// Get in Candela. /// - public double Candela => As(LuminousIntensityUnit.Candela); + public T Candela => As(LuminousIntensityUnit.Candela); #endregion @@ -204,10 +201,9 @@ public static string GetAbbreviation(LuminousIntensityUnit unit, [CanBeNull] IFo /// Get from Candela. /// /// If value is NaN or Infinity. - public static LuminousIntensity FromCandela(QuantityValue candela) + public static LuminousIntensity FromCandela(T candela) { - double value = (double) candela; - return new LuminousIntensity(value, LuminousIntensityUnit.Candela); + return new LuminousIntensity(candela, LuminousIntensityUnit.Candela); } /// @@ -216,9 +212,9 @@ public static LuminousIntensity FromCandela(QuantityValue candela) /// Value to convert from. /// Unit to convert from. /// unit value. - public static LuminousIntensity From(QuantityValue value, LuminousIntensityUnit fromUnit) + public static LuminousIntensity From(T value, LuminousIntensityUnit fromUnit) { - return new LuminousIntensity((double)value, fromUnit); + return new LuminousIntensity(value, fromUnit); } #endregion @@ -372,43 +368,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino /// Negate the value. public static LuminousIntensity operator -(LuminousIntensity right) { - return new LuminousIntensity(-right.Value, right.Unit); + return new LuminousIntensity(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static LuminousIntensity operator +(LuminousIntensity left, LuminousIntensity right) { - return new LuminousIntensity(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new LuminousIntensity(value, left.Unit); } /// Get from subtracting two . public static LuminousIntensity operator -(LuminousIntensity left, LuminousIntensity right) { - return new LuminousIntensity(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new LuminousIntensity(value, left.Unit); } /// Get from multiplying value and . - public static LuminousIntensity operator *(double left, LuminousIntensity right) + public static LuminousIntensity operator *(T left, LuminousIntensity right) { - return new LuminousIntensity(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new LuminousIntensity(value, right.Unit); } /// Get from multiplying value and . - public static LuminousIntensity operator *(LuminousIntensity left, double right) + public static LuminousIntensity operator *(LuminousIntensity left, T right) { - return new LuminousIntensity(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new LuminousIntensity(value, left.Unit); } /// Get from dividing by value. - public static LuminousIntensity operator /(LuminousIntensity left, double right) + public static LuminousIntensity operator /(LuminousIntensity left, T right) { - return new LuminousIntensity(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new LuminousIntensity(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(LuminousIntensity left, LuminousIntensity right) + public static T operator /(LuminousIntensity left, LuminousIntensity right) { - return left.Candela / right.Candela; + return CompiledLambdas.Divide(left.Candela, right.Candela); } #endregion @@ -418,25 +419,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino /// Returns true if less or equal to. public static bool operator <=(LuminousIntensity left, LuminousIntensity right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(LuminousIntensity left, LuminousIntensity right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(LuminousIntensity left, LuminousIntensity right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(LuminousIntensity left, LuminousIntensity right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -465,7 +466,7 @@ public int CompareTo(object obj) /// public int CompareTo(LuminousIntensity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -482,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(LuminousIntensity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -530,10 +531,8 @@ public bool Equals(LuminousIntensity other, double tolerance, ComparisonType if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -553,17 +552,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(LuminousIntensityUnit unit) + public T As(LuminousIntensityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -583,9 +582,14 @@ double IQuantity.As(Enum unit) if(!(unit is LuminousIntensityUnit unitAsLuminousIntensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminousIntensityUnit)} is supported.", nameof(unit)); - return As(unitAsLuminousIntensityUnit); + var asValue = As(unitAsLuminousIntensityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(LuminousIntensityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -626,19 +630,25 @@ public LuminousIntensity ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(LuminousIntensityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(LuminousIntensityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case LuminousIntensityUnit.Candela: return _value; + case LuminousIntensityUnit.Candela: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -655,10 +665,10 @@ internal LuminousIntensity ToBaseUnit() return new LuminousIntensity(baseUnitValue, BaseUnit); } - private double GetValueAs(LuminousIntensityUnit unit) + private T GetValueAs(LuminousIntensityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -766,7 +776,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -781,37 +791,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -835,17 +845,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs index 1bee29779c..a1e19ef2cb 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Magnetic_field /// - public partial struct MagneticField : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct MagneticField : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -67,12 +62,12 @@ static MagneticField() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public MagneticField(double value, MagneticFieldUnit unit) + public MagneticField(T value, MagneticFieldUnit unit) { if(unit == MagneticFieldUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -84,14 +79,14 @@ public MagneticField(double value, MagneticFieldUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public MagneticField(double value, UnitSystem unitSystem) + public MagneticField(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -133,7 +128,7 @@ public MagneticField(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Tesla. /// - public static MagneticField Zero { get; } = new MagneticField(0, BaseUnit); + public static MagneticField Zero { get; } = new MagneticField((T)0, BaseUnit); #endregion @@ -142,7 +137,9 @@ public MagneticField(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -172,22 +169,22 @@ public MagneticField(double value, UnitSystem unitSystem) /// /// Get in Microteslas. /// - public double Microteslas => As(MagneticFieldUnit.Microtesla); + public T Microteslas => As(MagneticFieldUnit.Microtesla); /// /// Get in Milliteslas. /// - public double Milliteslas => As(MagneticFieldUnit.Millitesla); + public T Milliteslas => As(MagneticFieldUnit.Millitesla); /// /// Get in Nanoteslas. /// - public double Nanoteslas => As(MagneticFieldUnit.Nanotesla); + public T Nanoteslas => As(MagneticFieldUnit.Nanotesla); /// /// Get in Teslas. /// - public double Teslas => As(MagneticFieldUnit.Tesla); + public T Teslas => As(MagneticFieldUnit.Tesla); #endregion @@ -222,37 +219,33 @@ public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] IFormat /// Get from Microteslas. /// /// If value is NaN or Infinity. - public static MagneticField FromMicroteslas(QuantityValue microteslas) + public static MagneticField FromMicroteslas(T microteslas) { - double value = (double) microteslas; - return new MagneticField(value, MagneticFieldUnit.Microtesla); + return new MagneticField(microteslas, MagneticFieldUnit.Microtesla); } /// /// Get from Milliteslas. /// /// If value is NaN or Infinity. - public static MagneticField FromMilliteslas(QuantityValue milliteslas) + public static MagneticField FromMilliteslas(T milliteslas) { - double value = (double) milliteslas; - return new MagneticField(value, MagneticFieldUnit.Millitesla); + return new MagneticField(milliteslas, MagneticFieldUnit.Millitesla); } /// /// Get from Nanoteslas. /// /// If value is NaN or Infinity. - public static MagneticField FromNanoteslas(QuantityValue nanoteslas) + public static MagneticField FromNanoteslas(T nanoteslas) { - double value = (double) nanoteslas; - return new MagneticField(value, MagneticFieldUnit.Nanotesla); + return new MagneticField(nanoteslas, MagneticFieldUnit.Nanotesla); } /// /// Get from Teslas. /// /// If value is NaN or Infinity. - public static MagneticField FromTeslas(QuantityValue teslas) + public static MagneticField FromTeslas(T teslas) { - double value = (double) teslas; - return new MagneticField(value, MagneticFieldUnit.Tesla); + return new MagneticField(teslas, MagneticFieldUnit.Tesla); } /// @@ -261,9 +254,9 @@ public static MagneticField FromTeslas(QuantityValue teslas) /// Value to convert from. /// Unit to convert from. /// unit value. - public static MagneticField From(QuantityValue value, MagneticFieldUnit fromUnit) + public static MagneticField From(T value, MagneticFieldUnit fromUnit) { - return new MagneticField((double)value, fromUnit); + return new MagneticField(value, fromUnit); } #endregion @@ -417,43 +410,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet /// Negate the value. public static MagneticField operator -(MagneticField right) { - return new MagneticField(-right.Value, right.Unit); + return new MagneticField(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static MagneticField operator +(MagneticField left, MagneticField right) { - return new MagneticField(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new MagneticField(value, left.Unit); } /// Get from subtracting two . public static MagneticField operator -(MagneticField left, MagneticField right) { - return new MagneticField(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new MagneticField(value, left.Unit); } /// Get from multiplying value and . - public static MagneticField operator *(double left, MagneticField right) + public static MagneticField operator *(T left, MagneticField right) { - return new MagneticField(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new MagneticField(value, right.Unit); } /// Get from multiplying value and . - public static MagneticField operator *(MagneticField left, double right) + public static MagneticField operator *(MagneticField left, T right) { - return new MagneticField(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new MagneticField(value, left.Unit); } /// Get from dividing by value. - public static MagneticField operator /(MagneticField left, double right) + public static MagneticField operator /(MagneticField left, T right) { - return new MagneticField(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new MagneticField(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(MagneticField left, MagneticField right) + public static T operator /(MagneticField left, MagneticField right) { - return left.Teslas / right.Teslas; + return CompiledLambdas.Divide(left.Teslas, right.Teslas); } #endregion @@ -463,25 +461,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet /// Returns true if less or equal to. public static bool operator <=(MagneticField left, MagneticField right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(MagneticField left, MagneticField right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(MagneticField left, MagneticField right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(MagneticField left, MagneticField right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -510,7 +508,7 @@ public int CompareTo(object obj) /// public int CompareTo(MagneticField other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -527,7 +525,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MagneticField other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -575,10 +573,8 @@ public bool Equals(MagneticField other, double tolerance, ComparisonType comp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -598,17 +594,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MagneticFieldUnit unit) + public T As(MagneticFieldUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -628,9 +624,14 @@ double IQuantity.As(Enum unit) if(!(unit is MagneticFieldUnit unitAsMagneticFieldUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagneticFieldUnit)} is supported.", nameof(unit)); - return As(unitAsMagneticFieldUnit); + var asValue = As(unitAsMagneticFieldUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(MagneticFieldUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -671,22 +672,28 @@ public MagneticField ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(MagneticFieldUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(MagneticFieldUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case MagneticFieldUnit.Microtesla: return (_value) * 1e-6d; - case MagneticFieldUnit.Millitesla: return (_value) * 1e-3d; - case MagneticFieldUnit.Nanotesla: return (_value) * 1e-9d; - case MagneticFieldUnit.Tesla: return _value; + case MagneticFieldUnit.Microtesla: return (Value) * 1e-6d; + case MagneticFieldUnit.Millitesla: return (Value) * 1e-3d; + case MagneticFieldUnit.Nanotesla: return (Value) * 1e-9d; + case MagneticFieldUnit.Tesla: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -703,10 +710,10 @@ internal MagneticField ToBaseUnit() return new MagneticField(baseUnitValue, BaseUnit); } - private double GetValueAs(MagneticFieldUnit unit) + private T GetValueAs(MagneticFieldUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -817,7 +824,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -832,37 +839,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -886,17 +893,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs index f5b2b104d9..87e0c58076 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Magnetic_flux /// - public partial struct MagneticFlux : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct MagneticFlux : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -64,12 +59,12 @@ static MagneticFlux() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public MagneticFlux(double value, MagneticFluxUnit unit) + public MagneticFlux(T value, MagneticFluxUnit unit) { if(unit == MagneticFluxUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -81,14 +76,14 @@ public MagneticFlux(double value, MagneticFluxUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public MagneticFlux(double value, UnitSystem unitSystem) + public MagneticFlux(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -130,7 +125,7 @@ public MagneticFlux(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Weber. /// - public static MagneticFlux Zero { get; } = new MagneticFlux(0, BaseUnit); + public static MagneticFlux Zero { get; } = new MagneticFlux((T)0, BaseUnit); #endregion @@ -139,7 +134,9 @@ public MagneticFlux(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -169,7 +166,7 @@ public MagneticFlux(double value, UnitSystem unitSystem) /// /// Get in Webers. /// - public double Webers => As(MagneticFluxUnit.Weber); + public T Webers => As(MagneticFluxUnit.Weber); #endregion @@ -204,10 +201,9 @@ public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] IFormatP /// Get from Webers. /// /// If value is NaN or Infinity. - public static MagneticFlux FromWebers(QuantityValue webers) + public static MagneticFlux FromWebers(T webers) { - double value = (double) webers; - return new MagneticFlux(value, MagneticFluxUnit.Weber); + return new MagneticFlux(webers, MagneticFluxUnit.Weber); } /// @@ -216,9 +212,9 @@ public static MagneticFlux FromWebers(QuantityValue webers) /// Value to convert from. /// Unit to convert from. /// unit value. - public static MagneticFlux From(QuantityValue value, MagneticFluxUnit fromUnit) + public static MagneticFlux From(T value, MagneticFluxUnit fromUnit) { - return new MagneticFlux((double)value, fromUnit); + return new MagneticFlux(value, fromUnit); } #endregion @@ -372,43 +368,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet /// Negate the value. public static MagneticFlux operator -(MagneticFlux right) { - return new MagneticFlux(-right.Value, right.Unit); + return new MagneticFlux(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static MagneticFlux operator +(MagneticFlux left, MagneticFlux right) { - return new MagneticFlux(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new MagneticFlux(value, left.Unit); } /// Get from subtracting two . public static MagneticFlux operator -(MagneticFlux left, MagneticFlux right) { - return new MagneticFlux(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new MagneticFlux(value, left.Unit); } /// Get from multiplying value and . - public static MagneticFlux operator *(double left, MagneticFlux right) + public static MagneticFlux operator *(T left, MagneticFlux right) { - return new MagneticFlux(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new MagneticFlux(value, right.Unit); } /// Get from multiplying value and . - public static MagneticFlux operator *(MagneticFlux left, double right) + public static MagneticFlux operator *(MagneticFlux left, T right) { - return new MagneticFlux(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new MagneticFlux(value, left.Unit); } /// Get from dividing by value. - public static MagneticFlux operator /(MagneticFlux left, double right) + public static MagneticFlux operator /(MagneticFlux left, T right) { - return new MagneticFlux(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new MagneticFlux(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(MagneticFlux left, MagneticFlux right) + public static T operator /(MagneticFlux left, MagneticFlux right) { - return left.Webers / right.Webers; + return CompiledLambdas.Divide(left.Webers, right.Webers); } #endregion @@ -418,25 +419,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet /// Returns true if less or equal to. public static bool operator <=(MagneticFlux left, MagneticFlux right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(MagneticFlux left, MagneticFlux right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(MagneticFlux left, MagneticFlux right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(MagneticFlux left, MagneticFlux right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -465,7 +466,7 @@ public int CompareTo(object obj) /// public int CompareTo(MagneticFlux other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -482,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MagneticFlux other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -530,10 +531,8 @@ public bool Equals(MagneticFlux other, double tolerance, ComparisonType compa if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -553,17 +552,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MagneticFluxUnit unit) + public T As(MagneticFluxUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -583,9 +582,14 @@ double IQuantity.As(Enum unit) if(!(unit is MagneticFluxUnit unitAsMagneticFluxUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagneticFluxUnit)} is supported.", nameof(unit)); - return As(unitAsMagneticFluxUnit); + var asValue = As(unitAsMagneticFluxUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(MagneticFluxUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -626,19 +630,25 @@ public MagneticFlux ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(MagneticFluxUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(MagneticFluxUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case MagneticFluxUnit.Weber: return _value; + case MagneticFluxUnit.Weber: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -655,10 +665,10 @@ internal MagneticFlux ToBaseUnit() return new MagneticFlux(baseUnitValue, BaseUnit); } - private double GetValueAs(MagneticFluxUnit unit) + private T GetValueAs(MagneticFluxUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -766,7 +776,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -781,37 +791,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -835,17 +845,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs index 021bc4c506..07c9b59e75 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Magnetization /// - public partial struct Magnetization : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Magnetization : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -64,12 +59,12 @@ static Magnetization() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Magnetization(double value, MagnetizationUnit unit) + public Magnetization(T value, MagnetizationUnit unit) { if(unit == MagnetizationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -81,14 +76,14 @@ public Magnetization(double value, MagnetizationUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Magnetization(double value, UnitSystem unitSystem) + public Magnetization(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -130,7 +125,7 @@ public Magnetization(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerMeter. /// - public static Magnetization Zero { get; } = new Magnetization(0, BaseUnit); + public static Magnetization Zero { get; } = new Magnetization((T)0, BaseUnit); #endregion @@ -139,7 +134,9 @@ public Magnetization(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -169,7 +166,7 @@ public Magnetization(double value, UnitSystem unitSystem) /// /// Get in AmperesPerMeter. /// - public double AmperesPerMeter => As(MagnetizationUnit.AmperePerMeter); + public T AmperesPerMeter => As(MagnetizationUnit.AmperePerMeter); #endregion @@ -204,10 +201,9 @@ public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] IFormat /// Get from AmperesPerMeter. /// /// If value is NaN or Infinity. - public static Magnetization FromAmperesPerMeter(QuantityValue amperespermeter) + public static Magnetization FromAmperesPerMeter(T amperespermeter) { - double value = (double) amperespermeter; - return new Magnetization(value, MagnetizationUnit.AmperePerMeter); + return new Magnetization(amperespermeter, MagnetizationUnit.AmperePerMeter); } /// @@ -216,9 +212,9 @@ public static Magnetization FromAmperesPerMeter(QuantityValue amperespermeter /// Value to convert from. /// Unit to convert from. /// unit value. - public static Magnetization From(QuantityValue value, MagnetizationUnit fromUnit) + public static Magnetization From(T value, MagnetizationUnit fromUnit) { - return new Magnetization((double)value, fromUnit); + return new Magnetization(value, fromUnit); } #endregion @@ -372,43 +368,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet /// Negate the value. public static Magnetization operator -(Magnetization right) { - return new Magnetization(-right.Value, right.Unit); + return new Magnetization(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Magnetization operator +(Magnetization left, Magnetization right) { - return new Magnetization(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Magnetization(value, left.Unit); } /// Get from subtracting two . public static Magnetization operator -(Magnetization left, Magnetization right) { - return new Magnetization(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Magnetization(value, left.Unit); } /// Get from multiplying value and . - public static Magnetization operator *(double left, Magnetization right) + public static Magnetization operator *(T left, Magnetization right) { - return new Magnetization(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Magnetization(value, right.Unit); } /// Get from multiplying value and . - public static Magnetization operator *(Magnetization left, double right) + public static Magnetization operator *(Magnetization left, T right) { - return new Magnetization(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Magnetization(value, left.Unit); } /// Get from dividing by value. - public static Magnetization operator /(Magnetization left, double right) + public static Magnetization operator /(Magnetization left, T right) { - return new Magnetization(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Magnetization(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Magnetization left, Magnetization right) + public static T operator /(Magnetization left, Magnetization right) { - return left.AmperesPerMeter / right.AmperesPerMeter; + return CompiledLambdas.Divide(left.AmperesPerMeter, right.AmperesPerMeter); } #endregion @@ -418,25 +419,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet /// Returns true if less or equal to. public static bool operator <=(Magnetization left, Magnetization right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Magnetization left, Magnetization right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Magnetization left, Magnetization right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Magnetization left, Magnetization right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -465,7 +466,7 @@ public int CompareTo(object obj) /// public int CompareTo(Magnetization other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -482,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Magnetization other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -530,10 +531,8 @@ public bool Equals(Magnetization other, double tolerance, ComparisonType comp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -553,17 +552,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MagnetizationUnit unit) + public T As(MagnetizationUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -583,9 +582,14 @@ double IQuantity.As(Enum unit) if(!(unit is MagnetizationUnit unitAsMagnetizationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagnetizationUnit)} is supported.", nameof(unit)); - return As(unitAsMagnetizationUnit); + var asValue = As(unitAsMagnetizationUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(MagnetizationUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -626,19 +630,25 @@ public Magnetization ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(MagnetizationUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(MagnetizationUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case MagnetizationUnit.AmperePerMeter: return _value; + case MagnetizationUnit.AmperePerMeter: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -655,10 +665,10 @@ internal Magnetization ToBaseUnit() return new Magnetization(baseUnitValue, BaseUnit); } - private double GetValueAs(MagnetizationUnit unit) + private T GetValueAs(MagnetizationUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -766,7 +776,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -781,37 +791,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -835,17 +845,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs index b134ddb9fd..04ae0e3d54 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// In physics, mass (from Greek μᾶζα "barley cake, lump [of dough]") is a property of a physical system or body, giving rise to the phenomena of the body's resistance to being accelerated by a force and the strength of its mutual gravitational attraction with other bodies. Instruments such as mass balances or scales use those phenomena to measure mass. The SI unit of mass is the kilogram (kg). /// - public partial struct Mass : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Mass : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -85,12 +80,12 @@ static Mass() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Mass(double value, MassUnit unit) + public Mass(T value, MassUnit unit) { if(unit == MassUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -102,14 +97,14 @@ public Mass(double value, MassUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Mass(double value, UnitSystem unitSystem) + public Mass(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -151,7 +146,7 @@ public Mass(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Kilogram. /// - public static Mass Zero { get; } = new Mass(0, BaseUnit); + public static Mass Zero { get; } = new Mass((T)0, BaseUnit); #endregion @@ -160,7 +155,9 @@ public Mass(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -190,127 +187,127 @@ public Mass(double value, UnitSystem unitSystem) /// /// Get in Centigrams. /// - public double Centigrams => As(MassUnit.Centigram); + public T Centigrams => As(MassUnit.Centigram); /// /// Get in Decagrams. /// - public double Decagrams => As(MassUnit.Decagram); + public T Decagrams => As(MassUnit.Decagram); /// /// Get in Decigrams. /// - public double Decigrams => As(MassUnit.Decigram); + public T Decigrams => As(MassUnit.Decigram); /// /// Get in EarthMasses. /// - public double EarthMasses => As(MassUnit.EarthMass); + public T EarthMasses => As(MassUnit.EarthMass); /// /// Get in Grains. /// - public double Grains => As(MassUnit.Grain); + public T Grains => As(MassUnit.Grain); /// /// Get in Grams. /// - public double Grams => As(MassUnit.Gram); + public T Grams => As(MassUnit.Gram); /// /// Get in Hectograms. /// - public double Hectograms => As(MassUnit.Hectogram); + public T Hectograms => As(MassUnit.Hectogram); /// /// Get in Kilograms. /// - public double Kilograms => As(MassUnit.Kilogram); + public T Kilograms => As(MassUnit.Kilogram); /// /// Get in Kilopounds. /// - public double Kilopounds => As(MassUnit.Kilopound); + public T Kilopounds => As(MassUnit.Kilopound); /// /// Get in Kilotonnes. /// - public double Kilotonnes => As(MassUnit.Kilotonne); + public T Kilotonnes => As(MassUnit.Kilotonne); /// /// Get in LongHundredweight. /// - public double LongHundredweight => As(MassUnit.LongHundredweight); + public T LongHundredweight => As(MassUnit.LongHundredweight); /// /// Get in LongTons. /// - public double LongTons => As(MassUnit.LongTon); + public T LongTons => As(MassUnit.LongTon); /// /// Get in Megapounds. /// - public double Megapounds => As(MassUnit.Megapound); + public T Megapounds => As(MassUnit.Megapound); /// /// Get in Megatonnes. /// - public double Megatonnes => As(MassUnit.Megatonne); + public T Megatonnes => As(MassUnit.Megatonne); /// /// Get in Micrograms. /// - public double Micrograms => As(MassUnit.Microgram); + public T Micrograms => As(MassUnit.Microgram); /// /// Get in Milligrams. /// - public double Milligrams => As(MassUnit.Milligram); + public T Milligrams => As(MassUnit.Milligram); /// /// Get in Nanograms. /// - public double Nanograms => As(MassUnit.Nanogram); + public T Nanograms => As(MassUnit.Nanogram); /// /// Get in Ounces. /// - public double Ounces => As(MassUnit.Ounce); + public T Ounces => As(MassUnit.Ounce); /// /// Get in Pounds. /// - public double Pounds => As(MassUnit.Pound); + public T Pounds => As(MassUnit.Pound); /// /// Get in ShortHundredweight. /// - public double ShortHundredweight => As(MassUnit.ShortHundredweight); + public T ShortHundredweight => As(MassUnit.ShortHundredweight); /// /// Get in ShortTons. /// - public double ShortTons => As(MassUnit.ShortTon); + public T ShortTons => As(MassUnit.ShortTon); /// /// Get in Slugs. /// - public double Slugs => As(MassUnit.Slug); + public T Slugs => As(MassUnit.Slug); /// /// Get in SolarMasses. /// - public double SolarMasses => As(MassUnit.SolarMass); + public T SolarMasses => As(MassUnit.SolarMass); /// /// Get in Stone. /// - public double Stone => As(MassUnit.Stone); + public T Stone => As(MassUnit.Stone); /// /// Get in Tonnes. /// - public double Tonnes => As(MassUnit.Tonne); + public T Tonnes => As(MassUnit.Tonne); #endregion @@ -345,226 +342,201 @@ public static string GetAbbreviation(MassUnit unit, [CanBeNull] IFormatProvider /// Get from Centigrams. /// /// If value is NaN or Infinity. - public static Mass FromCentigrams(QuantityValue centigrams) + public static Mass FromCentigrams(T centigrams) { - double value = (double) centigrams; - return new Mass(value, MassUnit.Centigram); + return new Mass(centigrams, MassUnit.Centigram); } /// /// Get from Decagrams. /// /// If value is NaN or Infinity. - public static Mass FromDecagrams(QuantityValue decagrams) + public static Mass FromDecagrams(T decagrams) { - double value = (double) decagrams; - return new Mass(value, MassUnit.Decagram); + return new Mass(decagrams, MassUnit.Decagram); } /// /// Get from Decigrams. /// /// If value is NaN or Infinity. - public static Mass FromDecigrams(QuantityValue decigrams) + public static Mass FromDecigrams(T decigrams) { - double value = (double) decigrams; - return new Mass(value, MassUnit.Decigram); + return new Mass(decigrams, MassUnit.Decigram); } /// /// Get from EarthMasses. /// /// If value is NaN or Infinity. - public static Mass FromEarthMasses(QuantityValue earthmasses) + public static Mass FromEarthMasses(T earthmasses) { - double value = (double) earthmasses; - return new Mass(value, MassUnit.EarthMass); + return new Mass(earthmasses, MassUnit.EarthMass); } /// /// Get from Grains. /// /// If value is NaN or Infinity. - public static Mass FromGrains(QuantityValue grains) + public static Mass FromGrains(T grains) { - double value = (double) grains; - return new Mass(value, MassUnit.Grain); + return new Mass(grains, MassUnit.Grain); } /// /// Get from Grams. /// /// If value is NaN or Infinity. - public static Mass FromGrams(QuantityValue grams) + public static Mass FromGrams(T grams) { - double value = (double) grams; - return new Mass(value, MassUnit.Gram); + return new Mass(grams, MassUnit.Gram); } /// /// Get from Hectograms. /// /// If value is NaN or Infinity. - public static Mass FromHectograms(QuantityValue hectograms) + public static Mass FromHectograms(T hectograms) { - double value = (double) hectograms; - return new Mass(value, MassUnit.Hectogram); + return new Mass(hectograms, MassUnit.Hectogram); } /// /// Get from Kilograms. /// /// If value is NaN or Infinity. - public static Mass FromKilograms(QuantityValue kilograms) + public static Mass FromKilograms(T kilograms) { - double value = (double) kilograms; - return new Mass(value, MassUnit.Kilogram); + return new Mass(kilograms, MassUnit.Kilogram); } /// /// Get from Kilopounds. /// /// If value is NaN or Infinity. - public static Mass FromKilopounds(QuantityValue kilopounds) + public static Mass FromKilopounds(T kilopounds) { - double value = (double) kilopounds; - return new Mass(value, MassUnit.Kilopound); + return new Mass(kilopounds, MassUnit.Kilopound); } /// /// Get from Kilotonnes. /// /// If value is NaN or Infinity. - public static Mass FromKilotonnes(QuantityValue kilotonnes) + public static Mass FromKilotonnes(T kilotonnes) { - double value = (double) kilotonnes; - return new Mass(value, MassUnit.Kilotonne); + return new Mass(kilotonnes, MassUnit.Kilotonne); } /// /// Get from LongHundredweight. /// /// If value is NaN or Infinity. - public static Mass FromLongHundredweight(QuantityValue longhundredweight) + public static Mass FromLongHundredweight(T longhundredweight) { - double value = (double) longhundredweight; - return new Mass(value, MassUnit.LongHundredweight); + return new Mass(longhundredweight, MassUnit.LongHundredweight); } /// /// Get from LongTons. /// /// If value is NaN or Infinity. - public static Mass FromLongTons(QuantityValue longtons) + public static Mass FromLongTons(T longtons) { - double value = (double) longtons; - return new Mass(value, MassUnit.LongTon); + return new Mass(longtons, MassUnit.LongTon); } /// /// Get from Megapounds. /// /// If value is NaN or Infinity. - public static Mass FromMegapounds(QuantityValue megapounds) + public static Mass FromMegapounds(T megapounds) { - double value = (double) megapounds; - return new Mass(value, MassUnit.Megapound); + return new Mass(megapounds, MassUnit.Megapound); } /// /// Get from Megatonnes. /// /// If value is NaN or Infinity. - public static Mass FromMegatonnes(QuantityValue megatonnes) + public static Mass FromMegatonnes(T megatonnes) { - double value = (double) megatonnes; - return new Mass(value, MassUnit.Megatonne); + return new Mass(megatonnes, MassUnit.Megatonne); } /// /// Get from Micrograms. /// /// If value is NaN or Infinity. - public static Mass FromMicrograms(QuantityValue micrograms) + public static Mass FromMicrograms(T micrograms) { - double value = (double) micrograms; - return new Mass(value, MassUnit.Microgram); + return new Mass(micrograms, MassUnit.Microgram); } /// /// Get from Milligrams. /// /// If value is NaN or Infinity. - public static Mass FromMilligrams(QuantityValue milligrams) + public static Mass FromMilligrams(T milligrams) { - double value = (double) milligrams; - return new Mass(value, MassUnit.Milligram); + return new Mass(milligrams, MassUnit.Milligram); } /// /// Get from Nanograms. /// /// If value is NaN or Infinity. - public static Mass FromNanograms(QuantityValue nanograms) + public static Mass FromNanograms(T nanograms) { - double value = (double) nanograms; - return new Mass(value, MassUnit.Nanogram); + return new Mass(nanograms, MassUnit.Nanogram); } /// /// Get from Ounces. /// /// If value is NaN or Infinity. - public static Mass FromOunces(QuantityValue ounces) + public static Mass FromOunces(T ounces) { - double value = (double) ounces; - return new Mass(value, MassUnit.Ounce); + return new Mass(ounces, MassUnit.Ounce); } /// /// Get from Pounds. /// /// If value is NaN or Infinity. - public static Mass FromPounds(QuantityValue pounds) + public static Mass FromPounds(T pounds) { - double value = (double) pounds; - return new Mass(value, MassUnit.Pound); + return new Mass(pounds, MassUnit.Pound); } /// /// Get from ShortHundredweight. /// /// If value is NaN or Infinity. - public static Mass FromShortHundredweight(QuantityValue shorthundredweight) + public static Mass FromShortHundredweight(T shorthundredweight) { - double value = (double) shorthundredweight; - return new Mass(value, MassUnit.ShortHundredweight); + return new Mass(shorthundredweight, MassUnit.ShortHundredweight); } /// /// Get from ShortTons. /// /// If value is NaN or Infinity. - public static Mass FromShortTons(QuantityValue shorttons) + public static Mass FromShortTons(T shorttons) { - double value = (double) shorttons; - return new Mass(value, MassUnit.ShortTon); + return new Mass(shorttons, MassUnit.ShortTon); } /// /// Get from Slugs. /// /// If value is NaN or Infinity. - public static Mass FromSlugs(QuantityValue slugs) + public static Mass FromSlugs(T slugs) { - double value = (double) slugs; - return new Mass(value, MassUnit.Slug); + return new Mass(slugs, MassUnit.Slug); } /// /// Get from SolarMasses. /// /// If value is NaN or Infinity. - public static Mass FromSolarMasses(QuantityValue solarmasses) + public static Mass FromSolarMasses(T solarmasses) { - double value = (double) solarmasses; - return new Mass(value, MassUnit.SolarMass); + return new Mass(solarmasses, MassUnit.SolarMass); } /// /// Get from Stone. /// /// If value is NaN or Infinity. - public static Mass FromStone(QuantityValue stone) + public static Mass FromStone(T stone) { - double value = (double) stone; - return new Mass(value, MassUnit.Stone); + return new Mass(stone, MassUnit.Stone); } /// /// Get from Tonnes. /// /// If value is NaN or Infinity. - public static Mass FromTonnes(QuantityValue tonnes) + public static Mass FromTonnes(T tonnes) { - double value = (double) tonnes; - return new Mass(value, MassUnit.Tonne); + return new Mass(tonnes, MassUnit.Tonne); } /// @@ -573,9 +545,9 @@ public static Mass FromTonnes(QuantityValue tonnes) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Mass From(QuantityValue value, MassUnit fromUnit) + public static Mass From(T value, MassUnit fromUnit) { - return new Mass((double)value, fromUnit); + return new Mass(value, fromUnit); } #endregion @@ -729,43 +701,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassUn /// Negate the value. public static Mass operator -(Mass right) { - return new Mass(-right.Value, right.Unit); + return new Mass(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Mass operator +(Mass left, Mass right) { - return new Mass(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Mass(value, left.Unit); } /// Get from subtracting two . public static Mass operator -(Mass left, Mass right) { - return new Mass(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Mass(value, left.Unit); } /// Get from multiplying value and . - public static Mass operator *(double left, Mass right) + public static Mass operator *(T left, Mass right) { - return new Mass(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Mass(value, right.Unit); } /// Get from multiplying value and . - public static Mass operator *(Mass left, double right) + public static Mass operator *(Mass left, T right) { - return new Mass(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Mass(value, left.Unit); } /// Get from dividing by value. - public static Mass operator /(Mass left, double right) + public static Mass operator /(Mass left, T right) { - return new Mass(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Mass(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Mass left, Mass right) + public static T operator /(Mass left, Mass right) { - return left.Kilograms / right.Kilograms; + return CompiledLambdas.Divide(left.Kilograms, right.Kilograms); } #endregion @@ -775,25 +752,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassUn /// Returns true if less or equal to. public static bool operator <=(Mass left, Mass right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Mass left, Mass right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Mass left, Mass right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Mass left, Mass right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -822,7 +799,7 @@ public int CompareTo(object obj) /// public int CompareTo(Mass other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -839,7 +816,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Mass other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -887,10 +864,8 @@ public bool Equals(Mass other, double tolerance, ComparisonType comparisonTyp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -910,17 +885,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MassUnit unit) + public T As(MassUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -940,9 +915,14 @@ double IQuantity.As(Enum unit) if(!(unit is MassUnit unitAsMassUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassUnit)} is supported.", nameof(unit)); - return As(unitAsMassUnit); + var asValue = As(unitAsMassUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(MassUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -983,43 +963,49 @@ public Mass ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(MassUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(MassUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case MassUnit.Centigram: return (_value/1e3) * 1e-2d; - case MassUnit.Decagram: return (_value/1e3) * 1e1d; - case MassUnit.Decigram: return (_value/1e3) * 1e-1d; - case MassUnit.EarthMass: return _value * 5.9722E+24; - case MassUnit.Grain: return _value/15432.358352941431; - case MassUnit.Gram: return _value/1e3; - case MassUnit.Hectogram: return (_value/1e3) * 1e2d; - case MassUnit.Kilogram: return (_value/1e3) * 1e3d; - case MassUnit.Kilopound: return (_value*0.45359237) * 1e3d; - case MassUnit.Kilotonne: return (_value*1e3) * 1e3d; - case MassUnit.LongHundredweight: return _value/0.01968413055222121; - case MassUnit.LongTon: return _value*1.0160469088e3; - case MassUnit.Megapound: return (_value*0.45359237) * 1e6d; - case MassUnit.Megatonne: return (_value*1e3) * 1e6d; - case MassUnit.Microgram: return (_value/1e3) * 1e-6d; - case MassUnit.Milligram: return (_value/1e3) * 1e-3d; - case MassUnit.Nanogram: return (_value/1e3) * 1e-9d; - case MassUnit.Ounce: return _value/35.2739619; - case MassUnit.Pound: return _value*0.45359237; - case MassUnit.ShortHundredweight: return _value/0.022046226218487758; - case MassUnit.ShortTon: return _value*9.0718474e2; - case MassUnit.Slug: return _value/6.852176556196105e-2; - case MassUnit.SolarMass: return _value * 1.98947e30; - case MassUnit.Stone: return _value/0.1574731728702698; - case MassUnit.Tonne: return _value*1e3; + case MassUnit.Centigram: return (Value/1e3) * 1e-2d; + case MassUnit.Decagram: return (Value/1e3) * 1e1d; + case MassUnit.Decigram: return (Value/1e3) * 1e-1d; + case MassUnit.EarthMass: return Value * 5.9722E+24; + case MassUnit.Grain: return Value/15432.358352941431; + case MassUnit.Gram: return Value/1e3; + case MassUnit.Hectogram: return (Value/1e3) * 1e2d; + case MassUnit.Kilogram: return (Value/1e3) * 1e3d; + case MassUnit.Kilopound: return (Value*0.45359237) * 1e3d; + case MassUnit.Kilotonne: return (Value*1e3) * 1e3d; + case MassUnit.LongHundredweight: return Value/0.01968413055222121; + case MassUnit.LongTon: return Value*1.0160469088e3; + case MassUnit.Megapound: return (Value*0.45359237) * 1e6d; + case MassUnit.Megatonne: return (Value*1e3) * 1e6d; + case MassUnit.Microgram: return (Value/1e3) * 1e-6d; + case MassUnit.Milligram: return (Value/1e3) * 1e-3d; + case MassUnit.Nanogram: return (Value/1e3) * 1e-9d; + case MassUnit.Ounce: return Value/35.2739619; + case MassUnit.Pound: return Value*0.45359237; + case MassUnit.ShortHundredweight: return Value/0.022046226218487758; + case MassUnit.ShortTon: return Value*9.0718474e2; + case MassUnit.Slug: return Value/6.852176556196105e-2; + case MassUnit.SolarMass: return Value * 1.98947e30; + case MassUnit.Stone: return Value/0.1574731728702698; + case MassUnit.Tonne: return Value*1e3; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -1036,10 +1022,10 @@ internal Mass ToBaseUnit() return new Mass(baseUnitValue, BaseUnit); } - private double GetValueAs(MassUnit unit) + private T GetValueAs(MassUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1171,7 +1157,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1186,37 +1172,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1240,17 +1226,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs index 7bf2df6bc1..5902ae9995 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Mass_concentration_(chemistry) /// - public partial struct MassConcentration : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct MassConcentration : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -103,12 +98,12 @@ static MassConcentration() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public MassConcentration(double value, MassConcentrationUnit unit) + public MassConcentration(T value, MassConcentrationUnit unit) { if(unit == MassConcentrationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -120,14 +115,14 @@ public MassConcentration(double value, MassConcentrationUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public MassConcentration(double value, UnitSystem unitSystem) + public MassConcentration(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -169,7 +164,7 @@ public MassConcentration(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerCubicMeter. /// - public static MassConcentration Zero { get; } = new MassConcentration(0, BaseUnit); + public static MassConcentration Zero { get; } = new MassConcentration((T)0, BaseUnit); #endregion @@ -178,7 +173,9 @@ public MassConcentration(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -208,202 +205,202 @@ public MassConcentration(double value, UnitSystem unitSystem) /// /// Get in CentigramsPerDeciliter. /// - public double CentigramsPerDeciliter => As(MassConcentrationUnit.CentigramPerDeciliter); + public T CentigramsPerDeciliter => As(MassConcentrationUnit.CentigramPerDeciliter); /// /// Get in CentigramsPerLiter. /// - public double CentigramsPerLiter => As(MassConcentrationUnit.CentigramPerLiter); + public T CentigramsPerLiter => As(MassConcentrationUnit.CentigramPerLiter); /// /// Get in CentigramsPerMilliliter. /// - public double CentigramsPerMilliliter => As(MassConcentrationUnit.CentigramPerMilliliter); + public T CentigramsPerMilliliter => As(MassConcentrationUnit.CentigramPerMilliliter); /// /// Get in DecigramsPerDeciliter. /// - public double DecigramsPerDeciliter => As(MassConcentrationUnit.DecigramPerDeciliter); + public T DecigramsPerDeciliter => As(MassConcentrationUnit.DecigramPerDeciliter); /// /// Get in DecigramsPerLiter. /// - public double DecigramsPerLiter => As(MassConcentrationUnit.DecigramPerLiter); + public T DecigramsPerLiter => As(MassConcentrationUnit.DecigramPerLiter); /// /// Get in DecigramsPerMilliliter. /// - public double DecigramsPerMilliliter => As(MassConcentrationUnit.DecigramPerMilliliter); + public T DecigramsPerMilliliter => As(MassConcentrationUnit.DecigramPerMilliliter); /// /// Get in GramsPerCubicCentimeter. /// - public double GramsPerCubicCentimeter => As(MassConcentrationUnit.GramPerCubicCentimeter); + public T GramsPerCubicCentimeter => As(MassConcentrationUnit.GramPerCubicCentimeter); /// /// Get in GramsPerCubicMeter. /// - public double GramsPerCubicMeter => As(MassConcentrationUnit.GramPerCubicMeter); + public T GramsPerCubicMeter => As(MassConcentrationUnit.GramPerCubicMeter); /// /// Get in GramsPerCubicMillimeter. /// - public double GramsPerCubicMillimeter => As(MassConcentrationUnit.GramPerCubicMillimeter); + public T GramsPerCubicMillimeter => As(MassConcentrationUnit.GramPerCubicMillimeter); /// /// Get in GramsPerDeciliter. /// - public double GramsPerDeciliter => As(MassConcentrationUnit.GramPerDeciliter); + public T GramsPerDeciliter => As(MassConcentrationUnit.GramPerDeciliter); /// /// Get in GramsPerLiter. /// - public double GramsPerLiter => As(MassConcentrationUnit.GramPerLiter); + public T GramsPerLiter => As(MassConcentrationUnit.GramPerLiter); /// /// Get in GramsPerMilliliter. /// - public double GramsPerMilliliter => As(MassConcentrationUnit.GramPerMilliliter); + public T GramsPerMilliliter => As(MassConcentrationUnit.GramPerMilliliter); /// /// Get in KilogramsPerCubicCentimeter. /// - public double KilogramsPerCubicCentimeter => As(MassConcentrationUnit.KilogramPerCubicCentimeter); + public T KilogramsPerCubicCentimeter => As(MassConcentrationUnit.KilogramPerCubicCentimeter); /// /// Get in KilogramsPerCubicMeter. /// - public double KilogramsPerCubicMeter => As(MassConcentrationUnit.KilogramPerCubicMeter); + public T KilogramsPerCubicMeter => As(MassConcentrationUnit.KilogramPerCubicMeter); /// /// Get in KilogramsPerCubicMillimeter. /// - public double KilogramsPerCubicMillimeter => As(MassConcentrationUnit.KilogramPerCubicMillimeter); + public T KilogramsPerCubicMillimeter => As(MassConcentrationUnit.KilogramPerCubicMillimeter); /// /// Get in KilogramsPerLiter. /// - public double KilogramsPerLiter => As(MassConcentrationUnit.KilogramPerLiter); + public T KilogramsPerLiter => As(MassConcentrationUnit.KilogramPerLiter); /// /// Get in KilopoundsPerCubicFoot. /// - public double KilopoundsPerCubicFoot => As(MassConcentrationUnit.KilopoundPerCubicFoot); + public T KilopoundsPerCubicFoot => As(MassConcentrationUnit.KilopoundPerCubicFoot); /// /// Get in KilopoundsPerCubicInch. /// - public double KilopoundsPerCubicInch => As(MassConcentrationUnit.KilopoundPerCubicInch); + public T KilopoundsPerCubicInch => As(MassConcentrationUnit.KilopoundPerCubicInch); /// /// Get in MicrogramsPerCubicMeter. /// - public double MicrogramsPerCubicMeter => As(MassConcentrationUnit.MicrogramPerCubicMeter); + public T MicrogramsPerCubicMeter => As(MassConcentrationUnit.MicrogramPerCubicMeter); /// /// Get in MicrogramsPerDeciliter. /// - public double MicrogramsPerDeciliter => As(MassConcentrationUnit.MicrogramPerDeciliter); + public T MicrogramsPerDeciliter => As(MassConcentrationUnit.MicrogramPerDeciliter); /// /// Get in MicrogramsPerLiter. /// - public double MicrogramsPerLiter => As(MassConcentrationUnit.MicrogramPerLiter); + public T MicrogramsPerLiter => As(MassConcentrationUnit.MicrogramPerLiter); /// /// Get in MicrogramsPerMilliliter. /// - public double MicrogramsPerMilliliter => As(MassConcentrationUnit.MicrogramPerMilliliter); + public T MicrogramsPerMilliliter => As(MassConcentrationUnit.MicrogramPerMilliliter); /// /// Get in MilligramsPerCubicMeter. /// - public double MilligramsPerCubicMeter => As(MassConcentrationUnit.MilligramPerCubicMeter); + public T MilligramsPerCubicMeter => As(MassConcentrationUnit.MilligramPerCubicMeter); /// /// Get in MilligramsPerDeciliter. /// - public double MilligramsPerDeciliter => As(MassConcentrationUnit.MilligramPerDeciliter); + public T MilligramsPerDeciliter => As(MassConcentrationUnit.MilligramPerDeciliter); /// /// Get in MilligramsPerLiter. /// - public double MilligramsPerLiter => As(MassConcentrationUnit.MilligramPerLiter); + public T MilligramsPerLiter => As(MassConcentrationUnit.MilligramPerLiter); /// /// Get in MilligramsPerMilliliter. /// - public double MilligramsPerMilliliter => As(MassConcentrationUnit.MilligramPerMilliliter); + public T MilligramsPerMilliliter => As(MassConcentrationUnit.MilligramPerMilliliter); /// /// Get in NanogramsPerDeciliter. /// - public double NanogramsPerDeciliter => As(MassConcentrationUnit.NanogramPerDeciliter); + public T NanogramsPerDeciliter => As(MassConcentrationUnit.NanogramPerDeciliter); /// /// Get in NanogramsPerLiter. /// - public double NanogramsPerLiter => As(MassConcentrationUnit.NanogramPerLiter); + public T NanogramsPerLiter => As(MassConcentrationUnit.NanogramPerLiter); /// /// Get in NanogramsPerMilliliter. /// - public double NanogramsPerMilliliter => As(MassConcentrationUnit.NanogramPerMilliliter); + public T NanogramsPerMilliliter => As(MassConcentrationUnit.NanogramPerMilliliter); /// /// Get in PicogramsPerDeciliter. /// - public double PicogramsPerDeciliter => As(MassConcentrationUnit.PicogramPerDeciliter); + public T PicogramsPerDeciliter => As(MassConcentrationUnit.PicogramPerDeciliter); /// /// Get in PicogramsPerLiter. /// - public double PicogramsPerLiter => As(MassConcentrationUnit.PicogramPerLiter); + public T PicogramsPerLiter => As(MassConcentrationUnit.PicogramPerLiter); /// /// Get in PicogramsPerMilliliter. /// - public double PicogramsPerMilliliter => As(MassConcentrationUnit.PicogramPerMilliliter); + public T PicogramsPerMilliliter => As(MassConcentrationUnit.PicogramPerMilliliter); /// /// Get in PoundsPerCubicFoot. /// - public double PoundsPerCubicFoot => As(MassConcentrationUnit.PoundPerCubicFoot); + public T PoundsPerCubicFoot => As(MassConcentrationUnit.PoundPerCubicFoot); /// /// Get in PoundsPerCubicInch. /// - public double PoundsPerCubicInch => As(MassConcentrationUnit.PoundPerCubicInch); + public T PoundsPerCubicInch => As(MassConcentrationUnit.PoundPerCubicInch); /// /// Get in PoundsPerImperialGallon. /// - public double PoundsPerImperialGallon => As(MassConcentrationUnit.PoundPerImperialGallon); + public T PoundsPerImperialGallon => As(MassConcentrationUnit.PoundPerImperialGallon); /// /// Get in PoundsPerUSGallon. /// - public double PoundsPerUSGallon => As(MassConcentrationUnit.PoundPerUSGallon); + public T PoundsPerUSGallon => As(MassConcentrationUnit.PoundPerUSGallon); /// /// Get in SlugsPerCubicFoot. /// - public double SlugsPerCubicFoot => As(MassConcentrationUnit.SlugPerCubicFoot); + public T SlugsPerCubicFoot => As(MassConcentrationUnit.SlugPerCubicFoot); /// /// Get in TonnesPerCubicCentimeter. /// - public double TonnesPerCubicCentimeter => As(MassConcentrationUnit.TonnePerCubicCentimeter); + public T TonnesPerCubicCentimeter => As(MassConcentrationUnit.TonnePerCubicCentimeter); /// /// Get in TonnesPerCubicMeter. /// - public double TonnesPerCubicMeter => As(MassConcentrationUnit.TonnePerCubicMeter); + public T TonnesPerCubicMeter => As(MassConcentrationUnit.TonnePerCubicMeter); /// /// Get in TonnesPerCubicMillimeter. /// - public double TonnesPerCubicMillimeter => As(MassConcentrationUnit.TonnePerCubicMillimeter); + public T TonnesPerCubicMillimeter => As(MassConcentrationUnit.TonnePerCubicMillimeter); #endregion @@ -438,361 +435,321 @@ public static string GetAbbreviation(MassConcentrationUnit unit, [CanBeNull] IFo /// Get from CentigramsPerDeciliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromCentigramsPerDeciliter(QuantityValue centigramsperdeciliter) + public static MassConcentration FromCentigramsPerDeciliter(T centigramsperdeciliter) { - double value = (double) centigramsperdeciliter; - return new MassConcentration(value, MassConcentrationUnit.CentigramPerDeciliter); + return new MassConcentration(centigramsperdeciliter, MassConcentrationUnit.CentigramPerDeciliter); } /// /// Get from CentigramsPerLiter. /// /// If value is NaN or Infinity. - public static MassConcentration FromCentigramsPerLiter(QuantityValue centigramsperliter) + public static MassConcentration FromCentigramsPerLiter(T centigramsperliter) { - double value = (double) centigramsperliter; - return new MassConcentration(value, MassConcentrationUnit.CentigramPerLiter); + return new MassConcentration(centigramsperliter, MassConcentrationUnit.CentigramPerLiter); } /// /// Get from CentigramsPerMilliliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromCentigramsPerMilliliter(QuantityValue centigramspermilliliter) + public static MassConcentration FromCentigramsPerMilliliter(T centigramspermilliliter) { - double value = (double) centigramspermilliliter; - return new MassConcentration(value, MassConcentrationUnit.CentigramPerMilliliter); + return new MassConcentration(centigramspermilliliter, MassConcentrationUnit.CentigramPerMilliliter); } /// /// Get from DecigramsPerDeciliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromDecigramsPerDeciliter(QuantityValue decigramsperdeciliter) + public static MassConcentration FromDecigramsPerDeciliter(T decigramsperdeciliter) { - double value = (double) decigramsperdeciliter; - return new MassConcentration(value, MassConcentrationUnit.DecigramPerDeciliter); + return new MassConcentration(decigramsperdeciliter, MassConcentrationUnit.DecigramPerDeciliter); } /// /// Get from DecigramsPerLiter. /// /// If value is NaN or Infinity. - public static MassConcentration FromDecigramsPerLiter(QuantityValue decigramsperliter) + public static MassConcentration FromDecigramsPerLiter(T decigramsperliter) { - double value = (double) decigramsperliter; - return new MassConcentration(value, MassConcentrationUnit.DecigramPerLiter); + return new MassConcentration(decigramsperliter, MassConcentrationUnit.DecigramPerLiter); } /// /// Get from DecigramsPerMilliliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromDecigramsPerMilliliter(QuantityValue decigramspermilliliter) + public static MassConcentration FromDecigramsPerMilliliter(T decigramspermilliliter) { - double value = (double) decigramspermilliliter; - return new MassConcentration(value, MassConcentrationUnit.DecigramPerMilliliter); + return new MassConcentration(decigramspermilliliter, MassConcentrationUnit.DecigramPerMilliliter); } /// /// Get from GramsPerCubicCentimeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromGramsPerCubicCentimeter(QuantityValue gramspercubiccentimeter) + public static MassConcentration FromGramsPerCubicCentimeter(T gramspercubiccentimeter) { - double value = (double) gramspercubiccentimeter; - return new MassConcentration(value, MassConcentrationUnit.GramPerCubicCentimeter); + return new MassConcentration(gramspercubiccentimeter, MassConcentrationUnit.GramPerCubicCentimeter); } /// /// Get from GramsPerCubicMeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromGramsPerCubicMeter(QuantityValue gramspercubicmeter) + public static MassConcentration FromGramsPerCubicMeter(T gramspercubicmeter) { - double value = (double) gramspercubicmeter; - return new MassConcentration(value, MassConcentrationUnit.GramPerCubicMeter); + return new MassConcentration(gramspercubicmeter, MassConcentrationUnit.GramPerCubicMeter); } /// /// Get from GramsPerCubicMillimeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromGramsPerCubicMillimeter(QuantityValue gramspercubicmillimeter) + public static MassConcentration FromGramsPerCubicMillimeter(T gramspercubicmillimeter) { - double value = (double) gramspercubicmillimeter; - return new MassConcentration(value, MassConcentrationUnit.GramPerCubicMillimeter); + return new MassConcentration(gramspercubicmillimeter, MassConcentrationUnit.GramPerCubicMillimeter); } /// /// Get from GramsPerDeciliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromGramsPerDeciliter(QuantityValue gramsperdeciliter) + public static MassConcentration FromGramsPerDeciliter(T gramsperdeciliter) { - double value = (double) gramsperdeciliter; - return new MassConcentration(value, MassConcentrationUnit.GramPerDeciliter); + return new MassConcentration(gramsperdeciliter, MassConcentrationUnit.GramPerDeciliter); } /// /// Get from GramsPerLiter. /// /// If value is NaN or Infinity. - public static MassConcentration FromGramsPerLiter(QuantityValue gramsperliter) + public static MassConcentration FromGramsPerLiter(T gramsperliter) { - double value = (double) gramsperliter; - return new MassConcentration(value, MassConcentrationUnit.GramPerLiter); + return new MassConcentration(gramsperliter, MassConcentrationUnit.GramPerLiter); } /// /// Get from GramsPerMilliliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromGramsPerMilliliter(QuantityValue gramspermilliliter) + public static MassConcentration FromGramsPerMilliliter(T gramspermilliliter) { - double value = (double) gramspermilliliter; - return new MassConcentration(value, MassConcentrationUnit.GramPerMilliliter); + return new MassConcentration(gramspermilliliter, MassConcentrationUnit.GramPerMilliliter); } /// /// Get from KilogramsPerCubicCentimeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromKilogramsPerCubicCentimeter(QuantityValue kilogramspercubiccentimeter) + public static MassConcentration FromKilogramsPerCubicCentimeter(T kilogramspercubiccentimeter) { - double value = (double) kilogramspercubiccentimeter; - return new MassConcentration(value, MassConcentrationUnit.KilogramPerCubicCentimeter); + return new MassConcentration(kilogramspercubiccentimeter, MassConcentrationUnit.KilogramPerCubicCentimeter); } /// /// Get from KilogramsPerCubicMeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromKilogramsPerCubicMeter(QuantityValue kilogramspercubicmeter) + public static MassConcentration FromKilogramsPerCubicMeter(T kilogramspercubicmeter) { - double value = (double) kilogramspercubicmeter; - return new MassConcentration(value, MassConcentrationUnit.KilogramPerCubicMeter); + return new MassConcentration(kilogramspercubicmeter, MassConcentrationUnit.KilogramPerCubicMeter); } /// /// Get from KilogramsPerCubicMillimeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromKilogramsPerCubicMillimeter(QuantityValue kilogramspercubicmillimeter) + public static MassConcentration FromKilogramsPerCubicMillimeter(T kilogramspercubicmillimeter) { - double value = (double) kilogramspercubicmillimeter; - return new MassConcentration(value, MassConcentrationUnit.KilogramPerCubicMillimeter); + return new MassConcentration(kilogramspercubicmillimeter, MassConcentrationUnit.KilogramPerCubicMillimeter); } /// /// Get from KilogramsPerLiter. /// /// If value is NaN or Infinity. - public static MassConcentration FromKilogramsPerLiter(QuantityValue kilogramsperliter) + public static MassConcentration FromKilogramsPerLiter(T kilogramsperliter) { - double value = (double) kilogramsperliter; - return new MassConcentration(value, MassConcentrationUnit.KilogramPerLiter); + return new MassConcentration(kilogramsperliter, MassConcentrationUnit.KilogramPerLiter); } /// /// Get from KilopoundsPerCubicFoot. /// /// If value is NaN or Infinity. - public static MassConcentration FromKilopoundsPerCubicFoot(QuantityValue kilopoundspercubicfoot) + public static MassConcentration FromKilopoundsPerCubicFoot(T kilopoundspercubicfoot) { - double value = (double) kilopoundspercubicfoot; - return new MassConcentration(value, MassConcentrationUnit.KilopoundPerCubicFoot); + return new MassConcentration(kilopoundspercubicfoot, MassConcentrationUnit.KilopoundPerCubicFoot); } /// /// Get from KilopoundsPerCubicInch. /// /// If value is NaN or Infinity. - public static MassConcentration FromKilopoundsPerCubicInch(QuantityValue kilopoundspercubicinch) + public static MassConcentration FromKilopoundsPerCubicInch(T kilopoundspercubicinch) { - double value = (double) kilopoundspercubicinch; - return new MassConcentration(value, MassConcentrationUnit.KilopoundPerCubicInch); + return new MassConcentration(kilopoundspercubicinch, MassConcentrationUnit.KilopoundPerCubicInch); } /// /// Get from MicrogramsPerCubicMeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromMicrogramsPerCubicMeter(QuantityValue microgramspercubicmeter) + public static MassConcentration FromMicrogramsPerCubicMeter(T microgramspercubicmeter) { - double value = (double) microgramspercubicmeter; - return new MassConcentration(value, MassConcentrationUnit.MicrogramPerCubicMeter); + return new MassConcentration(microgramspercubicmeter, MassConcentrationUnit.MicrogramPerCubicMeter); } /// /// Get from MicrogramsPerDeciliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromMicrogramsPerDeciliter(QuantityValue microgramsperdeciliter) + public static MassConcentration FromMicrogramsPerDeciliter(T microgramsperdeciliter) { - double value = (double) microgramsperdeciliter; - return new MassConcentration(value, MassConcentrationUnit.MicrogramPerDeciliter); + return new MassConcentration(microgramsperdeciliter, MassConcentrationUnit.MicrogramPerDeciliter); } /// /// Get from MicrogramsPerLiter. /// /// If value is NaN or Infinity. - public static MassConcentration FromMicrogramsPerLiter(QuantityValue microgramsperliter) + public static MassConcentration FromMicrogramsPerLiter(T microgramsperliter) { - double value = (double) microgramsperliter; - return new MassConcentration(value, MassConcentrationUnit.MicrogramPerLiter); + return new MassConcentration(microgramsperliter, MassConcentrationUnit.MicrogramPerLiter); } /// /// Get from MicrogramsPerMilliliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromMicrogramsPerMilliliter(QuantityValue microgramspermilliliter) + public static MassConcentration FromMicrogramsPerMilliliter(T microgramspermilliliter) { - double value = (double) microgramspermilliliter; - return new MassConcentration(value, MassConcentrationUnit.MicrogramPerMilliliter); + return new MassConcentration(microgramspermilliliter, MassConcentrationUnit.MicrogramPerMilliliter); } /// /// Get from MilligramsPerCubicMeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromMilligramsPerCubicMeter(QuantityValue milligramspercubicmeter) + public static MassConcentration FromMilligramsPerCubicMeter(T milligramspercubicmeter) { - double value = (double) milligramspercubicmeter; - return new MassConcentration(value, MassConcentrationUnit.MilligramPerCubicMeter); + return new MassConcentration(milligramspercubicmeter, MassConcentrationUnit.MilligramPerCubicMeter); } /// /// Get from MilligramsPerDeciliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromMilligramsPerDeciliter(QuantityValue milligramsperdeciliter) + public static MassConcentration FromMilligramsPerDeciliter(T milligramsperdeciliter) { - double value = (double) milligramsperdeciliter; - return new MassConcentration(value, MassConcentrationUnit.MilligramPerDeciliter); + return new MassConcentration(milligramsperdeciliter, MassConcentrationUnit.MilligramPerDeciliter); } /// /// Get from MilligramsPerLiter. /// /// If value is NaN or Infinity. - public static MassConcentration FromMilligramsPerLiter(QuantityValue milligramsperliter) + public static MassConcentration FromMilligramsPerLiter(T milligramsperliter) { - double value = (double) milligramsperliter; - return new MassConcentration(value, MassConcentrationUnit.MilligramPerLiter); + return new MassConcentration(milligramsperliter, MassConcentrationUnit.MilligramPerLiter); } /// /// Get from MilligramsPerMilliliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromMilligramsPerMilliliter(QuantityValue milligramspermilliliter) + public static MassConcentration FromMilligramsPerMilliliter(T milligramspermilliliter) { - double value = (double) milligramspermilliliter; - return new MassConcentration(value, MassConcentrationUnit.MilligramPerMilliliter); + return new MassConcentration(milligramspermilliliter, MassConcentrationUnit.MilligramPerMilliliter); } /// /// Get from NanogramsPerDeciliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromNanogramsPerDeciliter(QuantityValue nanogramsperdeciliter) + public static MassConcentration FromNanogramsPerDeciliter(T nanogramsperdeciliter) { - double value = (double) nanogramsperdeciliter; - return new MassConcentration(value, MassConcentrationUnit.NanogramPerDeciliter); + return new MassConcentration(nanogramsperdeciliter, MassConcentrationUnit.NanogramPerDeciliter); } /// /// Get from NanogramsPerLiter. /// /// If value is NaN or Infinity. - public static MassConcentration FromNanogramsPerLiter(QuantityValue nanogramsperliter) + public static MassConcentration FromNanogramsPerLiter(T nanogramsperliter) { - double value = (double) nanogramsperliter; - return new MassConcentration(value, MassConcentrationUnit.NanogramPerLiter); + return new MassConcentration(nanogramsperliter, MassConcentrationUnit.NanogramPerLiter); } /// /// Get from NanogramsPerMilliliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromNanogramsPerMilliliter(QuantityValue nanogramspermilliliter) + public static MassConcentration FromNanogramsPerMilliliter(T nanogramspermilliliter) { - double value = (double) nanogramspermilliliter; - return new MassConcentration(value, MassConcentrationUnit.NanogramPerMilliliter); + return new MassConcentration(nanogramspermilliliter, MassConcentrationUnit.NanogramPerMilliliter); } /// /// Get from PicogramsPerDeciliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromPicogramsPerDeciliter(QuantityValue picogramsperdeciliter) + public static MassConcentration FromPicogramsPerDeciliter(T picogramsperdeciliter) { - double value = (double) picogramsperdeciliter; - return new MassConcentration(value, MassConcentrationUnit.PicogramPerDeciliter); + return new MassConcentration(picogramsperdeciliter, MassConcentrationUnit.PicogramPerDeciliter); } /// /// Get from PicogramsPerLiter. /// /// If value is NaN or Infinity. - public static MassConcentration FromPicogramsPerLiter(QuantityValue picogramsperliter) + public static MassConcentration FromPicogramsPerLiter(T picogramsperliter) { - double value = (double) picogramsperliter; - return new MassConcentration(value, MassConcentrationUnit.PicogramPerLiter); + return new MassConcentration(picogramsperliter, MassConcentrationUnit.PicogramPerLiter); } /// /// Get from PicogramsPerMilliliter. /// /// If value is NaN or Infinity. - public static MassConcentration FromPicogramsPerMilliliter(QuantityValue picogramspermilliliter) + public static MassConcentration FromPicogramsPerMilliliter(T picogramspermilliliter) { - double value = (double) picogramspermilliliter; - return new MassConcentration(value, MassConcentrationUnit.PicogramPerMilliliter); + return new MassConcentration(picogramspermilliliter, MassConcentrationUnit.PicogramPerMilliliter); } /// /// Get from PoundsPerCubicFoot. /// /// If value is NaN or Infinity. - public static MassConcentration FromPoundsPerCubicFoot(QuantityValue poundspercubicfoot) + public static MassConcentration FromPoundsPerCubicFoot(T poundspercubicfoot) { - double value = (double) poundspercubicfoot; - return new MassConcentration(value, MassConcentrationUnit.PoundPerCubicFoot); + return new MassConcentration(poundspercubicfoot, MassConcentrationUnit.PoundPerCubicFoot); } /// /// Get from PoundsPerCubicInch. /// /// If value is NaN or Infinity. - public static MassConcentration FromPoundsPerCubicInch(QuantityValue poundspercubicinch) + public static MassConcentration FromPoundsPerCubicInch(T poundspercubicinch) { - double value = (double) poundspercubicinch; - return new MassConcentration(value, MassConcentrationUnit.PoundPerCubicInch); + return new MassConcentration(poundspercubicinch, MassConcentrationUnit.PoundPerCubicInch); } /// /// Get from PoundsPerImperialGallon. /// /// If value is NaN or Infinity. - public static MassConcentration FromPoundsPerImperialGallon(QuantityValue poundsperimperialgallon) + public static MassConcentration FromPoundsPerImperialGallon(T poundsperimperialgallon) { - double value = (double) poundsperimperialgallon; - return new MassConcentration(value, MassConcentrationUnit.PoundPerImperialGallon); + return new MassConcentration(poundsperimperialgallon, MassConcentrationUnit.PoundPerImperialGallon); } /// /// Get from PoundsPerUSGallon. /// /// If value is NaN or Infinity. - public static MassConcentration FromPoundsPerUSGallon(QuantityValue poundsperusgallon) + public static MassConcentration FromPoundsPerUSGallon(T poundsperusgallon) { - double value = (double) poundsperusgallon; - return new MassConcentration(value, MassConcentrationUnit.PoundPerUSGallon); + return new MassConcentration(poundsperusgallon, MassConcentrationUnit.PoundPerUSGallon); } /// /// Get from SlugsPerCubicFoot. /// /// If value is NaN or Infinity. - public static MassConcentration FromSlugsPerCubicFoot(QuantityValue slugspercubicfoot) + public static MassConcentration FromSlugsPerCubicFoot(T slugspercubicfoot) { - double value = (double) slugspercubicfoot; - return new MassConcentration(value, MassConcentrationUnit.SlugPerCubicFoot); + return new MassConcentration(slugspercubicfoot, MassConcentrationUnit.SlugPerCubicFoot); } /// /// Get from TonnesPerCubicCentimeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromTonnesPerCubicCentimeter(QuantityValue tonnespercubiccentimeter) + public static MassConcentration FromTonnesPerCubicCentimeter(T tonnespercubiccentimeter) { - double value = (double) tonnespercubiccentimeter; - return new MassConcentration(value, MassConcentrationUnit.TonnePerCubicCentimeter); + return new MassConcentration(tonnespercubiccentimeter, MassConcentrationUnit.TonnePerCubicCentimeter); } /// /// Get from TonnesPerCubicMeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromTonnesPerCubicMeter(QuantityValue tonnespercubicmeter) + public static MassConcentration FromTonnesPerCubicMeter(T tonnespercubicmeter) { - double value = (double) tonnespercubicmeter; - return new MassConcentration(value, MassConcentrationUnit.TonnePerCubicMeter); + return new MassConcentration(tonnespercubicmeter, MassConcentrationUnit.TonnePerCubicMeter); } /// /// Get from TonnesPerCubicMillimeter. /// /// If value is NaN or Infinity. - public static MassConcentration FromTonnesPerCubicMillimeter(QuantityValue tonnespercubicmillimeter) + public static MassConcentration FromTonnesPerCubicMillimeter(T tonnespercubicmillimeter) { - double value = (double) tonnespercubicmillimeter; - return new MassConcentration(value, MassConcentrationUnit.TonnePerCubicMillimeter); + return new MassConcentration(tonnespercubicmillimeter, MassConcentrationUnit.TonnePerCubicMillimeter); } /// @@ -801,9 +758,9 @@ public static MassConcentration FromTonnesPerCubicMillimeter(QuantityValue to /// Value to convert from. /// Unit to convert from. /// unit value. - public static MassConcentration From(QuantityValue value, MassConcentrationUnit fromUnit) + public static MassConcentration From(T value, MassConcentrationUnit fromUnit) { - return new MassConcentration((double)value, fromUnit); + return new MassConcentration(value, fromUnit); } #endregion @@ -957,43 +914,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassCo /// Negate the value. public static MassConcentration operator -(MassConcentration right) { - return new MassConcentration(-right.Value, right.Unit); + return new MassConcentration(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static MassConcentration operator +(MassConcentration left, MassConcentration right) { - return new MassConcentration(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new MassConcentration(value, left.Unit); } /// Get from subtracting two . public static MassConcentration operator -(MassConcentration left, MassConcentration right) { - return new MassConcentration(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new MassConcentration(value, left.Unit); } /// Get from multiplying value and . - public static MassConcentration operator *(double left, MassConcentration right) + public static MassConcentration operator *(T left, MassConcentration right) { - return new MassConcentration(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new MassConcentration(value, right.Unit); } /// Get from multiplying value and . - public static MassConcentration operator *(MassConcentration left, double right) + public static MassConcentration operator *(MassConcentration left, T right) { - return new MassConcentration(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new MassConcentration(value, left.Unit); } /// Get from dividing by value. - public static MassConcentration operator /(MassConcentration left, double right) + public static MassConcentration operator /(MassConcentration left, T right) { - return new MassConcentration(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new MassConcentration(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(MassConcentration left, MassConcentration right) + public static T operator /(MassConcentration left, MassConcentration right) { - return left.KilogramsPerCubicMeter / right.KilogramsPerCubicMeter; + return CompiledLambdas.Divide(left.KilogramsPerCubicMeter, right.KilogramsPerCubicMeter); } #endregion @@ -1003,25 +965,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassCo /// Returns true if less or equal to. public static bool operator <=(MassConcentration left, MassConcentration right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(MassConcentration left, MassConcentration right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(MassConcentration left, MassConcentration right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(MassConcentration left, MassConcentration right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -1050,7 +1012,7 @@ public int CompareTo(object obj) /// public int CompareTo(MassConcentration other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -1067,7 +1029,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MassConcentration other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1115,10 +1077,8 @@ public bool Equals(MassConcentration other, double tolerance, ComparisonType if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -1138,17 +1098,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MassConcentrationUnit unit) + public T As(MassConcentrationUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1168,9 +1128,14 @@ double IQuantity.As(Enum unit) if(!(unit is MassConcentrationUnit unitAsMassConcentrationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassConcentrationUnit)} is supported.", nameof(unit)); - return As(unitAsMassConcentrationUnit); + var asValue = As(unitAsMassConcentrationUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(MassConcentrationUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -1211,58 +1176,64 @@ public MassConcentration ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(MassConcentrationUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(MassConcentrationUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case MassConcentrationUnit.CentigramPerDeciliter: return (_value/1e-1) * 1e-2d; - case MassConcentrationUnit.CentigramPerLiter: return (_value) * 1e-2d; - case MassConcentrationUnit.CentigramPerMilliliter: return (_value/1e-3) * 1e-2d; - case MassConcentrationUnit.DecigramPerDeciliter: return (_value/1e-1) * 1e-1d; - case MassConcentrationUnit.DecigramPerLiter: return (_value) * 1e-1d; - case MassConcentrationUnit.DecigramPerMilliliter: return (_value/1e-3) * 1e-1d; - case MassConcentrationUnit.GramPerCubicCentimeter: return _value/1e-3; - case MassConcentrationUnit.GramPerCubicMeter: return _value/1e3; - case MassConcentrationUnit.GramPerCubicMillimeter: return _value/1e-6; - case MassConcentrationUnit.GramPerDeciliter: return _value/1e-1; - case MassConcentrationUnit.GramPerLiter: return _value; - case MassConcentrationUnit.GramPerMilliliter: return _value/1e-3; - case MassConcentrationUnit.KilogramPerCubicCentimeter: return (_value/1e-3) * 1e3d; - case MassConcentrationUnit.KilogramPerCubicMeter: return (_value/1e3) * 1e3d; - case MassConcentrationUnit.KilogramPerCubicMillimeter: return (_value/1e-6) * 1e3d; - case MassConcentrationUnit.KilogramPerLiter: return (_value) * 1e3d; - case MassConcentrationUnit.KilopoundPerCubicFoot: return (_value/0.062427961) * 1e3d; - case MassConcentrationUnit.KilopoundPerCubicInch: return (_value/3.6127298147753e-5) * 1e3d; - case MassConcentrationUnit.MicrogramPerCubicMeter: return (_value/1e3) * 1e-6d; - case MassConcentrationUnit.MicrogramPerDeciliter: return (_value/1e-1) * 1e-6d; - case MassConcentrationUnit.MicrogramPerLiter: return (_value) * 1e-6d; - case MassConcentrationUnit.MicrogramPerMilliliter: return (_value/1e-3) * 1e-6d; - case MassConcentrationUnit.MilligramPerCubicMeter: return (_value/1e3) * 1e-3d; - case MassConcentrationUnit.MilligramPerDeciliter: return (_value/1e-1) * 1e-3d; - case MassConcentrationUnit.MilligramPerLiter: return (_value) * 1e-3d; - case MassConcentrationUnit.MilligramPerMilliliter: return (_value/1e-3) * 1e-3d; - case MassConcentrationUnit.NanogramPerDeciliter: return (_value/1e-1) * 1e-9d; - case MassConcentrationUnit.NanogramPerLiter: return (_value) * 1e-9d; - case MassConcentrationUnit.NanogramPerMilliliter: return (_value/1e-3) * 1e-9d; - case MassConcentrationUnit.PicogramPerDeciliter: return (_value/1e-1) * 1e-12d; - case MassConcentrationUnit.PicogramPerLiter: return (_value) * 1e-12d; - case MassConcentrationUnit.PicogramPerMilliliter: return (_value/1e-3) * 1e-12d; - case MassConcentrationUnit.PoundPerCubicFoot: return _value/0.062427961; - case MassConcentrationUnit.PoundPerCubicInch: return _value/3.6127298147753e-5; - case MassConcentrationUnit.PoundPerImperialGallon: return _value*9.9776398e1; - case MassConcentrationUnit.PoundPerUSGallon: return _value*1.19826427e2; - case MassConcentrationUnit.SlugPerCubicFoot: return _value*515.378818; - case MassConcentrationUnit.TonnePerCubicCentimeter: return _value/1e-9; - case MassConcentrationUnit.TonnePerCubicMeter: return _value/0.001; - case MassConcentrationUnit.TonnePerCubicMillimeter: return _value/1e-12; + case MassConcentrationUnit.CentigramPerDeciliter: return (Value/1e-1) * 1e-2d; + case MassConcentrationUnit.CentigramPerLiter: return (Value) * 1e-2d; + case MassConcentrationUnit.CentigramPerMilliliter: return (Value/1e-3) * 1e-2d; + case MassConcentrationUnit.DecigramPerDeciliter: return (Value/1e-1) * 1e-1d; + case MassConcentrationUnit.DecigramPerLiter: return (Value) * 1e-1d; + case MassConcentrationUnit.DecigramPerMilliliter: return (Value/1e-3) * 1e-1d; + case MassConcentrationUnit.GramPerCubicCentimeter: return Value/1e-3; + case MassConcentrationUnit.GramPerCubicMeter: return Value/1e3; + case MassConcentrationUnit.GramPerCubicMillimeter: return Value/1e-6; + case MassConcentrationUnit.GramPerDeciliter: return Value/1e-1; + case MassConcentrationUnit.GramPerLiter: return Value; + case MassConcentrationUnit.GramPerMilliliter: return Value/1e-3; + case MassConcentrationUnit.KilogramPerCubicCentimeter: return (Value/1e-3) * 1e3d; + case MassConcentrationUnit.KilogramPerCubicMeter: return (Value/1e3) * 1e3d; + case MassConcentrationUnit.KilogramPerCubicMillimeter: return (Value/1e-6) * 1e3d; + case MassConcentrationUnit.KilogramPerLiter: return (Value) * 1e3d; + case MassConcentrationUnit.KilopoundPerCubicFoot: return (Value/0.062427961) * 1e3d; + case MassConcentrationUnit.KilopoundPerCubicInch: return (Value/3.6127298147753e-5) * 1e3d; + case MassConcentrationUnit.MicrogramPerCubicMeter: return (Value/1e3) * 1e-6d; + case MassConcentrationUnit.MicrogramPerDeciliter: return (Value/1e-1) * 1e-6d; + case MassConcentrationUnit.MicrogramPerLiter: return (Value) * 1e-6d; + case MassConcentrationUnit.MicrogramPerMilliliter: return (Value/1e-3) * 1e-6d; + case MassConcentrationUnit.MilligramPerCubicMeter: return (Value/1e3) * 1e-3d; + case MassConcentrationUnit.MilligramPerDeciliter: return (Value/1e-1) * 1e-3d; + case MassConcentrationUnit.MilligramPerLiter: return (Value) * 1e-3d; + case MassConcentrationUnit.MilligramPerMilliliter: return (Value/1e-3) * 1e-3d; + case MassConcentrationUnit.NanogramPerDeciliter: return (Value/1e-1) * 1e-9d; + case MassConcentrationUnit.NanogramPerLiter: return (Value) * 1e-9d; + case MassConcentrationUnit.NanogramPerMilliliter: return (Value/1e-3) * 1e-9d; + case MassConcentrationUnit.PicogramPerDeciliter: return (Value/1e-1) * 1e-12d; + case MassConcentrationUnit.PicogramPerLiter: return (Value) * 1e-12d; + case MassConcentrationUnit.PicogramPerMilliliter: return (Value/1e-3) * 1e-12d; + case MassConcentrationUnit.PoundPerCubicFoot: return Value/0.062427961; + case MassConcentrationUnit.PoundPerCubicInch: return Value/3.6127298147753e-5; + case MassConcentrationUnit.PoundPerImperialGallon: return Value*9.9776398e1; + case MassConcentrationUnit.PoundPerUSGallon: return Value*1.19826427e2; + case MassConcentrationUnit.SlugPerCubicFoot: return Value*515.378818; + case MassConcentrationUnit.TonnePerCubicCentimeter: return Value/1e-9; + case MassConcentrationUnit.TonnePerCubicMeter: return Value/0.001; + case MassConcentrationUnit.TonnePerCubicMillimeter: return Value/1e-12; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -1279,10 +1250,10 @@ internal MassConcentration ToBaseUnit() return new MassConcentration(baseUnitValue, BaseUnit); } - private double GetValueAs(MassConcentrationUnit unit) + private T GetValueAs(MassConcentrationUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1429,7 +1400,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1444,37 +1415,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1498,17 +1469,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs index a0944564d2..3d09b1c712 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Mass flow is the ratio of the mass change to the time during which the change occurred (value of mass changes per unit time). /// - public partial struct MassFlow : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct MassFlow : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -93,12 +88,12 @@ static MassFlow() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public MassFlow(double value, MassFlowUnit unit) + public MassFlow(T value, MassFlowUnit unit) { if(unit == MassFlowUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -110,14 +105,14 @@ public MassFlow(double value, MassFlowUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public MassFlow(double value, UnitSystem unitSystem) + public MassFlow(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -159,7 +154,7 @@ public MassFlow(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit GramPerSecond. /// - public static MassFlow Zero { get; } = new MassFlow(0, BaseUnit); + public static MassFlow Zero { get; } = new MassFlow((T)0, BaseUnit); #endregion @@ -168,7 +163,9 @@ public MassFlow(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -198,167 +195,167 @@ public MassFlow(double value, UnitSystem unitSystem) /// /// Get in CentigramsPerDay. /// - public double CentigramsPerDay => As(MassFlowUnit.CentigramPerDay); + public T CentigramsPerDay => As(MassFlowUnit.CentigramPerDay); /// /// Get in CentigramsPerSecond. /// - public double CentigramsPerSecond => As(MassFlowUnit.CentigramPerSecond); + public T CentigramsPerSecond => As(MassFlowUnit.CentigramPerSecond); /// /// Get in DecagramsPerDay. /// - public double DecagramsPerDay => As(MassFlowUnit.DecagramPerDay); + public T DecagramsPerDay => As(MassFlowUnit.DecagramPerDay); /// /// Get in DecagramsPerSecond. /// - public double DecagramsPerSecond => As(MassFlowUnit.DecagramPerSecond); + public T DecagramsPerSecond => As(MassFlowUnit.DecagramPerSecond); /// /// Get in DecigramsPerDay. /// - public double DecigramsPerDay => As(MassFlowUnit.DecigramPerDay); + public T DecigramsPerDay => As(MassFlowUnit.DecigramPerDay); /// /// Get in DecigramsPerSecond. /// - public double DecigramsPerSecond => As(MassFlowUnit.DecigramPerSecond); + public T DecigramsPerSecond => As(MassFlowUnit.DecigramPerSecond); /// /// Get in GramsPerDay. /// - public double GramsPerDay => As(MassFlowUnit.GramPerDay); + public T GramsPerDay => As(MassFlowUnit.GramPerDay); /// /// Get in GramsPerHour. /// - public double GramsPerHour => As(MassFlowUnit.GramPerHour); + public T GramsPerHour => As(MassFlowUnit.GramPerHour); /// /// Get in GramsPerSecond. /// - public double GramsPerSecond => As(MassFlowUnit.GramPerSecond); + public T GramsPerSecond => As(MassFlowUnit.GramPerSecond); /// /// Get in HectogramsPerDay. /// - public double HectogramsPerDay => As(MassFlowUnit.HectogramPerDay); + public T HectogramsPerDay => As(MassFlowUnit.HectogramPerDay); /// /// Get in HectogramsPerSecond. /// - public double HectogramsPerSecond => As(MassFlowUnit.HectogramPerSecond); + public T HectogramsPerSecond => As(MassFlowUnit.HectogramPerSecond); /// /// Get in KilogramsPerDay. /// - public double KilogramsPerDay => As(MassFlowUnit.KilogramPerDay); + public T KilogramsPerDay => As(MassFlowUnit.KilogramPerDay); /// /// Get in KilogramsPerHour. /// - public double KilogramsPerHour => As(MassFlowUnit.KilogramPerHour); + public T KilogramsPerHour => As(MassFlowUnit.KilogramPerHour); /// /// Get in KilogramsPerMinute. /// - public double KilogramsPerMinute => As(MassFlowUnit.KilogramPerMinute); + public T KilogramsPerMinute => As(MassFlowUnit.KilogramPerMinute); /// /// Get in KilogramsPerSecond. /// - public double KilogramsPerSecond => As(MassFlowUnit.KilogramPerSecond); + public T KilogramsPerSecond => As(MassFlowUnit.KilogramPerSecond); /// /// Get in MegagramsPerDay. /// - public double MegagramsPerDay => As(MassFlowUnit.MegagramPerDay); + public T MegagramsPerDay => As(MassFlowUnit.MegagramPerDay); /// /// Get in MegapoundsPerDay. /// - public double MegapoundsPerDay => As(MassFlowUnit.MegapoundPerDay); + public T MegapoundsPerDay => As(MassFlowUnit.MegapoundPerDay); /// /// Get in MegapoundsPerHour. /// - public double MegapoundsPerHour => As(MassFlowUnit.MegapoundPerHour); + public T MegapoundsPerHour => As(MassFlowUnit.MegapoundPerHour); /// /// Get in MegapoundsPerMinute. /// - public double MegapoundsPerMinute => As(MassFlowUnit.MegapoundPerMinute); + public T MegapoundsPerMinute => As(MassFlowUnit.MegapoundPerMinute); /// /// Get in MegapoundsPerSecond. /// - public double MegapoundsPerSecond => As(MassFlowUnit.MegapoundPerSecond); + public T MegapoundsPerSecond => As(MassFlowUnit.MegapoundPerSecond); /// /// Get in MicrogramsPerDay. /// - public double MicrogramsPerDay => As(MassFlowUnit.MicrogramPerDay); + public T MicrogramsPerDay => As(MassFlowUnit.MicrogramPerDay); /// /// Get in MicrogramsPerSecond. /// - public double MicrogramsPerSecond => As(MassFlowUnit.MicrogramPerSecond); + public T MicrogramsPerSecond => As(MassFlowUnit.MicrogramPerSecond); /// /// Get in MilligramsPerDay. /// - public double MilligramsPerDay => As(MassFlowUnit.MilligramPerDay); + public T MilligramsPerDay => As(MassFlowUnit.MilligramPerDay); /// /// Get in MilligramsPerSecond. /// - public double MilligramsPerSecond => As(MassFlowUnit.MilligramPerSecond); + public T MilligramsPerSecond => As(MassFlowUnit.MilligramPerSecond); /// /// Get in NanogramsPerDay. /// - public double NanogramsPerDay => As(MassFlowUnit.NanogramPerDay); + public T NanogramsPerDay => As(MassFlowUnit.NanogramPerDay); /// /// Get in NanogramsPerSecond. /// - public double NanogramsPerSecond => As(MassFlowUnit.NanogramPerSecond); + public T NanogramsPerSecond => As(MassFlowUnit.NanogramPerSecond); /// /// Get in PoundsPerDay. /// - public double PoundsPerDay => As(MassFlowUnit.PoundPerDay); + public T PoundsPerDay => As(MassFlowUnit.PoundPerDay); /// /// Get in PoundsPerHour. /// - public double PoundsPerHour => As(MassFlowUnit.PoundPerHour); + public T PoundsPerHour => As(MassFlowUnit.PoundPerHour); /// /// Get in PoundsPerMinute. /// - public double PoundsPerMinute => As(MassFlowUnit.PoundPerMinute); + public T PoundsPerMinute => As(MassFlowUnit.PoundPerMinute); /// /// Get in PoundsPerSecond. /// - public double PoundsPerSecond => As(MassFlowUnit.PoundPerSecond); + public T PoundsPerSecond => As(MassFlowUnit.PoundPerSecond); /// /// Get in ShortTonsPerHour. /// - public double ShortTonsPerHour => As(MassFlowUnit.ShortTonPerHour); + public T ShortTonsPerHour => As(MassFlowUnit.ShortTonPerHour); /// /// Get in TonnesPerDay. /// - public double TonnesPerDay => As(MassFlowUnit.TonnePerDay); + public T TonnesPerDay => As(MassFlowUnit.TonnePerDay); /// /// Get in TonnesPerHour. /// - public double TonnesPerHour => As(MassFlowUnit.TonnePerHour); + public T TonnesPerHour => As(MassFlowUnit.TonnePerHour); #endregion @@ -393,298 +390,265 @@ public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] IFormatProvi /// Get from CentigramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromCentigramsPerDay(QuantityValue centigramsperday) + public static MassFlow FromCentigramsPerDay(T centigramsperday) { - double value = (double) centigramsperday; - return new MassFlow(value, MassFlowUnit.CentigramPerDay); + return new MassFlow(centigramsperday, MassFlowUnit.CentigramPerDay); } /// /// Get from CentigramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromCentigramsPerSecond(QuantityValue centigramspersecond) + public static MassFlow FromCentigramsPerSecond(T centigramspersecond) { - double value = (double) centigramspersecond; - return new MassFlow(value, MassFlowUnit.CentigramPerSecond); + return new MassFlow(centigramspersecond, MassFlowUnit.CentigramPerSecond); } /// /// Get from DecagramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromDecagramsPerDay(QuantityValue decagramsperday) + public static MassFlow FromDecagramsPerDay(T decagramsperday) { - double value = (double) decagramsperday; - return new MassFlow(value, MassFlowUnit.DecagramPerDay); + return new MassFlow(decagramsperday, MassFlowUnit.DecagramPerDay); } /// /// Get from DecagramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromDecagramsPerSecond(QuantityValue decagramspersecond) + public static MassFlow FromDecagramsPerSecond(T decagramspersecond) { - double value = (double) decagramspersecond; - return new MassFlow(value, MassFlowUnit.DecagramPerSecond); + return new MassFlow(decagramspersecond, MassFlowUnit.DecagramPerSecond); } /// /// Get from DecigramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromDecigramsPerDay(QuantityValue decigramsperday) + public static MassFlow FromDecigramsPerDay(T decigramsperday) { - double value = (double) decigramsperday; - return new MassFlow(value, MassFlowUnit.DecigramPerDay); + return new MassFlow(decigramsperday, MassFlowUnit.DecigramPerDay); } /// /// Get from DecigramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromDecigramsPerSecond(QuantityValue decigramspersecond) + public static MassFlow FromDecigramsPerSecond(T decigramspersecond) { - double value = (double) decigramspersecond; - return new MassFlow(value, MassFlowUnit.DecigramPerSecond); + return new MassFlow(decigramspersecond, MassFlowUnit.DecigramPerSecond); } /// /// Get from GramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromGramsPerDay(QuantityValue gramsperday) + public static MassFlow FromGramsPerDay(T gramsperday) { - double value = (double) gramsperday; - return new MassFlow(value, MassFlowUnit.GramPerDay); + return new MassFlow(gramsperday, MassFlowUnit.GramPerDay); } /// /// Get from GramsPerHour. /// /// If value is NaN or Infinity. - public static MassFlow FromGramsPerHour(QuantityValue gramsperhour) + public static MassFlow FromGramsPerHour(T gramsperhour) { - double value = (double) gramsperhour; - return new MassFlow(value, MassFlowUnit.GramPerHour); + return new MassFlow(gramsperhour, MassFlowUnit.GramPerHour); } /// /// Get from GramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromGramsPerSecond(QuantityValue gramspersecond) + public static MassFlow FromGramsPerSecond(T gramspersecond) { - double value = (double) gramspersecond; - return new MassFlow(value, MassFlowUnit.GramPerSecond); + return new MassFlow(gramspersecond, MassFlowUnit.GramPerSecond); } /// /// Get from HectogramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromHectogramsPerDay(QuantityValue hectogramsperday) + public static MassFlow FromHectogramsPerDay(T hectogramsperday) { - double value = (double) hectogramsperday; - return new MassFlow(value, MassFlowUnit.HectogramPerDay); + return new MassFlow(hectogramsperday, MassFlowUnit.HectogramPerDay); } /// /// Get from HectogramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromHectogramsPerSecond(QuantityValue hectogramspersecond) + public static MassFlow FromHectogramsPerSecond(T hectogramspersecond) { - double value = (double) hectogramspersecond; - return new MassFlow(value, MassFlowUnit.HectogramPerSecond); + return new MassFlow(hectogramspersecond, MassFlowUnit.HectogramPerSecond); } /// /// Get from KilogramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromKilogramsPerDay(QuantityValue kilogramsperday) + public static MassFlow FromKilogramsPerDay(T kilogramsperday) { - double value = (double) kilogramsperday; - return new MassFlow(value, MassFlowUnit.KilogramPerDay); + return new MassFlow(kilogramsperday, MassFlowUnit.KilogramPerDay); } /// /// Get from KilogramsPerHour. /// /// If value is NaN or Infinity. - public static MassFlow FromKilogramsPerHour(QuantityValue kilogramsperhour) + public static MassFlow FromKilogramsPerHour(T kilogramsperhour) { - double value = (double) kilogramsperhour; - return new MassFlow(value, MassFlowUnit.KilogramPerHour); + return new MassFlow(kilogramsperhour, MassFlowUnit.KilogramPerHour); } /// /// Get from KilogramsPerMinute. /// /// If value is NaN or Infinity. - public static MassFlow FromKilogramsPerMinute(QuantityValue kilogramsperminute) + public static MassFlow FromKilogramsPerMinute(T kilogramsperminute) { - double value = (double) kilogramsperminute; - return new MassFlow(value, MassFlowUnit.KilogramPerMinute); + return new MassFlow(kilogramsperminute, MassFlowUnit.KilogramPerMinute); } /// /// Get from KilogramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromKilogramsPerSecond(QuantityValue kilogramspersecond) + public static MassFlow FromKilogramsPerSecond(T kilogramspersecond) { - double value = (double) kilogramspersecond; - return new MassFlow(value, MassFlowUnit.KilogramPerSecond); + return new MassFlow(kilogramspersecond, MassFlowUnit.KilogramPerSecond); } /// /// Get from MegagramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromMegagramsPerDay(QuantityValue megagramsperday) + public static MassFlow FromMegagramsPerDay(T megagramsperday) { - double value = (double) megagramsperday; - return new MassFlow(value, MassFlowUnit.MegagramPerDay); + return new MassFlow(megagramsperday, MassFlowUnit.MegagramPerDay); } /// /// Get from MegapoundsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromMegapoundsPerDay(QuantityValue megapoundsperday) + public static MassFlow FromMegapoundsPerDay(T megapoundsperday) { - double value = (double) megapoundsperday; - return new MassFlow(value, MassFlowUnit.MegapoundPerDay); + return new MassFlow(megapoundsperday, MassFlowUnit.MegapoundPerDay); } /// /// Get from MegapoundsPerHour. /// /// If value is NaN or Infinity. - public static MassFlow FromMegapoundsPerHour(QuantityValue megapoundsperhour) + public static MassFlow FromMegapoundsPerHour(T megapoundsperhour) { - double value = (double) megapoundsperhour; - return new MassFlow(value, MassFlowUnit.MegapoundPerHour); + return new MassFlow(megapoundsperhour, MassFlowUnit.MegapoundPerHour); } /// /// Get from MegapoundsPerMinute. /// /// If value is NaN or Infinity. - public static MassFlow FromMegapoundsPerMinute(QuantityValue megapoundsperminute) + public static MassFlow FromMegapoundsPerMinute(T megapoundsperminute) { - double value = (double) megapoundsperminute; - return new MassFlow(value, MassFlowUnit.MegapoundPerMinute); + return new MassFlow(megapoundsperminute, MassFlowUnit.MegapoundPerMinute); } /// /// Get from MegapoundsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromMegapoundsPerSecond(QuantityValue megapoundspersecond) + public static MassFlow FromMegapoundsPerSecond(T megapoundspersecond) { - double value = (double) megapoundspersecond; - return new MassFlow(value, MassFlowUnit.MegapoundPerSecond); + return new MassFlow(megapoundspersecond, MassFlowUnit.MegapoundPerSecond); } /// /// Get from MicrogramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromMicrogramsPerDay(QuantityValue microgramsperday) + public static MassFlow FromMicrogramsPerDay(T microgramsperday) { - double value = (double) microgramsperday; - return new MassFlow(value, MassFlowUnit.MicrogramPerDay); + return new MassFlow(microgramsperday, MassFlowUnit.MicrogramPerDay); } /// /// Get from MicrogramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromMicrogramsPerSecond(QuantityValue microgramspersecond) + public static MassFlow FromMicrogramsPerSecond(T microgramspersecond) { - double value = (double) microgramspersecond; - return new MassFlow(value, MassFlowUnit.MicrogramPerSecond); + return new MassFlow(microgramspersecond, MassFlowUnit.MicrogramPerSecond); } /// /// Get from MilligramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromMilligramsPerDay(QuantityValue milligramsperday) + public static MassFlow FromMilligramsPerDay(T milligramsperday) { - double value = (double) milligramsperday; - return new MassFlow(value, MassFlowUnit.MilligramPerDay); + return new MassFlow(milligramsperday, MassFlowUnit.MilligramPerDay); } /// /// Get from MilligramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromMilligramsPerSecond(QuantityValue milligramspersecond) + public static MassFlow FromMilligramsPerSecond(T milligramspersecond) { - double value = (double) milligramspersecond; - return new MassFlow(value, MassFlowUnit.MilligramPerSecond); + return new MassFlow(milligramspersecond, MassFlowUnit.MilligramPerSecond); } /// /// Get from NanogramsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromNanogramsPerDay(QuantityValue nanogramsperday) + public static MassFlow FromNanogramsPerDay(T nanogramsperday) { - double value = (double) nanogramsperday; - return new MassFlow(value, MassFlowUnit.NanogramPerDay); + return new MassFlow(nanogramsperday, MassFlowUnit.NanogramPerDay); } /// /// Get from NanogramsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromNanogramsPerSecond(QuantityValue nanogramspersecond) + public static MassFlow FromNanogramsPerSecond(T nanogramspersecond) { - double value = (double) nanogramspersecond; - return new MassFlow(value, MassFlowUnit.NanogramPerSecond); + return new MassFlow(nanogramspersecond, MassFlowUnit.NanogramPerSecond); } /// /// Get from PoundsPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromPoundsPerDay(QuantityValue poundsperday) + public static MassFlow FromPoundsPerDay(T poundsperday) { - double value = (double) poundsperday; - return new MassFlow(value, MassFlowUnit.PoundPerDay); + return new MassFlow(poundsperday, MassFlowUnit.PoundPerDay); } /// /// Get from PoundsPerHour. /// /// If value is NaN or Infinity. - public static MassFlow FromPoundsPerHour(QuantityValue poundsperhour) + public static MassFlow FromPoundsPerHour(T poundsperhour) { - double value = (double) poundsperhour; - return new MassFlow(value, MassFlowUnit.PoundPerHour); + return new MassFlow(poundsperhour, MassFlowUnit.PoundPerHour); } /// /// Get from PoundsPerMinute. /// /// If value is NaN or Infinity. - public static MassFlow FromPoundsPerMinute(QuantityValue poundsperminute) + public static MassFlow FromPoundsPerMinute(T poundsperminute) { - double value = (double) poundsperminute; - return new MassFlow(value, MassFlowUnit.PoundPerMinute); + return new MassFlow(poundsperminute, MassFlowUnit.PoundPerMinute); } /// /// Get from PoundsPerSecond. /// /// If value is NaN or Infinity. - public static MassFlow FromPoundsPerSecond(QuantityValue poundspersecond) + public static MassFlow FromPoundsPerSecond(T poundspersecond) { - double value = (double) poundspersecond; - return new MassFlow(value, MassFlowUnit.PoundPerSecond); + return new MassFlow(poundspersecond, MassFlowUnit.PoundPerSecond); } /// /// Get from ShortTonsPerHour. /// /// If value is NaN or Infinity. - public static MassFlow FromShortTonsPerHour(QuantityValue shorttonsperhour) + public static MassFlow FromShortTonsPerHour(T shorttonsperhour) { - double value = (double) shorttonsperhour; - return new MassFlow(value, MassFlowUnit.ShortTonPerHour); + return new MassFlow(shorttonsperhour, MassFlowUnit.ShortTonPerHour); } /// /// Get from TonnesPerDay. /// /// If value is NaN or Infinity. - public static MassFlow FromTonnesPerDay(QuantityValue tonnesperday) + public static MassFlow FromTonnesPerDay(T tonnesperday) { - double value = (double) tonnesperday; - return new MassFlow(value, MassFlowUnit.TonnePerDay); + return new MassFlow(tonnesperday, MassFlowUnit.TonnePerDay); } /// /// Get from TonnesPerHour. /// /// If value is NaN or Infinity. - public static MassFlow FromTonnesPerHour(QuantityValue tonnesperhour) + public static MassFlow FromTonnesPerHour(T tonnesperhour) { - double value = (double) tonnesperhour; - return new MassFlow(value, MassFlowUnit.TonnePerHour); + return new MassFlow(tonnesperhour, MassFlowUnit.TonnePerHour); } /// @@ -693,9 +657,9 @@ public static MassFlow FromTonnesPerHour(QuantityValue tonnesperhour) /// Value to convert from. /// Unit to convert from. /// unit value. - public static MassFlow From(QuantityValue value, MassFlowUnit fromUnit) + public static MassFlow From(T value, MassFlowUnit fromUnit) { - return new MassFlow((double)value, fromUnit); + return new MassFlow(value, fromUnit); } #endregion @@ -849,43 +813,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFl /// Negate the value. public static MassFlow operator -(MassFlow right) { - return new MassFlow(-right.Value, right.Unit); + return new MassFlow(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static MassFlow operator +(MassFlow left, MassFlow right) { - return new MassFlow(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new MassFlow(value, left.Unit); } /// Get from subtracting two . public static MassFlow operator -(MassFlow left, MassFlow right) { - return new MassFlow(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new MassFlow(value, left.Unit); } /// Get from multiplying value and . - public static MassFlow operator *(double left, MassFlow right) + public static MassFlow operator *(T left, MassFlow right) { - return new MassFlow(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new MassFlow(value, right.Unit); } /// Get from multiplying value and . - public static MassFlow operator *(MassFlow left, double right) + public static MassFlow operator *(MassFlow left, T right) { - return new MassFlow(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new MassFlow(value, left.Unit); } /// Get from dividing by value. - public static MassFlow operator /(MassFlow left, double right) + public static MassFlow operator /(MassFlow left, T right) { - return new MassFlow(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new MassFlow(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(MassFlow left, MassFlow right) + public static T operator /(MassFlow left, MassFlow right) { - return left.GramsPerSecond / right.GramsPerSecond; + return CompiledLambdas.Divide(left.GramsPerSecond, right.GramsPerSecond); } #endregion @@ -895,25 +864,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFl /// Returns true if less or equal to. public static bool operator <=(MassFlow left, MassFlow right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(MassFlow left, MassFlow right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(MassFlow left, MassFlow right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(MassFlow left, MassFlow right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -942,7 +911,7 @@ public int CompareTo(object obj) /// public int CompareTo(MassFlow other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -959,7 +928,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MassFlow other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1007,10 +976,8 @@ public bool Equals(MassFlow other, double tolerance, ComparisonType compariso if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -1030,17 +997,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MassFlowUnit unit) + public T As(MassFlowUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1060,9 +1027,14 @@ double IQuantity.As(Enum unit) if(!(unit is MassFlowUnit unitAsMassFlowUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFlowUnit)} is supported.", nameof(unit)); - return As(unitAsMassFlowUnit); + var asValue = As(unitAsMassFlowUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(MassFlowUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -1103,51 +1075,57 @@ public MassFlow ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(MassFlowUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(MassFlowUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case MassFlowUnit.CentigramPerDay: return (_value/86400) * 1e-2d; - case MassFlowUnit.CentigramPerSecond: return (_value) * 1e-2d; - case MassFlowUnit.DecagramPerDay: return (_value/86400) * 1e1d; - case MassFlowUnit.DecagramPerSecond: return (_value) * 1e1d; - case MassFlowUnit.DecigramPerDay: return (_value/86400) * 1e-1d; - case MassFlowUnit.DecigramPerSecond: return (_value) * 1e-1d; - case MassFlowUnit.GramPerDay: return _value/86400; - case MassFlowUnit.GramPerHour: return _value/3600; - case MassFlowUnit.GramPerSecond: return _value; - case MassFlowUnit.HectogramPerDay: return (_value/86400) * 1e2d; - case MassFlowUnit.HectogramPerSecond: return (_value) * 1e2d; - case MassFlowUnit.KilogramPerDay: return (_value/86400) * 1e3d; - case MassFlowUnit.KilogramPerHour: return _value/3.6; - case MassFlowUnit.KilogramPerMinute: return _value/0.06; - case MassFlowUnit.KilogramPerSecond: return (_value) * 1e3d; - case MassFlowUnit.MegagramPerDay: return (_value/86400) * 1e6d; - case MassFlowUnit.MegapoundPerDay: return (_value/190.47936) * 1e6d; - case MassFlowUnit.MegapoundPerHour: return (_value/7.93664) * 1e6d; - case MassFlowUnit.MegapoundPerMinute: return (_value/0.132277) * 1e6d; - case MassFlowUnit.MegapoundPerSecond: return (_value * 453.59237) * 1e6d; - case MassFlowUnit.MicrogramPerDay: return (_value/86400) * 1e-6d; - case MassFlowUnit.MicrogramPerSecond: return (_value) * 1e-6d; - case MassFlowUnit.MilligramPerDay: return (_value/86400) * 1e-3d; - case MassFlowUnit.MilligramPerSecond: return (_value) * 1e-3d; - case MassFlowUnit.NanogramPerDay: return (_value/86400) * 1e-9d; - case MassFlowUnit.NanogramPerSecond: return (_value) * 1e-9d; - case MassFlowUnit.PoundPerDay: return _value/190.47936; - case MassFlowUnit.PoundPerHour: return _value/7.93664; - case MassFlowUnit.PoundPerMinute: return _value/0.132277; - case MassFlowUnit.PoundPerSecond: return _value * 453.59237; - case MassFlowUnit.ShortTonPerHour: return _value*251.9957611; - case MassFlowUnit.TonnePerDay: return _value/0.0864000; - case MassFlowUnit.TonnePerHour: return 1000*_value/3.6; + case MassFlowUnit.CentigramPerDay: return (Value/86400) * 1e-2d; + case MassFlowUnit.CentigramPerSecond: return (Value) * 1e-2d; + case MassFlowUnit.DecagramPerDay: return (Value/86400) * 1e1d; + case MassFlowUnit.DecagramPerSecond: return (Value) * 1e1d; + case MassFlowUnit.DecigramPerDay: return (Value/86400) * 1e-1d; + case MassFlowUnit.DecigramPerSecond: return (Value) * 1e-1d; + case MassFlowUnit.GramPerDay: return Value/86400; + case MassFlowUnit.GramPerHour: return Value/3600; + case MassFlowUnit.GramPerSecond: return Value; + case MassFlowUnit.HectogramPerDay: return (Value/86400) * 1e2d; + case MassFlowUnit.HectogramPerSecond: return (Value) * 1e2d; + case MassFlowUnit.KilogramPerDay: return (Value/86400) * 1e3d; + case MassFlowUnit.KilogramPerHour: return Value/3.6; + case MassFlowUnit.KilogramPerMinute: return Value/0.06; + case MassFlowUnit.KilogramPerSecond: return (Value) * 1e3d; + case MassFlowUnit.MegagramPerDay: return (Value/86400) * 1e6d; + case MassFlowUnit.MegapoundPerDay: return (Value/190.47936) * 1e6d; + case MassFlowUnit.MegapoundPerHour: return (Value/7.93664) * 1e6d; + case MassFlowUnit.MegapoundPerMinute: return (Value/0.132277) * 1e6d; + case MassFlowUnit.MegapoundPerSecond: return (Value * 453.59237) * 1e6d; + case MassFlowUnit.MicrogramPerDay: return (Value/86400) * 1e-6d; + case MassFlowUnit.MicrogramPerSecond: return (Value) * 1e-6d; + case MassFlowUnit.MilligramPerDay: return (Value/86400) * 1e-3d; + case MassFlowUnit.MilligramPerSecond: return (Value) * 1e-3d; + case MassFlowUnit.NanogramPerDay: return (Value/86400) * 1e-9d; + case MassFlowUnit.NanogramPerSecond: return (Value) * 1e-9d; + case MassFlowUnit.PoundPerDay: return Value/190.47936; + case MassFlowUnit.PoundPerHour: return Value/7.93664; + case MassFlowUnit.PoundPerMinute: return Value/0.132277; + case MassFlowUnit.PoundPerSecond: return Value * 453.59237; + case MassFlowUnit.ShortTonPerHour: return Value*251.9957611; + case MassFlowUnit.TonnePerDay: return Value/0.0864000; + case MassFlowUnit.TonnePerHour: return 1000*Value/3.6; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -1164,10 +1142,10 @@ internal MassFlow ToBaseUnit() return new MassFlow(baseUnitValue, BaseUnit); } - private double GetValueAs(MassFlowUnit unit) + private T GetValueAs(MassFlowUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1307,7 +1285,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1322,37 +1300,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1376,17 +1354,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs index 7c90779735..702c130c0f 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Mass flux is the mass flow rate per unit area. /// - public partial struct MassFlux : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct MassFlux : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -62,12 +57,12 @@ static MassFlux() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public MassFlux(double value, MassFluxUnit unit) + public MassFlux(T value, MassFluxUnit unit) { if(unit == MassFluxUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -79,14 +74,14 @@ public MassFlux(double value, MassFluxUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public MassFlux(double value, UnitSystem unitSystem) + public MassFlux(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -128,7 +123,7 @@ public MassFlux(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerSecondPerSquareMeter. /// - public static MassFlux Zero { get; } = new MassFlux(0, BaseUnit); + public static MassFlux Zero { get; } = new MassFlux((T)0, BaseUnit); #endregion @@ -137,7 +132,9 @@ public MassFlux(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -167,12 +164,12 @@ public MassFlux(double value, UnitSystem unitSystem) /// /// Get in GramsPerSecondPerSquareMeter. /// - public double GramsPerSecondPerSquareMeter => As(MassFluxUnit.GramPerSecondPerSquareMeter); + public T GramsPerSecondPerSquareMeter => As(MassFluxUnit.GramPerSecondPerSquareMeter); /// /// Get in KilogramsPerSecondPerSquareMeter. /// - public double KilogramsPerSecondPerSquareMeter => As(MassFluxUnit.KilogramPerSecondPerSquareMeter); + public T KilogramsPerSecondPerSquareMeter => As(MassFluxUnit.KilogramPerSecondPerSquareMeter); #endregion @@ -207,19 +204,17 @@ public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] IFormatProvi /// Get from GramsPerSecondPerSquareMeter. /// /// If value is NaN or Infinity. - public static MassFlux FromGramsPerSecondPerSquareMeter(QuantityValue gramspersecondpersquaremeter) + public static MassFlux FromGramsPerSecondPerSquareMeter(T gramspersecondpersquaremeter) { - double value = (double) gramspersecondpersquaremeter; - return new MassFlux(value, MassFluxUnit.GramPerSecondPerSquareMeter); + return new MassFlux(gramspersecondpersquaremeter, MassFluxUnit.GramPerSecondPerSquareMeter); } /// /// Get from KilogramsPerSecondPerSquareMeter. /// /// If value is NaN or Infinity. - public static MassFlux FromKilogramsPerSecondPerSquareMeter(QuantityValue kilogramspersecondpersquaremeter) + public static MassFlux FromKilogramsPerSecondPerSquareMeter(T kilogramspersecondpersquaremeter) { - double value = (double) kilogramspersecondpersquaremeter; - return new MassFlux(value, MassFluxUnit.KilogramPerSecondPerSquareMeter); + return new MassFlux(kilogramspersecondpersquaremeter, MassFluxUnit.KilogramPerSecondPerSquareMeter); } /// @@ -228,9 +223,9 @@ public static MassFlux FromKilogramsPerSecondPerSquareMeter(QuantityValue kil /// Value to convert from. /// Unit to convert from. /// unit value. - public static MassFlux From(QuantityValue value, MassFluxUnit fromUnit) + public static MassFlux From(T value, MassFluxUnit fromUnit) { - return new MassFlux((double)value, fromUnit); + return new MassFlux(value, fromUnit); } #endregion @@ -384,43 +379,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFl /// Negate the value. public static MassFlux operator -(MassFlux right) { - return new MassFlux(-right.Value, right.Unit); + return new MassFlux(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static MassFlux operator +(MassFlux left, MassFlux right) { - return new MassFlux(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new MassFlux(value, left.Unit); } /// Get from subtracting two . public static MassFlux operator -(MassFlux left, MassFlux right) { - return new MassFlux(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new MassFlux(value, left.Unit); } /// Get from multiplying value and . - public static MassFlux operator *(double left, MassFlux right) + public static MassFlux operator *(T left, MassFlux right) { - return new MassFlux(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new MassFlux(value, right.Unit); } /// Get from multiplying value and . - public static MassFlux operator *(MassFlux left, double right) + public static MassFlux operator *(MassFlux left, T right) { - return new MassFlux(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new MassFlux(value, left.Unit); } /// Get from dividing by value. - public static MassFlux operator /(MassFlux left, double right) + public static MassFlux operator /(MassFlux left, T right) { - return new MassFlux(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new MassFlux(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(MassFlux left, MassFlux right) + public static T operator /(MassFlux left, MassFlux right) { - return left.KilogramsPerSecondPerSquareMeter / right.KilogramsPerSecondPerSquareMeter; + return CompiledLambdas.Divide(left.KilogramsPerSecondPerSquareMeter, right.KilogramsPerSecondPerSquareMeter); } #endregion @@ -430,25 +430,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFl /// Returns true if less or equal to. public static bool operator <=(MassFlux left, MassFlux right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(MassFlux left, MassFlux right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(MassFlux left, MassFlux right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(MassFlux left, MassFlux right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -477,7 +477,7 @@ public int CompareTo(object obj) /// public int CompareTo(MassFlux other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -494,7 +494,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MassFlux other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -542,10 +542,8 @@ public bool Equals(MassFlux other, double tolerance, ComparisonType compariso if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -565,17 +563,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MassFluxUnit unit) + public T As(MassFluxUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -595,9 +593,14 @@ double IQuantity.As(Enum unit) if(!(unit is MassFluxUnit unitAsMassFluxUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFluxUnit)} is supported.", nameof(unit)); - return As(unitAsMassFluxUnit); + var asValue = As(unitAsMassFluxUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(MassFluxUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -638,20 +641,26 @@ public MassFlux ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(MassFluxUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(MassFluxUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case MassFluxUnit.GramPerSecondPerSquareMeter: return _value/1e3; - case MassFluxUnit.KilogramPerSecondPerSquareMeter: return (_value/1e3) * 1e3d; + case MassFluxUnit.GramPerSecondPerSquareMeter: return Value/1e3; + case MassFluxUnit.KilogramPerSecondPerSquareMeter: return (Value/1e3) * 1e3d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -668,10 +677,10 @@ internal MassFlux ToBaseUnit() return new MassFlux(baseUnitValue, BaseUnit); } - private double GetValueAs(MassFluxUnit unit) + private T GetValueAs(MassFluxUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -780,7 +789,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -795,37 +804,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -849,17 +858,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs index 19007f0676..704fdfcd8d 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Mass_fraction_(chemistry) /// - public partial struct MassFraction : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct MassFraction : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -87,12 +82,12 @@ static MassFraction() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public MassFraction(double value, MassFractionUnit unit) + public MassFraction(T value, MassFractionUnit unit) { if(unit == MassFractionUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -104,14 +99,14 @@ public MassFraction(double value, MassFractionUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public MassFraction(double value, UnitSystem unitSystem) + public MassFraction(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -153,7 +148,7 @@ public MassFraction(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit DecimalFraction. /// - public static MassFraction Zero { get; } = new MassFraction(0, BaseUnit); + public static MassFraction Zero { get; } = new MassFraction((T)0, BaseUnit); #endregion @@ -162,7 +157,9 @@ public MassFraction(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -192,122 +189,122 @@ public MassFraction(double value, UnitSystem unitSystem) /// /// Get in CentigramsPerGram. /// - public double CentigramsPerGram => As(MassFractionUnit.CentigramPerGram); + public T CentigramsPerGram => As(MassFractionUnit.CentigramPerGram); /// /// Get in CentigramsPerKilogram. /// - public double CentigramsPerKilogram => As(MassFractionUnit.CentigramPerKilogram); + public T CentigramsPerKilogram => As(MassFractionUnit.CentigramPerKilogram); /// /// Get in DecagramsPerGram. /// - public double DecagramsPerGram => As(MassFractionUnit.DecagramPerGram); + public T DecagramsPerGram => As(MassFractionUnit.DecagramPerGram); /// /// Get in DecagramsPerKilogram. /// - public double DecagramsPerKilogram => As(MassFractionUnit.DecagramPerKilogram); + public T DecagramsPerKilogram => As(MassFractionUnit.DecagramPerKilogram); /// /// Get in DecigramsPerGram. /// - public double DecigramsPerGram => As(MassFractionUnit.DecigramPerGram); + public T DecigramsPerGram => As(MassFractionUnit.DecigramPerGram); /// /// Get in DecigramsPerKilogram. /// - public double DecigramsPerKilogram => As(MassFractionUnit.DecigramPerKilogram); + public T DecigramsPerKilogram => As(MassFractionUnit.DecigramPerKilogram); /// /// Get in DecimalFractions. /// - public double DecimalFractions => As(MassFractionUnit.DecimalFraction); + public T DecimalFractions => As(MassFractionUnit.DecimalFraction); /// /// Get in GramsPerGram. /// - public double GramsPerGram => As(MassFractionUnit.GramPerGram); + public T GramsPerGram => As(MassFractionUnit.GramPerGram); /// /// Get in GramsPerKilogram. /// - public double GramsPerKilogram => As(MassFractionUnit.GramPerKilogram); + public T GramsPerKilogram => As(MassFractionUnit.GramPerKilogram); /// /// Get in HectogramsPerGram. /// - public double HectogramsPerGram => As(MassFractionUnit.HectogramPerGram); + public T HectogramsPerGram => As(MassFractionUnit.HectogramPerGram); /// /// Get in HectogramsPerKilogram. /// - public double HectogramsPerKilogram => As(MassFractionUnit.HectogramPerKilogram); + public T HectogramsPerKilogram => As(MassFractionUnit.HectogramPerKilogram); /// /// Get in KilogramsPerGram. /// - public double KilogramsPerGram => As(MassFractionUnit.KilogramPerGram); + public T KilogramsPerGram => As(MassFractionUnit.KilogramPerGram); /// /// Get in KilogramsPerKilogram. /// - public double KilogramsPerKilogram => As(MassFractionUnit.KilogramPerKilogram); + public T KilogramsPerKilogram => As(MassFractionUnit.KilogramPerKilogram); /// /// Get in MicrogramsPerGram. /// - public double MicrogramsPerGram => As(MassFractionUnit.MicrogramPerGram); + public T MicrogramsPerGram => As(MassFractionUnit.MicrogramPerGram); /// /// Get in MicrogramsPerKilogram. /// - public double MicrogramsPerKilogram => As(MassFractionUnit.MicrogramPerKilogram); + public T MicrogramsPerKilogram => As(MassFractionUnit.MicrogramPerKilogram); /// /// Get in MilligramsPerGram. /// - public double MilligramsPerGram => As(MassFractionUnit.MilligramPerGram); + public T MilligramsPerGram => As(MassFractionUnit.MilligramPerGram); /// /// Get in MilligramsPerKilogram. /// - public double MilligramsPerKilogram => As(MassFractionUnit.MilligramPerKilogram); + public T MilligramsPerKilogram => As(MassFractionUnit.MilligramPerKilogram); /// /// Get in NanogramsPerGram. /// - public double NanogramsPerGram => As(MassFractionUnit.NanogramPerGram); + public T NanogramsPerGram => As(MassFractionUnit.NanogramPerGram); /// /// Get in NanogramsPerKilogram. /// - public double NanogramsPerKilogram => As(MassFractionUnit.NanogramPerKilogram); + public T NanogramsPerKilogram => As(MassFractionUnit.NanogramPerKilogram); /// /// Get in PartsPerBillion. /// - public double PartsPerBillion => As(MassFractionUnit.PartPerBillion); + public T PartsPerBillion => As(MassFractionUnit.PartPerBillion); /// /// Get in PartsPerMillion. /// - public double PartsPerMillion => As(MassFractionUnit.PartPerMillion); + public T PartsPerMillion => As(MassFractionUnit.PartPerMillion); /// /// Get in PartsPerThousand. /// - public double PartsPerThousand => As(MassFractionUnit.PartPerThousand); + public T PartsPerThousand => As(MassFractionUnit.PartPerThousand); /// /// Get in PartsPerTrillion. /// - public double PartsPerTrillion => As(MassFractionUnit.PartPerTrillion); + public T PartsPerTrillion => As(MassFractionUnit.PartPerTrillion); /// /// Get in Percent. /// - public double Percent => As(MassFractionUnit.Percent); + public T Percent => As(MassFractionUnit.Percent); #endregion @@ -342,217 +339,193 @@ public static string GetAbbreviation(MassFractionUnit unit, [CanBeNull] IFormatP /// Get from CentigramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromCentigramsPerGram(QuantityValue centigramspergram) + public static MassFraction FromCentigramsPerGram(T centigramspergram) { - double value = (double) centigramspergram; - return new MassFraction(value, MassFractionUnit.CentigramPerGram); + return new MassFraction(centigramspergram, MassFractionUnit.CentigramPerGram); } /// /// Get from CentigramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromCentigramsPerKilogram(QuantityValue centigramsperkilogram) + public static MassFraction FromCentigramsPerKilogram(T centigramsperkilogram) { - double value = (double) centigramsperkilogram; - return new MassFraction(value, MassFractionUnit.CentigramPerKilogram); + return new MassFraction(centigramsperkilogram, MassFractionUnit.CentigramPerKilogram); } /// /// Get from DecagramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromDecagramsPerGram(QuantityValue decagramspergram) + public static MassFraction FromDecagramsPerGram(T decagramspergram) { - double value = (double) decagramspergram; - return new MassFraction(value, MassFractionUnit.DecagramPerGram); + return new MassFraction(decagramspergram, MassFractionUnit.DecagramPerGram); } /// /// Get from DecagramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromDecagramsPerKilogram(QuantityValue decagramsperkilogram) + public static MassFraction FromDecagramsPerKilogram(T decagramsperkilogram) { - double value = (double) decagramsperkilogram; - return new MassFraction(value, MassFractionUnit.DecagramPerKilogram); + return new MassFraction(decagramsperkilogram, MassFractionUnit.DecagramPerKilogram); } /// /// Get from DecigramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromDecigramsPerGram(QuantityValue decigramspergram) + public static MassFraction FromDecigramsPerGram(T decigramspergram) { - double value = (double) decigramspergram; - return new MassFraction(value, MassFractionUnit.DecigramPerGram); + return new MassFraction(decigramspergram, MassFractionUnit.DecigramPerGram); } /// /// Get from DecigramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromDecigramsPerKilogram(QuantityValue decigramsperkilogram) + public static MassFraction FromDecigramsPerKilogram(T decigramsperkilogram) { - double value = (double) decigramsperkilogram; - return new MassFraction(value, MassFractionUnit.DecigramPerKilogram); + return new MassFraction(decigramsperkilogram, MassFractionUnit.DecigramPerKilogram); } /// /// Get from DecimalFractions. /// /// If value is NaN or Infinity. - public static MassFraction FromDecimalFractions(QuantityValue decimalfractions) + public static MassFraction FromDecimalFractions(T decimalfractions) { - double value = (double) decimalfractions; - return new MassFraction(value, MassFractionUnit.DecimalFraction); + return new MassFraction(decimalfractions, MassFractionUnit.DecimalFraction); } /// /// Get from GramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromGramsPerGram(QuantityValue gramspergram) + public static MassFraction FromGramsPerGram(T gramspergram) { - double value = (double) gramspergram; - return new MassFraction(value, MassFractionUnit.GramPerGram); + return new MassFraction(gramspergram, MassFractionUnit.GramPerGram); } /// /// Get from GramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromGramsPerKilogram(QuantityValue gramsperkilogram) + public static MassFraction FromGramsPerKilogram(T gramsperkilogram) { - double value = (double) gramsperkilogram; - return new MassFraction(value, MassFractionUnit.GramPerKilogram); + return new MassFraction(gramsperkilogram, MassFractionUnit.GramPerKilogram); } /// /// Get from HectogramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromHectogramsPerGram(QuantityValue hectogramspergram) + public static MassFraction FromHectogramsPerGram(T hectogramspergram) { - double value = (double) hectogramspergram; - return new MassFraction(value, MassFractionUnit.HectogramPerGram); + return new MassFraction(hectogramspergram, MassFractionUnit.HectogramPerGram); } /// /// Get from HectogramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromHectogramsPerKilogram(QuantityValue hectogramsperkilogram) + public static MassFraction FromHectogramsPerKilogram(T hectogramsperkilogram) { - double value = (double) hectogramsperkilogram; - return new MassFraction(value, MassFractionUnit.HectogramPerKilogram); + return new MassFraction(hectogramsperkilogram, MassFractionUnit.HectogramPerKilogram); } /// /// Get from KilogramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromKilogramsPerGram(QuantityValue kilogramspergram) + public static MassFraction FromKilogramsPerGram(T kilogramspergram) { - double value = (double) kilogramspergram; - return new MassFraction(value, MassFractionUnit.KilogramPerGram); + return new MassFraction(kilogramspergram, MassFractionUnit.KilogramPerGram); } /// /// Get from KilogramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromKilogramsPerKilogram(QuantityValue kilogramsperkilogram) + public static MassFraction FromKilogramsPerKilogram(T kilogramsperkilogram) { - double value = (double) kilogramsperkilogram; - return new MassFraction(value, MassFractionUnit.KilogramPerKilogram); + return new MassFraction(kilogramsperkilogram, MassFractionUnit.KilogramPerKilogram); } /// /// Get from MicrogramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromMicrogramsPerGram(QuantityValue microgramspergram) + public static MassFraction FromMicrogramsPerGram(T microgramspergram) { - double value = (double) microgramspergram; - return new MassFraction(value, MassFractionUnit.MicrogramPerGram); + return new MassFraction(microgramspergram, MassFractionUnit.MicrogramPerGram); } /// /// Get from MicrogramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromMicrogramsPerKilogram(QuantityValue microgramsperkilogram) + public static MassFraction FromMicrogramsPerKilogram(T microgramsperkilogram) { - double value = (double) microgramsperkilogram; - return new MassFraction(value, MassFractionUnit.MicrogramPerKilogram); + return new MassFraction(microgramsperkilogram, MassFractionUnit.MicrogramPerKilogram); } /// /// Get from MilligramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromMilligramsPerGram(QuantityValue milligramspergram) + public static MassFraction FromMilligramsPerGram(T milligramspergram) { - double value = (double) milligramspergram; - return new MassFraction(value, MassFractionUnit.MilligramPerGram); + return new MassFraction(milligramspergram, MassFractionUnit.MilligramPerGram); } /// /// Get from MilligramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromMilligramsPerKilogram(QuantityValue milligramsperkilogram) + public static MassFraction FromMilligramsPerKilogram(T milligramsperkilogram) { - double value = (double) milligramsperkilogram; - return new MassFraction(value, MassFractionUnit.MilligramPerKilogram); + return new MassFraction(milligramsperkilogram, MassFractionUnit.MilligramPerKilogram); } /// /// Get from NanogramsPerGram. /// /// If value is NaN or Infinity. - public static MassFraction FromNanogramsPerGram(QuantityValue nanogramspergram) + public static MassFraction FromNanogramsPerGram(T nanogramspergram) { - double value = (double) nanogramspergram; - return new MassFraction(value, MassFractionUnit.NanogramPerGram); + return new MassFraction(nanogramspergram, MassFractionUnit.NanogramPerGram); } /// /// Get from NanogramsPerKilogram. /// /// If value is NaN or Infinity. - public static MassFraction FromNanogramsPerKilogram(QuantityValue nanogramsperkilogram) + public static MassFraction FromNanogramsPerKilogram(T nanogramsperkilogram) { - double value = (double) nanogramsperkilogram; - return new MassFraction(value, MassFractionUnit.NanogramPerKilogram); + return new MassFraction(nanogramsperkilogram, MassFractionUnit.NanogramPerKilogram); } /// /// Get from PartsPerBillion. /// /// If value is NaN or Infinity. - public static MassFraction FromPartsPerBillion(QuantityValue partsperbillion) + public static MassFraction FromPartsPerBillion(T partsperbillion) { - double value = (double) partsperbillion; - return new MassFraction(value, MassFractionUnit.PartPerBillion); + return new MassFraction(partsperbillion, MassFractionUnit.PartPerBillion); } /// /// Get from PartsPerMillion. /// /// If value is NaN or Infinity. - public static MassFraction FromPartsPerMillion(QuantityValue partspermillion) + public static MassFraction FromPartsPerMillion(T partspermillion) { - double value = (double) partspermillion; - return new MassFraction(value, MassFractionUnit.PartPerMillion); + return new MassFraction(partspermillion, MassFractionUnit.PartPerMillion); } /// /// Get from PartsPerThousand. /// /// If value is NaN or Infinity. - public static MassFraction FromPartsPerThousand(QuantityValue partsperthousand) + public static MassFraction FromPartsPerThousand(T partsperthousand) { - double value = (double) partsperthousand; - return new MassFraction(value, MassFractionUnit.PartPerThousand); + return new MassFraction(partsperthousand, MassFractionUnit.PartPerThousand); } /// /// Get from PartsPerTrillion. /// /// If value is NaN or Infinity. - public static MassFraction FromPartsPerTrillion(QuantityValue partspertrillion) + public static MassFraction FromPartsPerTrillion(T partspertrillion) { - double value = (double) partspertrillion; - return new MassFraction(value, MassFractionUnit.PartPerTrillion); + return new MassFraction(partspertrillion, MassFractionUnit.PartPerTrillion); } /// /// Get from Percent. /// /// If value is NaN or Infinity. - public static MassFraction FromPercent(QuantityValue percent) + public static MassFraction FromPercent(T percent) { - double value = (double) percent; - return new MassFraction(value, MassFractionUnit.Percent); + return new MassFraction(percent, MassFractionUnit.Percent); } /// @@ -561,9 +534,9 @@ public static MassFraction FromPercent(QuantityValue percent) /// Value to convert from. /// Unit to convert from. /// unit value. - public static MassFraction From(QuantityValue value, MassFractionUnit fromUnit) + public static MassFraction From(T value, MassFractionUnit fromUnit) { - return new MassFraction((double)value, fromUnit); + return new MassFraction(value, fromUnit); } #endregion @@ -717,43 +690,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFr /// Negate the value. public static MassFraction operator -(MassFraction right) { - return new MassFraction(-right.Value, right.Unit); + return new MassFraction(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static MassFraction operator +(MassFraction left, MassFraction right) { - return new MassFraction(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new MassFraction(value, left.Unit); } /// Get from subtracting two . public static MassFraction operator -(MassFraction left, MassFraction right) { - return new MassFraction(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new MassFraction(value, left.Unit); } /// Get from multiplying value and . - public static MassFraction operator *(double left, MassFraction right) + public static MassFraction operator *(T left, MassFraction right) { - return new MassFraction(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new MassFraction(value, right.Unit); } /// Get from multiplying value and . - public static MassFraction operator *(MassFraction left, double right) + public static MassFraction operator *(MassFraction left, T right) { - return new MassFraction(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new MassFraction(value, left.Unit); } /// Get from dividing by value. - public static MassFraction operator /(MassFraction left, double right) + public static MassFraction operator /(MassFraction left, T right) { - return new MassFraction(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new MassFraction(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(MassFraction left, MassFraction right) + public static T operator /(MassFraction left, MassFraction right) { - return left.DecimalFractions / right.DecimalFractions; + return CompiledLambdas.Divide(left.DecimalFractions, right.DecimalFractions); } #endregion @@ -763,25 +741,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFr /// Returns true if less or equal to. public static bool operator <=(MassFraction left, MassFraction right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(MassFraction left, MassFraction right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(MassFraction left, MassFraction right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(MassFraction left, MassFraction right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -810,7 +788,7 @@ public int CompareTo(object obj) /// public int CompareTo(MassFraction other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -827,7 +805,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MassFraction other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -875,10 +853,8 @@ public bool Equals(MassFraction other, double tolerance, ComparisonType compa if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -898,17 +874,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MassFractionUnit unit) + public T As(MassFractionUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -928,9 +904,14 @@ double IQuantity.As(Enum unit) if(!(unit is MassFractionUnit unitAsMassFractionUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFractionUnit)} is supported.", nameof(unit)); - return As(unitAsMassFractionUnit); + var asValue = As(unitAsMassFractionUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(MassFractionUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -971,42 +952,48 @@ public MassFraction ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(MassFractionUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(MassFractionUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case MassFractionUnit.CentigramPerGram: return (_value) * 1e-2d; - case MassFractionUnit.CentigramPerKilogram: return (_value/1e3) * 1e-2d; - case MassFractionUnit.DecagramPerGram: return (_value) * 1e1d; - case MassFractionUnit.DecagramPerKilogram: return (_value/1e3) * 1e1d; - case MassFractionUnit.DecigramPerGram: return (_value) * 1e-1d; - case MassFractionUnit.DecigramPerKilogram: return (_value/1e3) * 1e-1d; - case MassFractionUnit.DecimalFraction: return _value; - case MassFractionUnit.GramPerGram: return _value; - case MassFractionUnit.GramPerKilogram: return _value/1e3; - case MassFractionUnit.HectogramPerGram: return (_value) * 1e2d; - case MassFractionUnit.HectogramPerKilogram: return (_value/1e3) * 1e2d; - case MassFractionUnit.KilogramPerGram: return (_value) * 1e3d; - case MassFractionUnit.KilogramPerKilogram: return (_value/1e3) * 1e3d; - case MassFractionUnit.MicrogramPerGram: return (_value) * 1e-6d; - case MassFractionUnit.MicrogramPerKilogram: return (_value/1e3) * 1e-6d; - case MassFractionUnit.MilligramPerGram: return (_value) * 1e-3d; - case MassFractionUnit.MilligramPerKilogram: return (_value/1e3) * 1e-3d; - case MassFractionUnit.NanogramPerGram: return (_value) * 1e-9d; - case MassFractionUnit.NanogramPerKilogram: return (_value/1e3) * 1e-9d; - case MassFractionUnit.PartPerBillion: return _value/1e9; - case MassFractionUnit.PartPerMillion: return _value/1e6; - case MassFractionUnit.PartPerThousand: return _value/1e3; - case MassFractionUnit.PartPerTrillion: return _value/1e12; - case MassFractionUnit.Percent: return _value/1e2; + case MassFractionUnit.CentigramPerGram: return (Value) * 1e-2d; + case MassFractionUnit.CentigramPerKilogram: return (Value/1e3) * 1e-2d; + case MassFractionUnit.DecagramPerGram: return (Value) * 1e1d; + case MassFractionUnit.DecagramPerKilogram: return (Value/1e3) * 1e1d; + case MassFractionUnit.DecigramPerGram: return (Value) * 1e-1d; + case MassFractionUnit.DecigramPerKilogram: return (Value/1e3) * 1e-1d; + case MassFractionUnit.DecimalFraction: return Value; + case MassFractionUnit.GramPerGram: return Value; + case MassFractionUnit.GramPerKilogram: return Value/1e3; + case MassFractionUnit.HectogramPerGram: return (Value) * 1e2d; + case MassFractionUnit.HectogramPerKilogram: return (Value/1e3) * 1e2d; + case MassFractionUnit.KilogramPerGram: return (Value) * 1e3d; + case MassFractionUnit.KilogramPerKilogram: return (Value/1e3) * 1e3d; + case MassFractionUnit.MicrogramPerGram: return (Value) * 1e-6d; + case MassFractionUnit.MicrogramPerKilogram: return (Value/1e3) * 1e-6d; + case MassFractionUnit.MilligramPerGram: return (Value) * 1e-3d; + case MassFractionUnit.MilligramPerKilogram: return (Value/1e3) * 1e-3d; + case MassFractionUnit.NanogramPerGram: return (Value) * 1e-9d; + case MassFractionUnit.NanogramPerKilogram: return (Value/1e3) * 1e-9d; + case MassFractionUnit.PartPerBillion: return Value/1e9; + case MassFractionUnit.PartPerMillion: return Value/1e6; + case MassFractionUnit.PartPerThousand: return Value/1e3; + case MassFractionUnit.PartPerTrillion: return Value/1e12; + case MassFractionUnit.Percent: return Value/1e2; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -1023,10 +1010,10 @@ internal MassFraction ToBaseUnit() return new MassFraction(baseUnitValue, BaseUnit); } - private double GetValueAs(MassFractionUnit unit) + private T GetValueAs(MassFractionUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1157,7 +1144,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1172,37 +1159,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1226,17 +1213,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs index 4d919bedf0..f8ba9359d9 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// A property of body reflects how its mass is distributed with regard to an axis. /// - public partial struct MassMomentOfInertia : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct MassMomentOfInertia : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -88,12 +83,12 @@ static MassMomentOfInertia() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public MassMomentOfInertia(double value, MassMomentOfInertiaUnit unit) + public MassMomentOfInertia(T value, MassMomentOfInertiaUnit unit) { if(unit == MassMomentOfInertiaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -105,14 +100,14 @@ public MassMomentOfInertia(double value, MassMomentOfInertiaUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public MassMomentOfInertia(double value, UnitSystem unitSystem) + public MassMomentOfInertia(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -154,7 +149,7 @@ public MassMomentOfInertia(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramSquareMeter. /// - public static MassMomentOfInertia Zero { get; } = new MassMomentOfInertia(0, BaseUnit); + public static MassMomentOfInertia Zero { get; } = new MassMomentOfInertia((T)0, BaseUnit); #endregion @@ -163,7 +158,9 @@ public MassMomentOfInertia(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -193,142 +190,142 @@ public MassMomentOfInertia(double value, UnitSystem unitSystem) /// /// Get in GramSquareCentimeters. /// - public double GramSquareCentimeters => As(MassMomentOfInertiaUnit.GramSquareCentimeter); + public T GramSquareCentimeters => As(MassMomentOfInertiaUnit.GramSquareCentimeter); /// /// Get in GramSquareDecimeters. /// - public double GramSquareDecimeters => As(MassMomentOfInertiaUnit.GramSquareDecimeter); + public T GramSquareDecimeters => As(MassMomentOfInertiaUnit.GramSquareDecimeter); /// /// Get in GramSquareMeters. /// - public double GramSquareMeters => As(MassMomentOfInertiaUnit.GramSquareMeter); + public T GramSquareMeters => As(MassMomentOfInertiaUnit.GramSquareMeter); /// /// Get in GramSquareMillimeters. /// - public double GramSquareMillimeters => As(MassMomentOfInertiaUnit.GramSquareMillimeter); + public T GramSquareMillimeters => As(MassMomentOfInertiaUnit.GramSquareMillimeter); /// /// Get in KilogramSquareCentimeters. /// - public double KilogramSquareCentimeters => As(MassMomentOfInertiaUnit.KilogramSquareCentimeter); + public T KilogramSquareCentimeters => As(MassMomentOfInertiaUnit.KilogramSquareCentimeter); /// /// Get in KilogramSquareDecimeters. /// - public double KilogramSquareDecimeters => As(MassMomentOfInertiaUnit.KilogramSquareDecimeter); + public T KilogramSquareDecimeters => As(MassMomentOfInertiaUnit.KilogramSquareDecimeter); /// /// Get in KilogramSquareMeters. /// - public double KilogramSquareMeters => As(MassMomentOfInertiaUnit.KilogramSquareMeter); + public T KilogramSquareMeters => As(MassMomentOfInertiaUnit.KilogramSquareMeter); /// /// Get in KilogramSquareMillimeters. /// - public double KilogramSquareMillimeters => As(MassMomentOfInertiaUnit.KilogramSquareMillimeter); + public T KilogramSquareMillimeters => As(MassMomentOfInertiaUnit.KilogramSquareMillimeter); /// /// Get in KilotonneSquareCentimeters. /// - public double KilotonneSquareCentimeters => As(MassMomentOfInertiaUnit.KilotonneSquareCentimeter); + public T KilotonneSquareCentimeters => As(MassMomentOfInertiaUnit.KilotonneSquareCentimeter); /// /// Get in KilotonneSquareDecimeters. /// - public double KilotonneSquareDecimeters => As(MassMomentOfInertiaUnit.KilotonneSquareDecimeter); + public T KilotonneSquareDecimeters => As(MassMomentOfInertiaUnit.KilotonneSquareDecimeter); /// /// Get in KilotonneSquareMeters. /// - public double KilotonneSquareMeters => As(MassMomentOfInertiaUnit.KilotonneSquareMeter); + public T KilotonneSquareMeters => As(MassMomentOfInertiaUnit.KilotonneSquareMeter); /// /// Get in KilotonneSquareMilimeters. /// - public double KilotonneSquareMilimeters => As(MassMomentOfInertiaUnit.KilotonneSquareMilimeter); + public T KilotonneSquareMilimeters => As(MassMomentOfInertiaUnit.KilotonneSquareMilimeter); /// /// Get in MegatonneSquareCentimeters. /// - public double MegatonneSquareCentimeters => As(MassMomentOfInertiaUnit.MegatonneSquareCentimeter); + public T MegatonneSquareCentimeters => As(MassMomentOfInertiaUnit.MegatonneSquareCentimeter); /// /// Get in MegatonneSquareDecimeters. /// - public double MegatonneSquareDecimeters => As(MassMomentOfInertiaUnit.MegatonneSquareDecimeter); + public T MegatonneSquareDecimeters => As(MassMomentOfInertiaUnit.MegatonneSquareDecimeter); /// /// Get in MegatonneSquareMeters. /// - public double MegatonneSquareMeters => As(MassMomentOfInertiaUnit.MegatonneSquareMeter); + public T MegatonneSquareMeters => As(MassMomentOfInertiaUnit.MegatonneSquareMeter); /// /// Get in MegatonneSquareMilimeters. /// - public double MegatonneSquareMilimeters => As(MassMomentOfInertiaUnit.MegatonneSquareMilimeter); + public T MegatonneSquareMilimeters => As(MassMomentOfInertiaUnit.MegatonneSquareMilimeter); /// /// Get in MilligramSquareCentimeters. /// - public double MilligramSquareCentimeters => As(MassMomentOfInertiaUnit.MilligramSquareCentimeter); + public T MilligramSquareCentimeters => As(MassMomentOfInertiaUnit.MilligramSquareCentimeter); /// /// Get in MilligramSquareDecimeters. /// - public double MilligramSquareDecimeters => As(MassMomentOfInertiaUnit.MilligramSquareDecimeter); + public T MilligramSquareDecimeters => As(MassMomentOfInertiaUnit.MilligramSquareDecimeter); /// /// Get in MilligramSquareMeters. /// - public double MilligramSquareMeters => As(MassMomentOfInertiaUnit.MilligramSquareMeter); + public T MilligramSquareMeters => As(MassMomentOfInertiaUnit.MilligramSquareMeter); /// /// Get in MilligramSquareMillimeters. /// - public double MilligramSquareMillimeters => As(MassMomentOfInertiaUnit.MilligramSquareMillimeter); + public T MilligramSquareMillimeters => As(MassMomentOfInertiaUnit.MilligramSquareMillimeter); /// /// Get in PoundSquareFeet. /// - public double PoundSquareFeet => As(MassMomentOfInertiaUnit.PoundSquareFoot); + public T PoundSquareFeet => As(MassMomentOfInertiaUnit.PoundSquareFoot); /// /// Get in PoundSquareInches. /// - public double PoundSquareInches => As(MassMomentOfInertiaUnit.PoundSquareInch); + public T PoundSquareInches => As(MassMomentOfInertiaUnit.PoundSquareInch); /// /// Get in SlugSquareFeet. /// - public double SlugSquareFeet => As(MassMomentOfInertiaUnit.SlugSquareFoot); + public T SlugSquareFeet => As(MassMomentOfInertiaUnit.SlugSquareFoot); /// /// Get in SlugSquareInches. /// - public double SlugSquareInches => As(MassMomentOfInertiaUnit.SlugSquareInch); + public T SlugSquareInches => As(MassMomentOfInertiaUnit.SlugSquareInch); /// /// Get in TonneSquareCentimeters. /// - public double TonneSquareCentimeters => As(MassMomentOfInertiaUnit.TonneSquareCentimeter); + public T TonneSquareCentimeters => As(MassMomentOfInertiaUnit.TonneSquareCentimeter); /// /// Get in TonneSquareDecimeters. /// - public double TonneSquareDecimeters => As(MassMomentOfInertiaUnit.TonneSquareDecimeter); + public T TonneSquareDecimeters => As(MassMomentOfInertiaUnit.TonneSquareDecimeter); /// /// Get in TonneSquareMeters. /// - public double TonneSquareMeters => As(MassMomentOfInertiaUnit.TonneSquareMeter); + public T TonneSquareMeters => As(MassMomentOfInertiaUnit.TonneSquareMeter); /// /// Get in TonneSquareMilimeters. /// - public double TonneSquareMilimeters => As(MassMomentOfInertiaUnit.TonneSquareMilimeter); + public T TonneSquareMilimeters => As(MassMomentOfInertiaUnit.TonneSquareMilimeter); #endregion @@ -363,253 +360,225 @@ public static string GetAbbreviation(MassMomentOfInertiaUnit unit, [CanBeNull] I /// Get from GramSquareCentimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromGramSquareCentimeters(QuantityValue gramsquarecentimeters) + public static MassMomentOfInertia FromGramSquareCentimeters(T gramsquarecentimeters) { - double value = (double) gramsquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareCentimeter); + return new MassMomentOfInertia(gramsquarecentimeters, MassMomentOfInertiaUnit.GramSquareCentimeter); } /// /// Get from GramSquareDecimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromGramSquareDecimeters(QuantityValue gramsquaredecimeters) + public static MassMomentOfInertia FromGramSquareDecimeters(T gramsquaredecimeters) { - double value = (double) gramsquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareDecimeter); + return new MassMomentOfInertia(gramsquaredecimeters, MassMomentOfInertiaUnit.GramSquareDecimeter); } /// /// Get from GramSquareMeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromGramSquareMeters(QuantityValue gramsquaremeters) + public static MassMomentOfInertia FromGramSquareMeters(T gramsquaremeters) { - double value = (double) gramsquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareMeter); + return new MassMomentOfInertia(gramsquaremeters, MassMomentOfInertiaUnit.GramSquareMeter); } /// /// Get from GramSquareMillimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromGramSquareMillimeters(QuantityValue gramsquaremillimeters) + public static MassMomentOfInertia FromGramSquareMillimeters(T gramsquaremillimeters) { - double value = (double) gramsquaremillimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareMillimeter); + return new MassMomentOfInertia(gramsquaremillimeters, MassMomentOfInertiaUnit.GramSquareMillimeter); } /// /// Get from KilogramSquareCentimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromKilogramSquareCentimeters(QuantityValue kilogramsquarecentimeters) + public static MassMomentOfInertia FromKilogramSquareCentimeters(T kilogramsquarecentimeters) { - double value = (double) kilogramsquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareCentimeter); + return new MassMomentOfInertia(kilogramsquarecentimeters, MassMomentOfInertiaUnit.KilogramSquareCentimeter); } /// /// Get from KilogramSquareDecimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromKilogramSquareDecimeters(QuantityValue kilogramsquaredecimeters) + public static MassMomentOfInertia FromKilogramSquareDecimeters(T kilogramsquaredecimeters) { - double value = (double) kilogramsquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareDecimeter); + return new MassMomentOfInertia(kilogramsquaredecimeters, MassMomentOfInertiaUnit.KilogramSquareDecimeter); } /// /// Get from KilogramSquareMeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromKilogramSquareMeters(QuantityValue kilogramsquaremeters) + public static MassMomentOfInertia FromKilogramSquareMeters(T kilogramsquaremeters) { - double value = (double) kilogramsquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareMeter); + return new MassMomentOfInertia(kilogramsquaremeters, MassMomentOfInertiaUnit.KilogramSquareMeter); } /// /// Get from KilogramSquareMillimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromKilogramSquareMillimeters(QuantityValue kilogramsquaremillimeters) + public static MassMomentOfInertia FromKilogramSquareMillimeters(T kilogramsquaremillimeters) { - double value = (double) kilogramsquaremillimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareMillimeter); + return new MassMomentOfInertia(kilogramsquaremillimeters, MassMomentOfInertiaUnit.KilogramSquareMillimeter); } /// /// Get from KilotonneSquareCentimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromKilotonneSquareCentimeters(QuantityValue kilotonnesquarecentimeters) + public static MassMomentOfInertia FromKilotonneSquareCentimeters(T kilotonnesquarecentimeters) { - double value = (double) kilotonnesquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareCentimeter); + return new MassMomentOfInertia(kilotonnesquarecentimeters, MassMomentOfInertiaUnit.KilotonneSquareCentimeter); } /// /// Get from KilotonneSquareDecimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromKilotonneSquareDecimeters(QuantityValue kilotonnesquaredecimeters) + public static MassMomentOfInertia FromKilotonneSquareDecimeters(T kilotonnesquaredecimeters) { - double value = (double) kilotonnesquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareDecimeter); + return new MassMomentOfInertia(kilotonnesquaredecimeters, MassMomentOfInertiaUnit.KilotonneSquareDecimeter); } /// /// Get from KilotonneSquareMeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromKilotonneSquareMeters(QuantityValue kilotonnesquaremeters) + public static MassMomentOfInertia FromKilotonneSquareMeters(T kilotonnesquaremeters) { - double value = (double) kilotonnesquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareMeter); + return new MassMomentOfInertia(kilotonnesquaremeters, MassMomentOfInertiaUnit.KilotonneSquareMeter); } /// /// Get from KilotonneSquareMilimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromKilotonneSquareMilimeters(QuantityValue kilotonnesquaremilimeters) + public static MassMomentOfInertia FromKilotonneSquareMilimeters(T kilotonnesquaremilimeters) { - double value = (double) kilotonnesquaremilimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareMilimeter); + return new MassMomentOfInertia(kilotonnesquaremilimeters, MassMomentOfInertiaUnit.KilotonneSquareMilimeter); } /// /// Get from MegatonneSquareCentimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromMegatonneSquareCentimeters(QuantityValue megatonnesquarecentimeters) + public static MassMomentOfInertia FromMegatonneSquareCentimeters(T megatonnesquarecentimeters) { - double value = (double) megatonnesquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareCentimeter); + return new MassMomentOfInertia(megatonnesquarecentimeters, MassMomentOfInertiaUnit.MegatonneSquareCentimeter); } /// /// Get from MegatonneSquareDecimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromMegatonneSquareDecimeters(QuantityValue megatonnesquaredecimeters) + public static MassMomentOfInertia FromMegatonneSquareDecimeters(T megatonnesquaredecimeters) { - double value = (double) megatonnesquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareDecimeter); + return new MassMomentOfInertia(megatonnesquaredecimeters, MassMomentOfInertiaUnit.MegatonneSquareDecimeter); } /// /// Get from MegatonneSquareMeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromMegatonneSquareMeters(QuantityValue megatonnesquaremeters) + public static MassMomentOfInertia FromMegatonneSquareMeters(T megatonnesquaremeters) { - double value = (double) megatonnesquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareMeter); + return new MassMomentOfInertia(megatonnesquaremeters, MassMomentOfInertiaUnit.MegatonneSquareMeter); } /// /// Get from MegatonneSquareMilimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromMegatonneSquareMilimeters(QuantityValue megatonnesquaremilimeters) + public static MassMomentOfInertia FromMegatonneSquareMilimeters(T megatonnesquaremilimeters) { - double value = (double) megatonnesquaremilimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareMilimeter); + return new MassMomentOfInertia(megatonnesquaremilimeters, MassMomentOfInertiaUnit.MegatonneSquareMilimeter); } /// /// Get from MilligramSquareCentimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromMilligramSquareCentimeters(QuantityValue milligramsquarecentimeters) + public static MassMomentOfInertia FromMilligramSquareCentimeters(T milligramsquarecentimeters) { - double value = (double) milligramsquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareCentimeter); + return new MassMomentOfInertia(milligramsquarecentimeters, MassMomentOfInertiaUnit.MilligramSquareCentimeter); } /// /// Get from MilligramSquareDecimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromMilligramSquareDecimeters(QuantityValue milligramsquaredecimeters) + public static MassMomentOfInertia FromMilligramSquareDecimeters(T milligramsquaredecimeters) { - double value = (double) milligramsquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareDecimeter); + return new MassMomentOfInertia(milligramsquaredecimeters, MassMomentOfInertiaUnit.MilligramSquareDecimeter); } /// /// Get from MilligramSquareMeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromMilligramSquareMeters(QuantityValue milligramsquaremeters) + public static MassMomentOfInertia FromMilligramSquareMeters(T milligramsquaremeters) { - double value = (double) milligramsquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareMeter); + return new MassMomentOfInertia(milligramsquaremeters, MassMomentOfInertiaUnit.MilligramSquareMeter); } /// /// Get from MilligramSquareMillimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromMilligramSquareMillimeters(QuantityValue milligramsquaremillimeters) + public static MassMomentOfInertia FromMilligramSquareMillimeters(T milligramsquaremillimeters) { - double value = (double) milligramsquaremillimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareMillimeter); + return new MassMomentOfInertia(milligramsquaremillimeters, MassMomentOfInertiaUnit.MilligramSquareMillimeter); } /// /// Get from PoundSquareFeet. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromPoundSquareFeet(QuantityValue poundsquarefeet) + public static MassMomentOfInertia FromPoundSquareFeet(T poundsquarefeet) { - double value = (double) poundsquarefeet; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.PoundSquareFoot); + return new MassMomentOfInertia(poundsquarefeet, MassMomentOfInertiaUnit.PoundSquareFoot); } /// /// Get from PoundSquareInches. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromPoundSquareInches(QuantityValue poundsquareinches) + public static MassMomentOfInertia FromPoundSquareInches(T poundsquareinches) { - double value = (double) poundsquareinches; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.PoundSquareInch); + return new MassMomentOfInertia(poundsquareinches, MassMomentOfInertiaUnit.PoundSquareInch); } /// /// Get from SlugSquareFeet. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromSlugSquareFeet(QuantityValue slugsquarefeet) + public static MassMomentOfInertia FromSlugSquareFeet(T slugsquarefeet) { - double value = (double) slugsquarefeet; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.SlugSquareFoot); + return new MassMomentOfInertia(slugsquarefeet, MassMomentOfInertiaUnit.SlugSquareFoot); } /// /// Get from SlugSquareInches. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromSlugSquareInches(QuantityValue slugsquareinches) + public static MassMomentOfInertia FromSlugSquareInches(T slugsquareinches) { - double value = (double) slugsquareinches; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.SlugSquareInch); + return new MassMomentOfInertia(slugsquareinches, MassMomentOfInertiaUnit.SlugSquareInch); } /// /// Get from TonneSquareCentimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromTonneSquareCentimeters(QuantityValue tonnesquarecentimeters) + public static MassMomentOfInertia FromTonneSquareCentimeters(T tonnesquarecentimeters) { - double value = (double) tonnesquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareCentimeter); + return new MassMomentOfInertia(tonnesquarecentimeters, MassMomentOfInertiaUnit.TonneSquareCentimeter); } /// /// Get from TonneSquareDecimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromTonneSquareDecimeters(QuantityValue tonnesquaredecimeters) + public static MassMomentOfInertia FromTonneSquareDecimeters(T tonnesquaredecimeters) { - double value = (double) tonnesquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareDecimeter); + return new MassMomentOfInertia(tonnesquaredecimeters, MassMomentOfInertiaUnit.TonneSquareDecimeter); } /// /// Get from TonneSquareMeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromTonneSquareMeters(QuantityValue tonnesquaremeters) + public static MassMomentOfInertia FromTonneSquareMeters(T tonnesquaremeters) { - double value = (double) tonnesquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareMeter); + return new MassMomentOfInertia(tonnesquaremeters, MassMomentOfInertiaUnit.TonneSquareMeter); } /// /// Get from TonneSquareMilimeters. /// /// If value is NaN or Infinity. - public static MassMomentOfInertia FromTonneSquareMilimeters(QuantityValue tonnesquaremilimeters) + public static MassMomentOfInertia FromTonneSquareMilimeters(T tonnesquaremilimeters) { - double value = (double) tonnesquaremilimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareMilimeter); + return new MassMomentOfInertia(tonnesquaremilimeters, MassMomentOfInertiaUnit.TonneSquareMilimeter); } /// @@ -618,9 +587,9 @@ public static MassMomentOfInertia FromTonneSquareMilimeters(QuantityValue ton /// Value to convert from. /// Unit to convert from. /// unit value. - public static MassMomentOfInertia From(QuantityValue value, MassMomentOfInertiaUnit fromUnit) + public static MassMomentOfInertia From(T value, MassMomentOfInertiaUnit fromUnit) { - return new MassMomentOfInertia((double)value, fromUnit); + return new MassMomentOfInertia(value, fromUnit); } #endregion @@ -774,43 +743,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassMo /// Negate the value. public static MassMomentOfInertia operator -(MassMomentOfInertia right) { - return new MassMomentOfInertia(-right.Value, right.Unit); + return new MassMomentOfInertia(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static MassMomentOfInertia operator +(MassMomentOfInertia left, MassMomentOfInertia right) { - return new MassMomentOfInertia(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new MassMomentOfInertia(value, left.Unit); } /// Get from subtracting two . public static MassMomentOfInertia operator -(MassMomentOfInertia left, MassMomentOfInertia right) { - return new MassMomentOfInertia(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new MassMomentOfInertia(value, left.Unit); } /// Get from multiplying value and . - public static MassMomentOfInertia operator *(double left, MassMomentOfInertia right) + public static MassMomentOfInertia operator *(T left, MassMomentOfInertia right) { - return new MassMomentOfInertia(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new MassMomentOfInertia(value, right.Unit); } /// Get from multiplying value and . - public static MassMomentOfInertia operator *(MassMomentOfInertia left, double right) + public static MassMomentOfInertia operator *(MassMomentOfInertia left, T right) { - return new MassMomentOfInertia(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new MassMomentOfInertia(value, left.Unit); } /// Get from dividing by value. - public static MassMomentOfInertia operator /(MassMomentOfInertia left, double right) + public static MassMomentOfInertia operator /(MassMomentOfInertia left, T right) { - return new MassMomentOfInertia(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new MassMomentOfInertia(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(MassMomentOfInertia left, MassMomentOfInertia right) + public static T operator /(MassMomentOfInertia left, MassMomentOfInertia right) { - return left.KilogramSquareMeters / right.KilogramSquareMeters; + return CompiledLambdas.Divide(left.KilogramSquareMeters, right.KilogramSquareMeters); } #endregion @@ -820,25 +794,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassMo /// Returns true if less or equal to. public static bool operator <=(MassMomentOfInertia left, MassMomentOfInertia right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(MassMomentOfInertia left, MassMomentOfInertia right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(MassMomentOfInertia left, MassMomentOfInertia right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(MassMomentOfInertia left, MassMomentOfInertia right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -867,7 +841,7 @@ public int CompareTo(object obj) /// public int CompareTo(MassMomentOfInertia other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -884,7 +858,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MassMomentOfInertia other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -932,10 +906,8 @@ public bool Equals(MassMomentOfInertia other, double tolerance, ComparisonTyp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -955,17 +927,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MassMomentOfInertiaUnit unit) + public T As(MassMomentOfInertiaUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -985,9 +957,14 @@ double IQuantity.As(Enum unit) if(!(unit is MassMomentOfInertiaUnit unitAsMassMomentOfInertiaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassMomentOfInertiaUnit)} is supported.", nameof(unit)); - return As(unitAsMassMomentOfInertiaUnit); + var asValue = As(unitAsMassMomentOfInertiaUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(MassMomentOfInertiaUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -1028,46 +1005,52 @@ public MassMomentOfInertia ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(MassMomentOfInertiaUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(MassMomentOfInertiaUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case MassMomentOfInertiaUnit.GramSquareCentimeter: return _value/1e7; - case MassMomentOfInertiaUnit.GramSquareDecimeter: return _value/1e5; - case MassMomentOfInertiaUnit.GramSquareMeter: return _value/1e3; - case MassMomentOfInertiaUnit.GramSquareMillimeter: return _value/1e9; - case MassMomentOfInertiaUnit.KilogramSquareCentimeter: return (_value/1e7) * 1e3d; - case MassMomentOfInertiaUnit.KilogramSquareDecimeter: return (_value/1e5) * 1e3d; - case MassMomentOfInertiaUnit.KilogramSquareMeter: return (_value/1e3) * 1e3d; - case MassMomentOfInertiaUnit.KilogramSquareMillimeter: return (_value/1e9) * 1e3d; - case MassMomentOfInertiaUnit.KilotonneSquareCentimeter: return (_value/1e1) * 1e3d; - case MassMomentOfInertiaUnit.KilotonneSquareDecimeter: return (_value/1e-1) * 1e3d; - case MassMomentOfInertiaUnit.KilotonneSquareMeter: return (_value/1e-3) * 1e3d; - case MassMomentOfInertiaUnit.KilotonneSquareMilimeter: return (_value/1e3) * 1e3d; - case MassMomentOfInertiaUnit.MegatonneSquareCentimeter: return (_value/1e1) * 1e6d; - case MassMomentOfInertiaUnit.MegatonneSquareDecimeter: return (_value/1e-1) * 1e6d; - case MassMomentOfInertiaUnit.MegatonneSquareMeter: return (_value/1e-3) * 1e6d; - case MassMomentOfInertiaUnit.MegatonneSquareMilimeter: return (_value/1e3) * 1e6d; - case MassMomentOfInertiaUnit.MilligramSquareCentimeter: return (_value/1e7) * 1e-3d; - case MassMomentOfInertiaUnit.MilligramSquareDecimeter: return (_value/1e5) * 1e-3d; - case MassMomentOfInertiaUnit.MilligramSquareMeter: return (_value/1e3) * 1e-3d; - case MassMomentOfInertiaUnit.MilligramSquareMillimeter: return (_value/1e9) * 1e-3d; - case MassMomentOfInertiaUnit.PoundSquareFoot: return _value*4.21401101e-2; - case MassMomentOfInertiaUnit.PoundSquareInch: return _value*2.9263965e-4; - case MassMomentOfInertiaUnit.SlugSquareFoot: return _value*1.3558179619; - case MassMomentOfInertiaUnit.SlugSquareInch: return _value*9.41540242e-3; - case MassMomentOfInertiaUnit.TonneSquareCentimeter: return _value/1e1; - case MassMomentOfInertiaUnit.TonneSquareDecimeter: return _value/1e-1; - case MassMomentOfInertiaUnit.TonneSquareMeter: return _value/1e-3; - case MassMomentOfInertiaUnit.TonneSquareMilimeter: return _value/1e3; + case MassMomentOfInertiaUnit.GramSquareCentimeter: return Value/1e7; + case MassMomentOfInertiaUnit.GramSquareDecimeter: return Value/1e5; + case MassMomentOfInertiaUnit.GramSquareMeter: return Value/1e3; + case MassMomentOfInertiaUnit.GramSquareMillimeter: return Value/1e9; + case MassMomentOfInertiaUnit.KilogramSquareCentimeter: return (Value/1e7) * 1e3d; + case MassMomentOfInertiaUnit.KilogramSquareDecimeter: return (Value/1e5) * 1e3d; + case MassMomentOfInertiaUnit.KilogramSquareMeter: return (Value/1e3) * 1e3d; + case MassMomentOfInertiaUnit.KilogramSquareMillimeter: return (Value/1e9) * 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareCentimeter: return (Value/1e1) * 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareDecimeter: return (Value/1e-1) * 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareMeter: return (Value/1e-3) * 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareMilimeter: return (Value/1e3) * 1e3d; + case MassMomentOfInertiaUnit.MegatonneSquareCentimeter: return (Value/1e1) * 1e6d; + case MassMomentOfInertiaUnit.MegatonneSquareDecimeter: return (Value/1e-1) * 1e6d; + case MassMomentOfInertiaUnit.MegatonneSquareMeter: return (Value/1e-3) * 1e6d; + case MassMomentOfInertiaUnit.MegatonneSquareMilimeter: return (Value/1e3) * 1e6d; + case MassMomentOfInertiaUnit.MilligramSquareCentimeter: return (Value/1e7) * 1e-3d; + case MassMomentOfInertiaUnit.MilligramSquareDecimeter: return (Value/1e5) * 1e-3d; + case MassMomentOfInertiaUnit.MilligramSquareMeter: return (Value/1e3) * 1e-3d; + case MassMomentOfInertiaUnit.MilligramSquareMillimeter: return (Value/1e9) * 1e-3d; + case MassMomentOfInertiaUnit.PoundSquareFoot: return Value*4.21401101e-2; + case MassMomentOfInertiaUnit.PoundSquareInch: return Value*2.9263965e-4; + case MassMomentOfInertiaUnit.SlugSquareFoot: return Value*1.3558179619; + case MassMomentOfInertiaUnit.SlugSquareInch: return Value*9.41540242e-3; + case MassMomentOfInertiaUnit.TonneSquareCentimeter: return Value/1e1; + case MassMomentOfInertiaUnit.TonneSquareDecimeter: return Value/1e-1; + case MassMomentOfInertiaUnit.TonneSquareMeter: return Value/1e-3; + case MassMomentOfInertiaUnit.TonneSquareMilimeter: return Value/1e3; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -1084,10 +1067,10 @@ internal MassMomentOfInertia ToBaseUnit() return new MassMomentOfInertia(baseUnitValue, BaseUnit); } - private double GetValueAs(MassMomentOfInertiaUnit unit) + private T GetValueAs(MassMomentOfInertiaUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1222,7 +1205,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1237,37 +1220,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1291,17 +1274,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs index 071a04d7de..68a852daa0 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Molar energy is the amount of energy stored in 1 mole of a substance. /// - public partial struct MolarEnergy : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct MolarEnergy : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -63,12 +58,12 @@ static MolarEnergy() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public MolarEnergy(double value, MolarEnergyUnit unit) + public MolarEnergy(T value, MolarEnergyUnit unit) { if(unit == MolarEnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -80,14 +75,14 @@ public MolarEnergy(double value, MolarEnergyUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public MolarEnergy(double value, UnitSystem unitSystem) + public MolarEnergy(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -129,7 +124,7 @@ public MolarEnergy(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerMole. /// - public static MolarEnergy Zero { get; } = new MolarEnergy(0, BaseUnit); + public static MolarEnergy Zero { get; } = new MolarEnergy((T)0, BaseUnit); #endregion @@ -138,7 +133,9 @@ public MolarEnergy(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -168,17 +165,17 @@ public MolarEnergy(double value, UnitSystem unitSystem) /// /// Get in JoulesPerMole. /// - public double JoulesPerMole => As(MolarEnergyUnit.JoulePerMole); + public T JoulesPerMole => As(MolarEnergyUnit.JoulePerMole); /// /// Get in KilojoulesPerMole. /// - public double KilojoulesPerMole => As(MolarEnergyUnit.KilojoulePerMole); + public T KilojoulesPerMole => As(MolarEnergyUnit.KilojoulePerMole); /// /// Get in MegajoulesPerMole. /// - public double MegajoulesPerMole => As(MolarEnergyUnit.MegajoulePerMole); + public T MegajoulesPerMole => As(MolarEnergyUnit.MegajoulePerMole); #endregion @@ -213,28 +210,25 @@ public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] IFormatPr /// Get from JoulesPerMole. /// /// If value is NaN or Infinity. - public static MolarEnergy FromJoulesPerMole(QuantityValue joulespermole) + public static MolarEnergy FromJoulesPerMole(T joulespermole) { - double value = (double) joulespermole; - return new MolarEnergy(value, MolarEnergyUnit.JoulePerMole); + return new MolarEnergy(joulespermole, MolarEnergyUnit.JoulePerMole); } /// /// Get from KilojoulesPerMole. /// /// If value is NaN or Infinity. - public static MolarEnergy FromKilojoulesPerMole(QuantityValue kilojoulespermole) + public static MolarEnergy FromKilojoulesPerMole(T kilojoulespermole) { - double value = (double) kilojoulespermole; - return new MolarEnergy(value, MolarEnergyUnit.KilojoulePerMole); + return new MolarEnergy(kilojoulespermole, MolarEnergyUnit.KilojoulePerMole); } /// /// Get from MegajoulesPerMole. /// /// If value is NaN or Infinity. - public static MolarEnergy FromMegajoulesPerMole(QuantityValue megajoulespermole) + public static MolarEnergy FromMegajoulesPerMole(T megajoulespermole) { - double value = (double) megajoulespermole; - return new MolarEnergy(value, MolarEnergyUnit.MegajoulePerMole); + return new MolarEnergy(megajoulespermole, MolarEnergyUnit.MegajoulePerMole); } /// @@ -243,9 +237,9 @@ public static MolarEnergy FromMegajoulesPerMole(QuantityValue megajoulespermo /// Value to convert from. /// Unit to convert from. /// unit value. - public static MolarEnergy From(QuantityValue value, MolarEnergyUnit fromUnit) + public static MolarEnergy From(T value, MolarEnergyUnit fromUnit) { - return new MolarEnergy((double)value, fromUnit); + return new MolarEnergy(value, fromUnit); } #endregion @@ -399,43 +393,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarE /// Negate the value. public static MolarEnergy operator -(MolarEnergy right) { - return new MolarEnergy(-right.Value, right.Unit); + return new MolarEnergy(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static MolarEnergy operator +(MolarEnergy left, MolarEnergy right) { - return new MolarEnergy(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new MolarEnergy(value, left.Unit); } /// Get from subtracting two . public static MolarEnergy operator -(MolarEnergy left, MolarEnergy right) { - return new MolarEnergy(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new MolarEnergy(value, left.Unit); } /// Get from multiplying value and . - public static MolarEnergy operator *(double left, MolarEnergy right) + public static MolarEnergy operator *(T left, MolarEnergy right) { - return new MolarEnergy(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new MolarEnergy(value, right.Unit); } /// Get from multiplying value and . - public static MolarEnergy operator *(MolarEnergy left, double right) + public static MolarEnergy operator *(MolarEnergy left, T right) { - return new MolarEnergy(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new MolarEnergy(value, left.Unit); } /// Get from dividing by value. - public static MolarEnergy operator /(MolarEnergy left, double right) + public static MolarEnergy operator /(MolarEnergy left, T right) { - return new MolarEnergy(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new MolarEnergy(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(MolarEnergy left, MolarEnergy right) + public static T operator /(MolarEnergy left, MolarEnergy right) { - return left.JoulesPerMole / right.JoulesPerMole; + return CompiledLambdas.Divide(left.JoulesPerMole, right.JoulesPerMole); } #endregion @@ -445,25 +444,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarE /// Returns true if less or equal to. public static bool operator <=(MolarEnergy left, MolarEnergy right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(MolarEnergy left, MolarEnergy right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(MolarEnergy left, MolarEnergy right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(MolarEnergy left, MolarEnergy right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -492,7 +491,7 @@ public int CompareTo(object obj) /// public int CompareTo(MolarEnergy other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -509,7 +508,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MolarEnergy other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -557,10 +556,8 @@ public bool Equals(MolarEnergy other, double tolerance, ComparisonType compar if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -580,17 +577,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MolarEnergyUnit unit) + public T As(MolarEnergyUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -610,9 +607,14 @@ double IQuantity.As(Enum unit) if(!(unit is MolarEnergyUnit unitAsMolarEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarEnergyUnit)} is supported.", nameof(unit)); - return As(unitAsMolarEnergyUnit); + var asValue = As(unitAsMolarEnergyUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(MolarEnergyUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -653,21 +655,27 @@ public MolarEnergy ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(MolarEnergyUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(MolarEnergyUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case MolarEnergyUnit.JoulePerMole: return _value; - case MolarEnergyUnit.KilojoulePerMole: return (_value) * 1e3d; - case MolarEnergyUnit.MegajoulePerMole: return (_value) * 1e6d; + case MolarEnergyUnit.JoulePerMole: return Value; + case MolarEnergyUnit.KilojoulePerMole: return (Value) * 1e3d; + case MolarEnergyUnit.MegajoulePerMole: return (Value) * 1e6d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -684,10 +692,10 @@ internal MolarEnergy ToBaseUnit() return new MolarEnergy(baseUnitValue, BaseUnit); } - private double GetValueAs(MolarEnergyUnit unit) + private T GetValueAs(MolarEnergyUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -797,7 +805,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -812,37 +820,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -866,17 +874,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs index b42f81ffd7..4de5e89f50 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Molar entropy is amount of energy required to increase temperature of 1 mole substance by 1 Kelvin. /// - public partial struct MolarEntropy : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct MolarEntropy : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -63,12 +58,12 @@ static MolarEntropy() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public MolarEntropy(double value, MolarEntropyUnit unit) + public MolarEntropy(T value, MolarEntropyUnit unit) { if(unit == MolarEntropyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -80,14 +75,14 @@ public MolarEntropy(double value, MolarEntropyUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public MolarEntropy(double value, UnitSystem unitSystem) + public MolarEntropy(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -129,7 +124,7 @@ public MolarEntropy(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerMoleKelvin. /// - public static MolarEntropy Zero { get; } = new MolarEntropy(0, BaseUnit); + public static MolarEntropy Zero { get; } = new MolarEntropy((T)0, BaseUnit); #endregion @@ -138,7 +133,9 @@ public MolarEntropy(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -168,17 +165,17 @@ public MolarEntropy(double value, UnitSystem unitSystem) /// /// Get in JoulesPerMoleKelvin. /// - public double JoulesPerMoleKelvin => As(MolarEntropyUnit.JoulePerMoleKelvin); + public T JoulesPerMoleKelvin => As(MolarEntropyUnit.JoulePerMoleKelvin); /// /// Get in KilojoulesPerMoleKelvin. /// - public double KilojoulesPerMoleKelvin => As(MolarEntropyUnit.KilojoulePerMoleKelvin); + public T KilojoulesPerMoleKelvin => As(MolarEntropyUnit.KilojoulePerMoleKelvin); /// /// Get in MegajoulesPerMoleKelvin. /// - public double MegajoulesPerMoleKelvin => As(MolarEntropyUnit.MegajoulePerMoleKelvin); + public T MegajoulesPerMoleKelvin => As(MolarEntropyUnit.MegajoulePerMoleKelvin); #endregion @@ -213,28 +210,25 @@ public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] IFormatP /// Get from JoulesPerMoleKelvin. /// /// If value is NaN or Infinity. - public static MolarEntropy FromJoulesPerMoleKelvin(QuantityValue joulespermolekelvin) + public static MolarEntropy FromJoulesPerMoleKelvin(T joulespermolekelvin) { - double value = (double) joulespermolekelvin; - return new MolarEntropy(value, MolarEntropyUnit.JoulePerMoleKelvin); + return new MolarEntropy(joulespermolekelvin, MolarEntropyUnit.JoulePerMoleKelvin); } /// /// Get from KilojoulesPerMoleKelvin. /// /// If value is NaN or Infinity. - public static MolarEntropy FromKilojoulesPerMoleKelvin(QuantityValue kilojoulespermolekelvin) + public static MolarEntropy FromKilojoulesPerMoleKelvin(T kilojoulespermolekelvin) { - double value = (double) kilojoulespermolekelvin; - return new MolarEntropy(value, MolarEntropyUnit.KilojoulePerMoleKelvin); + return new MolarEntropy(kilojoulespermolekelvin, MolarEntropyUnit.KilojoulePerMoleKelvin); } /// /// Get from MegajoulesPerMoleKelvin. /// /// If value is NaN or Infinity. - public static MolarEntropy FromMegajoulesPerMoleKelvin(QuantityValue megajoulespermolekelvin) + public static MolarEntropy FromMegajoulesPerMoleKelvin(T megajoulespermolekelvin) { - double value = (double) megajoulespermolekelvin; - return new MolarEntropy(value, MolarEntropyUnit.MegajoulePerMoleKelvin); + return new MolarEntropy(megajoulespermolekelvin, MolarEntropyUnit.MegajoulePerMoleKelvin); } /// @@ -243,9 +237,9 @@ public static MolarEntropy FromMegajoulesPerMoleKelvin(QuantityValue megajoul /// Value to convert from. /// Unit to convert from. /// unit value. - public static MolarEntropy From(QuantityValue value, MolarEntropyUnit fromUnit) + public static MolarEntropy From(T value, MolarEntropyUnit fromUnit) { - return new MolarEntropy((double)value, fromUnit); + return new MolarEntropy(value, fromUnit); } #endregion @@ -399,43 +393,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarE /// Negate the value. public static MolarEntropy operator -(MolarEntropy right) { - return new MolarEntropy(-right.Value, right.Unit); + return new MolarEntropy(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static MolarEntropy operator +(MolarEntropy left, MolarEntropy right) { - return new MolarEntropy(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new MolarEntropy(value, left.Unit); } /// Get from subtracting two . public static MolarEntropy operator -(MolarEntropy left, MolarEntropy right) { - return new MolarEntropy(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new MolarEntropy(value, left.Unit); } /// Get from multiplying value and . - public static MolarEntropy operator *(double left, MolarEntropy right) + public static MolarEntropy operator *(T left, MolarEntropy right) { - return new MolarEntropy(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new MolarEntropy(value, right.Unit); } /// Get from multiplying value and . - public static MolarEntropy operator *(MolarEntropy left, double right) + public static MolarEntropy operator *(MolarEntropy left, T right) { - return new MolarEntropy(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new MolarEntropy(value, left.Unit); } /// Get from dividing by value. - public static MolarEntropy operator /(MolarEntropy left, double right) + public static MolarEntropy operator /(MolarEntropy left, T right) { - return new MolarEntropy(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new MolarEntropy(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(MolarEntropy left, MolarEntropy right) + public static T operator /(MolarEntropy left, MolarEntropy right) { - return left.JoulesPerMoleKelvin / right.JoulesPerMoleKelvin; + return CompiledLambdas.Divide(left.JoulesPerMoleKelvin, right.JoulesPerMoleKelvin); } #endregion @@ -445,25 +444,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarE /// Returns true if less or equal to. public static bool operator <=(MolarEntropy left, MolarEntropy right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(MolarEntropy left, MolarEntropy right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(MolarEntropy left, MolarEntropy right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(MolarEntropy left, MolarEntropy right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -492,7 +491,7 @@ public int CompareTo(object obj) /// public int CompareTo(MolarEntropy other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -509,7 +508,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MolarEntropy other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -557,10 +556,8 @@ public bool Equals(MolarEntropy other, double tolerance, ComparisonType compa if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -580,17 +577,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MolarEntropyUnit unit) + public T As(MolarEntropyUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -610,9 +607,14 @@ double IQuantity.As(Enum unit) if(!(unit is MolarEntropyUnit unitAsMolarEntropyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarEntropyUnit)} is supported.", nameof(unit)); - return As(unitAsMolarEntropyUnit); + var asValue = As(unitAsMolarEntropyUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(MolarEntropyUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -653,21 +655,27 @@ public MolarEntropy ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(MolarEntropyUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(MolarEntropyUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case MolarEntropyUnit.JoulePerMoleKelvin: return _value; - case MolarEntropyUnit.KilojoulePerMoleKelvin: return (_value) * 1e3d; - case MolarEntropyUnit.MegajoulePerMoleKelvin: return (_value) * 1e6d; + case MolarEntropyUnit.JoulePerMoleKelvin: return Value; + case MolarEntropyUnit.KilojoulePerMoleKelvin: return (Value) * 1e3d; + case MolarEntropyUnit.MegajoulePerMoleKelvin: return (Value) * 1e6d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -684,10 +692,10 @@ internal MolarEntropy ToBaseUnit() return new MolarEntropy(baseUnitValue, BaseUnit); } - private double GetValueAs(MolarEntropyUnit unit) + private T GetValueAs(MolarEntropyUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -797,7 +805,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -812,37 +820,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -866,17 +874,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs index 4a2437bc05..c6eaa23fe1 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// In chemistry, the molar mass M is a physical property defined as the mass of a given substance (chemical element or chemical compound) divided by the amount of substance. /// - public partial struct MolarMass : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct MolarMass : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -72,12 +67,12 @@ static MolarMass() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public MolarMass(double value, MolarMassUnit unit) + public MolarMass(T value, MolarMassUnit unit) { if(unit == MolarMassUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -89,14 +84,14 @@ public MolarMass(double value, MolarMassUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public MolarMass(double value, UnitSystem unitSystem) + public MolarMass(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -138,7 +133,7 @@ public MolarMass(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerMole. /// - public static MolarMass Zero { get; } = new MolarMass(0, BaseUnit); + public static MolarMass Zero { get; } = new MolarMass((T)0, BaseUnit); #endregion @@ -147,7 +142,9 @@ public MolarMass(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -177,62 +174,62 @@ public MolarMass(double value, UnitSystem unitSystem) /// /// Get in CentigramsPerMole. /// - public double CentigramsPerMole => As(MolarMassUnit.CentigramPerMole); + public T CentigramsPerMole => As(MolarMassUnit.CentigramPerMole); /// /// Get in DecagramsPerMole. /// - public double DecagramsPerMole => As(MolarMassUnit.DecagramPerMole); + public T DecagramsPerMole => As(MolarMassUnit.DecagramPerMole); /// /// Get in DecigramsPerMole. /// - public double DecigramsPerMole => As(MolarMassUnit.DecigramPerMole); + public T DecigramsPerMole => As(MolarMassUnit.DecigramPerMole); /// /// Get in GramsPerMole. /// - public double GramsPerMole => As(MolarMassUnit.GramPerMole); + public T GramsPerMole => As(MolarMassUnit.GramPerMole); /// /// Get in HectogramsPerMole. /// - public double HectogramsPerMole => As(MolarMassUnit.HectogramPerMole); + public T HectogramsPerMole => As(MolarMassUnit.HectogramPerMole); /// /// Get in KilogramsPerMole. /// - public double KilogramsPerMole => As(MolarMassUnit.KilogramPerMole); + public T KilogramsPerMole => As(MolarMassUnit.KilogramPerMole); /// /// Get in KilopoundsPerMole. /// - public double KilopoundsPerMole => As(MolarMassUnit.KilopoundPerMole); + public T KilopoundsPerMole => As(MolarMassUnit.KilopoundPerMole); /// /// Get in MegapoundsPerMole. /// - public double MegapoundsPerMole => As(MolarMassUnit.MegapoundPerMole); + public T MegapoundsPerMole => As(MolarMassUnit.MegapoundPerMole); /// /// Get in MicrogramsPerMole. /// - public double MicrogramsPerMole => As(MolarMassUnit.MicrogramPerMole); + public T MicrogramsPerMole => As(MolarMassUnit.MicrogramPerMole); /// /// Get in MilligramsPerMole. /// - public double MilligramsPerMole => As(MolarMassUnit.MilligramPerMole); + public T MilligramsPerMole => As(MolarMassUnit.MilligramPerMole); /// /// Get in NanogramsPerMole. /// - public double NanogramsPerMole => As(MolarMassUnit.NanogramPerMole); + public T NanogramsPerMole => As(MolarMassUnit.NanogramPerMole); /// /// Get in PoundsPerMole. /// - public double PoundsPerMole => As(MolarMassUnit.PoundPerMole); + public T PoundsPerMole => As(MolarMassUnit.PoundPerMole); #endregion @@ -267,109 +264,97 @@ public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] IFormatProv /// Get from CentigramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromCentigramsPerMole(QuantityValue centigramspermole) + public static MolarMass FromCentigramsPerMole(T centigramspermole) { - double value = (double) centigramspermole; - return new MolarMass(value, MolarMassUnit.CentigramPerMole); + return new MolarMass(centigramspermole, MolarMassUnit.CentigramPerMole); } /// /// Get from DecagramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromDecagramsPerMole(QuantityValue decagramspermole) + public static MolarMass FromDecagramsPerMole(T decagramspermole) { - double value = (double) decagramspermole; - return new MolarMass(value, MolarMassUnit.DecagramPerMole); + return new MolarMass(decagramspermole, MolarMassUnit.DecagramPerMole); } /// /// Get from DecigramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromDecigramsPerMole(QuantityValue decigramspermole) + public static MolarMass FromDecigramsPerMole(T decigramspermole) { - double value = (double) decigramspermole; - return new MolarMass(value, MolarMassUnit.DecigramPerMole); + return new MolarMass(decigramspermole, MolarMassUnit.DecigramPerMole); } /// /// Get from GramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromGramsPerMole(QuantityValue gramspermole) + public static MolarMass FromGramsPerMole(T gramspermole) { - double value = (double) gramspermole; - return new MolarMass(value, MolarMassUnit.GramPerMole); + return new MolarMass(gramspermole, MolarMassUnit.GramPerMole); } /// /// Get from HectogramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromHectogramsPerMole(QuantityValue hectogramspermole) + public static MolarMass FromHectogramsPerMole(T hectogramspermole) { - double value = (double) hectogramspermole; - return new MolarMass(value, MolarMassUnit.HectogramPerMole); + return new MolarMass(hectogramspermole, MolarMassUnit.HectogramPerMole); } /// /// Get from KilogramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromKilogramsPerMole(QuantityValue kilogramspermole) + public static MolarMass FromKilogramsPerMole(T kilogramspermole) { - double value = (double) kilogramspermole; - return new MolarMass(value, MolarMassUnit.KilogramPerMole); + return new MolarMass(kilogramspermole, MolarMassUnit.KilogramPerMole); } /// /// Get from KilopoundsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromKilopoundsPerMole(QuantityValue kilopoundspermole) + public static MolarMass FromKilopoundsPerMole(T kilopoundspermole) { - double value = (double) kilopoundspermole; - return new MolarMass(value, MolarMassUnit.KilopoundPerMole); + return new MolarMass(kilopoundspermole, MolarMassUnit.KilopoundPerMole); } /// /// Get from MegapoundsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromMegapoundsPerMole(QuantityValue megapoundspermole) + public static MolarMass FromMegapoundsPerMole(T megapoundspermole) { - double value = (double) megapoundspermole; - return new MolarMass(value, MolarMassUnit.MegapoundPerMole); + return new MolarMass(megapoundspermole, MolarMassUnit.MegapoundPerMole); } /// /// Get from MicrogramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromMicrogramsPerMole(QuantityValue microgramspermole) + public static MolarMass FromMicrogramsPerMole(T microgramspermole) { - double value = (double) microgramspermole; - return new MolarMass(value, MolarMassUnit.MicrogramPerMole); + return new MolarMass(microgramspermole, MolarMassUnit.MicrogramPerMole); } /// /// Get from MilligramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromMilligramsPerMole(QuantityValue milligramspermole) + public static MolarMass FromMilligramsPerMole(T milligramspermole) { - double value = (double) milligramspermole; - return new MolarMass(value, MolarMassUnit.MilligramPerMole); + return new MolarMass(milligramspermole, MolarMassUnit.MilligramPerMole); } /// /// Get from NanogramsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromNanogramsPerMole(QuantityValue nanogramspermole) + public static MolarMass FromNanogramsPerMole(T nanogramspermole) { - double value = (double) nanogramspermole; - return new MolarMass(value, MolarMassUnit.NanogramPerMole); + return new MolarMass(nanogramspermole, MolarMassUnit.NanogramPerMole); } /// /// Get from PoundsPerMole. /// /// If value is NaN or Infinity. - public static MolarMass FromPoundsPerMole(QuantityValue poundspermole) + public static MolarMass FromPoundsPerMole(T poundspermole) { - double value = (double) poundspermole; - return new MolarMass(value, MolarMassUnit.PoundPerMole); + return new MolarMass(poundspermole, MolarMassUnit.PoundPerMole); } /// @@ -378,9 +363,9 @@ public static MolarMass FromPoundsPerMole(QuantityValue poundspermole) /// Value to convert from. /// Unit to convert from. /// unit value. - public static MolarMass From(QuantityValue value, MolarMassUnit fromUnit) + public static MolarMass From(T value, MolarMassUnit fromUnit) { - return new MolarMass((double)value, fromUnit); + return new MolarMass(value, fromUnit); } #endregion @@ -534,43 +519,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarM /// Negate the value. public static MolarMass operator -(MolarMass right) { - return new MolarMass(-right.Value, right.Unit); + return new MolarMass(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static MolarMass operator +(MolarMass left, MolarMass right) { - return new MolarMass(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new MolarMass(value, left.Unit); } /// Get from subtracting two . public static MolarMass operator -(MolarMass left, MolarMass right) { - return new MolarMass(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new MolarMass(value, left.Unit); } /// Get from multiplying value and . - public static MolarMass operator *(double left, MolarMass right) + public static MolarMass operator *(T left, MolarMass right) { - return new MolarMass(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new MolarMass(value, right.Unit); } /// Get from multiplying value and . - public static MolarMass operator *(MolarMass left, double right) + public static MolarMass operator *(MolarMass left, T right) { - return new MolarMass(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new MolarMass(value, left.Unit); } /// Get from dividing by value. - public static MolarMass operator /(MolarMass left, double right) + public static MolarMass operator /(MolarMass left, T right) { - return new MolarMass(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new MolarMass(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(MolarMass left, MolarMass right) + public static T operator /(MolarMass left, MolarMass right) { - return left.KilogramsPerMole / right.KilogramsPerMole; + return CompiledLambdas.Divide(left.KilogramsPerMole, right.KilogramsPerMole); } #endregion @@ -580,25 +570,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarM /// Returns true if less or equal to. public static bool operator <=(MolarMass left, MolarMass right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(MolarMass left, MolarMass right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(MolarMass left, MolarMass right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(MolarMass left, MolarMass right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -627,7 +617,7 @@ public int CompareTo(object obj) /// public int CompareTo(MolarMass other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -644,7 +634,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MolarMass other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -692,10 +682,8 @@ public bool Equals(MolarMass other, double tolerance, ComparisonType comparis if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -715,17 +703,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MolarMassUnit unit) + public T As(MolarMassUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -745,9 +733,14 @@ double IQuantity.As(Enum unit) if(!(unit is MolarMassUnit unitAsMolarMassUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarMassUnit)} is supported.", nameof(unit)); - return As(unitAsMolarMassUnit); + var asValue = As(unitAsMolarMassUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(MolarMassUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -788,30 +781,36 @@ public MolarMass ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(MolarMassUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(MolarMassUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case MolarMassUnit.CentigramPerMole: return (_value/1e3) * 1e-2d; - case MolarMassUnit.DecagramPerMole: return (_value/1e3) * 1e1d; - case MolarMassUnit.DecigramPerMole: return (_value/1e3) * 1e-1d; - case MolarMassUnit.GramPerMole: return _value/1e3; - case MolarMassUnit.HectogramPerMole: return (_value/1e3) * 1e2d; - case MolarMassUnit.KilogramPerMole: return (_value/1e3) * 1e3d; - case MolarMassUnit.KilopoundPerMole: return (_value*0.45359237) * 1e3d; - case MolarMassUnit.MegapoundPerMole: return (_value*0.45359237) * 1e6d; - case MolarMassUnit.MicrogramPerMole: return (_value/1e3) * 1e-6d; - case MolarMassUnit.MilligramPerMole: return (_value/1e3) * 1e-3d; - case MolarMassUnit.NanogramPerMole: return (_value/1e3) * 1e-9d; - case MolarMassUnit.PoundPerMole: return _value*0.45359237; + case MolarMassUnit.CentigramPerMole: return (Value/1e3) * 1e-2d; + case MolarMassUnit.DecagramPerMole: return (Value/1e3) * 1e1d; + case MolarMassUnit.DecigramPerMole: return (Value/1e3) * 1e-1d; + case MolarMassUnit.GramPerMole: return Value/1e3; + case MolarMassUnit.HectogramPerMole: return (Value/1e3) * 1e2d; + case MolarMassUnit.KilogramPerMole: return (Value/1e3) * 1e3d; + case MolarMassUnit.KilopoundPerMole: return (Value*0.45359237) * 1e3d; + case MolarMassUnit.MegapoundPerMole: return (Value*0.45359237) * 1e6d; + case MolarMassUnit.MicrogramPerMole: return (Value/1e3) * 1e-6d; + case MolarMassUnit.MilligramPerMole: return (Value/1e3) * 1e-3d; + case MolarMassUnit.NanogramPerMole: return (Value/1e3) * 1e-9d; + case MolarMassUnit.PoundPerMole: return Value*0.45359237; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -828,10 +827,10 @@ internal MolarMass ToBaseUnit() return new MolarMass(baseUnitValue, BaseUnit); } - private double GetValueAs(MolarMassUnit unit) + private T GetValueAs(MolarMassUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -950,7 +949,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -965,37 +964,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1019,17 +1018,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs index e7154dc3b8..7954fbae24 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Molar_concentration /// - public partial struct Molarity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Molarity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -71,12 +66,12 @@ static Molarity() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Molarity(double value, MolarityUnit unit) + public Molarity(T value, MolarityUnit unit) { if(unit == MolarityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -88,14 +83,14 @@ public Molarity(double value, MolarityUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Molarity(double value, UnitSystem unitSystem) + public Molarity(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -137,7 +132,7 @@ public Molarity(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit MolesPerCubicMeter. /// - public static Molarity Zero { get; } = new Molarity(0, BaseUnit); + public static Molarity Zero { get; } = new Molarity((T)0, BaseUnit); #endregion @@ -146,7 +141,9 @@ public Molarity(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -176,42 +173,42 @@ public Molarity(double value, UnitSystem unitSystem) /// /// Get in CentimolesPerLiter. /// - public double CentimolesPerLiter => As(MolarityUnit.CentimolesPerLiter); + public T CentimolesPerLiter => As(MolarityUnit.CentimolesPerLiter); /// /// Get in DecimolesPerLiter. /// - public double DecimolesPerLiter => As(MolarityUnit.DecimolesPerLiter); + public T DecimolesPerLiter => As(MolarityUnit.DecimolesPerLiter); /// /// Get in MicromolesPerLiter. /// - public double MicromolesPerLiter => As(MolarityUnit.MicromolesPerLiter); + public T MicromolesPerLiter => As(MolarityUnit.MicromolesPerLiter); /// /// Get in MillimolesPerLiter. /// - public double MillimolesPerLiter => As(MolarityUnit.MillimolesPerLiter); + public T MillimolesPerLiter => As(MolarityUnit.MillimolesPerLiter); /// /// Get in MolesPerCubicMeter. /// - public double MolesPerCubicMeter => As(MolarityUnit.MolesPerCubicMeter); + public T MolesPerCubicMeter => As(MolarityUnit.MolesPerCubicMeter); /// /// Get in MolesPerLiter. /// - public double MolesPerLiter => As(MolarityUnit.MolesPerLiter); + public T MolesPerLiter => As(MolarityUnit.MolesPerLiter); /// /// Get in NanomolesPerLiter. /// - public double NanomolesPerLiter => As(MolarityUnit.NanomolesPerLiter); + public T NanomolesPerLiter => As(MolarityUnit.NanomolesPerLiter); /// /// Get in PicomolesPerLiter. /// - public double PicomolesPerLiter => As(MolarityUnit.PicomolesPerLiter); + public T PicomolesPerLiter => As(MolarityUnit.PicomolesPerLiter); #endregion @@ -246,73 +243,65 @@ public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] IFormatProvi /// Get from CentimolesPerLiter. /// /// If value is NaN or Infinity. - public static Molarity FromCentimolesPerLiter(QuantityValue centimolesperliter) + public static Molarity FromCentimolesPerLiter(T centimolesperliter) { - double value = (double) centimolesperliter; - return new Molarity(value, MolarityUnit.CentimolesPerLiter); + return new Molarity(centimolesperliter, MolarityUnit.CentimolesPerLiter); } /// /// Get from DecimolesPerLiter. /// /// If value is NaN or Infinity. - public static Molarity FromDecimolesPerLiter(QuantityValue decimolesperliter) + public static Molarity FromDecimolesPerLiter(T decimolesperliter) { - double value = (double) decimolesperliter; - return new Molarity(value, MolarityUnit.DecimolesPerLiter); + return new Molarity(decimolesperliter, MolarityUnit.DecimolesPerLiter); } /// /// Get from MicromolesPerLiter. /// /// If value is NaN or Infinity. - public static Molarity FromMicromolesPerLiter(QuantityValue micromolesperliter) + public static Molarity FromMicromolesPerLiter(T micromolesperliter) { - double value = (double) micromolesperliter; - return new Molarity(value, MolarityUnit.MicromolesPerLiter); + return new Molarity(micromolesperliter, MolarityUnit.MicromolesPerLiter); } /// /// Get from MillimolesPerLiter. /// /// If value is NaN or Infinity. - public static Molarity FromMillimolesPerLiter(QuantityValue millimolesperliter) + public static Molarity FromMillimolesPerLiter(T millimolesperliter) { - double value = (double) millimolesperliter; - return new Molarity(value, MolarityUnit.MillimolesPerLiter); + return new Molarity(millimolesperliter, MolarityUnit.MillimolesPerLiter); } /// /// Get from MolesPerCubicMeter. /// /// If value is NaN or Infinity. - public static Molarity FromMolesPerCubicMeter(QuantityValue molespercubicmeter) + public static Molarity FromMolesPerCubicMeter(T molespercubicmeter) { - double value = (double) molespercubicmeter; - return new Molarity(value, MolarityUnit.MolesPerCubicMeter); + return new Molarity(molespercubicmeter, MolarityUnit.MolesPerCubicMeter); } /// /// Get from MolesPerLiter. /// /// If value is NaN or Infinity. - public static Molarity FromMolesPerLiter(QuantityValue molesperliter) + public static Molarity FromMolesPerLiter(T molesperliter) { - double value = (double) molesperliter; - return new Molarity(value, MolarityUnit.MolesPerLiter); + return new Molarity(molesperliter, MolarityUnit.MolesPerLiter); } /// /// Get from NanomolesPerLiter. /// /// If value is NaN or Infinity. - public static Molarity FromNanomolesPerLiter(QuantityValue nanomolesperliter) + public static Molarity FromNanomolesPerLiter(T nanomolesperliter) { - double value = (double) nanomolesperliter; - return new Molarity(value, MolarityUnit.NanomolesPerLiter); + return new Molarity(nanomolesperliter, MolarityUnit.NanomolesPerLiter); } /// /// Get from PicomolesPerLiter. /// /// If value is NaN or Infinity. - public static Molarity FromPicomolesPerLiter(QuantityValue picomolesperliter) + public static Molarity FromPicomolesPerLiter(T picomolesperliter) { - double value = (double) picomolesperliter; - return new Molarity(value, MolarityUnit.PicomolesPerLiter); + return new Molarity(picomolesperliter, MolarityUnit.PicomolesPerLiter); } /// @@ -321,9 +310,9 @@ public static Molarity FromPicomolesPerLiter(QuantityValue picomolesperliter) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Molarity From(QuantityValue value, MolarityUnit fromUnit) + public static Molarity From(T value, MolarityUnit fromUnit) { - return new Molarity((double)value, fromUnit); + return new Molarity(value, fromUnit); } #endregion @@ -477,43 +466,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Molari /// Negate the value. public static Molarity operator -(Molarity right) { - return new Molarity(-right.Value, right.Unit); + return new Molarity(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Molarity operator +(Molarity left, Molarity right) { - return new Molarity(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Molarity(value, left.Unit); } /// Get from subtracting two . public static Molarity operator -(Molarity left, Molarity right) { - return new Molarity(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Molarity(value, left.Unit); } /// Get from multiplying value and . - public static Molarity operator *(double left, Molarity right) + public static Molarity operator *(T left, Molarity right) { - return new Molarity(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Molarity(value, right.Unit); } /// Get from multiplying value and . - public static Molarity operator *(Molarity left, double right) + public static Molarity operator *(Molarity left, T right) { - return new Molarity(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Molarity(value, left.Unit); } /// Get from dividing by value. - public static Molarity operator /(Molarity left, double right) + public static Molarity operator /(Molarity left, T right) { - return new Molarity(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Molarity(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Molarity left, Molarity right) + public static T operator /(Molarity left, Molarity right) { - return left.MolesPerCubicMeter / right.MolesPerCubicMeter; + return CompiledLambdas.Divide(left.MolesPerCubicMeter, right.MolesPerCubicMeter); } #endregion @@ -523,25 +517,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Molari /// Returns true if less or equal to. public static bool operator <=(Molarity left, Molarity right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Molarity left, Molarity right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Molarity left, Molarity right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Molarity left, Molarity right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -570,7 +564,7 @@ public int CompareTo(object obj) /// public int CompareTo(Molarity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -587,7 +581,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Molarity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -635,10 +629,8 @@ public bool Equals(Molarity other, double tolerance, ComparisonType compariso if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -658,17 +650,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MolarityUnit unit) + public T As(MolarityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -688,9 +680,14 @@ double IQuantity.As(Enum unit) if(!(unit is MolarityUnit unitAsMolarityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarityUnit)} is supported.", nameof(unit)); - return As(unitAsMolarityUnit); + var asValue = As(unitAsMolarityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(MolarityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -731,26 +728,32 @@ public Molarity ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(MolarityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(MolarityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case MolarityUnit.CentimolesPerLiter: return (_value/1e-3) * 1e-2d; - case MolarityUnit.DecimolesPerLiter: return (_value/1e-3) * 1e-1d; - case MolarityUnit.MicromolesPerLiter: return (_value/1e-3) * 1e-6d; - case MolarityUnit.MillimolesPerLiter: return (_value/1e-3) * 1e-3d; - case MolarityUnit.MolesPerCubicMeter: return _value; - case MolarityUnit.MolesPerLiter: return _value/1e-3; - case MolarityUnit.NanomolesPerLiter: return (_value/1e-3) * 1e-9d; - case MolarityUnit.PicomolesPerLiter: return (_value/1e-3) * 1e-12d; + case MolarityUnit.CentimolesPerLiter: return (Value/1e-3) * 1e-2d; + case MolarityUnit.DecimolesPerLiter: return (Value/1e-3) * 1e-1d; + case MolarityUnit.MicromolesPerLiter: return (Value/1e-3) * 1e-6d; + case MolarityUnit.MillimolesPerLiter: return (Value/1e-3) * 1e-3d; + case MolarityUnit.MolesPerCubicMeter: return Value; + case MolarityUnit.MolesPerLiter: return Value/1e-3; + case MolarityUnit.NanomolesPerLiter: return (Value/1e-3) * 1e-9d; + case MolarityUnit.PicomolesPerLiter: return (Value/1e-3) * 1e-12d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -767,10 +770,10 @@ internal Molarity ToBaseUnit() return new Molarity(baseUnitValue, BaseUnit); } - private double GetValueAs(MolarityUnit unit) + private T GetValueAs(MolarityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -885,7 +888,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -900,37 +903,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -954,17 +957,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs index fd2d863723..23faad97cf 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Permeability_(electromagnetism) /// - public partial struct Permeability : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Permeability : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -64,12 +59,12 @@ static Permeability() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Permeability(double value, PermeabilityUnit unit) + public Permeability(T value, PermeabilityUnit unit) { if(unit == PermeabilityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -81,14 +76,14 @@ public Permeability(double value, PermeabilityUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Permeability(double value, UnitSystem unitSystem) + public Permeability(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -130,7 +125,7 @@ public Permeability(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit HenryPerMeter. /// - public static Permeability Zero { get; } = new Permeability(0, BaseUnit); + public static Permeability Zero { get; } = new Permeability((T)0, BaseUnit); #endregion @@ -139,7 +134,9 @@ public Permeability(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -169,7 +166,7 @@ public Permeability(double value, UnitSystem unitSystem) /// /// Get in HenriesPerMeter. /// - public double HenriesPerMeter => As(PermeabilityUnit.HenryPerMeter); + public T HenriesPerMeter => As(PermeabilityUnit.HenryPerMeter); #endregion @@ -204,10 +201,9 @@ public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] IFormatP /// Get from HenriesPerMeter. /// /// If value is NaN or Infinity. - public static Permeability FromHenriesPerMeter(QuantityValue henriespermeter) + public static Permeability FromHenriesPerMeter(T henriespermeter) { - double value = (double) henriespermeter; - return new Permeability(value, PermeabilityUnit.HenryPerMeter); + return new Permeability(henriespermeter, PermeabilityUnit.HenryPerMeter); } /// @@ -216,9 +212,9 @@ public static Permeability FromHenriesPerMeter(QuantityValue henriespermeter) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Permeability From(QuantityValue value, PermeabilityUnit fromUnit) + public static Permeability From(T value, PermeabilityUnit fromUnit) { - return new Permeability((double)value, fromUnit); + return new Permeability(value, fromUnit); } #endregion @@ -372,43 +368,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Permea /// Negate the value. public static Permeability operator -(Permeability right) { - return new Permeability(-right.Value, right.Unit); + return new Permeability(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Permeability operator +(Permeability left, Permeability right) { - return new Permeability(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Permeability(value, left.Unit); } /// Get from subtracting two . public static Permeability operator -(Permeability left, Permeability right) { - return new Permeability(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Permeability(value, left.Unit); } /// Get from multiplying value and . - public static Permeability operator *(double left, Permeability right) + public static Permeability operator *(T left, Permeability right) { - return new Permeability(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Permeability(value, right.Unit); } /// Get from multiplying value and . - public static Permeability operator *(Permeability left, double right) + public static Permeability operator *(Permeability left, T right) { - return new Permeability(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Permeability(value, left.Unit); } /// Get from dividing by value. - public static Permeability operator /(Permeability left, double right) + public static Permeability operator /(Permeability left, T right) { - return new Permeability(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Permeability(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Permeability left, Permeability right) + public static T operator /(Permeability left, Permeability right) { - return left.HenriesPerMeter / right.HenriesPerMeter; + return CompiledLambdas.Divide(left.HenriesPerMeter, right.HenriesPerMeter); } #endregion @@ -418,25 +419,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Permea /// Returns true if less or equal to. public static bool operator <=(Permeability left, Permeability right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Permeability left, Permeability right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Permeability left, Permeability right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Permeability left, Permeability right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -465,7 +466,7 @@ public int CompareTo(object obj) /// public int CompareTo(Permeability other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -482,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Permeability other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -530,10 +531,8 @@ public bool Equals(Permeability other, double tolerance, ComparisonType compa if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -553,17 +552,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(PermeabilityUnit unit) + public T As(PermeabilityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -583,9 +582,14 @@ double IQuantity.As(Enum unit) if(!(unit is PermeabilityUnit unitAsPermeabilityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PermeabilityUnit)} is supported.", nameof(unit)); - return As(unitAsPermeabilityUnit); + var asValue = As(unitAsPermeabilityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(PermeabilityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -626,19 +630,25 @@ public Permeability ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(PermeabilityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(PermeabilityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case PermeabilityUnit.HenryPerMeter: return _value; + case PermeabilityUnit.HenryPerMeter: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -655,10 +665,10 @@ internal Permeability ToBaseUnit() return new Permeability(baseUnitValue, BaseUnit); } - private double GetValueAs(PermeabilityUnit unit) + private T GetValueAs(PermeabilityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -766,7 +776,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -781,37 +791,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -835,17 +845,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs index 10e222c8ec..5d4d9e5fbb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Permittivity /// - public partial struct Permittivity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Permittivity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -64,12 +59,12 @@ static Permittivity() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Permittivity(double value, PermittivityUnit unit) + public Permittivity(T value, PermittivityUnit unit) { if(unit == PermittivityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -81,14 +76,14 @@ public Permittivity(double value, PermittivityUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Permittivity(double value, UnitSystem unitSystem) + public Permittivity(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -130,7 +125,7 @@ public Permittivity(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit FaradPerMeter. /// - public static Permittivity Zero { get; } = new Permittivity(0, BaseUnit); + public static Permittivity Zero { get; } = new Permittivity((T)0, BaseUnit); #endregion @@ -139,7 +134,9 @@ public Permittivity(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -169,7 +166,7 @@ public Permittivity(double value, UnitSystem unitSystem) /// /// Get in FaradsPerMeter. /// - public double FaradsPerMeter => As(PermittivityUnit.FaradPerMeter); + public T FaradsPerMeter => As(PermittivityUnit.FaradPerMeter); #endregion @@ -204,10 +201,9 @@ public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] IFormatP /// Get from FaradsPerMeter. /// /// If value is NaN or Infinity. - public static Permittivity FromFaradsPerMeter(QuantityValue faradspermeter) + public static Permittivity FromFaradsPerMeter(T faradspermeter) { - double value = (double) faradspermeter; - return new Permittivity(value, PermittivityUnit.FaradPerMeter); + return new Permittivity(faradspermeter, PermittivityUnit.FaradPerMeter); } /// @@ -216,9 +212,9 @@ public static Permittivity FromFaradsPerMeter(QuantityValue faradspermeter) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Permittivity From(QuantityValue value, PermittivityUnit fromUnit) + public static Permittivity From(T value, PermittivityUnit fromUnit) { - return new Permittivity((double)value, fromUnit); + return new Permittivity(value, fromUnit); } #endregion @@ -372,43 +368,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Permit /// Negate the value. public static Permittivity operator -(Permittivity right) { - return new Permittivity(-right.Value, right.Unit); + return new Permittivity(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Permittivity operator +(Permittivity left, Permittivity right) { - return new Permittivity(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Permittivity(value, left.Unit); } /// Get from subtracting two . public static Permittivity operator -(Permittivity left, Permittivity right) { - return new Permittivity(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Permittivity(value, left.Unit); } /// Get from multiplying value and . - public static Permittivity operator *(double left, Permittivity right) + public static Permittivity operator *(T left, Permittivity right) { - return new Permittivity(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Permittivity(value, right.Unit); } /// Get from multiplying value and . - public static Permittivity operator *(Permittivity left, double right) + public static Permittivity operator *(Permittivity left, T right) { - return new Permittivity(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Permittivity(value, left.Unit); } /// Get from dividing by value. - public static Permittivity operator /(Permittivity left, double right) + public static Permittivity operator /(Permittivity left, T right) { - return new Permittivity(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Permittivity(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Permittivity left, Permittivity right) + public static T operator /(Permittivity left, Permittivity right) { - return left.FaradsPerMeter / right.FaradsPerMeter; + return CompiledLambdas.Divide(left.FaradsPerMeter, right.FaradsPerMeter); } #endregion @@ -418,25 +419,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Permit /// Returns true if less or equal to. public static bool operator <=(Permittivity left, Permittivity right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Permittivity left, Permittivity right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Permittivity left, Permittivity right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Permittivity left, Permittivity right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -465,7 +466,7 @@ public int CompareTo(object obj) /// public int CompareTo(Permittivity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -482,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Permittivity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -530,10 +531,8 @@ public bool Equals(Permittivity other, double tolerance, ComparisonType compa if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -553,17 +552,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(PermittivityUnit unit) + public T As(PermittivityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -583,9 +582,14 @@ double IQuantity.As(Enum unit) if(!(unit is PermittivityUnit unitAsPermittivityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PermittivityUnit)} is supported.", nameof(unit)); - return As(unitAsPermittivityUnit); + var asValue = As(unitAsPermittivityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(PermittivityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -626,19 +630,25 @@ public Permittivity ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(PermittivityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(PermittivityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case PermittivityUnit.FaradPerMeter: return _value; + case PermittivityUnit.FaradPerMeter: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -655,10 +665,10 @@ internal Permittivity ToBaseUnit() return new Permittivity(baseUnitValue, BaseUnit); } - private double GetValueAs(PermittivityUnit unit) + private T GetValueAs(PermittivityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -766,7 +776,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -781,37 +791,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -835,17 +845,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Power.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.g.cs index f608570932..76551ea6bc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// In physics, power is the rate of doing work. It is equivalent to an amount of energy consumed per unit time. /// - public partial struct Power : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Power : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly decimal _value; - /// /// The unit this quantity was constructed with. /// @@ -80,12 +75,12 @@ static Power() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Power(decimal value, PowerUnit unit) + public Power(T value, PowerUnit unit) { if(unit == PowerUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = value; + Value = value; _unit = unit; } @@ -97,14 +92,14 @@ public Power(decimal value, PowerUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Power(decimal value, UnitSystem unitSystem) + public Power(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = value; + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -146,7 +141,7 @@ public Power(decimal value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Watt. /// - public static Power Zero { get; } = new Power(0, BaseUnit); + public static Power Zero { get; } = new Power((T)0, BaseUnit); #endregion @@ -155,9 +150,9 @@ public Power(decimal value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public decimal Value => _value; + public T Value{ get; } - double IQuantity.Value => (double) _value; + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -187,102 +182,102 @@ public Power(decimal value, UnitSystem unitSystem) /// /// Get in BoilerHorsepower. /// - public double BoilerHorsepower => As(PowerUnit.BoilerHorsepower); + public T BoilerHorsepower => As(PowerUnit.BoilerHorsepower); /// /// Get in BritishThermalUnitsPerHour. /// - public double BritishThermalUnitsPerHour => As(PowerUnit.BritishThermalUnitPerHour); + public T BritishThermalUnitsPerHour => As(PowerUnit.BritishThermalUnitPerHour); /// /// Get in Decawatts. /// - public double Decawatts => As(PowerUnit.Decawatt); + public T Decawatts => As(PowerUnit.Decawatt); /// /// Get in Deciwatts. /// - public double Deciwatts => As(PowerUnit.Deciwatt); + public T Deciwatts => As(PowerUnit.Deciwatt); /// /// Get in ElectricalHorsepower. /// - public double ElectricalHorsepower => As(PowerUnit.ElectricalHorsepower); + public T ElectricalHorsepower => As(PowerUnit.ElectricalHorsepower); /// /// Get in Femtowatts. /// - public double Femtowatts => As(PowerUnit.Femtowatt); + public T Femtowatts => As(PowerUnit.Femtowatt); /// /// Get in Gigawatts. /// - public double Gigawatts => As(PowerUnit.Gigawatt); + public T Gigawatts => As(PowerUnit.Gigawatt); /// /// Get in HydraulicHorsepower. /// - public double HydraulicHorsepower => As(PowerUnit.HydraulicHorsepower); + public T HydraulicHorsepower => As(PowerUnit.HydraulicHorsepower); /// /// Get in KilobritishThermalUnitsPerHour. /// - public double KilobritishThermalUnitsPerHour => As(PowerUnit.KilobritishThermalUnitPerHour); + public T KilobritishThermalUnitsPerHour => As(PowerUnit.KilobritishThermalUnitPerHour); /// /// Get in Kilowatts. /// - public double Kilowatts => As(PowerUnit.Kilowatt); + public T Kilowatts => As(PowerUnit.Kilowatt); /// /// Get in MechanicalHorsepower. /// - public double MechanicalHorsepower => As(PowerUnit.MechanicalHorsepower); + public T MechanicalHorsepower => As(PowerUnit.MechanicalHorsepower); /// /// Get in Megawatts. /// - public double Megawatts => As(PowerUnit.Megawatt); + public T Megawatts => As(PowerUnit.Megawatt); /// /// Get in MetricHorsepower. /// - public double MetricHorsepower => As(PowerUnit.MetricHorsepower); + public T MetricHorsepower => As(PowerUnit.MetricHorsepower); /// /// Get in Microwatts. /// - public double Microwatts => As(PowerUnit.Microwatt); + public T Microwatts => As(PowerUnit.Microwatt); /// /// Get in Milliwatts. /// - public double Milliwatts => As(PowerUnit.Milliwatt); + public T Milliwatts => As(PowerUnit.Milliwatt); /// /// Get in Nanowatts. /// - public double Nanowatts => As(PowerUnit.Nanowatt); + public T Nanowatts => As(PowerUnit.Nanowatt); /// /// Get in Petawatts. /// - public double Petawatts => As(PowerUnit.Petawatt); + public T Petawatts => As(PowerUnit.Petawatt); /// /// Get in Picowatts. /// - public double Picowatts => As(PowerUnit.Picowatt); + public T Picowatts => As(PowerUnit.Picowatt); /// /// Get in Terawatts. /// - public double Terawatts => As(PowerUnit.Terawatt); + public T Terawatts => As(PowerUnit.Terawatt); /// /// Get in Watts. /// - public double Watts => As(PowerUnit.Watt); + public T Watts => As(PowerUnit.Watt); #endregion @@ -317,181 +312,161 @@ public static string GetAbbreviation(PowerUnit unit, [CanBeNull] IFormatProvider /// Get from BoilerHorsepower. /// /// If value is NaN or Infinity. - public static Power FromBoilerHorsepower(QuantityValue boilerhorsepower) + public static Power FromBoilerHorsepower(T boilerhorsepower) { - decimal value = (decimal) boilerhorsepower; - return new Power(value, PowerUnit.BoilerHorsepower); + return new Power(boilerhorsepower, PowerUnit.BoilerHorsepower); } /// /// Get from BritishThermalUnitsPerHour. /// /// If value is NaN or Infinity. - public static Power FromBritishThermalUnitsPerHour(QuantityValue britishthermalunitsperhour) + public static Power FromBritishThermalUnitsPerHour(T britishthermalunitsperhour) { - decimal value = (decimal) britishthermalunitsperhour; - return new Power(value, PowerUnit.BritishThermalUnitPerHour); + return new Power(britishthermalunitsperhour, PowerUnit.BritishThermalUnitPerHour); } /// /// Get from Decawatts. /// /// If value is NaN or Infinity. - public static Power FromDecawatts(QuantityValue decawatts) + public static Power FromDecawatts(T decawatts) { - decimal value = (decimal) decawatts; - return new Power(value, PowerUnit.Decawatt); + return new Power(decawatts, PowerUnit.Decawatt); } /// /// Get from Deciwatts. /// /// If value is NaN or Infinity. - public static Power FromDeciwatts(QuantityValue deciwatts) + public static Power FromDeciwatts(T deciwatts) { - decimal value = (decimal) deciwatts; - return new Power(value, PowerUnit.Deciwatt); + return new Power(deciwatts, PowerUnit.Deciwatt); } /// /// Get from ElectricalHorsepower. /// /// If value is NaN or Infinity. - public static Power FromElectricalHorsepower(QuantityValue electricalhorsepower) + public static Power FromElectricalHorsepower(T electricalhorsepower) { - decimal value = (decimal) electricalhorsepower; - return new Power(value, PowerUnit.ElectricalHorsepower); + return new Power(electricalhorsepower, PowerUnit.ElectricalHorsepower); } /// /// Get from Femtowatts. /// /// If value is NaN or Infinity. - public static Power FromFemtowatts(QuantityValue femtowatts) + public static Power FromFemtowatts(T femtowatts) { - decimal value = (decimal) femtowatts; - return new Power(value, PowerUnit.Femtowatt); + return new Power(femtowatts, PowerUnit.Femtowatt); } /// /// Get from Gigawatts. /// /// If value is NaN or Infinity. - public static Power FromGigawatts(QuantityValue gigawatts) + public static Power FromGigawatts(T gigawatts) { - decimal value = (decimal) gigawatts; - return new Power(value, PowerUnit.Gigawatt); + return new Power(gigawatts, PowerUnit.Gigawatt); } /// /// Get from HydraulicHorsepower. /// /// If value is NaN or Infinity. - public static Power FromHydraulicHorsepower(QuantityValue hydraulichorsepower) + public static Power FromHydraulicHorsepower(T hydraulichorsepower) { - decimal value = (decimal) hydraulichorsepower; - return new Power(value, PowerUnit.HydraulicHorsepower); + return new Power(hydraulichorsepower, PowerUnit.HydraulicHorsepower); } /// /// Get from KilobritishThermalUnitsPerHour. /// /// If value is NaN or Infinity. - public static Power FromKilobritishThermalUnitsPerHour(QuantityValue kilobritishthermalunitsperhour) + public static Power FromKilobritishThermalUnitsPerHour(T kilobritishthermalunitsperhour) { - decimal value = (decimal) kilobritishthermalunitsperhour; - return new Power(value, PowerUnit.KilobritishThermalUnitPerHour); + return new Power(kilobritishthermalunitsperhour, PowerUnit.KilobritishThermalUnitPerHour); } /// /// Get from Kilowatts. /// /// If value is NaN or Infinity. - public static Power FromKilowatts(QuantityValue kilowatts) + public static Power FromKilowatts(T kilowatts) { - decimal value = (decimal) kilowatts; - return new Power(value, PowerUnit.Kilowatt); + return new Power(kilowatts, PowerUnit.Kilowatt); } /// /// Get from MechanicalHorsepower. /// /// If value is NaN or Infinity. - public static Power FromMechanicalHorsepower(QuantityValue mechanicalhorsepower) + public static Power FromMechanicalHorsepower(T mechanicalhorsepower) { - decimal value = (decimal) mechanicalhorsepower; - return new Power(value, PowerUnit.MechanicalHorsepower); + return new Power(mechanicalhorsepower, PowerUnit.MechanicalHorsepower); } /// /// Get from Megawatts. /// /// If value is NaN or Infinity. - public static Power FromMegawatts(QuantityValue megawatts) + public static Power FromMegawatts(T megawatts) { - decimal value = (decimal) megawatts; - return new Power(value, PowerUnit.Megawatt); + return new Power(megawatts, PowerUnit.Megawatt); } /// /// Get from MetricHorsepower. /// /// If value is NaN or Infinity. - public static Power FromMetricHorsepower(QuantityValue metrichorsepower) + public static Power FromMetricHorsepower(T metrichorsepower) { - decimal value = (decimal) metrichorsepower; - return new Power(value, PowerUnit.MetricHorsepower); + return new Power(metrichorsepower, PowerUnit.MetricHorsepower); } /// /// Get from Microwatts. /// /// If value is NaN or Infinity. - public static Power FromMicrowatts(QuantityValue microwatts) + public static Power FromMicrowatts(T microwatts) { - decimal value = (decimal) microwatts; - return new Power(value, PowerUnit.Microwatt); + return new Power(microwatts, PowerUnit.Microwatt); } /// /// Get from Milliwatts. /// /// If value is NaN or Infinity. - public static Power FromMilliwatts(QuantityValue milliwatts) + public static Power FromMilliwatts(T milliwatts) { - decimal value = (decimal) milliwatts; - return new Power(value, PowerUnit.Milliwatt); + return new Power(milliwatts, PowerUnit.Milliwatt); } /// /// Get from Nanowatts. /// /// If value is NaN or Infinity. - public static Power FromNanowatts(QuantityValue nanowatts) + public static Power FromNanowatts(T nanowatts) { - decimal value = (decimal) nanowatts; - return new Power(value, PowerUnit.Nanowatt); + return new Power(nanowatts, PowerUnit.Nanowatt); } /// /// Get from Petawatts. /// /// If value is NaN or Infinity. - public static Power FromPetawatts(QuantityValue petawatts) + public static Power FromPetawatts(T petawatts) { - decimal value = (decimal) petawatts; - return new Power(value, PowerUnit.Petawatt); + return new Power(petawatts, PowerUnit.Petawatt); } /// /// Get from Picowatts. /// /// If value is NaN or Infinity. - public static Power FromPicowatts(QuantityValue picowatts) + public static Power FromPicowatts(T picowatts) { - decimal value = (decimal) picowatts; - return new Power(value, PowerUnit.Picowatt); + return new Power(picowatts, PowerUnit.Picowatt); } /// /// Get from Terawatts. /// /// If value is NaN or Infinity. - public static Power FromTerawatts(QuantityValue terawatts) + public static Power FromTerawatts(T terawatts) { - decimal value = (decimal) terawatts; - return new Power(value, PowerUnit.Terawatt); + return new Power(terawatts, PowerUnit.Terawatt); } /// /// Get from Watts. /// /// If value is NaN or Infinity. - public static Power FromWatts(QuantityValue watts) + public static Power FromWatts(T watts) { - decimal value = (decimal) watts; - return new Power(value, PowerUnit.Watt); + return new Power(watts, PowerUnit.Watt); } /// @@ -500,9 +475,9 @@ public static Power FromWatts(QuantityValue watts) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Power From(QuantityValue value, PowerUnit fromUnit) + public static Power From(T value, PowerUnit fromUnit) { - return new Power((decimal)value, fromUnit); + return new Power(value, fromUnit); } #endregion @@ -656,43 +631,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerU /// Negate the value. public static Power operator -(Power right) { - return new Power(-right.Value, right.Unit); + return new Power(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Power operator +(Power left, Power right) { - return new Power(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Power(value, left.Unit); } /// Get from subtracting two . public static Power operator -(Power left, Power right) { - return new Power(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Power(value, left.Unit); } /// Get from multiplying value and . - public static Power operator *(decimal left, Power right) + public static Power operator *(T left, Power right) { - return new Power(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Power(value, right.Unit); } /// Get from multiplying value and . - public static Power operator *(Power left, decimal right) + public static Power operator *(Power left, T right) { - return new Power(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Power(value, left.Unit); } /// Get from dividing by value. - public static Power operator /(Power left, decimal right) + public static Power operator /(Power left, T right) { - return new Power(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Power(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Power left, Power right) + public static T operator /(Power left, Power right) { - return left.Watts / right.Watts; + return CompiledLambdas.Divide(left.Watts, right.Watts); } #endregion @@ -702,25 +682,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerU /// Returns true if less or equal to. public static bool operator <=(Power left, Power right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Power left, Power right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Power left, Power right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Power left, Power right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -749,7 +729,7 @@ public int CompareTo(object obj) /// public int CompareTo(Power other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -766,7 +746,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Power other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -814,10 +794,8 @@ public bool Equals(Power other, double tolerance, ComparisonType comparisonTy if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -837,17 +815,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(PowerUnit unit) + public T As(PowerUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -867,9 +845,14 @@ double IQuantity.As(Enum unit) if(!(unit is PowerUnit unitAsPowerUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PowerUnit)} is supported.", nameof(unit)); - return As(unitAsPowerUnit); + var asValue = As(unitAsPowerUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(PowerUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -910,38 +893,44 @@ public Power ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(PowerUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(PowerUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private decimal GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case PowerUnit.BoilerHorsepower: return _value*9812.5m; - case PowerUnit.BritishThermalUnitPerHour: return _value*0.293071m; - case PowerUnit.Decawatt: return (_value) * 1e1m; - case PowerUnit.Deciwatt: return (_value) * 1e-1m; - case PowerUnit.ElectricalHorsepower: return _value*746m; - case PowerUnit.Femtowatt: return (_value) * 1e-15m; - case PowerUnit.Gigawatt: return (_value) * 1e9m; - case PowerUnit.HydraulicHorsepower: return _value*745.69988145m; - case PowerUnit.KilobritishThermalUnitPerHour: return (_value*0.293071m) * 1e3m; - case PowerUnit.Kilowatt: return (_value) * 1e3m; - case PowerUnit.MechanicalHorsepower: return _value*745.69m; - case PowerUnit.Megawatt: return (_value) * 1e6m; - case PowerUnit.MetricHorsepower: return _value*735.49875m; - case PowerUnit.Microwatt: return (_value) * 1e-6m; - case PowerUnit.Milliwatt: return (_value) * 1e-3m; - case PowerUnit.Nanowatt: return (_value) * 1e-9m; - case PowerUnit.Petawatt: return (_value) * 1e15m; - case PowerUnit.Picowatt: return (_value) * 1e-12m; - case PowerUnit.Terawatt: return (_value) * 1e12m; - case PowerUnit.Watt: return _value; + case PowerUnit.BoilerHorsepower: return Value*9812.5m; + case PowerUnit.BritishThermalUnitPerHour: return Value*0.293071m; + case PowerUnit.Decawatt: return (Value) * 1e1m; + case PowerUnit.Deciwatt: return (Value) * 1e-1m; + case PowerUnit.ElectricalHorsepower: return Value*746m; + case PowerUnit.Femtowatt: return (Value) * 1e-15m; + case PowerUnit.Gigawatt: return (Value) * 1e9m; + case PowerUnit.HydraulicHorsepower: return Value*745.69988145m; + case PowerUnit.KilobritishThermalUnitPerHour: return (Value*0.293071m) * 1e3m; + case PowerUnit.Kilowatt: return (Value) * 1e3m; + case PowerUnit.MechanicalHorsepower: return Value*745.69m; + case PowerUnit.Megawatt: return (Value) * 1e6m; + case PowerUnit.MetricHorsepower: return Value*735.49875m; + case PowerUnit.Microwatt: return (Value) * 1e-6m; + case PowerUnit.Milliwatt: return (Value) * 1e-3m; + case PowerUnit.Nanowatt: return (Value) * 1e-9m; + case PowerUnit.Petawatt: return (Value) * 1e15m; + case PowerUnit.Picowatt: return (Value) * 1e-12m; + case PowerUnit.Terawatt: return (Value) * 1e12m; + case PowerUnit.Watt: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -958,10 +947,10 @@ internal Power ToBaseUnit() return new Power(baseUnitValue, BaseUnit); } - private decimal GetValueAs(PowerUnit unit) + private T GetValueAs(PowerUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1088,7 +1077,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1103,37 +1092,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1157,17 +1146,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs index 55a9ec7b79..33f9792144 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// The amount of power in a volume. /// - public partial struct PowerDensity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct PowerDensity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -104,12 +99,12 @@ static PowerDensity() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public PowerDensity(double value, PowerDensityUnit unit) + public PowerDensity(T value, PowerDensityUnit unit) { if(unit == PowerDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -121,14 +116,14 @@ public PowerDensity(double value, PowerDensityUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public PowerDensity(double value, UnitSystem unitSystem) + public PowerDensity(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -170,7 +165,7 @@ public PowerDensity(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit WattPerCubicMeter. /// - public static PowerDensity Zero { get; } = new PowerDensity(0, BaseUnit); + public static PowerDensity Zero { get; } = new PowerDensity((T)0, BaseUnit); #endregion @@ -179,7 +174,9 @@ public PowerDensity(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -209,222 +206,222 @@ public PowerDensity(double value, UnitSystem unitSystem) /// /// Get in DecawattsPerCubicFoot. /// - public double DecawattsPerCubicFoot => As(PowerDensityUnit.DecawattPerCubicFoot); + public T DecawattsPerCubicFoot => As(PowerDensityUnit.DecawattPerCubicFoot); /// /// Get in DecawattsPerCubicInch. /// - public double DecawattsPerCubicInch => As(PowerDensityUnit.DecawattPerCubicInch); + public T DecawattsPerCubicInch => As(PowerDensityUnit.DecawattPerCubicInch); /// /// Get in DecawattsPerCubicMeter. /// - public double DecawattsPerCubicMeter => As(PowerDensityUnit.DecawattPerCubicMeter); + public T DecawattsPerCubicMeter => As(PowerDensityUnit.DecawattPerCubicMeter); /// /// Get in DecawattsPerLiter. /// - public double DecawattsPerLiter => As(PowerDensityUnit.DecawattPerLiter); + public T DecawattsPerLiter => As(PowerDensityUnit.DecawattPerLiter); /// /// Get in DeciwattsPerCubicFoot. /// - public double DeciwattsPerCubicFoot => As(PowerDensityUnit.DeciwattPerCubicFoot); + public T DeciwattsPerCubicFoot => As(PowerDensityUnit.DeciwattPerCubicFoot); /// /// Get in DeciwattsPerCubicInch. /// - public double DeciwattsPerCubicInch => As(PowerDensityUnit.DeciwattPerCubicInch); + public T DeciwattsPerCubicInch => As(PowerDensityUnit.DeciwattPerCubicInch); /// /// Get in DeciwattsPerCubicMeter. /// - public double DeciwattsPerCubicMeter => As(PowerDensityUnit.DeciwattPerCubicMeter); + public T DeciwattsPerCubicMeter => As(PowerDensityUnit.DeciwattPerCubicMeter); /// /// Get in DeciwattsPerLiter. /// - public double DeciwattsPerLiter => As(PowerDensityUnit.DeciwattPerLiter); + public T DeciwattsPerLiter => As(PowerDensityUnit.DeciwattPerLiter); /// /// Get in GigawattsPerCubicFoot. /// - public double GigawattsPerCubicFoot => As(PowerDensityUnit.GigawattPerCubicFoot); + public T GigawattsPerCubicFoot => As(PowerDensityUnit.GigawattPerCubicFoot); /// /// Get in GigawattsPerCubicInch. /// - public double GigawattsPerCubicInch => As(PowerDensityUnit.GigawattPerCubicInch); + public T GigawattsPerCubicInch => As(PowerDensityUnit.GigawattPerCubicInch); /// /// Get in GigawattsPerCubicMeter. /// - public double GigawattsPerCubicMeter => As(PowerDensityUnit.GigawattPerCubicMeter); + public T GigawattsPerCubicMeter => As(PowerDensityUnit.GigawattPerCubicMeter); /// /// Get in GigawattsPerLiter. /// - public double GigawattsPerLiter => As(PowerDensityUnit.GigawattPerLiter); + public T GigawattsPerLiter => As(PowerDensityUnit.GigawattPerLiter); /// /// Get in KilowattsPerCubicFoot. /// - public double KilowattsPerCubicFoot => As(PowerDensityUnit.KilowattPerCubicFoot); + public T KilowattsPerCubicFoot => As(PowerDensityUnit.KilowattPerCubicFoot); /// /// Get in KilowattsPerCubicInch. /// - public double KilowattsPerCubicInch => As(PowerDensityUnit.KilowattPerCubicInch); + public T KilowattsPerCubicInch => As(PowerDensityUnit.KilowattPerCubicInch); /// /// Get in KilowattsPerCubicMeter. /// - public double KilowattsPerCubicMeter => As(PowerDensityUnit.KilowattPerCubicMeter); + public T KilowattsPerCubicMeter => As(PowerDensityUnit.KilowattPerCubicMeter); /// /// Get in KilowattsPerLiter. /// - public double KilowattsPerLiter => As(PowerDensityUnit.KilowattPerLiter); + public T KilowattsPerLiter => As(PowerDensityUnit.KilowattPerLiter); /// /// Get in MegawattsPerCubicFoot. /// - public double MegawattsPerCubicFoot => As(PowerDensityUnit.MegawattPerCubicFoot); + public T MegawattsPerCubicFoot => As(PowerDensityUnit.MegawattPerCubicFoot); /// /// Get in MegawattsPerCubicInch. /// - public double MegawattsPerCubicInch => As(PowerDensityUnit.MegawattPerCubicInch); + public T MegawattsPerCubicInch => As(PowerDensityUnit.MegawattPerCubicInch); /// /// Get in MegawattsPerCubicMeter. /// - public double MegawattsPerCubicMeter => As(PowerDensityUnit.MegawattPerCubicMeter); + public T MegawattsPerCubicMeter => As(PowerDensityUnit.MegawattPerCubicMeter); /// /// Get in MegawattsPerLiter. /// - public double MegawattsPerLiter => As(PowerDensityUnit.MegawattPerLiter); + public T MegawattsPerLiter => As(PowerDensityUnit.MegawattPerLiter); /// /// Get in MicrowattsPerCubicFoot. /// - public double MicrowattsPerCubicFoot => As(PowerDensityUnit.MicrowattPerCubicFoot); + public T MicrowattsPerCubicFoot => As(PowerDensityUnit.MicrowattPerCubicFoot); /// /// Get in MicrowattsPerCubicInch. /// - public double MicrowattsPerCubicInch => As(PowerDensityUnit.MicrowattPerCubicInch); + public T MicrowattsPerCubicInch => As(PowerDensityUnit.MicrowattPerCubicInch); /// /// Get in MicrowattsPerCubicMeter. /// - public double MicrowattsPerCubicMeter => As(PowerDensityUnit.MicrowattPerCubicMeter); + public T MicrowattsPerCubicMeter => As(PowerDensityUnit.MicrowattPerCubicMeter); /// /// Get in MicrowattsPerLiter. /// - public double MicrowattsPerLiter => As(PowerDensityUnit.MicrowattPerLiter); + public T MicrowattsPerLiter => As(PowerDensityUnit.MicrowattPerLiter); /// /// Get in MilliwattsPerCubicFoot. /// - public double MilliwattsPerCubicFoot => As(PowerDensityUnit.MilliwattPerCubicFoot); + public T MilliwattsPerCubicFoot => As(PowerDensityUnit.MilliwattPerCubicFoot); /// /// Get in MilliwattsPerCubicInch. /// - public double MilliwattsPerCubicInch => As(PowerDensityUnit.MilliwattPerCubicInch); + public T MilliwattsPerCubicInch => As(PowerDensityUnit.MilliwattPerCubicInch); /// /// Get in MilliwattsPerCubicMeter. /// - public double MilliwattsPerCubicMeter => As(PowerDensityUnit.MilliwattPerCubicMeter); + public T MilliwattsPerCubicMeter => As(PowerDensityUnit.MilliwattPerCubicMeter); /// /// Get in MilliwattsPerLiter. /// - public double MilliwattsPerLiter => As(PowerDensityUnit.MilliwattPerLiter); + public T MilliwattsPerLiter => As(PowerDensityUnit.MilliwattPerLiter); /// /// Get in NanowattsPerCubicFoot. /// - public double NanowattsPerCubicFoot => As(PowerDensityUnit.NanowattPerCubicFoot); + public T NanowattsPerCubicFoot => As(PowerDensityUnit.NanowattPerCubicFoot); /// /// Get in NanowattsPerCubicInch. /// - public double NanowattsPerCubicInch => As(PowerDensityUnit.NanowattPerCubicInch); + public T NanowattsPerCubicInch => As(PowerDensityUnit.NanowattPerCubicInch); /// /// Get in NanowattsPerCubicMeter. /// - public double NanowattsPerCubicMeter => As(PowerDensityUnit.NanowattPerCubicMeter); + public T NanowattsPerCubicMeter => As(PowerDensityUnit.NanowattPerCubicMeter); /// /// Get in NanowattsPerLiter. /// - public double NanowattsPerLiter => As(PowerDensityUnit.NanowattPerLiter); + public T NanowattsPerLiter => As(PowerDensityUnit.NanowattPerLiter); /// /// Get in PicowattsPerCubicFoot. /// - public double PicowattsPerCubicFoot => As(PowerDensityUnit.PicowattPerCubicFoot); + public T PicowattsPerCubicFoot => As(PowerDensityUnit.PicowattPerCubicFoot); /// /// Get in PicowattsPerCubicInch. /// - public double PicowattsPerCubicInch => As(PowerDensityUnit.PicowattPerCubicInch); + public T PicowattsPerCubicInch => As(PowerDensityUnit.PicowattPerCubicInch); /// /// Get in PicowattsPerCubicMeter. /// - public double PicowattsPerCubicMeter => As(PowerDensityUnit.PicowattPerCubicMeter); + public T PicowattsPerCubicMeter => As(PowerDensityUnit.PicowattPerCubicMeter); /// /// Get in PicowattsPerLiter. /// - public double PicowattsPerLiter => As(PowerDensityUnit.PicowattPerLiter); + public T PicowattsPerLiter => As(PowerDensityUnit.PicowattPerLiter); /// /// Get in TerawattsPerCubicFoot. /// - public double TerawattsPerCubicFoot => As(PowerDensityUnit.TerawattPerCubicFoot); + public T TerawattsPerCubicFoot => As(PowerDensityUnit.TerawattPerCubicFoot); /// /// Get in TerawattsPerCubicInch. /// - public double TerawattsPerCubicInch => As(PowerDensityUnit.TerawattPerCubicInch); + public T TerawattsPerCubicInch => As(PowerDensityUnit.TerawattPerCubicInch); /// /// Get in TerawattsPerCubicMeter. /// - public double TerawattsPerCubicMeter => As(PowerDensityUnit.TerawattPerCubicMeter); + public T TerawattsPerCubicMeter => As(PowerDensityUnit.TerawattPerCubicMeter); /// /// Get in TerawattsPerLiter. /// - public double TerawattsPerLiter => As(PowerDensityUnit.TerawattPerLiter); + public T TerawattsPerLiter => As(PowerDensityUnit.TerawattPerLiter); /// /// Get in WattsPerCubicFoot. /// - public double WattsPerCubicFoot => As(PowerDensityUnit.WattPerCubicFoot); + public T WattsPerCubicFoot => As(PowerDensityUnit.WattPerCubicFoot); /// /// Get in WattsPerCubicInch. /// - public double WattsPerCubicInch => As(PowerDensityUnit.WattPerCubicInch); + public T WattsPerCubicInch => As(PowerDensityUnit.WattPerCubicInch); /// /// Get in WattsPerCubicMeter. /// - public double WattsPerCubicMeter => As(PowerDensityUnit.WattPerCubicMeter); + public T WattsPerCubicMeter => As(PowerDensityUnit.WattPerCubicMeter); /// /// Get in WattsPerLiter. /// - public double WattsPerLiter => As(PowerDensityUnit.WattPerLiter); + public T WattsPerLiter => As(PowerDensityUnit.WattPerLiter); #endregion @@ -459,397 +456,353 @@ public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] IFormatP /// Get from DecawattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromDecawattsPerCubicFoot(QuantityValue decawattspercubicfoot) + public static PowerDensity FromDecawattsPerCubicFoot(T decawattspercubicfoot) { - double value = (double) decawattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicFoot); + return new PowerDensity(decawattspercubicfoot, PowerDensityUnit.DecawattPerCubicFoot); } /// /// Get from DecawattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromDecawattsPerCubicInch(QuantityValue decawattspercubicinch) + public static PowerDensity FromDecawattsPerCubicInch(T decawattspercubicinch) { - double value = (double) decawattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicInch); + return new PowerDensity(decawattspercubicinch, PowerDensityUnit.DecawattPerCubicInch); } /// /// Get from DecawattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromDecawattsPerCubicMeter(QuantityValue decawattspercubicmeter) + public static PowerDensity FromDecawattsPerCubicMeter(T decawattspercubicmeter) { - double value = (double) decawattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicMeter); + return new PowerDensity(decawattspercubicmeter, PowerDensityUnit.DecawattPerCubicMeter); } /// /// Get from DecawattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromDecawattsPerLiter(QuantityValue decawattsperliter) + public static PowerDensity FromDecawattsPerLiter(T decawattsperliter) { - double value = (double) decawattsperliter; - return new PowerDensity(value, PowerDensityUnit.DecawattPerLiter); + return new PowerDensity(decawattsperliter, PowerDensityUnit.DecawattPerLiter); } /// /// Get from DeciwattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromDeciwattsPerCubicFoot(QuantityValue deciwattspercubicfoot) + public static PowerDensity FromDeciwattsPerCubicFoot(T deciwattspercubicfoot) { - double value = (double) deciwattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicFoot); + return new PowerDensity(deciwattspercubicfoot, PowerDensityUnit.DeciwattPerCubicFoot); } /// /// Get from DeciwattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromDeciwattsPerCubicInch(QuantityValue deciwattspercubicinch) + public static PowerDensity FromDeciwattsPerCubicInch(T deciwattspercubicinch) { - double value = (double) deciwattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicInch); + return new PowerDensity(deciwattspercubicinch, PowerDensityUnit.DeciwattPerCubicInch); } /// /// Get from DeciwattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromDeciwattsPerCubicMeter(QuantityValue deciwattspercubicmeter) + public static PowerDensity FromDeciwattsPerCubicMeter(T deciwattspercubicmeter) { - double value = (double) deciwattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicMeter); + return new PowerDensity(deciwattspercubicmeter, PowerDensityUnit.DeciwattPerCubicMeter); } /// /// Get from DeciwattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromDeciwattsPerLiter(QuantityValue deciwattsperliter) + public static PowerDensity FromDeciwattsPerLiter(T deciwattsperliter) { - double value = (double) deciwattsperliter; - return new PowerDensity(value, PowerDensityUnit.DeciwattPerLiter); + return new PowerDensity(deciwattsperliter, PowerDensityUnit.DeciwattPerLiter); } /// /// Get from GigawattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromGigawattsPerCubicFoot(QuantityValue gigawattspercubicfoot) + public static PowerDensity FromGigawattsPerCubicFoot(T gigawattspercubicfoot) { - double value = (double) gigawattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicFoot); + return new PowerDensity(gigawattspercubicfoot, PowerDensityUnit.GigawattPerCubicFoot); } /// /// Get from GigawattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromGigawattsPerCubicInch(QuantityValue gigawattspercubicinch) + public static PowerDensity FromGigawattsPerCubicInch(T gigawattspercubicinch) { - double value = (double) gigawattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicInch); + return new PowerDensity(gigawattspercubicinch, PowerDensityUnit.GigawattPerCubicInch); } /// /// Get from GigawattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromGigawattsPerCubicMeter(QuantityValue gigawattspercubicmeter) + public static PowerDensity FromGigawattsPerCubicMeter(T gigawattspercubicmeter) { - double value = (double) gigawattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicMeter); + return new PowerDensity(gigawattspercubicmeter, PowerDensityUnit.GigawattPerCubicMeter); } /// /// Get from GigawattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromGigawattsPerLiter(QuantityValue gigawattsperliter) + public static PowerDensity FromGigawattsPerLiter(T gigawattsperliter) { - double value = (double) gigawattsperliter; - return new PowerDensity(value, PowerDensityUnit.GigawattPerLiter); + return new PowerDensity(gigawattsperliter, PowerDensityUnit.GigawattPerLiter); } /// /// Get from KilowattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromKilowattsPerCubicFoot(QuantityValue kilowattspercubicfoot) + public static PowerDensity FromKilowattsPerCubicFoot(T kilowattspercubicfoot) { - double value = (double) kilowattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicFoot); + return new PowerDensity(kilowattspercubicfoot, PowerDensityUnit.KilowattPerCubicFoot); } /// /// Get from KilowattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromKilowattsPerCubicInch(QuantityValue kilowattspercubicinch) + public static PowerDensity FromKilowattsPerCubicInch(T kilowattspercubicinch) { - double value = (double) kilowattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicInch); + return new PowerDensity(kilowattspercubicinch, PowerDensityUnit.KilowattPerCubicInch); } /// /// Get from KilowattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromKilowattsPerCubicMeter(QuantityValue kilowattspercubicmeter) + public static PowerDensity FromKilowattsPerCubicMeter(T kilowattspercubicmeter) { - double value = (double) kilowattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicMeter); + return new PowerDensity(kilowattspercubicmeter, PowerDensityUnit.KilowattPerCubicMeter); } /// /// Get from KilowattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromKilowattsPerLiter(QuantityValue kilowattsperliter) + public static PowerDensity FromKilowattsPerLiter(T kilowattsperliter) { - double value = (double) kilowattsperliter; - return new PowerDensity(value, PowerDensityUnit.KilowattPerLiter); + return new PowerDensity(kilowattsperliter, PowerDensityUnit.KilowattPerLiter); } /// /// Get from MegawattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromMegawattsPerCubicFoot(QuantityValue megawattspercubicfoot) + public static PowerDensity FromMegawattsPerCubicFoot(T megawattspercubicfoot) { - double value = (double) megawattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicFoot); + return new PowerDensity(megawattspercubicfoot, PowerDensityUnit.MegawattPerCubicFoot); } /// /// Get from MegawattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromMegawattsPerCubicInch(QuantityValue megawattspercubicinch) + public static PowerDensity FromMegawattsPerCubicInch(T megawattspercubicinch) { - double value = (double) megawattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicInch); + return new PowerDensity(megawattspercubicinch, PowerDensityUnit.MegawattPerCubicInch); } /// /// Get from MegawattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromMegawattsPerCubicMeter(QuantityValue megawattspercubicmeter) + public static PowerDensity FromMegawattsPerCubicMeter(T megawattspercubicmeter) { - double value = (double) megawattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicMeter); + return new PowerDensity(megawattspercubicmeter, PowerDensityUnit.MegawattPerCubicMeter); } /// /// Get from MegawattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromMegawattsPerLiter(QuantityValue megawattsperliter) + public static PowerDensity FromMegawattsPerLiter(T megawattsperliter) { - double value = (double) megawattsperliter; - return new PowerDensity(value, PowerDensityUnit.MegawattPerLiter); + return new PowerDensity(megawattsperliter, PowerDensityUnit.MegawattPerLiter); } /// /// Get from MicrowattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromMicrowattsPerCubicFoot(QuantityValue microwattspercubicfoot) + public static PowerDensity FromMicrowattsPerCubicFoot(T microwattspercubicfoot) { - double value = (double) microwattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicFoot); + return new PowerDensity(microwattspercubicfoot, PowerDensityUnit.MicrowattPerCubicFoot); } /// /// Get from MicrowattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromMicrowattsPerCubicInch(QuantityValue microwattspercubicinch) + public static PowerDensity FromMicrowattsPerCubicInch(T microwattspercubicinch) { - double value = (double) microwattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicInch); + return new PowerDensity(microwattspercubicinch, PowerDensityUnit.MicrowattPerCubicInch); } /// /// Get from MicrowattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromMicrowattsPerCubicMeter(QuantityValue microwattspercubicmeter) + public static PowerDensity FromMicrowattsPerCubicMeter(T microwattspercubicmeter) { - double value = (double) microwattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicMeter); + return new PowerDensity(microwattspercubicmeter, PowerDensityUnit.MicrowattPerCubicMeter); } /// /// Get from MicrowattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromMicrowattsPerLiter(QuantityValue microwattsperliter) + public static PowerDensity FromMicrowattsPerLiter(T microwattsperliter) { - double value = (double) microwattsperliter; - return new PowerDensity(value, PowerDensityUnit.MicrowattPerLiter); + return new PowerDensity(microwattsperliter, PowerDensityUnit.MicrowattPerLiter); } /// /// Get from MilliwattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromMilliwattsPerCubicFoot(QuantityValue milliwattspercubicfoot) + public static PowerDensity FromMilliwattsPerCubicFoot(T milliwattspercubicfoot) { - double value = (double) milliwattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicFoot); + return new PowerDensity(milliwattspercubicfoot, PowerDensityUnit.MilliwattPerCubicFoot); } /// /// Get from MilliwattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromMilliwattsPerCubicInch(QuantityValue milliwattspercubicinch) + public static PowerDensity FromMilliwattsPerCubicInch(T milliwattspercubicinch) { - double value = (double) milliwattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicInch); + return new PowerDensity(milliwattspercubicinch, PowerDensityUnit.MilliwattPerCubicInch); } /// /// Get from MilliwattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromMilliwattsPerCubicMeter(QuantityValue milliwattspercubicmeter) + public static PowerDensity FromMilliwattsPerCubicMeter(T milliwattspercubicmeter) { - double value = (double) milliwattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicMeter); + return new PowerDensity(milliwattspercubicmeter, PowerDensityUnit.MilliwattPerCubicMeter); } /// /// Get from MilliwattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromMilliwattsPerLiter(QuantityValue milliwattsperliter) + public static PowerDensity FromMilliwattsPerLiter(T milliwattsperliter) { - double value = (double) milliwattsperliter; - return new PowerDensity(value, PowerDensityUnit.MilliwattPerLiter); + return new PowerDensity(milliwattsperliter, PowerDensityUnit.MilliwattPerLiter); } /// /// Get from NanowattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromNanowattsPerCubicFoot(QuantityValue nanowattspercubicfoot) + public static PowerDensity FromNanowattsPerCubicFoot(T nanowattspercubicfoot) { - double value = (double) nanowattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicFoot); + return new PowerDensity(nanowattspercubicfoot, PowerDensityUnit.NanowattPerCubicFoot); } /// /// Get from NanowattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromNanowattsPerCubicInch(QuantityValue nanowattspercubicinch) + public static PowerDensity FromNanowattsPerCubicInch(T nanowattspercubicinch) { - double value = (double) nanowattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicInch); + return new PowerDensity(nanowattspercubicinch, PowerDensityUnit.NanowattPerCubicInch); } /// /// Get from NanowattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromNanowattsPerCubicMeter(QuantityValue nanowattspercubicmeter) + public static PowerDensity FromNanowattsPerCubicMeter(T nanowattspercubicmeter) { - double value = (double) nanowattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicMeter); + return new PowerDensity(nanowattspercubicmeter, PowerDensityUnit.NanowattPerCubicMeter); } /// /// Get from NanowattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromNanowattsPerLiter(QuantityValue nanowattsperliter) + public static PowerDensity FromNanowattsPerLiter(T nanowattsperliter) { - double value = (double) nanowattsperliter; - return new PowerDensity(value, PowerDensityUnit.NanowattPerLiter); + return new PowerDensity(nanowattsperliter, PowerDensityUnit.NanowattPerLiter); } /// /// Get from PicowattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromPicowattsPerCubicFoot(QuantityValue picowattspercubicfoot) + public static PowerDensity FromPicowattsPerCubicFoot(T picowattspercubicfoot) { - double value = (double) picowattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicFoot); + return new PowerDensity(picowattspercubicfoot, PowerDensityUnit.PicowattPerCubicFoot); } /// /// Get from PicowattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromPicowattsPerCubicInch(QuantityValue picowattspercubicinch) + public static PowerDensity FromPicowattsPerCubicInch(T picowattspercubicinch) { - double value = (double) picowattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicInch); + return new PowerDensity(picowattspercubicinch, PowerDensityUnit.PicowattPerCubicInch); } /// /// Get from PicowattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromPicowattsPerCubicMeter(QuantityValue picowattspercubicmeter) + public static PowerDensity FromPicowattsPerCubicMeter(T picowattspercubicmeter) { - double value = (double) picowattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicMeter); + return new PowerDensity(picowattspercubicmeter, PowerDensityUnit.PicowattPerCubicMeter); } /// /// Get from PicowattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromPicowattsPerLiter(QuantityValue picowattsperliter) + public static PowerDensity FromPicowattsPerLiter(T picowattsperliter) { - double value = (double) picowattsperliter; - return new PowerDensity(value, PowerDensityUnit.PicowattPerLiter); + return new PowerDensity(picowattsperliter, PowerDensityUnit.PicowattPerLiter); } /// /// Get from TerawattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromTerawattsPerCubicFoot(QuantityValue terawattspercubicfoot) + public static PowerDensity FromTerawattsPerCubicFoot(T terawattspercubicfoot) { - double value = (double) terawattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicFoot); + return new PowerDensity(terawattspercubicfoot, PowerDensityUnit.TerawattPerCubicFoot); } /// /// Get from TerawattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromTerawattsPerCubicInch(QuantityValue terawattspercubicinch) + public static PowerDensity FromTerawattsPerCubicInch(T terawattspercubicinch) { - double value = (double) terawattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicInch); + return new PowerDensity(terawattspercubicinch, PowerDensityUnit.TerawattPerCubicInch); } /// /// Get from TerawattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromTerawattsPerCubicMeter(QuantityValue terawattspercubicmeter) + public static PowerDensity FromTerawattsPerCubicMeter(T terawattspercubicmeter) { - double value = (double) terawattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicMeter); + return new PowerDensity(terawattspercubicmeter, PowerDensityUnit.TerawattPerCubicMeter); } /// /// Get from TerawattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromTerawattsPerLiter(QuantityValue terawattsperliter) + public static PowerDensity FromTerawattsPerLiter(T terawattsperliter) { - double value = (double) terawattsperliter; - return new PowerDensity(value, PowerDensityUnit.TerawattPerLiter); + return new PowerDensity(terawattsperliter, PowerDensityUnit.TerawattPerLiter); } /// /// Get from WattsPerCubicFoot. /// /// If value is NaN or Infinity. - public static PowerDensity FromWattsPerCubicFoot(QuantityValue wattspercubicfoot) + public static PowerDensity FromWattsPerCubicFoot(T wattspercubicfoot) { - double value = (double) wattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.WattPerCubicFoot); + return new PowerDensity(wattspercubicfoot, PowerDensityUnit.WattPerCubicFoot); } /// /// Get from WattsPerCubicInch. /// /// If value is NaN or Infinity. - public static PowerDensity FromWattsPerCubicInch(QuantityValue wattspercubicinch) + public static PowerDensity FromWattsPerCubicInch(T wattspercubicinch) { - double value = (double) wattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.WattPerCubicInch); + return new PowerDensity(wattspercubicinch, PowerDensityUnit.WattPerCubicInch); } /// /// Get from WattsPerCubicMeter. /// /// If value is NaN or Infinity. - public static PowerDensity FromWattsPerCubicMeter(QuantityValue wattspercubicmeter) + public static PowerDensity FromWattsPerCubicMeter(T wattspercubicmeter) { - double value = (double) wattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.WattPerCubicMeter); + return new PowerDensity(wattspercubicmeter, PowerDensityUnit.WattPerCubicMeter); } /// /// Get from WattsPerLiter. /// /// If value is NaN or Infinity. - public static PowerDensity FromWattsPerLiter(QuantityValue wattsperliter) + public static PowerDensity FromWattsPerLiter(T wattsperliter) { - double value = (double) wattsperliter; - return new PowerDensity(value, PowerDensityUnit.WattPerLiter); + return new PowerDensity(wattsperliter, PowerDensityUnit.WattPerLiter); } /// @@ -858,9 +811,9 @@ public static PowerDensity FromWattsPerLiter(QuantityValue wattsperliter) /// Value to convert from. /// Unit to convert from. /// unit value. - public static PowerDensity From(QuantityValue value, PowerDensityUnit fromUnit) + public static PowerDensity From(T value, PowerDensityUnit fromUnit) { - return new PowerDensity((double)value, fromUnit); + return new PowerDensity(value, fromUnit); } #endregion @@ -1014,43 +967,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerD /// Negate the value. public static PowerDensity operator -(PowerDensity right) { - return new PowerDensity(-right.Value, right.Unit); + return new PowerDensity(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static PowerDensity operator +(PowerDensity left, PowerDensity right) { - return new PowerDensity(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new PowerDensity(value, left.Unit); } /// Get from subtracting two . public static PowerDensity operator -(PowerDensity left, PowerDensity right) { - return new PowerDensity(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new PowerDensity(value, left.Unit); } /// Get from multiplying value and . - public static PowerDensity operator *(double left, PowerDensity right) + public static PowerDensity operator *(T left, PowerDensity right) { - return new PowerDensity(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new PowerDensity(value, right.Unit); } /// Get from multiplying value and . - public static PowerDensity operator *(PowerDensity left, double right) + public static PowerDensity operator *(PowerDensity left, T right) { - return new PowerDensity(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new PowerDensity(value, left.Unit); } /// Get from dividing by value. - public static PowerDensity operator /(PowerDensity left, double right) + public static PowerDensity operator /(PowerDensity left, T right) { - return new PowerDensity(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new PowerDensity(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(PowerDensity left, PowerDensity right) + public static T operator /(PowerDensity left, PowerDensity right) { - return left.WattsPerCubicMeter / right.WattsPerCubicMeter; + return CompiledLambdas.Divide(left.WattsPerCubicMeter, right.WattsPerCubicMeter); } #endregion @@ -1060,25 +1018,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerD /// Returns true if less or equal to. public static bool operator <=(PowerDensity left, PowerDensity right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(PowerDensity left, PowerDensity right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(PowerDensity left, PowerDensity right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(PowerDensity left, PowerDensity right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -1107,7 +1065,7 @@ public int CompareTo(object obj) /// public int CompareTo(PowerDensity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -1124,7 +1082,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(PowerDensity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1172,10 +1130,8 @@ public bool Equals(PowerDensity other, double tolerance, ComparisonType compa if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -1195,17 +1151,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(PowerDensityUnit unit) + public T As(PowerDensityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1225,9 +1181,14 @@ double IQuantity.As(Enum unit) if(!(unit is PowerDensityUnit unitAsPowerDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PowerDensityUnit)} is supported.", nameof(unit)); - return As(unitAsPowerDensityUnit); + var asValue = As(unitAsPowerDensityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(PowerDensityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -1268,62 +1229,68 @@ public PowerDensity ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(PowerDensityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(PowerDensityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case PowerDensityUnit.DecawattPerCubicFoot: return (_value*3.531466672148859e1) * 1e1d; - case PowerDensityUnit.DecawattPerCubicInch: return (_value*6.102374409473228e4) * 1e1d; - case PowerDensityUnit.DecawattPerCubicMeter: return (_value) * 1e1d; - case PowerDensityUnit.DecawattPerLiter: return (_value*1.0e3) * 1e1d; - case PowerDensityUnit.DeciwattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-1d; - case PowerDensityUnit.DeciwattPerCubicInch: return (_value*6.102374409473228e4) * 1e-1d; - case PowerDensityUnit.DeciwattPerCubicMeter: return (_value) * 1e-1d; - case PowerDensityUnit.DeciwattPerLiter: return (_value*1.0e3) * 1e-1d; - case PowerDensityUnit.GigawattPerCubicFoot: return (_value*3.531466672148859e1) * 1e9d; - case PowerDensityUnit.GigawattPerCubicInch: return (_value*6.102374409473228e4) * 1e9d; - case PowerDensityUnit.GigawattPerCubicMeter: return (_value) * 1e9d; - case PowerDensityUnit.GigawattPerLiter: return (_value*1.0e3) * 1e9d; - case PowerDensityUnit.KilowattPerCubicFoot: return (_value*3.531466672148859e1) * 1e3d; - case PowerDensityUnit.KilowattPerCubicInch: return (_value*6.102374409473228e4) * 1e3d; - case PowerDensityUnit.KilowattPerCubicMeter: return (_value) * 1e3d; - case PowerDensityUnit.KilowattPerLiter: return (_value*1.0e3) * 1e3d; - case PowerDensityUnit.MegawattPerCubicFoot: return (_value*3.531466672148859e1) * 1e6d; - case PowerDensityUnit.MegawattPerCubicInch: return (_value*6.102374409473228e4) * 1e6d; - case PowerDensityUnit.MegawattPerCubicMeter: return (_value) * 1e6d; - case PowerDensityUnit.MegawattPerLiter: return (_value*1.0e3) * 1e6d; - case PowerDensityUnit.MicrowattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-6d; - case PowerDensityUnit.MicrowattPerCubicInch: return (_value*6.102374409473228e4) * 1e-6d; - case PowerDensityUnit.MicrowattPerCubicMeter: return (_value) * 1e-6d; - case PowerDensityUnit.MicrowattPerLiter: return (_value*1.0e3) * 1e-6d; - case PowerDensityUnit.MilliwattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-3d; - case PowerDensityUnit.MilliwattPerCubicInch: return (_value*6.102374409473228e4) * 1e-3d; - case PowerDensityUnit.MilliwattPerCubicMeter: return (_value) * 1e-3d; - case PowerDensityUnit.MilliwattPerLiter: return (_value*1.0e3) * 1e-3d; - case PowerDensityUnit.NanowattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-9d; - case PowerDensityUnit.NanowattPerCubicInch: return (_value*6.102374409473228e4) * 1e-9d; - case PowerDensityUnit.NanowattPerCubicMeter: return (_value) * 1e-9d; - case PowerDensityUnit.NanowattPerLiter: return (_value*1.0e3) * 1e-9d; - case PowerDensityUnit.PicowattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-12d; - case PowerDensityUnit.PicowattPerCubicInch: return (_value*6.102374409473228e4) * 1e-12d; - case PowerDensityUnit.PicowattPerCubicMeter: return (_value) * 1e-12d; - case PowerDensityUnit.PicowattPerLiter: return (_value*1.0e3) * 1e-12d; - case PowerDensityUnit.TerawattPerCubicFoot: return (_value*3.531466672148859e1) * 1e12d; - case PowerDensityUnit.TerawattPerCubicInch: return (_value*6.102374409473228e4) * 1e12d; - case PowerDensityUnit.TerawattPerCubicMeter: return (_value) * 1e12d; - case PowerDensityUnit.TerawattPerLiter: return (_value*1.0e3) * 1e12d; - case PowerDensityUnit.WattPerCubicFoot: return _value*3.531466672148859e1; - case PowerDensityUnit.WattPerCubicInch: return _value*6.102374409473228e4; - case PowerDensityUnit.WattPerCubicMeter: return _value; - case PowerDensityUnit.WattPerLiter: return _value*1.0e3; + case PowerDensityUnit.DecawattPerCubicFoot: return (Value*3.531466672148859e1) * 1e1d; + case PowerDensityUnit.DecawattPerCubicInch: return (Value*6.102374409473228e4) * 1e1d; + case PowerDensityUnit.DecawattPerCubicMeter: return (Value) * 1e1d; + case PowerDensityUnit.DecawattPerLiter: return (Value*1.0e3) * 1e1d; + case PowerDensityUnit.DeciwattPerCubicFoot: return (Value*3.531466672148859e1) * 1e-1d; + case PowerDensityUnit.DeciwattPerCubicInch: return (Value*6.102374409473228e4) * 1e-1d; + case PowerDensityUnit.DeciwattPerCubicMeter: return (Value) * 1e-1d; + case PowerDensityUnit.DeciwattPerLiter: return (Value*1.0e3) * 1e-1d; + case PowerDensityUnit.GigawattPerCubicFoot: return (Value*3.531466672148859e1) * 1e9d; + case PowerDensityUnit.GigawattPerCubicInch: return (Value*6.102374409473228e4) * 1e9d; + case PowerDensityUnit.GigawattPerCubicMeter: return (Value) * 1e9d; + case PowerDensityUnit.GigawattPerLiter: return (Value*1.0e3) * 1e9d; + case PowerDensityUnit.KilowattPerCubicFoot: return (Value*3.531466672148859e1) * 1e3d; + case PowerDensityUnit.KilowattPerCubicInch: return (Value*6.102374409473228e4) * 1e3d; + case PowerDensityUnit.KilowattPerCubicMeter: return (Value) * 1e3d; + case PowerDensityUnit.KilowattPerLiter: return (Value*1.0e3) * 1e3d; + case PowerDensityUnit.MegawattPerCubicFoot: return (Value*3.531466672148859e1) * 1e6d; + case PowerDensityUnit.MegawattPerCubicInch: return (Value*6.102374409473228e4) * 1e6d; + case PowerDensityUnit.MegawattPerCubicMeter: return (Value) * 1e6d; + case PowerDensityUnit.MegawattPerLiter: return (Value*1.0e3) * 1e6d; + case PowerDensityUnit.MicrowattPerCubicFoot: return (Value*3.531466672148859e1) * 1e-6d; + case PowerDensityUnit.MicrowattPerCubicInch: return (Value*6.102374409473228e4) * 1e-6d; + case PowerDensityUnit.MicrowattPerCubicMeter: return (Value) * 1e-6d; + case PowerDensityUnit.MicrowattPerLiter: return (Value*1.0e3) * 1e-6d; + case PowerDensityUnit.MilliwattPerCubicFoot: return (Value*3.531466672148859e1) * 1e-3d; + case PowerDensityUnit.MilliwattPerCubicInch: return (Value*6.102374409473228e4) * 1e-3d; + case PowerDensityUnit.MilliwattPerCubicMeter: return (Value) * 1e-3d; + case PowerDensityUnit.MilliwattPerLiter: return (Value*1.0e3) * 1e-3d; + case PowerDensityUnit.NanowattPerCubicFoot: return (Value*3.531466672148859e1) * 1e-9d; + case PowerDensityUnit.NanowattPerCubicInch: return (Value*6.102374409473228e4) * 1e-9d; + case PowerDensityUnit.NanowattPerCubicMeter: return (Value) * 1e-9d; + case PowerDensityUnit.NanowattPerLiter: return (Value*1.0e3) * 1e-9d; + case PowerDensityUnit.PicowattPerCubicFoot: return (Value*3.531466672148859e1) * 1e-12d; + case PowerDensityUnit.PicowattPerCubicInch: return (Value*6.102374409473228e4) * 1e-12d; + case PowerDensityUnit.PicowattPerCubicMeter: return (Value) * 1e-12d; + case PowerDensityUnit.PicowattPerLiter: return (Value*1.0e3) * 1e-12d; + case PowerDensityUnit.TerawattPerCubicFoot: return (Value*3.531466672148859e1) * 1e12d; + case PowerDensityUnit.TerawattPerCubicInch: return (Value*6.102374409473228e4) * 1e12d; + case PowerDensityUnit.TerawattPerCubicMeter: return (Value) * 1e12d; + case PowerDensityUnit.TerawattPerLiter: return (Value*1.0e3) * 1e12d; + case PowerDensityUnit.WattPerCubicFoot: return Value*3.531466672148859e1; + case PowerDensityUnit.WattPerCubicInch: return Value*6.102374409473228e4; + case PowerDensityUnit.WattPerCubicMeter: return Value; + case PowerDensityUnit.WattPerLiter: return Value*1.0e3; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -1340,10 +1307,10 @@ internal PowerDensity ToBaseUnit() return new PowerDensity(baseUnitValue, BaseUnit); } - private double GetValueAs(PowerDensityUnit unit) + private T GetValueAs(PowerDensityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1494,7 +1461,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1509,37 +1476,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1563,17 +1530,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs index ee0454c0b1..ff15275651 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// The strength of a signal expressed in decibels (dB) relative to one watt. /// - public partial struct PowerRatio : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct PowerRatio : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -62,12 +57,12 @@ static PowerRatio() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public PowerRatio(double value, PowerRatioUnit unit) + public PowerRatio(T value, PowerRatioUnit unit) { if(unit == PowerRatioUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -79,14 +74,14 @@ public PowerRatio(double value, PowerRatioUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public PowerRatio(double value, UnitSystem unitSystem) + public PowerRatio(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -128,7 +123,7 @@ public PowerRatio(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit DecibelWatt. /// - public static PowerRatio Zero { get; } = new PowerRatio(0, BaseUnit); + public static PowerRatio Zero { get; } = new PowerRatio((T)0, BaseUnit); #endregion @@ -137,7 +132,9 @@ public PowerRatio(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -167,12 +164,12 @@ public PowerRatio(double value, UnitSystem unitSystem) /// /// Get in DecibelMilliwatts. /// - public double DecibelMilliwatts => As(PowerRatioUnit.DecibelMilliwatt); + public T DecibelMilliwatts => As(PowerRatioUnit.DecibelMilliwatt); /// /// Get in DecibelWatts. /// - public double DecibelWatts => As(PowerRatioUnit.DecibelWatt); + public T DecibelWatts => As(PowerRatioUnit.DecibelWatt); #endregion @@ -207,19 +204,17 @@ public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] IFormatPro /// Get from DecibelMilliwatts. /// /// If value is NaN or Infinity. - public static PowerRatio FromDecibelMilliwatts(QuantityValue decibelmilliwatts) + public static PowerRatio FromDecibelMilliwatts(T decibelmilliwatts) { - double value = (double) decibelmilliwatts; - return new PowerRatio(value, PowerRatioUnit.DecibelMilliwatt); + return new PowerRatio(decibelmilliwatts, PowerRatioUnit.DecibelMilliwatt); } /// /// Get from DecibelWatts. /// /// If value is NaN or Infinity. - public static PowerRatio FromDecibelWatts(QuantityValue decibelwatts) + public static PowerRatio FromDecibelWatts(T decibelwatts) { - double value = (double) decibelwatts; - return new PowerRatio(value, PowerRatioUnit.DecibelWatt); + return new PowerRatio(decibelwatts, PowerRatioUnit.DecibelWatt); } /// @@ -228,9 +223,9 @@ public static PowerRatio FromDecibelWatts(QuantityValue decibelwatts) /// Value to convert from. /// Unit to convert from. /// unit value. - public static PowerRatio From(QuantityValue value, PowerRatioUnit fromUnit) + public static PowerRatio From(T value, PowerRatioUnit fromUnit) { - return new PowerRatio((double)value, fromUnit); + return new PowerRatio(value, fromUnit); } #endregion @@ -438,25 +433,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerR /// Returns true if less or equal to. public static bool operator <=(PowerRatio left, PowerRatio right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(PowerRatio left, PowerRatio right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(PowerRatio left, PowerRatio right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(PowerRatio left, PowerRatio right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -485,7 +480,7 @@ public int CompareTo(object obj) /// public int CompareTo(PowerRatio other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -502,7 +497,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(PowerRatio other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -550,10 +545,8 @@ public bool Equals(PowerRatio other, double tolerance, ComparisonType compari if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -573,17 +566,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(PowerRatioUnit unit) + public T As(PowerRatioUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -603,9 +596,14 @@ double IQuantity.As(Enum unit) if(!(unit is PowerRatioUnit unitAsPowerRatioUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PowerRatioUnit)} is supported.", nameof(unit)); - return As(unitAsPowerRatioUnit); + var asValue = As(unitAsPowerRatioUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(PowerRatioUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -646,20 +644,26 @@ public PowerRatio ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(PowerRatioUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(PowerRatioUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case PowerRatioUnit.DecibelMilliwatt: return _value - 30; - case PowerRatioUnit.DecibelWatt: return _value; + case PowerRatioUnit.DecibelMilliwatt: return Value - 30; + case PowerRatioUnit.DecibelWatt: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -676,10 +680,10 @@ internal PowerRatio ToBaseUnit() return new PowerRatio(baseUnitValue, BaseUnit); } - private double GetValueAs(PowerRatioUnit unit) + private T GetValueAs(PowerRatioUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -788,7 +792,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -803,37 +807,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -857,17 +861,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs index 2c52d05c6d..6d3e8e66fe 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Pressure (symbol: P or p) is the ratio of force to the area over which that force is distributed. Pressure is force per unit area applied in a direction perpendicular to the surface of an object. Gauge pressure (also spelled gage pressure)[a] is the pressure relative to the local atmospheric or ambient pressure. Pressure is measured in any unit of force divided by any unit of area. The SI unit of pressure is the newton per square metre, which is called the pascal (Pa) after the seventeenth-century philosopher and scientist Blaise Pascal. A pressure of 1 Pa is small; it approximately equals the pressure exerted by a dollar bill resting flat on a table. Everyday pressures are often stated in kilopascals (1 kPa = 1000 Pa). /// - public partial struct Pressure : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Pressure : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -102,12 +97,12 @@ static Pressure() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Pressure(double value, PressureUnit unit) + public Pressure(T value, PressureUnit unit) { if(unit == PressureUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -119,14 +114,14 @@ public Pressure(double value, PressureUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Pressure(double value, UnitSystem unitSystem) + public Pressure(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -168,7 +163,7 @@ public Pressure(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Pascal. /// - public static Pressure Zero { get; } = new Pressure(0, BaseUnit); + public static Pressure Zero { get; } = new Pressure((T)0, BaseUnit); #endregion @@ -177,7 +172,9 @@ public Pressure(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -207,212 +204,212 @@ public Pressure(double value, UnitSystem unitSystem) /// /// Get in Atmospheres. /// - public double Atmospheres => As(PressureUnit.Atmosphere); + public T Atmospheres => As(PressureUnit.Atmosphere); /// /// Get in Bars. /// - public double Bars => As(PressureUnit.Bar); + public T Bars => As(PressureUnit.Bar); /// /// Get in Centibars. /// - public double Centibars => As(PressureUnit.Centibar); + public T Centibars => As(PressureUnit.Centibar); /// /// Get in Decapascals. /// - public double Decapascals => As(PressureUnit.Decapascal); + public T Decapascals => As(PressureUnit.Decapascal); /// /// Get in Decibars. /// - public double Decibars => As(PressureUnit.Decibar); + public T Decibars => As(PressureUnit.Decibar); /// /// Get in DynesPerSquareCentimeter. /// - public double DynesPerSquareCentimeter => As(PressureUnit.DynePerSquareCentimeter); + public T DynesPerSquareCentimeter => As(PressureUnit.DynePerSquareCentimeter); /// /// Get in FeetOfHead. /// - public double FeetOfHead => As(PressureUnit.FootOfHead); + public T FeetOfHead => As(PressureUnit.FootOfHead); /// /// Get in Gigapascals. /// - public double Gigapascals => As(PressureUnit.Gigapascal); + public T Gigapascals => As(PressureUnit.Gigapascal); /// /// Get in Hectopascals. /// - public double Hectopascals => As(PressureUnit.Hectopascal); + public T Hectopascals => As(PressureUnit.Hectopascal); /// /// Get in InchesOfMercury. /// - public double InchesOfMercury => As(PressureUnit.InchOfMercury); + public T InchesOfMercury => As(PressureUnit.InchOfMercury); /// /// Get in InchesOfWaterColumn. /// - public double InchesOfWaterColumn => As(PressureUnit.InchOfWaterColumn); + public T InchesOfWaterColumn => As(PressureUnit.InchOfWaterColumn); /// /// Get in Kilobars. /// - public double Kilobars => As(PressureUnit.Kilobar); + public T Kilobars => As(PressureUnit.Kilobar); /// /// Get in KilogramsForcePerSquareCentimeter. /// - public double KilogramsForcePerSquareCentimeter => As(PressureUnit.KilogramForcePerSquareCentimeter); + public T KilogramsForcePerSquareCentimeter => As(PressureUnit.KilogramForcePerSquareCentimeter); /// /// Get in KilogramsForcePerSquareMeter. /// - public double KilogramsForcePerSquareMeter => As(PressureUnit.KilogramForcePerSquareMeter); + public T KilogramsForcePerSquareMeter => As(PressureUnit.KilogramForcePerSquareMeter); /// /// Get in KilogramsForcePerSquareMillimeter. /// - public double KilogramsForcePerSquareMillimeter => As(PressureUnit.KilogramForcePerSquareMillimeter); + public T KilogramsForcePerSquareMillimeter => As(PressureUnit.KilogramForcePerSquareMillimeter); /// /// Get in KilonewtonsPerSquareCentimeter. /// - public double KilonewtonsPerSquareCentimeter => As(PressureUnit.KilonewtonPerSquareCentimeter); + public T KilonewtonsPerSquareCentimeter => As(PressureUnit.KilonewtonPerSquareCentimeter); /// /// Get in KilonewtonsPerSquareMeter. /// - public double KilonewtonsPerSquareMeter => As(PressureUnit.KilonewtonPerSquareMeter); + public T KilonewtonsPerSquareMeter => As(PressureUnit.KilonewtonPerSquareMeter); /// /// Get in KilonewtonsPerSquareMillimeter. /// - public double KilonewtonsPerSquareMillimeter => As(PressureUnit.KilonewtonPerSquareMillimeter); + public T KilonewtonsPerSquareMillimeter => As(PressureUnit.KilonewtonPerSquareMillimeter); /// /// Get in Kilopascals. /// - public double Kilopascals => As(PressureUnit.Kilopascal); + public T Kilopascals => As(PressureUnit.Kilopascal); /// /// Get in KilopoundsForcePerSquareFoot. /// - public double KilopoundsForcePerSquareFoot => As(PressureUnit.KilopoundForcePerSquareFoot); + public T KilopoundsForcePerSquareFoot => As(PressureUnit.KilopoundForcePerSquareFoot); /// /// Get in KilopoundsForcePerSquareInch. /// - public double KilopoundsForcePerSquareInch => As(PressureUnit.KilopoundForcePerSquareInch); + public T KilopoundsForcePerSquareInch => As(PressureUnit.KilopoundForcePerSquareInch); /// /// Get in Megabars. /// - public double Megabars => As(PressureUnit.Megabar); + public T Megabars => As(PressureUnit.Megabar); /// /// Get in MeganewtonsPerSquareMeter. /// - public double MeganewtonsPerSquareMeter => As(PressureUnit.MeganewtonPerSquareMeter); + public T MeganewtonsPerSquareMeter => As(PressureUnit.MeganewtonPerSquareMeter); /// /// Get in Megapascals. /// - public double Megapascals => As(PressureUnit.Megapascal); + public T Megapascals => As(PressureUnit.Megapascal); /// /// Get in MetersOfHead. /// - public double MetersOfHead => As(PressureUnit.MeterOfHead); + public T MetersOfHead => As(PressureUnit.MeterOfHead); /// /// Get in Microbars. /// - public double Microbars => As(PressureUnit.Microbar); + public T Microbars => As(PressureUnit.Microbar); /// /// Get in Micropascals. /// - public double Micropascals => As(PressureUnit.Micropascal); + public T Micropascals => As(PressureUnit.Micropascal); /// /// Get in Millibars. /// - public double Millibars => As(PressureUnit.Millibar); + public T Millibars => As(PressureUnit.Millibar); /// /// Get in MillimetersOfMercury. /// - public double MillimetersOfMercury => As(PressureUnit.MillimeterOfMercury); + public T MillimetersOfMercury => As(PressureUnit.MillimeterOfMercury); /// /// Get in Millipascals. /// - public double Millipascals => As(PressureUnit.Millipascal); + public T Millipascals => As(PressureUnit.Millipascal); /// /// Get in NewtonsPerSquareCentimeter. /// - public double NewtonsPerSquareCentimeter => As(PressureUnit.NewtonPerSquareCentimeter); + public T NewtonsPerSquareCentimeter => As(PressureUnit.NewtonPerSquareCentimeter); /// /// Get in NewtonsPerSquareMeter. /// - public double NewtonsPerSquareMeter => As(PressureUnit.NewtonPerSquareMeter); + public T NewtonsPerSquareMeter => As(PressureUnit.NewtonPerSquareMeter); /// /// Get in NewtonsPerSquareMillimeter. /// - public double NewtonsPerSquareMillimeter => As(PressureUnit.NewtonPerSquareMillimeter); + public T NewtonsPerSquareMillimeter => As(PressureUnit.NewtonPerSquareMillimeter); /// /// Get in Pascals. /// - public double Pascals => As(PressureUnit.Pascal); + public T Pascals => As(PressureUnit.Pascal); /// /// Get in PoundsForcePerSquareFoot. /// - public double PoundsForcePerSquareFoot => As(PressureUnit.PoundForcePerSquareFoot); + public T PoundsForcePerSquareFoot => As(PressureUnit.PoundForcePerSquareFoot); /// /// Get in PoundsForcePerSquareInch. /// - public double PoundsForcePerSquareInch => As(PressureUnit.PoundForcePerSquareInch); + public T PoundsForcePerSquareInch => As(PressureUnit.PoundForcePerSquareInch); /// /// Get in PoundsPerInchSecondSquared. /// - public double PoundsPerInchSecondSquared => As(PressureUnit.PoundPerInchSecondSquared); + public T PoundsPerInchSecondSquared => As(PressureUnit.PoundPerInchSecondSquared); /// /// Get in TechnicalAtmospheres. /// - public double TechnicalAtmospheres => As(PressureUnit.TechnicalAtmosphere); + public T TechnicalAtmospheres => As(PressureUnit.TechnicalAtmosphere); /// /// Get in TonnesForcePerSquareCentimeter. /// - public double TonnesForcePerSquareCentimeter => As(PressureUnit.TonneForcePerSquareCentimeter); + public T TonnesForcePerSquareCentimeter => As(PressureUnit.TonneForcePerSquareCentimeter); /// /// Get in TonnesForcePerSquareMeter. /// - public double TonnesForcePerSquareMeter => As(PressureUnit.TonneForcePerSquareMeter); + public T TonnesForcePerSquareMeter => As(PressureUnit.TonneForcePerSquareMeter); /// /// Get in TonnesForcePerSquareMillimeter. /// - public double TonnesForcePerSquareMillimeter => As(PressureUnit.TonneForcePerSquareMillimeter); + public T TonnesForcePerSquareMillimeter => As(PressureUnit.TonneForcePerSquareMillimeter); /// /// Get in Torrs. /// - public double Torrs => As(PressureUnit.Torr); + public T Torrs => As(PressureUnit.Torr); #endregion @@ -447,379 +444,337 @@ public static string GetAbbreviation(PressureUnit unit, [CanBeNull] IFormatProvi /// Get from Atmospheres. /// /// If value is NaN or Infinity. - public static Pressure FromAtmospheres(QuantityValue atmospheres) + public static Pressure FromAtmospheres(T atmospheres) { - double value = (double) atmospheres; - return new Pressure(value, PressureUnit.Atmosphere); + return new Pressure(atmospheres, PressureUnit.Atmosphere); } /// /// Get from Bars. /// /// If value is NaN or Infinity. - public static Pressure FromBars(QuantityValue bars) + public static Pressure FromBars(T bars) { - double value = (double) bars; - return new Pressure(value, PressureUnit.Bar); + return new Pressure(bars, PressureUnit.Bar); } /// /// Get from Centibars. /// /// If value is NaN or Infinity. - public static Pressure FromCentibars(QuantityValue centibars) + public static Pressure FromCentibars(T centibars) { - double value = (double) centibars; - return new Pressure(value, PressureUnit.Centibar); + return new Pressure(centibars, PressureUnit.Centibar); } /// /// Get from Decapascals. /// /// If value is NaN or Infinity. - public static Pressure FromDecapascals(QuantityValue decapascals) + public static Pressure FromDecapascals(T decapascals) { - double value = (double) decapascals; - return new Pressure(value, PressureUnit.Decapascal); + return new Pressure(decapascals, PressureUnit.Decapascal); } /// /// Get from Decibars. /// /// If value is NaN or Infinity. - public static Pressure FromDecibars(QuantityValue decibars) + public static Pressure FromDecibars(T decibars) { - double value = (double) decibars; - return new Pressure(value, PressureUnit.Decibar); + return new Pressure(decibars, PressureUnit.Decibar); } /// /// Get from DynesPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Pressure FromDynesPerSquareCentimeter(QuantityValue dynespersquarecentimeter) + public static Pressure FromDynesPerSquareCentimeter(T dynespersquarecentimeter) { - double value = (double) dynespersquarecentimeter; - return new Pressure(value, PressureUnit.DynePerSquareCentimeter); + return new Pressure(dynespersquarecentimeter, PressureUnit.DynePerSquareCentimeter); } /// /// Get from FeetOfHead. /// /// If value is NaN or Infinity. - public static Pressure FromFeetOfHead(QuantityValue feetofhead) + public static Pressure FromFeetOfHead(T feetofhead) { - double value = (double) feetofhead; - return new Pressure(value, PressureUnit.FootOfHead); + return new Pressure(feetofhead, PressureUnit.FootOfHead); } /// /// Get from Gigapascals. /// /// If value is NaN or Infinity. - public static Pressure FromGigapascals(QuantityValue gigapascals) + public static Pressure FromGigapascals(T gigapascals) { - double value = (double) gigapascals; - return new Pressure(value, PressureUnit.Gigapascal); + return new Pressure(gigapascals, PressureUnit.Gigapascal); } /// /// Get from Hectopascals. /// /// If value is NaN or Infinity. - public static Pressure FromHectopascals(QuantityValue hectopascals) + public static Pressure FromHectopascals(T hectopascals) { - double value = (double) hectopascals; - return new Pressure(value, PressureUnit.Hectopascal); + return new Pressure(hectopascals, PressureUnit.Hectopascal); } /// /// Get from InchesOfMercury. /// /// If value is NaN or Infinity. - public static Pressure FromInchesOfMercury(QuantityValue inchesofmercury) + public static Pressure FromInchesOfMercury(T inchesofmercury) { - double value = (double) inchesofmercury; - return new Pressure(value, PressureUnit.InchOfMercury); + return new Pressure(inchesofmercury, PressureUnit.InchOfMercury); } /// /// Get from InchesOfWaterColumn. /// /// If value is NaN or Infinity. - public static Pressure FromInchesOfWaterColumn(QuantityValue inchesofwatercolumn) + public static Pressure FromInchesOfWaterColumn(T inchesofwatercolumn) { - double value = (double) inchesofwatercolumn; - return new Pressure(value, PressureUnit.InchOfWaterColumn); + return new Pressure(inchesofwatercolumn, PressureUnit.InchOfWaterColumn); } /// /// Get from Kilobars. /// /// If value is NaN or Infinity. - public static Pressure FromKilobars(QuantityValue kilobars) + public static Pressure FromKilobars(T kilobars) { - double value = (double) kilobars; - return new Pressure(value, PressureUnit.Kilobar); + return new Pressure(kilobars, PressureUnit.Kilobar); } /// /// Get from KilogramsForcePerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Pressure FromKilogramsForcePerSquareCentimeter(QuantityValue kilogramsforcepersquarecentimeter) + public static Pressure FromKilogramsForcePerSquareCentimeter(T kilogramsforcepersquarecentimeter) { - double value = (double) kilogramsforcepersquarecentimeter; - return new Pressure(value, PressureUnit.KilogramForcePerSquareCentimeter); + return new Pressure(kilogramsforcepersquarecentimeter, PressureUnit.KilogramForcePerSquareCentimeter); } /// /// Get from KilogramsForcePerSquareMeter. /// /// If value is NaN or Infinity. - public static Pressure FromKilogramsForcePerSquareMeter(QuantityValue kilogramsforcepersquaremeter) + public static Pressure FromKilogramsForcePerSquareMeter(T kilogramsforcepersquaremeter) { - double value = (double) kilogramsforcepersquaremeter; - return new Pressure(value, PressureUnit.KilogramForcePerSquareMeter); + return new Pressure(kilogramsforcepersquaremeter, PressureUnit.KilogramForcePerSquareMeter); } /// /// Get from KilogramsForcePerSquareMillimeter. /// /// If value is NaN or Infinity. - public static Pressure FromKilogramsForcePerSquareMillimeter(QuantityValue kilogramsforcepersquaremillimeter) + public static Pressure FromKilogramsForcePerSquareMillimeter(T kilogramsforcepersquaremillimeter) { - double value = (double) kilogramsforcepersquaremillimeter; - return new Pressure(value, PressureUnit.KilogramForcePerSquareMillimeter); + return new Pressure(kilogramsforcepersquaremillimeter, PressureUnit.KilogramForcePerSquareMillimeter); } /// /// Get from KilonewtonsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Pressure FromKilonewtonsPerSquareCentimeter(QuantityValue kilonewtonspersquarecentimeter) + public static Pressure FromKilonewtonsPerSquareCentimeter(T kilonewtonspersquarecentimeter) { - double value = (double) kilonewtonspersquarecentimeter; - return new Pressure(value, PressureUnit.KilonewtonPerSquareCentimeter); + return new Pressure(kilonewtonspersquarecentimeter, PressureUnit.KilonewtonPerSquareCentimeter); } /// /// Get from KilonewtonsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Pressure FromKilonewtonsPerSquareMeter(QuantityValue kilonewtonspersquaremeter) + public static Pressure FromKilonewtonsPerSquareMeter(T kilonewtonspersquaremeter) { - double value = (double) kilonewtonspersquaremeter; - return new Pressure(value, PressureUnit.KilonewtonPerSquareMeter); + return new Pressure(kilonewtonspersquaremeter, PressureUnit.KilonewtonPerSquareMeter); } /// /// Get from KilonewtonsPerSquareMillimeter. /// /// If value is NaN or Infinity. - public static Pressure FromKilonewtonsPerSquareMillimeter(QuantityValue kilonewtonspersquaremillimeter) + public static Pressure FromKilonewtonsPerSquareMillimeter(T kilonewtonspersquaremillimeter) { - double value = (double) kilonewtonspersquaremillimeter; - return new Pressure(value, PressureUnit.KilonewtonPerSquareMillimeter); + return new Pressure(kilonewtonspersquaremillimeter, PressureUnit.KilonewtonPerSquareMillimeter); } /// /// Get from Kilopascals. /// /// If value is NaN or Infinity. - public static Pressure FromKilopascals(QuantityValue kilopascals) + public static Pressure FromKilopascals(T kilopascals) { - double value = (double) kilopascals; - return new Pressure(value, PressureUnit.Kilopascal); + return new Pressure(kilopascals, PressureUnit.Kilopascal); } /// /// Get from KilopoundsForcePerSquareFoot. /// /// If value is NaN or Infinity. - public static Pressure FromKilopoundsForcePerSquareFoot(QuantityValue kilopoundsforcepersquarefoot) + public static Pressure FromKilopoundsForcePerSquareFoot(T kilopoundsforcepersquarefoot) { - double value = (double) kilopoundsforcepersquarefoot; - return new Pressure(value, PressureUnit.KilopoundForcePerSquareFoot); + return new Pressure(kilopoundsforcepersquarefoot, PressureUnit.KilopoundForcePerSquareFoot); } /// /// Get from KilopoundsForcePerSquareInch. /// /// If value is NaN or Infinity. - public static Pressure FromKilopoundsForcePerSquareInch(QuantityValue kilopoundsforcepersquareinch) + public static Pressure FromKilopoundsForcePerSquareInch(T kilopoundsforcepersquareinch) { - double value = (double) kilopoundsforcepersquareinch; - return new Pressure(value, PressureUnit.KilopoundForcePerSquareInch); + return new Pressure(kilopoundsforcepersquareinch, PressureUnit.KilopoundForcePerSquareInch); } /// /// Get from Megabars. /// /// If value is NaN or Infinity. - public static Pressure FromMegabars(QuantityValue megabars) + public static Pressure FromMegabars(T megabars) { - double value = (double) megabars; - return new Pressure(value, PressureUnit.Megabar); + return new Pressure(megabars, PressureUnit.Megabar); } /// /// Get from MeganewtonsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Pressure FromMeganewtonsPerSquareMeter(QuantityValue meganewtonspersquaremeter) + public static Pressure FromMeganewtonsPerSquareMeter(T meganewtonspersquaremeter) { - double value = (double) meganewtonspersquaremeter; - return new Pressure(value, PressureUnit.MeganewtonPerSquareMeter); + return new Pressure(meganewtonspersquaremeter, PressureUnit.MeganewtonPerSquareMeter); } /// /// Get from Megapascals. /// /// If value is NaN or Infinity. - public static Pressure FromMegapascals(QuantityValue megapascals) + public static Pressure FromMegapascals(T megapascals) { - double value = (double) megapascals; - return new Pressure(value, PressureUnit.Megapascal); + return new Pressure(megapascals, PressureUnit.Megapascal); } /// /// Get from MetersOfHead. /// /// If value is NaN or Infinity. - public static Pressure FromMetersOfHead(QuantityValue metersofhead) + public static Pressure FromMetersOfHead(T metersofhead) { - double value = (double) metersofhead; - return new Pressure(value, PressureUnit.MeterOfHead); + return new Pressure(metersofhead, PressureUnit.MeterOfHead); } /// /// Get from Microbars. /// /// If value is NaN or Infinity. - public static Pressure FromMicrobars(QuantityValue microbars) + public static Pressure FromMicrobars(T microbars) { - double value = (double) microbars; - return new Pressure(value, PressureUnit.Microbar); + return new Pressure(microbars, PressureUnit.Microbar); } /// /// Get from Micropascals. /// /// If value is NaN or Infinity. - public static Pressure FromMicropascals(QuantityValue micropascals) + public static Pressure FromMicropascals(T micropascals) { - double value = (double) micropascals; - return new Pressure(value, PressureUnit.Micropascal); + return new Pressure(micropascals, PressureUnit.Micropascal); } /// /// Get from Millibars. /// /// If value is NaN or Infinity. - public static Pressure FromMillibars(QuantityValue millibars) + public static Pressure FromMillibars(T millibars) { - double value = (double) millibars; - return new Pressure(value, PressureUnit.Millibar); + return new Pressure(millibars, PressureUnit.Millibar); } /// /// Get from MillimetersOfMercury. /// /// If value is NaN or Infinity. - public static Pressure FromMillimetersOfMercury(QuantityValue millimetersofmercury) + public static Pressure FromMillimetersOfMercury(T millimetersofmercury) { - double value = (double) millimetersofmercury; - return new Pressure(value, PressureUnit.MillimeterOfMercury); + return new Pressure(millimetersofmercury, PressureUnit.MillimeterOfMercury); } /// /// Get from Millipascals. /// /// If value is NaN or Infinity. - public static Pressure FromMillipascals(QuantityValue millipascals) + public static Pressure FromMillipascals(T millipascals) { - double value = (double) millipascals; - return new Pressure(value, PressureUnit.Millipascal); + return new Pressure(millipascals, PressureUnit.Millipascal); } /// /// Get from NewtonsPerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Pressure FromNewtonsPerSquareCentimeter(QuantityValue newtonspersquarecentimeter) + public static Pressure FromNewtonsPerSquareCentimeter(T newtonspersquarecentimeter) { - double value = (double) newtonspersquarecentimeter; - return new Pressure(value, PressureUnit.NewtonPerSquareCentimeter); + return new Pressure(newtonspersquarecentimeter, PressureUnit.NewtonPerSquareCentimeter); } /// /// Get from NewtonsPerSquareMeter. /// /// If value is NaN or Infinity. - public static Pressure FromNewtonsPerSquareMeter(QuantityValue newtonspersquaremeter) + public static Pressure FromNewtonsPerSquareMeter(T newtonspersquaremeter) { - double value = (double) newtonspersquaremeter; - return new Pressure(value, PressureUnit.NewtonPerSquareMeter); + return new Pressure(newtonspersquaremeter, PressureUnit.NewtonPerSquareMeter); } /// /// Get from NewtonsPerSquareMillimeter. /// /// If value is NaN or Infinity. - public static Pressure FromNewtonsPerSquareMillimeter(QuantityValue newtonspersquaremillimeter) + public static Pressure FromNewtonsPerSquareMillimeter(T newtonspersquaremillimeter) { - double value = (double) newtonspersquaremillimeter; - return new Pressure(value, PressureUnit.NewtonPerSquareMillimeter); + return new Pressure(newtonspersquaremillimeter, PressureUnit.NewtonPerSquareMillimeter); } /// /// Get from Pascals. /// /// If value is NaN or Infinity. - public static Pressure FromPascals(QuantityValue pascals) + public static Pressure FromPascals(T pascals) { - double value = (double) pascals; - return new Pressure(value, PressureUnit.Pascal); + return new Pressure(pascals, PressureUnit.Pascal); } /// /// Get from PoundsForcePerSquareFoot. /// /// If value is NaN or Infinity. - public static Pressure FromPoundsForcePerSquareFoot(QuantityValue poundsforcepersquarefoot) + public static Pressure FromPoundsForcePerSquareFoot(T poundsforcepersquarefoot) { - double value = (double) poundsforcepersquarefoot; - return new Pressure(value, PressureUnit.PoundForcePerSquareFoot); + return new Pressure(poundsforcepersquarefoot, PressureUnit.PoundForcePerSquareFoot); } /// /// Get from PoundsForcePerSquareInch. /// /// If value is NaN or Infinity. - public static Pressure FromPoundsForcePerSquareInch(QuantityValue poundsforcepersquareinch) + public static Pressure FromPoundsForcePerSquareInch(T poundsforcepersquareinch) { - double value = (double) poundsforcepersquareinch; - return new Pressure(value, PressureUnit.PoundForcePerSquareInch); + return new Pressure(poundsforcepersquareinch, PressureUnit.PoundForcePerSquareInch); } /// /// Get from PoundsPerInchSecondSquared. /// /// If value is NaN or Infinity. - public static Pressure FromPoundsPerInchSecondSquared(QuantityValue poundsperinchsecondsquared) + public static Pressure FromPoundsPerInchSecondSquared(T poundsperinchsecondsquared) { - double value = (double) poundsperinchsecondsquared; - return new Pressure(value, PressureUnit.PoundPerInchSecondSquared); + return new Pressure(poundsperinchsecondsquared, PressureUnit.PoundPerInchSecondSquared); } /// /// Get from TechnicalAtmospheres. /// /// If value is NaN or Infinity. - public static Pressure FromTechnicalAtmospheres(QuantityValue technicalatmospheres) + public static Pressure FromTechnicalAtmospheres(T technicalatmospheres) { - double value = (double) technicalatmospheres; - return new Pressure(value, PressureUnit.TechnicalAtmosphere); + return new Pressure(technicalatmospheres, PressureUnit.TechnicalAtmosphere); } /// /// Get from TonnesForcePerSquareCentimeter. /// /// If value is NaN or Infinity. - public static Pressure FromTonnesForcePerSquareCentimeter(QuantityValue tonnesforcepersquarecentimeter) + public static Pressure FromTonnesForcePerSquareCentimeter(T tonnesforcepersquarecentimeter) { - double value = (double) tonnesforcepersquarecentimeter; - return new Pressure(value, PressureUnit.TonneForcePerSquareCentimeter); + return new Pressure(tonnesforcepersquarecentimeter, PressureUnit.TonneForcePerSquareCentimeter); } /// /// Get from TonnesForcePerSquareMeter. /// /// If value is NaN or Infinity. - public static Pressure FromTonnesForcePerSquareMeter(QuantityValue tonnesforcepersquaremeter) + public static Pressure FromTonnesForcePerSquareMeter(T tonnesforcepersquaremeter) { - double value = (double) tonnesforcepersquaremeter; - return new Pressure(value, PressureUnit.TonneForcePerSquareMeter); + return new Pressure(tonnesforcepersquaremeter, PressureUnit.TonneForcePerSquareMeter); } /// /// Get from TonnesForcePerSquareMillimeter. /// /// If value is NaN or Infinity. - public static Pressure FromTonnesForcePerSquareMillimeter(QuantityValue tonnesforcepersquaremillimeter) + public static Pressure FromTonnesForcePerSquareMillimeter(T tonnesforcepersquaremillimeter) { - double value = (double) tonnesforcepersquaremillimeter; - return new Pressure(value, PressureUnit.TonneForcePerSquareMillimeter); + return new Pressure(tonnesforcepersquaremillimeter, PressureUnit.TonneForcePerSquareMillimeter); } /// /// Get from Torrs. /// /// If value is NaN or Infinity. - public static Pressure FromTorrs(QuantityValue torrs) + public static Pressure FromTorrs(T torrs) { - double value = (double) torrs; - return new Pressure(value, PressureUnit.Torr); + return new Pressure(torrs, PressureUnit.Torr); } /// @@ -828,9 +783,9 @@ public static Pressure FromTorrs(QuantityValue torrs) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Pressure From(QuantityValue value, PressureUnit fromUnit) + public static Pressure From(T value, PressureUnit fromUnit) { - return new Pressure((double)value, fromUnit); + return new Pressure(value, fromUnit); } #endregion @@ -984,43 +939,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Pressu /// Negate the value. public static Pressure operator -(Pressure right) { - return new Pressure(-right.Value, right.Unit); + return new Pressure(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Pressure operator +(Pressure left, Pressure right) { - return new Pressure(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Pressure(value, left.Unit); } /// Get from subtracting two . public static Pressure operator -(Pressure left, Pressure right) { - return new Pressure(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Pressure(value, left.Unit); } /// Get from multiplying value and . - public static Pressure operator *(double left, Pressure right) + public static Pressure operator *(T left, Pressure right) { - return new Pressure(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Pressure(value, right.Unit); } /// Get from multiplying value and . - public static Pressure operator *(Pressure left, double right) + public static Pressure operator *(Pressure left, T right) { - return new Pressure(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Pressure(value, left.Unit); } /// Get from dividing by value. - public static Pressure operator /(Pressure left, double right) + public static Pressure operator /(Pressure left, T right) { - return new Pressure(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Pressure(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Pressure left, Pressure right) + public static T operator /(Pressure left, Pressure right) { - return left.Pascals / right.Pascals; + return CompiledLambdas.Divide(left.Pascals, right.Pascals); } #endregion @@ -1030,25 +990,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Pressu /// Returns true if less or equal to. public static bool operator <=(Pressure left, Pressure right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Pressure left, Pressure right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Pressure left, Pressure right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Pressure left, Pressure right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -1077,7 +1037,7 @@ public int CompareTo(object obj) /// public int CompareTo(Pressure other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -1094,7 +1054,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Pressure other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1142,10 +1102,8 @@ public bool Equals(Pressure other, double tolerance, ComparisonType compariso if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -1165,17 +1123,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(PressureUnit unit) + public T As(PressureUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1195,9 +1153,14 @@ double IQuantity.As(Enum unit) if(!(unit is PressureUnit unitAsPressureUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PressureUnit)} is supported.", nameof(unit)); - return As(unitAsPressureUnit); + var asValue = As(unitAsPressureUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(PressureUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -1238,60 +1201,66 @@ public Pressure ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(PressureUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(PressureUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case PressureUnit.Atmosphere: return _value*1.01325*1e5; - case PressureUnit.Bar: return _value*1e5; - case PressureUnit.Centibar: return (_value*1e5) * 1e-2d; - case PressureUnit.Decapascal: return (_value) * 1e1d; - case PressureUnit.Decibar: return (_value*1e5) * 1e-1d; - case PressureUnit.DynePerSquareCentimeter: return _value*1.0e-1; - case PressureUnit.FootOfHead: return _value*2989.0669; - case PressureUnit.Gigapascal: return (_value) * 1e9d; - case PressureUnit.Hectopascal: return (_value) * 1e2d; - case PressureUnit.InchOfMercury: return _value/2.95299830714159e-4; - case PressureUnit.InchOfWaterColumn: return _value*249.08890833333; - case PressureUnit.Kilobar: return (_value*1e5) * 1e3d; - case PressureUnit.KilogramForcePerSquareCentimeter: return _value*9.80665e4; - case PressureUnit.KilogramForcePerSquareMeter: return _value*9.80665019960652; - case PressureUnit.KilogramForcePerSquareMillimeter: return _value*9.80665e6; - case PressureUnit.KilonewtonPerSquareCentimeter: return (_value*1e4) * 1e3d; - case PressureUnit.KilonewtonPerSquareMeter: return (_value) * 1e3d; - case PressureUnit.KilonewtonPerSquareMillimeter: return (_value*1e6) * 1e3d; - case PressureUnit.Kilopascal: return (_value) * 1e3d; - case PressureUnit.KilopoundForcePerSquareFoot: return (_value*4.788025898033584e1) * 1e3d; - case PressureUnit.KilopoundForcePerSquareInch: return (_value*6.894757293168361e3) * 1e3d; - case PressureUnit.Megabar: return (_value*1e5) * 1e6d; - case PressureUnit.MeganewtonPerSquareMeter: return (_value) * 1e6d; - case PressureUnit.Megapascal: return (_value) * 1e6d; - case PressureUnit.MeterOfHead: return _value*9804.139432; - case PressureUnit.Microbar: return (_value*1e5) * 1e-6d; - case PressureUnit.Micropascal: return (_value) * 1e-6d; - case PressureUnit.Millibar: return (_value*1e5) * 1e-3d; - case PressureUnit.MillimeterOfMercury: return _value/7.50061561302643e-3; - case PressureUnit.Millipascal: return (_value) * 1e-3d; - case PressureUnit.NewtonPerSquareCentimeter: return _value*1e4; - case PressureUnit.NewtonPerSquareMeter: return _value; - case PressureUnit.NewtonPerSquareMillimeter: return _value*1e6; - case PressureUnit.Pascal: return _value; - case PressureUnit.PoundForcePerSquareFoot: return _value*4.788025898033584e1; - case PressureUnit.PoundForcePerSquareInch: return _value*6.894757293168361e3; - case PressureUnit.PoundPerInchSecondSquared: return _value*1.785796732283465e1; - case PressureUnit.TechnicalAtmosphere: return _value*9.80680592331*1e4; - case PressureUnit.TonneForcePerSquareCentimeter: return _value*9.80665e7; - case PressureUnit.TonneForcePerSquareMeter: return _value*9.80665e3; - case PressureUnit.TonneForcePerSquareMillimeter: return _value*9.80665e9; - case PressureUnit.Torr: return _value*1.3332266752*1e2; + case PressureUnit.Atmosphere: return Value*1.01325*1e5; + case PressureUnit.Bar: return Value*1e5; + case PressureUnit.Centibar: return (Value*1e5) * 1e-2d; + case PressureUnit.Decapascal: return (Value) * 1e1d; + case PressureUnit.Decibar: return (Value*1e5) * 1e-1d; + case PressureUnit.DynePerSquareCentimeter: return Value*1.0e-1; + case PressureUnit.FootOfHead: return Value*2989.0669; + case PressureUnit.Gigapascal: return (Value) * 1e9d; + case PressureUnit.Hectopascal: return (Value) * 1e2d; + case PressureUnit.InchOfMercury: return Value/2.95299830714159e-4; + case PressureUnit.InchOfWaterColumn: return Value*249.08890833333; + case PressureUnit.Kilobar: return (Value*1e5) * 1e3d; + case PressureUnit.KilogramForcePerSquareCentimeter: return Value*9.80665e4; + case PressureUnit.KilogramForcePerSquareMeter: return Value*9.80665019960652; + case PressureUnit.KilogramForcePerSquareMillimeter: return Value*9.80665e6; + case PressureUnit.KilonewtonPerSquareCentimeter: return (Value*1e4) * 1e3d; + case PressureUnit.KilonewtonPerSquareMeter: return (Value) * 1e3d; + case PressureUnit.KilonewtonPerSquareMillimeter: return (Value*1e6) * 1e3d; + case PressureUnit.Kilopascal: return (Value) * 1e3d; + case PressureUnit.KilopoundForcePerSquareFoot: return (Value*4.788025898033584e1) * 1e3d; + case PressureUnit.KilopoundForcePerSquareInch: return (Value*6.894757293168361e3) * 1e3d; + case PressureUnit.Megabar: return (Value*1e5) * 1e6d; + case PressureUnit.MeganewtonPerSquareMeter: return (Value) * 1e6d; + case PressureUnit.Megapascal: return (Value) * 1e6d; + case PressureUnit.MeterOfHead: return Value*9804.139432; + case PressureUnit.Microbar: return (Value*1e5) * 1e-6d; + case PressureUnit.Micropascal: return (Value) * 1e-6d; + case PressureUnit.Millibar: return (Value*1e5) * 1e-3d; + case PressureUnit.MillimeterOfMercury: return Value/7.50061561302643e-3; + case PressureUnit.Millipascal: return (Value) * 1e-3d; + case PressureUnit.NewtonPerSquareCentimeter: return Value*1e4; + case PressureUnit.NewtonPerSquareMeter: return Value; + case PressureUnit.NewtonPerSquareMillimeter: return Value*1e6; + case PressureUnit.Pascal: return Value; + case PressureUnit.PoundForcePerSquareFoot: return Value*4.788025898033584e1; + case PressureUnit.PoundForcePerSquareInch: return Value*6.894757293168361e3; + case PressureUnit.PoundPerInchSecondSquared: return Value*1.785796732283465e1; + case PressureUnit.TechnicalAtmosphere: return Value*9.80680592331*1e4; + case PressureUnit.TonneForcePerSquareCentimeter: return Value*9.80665e7; + case PressureUnit.TonneForcePerSquareMeter: return Value*9.80665e3; + case PressureUnit.TonneForcePerSquareMillimeter: return Value*9.80665e9; + case PressureUnit.Torr: return Value*1.3332266752*1e2; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -1308,10 +1277,10 @@ internal Pressure ToBaseUnit() return new Pressure(baseUnitValue, BaseUnit); } - private double GetValueAs(PressureUnit unit) + private T GetValueAs(PressureUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1460,7 +1429,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1475,37 +1444,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1529,17 +1498,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs index a104c13816..4835f9bea7 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Pressure change rate is the ratio of the pressure change to the time during which the change occurred (value of pressure changes per unit time). /// - public partial struct PressureChangeRate : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct PressureChangeRate : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -67,12 +62,12 @@ static PressureChangeRate() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public PressureChangeRate(double value, PressureChangeRateUnit unit) + public PressureChangeRate(T value, PressureChangeRateUnit unit) { if(unit == PressureChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -84,14 +79,14 @@ public PressureChangeRate(double value, PressureChangeRateUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public PressureChangeRate(double value, UnitSystem unitSystem) + public PressureChangeRate(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -133,7 +128,7 @@ public PressureChangeRate(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit PascalPerSecond. /// - public static PressureChangeRate Zero { get; } = new PressureChangeRate(0, BaseUnit); + public static PressureChangeRate Zero { get; } = new PressureChangeRate((T)0, BaseUnit); #endregion @@ -142,7 +137,9 @@ public PressureChangeRate(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -172,37 +169,37 @@ public PressureChangeRate(double value, UnitSystem unitSystem) /// /// Get in AtmospheresPerSecond. /// - public double AtmospheresPerSecond => As(PressureChangeRateUnit.AtmospherePerSecond); + public T AtmospheresPerSecond => As(PressureChangeRateUnit.AtmospherePerSecond); /// /// Get in KilopascalsPerMinute. /// - public double KilopascalsPerMinute => As(PressureChangeRateUnit.KilopascalPerMinute); + public T KilopascalsPerMinute => As(PressureChangeRateUnit.KilopascalPerMinute); /// /// Get in KilopascalsPerSecond. /// - public double KilopascalsPerSecond => As(PressureChangeRateUnit.KilopascalPerSecond); + public T KilopascalsPerSecond => As(PressureChangeRateUnit.KilopascalPerSecond); /// /// Get in MegapascalsPerMinute. /// - public double MegapascalsPerMinute => As(PressureChangeRateUnit.MegapascalPerMinute); + public T MegapascalsPerMinute => As(PressureChangeRateUnit.MegapascalPerMinute); /// /// Get in MegapascalsPerSecond. /// - public double MegapascalsPerSecond => As(PressureChangeRateUnit.MegapascalPerSecond); + public T MegapascalsPerSecond => As(PressureChangeRateUnit.MegapascalPerSecond); /// /// Get in PascalsPerMinute. /// - public double PascalsPerMinute => As(PressureChangeRateUnit.PascalPerMinute); + public T PascalsPerMinute => As(PressureChangeRateUnit.PascalPerMinute); /// /// Get in PascalsPerSecond. /// - public double PascalsPerSecond => As(PressureChangeRateUnit.PascalPerSecond); + public T PascalsPerSecond => As(PressureChangeRateUnit.PascalPerSecond); #endregion @@ -237,64 +234,57 @@ public static string GetAbbreviation(PressureChangeRateUnit unit, [CanBeNull] IF /// Get from AtmospheresPerSecond. /// /// If value is NaN or Infinity. - public static PressureChangeRate FromAtmospheresPerSecond(QuantityValue atmospherespersecond) + public static PressureChangeRate FromAtmospheresPerSecond(T atmospherespersecond) { - double value = (double) atmospherespersecond; - return new PressureChangeRate(value, PressureChangeRateUnit.AtmospherePerSecond); + return new PressureChangeRate(atmospherespersecond, PressureChangeRateUnit.AtmospherePerSecond); } /// /// Get from KilopascalsPerMinute. /// /// If value is NaN or Infinity. - public static PressureChangeRate FromKilopascalsPerMinute(QuantityValue kilopascalsperminute) + public static PressureChangeRate FromKilopascalsPerMinute(T kilopascalsperminute) { - double value = (double) kilopascalsperminute; - return new PressureChangeRate(value, PressureChangeRateUnit.KilopascalPerMinute); + return new PressureChangeRate(kilopascalsperminute, PressureChangeRateUnit.KilopascalPerMinute); } /// /// Get from KilopascalsPerSecond. /// /// If value is NaN or Infinity. - public static PressureChangeRate FromKilopascalsPerSecond(QuantityValue kilopascalspersecond) + public static PressureChangeRate FromKilopascalsPerSecond(T kilopascalspersecond) { - double value = (double) kilopascalspersecond; - return new PressureChangeRate(value, PressureChangeRateUnit.KilopascalPerSecond); + return new PressureChangeRate(kilopascalspersecond, PressureChangeRateUnit.KilopascalPerSecond); } /// /// Get from MegapascalsPerMinute. /// /// If value is NaN or Infinity. - public static PressureChangeRate FromMegapascalsPerMinute(QuantityValue megapascalsperminute) + public static PressureChangeRate FromMegapascalsPerMinute(T megapascalsperminute) { - double value = (double) megapascalsperminute; - return new PressureChangeRate(value, PressureChangeRateUnit.MegapascalPerMinute); + return new PressureChangeRate(megapascalsperminute, PressureChangeRateUnit.MegapascalPerMinute); } /// /// Get from MegapascalsPerSecond. /// /// If value is NaN or Infinity. - public static PressureChangeRate FromMegapascalsPerSecond(QuantityValue megapascalspersecond) + public static PressureChangeRate FromMegapascalsPerSecond(T megapascalspersecond) { - double value = (double) megapascalspersecond; - return new PressureChangeRate(value, PressureChangeRateUnit.MegapascalPerSecond); + return new PressureChangeRate(megapascalspersecond, PressureChangeRateUnit.MegapascalPerSecond); } /// /// Get from PascalsPerMinute. /// /// If value is NaN or Infinity. - public static PressureChangeRate FromPascalsPerMinute(QuantityValue pascalsperminute) + public static PressureChangeRate FromPascalsPerMinute(T pascalsperminute) { - double value = (double) pascalsperminute; - return new PressureChangeRate(value, PressureChangeRateUnit.PascalPerMinute); + return new PressureChangeRate(pascalsperminute, PressureChangeRateUnit.PascalPerMinute); } /// /// Get from PascalsPerSecond. /// /// If value is NaN or Infinity. - public static PressureChangeRate FromPascalsPerSecond(QuantityValue pascalspersecond) + public static PressureChangeRate FromPascalsPerSecond(T pascalspersecond) { - double value = (double) pascalspersecond; - return new PressureChangeRate(value, PressureChangeRateUnit.PascalPerSecond); + return new PressureChangeRate(pascalspersecond, PressureChangeRateUnit.PascalPerSecond); } /// @@ -303,9 +293,9 @@ public static PressureChangeRate FromPascalsPerSecond(QuantityValue pascalspe /// Value to convert from. /// Unit to convert from. /// unit value. - public static PressureChangeRate From(QuantityValue value, PressureChangeRateUnit fromUnit) + public static PressureChangeRate From(T value, PressureChangeRateUnit fromUnit) { - return new PressureChangeRate((double)value, fromUnit); + return new PressureChangeRate(value, fromUnit); } #endregion @@ -459,43 +449,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Pressu /// Negate the value. public static PressureChangeRate operator -(PressureChangeRate right) { - return new PressureChangeRate(-right.Value, right.Unit); + return new PressureChangeRate(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static PressureChangeRate operator +(PressureChangeRate left, PressureChangeRate right) { - return new PressureChangeRate(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new PressureChangeRate(value, left.Unit); } /// Get from subtracting two . public static PressureChangeRate operator -(PressureChangeRate left, PressureChangeRate right) { - return new PressureChangeRate(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new PressureChangeRate(value, left.Unit); } /// Get from multiplying value and . - public static PressureChangeRate operator *(double left, PressureChangeRate right) + public static PressureChangeRate operator *(T left, PressureChangeRate right) { - return new PressureChangeRate(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new PressureChangeRate(value, right.Unit); } /// Get from multiplying value and . - public static PressureChangeRate operator *(PressureChangeRate left, double right) + public static PressureChangeRate operator *(PressureChangeRate left, T right) { - return new PressureChangeRate(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new PressureChangeRate(value, left.Unit); } /// Get from dividing by value. - public static PressureChangeRate operator /(PressureChangeRate left, double right) + public static PressureChangeRate operator /(PressureChangeRate left, T right) { - return new PressureChangeRate(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new PressureChangeRate(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(PressureChangeRate left, PressureChangeRate right) + public static T operator /(PressureChangeRate left, PressureChangeRate right) { - return left.PascalsPerSecond / right.PascalsPerSecond; + return CompiledLambdas.Divide(left.PascalsPerSecond, right.PascalsPerSecond); } #endregion @@ -505,25 +500,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Pressu /// Returns true if less or equal to. public static bool operator <=(PressureChangeRate left, PressureChangeRate right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(PressureChangeRate left, PressureChangeRate right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(PressureChangeRate left, PressureChangeRate right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(PressureChangeRate left, PressureChangeRate right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -552,7 +547,7 @@ public int CompareTo(object obj) /// public int CompareTo(PressureChangeRate other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -569,7 +564,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(PressureChangeRate other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -617,10 +612,8 @@ public bool Equals(PressureChangeRate other, double tolerance, ComparisonType if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -640,17 +633,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(PressureChangeRateUnit unit) + public T As(PressureChangeRateUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -670,9 +663,14 @@ double IQuantity.As(Enum unit) if(!(unit is PressureChangeRateUnit unitAsPressureChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PressureChangeRateUnit)} is supported.", nameof(unit)); - return As(unitAsPressureChangeRateUnit); + var asValue = As(unitAsPressureChangeRateUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(PressureChangeRateUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -713,25 +711,31 @@ public PressureChangeRate ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(PressureChangeRateUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(PressureChangeRateUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case PressureChangeRateUnit.AtmospherePerSecond: return _value * 1.01325*1e5; - case PressureChangeRateUnit.KilopascalPerMinute: return (_value/60) * 1e3d; - case PressureChangeRateUnit.KilopascalPerSecond: return (_value) * 1e3d; - case PressureChangeRateUnit.MegapascalPerMinute: return (_value/60) * 1e6d; - case PressureChangeRateUnit.MegapascalPerSecond: return (_value) * 1e6d; - case PressureChangeRateUnit.PascalPerMinute: return _value/60; - case PressureChangeRateUnit.PascalPerSecond: return _value; + case PressureChangeRateUnit.AtmospherePerSecond: return Value * 1.01325*1e5; + case PressureChangeRateUnit.KilopascalPerMinute: return (Value/60) * 1e3d; + case PressureChangeRateUnit.KilopascalPerSecond: return (Value) * 1e3d; + case PressureChangeRateUnit.MegapascalPerMinute: return (Value/60) * 1e6d; + case PressureChangeRateUnit.MegapascalPerSecond: return (Value) * 1e6d; + case PressureChangeRateUnit.PascalPerMinute: return Value/60; + case PressureChangeRateUnit.PascalPerSecond: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -748,10 +752,10 @@ internal PressureChangeRate ToBaseUnit() return new PressureChangeRate(baseUnitValue, BaseUnit); } - private double GetValueAs(PressureChangeRateUnit unit) + private T GetValueAs(PressureChangeRateUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -865,7 +869,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -880,37 +884,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -934,17 +938,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs index 34366b1d1b..fa1bf36632 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// In mathematics, a ratio is a relationship between two numbers of the same kind (e.g., objects, persons, students, spoonfuls, units of whatever identical dimension), usually expressed as "a to b" or a:b, sometimes expressed arithmetically as a dimensionless quotient of the two that explicitly indicates how many times the first number contains the second (not necessarily an integer). /// - public partial struct Ratio : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Ratio : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -66,12 +61,12 @@ static Ratio() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Ratio(double value, RatioUnit unit) + public Ratio(T value, RatioUnit unit) { if(unit == RatioUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -83,14 +78,14 @@ public Ratio(double value, RatioUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Ratio(double value, UnitSystem unitSystem) + public Ratio(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -132,7 +127,7 @@ public Ratio(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit DecimalFraction. /// - public static Ratio Zero { get; } = new Ratio(0, BaseUnit); + public static Ratio Zero { get; } = new Ratio((T)0, BaseUnit); #endregion @@ -141,7 +136,9 @@ public Ratio(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -171,32 +168,32 @@ public Ratio(double value, UnitSystem unitSystem) /// /// Get in DecimalFractions. /// - public double DecimalFractions => As(RatioUnit.DecimalFraction); + public T DecimalFractions => As(RatioUnit.DecimalFraction); /// /// Get in PartsPerBillion. /// - public double PartsPerBillion => As(RatioUnit.PartPerBillion); + public T PartsPerBillion => As(RatioUnit.PartPerBillion); /// /// Get in PartsPerMillion. /// - public double PartsPerMillion => As(RatioUnit.PartPerMillion); + public T PartsPerMillion => As(RatioUnit.PartPerMillion); /// /// Get in PartsPerThousand. /// - public double PartsPerThousand => As(RatioUnit.PartPerThousand); + public T PartsPerThousand => As(RatioUnit.PartPerThousand); /// /// Get in PartsPerTrillion. /// - public double PartsPerTrillion => As(RatioUnit.PartPerTrillion); + public T PartsPerTrillion => As(RatioUnit.PartPerTrillion); /// /// Get in Percent. /// - public double Percent => As(RatioUnit.Percent); + public T Percent => As(RatioUnit.Percent); #endregion @@ -231,55 +228,49 @@ public static string GetAbbreviation(RatioUnit unit, [CanBeNull] IFormatProvider /// Get from DecimalFractions. /// /// If value is NaN or Infinity. - public static Ratio FromDecimalFractions(QuantityValue decimalfractions) + public static Ratio FromDecimalFractions(T decimalfractions) { - double value = (double) decimalfractions; - return new Ratio(value, RatioUnit.DecimalFraction); + return new Ratio(decimalfractions, RatioUnit.DecimalFraction); } /// /// Get from PartsPerBillion. /// /// If value is NaN or Infinity. - public static Ratio FromPartsPerBillion(QuantityValue partsperbillion) + public static Ratio FromPartsPerBillion(T partsperbillion) { - double value = (double) partsperbillion; - return new Ratio(value, RatioUnit.PartPerBillion); + return new Ratio(partsperbillion, RatioUnit.PartPerBillion); } /// /// Get from PartsPerMillion. /// /// If value is NaN or Infinity. - public static Ratio FromPartsPerMillion(QuantityValue partspermillion) + public static Ratio FromPartsPerMillion(T partspermillion) { - double value = (double) partspermillion; - return new Ratio(value, RatioUnit.PartPerMillion); + return new Ratio(partspermillion, RatioUnit.PartPerMillion); } /// /// Get from PartsPerThousand. /// /// If value is NaN or Infinity. - public static Ratio FromPartsPerThousand(QuantityValue partsperthousand) + public static Ratio FromPartsPerThousand(T partsperthousand) { - double value = (double) partsperthousand; - return new Ratio(value, RatioUnit.PartPerThousand); + return new Ratio(partsperthousand, RatioUnit.PartPerThousand); } /// /// Get from PartsPerTrillion. /// /// If value is NaN or Infinity. - public static Ratio FromPartsPerTrillion(QuantityValue partspertrillion) + public static Ratio FromPartsPerTrillion(T partspertrillion) { - double value = (double) partspertrillion; - return new Ratio(value, RatioUnit.PartPerTrillion); + return new Ratio(partspertrillion, RatioUnit.PartPerTrillion); } /// /// Get from Percent. /// /// If value is NaN or Infinity. - public static Ratio FromPercent(QuantityValue percent) + public static Ratio FromPercent(T percent) { - double value = (double) percent; - return new Ratio(value, RatioUnit.Percent); + return new Ratio(percent, RatioUnit.Percent); } /// @@ -288,9 +279,9 @@ public static Ratio FromPercent(QuantityValue percent) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Ratio From(QuantityValue value, RatioUnit fromUnit) + public static Ratio From(T value, RatioUnit fromUnit) { - return new Ratio((double)value, fromUnit); + return new Ratio(value, fromUnit); } #endregion @@ -444,43 +435,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out RatioU /// Negate the value. public static Ratio operator -(Ratio right) { - return new Ratio(-right.Value, right.Unit); + return new Ratio(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Ratio operator +(Ratio left, Ratio right) { - return new Ratio(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Ratio(value, left.Unit); } /// Get from subtracting two . public static Ratio operator -(Ratio left, Ratio right) { - return new Ratio(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Ratio(value, left.Unit); } /// Get from multiplying value and . - public static Ratio operator *(double left, Ratio right) + public static Ratio operator *(T left, Ratio right) { - return new Ratio(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Ratio(value, right.Unit); } /// Get from multiplying value and . - public static Ratio operator *(Ratio left, double right) + public static Ratio operator *(Ratio left, T right) { - return new Ratio(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Ratio(value, left.Unit); } /// Get from dividing by value. - public static Ratio operator /(Ratio left, double right) + public static Ratio operator /(Ratio left, T right) { - return new Ratio(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Ratio(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Ratio left, Ratio right) + public static T operator /(Ratio left, Ratio right) { - return left.DecimalFractions / right.DecimalFractions; + return CompiledLambdas.Divide(left.DecimalFractions, right.DecimalFractions); } #endregion @@ -490,25 +486,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out RatioU /// Returns true if less or equal to. public static bool operator <=(Ratio left, Ratio right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Ratio left, Ratio right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Ratio left, Ratio right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Ratio left, Ratio right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -537,7 +533,7 @@ public int CompareTo(object obj) /// public int CompareTo(Ratio other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -554,7 +550,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Ratio other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -602,10 +598,8 @@ public bool Equals(Ratio other, double tolerance, ComparisonType comparisonTy if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -625,17 +619,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(RatioUnit unit) + public T As(RatioUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -655,9 +649,14 @@ double IQuantity.As(Enum unit) if(!(unit is RatioUnit unitAsRatioUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RatioUnit)} is supported.", nameof(unit)); - return As(unitAsRatioUnit); + var asValue = As(unitAsRatioUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(RatioUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -698,24 +697,30 @@ public Ratio ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(RatioUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(RatioUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case RatioUnit.DecimalFraction: return _value; - case RatioUnit.PartPerBillion: return _value/1e9; - case RatioUnit.PartPerMillion: return _value/1e6; - case RatioUnit.PartPerThousand: return _value/1e3; - case RatioUnit.PartPerTrillion: return _value/1e12; - case RatioUnit.Percent: return _value/1e2; + case RatioUnit.DecimalFraction: return Value; + case RatioUnit.PartPerBillion: return Value/1e9; + case RatioUnit.PartPerMillion: return Value/1e6; + case RatioUnit.PartPerThousand: return Value/1e3; + case RatioUnit.PartPerTrillion: return Value/1e12; + case RatioUnit.Percent: return Value/1e2; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -732,10 +737,10 @@ internal Ratio ToBaseUnit() return new Ratio(baseUnitValue, BaseUnit); } - private double GetValueAs(RatioUnit unit) + private T GetValueAs(RatioUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -848,7 +853,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -863,37 +868,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -917,17 +922,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs index c156bb9783..51526038bf 100644 --- a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// The change in ratio per unit of time. /// - public partial struct RatioChangeRate : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct RatioChangeRate : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -62,12 +57,12 @@ static RatioChangeRate() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public RatioChangeRate(double value, RatioChangeRateUnit unit) + public RatioChangeRate(T value, RatioChangeRateUnit unit) { if(unit == RatioChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -79,14 +74,14 @@ public RatioChangeRate(double value, RatioChangeRateUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public RatioChangeRate(double value, UnitSystem unitSystem) + public RatioChangeRate(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -128,7 +123,7 @@ public RatioChangeRate(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit DecimalFractionPerSecond. /// - public static RatioChangeRate Zero { get; } = new RatioChangeRate(0, BaseUnit); + public static RatioChangeRate Zero { get; } = new RatioChangeRate((T)0, BaseUnit); #endregion @@ -137,7 +132,9 @@ public RatioChangeRate(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -167,12 +164,12 @@ public RatioChangeRate(double value, UnitSystem unitSystem) /// /// Get in DecimalFractionsPerSecond. /// - public double DecimalFractionsPerSecond => As(RatioChangeRateUnit.DecimalFractionPerSecond); + public T DecimalFractionsPerSecond => As(RatioChangeRateUnit.DecimalFractionPerSecond); /// /// Get in PercentsPerSecond. /// - public double PercentsPerSecond => As(RatioChangeRateUnit.PercentPerSecond); + public T PercentsPerSecond => As(RatioChangeRateUnit.PercentPerSecond); #endregion @@ -207,19 +204,17 @@ public static string GetAbbreviation(RatioChangeRateUnit unit, [CanBeNull] IForm /// Get from DecimalFractionsPerSecond. /// /// If value is NaN or Infinity. - public static RatioChangeRate FromDecimalFractionsPerSecond(QuantityValue decimalfractionspersecond) + public static RatioChangeRate FromDecimalFractionsPerSecond(T decimalfractionspersecond) { - double value = (double) decimalfractionspersecond; - return new RatioChangeRate(value, RatioChangeRateUnit.DecimalFractionPerSecond); + return new RatioChangeRate(decimalfractionspersecond, RatioChangeRateUnit.DecimalFractionPerSecond); } /// /// Get from PercentsPerSecond. /// /// If value is NaN or Infinity. - public static RatioChangeRate FromPercentsPerSecond(QuantityValue percentspersecond) + public static RatioChangeRate FromPercentsPerSecond(T percentspersecond) { - double value = (double) percentspersecond; - return new RatioChangeRate(value, RatioChangeRateUnit.PercentPerSecond); + return new RatioChangeRate(percentspersecond, RatioChangeRateUnit.PercentPerSecond); } /// @@ -228,9 +223,9 @@ public static RatioChangeRate FromPercentsPerSecond(QuantityValue percentsper /// Value to convert from. /// Unit to convert from. /// unit value. - public static RatioChangeRate From(QuantityValue value, RatioChangeRateUnit fromUnit) + public static RatioChangeRate From(T value, RatioChangeRateUnit fromUnit) { - return new RatioChangeRate((double)value, fromUnit); + return new RatioChangeRate(value, fromUnit); } #endregion @@ -384,43 +379,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out RatioC /// Negate the value. public static RatioChangeRate operator -(RatioChangeRate right) { - return new RatioChangeRate(-right.Value, right.Unit); + return new RatioChangeRate(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static RatioChangeRate operator +(RatioChangeRate left, RatioChangeRate right) { - return new RatioChangeRate(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new RatioChangeRate(value, left.Unit); } /// Get from subtracting two . public static RatioChangeRate operator -(RatioChangeRate left, RatioChangeRate right) { - return new RatioChangeRate(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new RatioChangeRate(value, left.Unit); } /// Get from multiplying value and . - public static RatioChangeRate operator *(double left, RatioChangeRate right) + public static RatioChangeRate operator *(T left, RatioChangeRate right) { - return new RatioChangeRate(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new RatioChangeRate(value, right.Unit); } /// Get from multiplying value and . - public static RatioChangeRate operator *(RatioChangeRate left, double right) + public static RatioChangeRate operator *(RatioChangeRate left, T right) { - return new RatioChangeRate(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new RatioChangeRate(value, left.Unit); } /// Get from dividing by value. - public static RatioChangeRate operator /(RatioChangeRate left, double right) + public static RatioChangeRate operator /(RatioChangeRate left, T right) { - return new RatioChangeRate(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new RatioChangeRate(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(RatioChangeRate left, RatioChangeRate right) + public static T operator /(RatioChangeRate left, RatioChangeRate right) { - return left.DecimalFractionsPerSecond / right.DecimalFractionsPerSecond; + return CompiledLambdas.Divide(left.DecimalFractionsPerSecond, right.DecimalFractionsPerSecond); } #endregion @@ -430,25 +430,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out RatioC /// Returns true if less or equal to. public static bool operator <=(RatioChangeRate left, RatioChangeRate right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(RatioChangeRate left, RatioChangeRate right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(RatioChangeRate left, RatioChangeRate right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(RatioChangeRate left, RatioChangeRate right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -477,7 +477,7 @@ public int CompareTo(object obj) /// public int CompareTo(RatioChangeRate other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -494,7 +494,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(RatioChangeRate other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -542,10 +542,8 @@ public bool Equals(RatioChangeRate other, double tolerance, ComparisonType co if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -565,17 +563,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(RatioChangeRateUnit unit) + public T As(RatioChangeRateUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -595,9 +593,14 @@ double IQuantity.As(Enum unit) if(!(unit is RatioChangeRateUnit unitAsRatioChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RatioChangeRateUnit)} is supported.", nameof(unit)); - return As(unitAsRatioChangeRateUnit); + var asValue = As(unitAsRatioChangeRateUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(RatioChangeRateUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -638,20 +641,26 @@ public RatioChangeRate ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(RatioChangeRateUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(RatioChangeRateUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case RatioChangeRateUnit.DecimalFractionPerSecond: return _value*1e2; - case RatioChangeRateUnit.PercentPerSecond: return _value; + case RatioChangeRateUnit.DecimalFractionPerSecond: return Value*1e2; + case RatioChangeRateUnit.PercentPerSecond: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -668,10 +677,10 @@ internal RatioChangeRate ToBaseUnit() return new RatioChangeRate(baseUnitValue, BaseUnit); } - private double GetValueAs(RatioChangeRateUnit unit) + private T GetValueAs(RatioChangeRateUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -780,7 +789,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -795,37 +804,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -849,17 +858,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs index 8dcedd73b1..b55d18935f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// The Volt-ampere reactive hour (expressed as varh) is the reactive power of one Volt-ampere reactive produced in one hour. /// - public partial struct ReactiveEnergy : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ReactiveEnergy : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -63,12 +58,12 @@ static ReactiveEnergy() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ReactiveEnergy(double value, ReactiveEnergyUnit unit) + public ReactiveEnergy(T value, ReactiveEnergyUnit unit) { if(unit == ReactiveEnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -80,14 +75,14 @@ public ReactiveEnergy(double value, ReactiveEnergyUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ReactiveEnergy(double value, UnitSystem unitSystem) + public ReactiveEnergy(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -129,7 +124,7 @@ public ReactiveEnergy(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereReactiveHour. /// - public static ReactiveEnergy Zero { get; } = new ReactiveEnergy(0, BaseUnit); + public static ReactiveEnergy Zero { get; } = new ReactiveEnergy((T)0, BaseUnit); #endregion @@ -138,7 +133,9 @@ public ReactiveEnergy(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -168,17 +165,17 @@ public ReactiveEnergy(double value, UnitSystem unitSystem) /// /// Get in KilovoltampereReactiveHours. /// - public double KilovoltampereReactiveHours => As(ReactiveEnergyUnit.KilovoltampereReactiveHour); + public T KilovoltampereReactiveHours => As(ReactiveEnergyUnit.KilovoltampereReactiveHour); /// /// Get in MegavoltampereReactiveHours. /// - public double MegavoltampereReactiveHours => As(ReactiveEnergyUnit.MegavoltampereReactiveHour); + public T MegavoltampereReactiveHours => As(ReactiveEnergyUnit.MegavoltampereReactiveHour); /// /// Get in VoltampereReactiveHours. /// - public double VoltampereReactiveHours => As(ReactiveEnergyUnit.VoltampereReactiveHour); + public T VoltampereReactiveHours => As(ReactiveEnergyUnit.VoltampereReactiveHour); #endregion @@ -213,28 +210,25 @@ public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] IForma /// Get from KilovoltampereReactiveHours. /// /// If value is NaN or Infinity. - public static ReactiveEnergy FromKilovoltampereReactiveHours(QuantityValue kilovoltamperereactivehours) + public static ReactiveEnergy FromKilovoltampereReactiveHours(T kilovoltamperereactivehours) { - double value = (double) kilovoltamperereactivehours; - return new ReactiveEnergy(value, ReactiveEnergyUnit.KilovoltampereReactiveHour); + return new ReactiveEnergy(kilovoltamperereactivehours, ReactiveEnergyUnit.KilovoltampereReactiveHour); } /// /// Get from MegavoltampereReactiveHours. /// /// If value is NaN or Infinity. - public static ReactiveEnergy FromMegavoltampereReactiveHours(QuantityValue megavoltamperereactivehours) + public static ReactiveEnergy FromMegavoltampereReactiveHours(T megavoltamperereactivehours) { - double value = (double) megavoltamperereactivehours; - return new ReactiveEnergy(value, ReactiveEnergyUnit.MegavoltampereReactiveHour); + return new ReactiveEnergy(megavoltamperereactivehours, ReactiveEnergyUnit.MegavoltampereReactiveHour); } /// /// Get from VoltampereReactiveHours. /// /// If value is NaN or Infinity. - public static ReactiveEnergy FromVoltampereReactiveHours(QuantityValue voltamperereactivehours) + public static ReactiveEnergy FromVoltampereReactiveHours(T voltamperereactivehours) { - double value = (double) voltamperereactivehours; - return new ReactiveEnergy(value, ReactiveEnergyUnit.VoltampereReactiveHour); + return new ReactiveEnergy(voltamperereactivehours, ReactiveEnergyUnit.VoltampereReactiveHour); } /// @@ -243,9 +237,9 @@ public static ReactiveEnergy FromVoltampereReactiveHours(QuantityValue voltam /// Value to convert from. /// Unit to convert from. /// unit value. - public static ReactiveEnergy From(QuantityValue value, ReactiveEnergyUnit fromUnit) + public static ReactiveEnergy From(T value, ReactiveEnergyUnit fromUnit) { - return new ReactiveEnergy((double)value, fromUnit); + return new ReactiveEnergy(value, fromUnit); } #endregion @@ -399,43 +393,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Reacti /// Negate the value. public static ReactiveEnergy operator -(ReactiveEnergy right) { - return new ReactiveEnergy(-right.Value, right.Unit); + return new ReactiveEnergy(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ReactiveEnergy operator +(ReactiveEnergy left, ReactiveEnergy right) { - return new ReactiveEnergy(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ReactiveEnergy(value, left.Unit); } /// Get from subtracting two . public static ReactiveEnergy operator -(ReactiveEnergy left, ReactiveEnergy right) { - return new ReactiveEnergy(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ReactiveEnergy(value, left.Unit); } /// Get from multiplying value and . - public static ReactiveEnergy operator *(double left, ReactiveEnergy right) + public static ReactiveEnergy operator *(T left, ReactiveEnergy right) { - return new ReactiveEnergy(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ReactiveEnergy(value, right.Unit); } /// Get from multiplying value and . - public static ReactiveEnergy operator *(ReactiveEnergy left, double right) + public static ReactiveEnergy operator *(ReactiveEnergy left, T right) { - return new ReactiveEnergy(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ReactiveEnergy(value, left.Unit); } /// Get from dividing by value. - public static ReactiveEnergy operator /(ReactiveEnergy left, double right) + public static ReactiveEnergy operator /(ReactiveEnergy left, T right) { - return new ReactiveEnergy(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ReactiveEnergy(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ReactiveEnergy left, ReactiveEnergy right) + public static T operator /(ReactiveEnergy left, ReactiveEnergy right) { - return left.VoltampereReactiveHours / right.VoltampereReactiveHours; + return CompiledLambdas.Divide(left.VoltampereReactiveHours, right.VoltampereReactiveHours); } #endregion @@ -445,25 +444,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Reacti /// Returns true if less or equal to. public static bool operator <=(ReactiveEnergy left, ReactiveEnergy right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ReactiveEnergy left, ReactiveEnergy right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ReactiveEnergy left, ReactiveEnergy right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ReactiveEnergy left, ReactiveEnergy right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -492,7 +491,7 @@ public int CompareTo(object obj) /// public int CompareTo(ReactiveEnergy other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -509,7 +508,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ReactiveEnergy other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -557,10 +556,8 @@ public bool Equals(ReactiveEnergy other, double tolerance, ComparisonType com if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -580,17 +577,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ReactiveEnergyUnit unit) + public T As(ReactiveEnergyUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -610,9 +607,14 @@ double IQuantity.As(Enum unit) if(!(unit is ReactiveEnergyUnit unitAsReactiveEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReactiveEnergyUnit)} is supported.", nameof(unit)); - return As(unitAsReactiveEnergyUnit); + var asValue = As(unitAsReactiveEnergyUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ReactiveEnergyUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -653,21 +655,27 @@ public ReactiveEnergy ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ReactiveEnergyUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ReactiveEnergyUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ReactiveEnergyUnit.KilovoltampereReactiveHour: return (_value) * 1e3d; - case ReactiveEnergyUnit.MegavoltampereReactiveHour: return (_value) * 1e6d; - case ReactiveEnergyUnit.VoltampereReactiveHour: return _value; + case ReactiveEnergyUnit.KilovoltampereReactiveHour: return (Value) * 1e3d; + case ReactiveEnergyUnit.MegavoltampereReactiveHour: return (Value) * 1e6d; + case ReactiveEnergyUnit.VoltampereReactiveHour: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -684,10 +692,10 @@ internal ReactiveEnergy ToBaseUnit() return new ReactiveEnergy(baseUnitValue, BaseUnit); } - private double GetValueAs(ReactiveEnergyUnit unit) + private T GetValueAs(ReactiveEnergyUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -797,7 +805,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -812,37 +820,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -866,17 +874,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs index deaffe4484..2b23306c1a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Volt-ampere reactive (var) is a unit by which reactive power is expressed in an AC electric power system. Reactive power exists in an AC circuit when the current and voltage are not in phase. /// - public partial struct ReactivePower : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ReactivePower : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -64,12 +59,12 @@ static ReactivePower() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ReactivePower(double value, ReactivePowerUnit unit) + public ReactivePower(T value, ReactivePowerUnit unit) { if(unit == ReactivePowerUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -81,14 +76,14 @@ public ReactivePower(double value, ReactivePowerUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ReactivePower(double value, UnitSystem unitSystem) + public ReactivePower(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -130,7 +125,7 @@ public ReactivePower(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereReactive. /// - public static ReactivePower Zero { get; } = new ReactivePower(0, BaseUnit); + public static ReactivePower Zero { get; } = new ReactivePower((T)0, BaseUnit); #endregion @@ -139,7 +134,9 @@ public ReactivePower(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -169,22 +166,22 @@ public ReactivePower(double value, UnitSystem unitSystem) /// /// Get in GigavoltamperesReactive. /// - public double GigavoltamperesReactive => As(ReactivePowerUnit.GigavoltampereReactive); + public T GigavoltamperesReactive => As(ReactivePowerUnit.GigavoltampereReactive); /// /// Get in KilovoltamperesReactive. /// - public double KilovoltamperesReactive => As(ReactivePowerUnit.KilovoltampereReactive); + public T KilovoltamperesReactive => As(ReactivePowerUnit.KilovoltampereReactive); /// /// Get in MegavoltamperesReactive. /// - public double MegavoltamperesReactive => As(ReactivePowerUnit.MegavoltampereReactive); + public T MegavoltamperesReactive => As(ReactivePowerUnit.MegavoltampereReactive); /// /// Get in VoltamperesReactive. /// - public double VoltamperesReactive => As(ReactivePowerUnit.VoltampereReactive); + public T VoltamperesReactive => As(ReactivePowerUnit.VoltampereReactive); #endregion @@ -219,37 +216,33 @@ public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] IFormat /// Get from GigavoltamperesReactive. /// /// If value is NaN or Infinity. - public static ReactivePower FromGigavoltamperesReactive(QuantityValue gigavoltamperesreactive) + public static ReactivePower FromGigavoltamperesReactive(T gigavoltamperesreactive) { - double value = (double) gigavoltamperesreactive; - return new ReactivePower(value, ReactivePowerUnit.GigavoltampereReactive); + return new ReactivePower(gigavoltamperesreactive, ReactivePowerUnit.GigavoltampereReactive); } /// /// Get from KilovoltamperesReactive. /// /// If value is NaN or Infinity. - public static ReactivePower FromKilovoltamperesReactive(QuantityValue kilovoltamperesreactive) + public static ReactivePower FromKilovoltamperesReactive(T kilovoltamperesreactive) { - double value = (double) kilovoltamperesreactive; - return new ReactivePower(value, ReactivePowerUnit.KilovoltampereReactive); + return new ReactivePower(kilovoltamperesreactive, ReactivePowerUnit.KilovoltampereReactive); } /// /// Get from MegavoltamperesReactive. /// /// If value is NaN or Infinity. - public static ReactivePower FromMegavoltamperesReactive(QuantityValue megavoltamperesreactive) + public static ReactivePower FromMegavoltamperesReactive(T megavoltamperesreactive) { - double value = (double) megavoltamperesreactive; - return new ReactivePower(value, ReactivePowerUnit.MegavoltampereReactive); + return new ReactivePower(megavoltamperesreactive, ReactivePowerUnit.MegavoltampereReactive); } /// /// Get from VoltamperesReactive. /// /// If value is NaN or Infinity. - public static ReactivePower FromVoltamperesReactive(QuantityValue voltamperesreactive) + public static ReactivePower FromVoltamperesReactive(T voltamperesreactive) { - double value = (double) voltamperesreactive; - return new ReactivePower(value, ReactivePowerUnit.VoltampereReactive); + return new ReactivePower(voltamperesreactive, ReactivePowerUnit.VoltampereReactive); } /// @@ -258,9 +251,9 @@ public static ReactivePower FromVoltamperesReactive(QuantityValue voltamperes /// Value to convert from. /// Unit to convert from. /// unit value. - public static ReactivePower From(QuantityValue value, ReactivePowerUnit fromUnit) + public static ReactivePower From(T value, ReactivePowerUnit fromUnit) { - return new ReactivePower((double)value, fromUnit); + return new ReactivePower(value, fromUnit); } #endregion @@ -414,43 +407,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Reacti /// Negate the value. public static ReactivePower operator -(ReactivePower right) { - return new ReactivePower(-right.Value, right.Unit); + return new ReactivePower(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ReactivePower operator +(ReactivePower left, ReactivePower right) { - return new ReactivePower(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ReactivePower(value, left.Unit); } /// Get from subtracting two . public static ReactivePower operator -(ReactivePower left, ReactivePower right) { - return new ReactivePower(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ReactivePower(value, left.Unit); } /// Get from multiplying value and . - public static ReactivePower operator *(double left, ReactivePower right) + public static ReactivePower operator *(T left, ReactivePower right) { - return new ReactivePower(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ReactivePower(value, right.Unit); } /// Get from multiplying value and . - public static ReactivePower operator *(ReactivePower left, double right) + public static ReactivePower operator *(ReactivePower left, T right) { - return new ReactivePower(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ReactivePower(value, left.Unit); } /// Get from dividing by value. - public static ReactivePower operator /(ReactivePower left, double right) + public static ReactivePower operator /(ReactivePower left, T right) { - return new ReactivePower(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ReactivePower(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ReactivePower left, ReactivePower right) + public static T operator /(ReactivePower left, ReactivePower right) { - return left.VoltamperesReactive / right.VoltamperesReactive; + return CompiledLambdas.Divide(left.VoltamperesReactive, right.VoltamperesReactive); } #endregion @@ -460,25 +458,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Reacti /// Returns true if less or equal to. public static bool operator <=(ReactivePower left, ReactivePower right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ReactivePower left, ReactivePower right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ReactivePower left, ReactivePower right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ReactivePower left, ReactivePower right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -507,7 +505,7 @@ public int CompareTo(object obj) /// public int CompareTo(ReactivePower other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -524,7 +522,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ReactivePower other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -572,10 +570,8 @@ public bool Equals(ReactivePower other, double tolerance, ComparisonType comp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -595,17 +591,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ReactivePowerUnit unit) + public T As(ReactivePowerUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -625,9 +621,14 @@ double IQuantity.As(Enum unit) if(!(unit is ReactivePowerUnit unitAsReactivePowerUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReactivePowerUnit)} is supported.", nameof(unit)); - return As(unitAsReactivePowerUnit); + var asValue = As(unitAsReactivePowerUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ReactivePowerUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -668,22 +669,28 @@ public ReactivePower ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ReactivePowerUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ReactivePowerUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ReactivePowerUnit.GigavoltampereReactive: return (_value) * 1e9d; - case ReactivePowerUnit.KilovoltampereReactive: return (_value) * 1e3d; - case ReactivePowerUnit.MegavoltampereReactive: return (_value) * 1e6d; - case ReactivePowerUnit.VoltampereReactive: return _value; + case ReactivePowerUnit.GigavoltampereReactive: return (Value) * 1e9d; + case ReactivePowerUnit.KilovoltampereReactive: return (Value) * 1e3d; + case ReactivePowerUnit.MegavoltampereReactive: return (Value) * 1e6d; + case ReactivePowerUnit.VoltampereReactive: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -700,10 +707,10 @@ internal ReactivePower ToBaseUnit() return new ReactivePower(baseUnitValue, BaseUnit); } - private double GetValueAs(ReactivePowerUnit unit) + private T GetValueAs(ReactivePowerUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -814,7 +821,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -829,37 +836,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -883,17 +890,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs index 14b647f102..c7b333e229 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Angular acceleration is the rate of change of rotational speed. /// - public partial struct RotationalAcceleration : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct RotationalAcceleration : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -64,12 +59,12 @@ static RotationalAcceleration() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public RotationalAcceleration(double value, RotationalAccelerationUnit unit) + public RotationalAcceleration(T value, RotationalAccelerationUnit unit) { if(unit == RotationalAccelerationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -81,14 +76,14 @@ public RotationalAcceleration(double value, RotationalAccelerationUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public RotationalAcceleration(double value, UnitSystem unitSystem) + public RotationalAcceleration(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -130,7 +125,7 @@ public RotationalAcceleration(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit RadianPerSecondSquared. /// - public static RotationalAcceleration Zero { get; } = new RotationalAcceleration(0, BaseUnit); + public static RotationalAcceleration Zero { get; } = new RotationalAcceleration((T)0, BaseUnit); #endregion @@ -139,7 +134,9 @@ public RotationalAcceleration(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -169,22 +166,22 @@ public RotationalAcceleration(double value, UnitSystem unitSystem) /// /// Get in DegreesPerSecondSquared. /// - public double DegreesPerSecondSquared => As(RotationalAccelerationUnit.DegreePerSecondSquared); + public T DegreesPerSecondSquared => As(RotationalAccelerationUnit.DegreePerSecondSquared); /// /// Get in RadiansPerSecondSquared. /// - public double RadiansPerSecondSquared => As(RotationalAccelerationUnit.RadianPerSecondSquared); + public T RadiansPerSecondSquared => As(RotationalAccelerationUnit.RadianPerSecondSquared); /// /// Get in RevolutionsPerMinutePerSecond. /// - public double RevolutionsPerMinutePerSecond => As(RotationalAccelerationUnit.RevolutionPerMinutePerSecond); + public T RevolutionsPerMinutePerSecond => As(RotationalAccelerationUnit.RevolutionPerMinutePerSecond); /// /// Get in RevolutionsPerSecondSquared. /// - public double RevolutionsPerSecondSquared => As(RotationalAccelerationUnit.RevolutionPerSecondSquared); + public T RevolutionsPerSecondSquared => As(RotationalAccelerationUnit.RevolutionPerSecondSquared); #endregion @@ -219,37 +216,33 @@ public static string GetAbbreviation(RotationalAccelerationUnit unit, [CanBeNull /// Get from DegreesPerSecondSquared. /// /// If value is NaN or Infinity. - public static RotationalAcceleration FromDegreesPerSecondSquared(QuantityValue degreespersecondsquared) + public static RotationalAcceleration FromDegreesPerSecondSquared(T degreespersecondsquared) { - double value = (double) degreespersecondsquared; - return new RotationalAcceleration(value, RotationalAccelerationUnit.DegreePerSecondSquared); + return new RotationalAcceleration(degreespersecondsquared, RotationalAccelerationUnit.DegreePerSecondSquared); } /// /// Get from RadiansPerSecondSquared. /// /// If value is NaN or Infinity. - public static RotationalAcceleration FromRadiansPerSecondSquared(QuantityValue radianspersecondsquared) + public static RotationalAcceleration FromRadiansPerSecondSquared(T radianspersecondsquared) { - double value = (double) radianspersecondsquared; - return new RotationalAcceleration(value, RotationalAccelerationUnit.RadianPerSecondSquared); + return new RotationalAcceleration(radianspersecondsquared, RotationalAccelerationUnit.RadianPerSecondSquared); } /// /// Get from RevolutionsPerMinutePerSecond. /// /// If value is NaN or Infinity. - public static RotationalAcceleration FromRevolutionsPerMinutePerSecond(QuantityValue revolutionsperminutepersecond) + public static RotationalAcceleration FromRevolutionsPerMinutePerSecond(T revolutionsperminutepersecond) { - double value = (double) revolutionsperminutepersecond; - return new RotationalAcceleration(value, RotationalAccelerationUnit.RevolutionPerMinutePerSecond); + return new RotationalAcceleration(revolutionsperminutepersecond, RotationalAccelerationUnit.RevolutionPerMinutePerSecond); } /// /// Get from RevolutionsPerSecondSquared. /// /// If value is NaN or Infinity. - public static RotationalAcceleration FromRevolutionsPerSecondSquared(QuantityValue revolutionspersecondsquared) + public static RotationalAcceleration FromRevolutionsPerSecondSquared(T revolutionspersecondsquared) { - double value = (double) revolutionspersecondsquared; - return new RotationalAcceleration(value, RotationalAccelerationUnit.RevolutionPerSecondSquared); + return new RotationalAcceleration(revolutionspersecondsquared, RotationalAccelerationUnit.RevolutionPerSecondSquared); } /// @@ -258,9 +251,9 @@ public static RotationalAcceleration FromRevolutionsPerSecondSquared(Quantity /// Value to convert from. /// Unit to convert from. /// unit value. - public static RotationalAcceleration From(QuantityValue value, RotationalAccelerationUnit fromUnit) + public static RotationalAcceleration From(T value, RotationalAccelerationUnit fromUnit) { - return new RotationalAcceleration((double)value, fromUnit); + return new RotationalAcceleration(value, fromUnit); } #endregion @@ -414,43 +407,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati /// Negate the value. public static RotationalAcceleration operator -(RotationalAcceleration right) { - return new RotationalAcceleration(-right.Value, right.Unit); + return new RotationalAcceleration(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static RotationalAcceleration operator +(RotationalAcceleration left, RotationalAcceleration right) { - return new RotationalAcceleration(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new RotationalAcceleration(value, left.Unit); } /// Get from subtracting two . public static RotationalAcceleration operator -(RotationalAcceleration left, RotationalAcceleration right) { - return new RotationalAcceleration(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new RotationalAcceleration(value, left.Unit); } /// Get from multiplying value and . - public static RotationalAcceleration operator *(double left, RotationalAcceleration right) + public static RotationalAcceleration operator *(T left, RotationalAcceleration right) { - return new RotationalAcceleration(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new RotationalAcceleration(value, right.Unit); } /// Get from multiplying value and . - public static RotationalAcceleration operator *(RotationalAcceleration left, double right) + public static RotationalAcceleration operator *(RotationalAcceleration left, T right) { - return new RotationalAcceleration(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new RotationalAcceleration(value, left.Unit); } /// Get from dividing by value. - public static RotationalAcceleration operator /(RotationalAcceleration left, double right) + public static RotationalAcceleration operator /(RotationalAcceleration left, T right) { - return new RotationalAcceleration(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new RotationalAcceleration(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(RotationalAcceleration left, RotationalAcceleration right) + public static T operator /(RotationalAcceleration left, RotationalAcceleration right) { - return left.RadiansPerSecondSquared / right.RadiansPerSecondSquared; + return CompiledLambdas.Divide(left.RadiansPerSecondSquared, right.RadiansPerSecondSquared); } #endregion @@ -460,25 +458,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati /// Returns true if less or equal to. public static bool operator <=(RotationalAcceleration left, RotationalAcceleration right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(RotationalAcceleration left, RotationalAcceleration right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(RotationalAcceleration left, RotationalAcceleration right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(RotationalAcceleration left, RotationalAcceleration right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -507,7 +505,7 @@ public int CompareTo(object obj) /// public int CompareTo(RotationalAcceleration other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -524,7 +522,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(RotationalAcceleration other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -572,10 +570,8 @@ public bool Equals(RotationalAcceleration other, double tolerance, Comparison if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -595,17 +591,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(RotationalAccelerationUnit unit) + public T As(RotationalAccelerationUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -625,9 +621,14 @@ double IQuantity.As(Enum unit) if(!(unit is RotationalAccelerationUnit unitAsRotationalAccelerationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalAccelerationUnit)} is supported.", nameof(unit)); - return As(unitAsRotationalAccelerationUnit); + var asValue = As(unitAsRotationalAccelerationUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(RotationalAccelerationUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -668,22 +669,28 @@ public RotationalAcceleration ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(RotationalAccelerationUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(RotationalAccelerationUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case RotationalAccelerationUnit.DegreePerSecondSquared: return (Math.PI/180)*_value; - case RotationalAccelerationUnit.RadianPerSecondSquared: return _value; - case RotationalAccelerationUnit.RevolutionPerMinutePerSecond: return ((2*Math.PI)/60)*_value; - case RotationalAccelerationUnit.RevolutionPerSecondSquared: return (2*Math.PI)*_value; + case RotationalAccelerationUnit.DegreePerSecondSquared: return (Math.PI/180)*Value; + case RotationalAccelerationUnit.RadianPerSecondSquared: return Value; + case RotationalAccelerationUnit.RevolutionPerMinutePerSecond: return ((2*Math.PI)/60)*Value; + case RotationalAccelerationUnit.RevolutionPerSecondSquared: return (2*Math.PI)*Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -700,10 +707,10 @@ internal RotationalAcceleration ToBaseUnit() return new RotationalAcceleration(baseUnitValue, BaseUnit); } - private double GetValueAs(RotationalAccelerationUnit unit) + private T GetValueAs(RotationalAccelerationUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -814,7 +821,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -829,37 +836,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -883,17 +890,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs index cecee53475..b6e2f67f6d 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Rotational speed (sometimes called speed of revolution) is the number of complete rotations, revolutions, cycles, or turns per time unit. Rotational speed is a cyclic frequency, measured in radians per second or in hertz in the SI System by scientists, or in revolutions per minute (rpm or min-1) or revolutions per second in everyday life. The symbol for rotational speed is ω (the Greek lowercase letter "omega"). /// - public partial struct RotationalSpeed : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct RotationalSpeed : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -73,12 +68,12 @@ static RotationalSpeed() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public RotationalSpeed(double value, RotationalSpeedUnit unit) + public RotationalSpeed(T value, RotationalSpeedUnit unit) { if(unit == RotationalSpeedUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -90,14 +85,14 @@ public RotationalSpeed(double value, RotationalSpeedUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public RotationalSpeed(double value, UnitSystem unitSystem) + public RotationalSpeed(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -139,7 +134,7 @@ public RotationalSpeed(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit RadianPerSecond. /// - public static RotationalSpeed Zero { get; } = new RotationalSpeed(0, BaseUnit); + public static RotationalSpeed Zero { get; } = new RotationalSpeed((T)0, BaseUnit); #endregion @@ -148,7 +143,9 @@ public RotationalSpeed(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -178,67 +175,67 @@ public RotationalSpeed(double value, UnitSystem unitSystem) /// /// Get in CentiradiansPerSecond. /// - public double CentiradiansPerSecond => As(RotationalSpeedUnit.CentiradianPerSecond); + public T CentiradiansPerSecond => As(RotationalSpeedUnit.CentiradianPerSecond); /// /// Get in DeciradiansPerSecond. /// - public double DeciradiansPerSecond => As(RotationalSpeedUnit.DeciradianPerSecond); + public T DeciradiansPerSecond => As(RotationalSpeedUnit.DeciradianPerSecond); /// /// Get in DegreesPerMinute. /// - public double DegreesPerMinute => As(RotationalSpeedUnit.DegreePerMinute); + public T DegreesPerMinute => As(RotationalSpeedUnit.DegreePerMinute); /// /// Get in DegreesPerSecond. /// - public double DegreesPerSecond => As(RotationalSpeedUnit.DegreePerSecond); + public T DegreesPerSecond => As(RotationalSpeedUnit.DegreePerSecond); /// /// Get in MicrodegreesPerSecond. /// - public double MicrodegreesPerSecond => As(RotationalSpeedUnit.MicrodegreePerSecond); + public T MicrodegreesPerSecond => As(RotationalSpeedUnit.MicrodegreePerSecond); /// /// Get in MicroradiansPerSecond. /// - public double MicroradiansPerSecond => As(RotationalSpeedUnit.MicroradianPerSecond); + public T MicroradiansPerSecond => As(RotationalSpeedUnit.MicroradianPerSecond); /// /// Get in MillidegreesPerSecond. /// - public double MillidegreesPerSecond => As(RotationalSpeedUnit.MillidegreePerSecond); + public T MillidegreesPerSecond => As(RotationalSpeedUnit.MillidegreePerSecond); /// /// Get in MilliradiansPerSecond. /// - public double MilliradiansPerSecond => As(RotationalSpeedUnit.MilliradianPerSecond); + public T MilliradiansPerSecond => As(RotationalSpeedUnit.MilliradianPerSecond); /// /// Get in NanodegreesPerSecond. /// - public double NanodegreesPerSecond => As(RotationalSpeedUnit.NanodegreePerSecond); + public T NanodegreesPerSecond => As(RotationalSpeedUnit.NanodegreePerSecond); /// /// Get in NanoradiansPerSecond. /// - public double NanoradiansPerSecond => As(RotationalSpeedUnit.NanoradianPerSecond); + public T NanoradiansPerSecond => As(RotationalSpeedUnit.NanoradianPerSecond); /// /// Get in RadiansPerSecond. /// - public double RadiansPerSecond => As(RotationalSpeedUnit.RadianPerSecond); + public T RadiansPerSecond => As(RotationalSpeedUnit.RadianPerSecond); /// /// Get in RevolutionsPerMinute. /// - public double RevolutionsPerMinute => As(RotationalSpeedUnit.RevolutionPerMinute); + public T RevolutionsPerMinute => As(RotationalSpeedUnit.RevolutionPerMinute); /// /// Get in RevolutionsPerSecond. /// - public double RevolutionsPerSecond => As(RotationalSpeedUnit.RevolutionPerSecond); + public T RevolutionsPerSecond => As(RotationalSpeedUnit.RevolutionPerSecond); #endregion @@ -273,118 +270,105 @@ public static string GetAbbreviation(RotationalSpeedUnit unit, [CanBeNull] IForm /// Get from CentiradiansPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromCentiradiansPerSecond(QuantityValue centiradianspersecond) + public static RotationalSpeed FromCentiradiansPerSecond(T centiradianspersecond) { - double value = (double) centiradianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.CentiradianPerSecond); + return new RotationalSpeed(centiradianspersecond, RotationalSpeedUnit.CentiradianPerSecond); } /// /// Get from DeciradiansPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromDeciradiansPerSecond(QuantityValue deciradianspersecond) + public static RotationalSpeed FromDeciradiansPerSecond(T deciradianspersecond) { - double value = (double) deciradianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.DeciradianPerSecond); + return new RotationalSpeed(deciradianspersecond, RotationalSpeedUnit.DeciradianPerSecond); } /// /// Get from DegreesPerMinute. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromDegreesPerMinute(QuantityValue degreesperminute) + public static RotationalSpeed FromDegreesPerMinute(T degreesperminute) { - double value = (double) degreesperminute; - return new RotationalSpeed(value, RotationalSpeedUnit.DegreePerMinute); + return new RotationalSpeed(degreesperminute, RotationalSpeedUnit.DegreePerMinute); } /// /// Get from DegreesPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromDegreesPerSecond(QuantityValue degreespersecond) + public static RotationalSpeed FromDegreesPerSecond(T degreespersecond) { - double value = (double) degreespersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.DegreePerSecond); + return new RotationalSpeed(degreespersecond, RotationalSpeedUnit.DegreePerSecond); } /// /// Get from MicrodegreesPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromMicrodegreesPerSecond(QuantityValue microdegreespersecond) + public static RotationalSpeed FromMicrodegreesPerSecond(T microdegreespersecond) { - double value = (double) microdegreespersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.MicrodegreePerSecond); + return new RotationalSpeed(microdegreespersecond, RotationalSpeedUnit.MicrodegreePerSecond); } /// /// Get from MicroradiansPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromMicroradiansPerSecond(QuantityValue microradianspersecond) + public static RotationalSpeed FromMicroradiansPerSecond(T microradianspersecond) { - double value = (double) microradianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.MicroradianPerSecond); + return new RotationalSpeed(microradianspersecond, RotationalSpeedUnit.MicroradianPerSecond); } /// /// Get from MillidegreesPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromMillidegreesPerSecond(QuantityValue millidegreespersecond) + public static RotationalSpeed FromMillidegreesPerSecond(T millidegreespersecond) { - double value = (double) millidegreespersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.MillidegreePerSecond); + return new RotationalSpeed(millidegreespersecond, RotationalSpeedUnit.MillidegreePerSecond); } /// /// Get from MilliradiansPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromMilliradiansPerSecond(QuantityValue milliradianspersecond) + public static RotationalSpeed FromMilliradiansPerSecond(T milliradianspersecond) { - double value = (double) milliradianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.MilliradianPerSecond); + return new RotationalSpeed(milliradianspersecond, RotationalSpeedUnit.MilliradianPerSecond); } /// /// Get from NanodegreesPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromNanodegreesPerSecond(QuantityValue nanodegreespersecond) + public static RotationalSpeed FromNanodegreesPerSecond(T nanodegreespersecond) { - double value = (double) nanodegreespersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.NanodegreePerSecond); + return new RotationalSpeed(nanodegreespersecond, RotationalSpeedUnit.NanodegreePerSecond); } /// /// Get from NanoradiansPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromNanoradiansPerSecond(QuantityValue nanoradianspersecond) + public static RotationalSpeed FromNanoradiansPerSecond(T nanoradianspersecond) { - double value = (double) nanoradianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.NanoradianPerSecond); + return new RotationalSpeed(nanoradianspersecond, RotationalSpeedUnit.NanoradianPerSecond); } /// /// Get from RadiansPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromRadiansPerSecond(QuantityValue radianspersecond) + public static RotationalSpeed FromRadiansPerSecond(T radianspersecond) { - double value = (double) radianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.RadianPerSecond); + return new RotationalSpeed(radianspersecond, RotationalSpeedUnit.RadianPerSecond); } /// /// Get from RevolutionsPerMinute. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromRevolutionsPerMinute(QuantityValue revolutionsperminute) + public static RotationalSpeed FromRevolutionsPerMinute(T revolutionsperminute) { - double value = (double) revolutionsperminute; - return new RotationalSpeed(value, RotationalSpeedUnit.RevolutionPerMinute); + return new RotationalSpeed(revolutionsperminute, RotationalSpeedUnit.RevolutionPerMinute); } /// /// Get from RevolutionsPerSecond. /// /// If value is NaN or Infinity. - public static RotationalSpeed FromRevolutionsPerSecond(QuantityValue revolutionspersecond) + public static RotationalSpeed FromRevolutionsPerSecond(T revolutionspersecond) { - double value = (double) revolutionspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.RevolutionPerSecond); + return new RotationalSpeed(revolutionspersecond, RotationalSpeedUnit.RevolutionPerSecond); } /// @@ -393,9 +377,9 @@ public static RotationalSpeed FromRevolutionsPerSecond(QuantityValue revoluti /// Value to convert from. /// Unit to convert from. /// unit value. - public static RotationalSpeed From(QuantityValue value, RotationalSpeedUnit fromUnit) + public static RotationalSpeed From(T value, RotationalSpeedUnit fromUnit) { - return new RotationalSpeed((double)value, fromUnit); + return new RotationalSpeed(value, fromUnit); } #endregion @@ -549,43 +533,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati /// Negate the value. public static RotationalSpeed operator -(RotationalSpeed right) { - return new RotationalSpeed(-right.Value, right.Unit); + return new RotationalSpeed(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static RotationalSpeed operator +(RotationalSpeed left, RotationalSpeed right) { - return new RotationalSpeed(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new RotationalSpeed(value, left.Unit); } /// Get from subtracting two . public static RotationalSpeed operator -(RotationalSpeed left, RotationalSpeed right) { - return new RotationalSpeed(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new RotationalSpeed(value, left.Unit); } /// Get from multiplying value and . - public static RotationalSpeed operator *(double left, RotationalSpeed right) + public static RotationalSpeed operator *(T left, RotationalSpeed right) { - return new RotationalSpeed(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new RotationalSpeed(value, right.Unit); } /// Get from multiplying value and . - public static RotationalSpeed operator *(RotationalSpeed left, double right) + public static RotationalSpeed operator *(RotationalSpeed left, T right) { - return new RotationalSpeed(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new RotationalSpeed(value, left.Unit); } /// Get from dividing by value. - public static RotationalSpeed operator /(RotationalSpeed left, double right) + public static RotationalSpeed operator /(RotationalSpeed left, T right) { - return new RotationalSpeed(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new RotationalSpeed(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(RotationalSpeed left, RotationalSpeed right) + public static T operator /(RotationalSpeed left, RotationalSpeed right) { - return left.RadiansPerSecond / right.RadiansPerSecond; + return CompiledLambdas.Divide(left.RadiansPerSecond, right.RadiansPerSecond); } #endregion @@ -595,25 +584,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati /// Returns true if less or equal to. public static bool operator <=(RotationalSpeed left, RotationalSpeed right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(RotationalSpeed left, RotationalSpeed right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(RotationalSpeed left, RotationalSpeed right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(RotationalSpeed left, RotationalSpeed right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -642,7 +631,7 @@ public int CompareTo(object obj) /// public int CompareTo(RotationalSpeed other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -659,7 +648,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(RotationalSpeed other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -707,10 +696,8 @@ public bool Equals(RotationalSpeed other, double tolerance, ComparisonType co if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -730,17 +717,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(RotationalSpeedUnit unit) + public T As(RotationalSpeedUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -760,9 +747,14 @@ double IQuantity.As(Enum unit) if(!(unit is RotationalSpeedUnit unitAsRotationalSpeedUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalSpeedUnit)} is supported.", nameof(unit)); - return As(unitAsRotationalSpeedUnit); + var asValue = As(unitAsRotationalSpeedUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(RotationalSpeedUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -803,31 +795,37 @@ public RotationalSpeed ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(RotationalSpeedUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(RotationalSpeedUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case RotationalSpeedUnit.CentiradianPerSecond: return (_value) * 1e-2d; - case RotationalSpeedUnit.DeciradianPerSecond: return (_value) * 1e-1d; - case RotationalSpeedUnit.DegreePerMinute: return (Math.PI/(180*60))*_value; - case RotationalSpeedUnit.DegreePerSecond: return (Math.PI/180)*_value; - case RotationalSpeedUnit.MicrodegreePerSecond: return ((Math.PI/180)*_value) * 1e-6d; - case RotationalSpeedUnit.MicroradianPerSecond: return (_value) * 1e-6d; - case RotationalSpeedUnit.MillidegreePerSecond: return ((Math.PI/180)*_value) * 1e-3d; - case RotationalSpeedUnit.MilliradianPerSecond: return (_value) * 1e-3d; - case RotationalSpeedUnit.NanodegreePerSecond: return ((Math.PI/180)*_value) * 1e-9d; - case RotationalSpeedUnit.NanoradianPerSecond: return (_value) * 1e-9d; - case RotationalSpeedUnit.RadianPerSecond: return _value; - case RotationalSpeedUnit.RevolutionPerMinute: return (_value*6.2831853072)/60; - case RotationalSpeedUnit.RevolutionPerSecond: return _value*6.2831853072; + case RotationalSpeedUnit.CentiradianPerSecond: return (Value) * 1e-2d; + case RotationalSpeedUnit.DeciradianPerSecond: return (Value) * 1e-1d; + case RotationalSpeedUnit.DegreePerMinute: return (Math.PI/(180*60))*Value; + case RotationalSpeedUnit.DegreePerSecond: return (Math.PI/180)*Value; + case RotationalSpeedUnit.MicrodegreePerSecond: return ((Math.PI/180)*Value) * 1e-6d; + case RotationalSpeedUnit.MicroradianPerSecond: return (Value) * 1e-6d; + case RotationalSpeedUnit.MillidegreePerSecond: return ((Math.PI/180)*Value) * 1e-3d; + case RotationalSpeedUnit.MilliradianPerSecond: return (Value) * 1e-3d; + case RotationalSpeedUnit.NanodegreePerSecond: return ((Math.PI/180)*Value) * 1e-9d; + case RotationalSpeedUnit.NanoradianPerSecond: return (Value) * 1e-9d; + case RotationalSpeedUnit.RadianPerSecond: return Value; + case RotationalSpeedUnit.RevolutionPerMinute: return (Value*6.2831853072)/60; + case RotationalSpeedUnit.RevolutionPerSecond: return Value*6.2831853072; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -844,10 +842,10 @@ internal RotationalSpeed ToBaseUnit() return new RotationalSpeed(baseUnitValue, BaseUnit); } - private double GetValueAs(RotationalSpeedUnit unit) + private T GetValueAs(RotationalSpeedUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -967,7 +965,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -982,37 +980,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1036,17 +1034,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs index 859908ba69..96342f5afa 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness /// - public partial struct RotationalStiffness : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct RotationalStiffness : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -63,12 +58,12 @@ static RotationalStiffness() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public RotationalStiffness(double value, RotationalStiffnessUnit unit) + public RotationalStiffness(T value, RotationalStiffnessUnit unit) { if(unit == RotationalStiffnessUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -80,14 +75,14 @@ public RotationalStiffness(double value, RotationalStiffnessUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public RotationalStiffness(double value, UnitSystem unitSystem) + public RotationalStiffness(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -129,7 +124,7 @@ public RotationalStiffness(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeterPerRadian. /// - public static RotationalStiffness Zero { get; } = new RotationalStiffness(0, BaseUnit); + public static RotationalStiffness Zero { get; } = new RotationalStiffness((T)0, BaseUnit); #endregion @@ -138,7 +133,9 @@ public RotationalStiffness(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -168,17 +165,17 @@ public RotationalStiffness(double value, UnitSystem unitSystem) /// /// Get in KilonewtonMetersPerRadian. /// - public double KilonewtonMetersPerRadian => As(RotationalStiffnessUnit.KilonewtonMeterPerRadian); + public T KilonewtonMetersPerRadian => As(RotationalStiffnessUnit.KilonewtonMeterPerRadian); /// /// Get in MeganewtonMetersPerRadian. /// - public double MeganewtonMetersPerRadian => As(RotationalStiffnessUnit.MeganewtonMeterPerRadian); + public T MeganewtonMetersPerRadian => As(RotationalStiffnessUnit.MeganewtonMeterPerRadian); /// /// Get in NewtonMetersPerRadian. /// - public double NewtonMetersPerRadian => As(RotationalStiffnessUnit.NewtonMeterPerRadian); + public T NewtonMetersPerRadian => As(RotationalStiffnessUnit.NewtonMeterPerRadian); #endregion @@ -213,28 +210,25 @@ public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] I /// Get from KilonewtonMetersPerRadian. /// /// If value is NaN or Infinity. - public static RotationalStiffness FromKilonewtonMetersPerRadian(QuantityValue kilonewtonmetersperradian) + public static RotationalStiffness FromKilonewtonMetersPerRadian(T kilonewtonmetersperradian) { - double value = (double) kilonewtonmetersperradian; - return new RotationalStiffness(value, RotationalStiffnessUnit.KilonewtonMeterPerRadian); + return new RotationalStiffness(kilonewtonmetersperradian, RotationalStiffnessUnit.KilonewtonMeterPerRadian); } /// /// Get from MeganewtonMetersPerRadian. /// /// If value is NaN or Infinity. - public static RotationalStiffness FromMeganewtonMetersPerRadian(QuantityValue meganewtonmetersperradian) + public static RotationalStiffness FromMeganewtonMetersPerRadian(T meganewtonmetersperradian) { - double value = (double) meganewtonmetersperradian; - return new RotationalStiffness(value, RotationalStiffnessUnit.MeganewtonMeterPerRadian); + return new RotationalStiffness(meganewtonmetersperradian, RotationalStiffnessUnit.MeganewtonMeterPerRadian); } /// /// Get from NewtonMetersPerRadian. /// /// If value is NaN or Infinity. - public static RotationalStiffness FromNewtonMetersPerRadian(QuantityValue newtonmetersperradian) + public static RotationalStiffness FromNewtonMetersPerRadian(T newtonmetersperradian) { - double value = (double) newtonmetersperradian; - return new RotationalStiffness(value, RotationalStiffnessUnit.NewtonMeterPerRadian); + return new RotationalStiffness(newtonmetersperradian, RotationalStiffnessUnit.NewtonMeterPerRadian); } /// @@ -243,9 +237,9 @@ public static RotationalStiffness FromNewtonMetersPerRadian(QuantityValue new /// Value to convert from. /// Unit to convert from. /// unit value. - public static RotationalStiffness From(QuantityValue value, RotationalStiffnessUnit fromUnit) + public static RotationalStiffness From(T value, RotationalStiffnessUnit fromUnit) { - return new RotationalStiffness((double)value, fromUnit); + return new RotationalStiffness(value, fromUnit); } #endregion @@ -399,43 +393,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati /// Negate the value. public static RotationalStiffness operator -(RotationalStiffness right) { - return new RotationalStiffness(-right.Value, right.Unit); + return new RotationalStiffness(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static RotationalStiffness operator +(RotationalStiffness left, RotationalStiffness right) { - return new RotationalStiffness(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new RotationalStiffness(value, left.Unit); } /// Get from subtracting two . public static RotationalStiffness operator -(RotationalStiffness left, RotationalStiffness right) { - return new RotationalStiffness(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new RotationalStiffness(value, left.Unit); } /// Get from multiplying value and . - public static RotationalStiffness operator *(double left, RotationalStiffness right) + public static RotationalStiffness operator *(T left, RotationalStiffness right) { - return new RotationalStiffness(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new RotationalStiffness(value, right.Unit); } /// Get from multiplying value and . - public static RotationalStiffness operator *(RotationalStiffness left, double right) + public static RotationalStiffness operator *(RotationalStiffness left, T right) { - return new RotationalStiffness(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new RotationalStiffness(value, left.Unit); } /// Get from dividing by value. - public static RotationalStiffness operator /(RotationalStiffness left, double right) + public static RotationalStiffness operator /(RotationalStiffness left, T right) { - return new RotationalStiffness(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new RotationalStiffness(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(RotationalStiffness left, RotationalStiffness right) + public static T operator /(RotationalStiffness left, RotationalStiffness right) { - return left.NewtonMetersPerRadian / right.NewtonMetersPerRadian; + return CompiledLambdas.Divide(left.NewtonMetersPerRadian, right.NewtonMetersPerRadian); } #endregion @@ -445,25 +444,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati /// Returns true if less or equal to. public static bool operator <=(RotationalStiffness left, RotationalStiffness right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(RotationalStiffness left, RotationalStiffness right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(RotationalStiffness left, RotationalStiffness right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(RotationalStiffness left, RotationalStiffness right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -492,7 +491,7 @@ public int CompareTo(object obj) /// public int CompareTo(RotationalStiffness other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -509,7 +508,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(RotationalStiffness other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -557,10 +556,8 @@ public bool Equals(RotationalStiffness other, double tolerance, ComparisonTyp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -580,17 +577,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(RotationalStiffnessUnit unit) + public T As(RotationalStiffnessUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -610,9 +607,14 @@ double IQuantity.As(Enum unit) if(!(unit is RotationalStiffnessUnit unitAsRotationalStiffnessUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalStiffnessUnit)} is supported.", nameof(unit)); - return As(unitAsRotationalStiffnessUnit); + var asValue = As(unitAsRotationalStiffnessUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(RotationalStiffnessUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -653,21 +655,27 @@ public RotationalStiffness ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(RotationalStiffnessUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(RotationalStiffnessUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case RotationalStiffnessUnit.KilonewtonMeterPerRadian: return (_value) * 1e3d; - case RotationalStiffnessUnit.MeganewtonMeterPerRadian: return (_value) * 1e6d; - case RotationalStiffnessUnit.NewtonMeterPerRadian: return _value; + case RotationalStiffnessUnit.KilonewtonMeterPerRadian: return (Value) * 1e3d; + case RotationalStiffnessUnit.MeganewtonMeterPerRadian: return (Value) * 1e6d; + case RotationalStiffnessUnit.NewtonMeterPerRadian: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -684,10 +692,10 @@ internal RotationalStiffness ToBaseUnit() return new RotationalStiffness(baseUnitValue, BaseUnit); } - private double GetValueAs(RotationalStiffnessUnit unit) + private T GetValueAs(RotationalStiffnessUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -797,7 +805,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -812,37 +820,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -866,17 +874,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs index dab6bb3521..0059a36e64 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness /// - public partial struct RotationalStiffnessPerLength : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct RotationalStiffnessPerLength : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -63,12 +58,12 @@ static RotationalStiffnessPerLength() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public RotationalStiffnessPerLength(double value, RotationalStiffnessPerLengthUnit unit) + public RotationalStiffnessPerLength(T value, RotationalStiffnessPerLengthUnit unit) { if(unit == RotationalStiffnessPerLengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -80,14 +75,14 @@ public RotationalStiffnessPerLength(double value, RotationalStiffnessPerLengthUn /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public RotationalStiffnessPerLength(double value, UnitSystem unitSystem) + public RotationalStiffnessPerLength(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -129,7 +124,7 @@ public RotationalStiffnessPerLength(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeterPerRadianPerMeter. /// - public static RotationalStiffnessPerLength Zero { get; } = new RotationalStiffnessPerLength(0, BaseUnit); + public static RotationalStiffnessPerLength Zero { get; } = new RotationalStiffnessPerLength((T)0, BaseUnit); #endregion @@ -138,7 +133,9 @@ public RotationalStiffnessPerLength(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -168,17 +165,17 @@ public RotationalStiffnessPerLength(double value, UnitSystem unitSystem) /// /// Get in KilonewtonMetersPerRadianPerMeter. /// - public double KilonewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter); + public T KilonewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter); /// /// Get in MeganewtonMetersPerRadianPerMeter. /// - public double MeganewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter); + public T MeganewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter); /// /// Get in NewtonMetersPerRadianPerMeter. /// - public double NewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter); + public T NewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter); #endregion @@ -213,28 +210,25 @@ public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit, [Can /// Get from KilonewtonMetersPerRadianPerMeter. /// /// If value is NaN or Infinity. - public static RotationalStiffnessPerLength FromKilonewtonMetersPerRadianPerMeter(QuantityValue kilonewtonmetersperradianpermeter) + public static RotationalStiffnessPerLength FromKilonewtonMetersPerRadianPerMeter(T kilonewtonmetersperradianpermeter) { - double value = (double) kilonewtonmetersperradianpermeter; - return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter); + return new RotationalStiffnessPerLength(kilonewtonmetersperradianpermeter, RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter); } /// /// Get from MeganewtonMetersPerRadianPerMeter. /// /// If value is NaN or Infinity. - public static RotationalStiffnessPerLength FromMeganewtonMetersPerRadianPerMeter(QuantityValue meganewtonmetersperradianpermeter) + public static RotationalStiffnessPerLength FromMeganewtonMetersPerRadianPerMeter(T meganewtonmetersperradianpermeter) { - double value = (double) meganewtonmetersperradianpermeter; - return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter); + return new RotationalStiffnessPerLength(meganewtonmetersperradianpermeter, RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter); } /// /// Get from NewtonMetersPerRadianPerMeter. /// /// If value is NaN or Infinity. - public static RotationalStiffnessPerLength FromNewtonMetersPerRadianPerMeter(QuantityValue newtonmetersperradianpermeter) + public static RotationalStiffnessPerLength FromNewtonMetersPerRadianPerMeter(T newtonmetersperradianpermeter) { - double value = (double) newtonmetersperradianpermeter; - return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter); + return new RotationalStiffnessPerLength(newtonmetersperradianpermeter, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter); } /// @@ -243,9 +237,9 @@ public static RotationalStiffnessPerLength FromNewtonMetersPerRadianPerMeter( /// Value to convert from. /// Unit to convert from. /// unit value. - public static RotationalStiffnessPerLength From(QuantityValue value, RotationalStiffnessPerLengthUnit fromUnit) + public static RotationalStiffnessPerLength From(T value, RotationalStiffnessPerLengthUnit fromUnit) { - return new RotationalStiffnessPerLength((double)value, fromUnit); + return new RotationalStiffnessPerLength(value, fromUnit); } #endregion @@ -399,43 +393,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati /// Negate the value. public static RotationalStiffnessPerLength operator -(RotationalStiffnessPerLength right) { - return new RotationalStiffnessPerLength(-right.Value, right.Unit); + return new RotationalStiffnessPerLength(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static RotationalStiffnessPerLength operator +(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { - return new RotationalStiffnessPerLength(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new RotationalStiffnessPerLength(value, left.Unit); } /// Get from subtracting two . public static RotationalStiffnessPerLength operator -(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { - return new RotationalStiffnessPerLength(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new RotationalStiffnessPerLength(value, left.Unit); } /// Get from multiplying value and . - public static RotationalStiffnessPerLength operator *(double left, RotationalStiffnessPerLength right) + public static RotationalStiffnessPerLength operator *(T left, RotationalStiffnessPerLength right) { - return new RotationalStiffnessPerLength(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new RotationalStiffnessPerLength(value, right.Unit); } /// Get from multiplying value and . - public static RotationalStiffnessPerLength operator *(RotationalStiffnessPerLength left, double right) + public static RotationalStiffnessPerLength operator *(RotationalStiffnessPerLength left, T right) { - return new RotationalStiffnessPerLength(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new RotationalStiffnessPerLength(value, left.Unit); } /// Get from dividing by value. - public static RotationalStiffnessPerLength operator /(RotationalStiffnessPerLength left, double right) + public static RotationalStiffnessPerLength operator /(RotationalStiffnessPerLength left, T right) { - return new RotationalStiffnessPerLength(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new RotationalStiffnessPerLength(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + public static T operator /(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { - return left.NewtonMetersPerRadianPerMeter / right.NewtonMetersPerRadianPerMeter; + return CompiledLambdas.Divide(left.NewtonMetersPerRadianPerMeter, right.NewtonMetersPerRadianPerMeter); } #endregion @@ -445,25 +444,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati /// Returns true if less or equal to. public static bool operator <=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -492,7 +491,7 @@ public int CompareTo(object obj) /// public int CompareTo(RotationalStiffnessPerLength other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -509,7 +508,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(RotationalStiffnessPerLength other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -557,10 +556,8 @@ public bool Equals(RotationalStiffnessPerLength other, double tolerance, Comp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -580,17 +577,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(RotationalStiffnessPerLengthUnit unit) + public T As(RotationalStiffnessPerLengthUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -610,9 +607,14 @@ double IQuantity.As(Enum unit) if(!(unit is RotationalStiffnessPerLengthUnit unitAsRotationalStiffnessPerLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalStiffnessPerLengthUnit)} is supported.", nameof(unit)); - return As(unitAsRotationalStiffnessPerLengthUnit); + var asValue = As(unitAsRotationalStiffnessPerLengthUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(RotationalStiffnessPerLengthUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -653,21 +655,27 @@ public RotationalStiffnessPerLength ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(RotationalStiffnessPerLengthUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(RotationalStiffnessPerLengthUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter: return (_value) * 1e3d; - case RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter: return (_value) * 1e6d; - case RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter: return _value; + case RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter: return (Value) * 1e3d; + case RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter: return (Value) * 1e6d; + case RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -684,10 +692,10 @@ internal RotationalStiffnessPerLength ToBaseUnit() return new RotationalStiffnessPerLength(baseUnitValue, BaseUnit); } - private double GetValueAs(RotationalStiffnessPerLengthUnit unit) + private T GetValueAs(RotationalStiffnessPerLengthUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -797,7 +805,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -812,37 +820,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -866,17 +874,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs index 4bfa23ec9f..8f263259ac 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Solid_angle /// - public partial struct SolidAngle : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct SolidAngle : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -64,12 +59,12 @@ static SolidAngle() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public SolidAngle(double value, SolidAngleUnit unit) + public SolidAngle(T value, SolidAngleUnit unit) { if(unit == SolidAngleUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -81,14 +76,14 @@ public SolidAngle(double value, SolidAngleUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public SolidAngle(double value, UnitSystem unitSystem) + public SolidAngle(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -130,7 +125,7 @@ public SolidAngle(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Steradian. /// - public static SolidAngle Zero { get; } = new SolidAngle(0, BaseUnit); + public static SolidAngle Zero { get; } = new SolidAngle((T)0, BaseUnit); #endregion @@ -139,7 +134,9 @@ public SolidAngle(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -169,7 +166,7 @@ public SolidAngle(double value, UnitSystem unitSystem) /// /// Get in Steradians. /// - public double Steradians => As(SolidAngleUnit.Steradian); + public T Steradians => As(SolidAngleUnit.Steradian); #endregion @@ -204,10 +201,9 @@ public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] IFormatPro /// Get from Steradians. /// /// If value is NaN or Infinity. - public static SolidAngle FromSteradians(QuantityValue steradians) + public static SolidAngle FromSteradians(T steradians) { - double value = (double) steradians; - return new SolidAngle(value, SolidAngleUnit.Steradian); + return new SolidAngle(steradians, SolidAngleUnit.Steradian); } /// @@ -216,9 +212,9 @@ public static SolidAngle FromSteradians(QuantityValue steradians) /// Value to convert from. /// Unit to convert from. /// unit value. - public static SolidAngle From(QuantityValue value, SolidAngleUnit fromUnit) + public static SolidAngle From(T value, SolidAngleUnit fromUnit) { - return new SolidAngle((double)value, fromUnit); + return new SolidAngle(value, fromUnit); } #endregion @@ -372,43 +368,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out SolidA /// Negate the value. public static SolidAngle operator -(SolidAngle right) { - return new SolidAngle(-right.Value, right.Unit); + return new SolidAngle(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static SolidAngle operator +(SolidAngle left, SolidAngle right) { - return new SolidAngle(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new SolidAngle(value, left.Unit); } /// Get from subtracting two . public static SolidAngle operator -(SolidAngle left, SolidAngle right) { - return new SolidAngle(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new SolidAngle(value, left.Unit); } /// Get from multiplying value and . - public static SolidAngle operator *(double left, SolidAngle right) + public static SolidAngle operator *(T left, SolidAngle right) { - return new SolidAngle(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new SolidAngle(value, right.Unit); } /// Get from multiplying value and . - public static SolidAngle operator *(SolidAngle left, double right) + public static SolidAngle operator *(SolidAngle left, T right) { - return new SolidAngle(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new SolidAngle(value, left.Unit); } /// Get from dividing by value. - public static SolidAngle operator /(SolidAngle left, double right) + public static SolidAngle operator /(SolidAngle left, T right) { - return new SolidAngle(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new SolidAngle(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(SolidAngle left, SolidAngle right) + public static T operator /(SolidAngle left, SolidAngle right) { - return left.Steradians / right.Steradians; + return CompiledLambdas.Divide(left.Steradians, right.Steradians); } #endregion @@ -418,25 +419,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out SolidA /// Returns true if less or equal to. public static bool operator <=(SolidAngle left, SolidAngle right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(SolidAngle left, SolidAngle right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(SolidAngle left, SolidAngle right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(SolidAngle left, SolidAngle right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -465,7 +466,7 @@ public int CompareTo(object obj) /// public int CompareTo(SolidAngle other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -482,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(SolidAngle other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -530,10 +531,8 @@ public bool Equals(SolidAngle other, double tolerance, ComparisonType compari if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -553,17 +552,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(SolidAngleUnit unit) + public T As(SolidAngleUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -583,9 +582,14 @@ double IQuantity.As(Enum unit) if(!(unit is SolidAngleUnit unitAsSolidAngleUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SolidAngleUnit)} is supported.", nameof(unit)); - return As(unitAsSolidAngleUnit); + var asValue = As(unitAsSolidAngleUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(SolidAngleUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -626,19 +630,25 @@ public SolidAngle ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(SolidAngleUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(SolidAngleUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case SolidAngleUnit.Steradian: return _value; + case SolidAngleUnit.Steradian: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -655,10 +665,10 @@ internal SolidAngle ToBaseUnit() return new SolidAngle(baseUnitValue, BaseUnit); } - private double GetValueAs(SolidAngleUnit unit) + private T GetValueAs(SolidAngleUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -766,7 +776,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -781,37 +791,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -835,17 +845,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs index a11868030f..0e368fe495 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Specific_energy /// - public partial struct SpecificEnergy : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct SpecificEnergy : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -72,12 +67,12 @@ static SpecificEnergy() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public SpecificEnergy(double value, SpecificEnergyUnit unit) + public SpecificEnergy(T value, SpecificEnergyUnit unit) { if(unit == SpecificEnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -89,14 +84,14 @@ public SpecificEnergy(double value, SpecificEnergyUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public SpecificEnergy(double value, UnitSystem unitSystem) + public SpecificEnergy(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -138,7 +133,7 @@ public SpecificEnergy(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKilogram. /// - public static SpecificEnergy Zero { get; } = new SpecificEnergy(0, BaseUnit); + public static SpecificEnergy Zero { get; } = new SpecificEnergy((T)0, BaseUnit); #endregion @@ -147,7 +142,9 @@ public SpecificEnergy(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -177,47 +174,47 @@ public SpecificEnergy(double value, UnitSystem unitSystem) /// /// Get in BtuPerPound. /// - public double BtuPerPound => As(SpecificEnergyUnit.BtuPerPound); + public T BtuPerPound => As(SpecificEnergyUnit.BtuPerPound); /// /// Get in CaloriesPerGram. /// - public double CaloriesPerGram => As(SpecificEnergyUnit.CaloriePerGram); + public T CaloriesPerGram => As(SpecificEnergyUnit.CaloriePerGram); /// /// Get in JoulesPerKilogram. /// - public double JoulesPerKilogram => As(SpecificEnergyUnit.JoulePerKilogram); + public T JoulesPerKilogram => As(SpecificEnergyUnit.JoulePerKilogram); /// /// Get in KilocaloriesPerGram. /// - public double KilocaloriesPerGram => As(SpecificEnergyUnit.KilocaloriePerGram); + public T KilocaloriesPerGram => As(SpecificEnergyUnit.KilocaloriePerGram); /// /// Get in KilojoulesPerKilogram. /// - public double KilojoulesPerKilogram => As(SpecificEnergyUnit.KilojoulePerKilogram); + public T KilojoulesPerKilogram => As(SpecificEnergyUnit.KilojoulePerKilogram); /// /// Get in KilowattHoursPerKilogram. /// - public double KilowattHoursPerKilogram => As(SpecificEnergyUnit.KilowattHourPerKilogram); + public T KilowattHoursPerKilogram => As(SpecificEnergyUnit.KilowattHourPerKilogram); /// /// Get in MegajoulesPerKilogram. /// - public double MegajoulesPerKilogram => As(SpecificEnergyUnit.MegajoulePerKilogram); + public T MegajoulesPerKilogram => As(SpecificEnergyUnit.MegajoulePerKilogram); /// /// Get in MegawattHoursPerKilogram. /// - public double MegawattHoursPerKilogram => As(SpecificEnergyUnit.MegawattHourPerKilogram); + public T MegawattHoursPerKilogram => As(SpecificEnergyUnit.MegawattHourPerKilogram); /// /// Get in WattHoursPerKilogram. /// - public double WattHoursPerKilogram => As(SpecificEnergyUnit.WattHourPerKilogram); + public T WattHoursPerKilogram => As(SpecificEnergyUnit.WattHourPerKilogram); #endregion @@ -252,82 +249,73 @@ public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] IForma /// Get from BtuPerPound. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromBtuPerPound(QuantityValue btuperpound) + public static SpecificEnergy FromBtuPerPound(T btuperpound) { - double value = (double) btuperpound; - return new SpecificEnergy(value, SpecificEnergyUnit.BtuPerPound); + return new SpecificEnergy(btuperpound, SpecificEnergyUnit.BtuPerPound); } /// /// Get from CaloriesPerGram. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromCaloriesPerGram(QuantityValue caloriespergram) + public static SpecificEnergy FromCaloriesPerGram(T caloriespergram) { - double value = (double) caloriespergram; - return new SpecificEnergy(value, SpecificEnergyUnit.CaloriePerGram); + return new SpecificEnergy(caloriespergram, SpecificEnergyUnit.CaloriePerGram); } /// /// Get from JoulesPerKilogram. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromJoulesPerKilogram(QuantityValue joulesperkilogram) + public static SpecificEnergy FromJoulesPerKilogram(T joulesperkilogram) { - double value = (double) joulesperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.JoulePerKilogram); + return new SpecificEnergy(joulesperkilogram, SpecificEnergyUnit.JoulePerKilogram); } /// /// Get from KilocaloriesPerGram. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromKilocaloriesPerGram(QuantityValue kilocaloriespergram) + public static SpecificEnergy FromKilocaloriesPerGram(T kilocaloriespergram) { - double value = (double) kilocaloriespergram; - return new SpecificEnergy(value, SpecificEnergyUnit.KilocaloriePerGram); + return new SpecificEnergy(kilocaloriespergram, SpecificEnergyUnit.KilocaloriePerGram); } /// /// Get from KilojoulesPerKilogram. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromKilojoulesPerKilogram(QuantityValue kilojoulesperkilogram) + public static SpecificEnergy FromKilojoulesPerKilogram(T kilojoulesperkilogram) { - double value = (double) kilojoulesperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.KilojoulePerKilogram); + return new SpecificEnergy(kilojoulesperkilogram, SpecificEnergyUnit.KilojoulePerKilogram); } /// /// Get from KilowattHoursPerKilogram. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromKilowattHoursPerKilogram(QuantityValue kilowatthoursperkilogram) + public static SpecificEnergy FromKilowattHoursPerKilogram(T kilowatthoursperkilogram) { - double value = (double) kilowatthoursperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.KilowattHourPerKilogram); + return new SpecificEnergy(kilowatthoursperkilogram, SpecificEnergyUnit.KilowattHourPerKilogram); } /// /// Get from MegajoulesPerKilogram. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromMegajoulesPerKilogram(QuantityValue megajoulesperkilogram) + public static SpecificEnergy FromMegajoulesPerKilogram(T megajoulesperkilogram) { - double value = (double) megajoulesperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.MegajoulePerKilogram); + return new SpecificEnergy(megajoulesperkilogram, SpecificEnergyUnit.MegajoulePerKilogram); } /// /// Get from MegawattHoursPerKilogram. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromMegawattHoursPerKilogram(QuantityValue megawatthoursperkilogram) + public static SpecificEnergy FromMegawattHoursPerKilogram(T megawatthoursperkilogram) { - double value = (double) megawatthoursperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.MegawattHourPerKilogram); + return new SpecificEnergy(megawatthoursperkilogram, SpecificEnergyUnit.MegawattHourPerKilogram); } /// /// Get from WattHoursPerKilogram. /// /// If value is NaN or Infinity. - public static SpecificEnergy FromWattHoursPerKilogram(QuantityValue watthoursperkilogram) + public static SpecificEnergy FromWattHoursPerKilogram(T watthoursperkilogram) { - double value = (double) watthoursperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.WattHourPerKilogram); + return new SpecificEnergy(watthoursperkilogram, SpecificEnergyUnit.WattHourPerKilogram); } /// @@ -336,9 +324,9 @@ public static SpecificEnergy FromWattHoursPerKilogram(QuantityValue watthours /// Value to convert from. /// Unit to convert from. /// unit value. - public static SpecificEnergy From(QuantityValue value, SpecificEnergyUnit fromUnit) + public static SpecificEnergy From(T value, SpecificEnergyUnit fromUnit) { - return new SpecificEnergy((double)value, fromUnit); + return new SpecificEnergy(value, fromUnit); } #endregion @@ -492,43 +480,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif /// Negate the value. public static SpecificEnergy operator -(SpecificEnergy right) { - return new SpecificEnergy(-right.Value, right.Unit); + return new SpecificEnergy(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static SpecificEnergy operator +(SpecificEnergy left, SpecificEnergy right) { - return new SpecificEnergy(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new SpecificEnergy(value, left.Unit); } /// Get from subtracting two . public static SpecificEnergy operator -(SpecificEnergy left, SpecificEnergy right) { - return new SpecificEnergy(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new SpecificEnergy(value, left.Unit); } /// Get from multiplying value and . - public static SpecificEnergy operator *(double left, SpecificEnergy right) + public static SpecificEnergy operator *(T left, SpecificEnergy right) { - return new SpecificEnergy(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new SpecificEnergy(value, right.Unit); } /// Get from multiplying value and . - public static SpecificEnergy operator *(SpecificEnergy left, double right) + public static SpecificEnergy operator *(SpecificEnergy left, T right) { - return new SpecificEnergy(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new SpecificEnergy(value, left.Unit); } /// Get from dividing by value. - public static SpecificEnergy operator /(SpecificEnergy left, double right) + public static SpecificEnergy operator /(SpecificEnergy left, T right) { - return new SpecificEnergy(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new SpecificEnergy(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(SpecificEnergy left, SpecificEnergy right) + public static T operator /(SpecificEnergy left, SpecificEnergy right) { - return left.JoulesPerKilogram / right.JoulesPerKilogram; + return CompiledLambdas.Divide(left.JoulesPerKilogram, right.JoulesPerKilogram); } #endregion @@ -538,25 +531,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif /// Returns true if less or equal to. public static bool operator <=(SpecificEnergy left, SpecificEnergy right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(SpecificEnergy left, SpecificEnergy right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(SpecificEnergy left, SpecificEnergy right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(SpecificEnergy left, SpecificEnergy right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -585,7 +578,7 @@ public int CompareTo(object obj) /// public int CompareTo(SpecificEnergy other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -602,7 +595,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(SpecificEnergy other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -650,10 +643,8 @@ public bool Equals(SpecificEnergy other, double tolerance, ComparisonType com if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -673,17 +664,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(SpecificEnergyUnit unit) + public T As(SpecificEnergyUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -703,9 +694,14 @@ double IQuantity.As(Enum unit) if(!(unit is SpecificEnergyUnit unitAsSpecificEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificEnergyUnit)} is supported.", nameof(unit)); - return As(unitAsSpecificEnergyUnit); + var asValue = As(unitAsSpecificEnergyUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(SpecificEnergyUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -746,27 +742,33 @@ public SpecificEnergy ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(SpecificEnergyUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(SpecificEnergyUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case SpecificEnergyUnit.BtuPerPound: return _value*2326.000075362; - case SpecificEnergyUnit.CaloriePerGram: return _value*4.184e3; - case SpecificEnergyUnit.JoulePerKilogram: return _value; - case SpecificEnergyUnit.KilocaloriePerGram: return (_value*4.184e3) * 1e3d; - case SpecificEnergyUnit.KilojoulePerKilogram: return (_value) * 1e3d; - case SpecificEnergyUnit.KilowattHourPerKilogram: return (_value*3.6e3) * 1e3d; - case SpecificEnergyUnit.MegajoulePerKilogram: return (_value) * 1e6d; - case SpecificEnergyUnit.MegawattHourPerKilogram: return (_value*3.6e3) * 1e6d; - case SpecificEnergyUnit.WattHourPerKilogram: return _value*3.6e3; + case SpecificEnergyUnit.BtuPerPound: return Value*2326.000075362; + case SpecificEnergyUnit.CaloriePerGram: return Value*4.184e3; + case SpecificEnergyUnit.JoulePerKilogram: return Value; + case SpecificEnergyUnit.KilocaloriePerGram: return (Value*4.184e3) * 1e3d; + case SpecificEnergyUnit.KilojoulePerKilogram: return (Value) * 1e3d; + case SpecificEnergyUnit.KilowattHourPerKilogram: return (Value*3.6e3) * 1e3d; + case SpecificEnergyUnit.MegajoulePerKilogram: return (Value) * 1e6d; + case SpecificEnergyUnit.MegawattHourPerKilogram: return (Value*3.6e3) * 1e6d; + case SpecificEnergyUnit.WattHourPerKilogram: return Value*3.6e3; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -783,10 +785,10 @@ internal SpecificEnergy ToBaseUnit() return new SpecificEnergy(baseUnitValue, BaseUnit); } - private double GetValueAs(SpecificEnergyUnit unit) + private T GetValueAs(SpecificEnergyUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -902,7 +904,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -917,37 +919,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -971,17 +973,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs index b2d770a772..25d870ba94 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Specific entropy is an amount of energy required to raise temperature of a substance by 1 Kelvin per unit mass. /// - public partial struct SpecificEntropy : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct SpecificEntropy : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -69,12 +64,12 @@ static SpecificEntropy() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public SpecificEntropy(double value, SpecificEntropyUnit unit) + public SpecificEntropy(T value, SpecificEntropyUnit unit) { if(unit == SpecificEntropyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -86,14 +81,14 @@ public SpecificEntropy(double value, SpecificEntropyUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public SpecificEntropy(double value, UnitSystem unitSystem) + public SpecificEntropy(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -135,7 +130,7 @@ public SpecificEntropy(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKilogramKelvin. /// - public static SpecificEntropy Zero { get; } = new SpecificEntropy(0, BaseUnit); + public static SpecificEntropy Zero { get; } = new SpecificEntropy((T)0, BaseUnit); #endregion @@ -144,7 +139,9 @@ public SpecificEntropy(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -174,47 +171,47 @@ public SpecificEntropy(double value, UnitSystem unitSystem) /// /// Get in BtusPerPoundFahrenheit. /// - public double BtusPerPoundFahrenheit => As(SpecificEntropyUnit.BtuPerPoundFahrenheit); + public T BtusPerPoundFahrenheit => As(SpecificEntropyUnit.BtuPerPoundFahrenheit); /// /// Get in CaloriesPerGramKelvin. /// - public double CaloriesPerGramKelvin => As(SpecificEntropyUnit.CaloriePerGramKelvin); + public T CaloriesPerGramKelvin => As(SpecificEntropyUnit.CaloriePerGramKelvin); /// /// Get in JoulesPerKilogramDegreeCelsius. /// - public double JoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.JoulePerKilogramDegreeCelsius); + public T JoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.JoulePerKilogramDegreeCelsius); /// /// Get in JoulesPerKilogramKelvin. /// - public double JoulesPerKilogramKelvin => As(SpecificEntropyUnit.JoulePerKilogramKelvin); + public T JoulesPerKilogramKelvin => As(SpecificEntropyUnit.JoulePerKilogramKelvin); /// /// Get in KilocaloriesPerGramKelvin. /// - public double KilocaloriesPerGramKelvin => As(SpecificEntropyUnit.KilocaloriePerGramKelvin); + public T KilocaloriesPerGramKelvin => As(SpecificEntropyUnit.KilocaloriePerGramKelvin); /// /// Get in KilojoulesPerKilogramDegreeCelsius. /// - public double KilojoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius); + public T KilojoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius); /// /// Get in KilojoulesPerKilogramKelvin. /// - public double KilojoulesPerKilogramKelvin => As(SpecificEntropyUnit.KilojoulePerKilogramKelvin); + public T KilojoulesPerKilogramKelvin => As(SpecificEntropyUnit.KilojoulePerKilogramKelvin); /// /// Get in MegajoulesPerKilogramDegreeCelsius. /// - public double MegajoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius); + public T MegajoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius); /// /// Get in MegajoulesPerKilogramKelvin. /// - public double MegajoulesPerKilogramKelvin => As(SpecificEntropyUnit.MegajoulePerKilogramKelvin); + public T MegajoulesPerKilogramKelvin => As(SpecificEntropyUnit.MegajoulePerKilogramKelvin); #endregion @@ -249,82 +246,73 @@ public static string GetAbbreviation(SpecificEntropyUnit unit, [CanBeNull] IForm /// Get from BtusPerPoundFahrenheit. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromBtusPerPoundFahrenheit(QuantityValue btusperpoundfahrenheit) + public static SpecificEntropy FromBtusPerPoundFahrenheit(T btusperpoundfahrenheit) { - double value = (double) btusperpoundfahrenheit; - return new SpecificEntropy(value, SpecificEntropyUnit.BtuPerPoundFahrenheit); + return new SpecificEntropy(btusperpoundfahrenheit, SpecificEntropyUnit.BtuPerPoundFahrenheit); } /// /// Get from CaloriesPerGramKelvin. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromCaloriesPerGramKelvin(QuantityValue caloriespergramkelvin) + public static SpecificEntropy FromCaloriesPerGramKelvin(T caloriespergramkelvin) { - double value = (double) caloriespergramkelvin; - return new SpecificEntropy(value, SpecificEntropyUnit.CaloriePerGramKelvin); + return new SpecificEntropy(caloriespergramkelvin, SpecificEntropyUnit.CaloriePerGramKelvin); } /// /// Get from JoulesPerKilogramDegreeCelsius. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromJoulesPerKilogramDegreeCelsius(QuantityValue joulesperkilogramdegreecelsius) + public static SpecificEntropy FromJoulesPerKilogramDegreeCelsius(T joulesperkilogramdegreecelsius) { - double value = (double) joulesperkilogramdegreecelsius; - return new SpecificEntropy(value, SpecificEntropyUnit.JoulePerKilogramDegreeCelsius); + return new SpecificEntropy(joulesperkilogramdegreecelsius, SpecificEntropyUnit.JoulePerKilogramDegreeCelsius); } /// /// Get from JoulesPerKilogramKelvin. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromJoulesPerKilogramKelvin(QuantityValue joulesperkilogramkelvin) + public static SpecificEntropy FromJoulesPerKilogramKelvin(T joulesperkilogramkelvin) { - double value = (double) joulesperkilogramkelvin; - return new SpecificEntropy(value, SpecificEntropyUnit.JoulePerKilogramKelvin); + return new SpecificEntropy(joulesperkilogramkelvin, SpecificEntropyUnit.JoulePerKilogramKelvin); } /// /// Get from KilocaloriesPerGramKelvin. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromKilocaloriesPerGramKelvin(QuantityValue kilocaloriespergramkelvin) + public static SpecificEntropy FromKilocaloriesPerGramKelvin(T kilocaloriespergramkelvin) { - double value = (double) kilocaloriespergramkelvin; - return new SpecificEntropy(value, SpecificEntropyUnit.KilocaloriePerGramKelvin); + return new SpecificEntropy(kilocaloriespergramkelvin, SpecificEntropyUnit.KilocaloriePerGramKelvin); } /// /// Get from KilojoulesPerKilogramDegreeCelsius. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromKilojoulesPerKilogramDegreeCelsius(QuantityValue kilojoulesperkilogramdegreecelsius) + public static SpecificEntropy FromKilojoulesPerKilogramDegreeCelsius(T kilojoulesperkilogramdegreecelsius) { - double value = (double) kilojoulesperkilogramdegreecelsius; - return new SpecificEntropy(value, SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius); + return new SpecificEntropy(kilojoulesperkilogramdegreecelsius, SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius); } /// /// Get from KilojoulesPerKilogramKelvin. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromKilojoulesPerKilogramKelvin(QuantityValue kilojoulesperkilogramkelvin) + public static SpecificEntropy FromKilojoulesPerKilogramKelvin(T kilojoulesperkilogramkelvin) { - double value = (double) kilojoulesperkilogramkelvin; - return new SpecificEntropy(value, SpecificEntropyUnit.KilojoulePerKilogramKelvin); + return new SpecificEntropy(kilojoulesperkilogramkelvin, SpecificEntropyUnit.KilojoulePerKilogramKelvin); } /// /// Get from MegajoulesPerKilogramDegreeCelsius. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromMegajoulesPerKilogramDegreeCelsius(QuantityValue megajoulesperkilogramdegreecelsius) + public static SpecificEntropy FromMegajoulesPerKilogramDegreeCelsius(T megajoulesperkilogramdegreecelsius) { - double value = (double) megajoulesperkilogramdegreecelsius; - return new SpecificEntropy(value, SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius); + return new SpecificEntropy(megajoulesperkilogramdegreecelsius, SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius); } /// /// Get from MegajoulesPerKilogramKelvin. /// /// If value is NaN or Infinity. - public static SpecificEntropy FromMegajoulesPerKilogramKelvin(QuantityValue megajoulesperkilogramkelvin) + public static SpecificEntropy FromMegajoulesPerKilogramKelvin(T megajoulesperkilogramkelvin) { - double value = (double) megajoulesperkilogramkelvin; - return new SpecificEntropy(value, SpecificEntropyUnit.MegajoulePerKilogramKelvin); + return new SpecificEntropy(megajoulesperkilogramkelvin, SpecificEntropyUnit.MegajoulePerKilogramKelvin); } /// @@ -333,9 +321,9 @@ public static SpecificEntropy FromMegajoulesPerKilogramKelvin(QuantityValue m /// Value to convert from. /// Unit to convert from. /// unit value. - public static SpecificEntropy From(QuantityValue value, SpecificEntropyUnit fromUnit) + public static SpecificEntropy From(T value, SpecificEntropyUnit fromUnit) { - return new SpecificEntropy((double)value, fromUnit); + return new SpecificEntropy(value, fromUnit); } #endregion @@ -489,43 +477,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif /// Negate the value. public static SpecificEntropy operator -(SpecificEntropy right) { - return new SpecificEntropy(-right.Value, right.Unit); + return new SpecificEntropy(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static SpecificEntropy operator +(SpecificEntropy left, SpecificEntropy right) { - return new SpecificEntropy(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new SpecificEntropy(value, left.Unit); } /// Get from subtracting two . public static SpecificEntropy operator -(SpecificEntropy left, SpecificEntropy right) { - return new SpecificEntropy(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new SpecificEntropy(value, left.Unit); } /// Get from multiplying value and . - public static SpecificEntropy operator *(double left, SpecificEntropy right) + public static SpecificEntropy operator *(T left, SpecificEntropy right) { - return new SpecificEntropy(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new SpecificEntropy(value, right.Unit); } /// Get from multiplying value and . - public static SpecificEntropy operator *(SpecificEntropy left, double right) + public static SpecificEntropy operator *(SpecificEntropy left, T right) { - return new SpecificEntropy(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new SpecificEntropy(value, left.Unit); } /// Get from dividing by value. - public static SpecificEntropy operator /(SpecificEntropy left, double right) + public static SpecificEntropy operator /(SpecificEntropy left, T right) { - return new SpecificEntropy(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new SpecificEntropy(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(SpecificEntropy left, SpecificEntropy right) + public static T operator /(SpecificEntropy left, SpecificEntropy right) { - return left.JoulesPerKilogramKelvin / right.JoulesPerKilogramKelvin; + return CompiledLambdas.Divide(left.JoulesPerKilogramKelvin, right.JoulesPerKilogramKelvin); } #endregion @@ -535,25 +528,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif /// Returns true if less or equal to. public static bool operator <=(SpecificEntropy left, SpecificEntropy right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(SpecificEntropy left, SpecificEntropy right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(SpecificEntropy left, SpecificEntropy right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(SpecificEntropy left, SpecificEntropy right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -582,7 +575,7 @@ public int CompareTo(object obj) /// public int CompareTo(SpecificEntropy other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -599,7 +592,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(SpecificEntropy other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -647,10 +640,8 @@ public bool Equals(SpecificEntropy other, double tolerance, ComparisonType co if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -670,17 +661,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(SpecificEntropyUnit unit) + public T As(SpecificEntropyUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -700,9 +691,14 @@ double IQuantity.As(Enum unit) if(!(unit is SpecificEntropyUnit unitAsSpecificEntropyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificEntropyUnit)} is supported.", nameof(unit)); - return As(unitAsSpecificEntropyUnit); + var asValue = As(unitAsSpecificEntropyUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(SpecificEntropyUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -743,27 +739,33 @@ public SpecificEntropy ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(SpecificEntropyUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(SpecificEntropyUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case SpecificEntropyUnit.BtuPerPoundFahrenheit: return _value * 4.1868e3; - case SpecificEntropyUnit.CaloriePerGramKelvin: return _value*4.184e3; - case SpecificEntropyUnit.JoulePerKilogramDegreeCelsius: return _value; - case SpecificEntropyUnit.JoulePerKilogramKelvin: return _value; - case SpecificEntropyUnit.KilocaloriePerGramKelvin: return (_value*4.184e3) * 1e3d; - case SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius: return (_value) * 1e3d; - case SpecificEntropyUnit.KilojoulePerKilogramKelvin: return (_value) * 1e3d; - case SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius: return (_value) * 1e6d; - case SpecificEntropyUnit.MegajoulePerKilogramKelvin: return (_value) * 1e6d; + case SpecificEntropyUnit.BtuPerPoundFahrenheit: return Value * 4.1868e3; + case SpecificEntropyUnit.CaloriePerGramKelvin: return Value*4.184e3; + case SpecificEntropyUnit.JoulePerKilogramDegreeCelsius: return Value; + case SpecificEntropyUnit.JoulePerKilogramKelvin: return Value; + case SpecificEntropyUnit.KilocaloriePerGramKelvin: return (Value*4.184e3) * 1e3d; + case SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius: return (Value) * 1e3d; + case SpecificEntropyUnit.KilojoulePerKilogramKelvin: return (Value) * 1e3d; + case SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius: return (Value) * 1e6d; + case SpecificEntropyUnit.MegajoulePerKilogramKelvin: return (Value) * 1e6d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -780,10 +782,10 @@ internal SpecificEntropy ToBaseUnit() return new SpecificEntropy(baseUnitValue, BaseUnit); } - private double GetValueAs(SpecificEntropyUnit unit) + private T GetValueAs(SpecificEntropyUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -899,7 +901,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -914,37 +916,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -968,17 +970,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs index a28109c12c..77df7227bc 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// In thermodynamics, the specific volume of a substance is the ratio of the substance's volume to its mass. It is the reciprocal of density and an intrinsic property of matter as well. /// - public partial struct SpecificVolume : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct SpecificVolume : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -63,12 +58,12 @@ static SpecificVolume() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public SpecificVolume(double value, SpecificVolumeUnit unit) + public SpecificVolume(T value, SpecificVolumeUnit unit) { if(unit == SpecificVolumeUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -80,14 +75,14 @@ public SpecificVolume(double value, SpecificVolumeUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public SpecificVolume(double value, UnitSystem unitSystem) + public SpecificVolume(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -129,7 +124,7 @@ public SpecificVolume(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerKilogram. /// - public static SpecificVolume Zero { get; } = new SpecificVolume(0, BaseUnit); + public static SpecificVolume Zero { get; } = new SpecificVolume((T)0, BaseUnit); #endregion @@ -138,7 +133,9 @@ public SpecificVolume(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -168,17 +165,17 @@ public SpecificVolume(double value, UnitSystem unitSystem) /// /// Get in CubicFeetPerPound. /// - public double CubicFeetPerPound => As(SpecificVolumeUnit.CubicFootPerPound); + public T CubicFeetPerPound => As(SpecificVolumeUnit.CubicFootPerPound); /// /// Get in CubicMetersPerKilogram. /// - public double CubicMetersPerKilogram => As(SpecificVolumeUnit.CubicMeterPerKilogram); + public T CubicMetersPerKilogram => As(SpecificVolumeUnit.CubicMeterPerKilogram); /// /// Get in MillicubicMetersPerKilogram. /// - public double MillicubicMetersPerKilogram => As(SpecificVolumeUnit.MillicubicMeterPerKilogram); + public T MillicubicMetersPerKilogram => As(SpecificVolumeUnit.MillicubicMeterPerKilogram); #endregion @@ -213,28 +210,25 @@ public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] IForma /// Get from CubicFeetPerPound. /// /// If value is NaN or Infinity. - public static SpecificVolume FromCubicFeetPerPound(QuantityValue cubicfeetperpound) + public static SpecificVolume FromCubicFeetPerPound(T cubicfeetperpound) { - double value = (double) cubicfeetperpound; - return new SpecificVolume(value, SpecificVolumeUnit.CubicFootPerPound); + return new SpecificVolume(cubicfeetperpound, SpecificVolumeUnit.CubicFootPerPound); } /// /// Get from CubicMetersPerKilogram. /// /// If value is NaN or Infinity. - public static SpecificVolume FromCubicMetersPerKilogram(QuantityValue cubicmetersperkilogram) + public static SpecificVolume FromCubicMetersPerKilogram(T cubicmetersperkilogram) { - double value = (double) cubicmetersperkilogram; - return new SpecificVolume(value, SpecificVolumeUnit.CubicMeterPerKilogram); + return new SpecificVolume(cubicmetersperkilogram, SpecificVolumeUnit.CubicMeterPerKilogram); } /// /// Get from MillicubicMetersPerKilogram. /// /// If value is NaN or Infinity. - public static SpecificVolume FromMillicubicMetersPerKilogram(QuantityValue millicubicmetersperkilogram) + public static SpecificVolume FromMillicubicMetersPerKilogram(T millicubicmetersperkilogram) { - double value = (double) millicubicmetersperkilogram; - return new SpecificVolume(value, SpecificVolumeUnit.MillicubicMeterPerKilogram); + return new SpecificVolume(millicubicmetersperkilogram, SpecificVolumeUnit.MillicubicMeterPerKilogram); } /// @@ -243,9 +237,9 @@ public static SpecificVolume FromMillicubicMetersPerKilogram(QuantityValue mi /// Value to convert from. /// Unit to convert from. /// unit value. - public static SpecificVolume From(QuantityValue value, SpecificVolumeUnit fromUnit) + public static SpecificVolume From(T value, SpecificVolumeUnit fromUnit) { - return new SpecificVolume((double)value, fromUnit); + return new SpecificVolume(value, fromUnit); } #endregion @@ -399,43 +393,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif /// Negate the value. public static SpecificVolume operator -(SpecificVolume right) { - return new SpecificVolume(-right.Value, right.Unit); + return new SpecificVolume(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static SpecificVolume operator +(SpecificVolume left, SpecificVolume right) { - return new SpecificVolume(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new SpecificVolume(value, left.Unit); } /// Get from subtracting two . public static SpecificVolume operator -(SpecificVolume left, SpecificVolume right) { - return new SpecificVolume(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new SpecificVolume(value, left.Unit); } /// Get from multiplying value and . - public static SpecificVolume operator *(double left, SpecificVolume right) + public static SpecificVolume operator *(T left, SpecificVolume right) { - return new SpecificVolume(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new SpecificVolume(value, right.Unit); } /// Get from multiplying value and . - public static SpecificVolume operator *(SpecificVolume left, double right) + public static SpecificVolume operator *(SpecificVolume left, T right) { - return new SpecificVolume(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new SpecificVolume(value, left.Unit); } /// Get from dividing by value. - public static SpecificVolume operator /(SpecificVolume left, double right) + public static SpecificVolume operator /(SpecificVolume left, T right) { - return new SpecificVolume(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new SpecificVolume(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(SpecificVolume left, SpecificVolume right) + public static T operator /(SpecificVolume left, SpecificVolume right) { - return left.CubicMetersPerKilogram / right.CubicMetersPerKilogram; + return CompiledLambdas.Divide(left.CubicMetersPerKilogram, right.CubicMetersPerKilogram); } #endregion @@ -445,25 +444,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif /// Returns true if less or equal to. public static bool operator <=(SpecificVolume left, SpecificVolume right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(SpecificVolume left, SpecificVolume right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(SpecificVolume left, SpecificVolume right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(SpecificVolume left, SpecificVolume right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -492,7 +491,7 @@ public int CompareTo(object obj) /// public int CompareTo(SpecificVolume other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -509,7 +508,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(SpecificVolume other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -557,10 +556,8 @@ public bool Equals(SpecificVolume other, double tolerance, ComparisonType com if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -580,17 +577,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(SpecificVolumeUnit unit) + public T As(SpecificVolumeUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -610,9 +607,14 @@ double IQuantity.As(Enum unit) if(!(unit is SpecificVolumeUnit unitAsSpecificVolumeUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificVolumeUnit)} is supported.", nameof(unit)); - return As(unitAsSpecificVolumeUnit); + var asValue = As(unitAsSpecificVolumeUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(SpecificVolumeUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -653,21 +655,27 @@ public SpecificVolume ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(SpecificVolumeUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(SpecificVolumeUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case SpecificVolumeUnit.CubicFootPerPound: return _value/16.01846353; - case SpecificVolumeUnit.CubicMeterPerKilogram: return _value; - case SpecificVolumeUnit.MillicubicMeterPerKilogram: return (_value) * 1e-3d; + case SpecificVolumeUnit.CubicFootPerPound: return Value/16.01846353; + case SpecificVolumeUnit.CubicMeterPerKilogram: return Value; + case SpecificVolumeUnit.MillicubicMeterPerKilogram: return (Value) * 1e-3d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -684,10 +692,10 @@ internal SpecificVolume ToBaseUnit() return new SpecificVolume(baseUnitValue, BaseUnit); } - private double GetValueAs(SpecificVolumeUnit unit) + private T GetValueAs(SpecificVolumeUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -797,7 +805,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -812,37 +820,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -866,17 +874,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs index 955d7cd043..00d426422b 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// http://en.wikipedia.org/wiki/Specificweight /// - public partial struct SpecificWeight : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct SpecificWeight : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -80,12 +75,12 @@ static SpecificWeight() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public SpecificWeight(double value, SpecificWeightUnit unit) + public SpecificWeight(T value, SpecificWeightUnit unit) { if(unit == SpecificWeightUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -97,14 +92,14 @@ public SpecificWeight(double value, SpecificWeightUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public SpecificWeight(double value, UnitSystem unitSystem) + public SpecificWeight(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -146,7 +141,7 @@ public SpecificWeight(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerCubicMeter. /// - public static SpecificWeight Zero { get; } = new SpecificWeight(0, BaseUnit); + public static SpecificWeight Zero { get; } = new SpecificWeight((T)0, BaseUnit); #endregion @@ -155,7 +150,9 @@ public SpecificWeight(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -185,87 +182,87 @@ public SpecificWeight(double value, UnitSystem unitSystem) /// /// Get in KilogramsForcePerCubicCentimeter. /// - public double KilogramsForcePerCubicCentimeter => As(SpecificWeightUnit.KilogramForcePerCubicCentimeter); + public T KilogramsForcePerCubicCentimeter => As(SpecificWeightUnit.KilogramForcePerCubicCentimeter); /// /// Get in KilogramsForcePerCubicMeter. /// - public double KilogramsForcePerCubicMeter => As(SpecificWeightUnit.KilogramForcePerCubicMeter); + public T KilogramsForcePerCubicMeter => As(SpecificWeightUnit.KilogramForcePerCubicMeter); /// /// Get in KilogramsForcePerCubicMillimeter. /// - public double KilogramsForcePerCubicMillimeter => As(SpecificWeightUnit.KilogramForcePerCubicMillimeter); + public T KilogramsForcePerCubicMillimeter => As(SpecificWeightUnit.KilogramForcePerCubicMillimeter); /// /// Get in KilonewtonsPerCubicCentimeter. /// - public double KilonewtonsPerCubicCentimeter => As(SpecificWeightUnit.KilonewtonPerCubicCentimeter); + public T KilonewtonsPerCubicCentimeter => As(SpecificWeightUnit.KilonewtonPerCubicCentimeter); /// /// Get in KilonewtonsPerCubicMeter. /// - public double KilonewtonsPerCubicMeter => As(SpecificWeightUnit.KilonewtonPerCubicMeter); + public T KilonewtonsPerCubicMeter => As(SpecificWeightUnit.KilonewtonPerCubicMeter); /// /// Get in KilonewtonsPerCubicMillimeter. /// - public double KilonewtonsPerCubicMillimeter => As(SpecificWeightUnit.KilonewtonPerCubicMillimeter); + public T KilonewtonsPerCubicMillimeter => As(SpecificWeightUnit.KilonewtonPerCubicMillimeter); /// /// Get in KilopoundsForcePerCubicFoot. /// - public double KilopoundsForcePerCubicFoot => As(SpecificWeightUnit.KilopoundForcePerCubicFoot); + public T KilopoundsForcePerCubicFoot => As(SpecificWeightUnit.KilopoundForcePerCubicFoot); /// /// Get in KilopoundsForcePerCubicInch. /// - public double KilopoundsForcePerCubicInch => As(SpecificWeightUnit.KilopoundForcePerCubicInch); + public T KilopoundsForcePerCubicInch => As(SpecificWeightUnit.KilopoundForcePerCubicInch); /// /// Get in MeganewtonsPerCubicMeter. /// - public double MeganewtonsPerCubicMeter => As(SpecificWeightUnit.MeganewtonPerCubicMeter); + public T MeganewtonsPerCubicMeter => As(SpecificWeightUnit.MeganewtonPerCubicMeter); /// /// Get in NewtonsPerCubicCentimeter. /// - public double NewtonsPerCubicCentimeter => As(SpecificWeightUnit.NewtonPerCubicCentimeter); + public T NewtonsPerCubicCentimeter => As(SpecificWeightUnit.NewtonPerCubicCentimeter); /// /// Get in NewtonsPerCubicMeter. /// - public double NewtonsPerCubicMeter => As(SpecificWeightUnit.NewtonPerCubicMeter); + public T NewtonsPerCubicMeter => As(SpecificWeightUnit.NewtonPerCubicMeter); /// /// Get in NewtonsPerCubicMillimeter. /// - public double NewtonsPerCubicMillimeter => As(SpecificWeightUnit.NewtonPerCubicMillimeter); + public T NewtonsPerCubicMillimeter => As(SpecificWeightUnit.NewtonPerCubicMillimeter); /// /// Get in PoundsForcePerCubicFoot. /// - public double PoundsForcePerCubicFoot => As(SpecificWeightUnit.PoundForcePerCubicFoot); + public T PoundsForcePerCubicFoot => As(SpecificWeightUnit.PoundForcePerCubicFoot); /// /// Get in PoundsForcePerCubicInch. /// - public double PoundsForcePerCubicInch => As(SpecificWeightUnit.PoundForcePerCubicInch); + public T PoundsForcePerCubicInch => As(SpecificWeightUnit.PoundForcePerCubicInch); /// /// Get in TonnesForcePerCubicCentimeter. /// - public double TonnesForcePerCubicCentimeter => As(SpecificWeightUnit.TonneForcePerCubicCentimeter); + public T TonnesForcePerCubicCentimeter => As(SpecificWeightUnit.TonneForcePerCubicCentimeter); /// /// Get in TonnesForcePerCubicMeter. /// - public double TonnesForcePerCubicMeter => As(SpecificWeightUnit.TonneForcePerCubicMeter); + public T TonnesForcePerCubicMeter => As(SpecificWeightUnit.TonneForcePerCubicMeter); /// /// Get in TonnesForcePerCubicMillimeter. /// - public double TonnesForcePerCubicMillimeter => As(SpecificWeightUnit.TonneForcePerCubicMillimeter); + public T TonnesForcePerCubicMillimeter => As(SpecificWeightUnit.TonneForcePerCubicMillimeter); #endregion @@ -300,154 +297,137 @@ public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] IForma /// Get from KilogramsForcePerCubicCentimeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromKilogramsForcePerCubicCentimeter(QuantityValue kilogramsforcepercubiccentimeter) + public static SpecificWeight FromKilogramsForcePerCubicCentimeter(T kilogramsforcepercubiccentimeter) { - double value = (double) kilogramsforcepercubiccentimeter; - return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicCentimeter); + return new SpecificWeight(kilogramsforcepercubiccentimeter, SpecificWeightUnit.KilogramForcePerCubicCentimeter); } /// /// Get from KilogramsForcePerCubicMeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromKilogramsForcePerCubicMeter(QuantityValue kilogramsforcepercubicmeter) + public static SpecificWeight FromKilogramsForcePerCubicMeter(T kilogramsforcepercubicmeter) { - double value = (double) kilogramsforcepercubicmeter; - return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicMeter); + return new SpecificWeight(kilogramsforcepercubicmeter, SpecificWeightUnit.KilogramForcePerCubicMeter); } /// /// Get from KilogramsForcePerCubicMillimeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromKilogramsForcePerCubicMillimeter(QuantityValue kilogramsforcepercubicmillimeter) + public static SpecificWeight FromKilogramsForcePerCubicMillimeter(T kilogramsforcepercubicmillimeter) { - double value = (double) kilogramsforcepercubicmillimeter; - return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicMillimeter); + return new SpecificWeight(kilogramsforcepercubicmillimeter, SpecificWeightUnit.KilogramForcePerCubicMillimeter); } /// /// Get from KilonewtonsPerCubicCentimeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromKilonewtonsPerCubicCentimeter(QuantityValue kilonewtonspercubiccentimeter) + public static SpecificWeight FromKilonewtonsPerCubicCentimeter(T kilonewtonspercubiccentimeter) { - double value = (double) kilonewtonspercubiccentimeter; - return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicCentimeter); + return new SpecificWeight(kilonewtonspercubiccentimeter, SpecificWeightUnit.KilonewtonPerCubicCentimeter); } /// /// Get from KilonewtonsPerCubicMeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromKilonewtonsPerCubicMeter(QuantityValue kilonewtonspercubicmeter) + public static SpecificWeight FromKilonewtonsPerCubicMeter(T kilonewtonspercubicmeter) { - double value = (double) kilonewtonspercubicmeter; - return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicMeter); + return new SpecificWeight(kilonewtonspercubicmeter, SpecificWeightUnit.KilonewtonPerCubicMeter); } /// /// Get from KilonewtonsPerCubicMillimeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromKilonewtonsPerCubicMillimeter(QuantityValue kilonewtonspercubicmillimeter) + public static SpecificWeight FromKilonewtonsPerCubicMillimeter(T kilonewtonspercubicmillimeter) { - double value = (double) kilonewtonspercubicmillimeter; - return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicMillimeter); + return new SpecificWeight(kilonewtonspercubicmillimeter, SpecificWeightUnit.KilonewtonPerCubicMillimeter); } /// /// Get from KilopoundsForcePerCubicFoot. /// /// If value is NaN or Infinity. - public static SpecificWeight FromKilopoundsForcePerCubicFoot(QuantityValue kilopoundsforcepercubicfoot) + public static SpecificWeight FromKilopoundsForcePerCubicFoot(T kilopoundsforcepercubicfoot) { - double value = (double) kilopoundsforcepercubicfoot; - return new SpecificWeight(value, SpecificWeightUnit.KilopoundForcePerCubicFoot); + return new SpecificWeight(kilopoundsforcepercubicfoot, SpecificWeightUnit.KilopoundForcePerCubicFoot); } /// /// Get from KilopoundsForcePerCubicInch. /// /// If value is NaN or Infinity. - public static SpecificWeight FromKilopoundsForcePerCubicInch(QuantityValue kilopoundsforcepercubicinch) + public static SpecificWeight FromKilopoundsForcePerCubicInch(T kilopoundsforcepercubicinch) { - double value = (double) kilopoundsforcepercubicinch; - return new SpecificWeight(value, SpecificWeightUnit.KilopoundForcePerCubicInch); + return new SpecificWeight(kilopoundsforcepercubicinch, SpecificWeightUnit.KilopoundForcePerCubicInch); } /// /// Get from MeganewtonsPerCubicMeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromMeganewtonsPerCubicMeter(QuantityValue meganewtonspercubicmeter) + public static SpecificWeight FromMeganewtonsPerCubicMeter(T meganewtonspercubicmeter) { - double value = (double) meganewtonspercubicmeter; - return new SpecificWeight(value, SpecificWeightUnit.MeganewtonPerCubicMeter); + return new SpecificWeight(meganewtonspercubicmeter, SpecificWeightUnit.MeganewtonPerCubicMeter); } /// /// Get from NewtonsPerCubicCentimeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromNewtonsPerCubicCentimeter(QuantityValue newtonspercubiccentimeter) + public static SpecificWeight FromNewtonsPerCubicCentimeter(T newtonspercubiccentimeter) { - double value = (double) newtonspercubiccentimeter; - return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicCentimeter); + return new SpecificWeight(newtonspercubiccentimeter, SpecificWeightUnit.NewtonPerCubicCentimeter); } /// /// Get from NewtonsPerCubicMeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromNewtonsPerCubicMeter(QuantityValue newtonspercubicmeter) + public static SpecificWeight FromNewtonsPerCubicMeter(T newtonspercubicmeter) { - double value = (double) newtonspercubicmeter; - return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicMeter); + return new SpecificWeight(newtonspercubicmeter, SpecificWeightUnit.NewtonPerCubicMeter); } /// /// Get from NewtonsPerCubicMillimeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromNewtonsPerCubicMillimeter(QuantityValue newtonspercubicmillimeter) + public static SpecificWeight FromNewtonsPerCubicMillimeter(T newtonspercubicmillimeter) { - double value = (double) newtonspercubicmillimeter; - return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicMillimeter); + return new SpecificWeight(newtonspercubicmillimeter, SpecificWeightUnit.NewtonPerCubicMillimeter); } /// /// Get from PoundsForcePerCubicFoot. /// /// If value is NaN or Infinity. - public static SpecificWeight FromPoundsForcePerCubicFoot(QuantityValue poundsforcepercubicfoot) + public static SpecificWeight FromPoundsForcePerCubicFoot(T poundsforcepercubicfoot) { - double value = (double) poundsforcepercubicfoot; - return new SpecificWeight(value, SpecificWeightUnit.PoundForcePerCubicFoot); + return new SpecificWeight(poundsforcepercubicfoot, SpecificWeightUnit.PoundForcePerCubicFoot); } /// /// Get from PoundsForcePerCubicInch. /// /// If value is NaN or Infinity. - public static SpecificWeight FromPoundsForcePerCubicInch(QuantityValue poundsforcepercubicinch) + public static SpecificWeight FromPoundsForcePerCubicInch(T poundsforcepercubicinch) { - double value = (double) poundsforcepercubicinch; - return new SpecificWeight(value, SpecificWeightUnit.PoundForcePerCubicInch); + return new SpecificWeight(poundsforcepercubicinch, SpecificWeightUnit.PoundForcePerCubicInch); } /// /// Get from TonnesForcePerCubicCentimeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromTonnesForcePerCubicCentimeter(QuantityValue tonnesforcepercubiccentimeter) + public static SpecificWeight FromTonnesForcePerCubicCentimeter(T tonnesforcepercubiccentimeter) { - double value = (double) tonnesforcepercubiccentimeter; - return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicCentimeter); + return new SpecificWeight(tonnesforcepercubiccentimeter, SpecificWeightUnit.TonneForcePerCubicCentimeter); } /// /// Get from TonnesForcePerCubicMeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromTonnesForcePerCubicMeter(QuantityValue tonnesforcepercubicmeter) + public static SpecificWeight FromTonnesForcePerCubicMeter(T tonnesforcepercubicmeter) { - double value = (double) tonnesforcepercubicmeter; - return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicMeter); + return new SpecificWeight(tonnesforcepercubicmeter, SpecificWeightUnit.TonneForcePerCubicMeter); } /// /// Get from TonnesForcePerCubicMillimeter. /// /// If value is NaN or Infinity. - public static SpecificWeight FromTonnesForcePerCubicMillimeter(QuantityValue tonnesforcepercubicmillimeter) + public static SpecificWeight FromTonnesForcePerCubicMillimeter(T tonnesforcepercubicmillimeter) { - double value = (double) tonnesforcepercubicmillimeter; - return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicMillimeter); + return new SpecificWeight(tonnesforcepercubicmillimeter, SpecificWeightUnit.TonneForcePerCubicMillimeter); } /// @@ -456,9 +436,9 @@ public static SpecificWeight FromTonnesForcePerCubicMillimeter(QuantityValue /// Value to convert from. /// Unit to convert from. /// unit value. - public static SpecificWeight From(QuantityValue value, SpecificWeightUnit fromUnit) + public static SpecificWeight From(T value, SpecificWeightUnit fromUnit) { - return new SpecificWeight((double)value, fromUnit); + return new SpecificWeight(value, fromUnit); } #endregion @@ -612,43 +592,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif /// Negate the value. public static SpecificWeight operator -(SpecificWeight right) { - return new SpecificWeight(-right.Value, right.Unit); + return new SpecificWeight(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static SpecificWeight operator +(SpecificWeight left, SpecificWeight right) { - return new SpecificWeight(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new SpecificWeight(value, left.Unit); } /// Get from subtracting two . public static SpecificWeight operator -(SpecificWeight left, SpecificWeight right) { - return new SpecificWeight(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new SpecificWeight(value, left.Unit); } /// Get from multiplying value and . - public static SpecificWeight operator *(double left, SpecificWeight right) + public static SpecificWeight operator *(T left, SpecificWeight right) { - return new SpecificWeight(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new SpecificWeight(value, right.Unit); } /// Get from multiplying value and . - public static SpecificWeight operator *(SpecificWeight left, double right) + public static SpecificWeight operator *(SpecificWeight left, T right) { - return new SpecificWeight(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new SpecificWeight(value, left.Unit); } /// Get from dividing by value. - public static SpecificWeight operator /(SpecificWeight left, double right) + public static SpecificWeight operator /(SpecificWeight left, T right) { - return new SpecificWeight(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new SpecificWeight(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(SpecificWeight left, SpecificWeight right) + public static T operator /(SpecificWeight left, SpecificWeight right) { - return left.NewtonsPerCubicMeter / right.NewtonsPerCubicMeter; + return CompiledLambdas.Divide(left.NewtonsPerCubicMeter, right.NewtonsPerCubicMeter); } #endregion @@ -658,25 +643,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif /// Returns true if less or equal to. public static bool operator <=(SpecificWeight left, SpecificWeight right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(SpecificWeight left, SpecificWeight right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(SpecificWeight left, SpecificWeight right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(SpecificWeight left, SpecificWeight right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -705,7 +690,7 @@ public int CompareTo(object obj) /// public int CompareTo(SpecificWeight other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -722,7 +707,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(SpecificWeight other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -770,10 +755,8 @@ public bool Equals(SpecificWeight other, double tolerance, ComparisonType com if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -793,17 +776,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(SpecificWeightUnit unit) + public T As(SpecificWeightUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -823,9 +806,14 @@ double IQuantity.As(Enum unit) if(!(unit is SpecificWeightUnit unitAsSpecificWeightUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificWeightUnit)} is supported.", nameof(unit)); - return As(unitAsSpecificWeightUnit); + var asValue = As(unitAsSpecificWeightUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(SpecificWeightUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -866,35 +854,41 @@ public SpecificWeight ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(SpecificWeightUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(SpecificWeightUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case SpecificWeightUnit.KilogramForcePerCubicCentimeter: return _value*9.80665e6; - case SpecificWeightUnit.KilogramForcePerCubicMeter: return _value*9.80665; - case SpecificWeightUnit.KilogramForcePerCubicMillimeter: return _value*9.80665e9; - case SpecificWeightUnit.KilonewtonPerCubicCentimeter: return (_value*1000000) * 1e3d; - case SpecificWeightUnit.KilonewtonPerCubicMeter: return (_value) * 1e3d; - case SpecificWeightUnit.KilonewtonPerCubicMillimeter: return (_value*1000000000) * 1e3d; - case SpecificWeightUnit.KilopoundForcePerCubicFoot: return (_value*1.570874638462462e2) * 1e3d; - case SpecificWeightUnit.KilopoundForcePerCubicInch: return (_value*2.714471375263134e5) * 1e3d; - case SpecificWeightUnit.MeganewtonPerCubicMeter: return (_value) * 1e6d; - case SpecificWeightUnit.NewtonPerCubicCentimeter: return _value*1000000; - case SpecificWeightUnit.NewtonPerCubicMeter: return _value; - case SpecificWeightUnit.NewtonPerCubicMillimeter: return _value*1000000000; - case SpecificWeightUnit.PoundForcePerCubicFoot: return _value*1.570874638462462e2; - case SpecificWeightUnit.PoundForcePerCubicInch: return _value*2.714471375263134e5; - case SpecificWeightUnit.TonneForcePerCubicCentimeter: return _value*9.80665e9; - case SpecificWeightUnit.TonneForcePerCubicMeter: return _value*9.80665e3; - case SpecificWeightUnit.TonneForcePerCubicMillimeter: return _value*9.80665e12; + case SpecificWeightUnit.KilogramForcePerCubicCentimeter: return Value*9.80665e6; + case SpecificWeightUnit.KilogramForcePerCubicMeter: return Value*9.80665; + case SpecificWeightUnit.KilogramForcePerCubicMillimeter: return Value*9.80665e9; + case SpecificWeightUnit.KilonewtonPerCubicCentimeter: return (Value*1000000) * 1e3d; + case SpecificWeightUnit.KilonewtonPerCubicMeter: return (Value) * 1e3d; + case SpecificWeightUnit.KilonewtonPerCubicMillimeter: return (Value*1000000000) * 1e3d; + case SpecificWeightUnit.KilopoundForcePerCubicFoot: return (Value*1.570874638462462e2) * 1e3d; + case SpecificWeightUnit.KilopoundForcePerCubicInch: return (Value*2.714471375263134e5) * 1e3d; + case SpecificWeightUnit.MeganewtonPerCubicMeter: return (Value) * 1e6d; + case SpecificWeightUnit.NewtonPerCubicCentimeter: return Value*1000000; + case SpecificWeightUnit.NewtonPerCubicMeter: return Value; + case SpecificWeightUnit.NewtonPerCubicMillimeter: return Value*1000000000; + case SpecificWeightUnit.PoundForcePerCubicFoot: return Value*1.570874638462462e2; + case SpecificWeightUnit.PoundForcePerCubicInch: return Value*2.714471375263134e5; + case SpecificWeightUnit.TonneForcePerCubicCentimeter: return Value*9.80665e9; + case SpecificWeightUnit.TonneForcePerCubicMeter: return Value*9.80665e3; + case SpecificWeightUnit.TonneForcePerCubicMillimeter: return Value*9.80665e12; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -911,10 +905,10 @@ internal SpecificWeight ToBaseUnit() return new SpecificWeight(baseUnitValue, BaseUnit); } - private double GetValueAs(SpecificWeightUnit unit) + private T GetValueAs(SpecificWeightUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1038,7 +1032,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1053,37 +1047,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1107,17 +1101,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs index ceb3913715..c72c891b26 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// In everyday use and in kinematics, the speed of an object is the magnitude of its velocity (the rate of change of its position); it is thus a scalar quantity.[1] The average speed of an object in an interval of time is the distance travelled by the object divided by the duration of the interval;[2] the instantaneous speed is the limit of the average speed as the duration of the time interval approaches zero. /// - public partial struct Speed : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Speed : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -92,12 +87,12 @@ static Speed() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Speed(double value, SpeedUnit unit) + public Speed(T value, SpeedUnit unit) { if(unit == SpeedUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -109,14 +104,14 @@ public Speed(double value, SpeedUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Speed(double value, UnitSystem unitSystem) + public Speed(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -158,7 +153,7 @@ public Speed(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit MeterPerSecond. /// - public static Speed Zero { get; } = new Speed(0, BaseUnit); + public static Speed Zero { get; } = new Speed((T)0, BaseUnit); #endregion @@ -167,7 +162,9 @@ public Speed(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -197,162 +194,162 @@ public Speed(double value, UnitSystem unitSystem) /// /// Get in CentimetersPerHour. /// - public double CentimetersPerHour => As(SpeedUnit.CentimeterPerHour); + public T CentimetersPerHour => As(SpeedUnit.CentimeterPerHour); /// /// Get in CentimetersPerMinutes. /// - public double CentimetersPerMinutes => As(SpeedUnit.CentimeterPerMinute); + public T CentimetersPerMinutes => As(SpeedUnit.CentimeterPerMinute); /// /// Get in CentimetersPerSecond. /// - public double CentimetersPerSecond => As(SpeedUnit.CentimeterPerSecond); + public T CentimetersPerSecond => As(SpeedUnit.CentimeterPerSecond); /// /// Get in DecimetersPerMinutes. /// - public double DecimetersPerMinutes => As(SpeedUnit.DecimeterPerMinute); + public T DecimetersPerMinutes => As(SpeedUnit.DecimeterPerMinute); /// /// Get in DecimetersPerSecond. /// - public double DecimetersPerSecond => As(SpeedUnit.DecimeterPerSecond); + public T DecimetersPerSecond => As(SpeedUnit.DecimeterPerSecond); /// /// Get in FeetPerHour. /// - public double FeetPerHour => As(SpeedUnit.FootPerHour); + public T FeetPerHour => As(SpeedUnit.FootPerHour); /// /// Get in FeetPerMinute. /// - public double FeetPerMinute => As(SpeedUnit.FootPerMinute); + public T FeetPerMinute => As(SpeedUnit.FootPerMinute); /// /// Get in FeetPerSecond. /// - public double FeetPerSecond => As(SpeedUnit.FootPerSecond); + public T FeetPerSecond => As(SpeedUnit.FootPerSecond); /// /// Get in InchesPerHour. /// - public double InchesPerHour => As(SpeedUnit.InchPerHour); + public T InchesPerHour => As(SpeedUnit.InchPerHour); /// /// Get in InchesPerMinute. /// - public double InchesPerMinute => As(SpeedUnit.InchPerMinute); + public T InchesPerMinute => As(SpeedUnit.InchPerMinute); /// /// Get in InchesPerSecond. /// - public double InchesPerSecond => As(SpeedUnit.InchPerSecond); + public T InchesPerSecond => As(SpeedUnit.InchPerSecond); /// /// Get in KilometersPerHour. /// - public double KilometersPerHour => As(SpeedUnit.KilometerPerHour); + public T KilometersPerHour => As(SpeedUnit.KilometerPerHour); /// /// Get in KilometersPerMinutes. /// - public double KilometersPerMinutes => As(SpeedUnit.KilometerPerMinute); + public T KilometersPerMinutes => As(SpeedUnit.KilometerPerMinute); /// /// Get in KilometersPerSecond. /// - public double KilometersPerSecond => As(SpeedUnit.KilometerPerSecond); + public T KilometersPerSecond => As(SpeedUnit.KilometerPerSecond); /// /// Get in Knots. /// - public double Knots => As(SpeedUnit.Knot); + public T Knots => As(SpeedUnit.Knot); /// /// Get in MetersPerHour. /// - public double MetersPerHour => As(SpeedUnit.MeterPerHour); + public T MetersPerHour => As(SpeedUnit.MeterPerHour); /// /// Get in MetersPerMinutes. /// - public double MetersPerMinutes => As(SpeedUnit.MeterPerMinute); + public T MetersPerMinutes => As(SpeedUnit.MeterPerMinute); /// /// Get in MetersPerSecond. /// - public double MetersPerSecond => As(SpeedUnit.MeterPerSecond); + public T MetersPerSecond => As(SpeedUnit.MeterPerSecond); /// /// Get in MicrometersPerMinutes. /// - public double MicrometersPerMinutes => As(SpeedUnit.MicrometerPerMinute); + public T MicrometersPerMinutes => As(SpeedUnit.MicrometerPerMinute); /// /// Get in MicrometersPerSecond. /// - public double MicrometersPerSecond => As(SpeedUnit.MicrometerPerSecond); + public T MicrometersPerSecond => As(SpeedUnit.MicrometerPerSecond); /// /// Get in MilesPerHour. /// - public double MilesPerHour => As(SpeedUnit.MilePerHour); + public T MilesPerHour => As(SpeedUnit.MilePerHour); /// /// Get in MillimetersPerHour. /// - public double MillimetersPerHour => As(SpeedUnit.MillimeterPerHour); + public T MillimetersPerHour => As(SpeedUnit.MillimeterPerHour); /// /// Get in MillimetersPerMinutes. /// - public double MillimetersPerMinutes => As(SpeedUnit.MillimeterPerMinute); + public T MillimetersPerMinutes => As(SpeedUnit.MillimeterPerMinute); /// /// Get in MillimetersPerSecond. /// - public double MillimetersPerSecond => As(SpeedUnit.MillimeterPerSecond); + public T MillimetersPerSecond => As(SpeedUnit.MillimeterPerSecond); /// /// Get in NanometersPerMinutes. /// - public double NanometersPerMinutes => As(SpeedUnit.NanometerPerMinute); + public T NanometersPerMinutes => As(SpeedUnit.NanometerPerMinute); /// /// Get in NanometersPerSecond. /// - public double NanometersPerSecond => As(SpeedUnit.NanometerPerSecond); + public T NanometersPerSecond => As(SpeedUnit.NanometerPerSecond); /// /// Get in UsSurveyFeetPerHour. /// - public double UsSurveyFeetPerHour => As(SpeedUnit.UsSurveyFootPerHour); + public T UsSurveyFeetPerHour => As(SpeedUnit.UsSurveyFootPerHour); /// /// Get in UsSurveyFeetPerMinute. /// - public double UsSurveyFeetPerMinute => As(SpeedUnit.UsSurveyFootPerMinute); + public T UsSurveyFeetPerMinute => As(SpeedUnit.UsSurveyFootPerMinute); /// /// Get in UsSurveyFeetPerSecond. /// - public double UsSurveyFeetPerSecond => As(SpeedUnit.UsSurveyFootPerSecond); + public T UsSurveyFeetPerSecond => As(SpeedUnit.UsSurveyFootPerSecond); /// /// Get in YardsPerHour. /// - public double YardsPerHour => As(SpeedUnit.YardPerHour); + public T YardsPerHour => As(SpeedUnit.YardPerHour); /// /// Get in YardsPerMinute. /// - public double YardsPerMinute => As(SpeedUnit.YardPerMinute); + public T YardsPerMinute => As(SpeedUnit.YardPerMinute); /// /// Get in YardsPerSecond. /// - public double YardsPerSecond => As(SpeedUnit.YardPerSecond); + public T YardsPerSecond => As(SpeedUnit.YardPerSecond); #endregion @@ -387,289 +384,257 @@ public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] IFormatProvider /// Get from CentimetersPerHour. /// /// If value is NaN or Infinity. - public static Speed FromCentimetersPerHour(QuantityValue centimetersperhour) + public static Speed FromCentimetersPerHour(T centimetersperhour) { - double value = (double) centimetersperhour; - return new Speed(value, SpeedUnit.CentimeterPerHour); + return new Speed(centimetersperhour, SpeedUnit.CentimeterPerHour); } /// /// Get from CentimetersPerMinutes. /// /// If value is NaN or Infinity. - public static Speed FromCentimetersPerMinutes(QuantityValue centimetersperminutes) + public static Speed FromCentimetersPerMinutes(T centimetersperminutes) { - double value = (double) centimetersperminutes; - return new Speed(value, SpeedUnit.CentimeterPerMinute); + return new Speed(centimetersperminutes, SpeedUnit.CentimeterPerMinute); } /// /// Get from CentimetersPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromCentimetersPerSecond(QuantityValue centimeterspersecond) + public static Speed FromCentimetersPerSecond(T centimeterspersecond) { - double value = (double) centimeterspersecond; - return new Speed(value, SpeedUnit.CentimeterPerSecond); + return new Speed(centimeterspersecond, SpeedUnit.CentimeterPerSecond); } /// /// Get from DecimetersPerMinutes. /// /// If value is NaN or Infinity. - public static Speed FromDecimetersPerMinutes(QuantityValue decimetersperminutes) + public static Speed FromDecimetersPerMinutes(T decimetersperminutes) { - double value = (double) decimetersperminutes; - return new Speed(value, SpeedUnit.DecimeterPerMinute); + return new Speed(decimetersperminutes, SpeedUnit.DecimeterPerMinute); } /// /// Get from DecimetersPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromDecimetersPerSecond(QuantityValue decimeterspersecond) + public static Speed FromDecimetersPerSecond(T decimeterspersecond) { - double value = (double) decimeterspersecond; - return new Speed(value, SpeedUnit.DecimeterPerSecond); + return new Speed(decimeterspersecond, SpeedUnit.DecimeterPerSecond); } /// /// Get from FeetPerHour. /// /// If value is NaN or Infinity. - public static Speed FromFeetPerHour(QuantityValue feetperhour) + public static Speed FromFeetPerHour(T feetperhour) { - double value = (double) feetperhour; - return new Speed(value, SpeedUnit.FootPerHour); + return new Speed(feetperhour, SpeedUnit.FootPerHour); } /// /// Get from FeetPerMinute. /// /// If value is NaN or Infinity. - public static Speed FromFeetPerMinute(QuantityValue feetperminute) + public static Speed FromFeetPerMinute(T feetperminute) { - double value = (double) feetperminute; - return new Speed(value, SpeedUnit.FootPerMinute); + return new Speed(feetperminute, SpeedUnit.FootPerMinute); } /// /// Get from FeetPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromFeetPerSecond(QuantityValue feetpersecond) + public static Speed FromFeetPerSecond(T feetpersecond) { - double value = (double) feetpersecond; - return new Speed(value, SpeedUnit.FootPerSecond); + return new Speed(feetpersecond, SpeedUnit.FootPerSecond); } /// /// Get from InchesPerHour. /// /// If value is NaN or Infinity. - public static Speed FromInchesPerHour(QuantityValue inchesperhour) + public static Speed FromInchesPerHour(T inchesperhour) { - double value = (double) inchesperhour; - return new Speed(value, SpeedUnit.InchPerHour); + return new Speed(inchesperhour, SpeedUnit.InchPerHour); } /// /// Get from InchesPerMinute. /// /// If value is NaN or Infinity. - public static Speed FromInchesPerMinute(QuantityValue inchesperminute) + public static Speed FromInchesPerMinute(T inchesperminute) { - double value = (double) inchesperminute; - return new Speed(value, SpeedUnit.InchPerMinute); + return new Speed(inchesperminute, SpeedUnit.InchPerMinute); } /// /// Get from InchesPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromInchesPerSecond(QuantityValue inchespersecond) + public static Speed FromInchesPerSecond(T inchespersecond) { - double value = (double) inchespersecond; - return new Speed(value, SpeedUnit.InchPerSecond); + return new Speed(inchespersecond, SpeedUnit.InchPerSecond); } /// /// Get from KilometersPerHour. /// /// If value is NaN or Infinity. - public static Speed FromKilometersPerHour(QuantityValue kilometersperhour) + public static Speed FromKilometersPerHour(T kilometersperhour) { - double value = (double) kilometersperhour; - return new Speed(value, SpeedUnit.KilometerPerHour); + return new Speed(kilometersperhour, SpeedUnit.KilometerPerHour); } /// /// Get from KilometersPerMinutes. /// /// If value is NaN or Infinity. - public static Speed FromKilometersPerMinutes(QuantityValue kilometersperminutes) + public static Speed FromKilometersPerMinutes(T kilometersperminutes) { - double value = (double) kilometersperminutes; - return new Speed(value, SpeedUnit.KilometerPerMinute); + return new Speed(kilometersperminutes, SpeedUnit.KilometerPerMinute); } /// /// Get from KilometersPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromKilometersPerSecond(QuantityValue kilometerspersecond) + public static Speed FromKilometersPerSecond(T kilometerspersecond) { - double value = (double) kilometerspersecond; - return new Speed(value, SpeedUnit.KilometerPerSecond); + return new Speed(kilometerspersecond, SpeedUnit.KilometerPerSecond); } /// /// Get from Knots. /// /// If value is NaN or Infinity. - public static Speed FromKnots(QuantityValue knots) + public static Speed FromKnots(T knots) { - double value = (double) knots; - return new Speed(value, SpeedUnit.Knot); + return new Speed(knots, SpeedUnit.Knot); } /// /// Get from MetersPerHour. /// /// If value is NaN or Infinity. - public static Speed FromMetersPerHour(QuantityValue metersperhour) + public static Speed FromMetersPerHour(T metersperhour) { - double value = (double) metersperhour; - return new Speed(value, SpeedUnit.MeterPerHour); + return new Speed(metersperhour, SpeedUnit.MeterPerHour); } /// /// Get from MetersPerMinutes. /// /// If value is NaN or Infinity. - public static Speed FromMetersPerMinutes(QuantityValue metersperminutes) + public static Speed FromMetersPerMinutes(T metersperminutes) { - double value = (double) metersperminutes; - return new Speed(value, SpeedUnit.MeterPerMinute); + return new Speed(metersperminutes, SpeedUnit.MeterPerMinute); } /// /// Get from MetersPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromMetersPerSecond(QuantityValue meterspersecond) + public static Speed FromMetersPerSecond(T meterspersecond) { - double value = (double) meterspersecond; - return new Speed(value, SpeedUnit.MeterPerSecond); + return new Speed(meterspersecond, SpeedUnit.MeterPerSecond); } /// /// Get from MicrometersPerMinutes. /// /// If value is NaN or Infinity. - public static Speed FromMicrometersPerMinutes(QuantityValue micrometersperminutes) + public static Speed FromMicrometersPerMinutes(T micrometersperminutes) { - double value = (double) micrometersperminutes; - return new Speed(value, SpeedUnit.MicrometerPerMinute); + return new Speed(micrometersperminutes, SpeedUnit.MicrometerPerMinute); } /// /// Get from MicrometersPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromMicrometersPerSecond(QuantityValue micrometerspersecond) + public static Speed FromMicrometersPerSecond(T micrometerspersecond) { - double value = (double) micrometerspersecond; - return new Speed(value, SpeedUnit.MicrometerPerSecond); + return new Speed(micrometerspersecond, SpeedUnit.MicrometerPerSecond); } /// /// Get from MilesPerHour. /// /// If value is NaN or Infinity. - public static Speed FromMilesPerHour(QuantityValue milesperhour) + public static Speed FromMilesPerHour(T milesperhour) { - double value = (double) milesperhour; - return new Speed(value, SpeedUnit.MilePerHour); + return new Speed(milesperhour, SpeedUnit.MilePerHour); } /// /// Get from MillimetersPerHour. /// /// If value is NaN or Infinity. - public static Speed FromMillimetersPerHour(QuantityValue millimetersperhour) + public static Speed FromMillimetersPerHour(T millimetersperhour) { - double value = (double) millimetersperhour; - return new Speed(value, SpeedUnit.MillimeterPerHour); + return new Speed(millimetersperhour, SpeedUnit.MillimeterPerHour); } /// /// Get from MillimetersPerMinutes. /// /// If value is NaN or Infinity. - public static Speed FromMillimetersPerMinutes(QuantityValue millimetersperminutes) + public static Speed FromMillimetersPerMinutes(T millimetersperminutes) { - double value = (double) millimetersperminutes; - return new Speed(value, SpeedUnit.MillimeterPerMinute); + return new Speed(millimetersperminutes, SpeedUnit.MillimeterPerMinute); } /// /// Get from MillimetersPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromMillimetersPerSecond(QuantityValue millimeterspersecond) + public static Speed FromMillimetersPerSecond(T millimeterspersecond) { - double value = (double) millimeterspersecond; - return new Speed(value, SpeedUnit.MillimeterPerSecond); + return new Speed(millimeterspersecond, SpeedUnit.MillimeterPerSecond); } /// /// Get from NanometersPerMinutes. /// /// If value is NaN or Infinity. - public static Speed FromNanometersPerMinutes(QuantityValue nanometersperminutes) + public static Speed FromNanometersPerMinutes(T nanometersperminutes) { - double value = (double) nanometersperminutes; - return new Speed(value, SpeedUnit.NanometerPerMinute); + return new Speed(nanometersperminutes, SpeedUnit.NanometerPerMinute); } /// /// Get from NanometersPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromNanometersPerSecond(QuantityValue nanometerspersecond) + public static Speed FromNanometersPerSecond(T nanometerspersecond) { - double value = (double) nanometerspersecond; - return new Speed(value, SpeedUnit.NanometerPerSecond); + return new Speed(nanometerspersecond, SpeedUnit.NanometerPerSecond); } /// /// Get from UsSurveyFeetPerHour. /// /// If value is NaN or Infinity. - public static Speed FromUsSurveyFeetPerHour(QuantityValue ussurveyfeetperhour) + public static Speed FromUsSurveyFeetPerHour(T ussurveyfeetperhour) { - double value = (double) ussurveyfeetperhour; - return new Speed(value, SpeedUnit.UsSurveyFootPerHour); + return new Speed(ussurveyfeetperhour, SpeedUnit.UsSurveyFootPerHour); } /// /// Get from UsSurveyFeetPerMinute. /// /// If value is NaN or Infinity. - public static Speed FromUsSurveyFeetPerMinute(QuantityValue ussurveyfeetperminute) + public static Speed FromUsSurveyFeetPerMinute(T ussurveyfeetperminute) { - double value = (double) ussurveyfeetperminute; - return new Speed(value, SpeedUnit.UsSurveyFootPerMinute); + return new Speed(ussurveyfeetperminute, SpeedUnit.UsSurveyFootPerMinute); } /// /// Get from UsSurveyFeetPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromUsSurveyFeetPerSecond(QuantityValue ussurveyfeetpersecond) + public static Speed FromUsSurveyFeetPerSecond(T ussurveyfeetpersecond) { - double value = (double) ussurveyfeetpersecond; - return new Speed(value, SpeedUnit.UsSurveyFootPerSecond); + return new Speed(ussurveyfeetpersecond, SpeedUnit.UsSurveyFootPerSecond); } /// /// Get from YardsPerHour. /// /// If value is NaN or Infinity. - public static Speed FromYardsPerHour(QuantityValue yardsperhour) + public static Speed FromYardsPerHour(T yardsperhour) { - double value = (double) yardsperhour; - return new Speed(value, SpeedUnit.YardPerHour); + return new Speed(yardsperhour, SpeedUnit.YardPerHour); } /// /// Get from YardsPerMinute. /// /// If value is NaN or Infinity. - public static Speed FromYardsPerMinute(QuantityValue yardsperminute) + public static Speed FromYardsPerMinute(T yardsperminute) { - double value = (double) yardsperminute; - return new Speed(value, SpeedUnit.YardPerMinute); + return new Speed(yardsperminute, SpeedUnit.YardPerMinute); } /// /// Get from YardsPerSecond. /// /// If value is NaN or Infinity. - public static Speed FromYardsPerSecond(QuantityValue yardspersecond) + public static Speed FromYardsPerSecond(T yardspersecond) { - double value = (double) yardspersecond; - return new Speed(value, SpeedUnit.YardPerSecond); + return new Speed(yardspersecond, SpeedUnit.YardPerSecond); } /// @@ -678,9 +643,9 @@ public static Speed FromYardsPerSecond(QuantityValue yardspersecond) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Speed From(QuantityValue value, SpeedUnit fromUnit) + public static Speed From(T value, SpeedUnit fromUnit) { - return new Speed((double)value, fromUnit); + return new Speed(value, fromUnit); } #endregion @@ -834,43 +799,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out SpeedU /// Negate the value. public static Speed operator -(Speed right) { - return new Speed(-right.Value, right.Unit); + return new Speed(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Speed operator +(Speed left, Speed right) { - return new Speed(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Speed(value, left.Unit); } /// Get from subtracting two . public static Speed operator -(Speed left, Speed right) { - return new Speed(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Speed(value, left.Unit); } /// Get from multiplying value and . - public static Speed operator *(double left, Speed right) + public static Speed operator *(T left, Speed right) { - return new Speed(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Speed(value, right.Unit); } /// Get from multiplying value and . - public static Speed operator *(Speed left, double right) + public static Speed operator *(Speed left, T right) { - return new Speed(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Speed(value, left.Unit); } /// Get from dividing by value. - public static Speed operator /(Speed left, double right) + public static Speed operator /(Speed left, T right) { - return new Speed(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Speed(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Speed left, Speed right) + public static T operator /(Speed left, Speed right) { - return left.MetersPerSecond / right.MetersPerSecond; + return CompiledLambdas.Divide(left.MetersPerSecond, right.MetersPerSecond); } #endregion @@ -880,25 +850,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out SpeedU /// Returns true if less or equal to. public static bool operator <=(Speed left, Speed right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Speed left, Speed right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Speed left, Speed right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Speed left, Speed right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -927,7 +897,7 @@ public int CompareTo(object obj) /// public int CompareTo(Speed other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -944,7 +914,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Speed other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -992,10 +962,8 @@ public bool Equals(Speed other, double tolerance, ComparisonType comparisonTy if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -1015,17 +983,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(SpeedUnit unit) + public T As(SpeedUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1045,9 +1013,14 @@ double IQuantity.As(Enum unit) if(!(unit is SpeedUnit unitAsSpeedUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpeedUnit)} is supported.", nameof(unit)); - return As(unitAsSpeedUnit); + var asValue = As(unitAsSpeedUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(SpeedUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -1088,50 +1061,56 @@ public Speed ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(SpeedUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(SpeedUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case SpeedUnit.CentimeterPerHour: return (_value/3600) * 1e-2d; - case SpeedUnit.CentimeterPerMinute: return (_value/60) * 1e-2d; - case SpeedUnit.CentimeterPerSecond: return (_value) * 1e-2d; - case SpeedUnit.DecimeterPerMinute: return (_value/60) * 1e-1d; - case SpeedUnit.DecimeterPerSecond: return (_value) * 1e-1d; - case SpeedUnit.FootPerHour: return _value*0.3048/3600; - case SpeedUnit.FootPerMinute: return _value*0.3048/60; - case SpeedUnit.FootPerSecond: return _value*0.3048; - case SpeedUnit.InchPerHour: return (_value/3600)*2.54e-2; - case SpeedUnit.InchPerMinute: return (_value/60)*2.54e-2; - case SpeedUnit.InchPerSecond: return _value*2.54e-2; - case SpeedUnit.KilometerPerHour: return (_value/3600) * 1e3d; - case SpeedUnit.KilometerPerMinute: return (_value/60) * 1e3d; - case SpeedUnit.KilometerPerSecond: return (_value) * 1e3d; - case SpeedUnit.Knot: return _value*0.514444; - case SpeedUnit.MeterPerHour: return _value/3600; - case SpeedUnit.MeterPerMinute: return _value/60; - case SpeedUnit.MeterPerSecond: return _value; - case SpeedUnit.MicrometerPerMinute: return (_value/60) * 1e-6d; - case SpeedUnit.MicrometerPerSecond: return (_value) * 1e-6d; - case SpeedUnit.MilePerHour: return _value*0.44704; - case SpeedUnit.MillimeterPerHour: return (_value/3600) * 1e-3d; - case SpeedUnit.MillimeterPerMinute: return (_value/60) * 1e-3d; - case SpeedUnit.MillimeterPerSecond: return (_value) * 1e-3d; - case SpeedUnit.NanometerPerMinute: return (_value/60) * 1e-9d; - case SpeedUnit.NanometerPerSecond: return (_value) * 1e-9d; - case SpeedUnit.UsSurveyFootPerHour: return (_value*1200/3937)/3600; - case SpeedUnit.UsSurveyFootPerMinute: return (_value*1200/3937)/60; - case SpeedUnit.UsSurveyFootPerSecond: return _value*1200/3937; - case SpeedUnit.YardPerHour: return _value*0.9144/3600; - case SpeedUnit.YardPerMinute: return _value*0.9144/60; - case SpeedUnit.YardPerSecond: return _value*0.9144; + case SpeedUnit.CentimeterPerHour: return (Value/3600) * 1e-2d; + case SpeedUnit.CentimeterPerMinute: return (Value/60) * 1e-2d; + case SpeedUnit.CentimeterPerSecond: return (Value) * 1e-2d; + case SpeedUnit.DecimeterPerMinute: return (Value/60) * 1e-1d; + case SpeedUnit.DecimeterPerSecond: return (Value) * 1e-1d; + case SpeedUnit.FootPerHour: return Value*0.3048/3600; + case SpeedUnit.FootPerMinute: return Value*0.3048/60; + case SpeedUnit.FootPerSecond: return Value*0.3048; + case SpeedUnit.InchPerHour: return (Value/3600)*2.54e-2; + case SpeedUnit.InchPerMinute: return (Value/60)*2.54e-2; + case SpeedUnit.InchPerSecond: return Value*2.54e-2; + case SpeedUnit.KilometerPerHour: return (Value/3600) * 1e3d; + case SpeedUnit.KilometerPerMinute: return (Value/60) * 1e3d; + case SpeedUnit.KilometerPerSecond: return (Value) * 1e3d; + case SpeedUnit.Knot: return Value*0.514444; + case SpeedUnit.MeterPerHour: return Value/3600; + case SpeedUnit.MeterPerMinute: return Value/60; + case SpeedUnit.MeterPerSecond: return Value; + case SpeedUnit.MicrometerPerMinute: return (Value/60) * 1e-6d; + case SpeedUnit.MicrometerPerSecond: return (Value) * 1e-6d; + case SpeedUnit.MilePerHour: return Value*0.44704; + case SpeedUnit.MillimeterPerHour: return (Value/3600) * 1e-3d; + case SpeedUnit.MillimeterPerMinute: return (Value/60) * 1e-3d; + case SpeedUnit.MillimeterPerSecond: return (Value) * 1e-3d; + case SpeedUnit.NanometerPerMinute: return (Value/60) * 1e-9d; + case SpeedUnit.NanometerPerSecond: return (Value) * 1e-9d; + case SpeedUnit.UsSurveyFootPerHour: return (Value*1200/3937)/3600; + case SpeedUnit.UsSurveyFootPerMinute: return (Value*1200/3937)/60; + case SpeedUnit.UsSurveyFootPerSecond: return Value*1200/3937; + case SpeedUnit.YardPerHour: return Value*0.9144/3600; + case SpeedUnit.YardPerMinute: return Value*0.9144/60; + case SpeedUnit.YardPerSecond: return Value*0.9144; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -1148,10 +1127,10 @@ internal Speed ToBaseUnit() return new Speed(baseUnitValue, BaseUnit); } - private double GetValueAs(SpeedUnit unit) + private T GetValueAs(SpeedUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1290,7 +1269,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1305,37 +1284,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1359,17 +1338,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs index 9af3a29244..178a07dce7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// A temperature is a numerical measure of hot or cold. Its measurement is by detection of heat radiation or particle velocity or kinetic energy, or by the bulk behavior of a thermometric material. It may be calibrated in any of various temperature scales, Celsius, Fahrenheit, Kelvin, etc. The fundamental physical definition of temperature is provided by thermodynamics. /// - public partial struct Temperature : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Temperature : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -69,12 +64,12 @@ static Temperature() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Temperature(double value, TemperatureUnit unit) + public Temperature(T value, TemperatureUnit unit) { if(unit == TemperatureUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -86,14 +81,14 @@ public Temperature(double value, TemperatureUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Temperature(double value, UnitSystem unitSystem) + public Temperature(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -135,7 +130,7 @@ public Temperature(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Kelvin. /// - public static Temperature Zero { get; } = new Temperature(0, BaseUnit); + public static Temperature Zero { get; } = new Temperature((T)0, BaseUnit); #endregion @@ -144,7 +139,9 @@ public Temperature(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -174,47 +171,47 @@ public Temperature(double value, UnitSystem unitSystem) /// /// Get in DegreesCelsius. /// - public double DegreesCelsius => As(TemperatureUnit.DegreeCelsius); + public T DegreesCelsius => As(TemperatureUnit.DegreeCelsius); /// /// Get in DegreesDelisle. /// - public double DegreesDelisle => As(TemperatureUnit.DegreeDelisle); + public T DegreesDelisle => As(TemperatureUnit.DegreeDelisle); /// /// Get in DegreesFahrenheit. /// - public double DegreesFahrenheit => As(TemperatureUnit.DegreeFahrenheit); + public T DegreesFahrenheit => As(TemperatureUnit.DegreeFahrenheit); /// /// Get in DegreesNewton. /// - public double DegreesNewton => As(TemperatureUnit.DegreeNewton); + public T DegreesNewton => As(TemperatureUnit.DegreeNewton); /// /// Get in DegreesRankine. /// - public double DegreesRankine => As(TemperatureUnit.DegreeRankine); + public T DegreesRankine => As(TemperatureUnit.DegreeRankine); /// /// Get in DegreesReaumur. /// - public double DegreesReaumur => As(TemperatureUnit.DegreeReaumur); + public T DegreesReaumur => As(TemperatureUnit.DegreeReaumur); /// /// Get in DegreesRoemer. /// - public double DegreesRoemer => As(TemperatureUnit.DegreeRoemer); + public T DegreesRoemer => As(TemperatureUnit.DegreeRoemer); /// /// Get in Kelvins. /// - public double Kelvins => As(TemperatureUnit.Kelvin); + public T Kelvins => As(TemperatureUnit.Kelvin); /// /// Get in SolarTemperatures. /// - public double SolarTemperatures => As(TemperatureUnit.SolarTemperature); + public T SolarTemperatures => As(TemperatureUnit.SolarTemperature); #endregion @@ -249,82 +246,73 @@ public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] IFormatPr /// Get from DegreesCelsius. /// /// If value is NaN or Infinity. - public static Temperature FromDegreesCelsius(QuantityValue degreescelsius) + public static Temperature FromDegreesCelsius(T degreescelsius) { - double value = (double) degreescelsius; - return new Temperature(value, TemperatureUnit.DegreeCelsius); + return new Temperature(degreescelsius, TemperatureUnit.DegreeCelsius); } /// /// Get from DegreesDelisle. /// /// If value is NaN or Infinity. - public static Temperature FromDegreesDelisle(QuantityValue degreesdelisle) + public static Temperature FromDegreesDelisle(T degreesdelisle) { - double value = (double) degreesdelisle; - return new Temperature(value, TemperatureUnit.DegreeDelisle); + return new Temperature(degreesdelisle, TemperatureUnit.DegreeDelisle); } /// /// Get from DegreesFahrenheit. /// /// If value is NaN or Infinity. - public static Temperature FromDegreesFahrenheit(QuantityValue degreesfahrenheit) + public static Temperature FromDegreesFahrenheit(T degreesfahrenheit) { - double value = (double) degreesfahrenheit; - return new Temperature(value, TemperatureUnit.DegreeFahrenheit); + return new Temperature(degreesfahrenheit, TemperatureUnit.DegreeFahrenheit); } /// /// Get from DegreesNewton. /// /// If value is NaN or Infinity. - public static Temperature FromDegreesNewton(QuantityValue degreesnewton) + public static Temperature FromDegreesNewton(T degreesnewton) { - double value = (double) degreesnewton; - return new Temperature(value, TemperatureUnit.DegreeNewton); + return new Temperature(degreesnewton, TemperatureUnit.DegreeNewton); } /// /// Get from DegreesRankine. /// /// If value is NaN or Infinity. - public static Temperature FromDegreesRankine(QuantityValue degreesrankine) + public static Temperature FromDegreesRankine(T degreesrankine) { - double value = (double) degreesrankine; - return new Temperature(value, TemperatureUnit.DegreeRankine); + return new Temperature(degreesrankine, TemperatureUnit.DegreeRankine); } /// /// Get from DegreesReaumur. /// /// If value is NaN or Infinity. - public static Temperature FromDegreesReaumur(QuantityValue degreesreaumur) + public static Temperature FromDegreesReaumur(T degreesreaumur) { - double value = (double) degreesreaumur; - return new Temperature(value, TemperatureUnit.DegreeReaumur); + return new Temperature(degreesreaumur, TemperatureUnit.DegreeReaumur); } /// /// Get from DegreesRoemer. /// /// If value is NaN or Infinity. - public static Temperature FromDegreesRoemer(QuantityValue degreesroemer) + public static Temperature FromDegreesRoemer(T degreesroemer) { - double value = (double) degreesroemer; - return new Temperature(value, TemperatureUnit.DegreeRoemer); + return new Temperature(degreesroemer, TemperatureUnit.DegreeRoemer); } /// /// Get from Kelvins. /// /// If value is NaN or Infinity. - public static Temperature FromKelvins(QuantityValue kelvins) + public static Temperature FromKelvins(T kelvins) { - double value = (double) kelvins; - return new Temperature(value, TemperatureUnit.Kelvin); + return new Temperature(kelvins, TemperatureUnit.Kelvin); } /// /// Get from SolarTemperatures. /// /// If value is NaN or Infinity. - public static Temperature FromSolarTemperatures(QuantityValue solartemperatures) + public static Temperature FromSolarTemperatures(T solartemperatures) { - double value = (double) solartemperatures; - return new Temperature(value, TemperatureUnit.SolarTemperature); + return new Temperature(solartemperatures, TemperatureUnit.SolarTemperature); } /// @@ -333,9 +321,9 @@ public static Temperature FromSolarTemperatures(QuantityValue solartemperatur /// Value to convert from. /// Unit to convert from. /// unit value. - public static Temperature From(QuantityValue value, TemperatureUnit fromUnit) + public static Temperature From(T value, TemperatureUnit fromUnit) { - return new Temperature((double)value, fromUnit); + return new Temperature(value, fromUnit); } #endregion @@ -489,25 +477,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper /// Returns true if less or equal to. public static bool operator <=(Temperature left, Temperature right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Temperature left, Temperature right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Temperature left, Temperature right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Temperature left, Temperature right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -536,7 +524,7 @@ public int CompareTo(object obj) /// public int CompareTo(Temperature other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -553,7 +541,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Temperature other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -601,10 +589,8 @@ public bool Equals(Temperature other, double tolerance, ComparisonType compar if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -624,17 +610,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(TemperatureUnit unit) + public T As(TemperatureUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -654,9 +640,14 @@ double IQuantity.As(Enum unit) if(!(unit is TemperatureUnit unitAsTemperatureUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureUnit)} is supported.", nameof(unit)); - return As(unitAsTemperatureUnit); + var asValue = As(unitAsTemperatureUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(TemperatureUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -697,27 +688,33 @@ public Temperature ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(TemperatureUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(TemperatureUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case TemperatureUnit.DegreeCelsius: return _value + 273.15; - case TemperatureUnit.DegreeDelisle: return _value*-2/3 + 373.15; - case TemperatureUnit.DegreeFahrenheit: return _value*5/9 + 459.67*5/9; - case TemperatureUnit.DegreeNewton: return _value*100/33 + 273.15; - case TemperatureUnit.DegreeRankine: return _value*5/9; - case TemperatureUnit.DegreeReaumur: return _value*5/4 + 273.15; - case TemperatureUnit.DegreeRoemer: return _value*40/21 + 273.15 - 7.5*40d/21; - case TemperatureUnit.Kelvin: return _value; - case TemperatureUnit.SolarTemperature: return _value * 5778; + case TemperatureUnit.DegreeCelsius: return Value + 273.15; + case TemperatureUnit.DegreeDelisle: return Value*-2/3 + 373.15; + case TemperatureUnit.DegreeFahrenheit: return Value*5/9 + 459.67*5/9; + case TemperatureUnit.DegreeNewton: return Value*100/33 + 273.15; + case TemperatureUnit.DegreeRankine: return Value*5/9; + case TemperatureUnit.DegreeReaumur: return Value*5/4 + 273.15; + case TemperatureUnit.DegreeRoemer: return Value*40/21 + 273.15 - 7.5*40d/21; + case TemperatureUnit.Kelvin: return Value; + case TemperatureUnit.SolarTemperature: return Value * 5778; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -734,10 +731,10 @@ internal Temperature ToBaseUnit() return new Temperature(baseUnitValue, BaseUnit); } - private double GetValueAs(TemperatureUnit unit) + private T GetValueAs(TemperatureUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -853,7 +850,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -868,37 +865,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -922,17 +919,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs index 4d2a73f9dd..50362e5e2a 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Temperature change rate is the ratio of the temperature change to the time during which the change occurred (value of temperature changes per unit time). /// - public partial struct TemperatureChangeRate : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct TemperatureChangeRate : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -70,12 +65,12 @@ static TemperatureChangeRate() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public TemperatureChangeRate(double value, TemperatureChangeRateUnit unit) + public TemperatureChangeRate(T value, TemperatureChangeRateUnit unit) { if(unit == TemperatureChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -87,14 +82,14 @@ public TemperatureChangeRate(double value, TemperatureChangeRateUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public TemperatureChangeRate(double value, UnitSystem unitSystem) + public TemperatureChangeRate(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -136,7 +131,7 @@ public TemperatureChangeRate(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit DegreeCelsiusPerSecond. /// - public static TemperatureChangeRate Zero { get; } = new TemperatureChangeRate(0, BaseUnit); + public static TemperatureChangeRate Zero { get; } = new TemperatureChangeRate((T)0, BaseUnit); #endregion @@ -145,7 +140,9 @@ public TemperatureChangeRate(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -175,52 +172,52 @@ public TemperatureChangeRate(double value, UnitSystem unitSystem) /// /// Get in CentidegreesCelsiusPerSecond. /// - public double CentidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond); + public T CentidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond); /// /// Get in DecadegreesCelsiusPerSecond. /// - public double DecadegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond); + public T DecadegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond); /// /// Get in DecidegreesCelsiusPerSecond. /// - public double DecidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond); + public T DecidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond); /// /// Get in DegreesCelsiusPerMinute. /// - public double DegreesCelsiusPerMinute => As(TemperatureChangeRateUnit.DegreeCelsiusPerMinute); + public T DegreesCelsiusPerMinute => As(TemperatureChangeRateUnit.DegreeCelsiusPerMinute); /// /// Get in DegreesCelsiusPerSecond. /// - public double DegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DegreeCelsiusPerSecond); + public T DegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DegreeCelsiusPerSecond); /// /// Get in HectodegreesCelsiusPerSecond. /// - public double HectodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond); + public T HectodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond); /// /// Get in KilodegreesCelsiusPerSecond. /// - public double KilodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond); + public T KilodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond); /// /// Get in MicrodegreesCelsiusPerSecond. /// - public double MicrodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond); + public T MicrodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond); /// /// Get in MillidegreesCelsiusPerSecond. /// - public double MillidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond); + public T MillidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond); /// /// Get in NanodegreesCelsiusPerSecond. /// - public double NanodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond); + public T NanodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond); #endregion @@ -255,91 +252,81 @@ public static string GetAbbreviation(TemperatureChangeRateUnit unit, [CanBeNull] /// Get from CentidegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromCentidegreesCelsiusPerSecond(QuantityValue centidegreescelsiuspersecond) + public static TemperatureChangeRate FromCentidegreesCelsiusPerSecond(T centidegreescelsiuspersecond) { - double value = (double) centidegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond); + return new TemperatureChangeRate(centidegreescelsiuspersecond, TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond); } /// /// Get from DecadegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromDecadegreesCelsiusPerSecond(QuantityValue decadegreescelsiuspersecond) + public static TemperatureChangeRate FromDecadegreesCelsiusPerSecond(T decadegreescelsiuspersecond) { - double value = (double) decadegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond); + return new TemperatureChangeRate(decadegreescelsiuspersecond, TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond); } /// /// Get from DecidegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromDecidegreesCelsiusPerSecond(QuantityValue decidegreescelsiuspersecond) + public static TemperatureChangeRate FromDecidegreesCelsiusPerSecond(T decidegreescelsiuspersecond) { - double value = (double) decidegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond); + return new TemperatureChangeRate(decidegreescelsiuspersecond, TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond); } /// /// Get from DegreesCelsiusPerMinute. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromDegreesCelsiusPerMinute(QuantityValue degreescelsiusperminute) + public static TemperatureChangeRate FromDegreesCelsiusPerMinute(T degreescelsiusperminute) { - double value = (double) degreescelsiusperminute; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DegreeCelsiusPerMinute); + return new TemperatureChangeRate(degreescelsiusperminute, TemperatureChangeRateUnit.DegreeCelsiusPerMinute); } /// /// Get from DegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromDegreesCelsiusPerSecond(QuantityValue degreescelsiuspersecond) + public static TemperatureChangeRate FromDegreesCelsiusPerSecond(T degreescelsiuspersecond) { - double value = (double) degreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DegreeCelsiusPerSecond); + return new TemperatureChangeRate(degreescelsiuspersecond, TemperatureChangeRateUnit.DegreeCelsiusPerSecond); } /// /// Get from HectodegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromHectodegreesCelsiusPerSecond(QuantityValue hectodegreescelsiuspersecond) + public static TemperatureChangeRate FromHectodegreesCelsiusPerSecond(T hectodegreescelsiuspersecond) { - double value = (double) hectodegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond); + return new TemperatureChangeRate(hectodegreescelsiuspersecond, TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond); } /// /// Get from KilodegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromKilodegreesCelsiusPerSecond(QuantityValue kilodegreescelsiuspersecond) + public static TemperatureChangeRate FromKilodegreesCelsiusPerSecond(T kilodegreescelsiuspersecond) { - double value = (double) kilodegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond); + return new TemperatureChangeRate(kilodegreescelsiuspersecond, TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond); } /// /// Get from MicrodegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromMicrodegreesCelsiusPerSecond(QuantityValue microdegreescelsiuspersecond) + public static TemperatureChangeRate FromMicrodegreesCelsiusPerSecond(T microdegreescelsiuspersecond) { - double value = (double) microdegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond); + return new TemperatureChangeRate(microdegreescelsiuspersecond, TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond); } /// /// Get from MillidegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromMillidegreesCelsiusPerSecond(QuantityValue millidegreescelsiuspersecond) + public static TemperatureChangeRate FromMillidegreesCelsiusPerSecond(T millidegreescelsiuspersecond) { - double value = (double) millidegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond); + return new TemperatureChangeRate(millidegreescelsiuspersecond, TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond); } /// /// Get from NanodegreesCelsiusPerSecond. /// /// If value is NaN or Infinity. - public static TemperatureChangeRate FromNanodegreesCelsiusPerSecond(QuantityValue nanodegreescelsiuspersecond) + public static TemperatureChangeRate FromNanodegreesCelsiusPerSecond(T nanodegreescelsiuspersecond) { - double value = (double) nanodegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond); + return new TemperatureChangeRate(nanodegreescelsiuspersecond, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond); } /// @@ -348,9 +335,9 @@ public static TemperatureChangeRate FromNanodegreesCelsiusPerSecond(QuantityV /// Value to convert from. /// Unit to convert from. /// unit value. - public static TemperatureChangeRate From(QuantityValue value, TemperatureChangeRateUnit fromUnit) + public static TemperatureChangeRate From(T value, TemperatureChangeRateUnit fromUnit) { - return new TemperatureChangeRate((double)value, fromUnit); + return new TemperatureChangeRate(value, fromUnit); } #endregion @@ -504,43 +491,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper /// Negate the value. public static TemperatureChangeRate operator -(TemperatureChangeRate right) { - return new TemperatureChangeRate(-right.Value, right.Unit); + return new TemperatureChangeRate(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static TemperatureChangeRate operator +(TemperatureChangeRate left, TemperatureChangeRate right) { - return new TemperatureChangeRate(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new TemperatureChangeRate(value, left.Unit); } /// Get from subtracting two . public static TemperatureChangeRate operator -(TemperatureChangeRate left, TemperatureChangeRate right) { - return new TemperatureChangeRate(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new TemperatureChangeRate(value, left.Unit); } /// Get from multiplying value and . - public static TemperatureChangeRate operator *(double left, TemperatureChangeRate right) + public static TemperatureChangeRate operator *(T left, TemperatureChangeRate right) { - return new TemperatureChangeRate(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new TemperatureChangeRate(value, right.Unit); } /// Get from multiplying value and . - public static TemperatureChangeRate operator *(TemperatureChangeRate left, double right) + public static TemperatureChangeRate operator *(TemperatureChangeRate left, T right) { - return new TemperatureChangeRate(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new TemperatureChangeRate(value, left.Unit); } /// Get from dividing by value. - public static TemperatureChangeRate operator /(TemperatureChangeRate left, double right) + public static TemperatureChangeRate operator /(TemperatureChangeRate left, T right) { - return new TemperatureChangeRate(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new TemperatureChangeRate(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(TemperatureChangeRate left, TemperatureChangeRate right) + public static T operator /(TemperatureChangeRate left, TemperatureChangeRate right) { - return left.DegreesCelsiusPerSecond / right.DegreesCelsiusPerSecond; + return CompiledLambdas.Divide(left.DegreesCelsiusPerSecond, right.DegreesCelsiusPerSecond); } #endregion @@ -550,25 +542,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper /// Returns true if less or equal to. public static bool operator <=(TemperatureChangeRate left, TemperatureChangeRate right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(TemperatureChangeRate left, TemperatureChangeRate right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(TemperatureChangeRate left, TemperatureChangeRate right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(TemperatureChangeRate left, TemperatureChangeRate right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -597,7 +589,7 @@ public int CompareTo(object obj) /// public int CompareTo(TemperatureChangeRate other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -614,7 +606,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(TemperatureChangeRate other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -662,10 +654,8 @@ public bool Equals(TemperatureChangeRate other, double tolerance, ComparisonT if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -685,17 +675,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(TemperatureChangeRateUnit unit) + public T As(TemperatureChangeRateUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -715,9 +705,14 @@ double IQuantity.As(Enum unit) if(!(unit is TemperatureChangeRateUnit unitAsTemperatureChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureChangeRateUnit)} is supported.", nameof(unit)); - return As(unitAsTemperatureChangeRateUnit); + var asValue = As(unitAsTemperatureChangeRateUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(TemperatureChangeRateUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -758,28 +753,34 @@ public TemperatureChangeRate ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(TemperatureChangeRateUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(TemperatureChangeRateUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond: return (_value) * 1e-2d; - case TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond: return (_value) * 1e1d; - case TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond: return (_value) * 1e-1d; - case TemperatureChangeRateUnit.DegreeCelsiusPerMinute: return _value/60; - case TemperatureChangeRateUnit.DegreeCelsiusPerSecond: return _value; - case TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond: return (_value) * 1e2d; - case TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond: return (_value) * 1e3d; - case TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond: return (_value) * 1e-6d; - case TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond: return (_value) * 1e-3d; - case TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond: return (_value) * 1e-9d; + case TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond: return (Value) * 1e-2d; + case TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond: return (Value) * 1e1d; + case TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond: return (Value) * 1e-1d; + case TemperatureChangeRateUnit.DegreeCelsiusPerMinute: return Value/60; + case TemperatureChangeRateUnit.DegreeCelsiusPerSecond: return Value; + case TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond: return (Value) * 1e2d; + case TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond: return (Value) * 1e3d; + case TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond: return (Value) * 1e-6d; + case TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond: return (Value) * 1e-3d; + case TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond: return (Value) * 1e-9d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -796,10 +797,10 @@ internal TemperatureChangeRate ToBaseUnit() return new TemperatureChangeRate(baseUnitValue, BaseUnit); } - private double GetValueAs(TemperatureChangeRateUnit unit) + private T GetValueAs(TemperatureChangeRateUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -916,7 +917,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -931,37 +932,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -985,17 +986,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs index d074cb57cf..5ce03346ec 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Difference between two temperatures. The conversions are different than for Temperature. /// - public partial struct TemperatureDelta : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct TemperatureDelta : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -68,12 +63,12 @@ static TemperatureDelta() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public TemperatureDelta(double value, TemperatureDeltaUnit unit) + public TemperatureDelta(T value, TemperatureDeltaUnit unit) { if(unit == TemperatureDeltaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -85,14 +80,14 @@ public TemperatureDelta(double value, TemperatureDeltaUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public TemperatureDelta(double value, UnitSystem unitSystem) + public TemperatureDelta(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -134,7 +129,7 @@ public TemperatureDelta(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Kelvin. /// - public static TemperatureDelta Zero { get; } = new TemperatureDelta(0, BaseUnit); + public static TemperatureDelta Zero { get; } = new TemperatureDelta((T)0, BaseUnit); #endregion @@ -143,7 +138,9 @@ public TemperatureDelta(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -173,42 +170,42 @@ public TemperatureDelta(double value, UnitSystem unitSystem) /// /// Get in DegreesCelsius. /// - public double DegreesCelsius => As(TemperatureDeltaUnit.DegreeCelsius); + public T DegreesCelsius => As(TemperatureDeltaUnit.DegreeCelsius); /// /// Get in DegreesDelisle. /// - public double DegreesDelisle => As(TemperatureDeltaUnit.DegreeDelisle); + public T DegreesDelisle => As(TemperatureDeltaUnit.DegreeDelisle); /// /// Get in DegreesFahrenheit. /// - public double DegreesFahrenheit => As(TemperatureDeltaUnit.DegreeFahrenheit); + public T DegreesFahrenheit => As(TemperatureDeltaUnit.DegreeFahrenheit); /// /// Get in DegreesNewton. /// - public double DegreesNewton => As(TemperatureDeltaUnit.DegreeNewton); + public T DegreesNewton => As(TemperatureDeltaUnit.DegreeNewton); /// /// Get in DegreesRankine. /// - public double DegreesRankine => As(TemperatureDeltaUnit.DegreeRankine); + public T DegreesRankine => As(TemperatureDeltaUnit.DegreeRankine); /// /// Get in DegreesReaumur. /// - public double DegreesReaumur => As(TemperatureDeltaUnit.DegreeReaumur); + public T DegreesReaumur => As(TemperatureDeltaUnit.DegreeReaumur); /// /// Get in DegreesRoemer. /// - public double DegreesRoemer => As(TemperatureDeltaUnit.DegreeRoemer); + public T DegreesRoemer => As(TemperatureDeltaUnit.DegreeRoemer); /// /// Get in Kelvins. /// - public double Kelvins => As(TemperatureDeltaUnit.Kelvin); + public T Kelvins => As(TemperatureDeltaUnit.Kelvin); #endregion @@ -243,73 +240,65 @@ public static string GetAbbreviation(TemperatureDeltaUnit unit, [CanBeNull] IFor /// Get from DegreesCelsius. /// /// If value is NaN or Infinity. - public static TemperatureDelta FromDegreesCelsius(QuantityValue degreescelsius) + public static TemperatureDelta FromDegreesCelsius(T degreescelsius) { - double value = (double) degreescelsius; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeCelsius); + return new TemperatureDelta(degreescelsius, TemperatureDeltaUnit.DegreeCelsius); } /// /// Get from DegreesDelisle. /// /// If value is NaN or Infinity. - public static TemperatureDelta FromDegreesDelisle(QuantityValue degreesdelisle) + public static TemperatureDelta FromDegreesDelisle(T degreesdelisle) { - double value = (double) degreesdelisle; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeDelisle); + return new TemperatureDelta(degreesdelisle, TemperatureDeltaUnit.DegreeDelisle); } /// /// Get from DegreesFahrenheit. /// /// If value is NaN or Infinity. - public static TemperatureDelta FromDegreesFahrenheit(QuantityValue degreesfahrenheit) + public static TemperatureDelta FromDegreesFahrenheit(T degreesfahrenheit) { - double value = (double) degreesfahrenheit; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeFahrenheit); + return new TemperatureDelta(degreesfahrenheit, TemperatureDeltaUnit.DegreeFahrenheit); } /// /// Get from DegreesNewton. /// /// If value is NaN or Infinity. - public static TemperatureDelta FromDegreesNewton(QuantityValue degreesnewton) + public static TemperatureDelta FromDegreesNewton(T degreesnewton) { - double value = (double) degreesnewton; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeNewton); + return new TemperatureDelta(degreesnewton, TemperatureDeltaUnit.DegreeNewton); } /// /// Get from DegreesRankine. /// /// If value is NaN or Infinity. - public static TemperatureDelta FromDegreesRankine(QuantityValue degreesrankine) + public static TemperatureDelta FromDegreesRankine(T degreesrankine) { - double value = (double) degreesrankine; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeRankine); + return new TemperatureDelta(degreesrankine, TemperatureDeltaUnit.DegreeRankine); } /// /// Get from DegreesReaumur. /// /// If value is NaN or Infinity. - public static TemperatureDelta FromDegreesReaumur(QuantityValue degreesreaumur) + public static TemperatureDelta FromDegreesReaumur(T degreesreaumur) { - double value = (double) degreesreaumur; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeReaumur); + return new TemperatureDelta(degreesreaumur, TemperatureDeltaUnit.DegreeReaumur); } /// /// Get from DegreesRoemer. /// /// If value is NaN or Infinity. - public static TemperatureDelta FromDegreesRoemer(QuantityValue degreesroemer) + public static TemperatureDelta FromDegreesRoemer(T degreesroemer) { - double value = (double) degreesroemer; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeRoemer); + return new TemperatureDelta(degreesroemer, TemperatureDeltaUnit.DegreeRoemer); } /// /// Get from Kelvins. /// /// If value is NaN or Infinity. - public static TemperatureDelta FromKelvins(QuantityValue kelvins) + public static TemperatureDelta FromKelvins(T kelvins) { - double value = (double) kelvins; - return new TemperatureDelta(value, TemperatureDeltaUnit.Kelvin); + return new TemperatureDelta(kelvins, TemperatureDeltaUnit.Kelvin); } /// @@ -318,9 +307,9 @@ public static TemperatureDelta FromKelvins(QuantityValue kelvins) /// Value to convert from. /// Unit to convert from. /// unit value. - public static TemperatureDelta From(QuantityValue value, TemperatureDeltaUnit fromUnit) + public static TemperatureDelta From(T value, TemperatureDeltaUnit fromUnit) { - return new TemperatureDelta((double)value, fromUnit); + return new TemperatureDelta(value, fromUnit); } #endregion @@ -474,43 +463,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper /// Negate the value. public static TemperatureDelta operator -(TemperatureDelta right) { - return new TemperatureDelta(-right.Value, right.Unit); + return new TemperatureDelta(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static TemperatureDelta operator +(TemperatureDelta left, TemperatureDelta right) { - return new TemperatureDelta(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new TemperatureDelta(value, left.Unit); } /// Get from subtracting two . public static TemperatureDelta operator -(TemperatureDelta left, TemperatureDelta right) { - return new TemperatureDelta(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new TemperatureDelta(value, left.Unit); } /// Get from multiplying value and . - public static TemperatureDelta operator *(double left, TemperatureDelta right) + public static TemperatureDelta operator *(T left, TemperatureDelta right) { - return new TemperatureDelta(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new TemperatureDelta(value, right.Unit); } /// Get from multiplying value and . - public static TemperatureDelta operator *(TemperatureDelta left, double right) + public static TemperatureDelta operator *(TemperatureDelta left, T right) { - return new TemperatureDelta(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new TemperatureDelta(value, left.Unit); } /// Get from dividing by value. - public static TemperatureDelta operator /(TemperatureDelta left, double right) + public static TemperatureDelta operator /(TemperatureDelta left, T right) { - return new TemperatureDelta(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new TemperatureDelta(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(TemperatureDelta left, TemperatureDelta right) + public static T operator /(TemperatureDelta left, TemperatureDelta right) { - return left.Kelvins / right.Kelvins; + return CompiledLambdas.Divide(left.Kelvins, right.Kelvins); } #endregion @@ -520,25 +514,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper /// Returns true if less or equal to. public static bool operator <=(TemperatureDelta left, TemperatureDelta right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(TemperatureDelta left, TemperatureDelta right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(TemperatureDelta left, TemperatureDelta right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(TemperatureDelta left, TemperatureDelta right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -567,7 +561,7 @@ public int CompareTo(object obj) /// public int CompareTo(TemperatureDelta other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -584,7 +578,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(TemperatureDelta other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -632,10 +626,8 @@ public bool Equals(TemperatureDelta other, double tolerance, ComparisonType c if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -655,17 +647,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(TemperatureDeltaUnit unit) + public T As(TemperatureDeltaUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -685,9 +677,14 @@ double IQuantity.As(Enum unit) if(!(unit is TemperatureDeltaUnit unitAsTemperatureDeltaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureDeltaUnit)} is supported.", nameof(unit)); - return As(unitAsTemperatureDeltaUnit); + var asValue = As(unitAsTemperatureDeltaUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(TemperatureDeltaUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -728,26 +725,32 @@ public TemperatureDelta ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(TemperatureDeltaUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(TemperatureDeltaUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case TemperatureDeltaUnit.DegreeCelsius: return _value; - case TemperatureDeltaUnit.DegreeDelisle: return _value*-2/3; - case TemperatureDeltaUnit.DegreeFahrenheit: return _value*5/9; - case TemperatureDeltaUnit.DegreeNewton: return _value*100/33; - case TemperatureDeltaUnit.DegreeRankine: return _value*5/9; - case TemperatureDeltaUnit.DegreeReaumur: return _value*5/4; - case TemperatureDeltaUnit.DegreeRoemer: return _value*40/21; - case TemperatureDeltaUnit.Kelvin: return _value; + case TemperatureDeltaUnit.DegreeCelsius: return Value; + case TemperatureDeltaUnit.DegreeDelisle: return Value*-2/3; + case TemperatureDeltaUnit.DegreeFahrenheit: return Value*5/9; + case TemperatureDeltaUnit.DegreeNewton: return Value*100/33; + case TemperatureDeltaUnit.DegreeRankine: return Value*5/9; + case TemperatureDeltaUnit.DegreeReaumur: return Value*5/4; + case TemperatureDeltaUnit.DegreeRoemer: return Value*40/21; + case TemperatureDeltaUnit.Kelvin: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -764,10 +767,10 @@ internal TemperatureDelta ToBaseUnit() return new TemperatureDelta(baseUnitValue, BaseUnit); } - private double GetValueAs(TemperatureDeltaUnit unit) + private T GetValueAs(TemperatureDeltaUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -882,7 +885,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -897,37 +900,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -951,17 +954,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs index 7a69d3a224..ee990666a9 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Thermal_Conductivity /// - public partial struct ThermalConductivity : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ThermalConductivity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -65,12 +60,12 @@ static ThermalConductivity() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ThermalConductivity(double value, ThermalConductivityUnit unit) + public ThermalConductivity(T value, ThermalConductivityUnit unit) { if(unit == ThermalConductivityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -82,14 +77,14 @@ public ThermalConductivity(double value, ThermalConductivityUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ThermalConductivity(double value, UnitSystem unitSystem) + public ThermalConductivity(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -131,7 +126,7 @@ public ThermalConductivity(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit WattPerMeterKelvin. /// - public static ThermalConductivity Zero { get; } = new ThermalConductivity(0, BaseUnit); + public static ThermalConductivity Zero { get; } = new ThermalConductivity((T)0, BaseUnit); #endregion @@ -140,7 +135,9 @@ public ThermalConductivity(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -170,12 +167,12 @@ public ThermalConductivity(double value, UnitSystem unitSystem) /// /// Get in BtusPerHourFootFahrenheit. /// - public double BtusPerHourFootFahrenheit => As(ThermalConductivityUnit.BtuPerHourFootFahrenheit); + public T BtusPerHourFootFahrenheit => As(ThermalConductivityUnit.BtuPerHourFootFahrenheit); /// /// Get in WattsPerMeterKelvin. /// - public double WattsPerMeterKelvin => As(ThermalConductivityUnit.WattPerMeterKelvin); + public T WattsPerMeterKelvin => As(ThermalConductivityUnit.WattPerMeterKelvin); #endregion @@ -210,19 +207,17 @@ public static string GetAbbreviation(ThermalConductivityUnit unit, [CanBeNull] I /// Get from BtusPerHourFootFahrenheit. /// /// If value is NaN or Infinity. - public static ThermalConductivity FromBtusPerHourFootFahrenheit(QuantityValue btusperhourfootfahrenheit) + public static ThermalConductivity FromBtusPerHourFootFahrenheit(T btusperhourfootfahrenheit) { - double value = (double) btusperhourfootfahrenheit; - return new ThermalConductivity(value, ThermalConductivityUnit.BtuPerHourFootFahrenheit); + return new ThermalConductivity(btusperhourfootfahrenheit, ThermalConductivityUnit.BtuPerHourFootFahrenheit); } /// /// Get from WattsPerMeterKelvin. /// /// If value is NaN or Infinity. - public static ThermalConductivity FromWattsPerMeterKelvin(QuantityValue wattspermeterkelvin) + public static ThermalConductivity FromWattsPerMeterKelvin(T wattspermeterkelvin) { - double value = (double) wattspermeterkelvin; - return new ThermalConductivity(value, ThermalConductivityUnit.WattPerMeterKelvin); + return new ThermalConductivity(wattspermeterkelvin, ThermalConductivityUnit.WattPerMeterKelvin); } /// @@ -231,9 +226,9 @@ public static ThermalConductivity FromWattsPerMeterKelvin(QuantityValue watts /// Value to convert from. /// Unit to convert from. /// unit value. - public static ThermalConductivity From(QuantityValue value, ThermalConductivityUnit fromUnit) + public static ThermalConductivity From(T value, ThermalConductivityUnit fromUnit) { - return new ThermalConductivity((double)value, fromUnit); + return new ThermalConductivity(value, fromUnit); } #endregion @@ -387,43 +382,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Therma /// Negate the value. public static ThermalConductivity operator -(ThermalConductivity right) { - return new ThermalConductivity(-right.Value, right.Unit); + return new ThermalConductivity(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ThermalConductivity operator +(ThermalConductivity left, ThermalConductivity right) { - return new ThermalConductivity(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ThermalConductivity(value, left.Unit); } /// Get from subtracting two . public static ThermalConductivity operator -(ThermalConductivity left, ThermalConductivity right) { - return new ThermalConductivity(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ThermalConductivity(value, left.Unit); } /// Get from multiplying value and . - public static ThermalConductivity operator *(double left, ThermalConductivity right) + public static ThermalConductivity operator *(T left, ThermalConductivity right) { - return new ThermalConductivity(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ThermalConductivity(value, right.Unit); } /// Get from multiplying value and . - public static ThermalConductivity operator *(ThermalConductivity left, double right) + public static ThermalConductivity operator *(ThermalConductivity left, T right) { - return new ThermalConductivity(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ThermalConductivity(value, left.Unit); } /// Get from dividing by value. - public static ThermalConductivity operator /(ThermalConductivity left, double right) + public static ThermalConductivity operator /(ThermalConductivity left, T right) { - return new ThermalConductivity(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ThermalConductivity(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ThermalConductivity left, ThermalConductivity right) + public static T operator /(ThermalConductivity left, ThermalConductivity right) { - return left.WattsPerMeterKelvin / right.WattsPerMeterKelvin; + return CompiledLambdas.Divide(left.WattsPerMeterKelvin, right.WattsPerMeterKelvin); } #endregion @@ -433,25 +433,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Therma /// Returns true if less or equal to. public static bool operator <=(ThermalConductivity left, ThermalConductivity right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ThermalConductivity left, ThermalConductivity right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ThermalConductivity left, ThermalConductivity right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ThermalConductivity left, ThermalConductivity right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -480,7 +480,7 @@ public int CompareTo(object obj) /// public int CompareTo(ThermalConductivity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -497,7 +497,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ThermalConductivity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -545,10 +545,8 @@ public bool Equals(ThermalConductivity other, double tolerance, ComparisonTyp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -568,17 +566,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ThermalConductivityUnit unit) + public T As(ThermalConductivityUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -598,9 +596,14 @@ double IQuantity.As(Enum unit) if(!(unit is ThermalConductivityUnit unitAsThermalConductivityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ThermalConductivityUnit)} is supported.", nameof(unit)); - return As(unitAsThermalConductivityUnit); + var asValue = As(unitAsThermalConductivityUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ThermalConductivityUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -641,20 +644,26 @@ public ThermalConductivity ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ThermalConductivityUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ThermalConductivityUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ThermalConductivityUnit.BtuPerHourFootFahrenheit: return _value*1.73073467; - case ThermalConductivityUnit.WattPerMeterKelvin: return _value; + case ThermalConductivityUnit.BtuPerHourFootFahrenheit: return Value*1.73073467; + case ThermalConductivityUnit.WattPerMeterKelvin: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -671,10 +680,10 @@ internal ThermalConductivity ToBaseUnit() return new ThermalConductivity(baseUnitValue, BaseUnit); } - private double GetValueAs(ThermalConductivityUnit unit) + private T GetValueAs(ThermalConductivityUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -783,7 +792,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -798,37 +807,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -852,17 +861,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs index 84e72ca39d..40d04ea0d3 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Heat Transfer Coefficient or Thermal conductivity - indicates a materials ability to conduct heat. /// - public partial struct ThermalResistance : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct ThermalResistance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -65,12 +60,12 @@ static ThermalResistance() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public ThermalResistance(double value, ThermalResistanceUnit unit) + public ThermalResistance(T value, ThermalResistanceUnit unit) { if(unit == ThermalResistanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -82,14 +77,14 @@ public ThermalResistance(double value, ThermalResistanceUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public ThermalResistance(double value, UnitSystem unitSystem) + public ThermalResistance(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -131,7 +126,7 @@ public ThermalResistance(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeterKelvinPerKilowatt. /// - public static ThermalResistance Zero { get; } = new ThermalResistance(0, BaseUnit); + public static ThermalResistance Zero { get; } = new ThermalResistance((T)0, BaseUnit); #endregion @@ -140,7 +135,9 @@ public ThermalResistance(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -170,27 +167,27 @@ public ThermalResistance(double value, UnitSystem unitSystem) /// /// Get in HourSquareFeetDegreesFahrenheitPerBtu. /// - public double HourSquareFeetDegreesFahrenheitPerBtu => As(ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu); + public T HourSquareFeetDegreesFahrenheitPerBtu => As(ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu); /// /// Get in SquareCentimeterHourDegreesCelsiusPerKilocalorie. /// - public double SquareCentimeterHourDegreesCelsiusPerKilocalorie => As(ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie); + public T SquareCentimeterHourDegreesCelsiusPerKilocalorie => As(ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie); /// /// Get in SquareCentimeterKelvinsPerWatt. /// - public double SquareCentimeterKelvinsPerWatt => As(ThermalResistanceUnit.SquareCentimeterKelvinPerWatt); + public T SquareCentimeterKelvinsPerWatt => As(ThermalResistanceUnit.SquareCentimeterKelvinPerWatt); /// /// Get in SquareMeterDegreesCelsiusPerWatt. /// - public double SquareMeterDegreesCelsiusPerWatt => As(ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt); + public T SquareMeterDegreesCelsiusPerWatt => As(ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt); /// /// Get in SquareMeterKelvinsPerKilowatt. /// - public double SquareMeterKelvinsPerKilowatt => As(ThermalResistanceUnit.SquareMeterKelvinPerKilowatt); + public T SquareMeterKelvinsPerKilowatt => As(ThermalResistanceUnit.SquareMeterKelvinPerKilowatt); #endregion @@ -225,46 +222,41 @@ public static string GetAbbreviation(ThermalResistanceUnit unit, [CanBeNull] IFo /// Get from HourSquareFeetDegreesFahrenheitPerBtu. /// /// If value is NaN or Infinity. - public static ThermalResistance FromHourSquareFeetDegreesFahrenheitPerBtu(QuantityValue hoursquarefeetdegreesfahrenheitperbtu) + public static ThermalResistance FromHourSquareFeetDegreesFahrenheitPerBtu(T hoursquarefeetdegreesfahrenheitperbtu) { - double value = (double) hoursquarefeetdegreesfahrenheitperbtu; - return new ThermalResistance(value, ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu); + return new ThermalResistance(hoursquarefeetdegreesfahrenheitperbtu, ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu); } /// /// Get from SquareCentimeterHourDegreesCelsiusPerKilocalorie. /// /// If value is NaN or Infinity. - public static ThermalResistance FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(QuantityValue squarecentimeterhourdegreescelsiusperkilocalorie) + public static ThermalResistance FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(T squarecentimeterhourdegreescelsiusperkilocalorie) { - double value = (double) squarecentimeterhourdegreescelsiusperkilocalorie; - return new ThermalResistance(value, ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie); + return new ThermalResistance(squarecentimeterhourdegreescelsiusperkilocalorie, ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie); } /// /// Get from SquareCentimeterKelvinsPerWatt. /// /// If value is NaN or Infinity. - public static ThermalResistance FromSquareCentimeterKelvinsPerWatt(QuantityValue squarecentimeterkelvinsperwatt) + public static ThermalResistance FromSquareCentimeterKelvinsPerWatt(T squarecentimeterkelvinsperwatt) { - double value = (double) squarecentimeterkelvinsperwatt; - return new ThermalResistance(value, ThermalResistanceUnit.SquareCentimeterKelvinPerWatt); + return new ThermalResistance(squarecentimeterkelvinsperwatt, ThermalResistanceUnit.SquareCentimeterKelvinPerWatt); } /// /// Get from SquareMeterDegreesCelsiusPerWatt. /// /// If value is NaN or Infinity. - public static ThermalResistance FromSquareMeterDegreesCelsiusPerWatt(QuantityValue squaremeterdegreescelsiusperwatt) + public static ThermalResistance FromSquareMeterDegreesCelsiusPerWatt(T squaremeterdegreescelsiusperwatt) { - double value = (double) squaremeterdegreescelsiusperwatt; - return new ThermalResistance(value, ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt); + return new ThermalResistance(squaremeterdegreescelsiusperwatt, ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt); } /// /// Get from SquareMeterKelvinsPerKilowatt. /// /// If value is NaN or Infinity. - public static ThermalResistance FromSquareMeterKelvinsPerKilowatt(QuantityValue squaremeterkelvinsperkilowatt) + public static ThermalResistance FromSquareMeterKelvinsPerKilowatt(T squaremeterkelvinsperkilowatt) { - double value = (double) squaremeterkelvinsperkilowatt; - return new ThermalResistance(value, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt); + return new ThermalResistance(squaremeterkelvinsperkilowatt, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt); } /// @@ -273,9 +265,9 @@ public static ThermalResistance FromSquareMeterKelvinsPerKilowatt(QuantityVal /// Value to convert from. /// Unit to convert from. /// unit value. - public static ThermalResistance From(QuantityValue value, ThermalResistanceUnit fromUnit) + public static ThermalResistance From(T value, ThermalResistanceUnit fromUnit) { - return new ThermalResistance((double)value, fromUnit); + return new ThermalResistance(value, fromUnit); } #endregion @@ -429,43 +421,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Therma /// Negate the value. public static ThermalResistance operator -(ThermalResistance right) { - return new ThermalResistance(-right.Value, right.Unit); + return new ThermalResistance(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static ThermalResistance operator +(ThermalResistance left, ThermalResistance right) { - return new ThermalResistance(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new ThermalResistance(value, left.Unit); } /// Get from subtracting two . public static ThermalResistance operator -(ThermalResistance left, ThermalResistance right) { - return new ThermalResistance(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new ThermalResistance(value, left.Unit); } /// Get from multiplying value and . - public static ThermalResistance operator *(double left, ThermalResistance right) + public static ThermalResistance operator *(T left, ThermalResistance right) { - return new ThermalResistance(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new ThermalResistance(value, right.Unit); } /// Get from multiplying value and . - public static ThermalResistance operator *(ThermalResistance left, double right) + public static ThermalResistance operator *(ThermalResistance left, T right) { - return new ThermalResistance(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new ThermalResistance(value, left.Unit); } /// Get from dividing by value. - public static ThermalResistance operator /(ThermalResistance left, double right) + public static ThermalResistance operator /(ThermalResistance left, T right) { - return new ThermalResistance(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new ThermalResistance(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(ThermalResistance left, ThermalResistance right) + public static T operator /(ThermalResistance left, ThermalResistance right) { - return left.SquareMeterKelvinsPerKilowatt / right.SquareMeterKelvinsPerKilowatt; + return CompiledLambdas.Divide(left.SquareMeterKelvinsPerKilowatt, right.SquareMeterKelvinsPerKilowatt); } #endregion @@ -475,25 +472,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Therma /// Returns true if less or equal to. public static bool operator <=(ThermalResistance left, ThermalResistance right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(ThermalResistance left, ThermalResistance right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(ThermalResistance left, ThermalResistance right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(ThermalResistance left, ThermalResistance right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -522,7 +519,7 @@ public int CompareTo(object obj) /// public int CompareTo(ThermalResistance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -539,7 +536,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ThermalResistance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -587,10 +584,8 @@ public bool Equals(ThermalResistance other, double tolerance, ComparisonType if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -610,17 +605,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ThermalResistanceUnit unit) + public T As(ThermalResistanceUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -640,9 +635,14 @@ double IQuantity.As(Enum unit) if(!(unit is ThermalResistanceUnit unitAsThermalResistanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ThermalResistanceUnit)} is supported.", nameof(unit)); - return As(unitAsThermalResistanceUnit); + var asValue = As(unitAsThermalResistanceUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(ThermalResistanceUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -683,23 +683,29 @@ public ThermalResistance ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(ThermalResistanceUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(ThermalResistanceUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu: return _value*176.1121482159839; - case ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie: return _value*0.0859779507590433; - case ThermalResistanceUnit.SquareCentimeterKelvinPerWatt: return _value*0.0999964777570357; - case ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt: return _value*1000.088056074108; - case ThermalResistanceUnit.SquareMeterKelvinPerKilowatt: return _value; + case ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu: return Value*176.1121482159839; + case ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie: return Value*0.0859779507590433; + case ThermalResistanceUnit.SquareCentimeterKelvinPerWatt: return Value*0.0999964777570357; + case ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt: return Value*1000.088056074108; + case ThermalResistanceUnit.SquareMeterKelvinPerKilowatt: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -716,10 +722,10 @@ internal ThermalResistance ToBaseUnit() return new ThermalResistance(baseUnitValue, BaseUnit); } - private double GetValueAs(ThermalResistanceUnit unit) + private T GetValueAs(ThermalResistanceUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -831,7 +837,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -846,37 +852,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -900,17 +906,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs index 8a3fb1d239..9d9c68e6c2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Torque, moment or moment of force (see the terminology below), is the tendency of a force to rotate an object about an axis,[1] fulcrum, or pivot. Just as a force is a push or a pull, a torque can be thought of as a twist to an object. Mathematically, torque is defined as the cross product of the lever-arm distance and force, which tends to produce rotation. Loosely speaking, torque is a measure of the turning force on an object such as a bolt or a flywheel. For example, pushing or pulling the handle of a wrench connected to a nut or bolt produces a torque (turning force) that loosens or tightens the nut or bolt. /// - public partial struct Torque : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Torque : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -81,12 +76,12 @@ static Torque() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Torque(double value, TorqueUnit unit) + public Torque(T value, TorqueUnit unit) { if(unit == TorqueUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -98,14 +93,14 @@ public Torque(double value, TorqueUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Torque(double value, UnitSystem unitSystem) + public Torque(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -147,7 +142,7 @@ public Torque(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeter. /// - public static Torque Zero { get; } = new Torque(0, BaseUnit); + public static Torque Zero { get; } = new Torque((T)0, BaseUnit); #endregion @@ -156,7 +151,9 @@ public Torque(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -186,107 +183,107 @@ public Torque(double value, UnitSystem unitSystem) /// /// Get in KilogramForceCentimeters. /// - public double KilogramForceCentimeters => As(TorqueUnit.KilogramForceCentimeter); + public T KilogramForceCentimeters => As(TorqueUnit.KilogramForceCentimeter); /// /// Get in KilogramForceMeters. /// - public double KilogramForceMeters => As(TorqueUnit.KilogramForceMeter); + public T KilogramForceMeters => As(TorqueUnit.KilogramForceMeter); /// /// Get in KilogramForceMillimeters. /// - public double KilogramForceMillimeters => As(TorqueUnit.KilogramForceMillimeter); + public T KilogramForceMillimeters => As(TorqueUnit.KilogramForceMillimeter); /// /// Get in KilonewtonCentimeters. /// - public double KilonewtonCentimeters => As(TorqueUnit.KilonewtonCentimeter); + public T KilonewtonCentimeters => As(TorqueUnit.KilonewtonCentimeter); /// /// Get in KilonewtonMeters. /// - public double KilonewtonMeters => As(TorqueUnit.KilonewtonMeter); + public T KilonewtonMeters => As(TorqueUnit.KilonewtonMeter); /// /// Get in KilonewtonMillimeters. /// - public double KilonewtonMillimeters => As(TorqueUnit.KilonewtonMillimeter); + public T KilonewtonMillimeters => As(TorqueUnit.KilonewtonMillimeter); /// /// Get in KilopoundForceFeet. /// - public double KilopoundForceFeet => As(TorqueUnit.KilopoundForceFoot); + public T KilopoundForceFeet => As(TorqueUnit.KilopoundForceFoot); /// /// Get in KilopoundForceInches. /// - public double KilopoundForceInches => As(TorqueUnit.KilopoundForceInch); + public T KilopoundForceInches => As(TorqueUnit.KilopoundForceInch); /// /// Get in MeganewtonCentimeters. /// - public double MeganewtonCentimeters => As(TorqueUnit.MeganewtonCentimeter); + public T MeganewtonCentimeters => As(TorqueUnit.MeganewtonCentimeter); /// /// Get in MeganewtonMeters. /// - public double MeganewtonMeters => As(TorqueUnit.MeganewtonMeter); + public T MeganewtonMeters => As(TorqueUnit.MeganewtonMeter); /// /// Get in MeganewtonMillimeters. /// - public double MeganewtonMillimeters => As(TorqueUnit.MeganewtonMillimeter); + public T MeganewtonMillimeters => As(TorqueUnit.MeganewtonMillimeter); /// /// Get in MegapoundForceFeet. /// - public double MegapoundForceFeet => As(TorqueUnit.MegapoundForceFoot); + public T MegapoundForceFeet => As(TorqueUnit.MegapoundForceFoot); /// /// Get in MegapoundForceInches. /// - public double MegapoundForceInches => As(TorqueUnit.MegapoundForceInch); + public T MegapoundForceInches => As(TorqueUnit.MegapoundForceInch); /// /// Get in NewtonCentimeters. /// - public double NewtonCentimeters => As(TorqueUnit.NewtonCentimeter); + public T NewtonCentimeters => As(TorqueUnit.NewtonCentimeter); /// /// Get in NewtonMeters. /// - public double NewtonMeters => As(TorqueUnit.NewtonMeter); + public T NewtonMeters => As(TorqueUnit.NewtonMeter); /// /// Get in NewtonMillimeters. /// - public double NewtonMillimeters => As(TorqueUnit.NewtonMillimeter); + public T NewtonMillimeters => As(TorqueUnit.NewtonMillimeter); /// /// Get in PoundForceFeet. /// - public double PoundForceFeet => As(TorqueUnit.PoundForceFoot); + public T PoundForceFeet => As(TorqueUnit.PoundForceFoot); /// /// Get in PoundForceInches. /// - public double PoundForceInches => As(TorqueUnit.PoundForceInch); + public T PoundForceInches => As(TorqueUnit.PoundForceInch); /// /// Get in TonneForceCentimeters. /// - public double TonneForceCentimeters => As(TorqueUnit.TonneForceCentimeter); + public T TonneForceCentimeters => As(TorqueUnit.TonneForceCentimeter); /// /// Get in TonneForceMeters. /// - public double TonneForceMeters => As(TorqueUnit.TonneForceMeter); + public T TonneForceMeters => As(TorqueUnit.TonneForceMeter); /// /// Get in TonneForceMillimeters. /// - public double TonneForceMillimeters => As(TorqueUnit.TonneForceMillimeter); + public T TonneForceMillimeters => As(TorqueUnit.TonneForceMillimeter); #endregion @@ -321,190 +318,169 @@ public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] IFormatProvide /// Get from KilogramForceCentimeters. /// /// If value is NaN or Infinity. - public static Torque FromKilogramForceCentimeters(QuantityValue kilogramforcecentimeters) + public static Torque FromKilogramForceCentimeters(T kilogramforcecentimeters) { - double value = (double) kilogramforcecentimeters; - return new Torque(value, TorqueUnit.KilogramForceCentimeter); + return new Torque(kilogramforcecentimeters, TorqueUnit.KilogramForceCentimeter); } /// /// Get from KilogramForceMeters. /// /// If value is NaN or Infinity. - public static Torque FromKilogramForceMeters(QuantityValue kilogramforcemeters) + public static Torque FromKilogramForceMeters(T kilogramforcemeters) { - double value = (double) kilogramforcemeters; - return new Torque(value, TorqueUnit.KilogramForceMeter); + return new Torque(kilogramforcemeters, TorqueUnit.KilogramForceMeter); } /// /// Get from KilogramForceMillimeters. /// /// If value is NaN or Infinity. - public static Torque FromKilogramForceMillimeters(QuantityValue kilogramforcemillimeters) + public static Torque FromKilogramForceMillimeters(T kilogramforcemillimeters) { - double value = (double) kilogramforcemillimeters; - return new Torque(value, TorqueUnit.KilogramForceMillimeter); + return new Torque(kilogramforcemillimeters, TorqueUnit.KilogramForceMillimeter); } /// /// Get from KilonewtonCentimeters. /// /// If value is NaN or Infinity. - public static Torque FromKilonewtonCentimeters(QuantityValue kilonewtoncentimeters) + public static Torque FromKilonewtonCentimeters(T kilonewtoncentimeters) { - double value = (double) kilonewtoncentimeters; - return new Torque(value, TorqueUnit.KilonewtonCentimeter); + return new Torque(kilonewtoncentimeters, TorqueUnit.KilonewtonCentimeter); } /// /// Get from KilonewtonMeters. /// /// If value is NaN or Infinity. - public static Torque FromKilonewtonMeters(QuantityValue kilonewtonmeters) + public static Torque FromKilonewtonMeters(T kilonewtonmeters) { - double value = (double) kilonewtonmeters; - return new Torque(value, TorqueUnit.KilonewtonMeter); + return new Torque(kilonewtonmeters, TorqueUnit.KilonewtonMeter); } /// /// Get from KilonewtonMillimeters. /// /// If value is NaN or Infinity. - public static Torque FromKilonewtonMillimeters(QuantityValue kilonewtonmillimeters) + public static Torque FromKilonewtonMillimeters(T kilonewtonmillimeters) { - double value = (double) kilonewtonmillimeters; - return new Torque(value, TorqueUnit.KilonewtonMillimeter); + return new Torque(kilonewtonmillimeters, TorqueUnit.KilonewtonMillimeter); } /// /// Get from KilopoundForceFeet. /// /// If value is NaN or Infinity. - public static Torque FromKilopoundForceFeet(QuantityValue kilopoundforcefeet) + public static Torque FromKilopoundForceFeet(T kilopoundforcefeet) { - double value = (double) kilopoundforcefeet; - return new Torque(value, TorqueUnit.KilopoundForceFoot); + return new Torque(kilopoundforcefeet, TorqueUnit.KilopoundForceFoot); } /// /// Get from KilopoundForceInches. /// /// If value is NaN or Infinity. - public static Torque FromKilopoundForceInches(QuantityValue kilopoundforceinches) + public static Torque FromKilopoundForceInches(T kilopoundforceinches) { - double value = (double) kilopoundforceinches; - return new Torque(value, TorqueUnit.KilopoundForceInch); + return new Torque(kilopoundforceinches, TorqueUnit.KilopoundForceInch); } /// /// Get from MeganewtonCentimeters. /// /// If value is NaN or Infinity. - public static Torque FromMeganewtonCentimeters(QuantityValue meganewtoncentimeters) + public static Torque FromMeganewtonCentimeters(T meganewtoncentimeters) { - double value = (double) meganewtoncentimeters; - return new Torque(value, TorqueUnit.MeganewtonCentimeter); + return new Torque(meganewtoncentimeters, TorqueUnit.MeganewtonCentimeter); } /// /// Get from MeganewtonMeters. /// /// If value is NaN or Infinity. - public static Torque FromMeganewtonMeters(QuantityValue meganewtonmeters) + public static Torque FromMeganewtonMeters(T meganewtonmeters) { - double value = (double) meganewtonmeters; - return new Torque(value, TorqueUnit.MeganewtonMeter); + return new Torque(meganewtonmeters, TorqueUnit.MeganewtonMeter); } /// /// Get from MeganewtonMillimeters. /// /// If value is NaN or Infinity. - public static Torque FromMeganewtonMillimeters(QuantityValue meganewtonmillimeters) + public static Torque FromMeganewtonMillimeters(T meganewtonmillimeters) { - double value = (double) meganewtonmillimeters; - return new Torque(value, TorqueUnit.MeganewtonMillimeter); + return new Torque(meganewtonmillimeters, TorqueUnit.MeganewtonMillimeter); } /// /// Get from MegapoundForceFeet. /// /// If value is NaN or Infinity. - public static Torque FromMegapoundForceFeet(QuantityValue megapoundforcefeet) + public static Torque FromMegapoundForceFeet(T megapoundforcefeet) { - double value = (double) megapoundforcefeet; - return new Torque(value, TorqueUnit.MegapoundForceFoot); + return new Torque(megapoundforcefeet, TorqueUnit.MegapoundForceFoot); } /// /// Get from MegapoundForceInches. /// /// If value is NaN or Infinity. - public static Torque FromMegapoundForceInches(QuantityValue megapoundforceinches) + public static Torque FromMegapoundForceInches(T megapoundforceinches) { - double value = (double) megapoundforceinches; - return new Torque(value, TorqueUnit.MegapoundForceInch); + return new Torque(megapoundforceinches, TorqueUnit.MegapoundForceInch); } /// /// Get from NewtonCentimeters. /// /// If value is NaN or Infinity. - public static Torque FromNewtonCentimeters(QuantityValue newtoncentimeters) + public static Torque FromNewtonCentimeters(T newtoncentimeters) { - double value = (double) newtoncentimeters; - return new Torque(value, TorqueUnit.NewtonCentimeter); + return new Torque(newtoncentimeters, TorqueUnit.NewtonCentimeter); } /// /// Get from NewtonMeters. /// /// If value is NaN or Infinity. - public static Torque FromNewtonMeters(QuantityValue newtonmeters) + public static Torque FromNewtonMeters(T newtonmeters) { - double value = (double) newtonmeters; - return new Torque(value, TorqueUnit.NewtonMeter); + return new Torque(newtonmeters, TorqueUnit.NewtonMeter); } /// /// Get from NewtonMillimeters. /// /// If value is NaN or Infinity. - public static Torque FromNewtonMillimeters(QuantityValue newtonmillimeters) + public static Torque FromNewtonMillimeters(T newtonmillimeters) { - double value = (double) newtonmillimeters; - return new Torque(value, TorqueUnit.NewtonMillimeter); + return new Torque(newtonmillimeters, TorqueUnit.NewtonMillimeter); } /// /// Get from PoundForceFeet. /// /// If value is NaN or Infinity. - public static Torque FromPoundForceFeet(QuantityValue poundforcefeet) + public static Torque FromPoundForceFeet(T poundforcefeet) { - double value = (double) poundforcefeet; - return new Torque(value, TorqueUnit.PoundForceFoot); + return new Torque(poundforcefeet, TorqueUnit.PoundForceFoot); } /// /// Get from PoundForceInches. /// /// If value is NaN or Infinity. - public static Torque FromPoundForceInches(QuantityValue poundforceinches) + public static Torque FromPoundForceInches(T poundforceinches) { - double value = (double) poundforceinches; - return new Torque(value, TorqueUnit.PoundForceInch); + return new Torque(poundforceinches, TorqueUnit.PoundForceInch); } /// /// Get from TonneForceCentimeters. /// /// If value is NaN or Infinity. - public static Torque FromTonneForceCentimeters(QuantityValue tonneforcecentimeters) + public static Torque FromTonneForceCentimeters(T tonneforcecentimeters) { - double value = (double) tonneforcecentimeters; - return new Torque(value, TorqueUnit.TonneForceCentimeter); + return new Torque(tonneforcecentimeters, TorqueUnit.TonneForceCentimeter); } /// /// Get from TonneForceMeters. /// /// If value is NaN or Infinity. - public static Torque FromTonneForceMeters(QuantityValue tonneforcemeters) + public static Torque FromTonneForceMeters(T tonneforcemeters) { - double value = (double) tonneforcemeters; - return new Torque(value, TorqueUnit.TonneForceMeter); + return new Torque(tonneforcemeters, TorqueUnit.TonneForceMeter); } /// /// Get from TonneForceMillimeters. /// /// If value is NaN or Infinity. - public static Torque FromTonneForceMillimeters(QuantityValue tonneforcemillimeters) + public static Torque FromTonneForceMillimeters(T tonneforcemillimeters) { - double value = (double) tonneforcemillimeters; - return new Torque(value, TorqueUnit.TonneForceMillimeter); + return new Torque(tonneforcemillimeters, TorqueUnit.TonneForceMillimeter); } /// @@ -513,9 +489,9 @@ public static Torque FromTonneForceMillimeters(QuantityValue tonneforcemillim /// Value to convert from. /// Unit to convert from. /// unit value. - public static Torque From(QuantityValue value, TorqueUnit fromUnit) + public static Torque From(T value, TorqueUnit fromUnit) { - return new Torque((double)value, fromUnit); + return new Torque(value, fromUnit); } #endregion @@ -669,43 +645,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Torque /// Negate the value. public static Torque operator -(Torque right) { - return new Torque(-right.Value, right.Unit); + return new Torque(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Torque operator +(Torque left, Torque right) { - return new Torque(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Torque(value, left.Unit); } /// Get from subtracting two . public static Torque operator -(Torque left, Torque right) { - return new Torque(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Torque(value, left.Unit); } /// Get from multiplying value and . - public static Torque operator *(double left, Torque right) + public static Torque operator *(T left, Torque right) { - return new Torque(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Torque(value, right.Unit); } /// Get from multiplying value and . - public static Torque operator *(Torque left, double right) + public static Torque operator *(Torque left, T right) { - return new Torque(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Torque(value, left.Unit); } /// Get from dividing by value. - public static Torque operator /(Torque left, double right) + public static Torque operator /(Torque left, T right) { - return new Torque(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Torque(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Torque left, Torque right) + public static T operator /(Torque left, Torque right) { - return left.NewtonMeters / right.NewtonMeters; + return CompiledLambdas.Divide(left.NewtonMeters, right.NewtonMeters); } #endregion @@ -715,25 +696,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Torque /// Returns true if less or equal to. public static bool operator <=(Torque left, Torque right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Torque left, Torque right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Torque left, Torque right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Torque left, Torque right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -762,7 +743,7 @@ public int CompareTo(object obj) /// public int CompareTo(Torque other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -779,7 +760,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Torque other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -827,10 +808,8 @@ public bool Equals(Torque other, double tolerance, ComparisonType comparisonT if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -850,17 +829,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(TorqueUnit unit) + public T As(TorqueUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -880,9 +859,14 @@ double IQuantity.As(Enum unit) if(!(unit is TorqueUnit unitAsTorqueUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TorqueUnit)} is supported.", nameof(unit)); - return As(unitAsTorqueUnit); + var asValue = As(unitAsTorqueUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(TorqueUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -923,39 +907,45 @@ public Torque ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(TorqueUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(TorqueUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case TorqueUnit.KilogramForceCentimeter: return _value*0.0980665019960652; - case TorqueUnit.KilogramForceMeter: return _value*9.80665019960652; - case TorqueUnit.KilogramForceMillimeter: return _value*0.00980665019960652; - case TorqueUnit.KilonewtonCentimeter: return (_value*0.01) * 1e3d; - case TorqueUnit.KilonewtonMeter: return (_value) * 1e3d; - case TorqueUnit.KilonewtonMillimeter: return (_value*0.001) * 1e3d; - case TorqueUnit.KilopoundForceFoot: return (_value*1.3558179483314) * 1e3d; - case TorqueUnit.KilopoundForceInch: return (_value*1.129848290276167e-1) * 1e3d; - case TorqueUnit.MeganewtonCentimeter: return (_value*0.01) * 1e6d; - case TorqueUnit.MeganewtonMeter: return (_value) * 1e6d; - case TorqueUnit.MeganewtonMillimeter: return (_value*0.001) * 1e6d; - case TorqueUnit.MegapoundForceFoot: return (_value*1.3558179483314) * 1e6d; - case TorqueUnit.MegapoundForceInch: return (_value*1.129848290276167e-1) * 1e6d; - case TorqueUnit.NewtonCentimeter: return _value*0.01; - case TorqueUnit.NewtonMeter: return _value; - case TorqueUnit.NewtonMillimeter: return _value*0.001; - case TorqueUnit.PoundForceFoot: return _value*1.3558179483314; - case TorqueUnit.PoundForceInch: return _value*1.129848290276167e-1; - case TorqueUnit.TonneForceCentimeter: return _value*98.0665019960652; - case TorqueUnit.TonneForceMeter: return _value*9806.65019960653; - case TorqueUnit.TonneForceMillimeter: return _value*9.80665019960652; + case TorqueUnit.KilogramForceCentimeter: return Value*0.0980665019960652; + case TorqueUnit.KilogramForceMeter: return Value*9.80665019960652; + case TorqueUnit.KilogramForceMillimeter: return Value*0.00980665019960652; + case TorqueUnit.KilonewtonCentimeter: return (Value*0.01) * 1e3d; + case TorqueUnit.KilonewtonMeter: return (Value) * 1e3d; + case TorqueUnit.KilonewtonMillimeter: return (Value*0.001) * 1e3d; + case TorqueUnit.KilopoundForceFoot: return (Value*1.3558179483314) * 1e3d; + case TorqueUnit.KilopoundForceInch: return (Value*1.129848290276167e-1) * 1e3d; + case TorqueUnit.MeganewtonCentimeter: return (Value*0.01) * 1e6d; + case TorqueUnit.MeganewtonMeter: return (Value) * 1e6d; + case TorqueUnit.MeganewtonMillimeter: return (Value*0.001) * 1e6d; + case TorqueUnit.MegapoundForceFoot: return (Value*1.3558179483314) * 1e6d; + case TorqueUnit.MegapoundForceInch: return (Value*1.129848290276167e-1) * 1e6d; + case TorqueUnit.NewtonCentimeter: return Value*0.01; + case TorqueUnit.NewtonMeter: return Value; + case TorqueUnit.NewtonMillimeter: return Value*0.001; + case TorqueUnit.PoundForceFoot: return Value*1.3558179483314; + case TorqueUnit.PoundForceInch: return Value*1.129848290276167e-1; + case TorqueUnit.TonneForceCentimeter: return Value*98.0665019960652; + case TorqueUnit.TonneForceMeter: return Value*9806.65019960653; + case TorqueUnit.TonneForceMillimeter: return Value*9.80665019960652; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -972,10 +962,10 @@ internal Torque ToBaseUnit() return new Torque(baseUnitValue, BaseUnit); } - private double GetValueAs(TorqueUnit unit) + private T GetValueAs(TorqueUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1103,7 +1093,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1118,37 +1108,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1172,17 +1162,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs index 585b89947b..3c4730ef51 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Vitamin A: 1 IU is the biological equivalent of 0.3 µg retinol, or of 0.6 µg beta-carotene. /// - public partial struct VitaminA : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct VitaminA : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -61,12 +56,12 @@ static VitaminA() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public VitaminA(double value, VitaminAUnit unit) + public VitaminA(T value, VitaminAUnit unit) { if(unit == VitaminAUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -78,14 +73,14 @@ public VitaminA(double value, VitaminAUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public VitaminA(double value, UnitSystem unitSystem) + public VitaminA(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -127,7 +122,7 @@ public VitaminA(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit InternationalUnit. /// - public static VitaminA Zero { get; } = new VitaminA(0, BaseUnit); + public static VitaminA Zero { get; } = new VitaminA((T)0, BaseUnit); #endregion @@ -136,7 +131,9 @@ public VitaminA(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -166,7 +163,7 @@ public VitaminA(double value, UnitSystem unitSystem) /// /// Get in InternationalUnits. /// - public double InternationalUnits => As(VitaminAUnit.InternationalUnit); + public T InternationalUnits => As(VitaminAUnit.InternationalUnit); #endregion @@ -201,10 +198,9 @@ public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] IFormatProvi /// Get from InternationalUnits. /// /// If value is NaN or Infinity. - public static VitaminA FromInternationalUnits(QuantityValue internationalunits) + public static VitaminA FromInternationalUnits(T internationalunits) { - double value = (double) internationalunits; - return new VitaminA(value, VitaminAUnit.InternationalUnit); + return new VitaminA(internationalunits, VitaminAUnit.InternationalUnit); } /// @@ -213,9 +209,9 @@ public static VitaminA FromInternationalUnits(QuantityValue internationalunit /// Value to convert from. /// Unit to convert from. /// unit value. - public static VitaminA From(QuantityValue value, VitaminAUnit fromUnit) + public static VitaminA From(T value, VitaminAUnit fromUnit) { - return new VitaminA((double)value, fromUnit); + return new VitaminA(value, fromUnit); } #endregion @@ -369,43 +365,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Vitami /// Negate the value. public static VitaminA operator -(VitaminA right) { - return new VitaminA(-right.Value, right.Unit); + return new VitaminA(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static VitaminA operator +(VitaminA left, VitaminA right) { - return new VitaminA(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new VitaminA(value, left.Unit); } /// Get from subtracting two . public static VitaminA operator -(VitaminA left, VitaminA right) { - return new VitaminA(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new VitaminA(value, left.Unit); } /// Get from multiplying value and . - public static VitaminA operator *(double left, VitaminA right) + public static VitaminA operator *(T left, VitaminA right) { - return new VitaminA(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new VitaminA(value, right.Unit); } /// Get from multiplying value and . - public static VitaminA operator *(VitaminA left, double right) + public static VitaminA operator *(VitaminA left, T right) { - return new VitaminA(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new VitaminA(value, left.Unit); } /// Get from dividing by value. - public static VitaminA operator /(VitaminA left, double right) + public static VitaminA operator /(VitaminA left, T right) { - return new VitaminA(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new VitaminA(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(VitaminA left, VitaminA right) + public static T operator /(VitaminA left, VitaminA right) { - return left.InternationalUnits / right.InternationalUnits; + return CompiledLambdas.Divide(left.InternationalUnits, right.InternationalUnits); } #endregion @@ -415,25 +416,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Vitami /// Returns true if less or equal to. public static bool operator <=(VitaminA left, VitaminA right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(VitaminA left, VitaminA right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(VitaminA left, VitaminA right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(VitaminA left, VitaminA right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -462,7 +463,7 @@ public int CompareTo(object obj) /// public int CompareTo(VitaminA other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -479,7 +480,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(VitaminA other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -527,10 +528,8 @@ public bool Equals(VitaminA other, double tolerance, ComparisonType compariso if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -550,17 +549,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(VitaminAUnit unit) + public T As(VitaminAUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -580,9 +579,14 @@ double IQuantity.As(Enum unit) if(!(unit is VitaminAUnit unitAsVitaminAUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VitaminAUnit)} is supported.", nameof(unit)); - return As(unitAsVitaminAUnit); + var asValue = As(unitAsVitaminAUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(VitaminAUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -623,19 +627,25 @@ public VitaminA ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(VitaminAUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(VitaminAUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case VitaminAUnit.InternationalUnit: return _value; + case VitaminAUnit.InternationalUnit: return Value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -652,10 +662,10 @@ internal VitaminA ToBaseUnit() return new VitaminA(baseUnitValue, BaseUnit); } - private double GetValueAs(VitaminAUnit unit) + private T GetValueAs(VitaminAUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -763,7 +773,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -778,37 +788,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -832,17 +842,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs index bae8b9b039..dd9120add9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Volume is the quantity of three-dimensional space enclosed by some closed boundary, for example, the space that a substance (solid, liquid, gas, or plasma) or shape occupies or contains.[1] Volume is often quantified numerically using the SI derived unit, the cubic metre. The volume of a container is generally understood to be the capacity of the container, i. e. the amount of fluid (gas or liquid) that the container could hold, rather than the amount of space the container itself displaces. /// - public partial struct Volume : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct Volume : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -107,12 +102,12 @@ static Volume() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public Volume(double value, VolumeUnit unit) + public Volume(T value, VolumeUnit unit) { if(unit == VolumeUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -124,14 +119,14 @@ public Volume(double value, VolumeUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public Volume(double value, UnitSystem unitSystem) + public Volume(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -173,7 +168,7 @@ public Volume(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeter. /// - public static Volume Zero { get; } = new Volume(0, BaseUnit); + public static Volume Zero { get; } = new Volume((T)0, BaseUnit); #endregion @@ -182,7 +177,9 @@ public Volume(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -212,237 +209,237 @@ public Volume(double value, UnitSystem unitSystem) /// /// Get in AcreFeet. /// - public double AcreFeet => As(VolumeUnit.AcreFoot); + public T AcreFeet => As(VolumeUnit.AcreFoot); /// /// Get in AuTablespoons. /// - public double AuTablespoons => As(VolumeUnit.AuTablespoon); + public T AuTablespoons => As(VolumeUnit.AuTablespoon); /// /// Get in Centiliters. /// - public double Centiliters => As(VolumeUnit.Centiliter); + public T Centiliters => As(VolumeUnit.Centiliter); /// /// Get in CubicCentimeters. /// - public double CubicCentimeters => As(VolumeUnit.CubicCentimeter); + public T CubicCentimeters => As(VolumeUnit.CubicCentimeter); /// /// Get in CubicDecimeters. /// - public double CubicDecimeters => As(VolumeUnit.CubicDecimeter); + public T CubicDecimeters => As(VolumeUnit.CubicDecimeter); /// /// Get in CubicFeet. /// - public double CubicFeet => As(VolumeUnit.CubicFoot); + public T CubicFeet => As(VolumeUnit.CubicFoot); /// /// Get in CubicHectometers. /// - public double CubicHectometers => As(VolumeUnit.CubicHectometer); + public T CubicHectometers => As(VolumeUnit.CubicHectometer); /// /// Get in CubicInches. /// - public double CubicInches => As(VolumeUnit.CubicInch); + public T CubicInches => As(VolumeUnit.CubicInch); /// /// Get in CubicKilometers. /// - public double CubicKilometers => As(VolumeUnit.CubicKilometer); + public T CubicKilometers => As(VolumeUnit.CubicKilometer); /// /// Get in CubicMeters. /// - public double CubicMeters => As(VolumeUnit.CubicMeter); + public T CubicMeters => As(VolumeUnit.CubicMeter); /// /// Get in CubicMicrometers. /// - public double CubicMicrometers => As(VolumeUnit.CubicMicrometer); + public T CubicMicrometers => As(VolumeUnit.CubicMicrometer); /// /// Get in CubicMiles. /// - public double CubicMiles => As(VolumeUnit.CubicMile); + public T CubicMiles => As(VolumeUnit.CubicMile); /// /// Get in CubicMillimeters. /// - public double CubicMillimeters => As(VolumeUnit.CubicMillimeter); + public T CubicMillimeters => As(VolumeUnit.CubicMillimeter); /// /// Get in CubicYards. /// - public double CubicYards => As(VolumeUnit.CubicYard); + public T CubicYards => As(VolumeUnit.CubicYard); /// /// Get in Deciliters. /// - public double Deciliters => As(VolumeUnit.Deciliter); + public T Deciliters => As(VolumeUnit.Deciliter); /// /// Get in HectocubicFeet. /// - public double HectocubicFeet => As(VolumeUnit.HectocubicFoot); + public T HectocubicFeet => As(VolumeUnit.HectocubicFoot); /// /// Get in HectocubicMeters. /// - public double HectocubicMeters => As(VolumeUnit.HectocubicMeter); + public T HectocubicMeters => As(VolumeUnit.HectocubicMeter); /// /// Get in Hectoliters. /// - public double Hectoliters => As(VolumeUnit.Hectoliter); + public T Hectoliters => As(VolumeUnit.Hectoliter); /// /// Get in ImperialBeerBarrels. /// - public double ImperialBeerBarrels => As(VolumeUnit.ImperialBeerBarrel); + public T ImperialBeerBarrels => As(VolumeUnit.ImperialBeerBarrel); /// /// Get in ImperialGallons. /// - public double ImperialGallons => As(VolumeUnit.ImperialGallon); + public T ImperialGallons => As(VolumeUnit.ImperialGallon); /// /// Get in ImperialOunces. /// - public double ImperialOunces => As(VolumeUnit.ImperialOunce); + public T ImperialOunces => As(VolumeUnit.ImperialOunce); /// /// Get in ImperialPints. /// - public double ImperialPints => As(VolumeUnit.ImperialPint); + public T ImperialPints => As(VolumeUnit.ImperialPint); /// /// Get in KilocubicFeet. /// - public double KilocubicFeet => As(VolumeUnit.KilocubicFoot); + public T KilocubicFeet => As(VolumeUnit.KilocubicFoot); /// /// Get in KilocubicMeters. /// - public double KilocubicMeters => As(VolumeUnit.KilocubicMeter); + public T KilocubicMeters => As(VolumeUnit.KilocubicMeter); /// /// Get in KiloimperialGallons. /// - public double KiloimperialGallons => As(VolumeUnit.KiloimperialGallon); + public T KiloimperialGallons => As(VolumeUnit.KiloimperialGallon); /// /// Get in Kiloliters. /// - public double Kiloliters => As(VolumeUnit.Kiloliter); + public T Kiloliters => As(VolumeUnit.Kiloliter); /// /// Get in KilousGallons. /// - public double KilousGallons => As(VolumeUnit.KilousGallon); + public T KilousGallons => As(VolumeUnit.KilousGallon); /// /// Get in Liters. /// - public double Liters => As(VolumeUnit.Liter); + public T Liters => As(VolumeUnit.Liter); /// /// Get in MegacubicFeet. /// - public double MegacubicFeet => As(VolumeUnit.MegacubicFoot); + public T MegacubicFeet => As(VolumeUnit.MegacubicFoot); /// /// Get in MegaimperialGallons. /// - public double MegaimperialGallons => As(VolumeUnit.MegaimperialGallon); + public T MegaimperialGallons => As(VolumeUnit.MegaimperialGallon); /// /// Get in Megaliters. /// - public double Megaliters => As(VolumeUnit.Megaliter); + public T Megaliters => As(VolumeUnit.Megaliter); /// /// Get in MegausGallons. /// - public double MegausGallons => As(VolumeUnit.MegausGallon); + public T MegausGallons => As(VolumeUnit.MegausGallon); /// /// Get in MetricCups. /// - public double MetricCups => As(VolumeUnit.MetricCup); + public T MetricCups => As(VolumeUnit.MetricCup); /// /// Get in MetricTeaspoons. /// - public double MetricTeaspoons => As(VolumeUnit.MetricTeaspoon); + public T MetricTeaspoons => As(VolumeUnit.MetricTeaspoon); /// /// Get in Microliters. /// - public double Microliters => As(VolumeUnit.Microliter); + public T Microliters => As(VolumeUnit.Microliter); /// /// Get in Milliliters. /// - public double Milliliters => As(VolumeUnit.Milliliter); + public T Milliliters => As(VolumeUnit.Milliliter); /// /// Get in OilBarrels. /// - public double OilBarrels => As(VolumeUnit.OilBarrel); + public T OilBarrels => As(VolumeUnit.OilBarrel); /// /// Get in UkTablespoons. /// - public double UkTablespoons => As(VolumeUnit.UkTablespoon); + public T UkTablespoons => As(VolumeUnit.UkTablespoon); /// /// Get in UsBeerBarrels. /// - public double UsBeerBarrels => As(VolumeUnit.UsBeerBarrel); + public T UsBeerBarrels => As(VolumeUnit.UsBeerBarrel); /// /// Get in UsCustomaryCups. /// - public double UsCustomaryCups => As(VolumeUnit.UsCustomaryCup); + public T UsCustomaryCups => As(VolumeUnit.UsCustomaryCup); /// /// Get in UsGallons. /// - public double UsGallons => As(VolumeUnit.UsGallon); + public T UsGallons => As(VolumeUnit.UsGallon); /// /// Get in UsLegalCups. /// - public double UsLegalCups => As(VolumeUnit.UsLegalCup); + public T UsLegalCups => As(VolumeUnit.UsLegalCup); /// /// Get in UsOunces. /// - public double UsOunces => As(VolumeUnit.UsOunce); + public T UsOunces => As(VolumeUnit.UsOunce); /// /// Get in UsPints. /// - public double UsPints => As(VolumeUnit.UsPint); + public T UsPints => As(VolumeUnit.UsPint); /// /// Get in UsQuarts. /// - public double UsQuarts => As(VolumeUnit.UsQuart); + public T UsQuarts => As(VolumeUnit.UsQuart); /// /// Get in UsTablespoons. /// - public double UsTablespoons => As(VolumeUnit.UsTablespoon); + public T UsTablespoons => As(VolumeUnit.UsTablespoon); /// /// Get in UsTeaspoons. /// - public double UsTeaspoons => As(VolumeUnit.UsTeaspoon); + public T UsTeaspoons => As(VolumeUnit.UsTeaspoon); #endregion @@ -477,424 +474,377 @@ public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] IFormatProvide /// Get from AcreFeet. /// /// If value is NaN or Infinity. - public static Volume FromAcreFeet(QuantityValue acrefeet) + public static Volume FromAcreFeet(T acrefeet) { - double value = (double) acrefeet; - return new Volume(value, VolumeUnit.AcreFoot); + return new Volume(acrefeet, VolumeUnit.AcreFoot); } /// /// Get from AuTablespoons. /// /// If value is NaN or Infinity. - public static Volume FromAuTablespoons(QuantityValue autablespoons) + public static Volume FromAuTablespoons(T autablespoons) { - double value = (double) autablespoons; - return new Volume(value, VolumeUnit.AuTablespoon); + return new Volume(autablespoons, VolumeUnit.AuTablespoon); } /// /// Get from Centiliters. /// /// If value is NaN or Infinity. - public static Volume FromCentiliters(QuantityValue centiliters) + public static Volume FromCentiliters(T centiliters) { - double value = (double) centiliters; - return new Volume(value, VolumeUnit.Centiliter); + return new Volume(centiliters, VolumeUnit.Centiliter); } /// /// Get from CubicCentimeters. /// /// If value is NaN or Infinity. - public static Volume FromCubicCentimeters(QuantityValue cubiccentimeters) + public static Volume FromCubicCentimeters(T cubiccentimeters) { - double value = (double) cubiccentimeters; - return new Volume(value, VolumeUnit.CubicCentimeter); + return new Volume(cubiccentimeters, VolumeUnit.CubicCentimeter); } /// /// Get from CubicDecimeters. /// /// If value is NaN or Infinity. - public static Volume FromCubicDecimeters(QuantityValue cubicdecimeters) + public static Volume FromCubicDecimeters(T cubicdecimeters) { - double value = (double) cubicdecimeters; - return new Volume(value, VolumeUnit.CubicDecimeter); + return new Volume(cubicdecimeters, VolumeUnit.CubicDecimeter); } /// /// Get from CubicFeet. /// /// If value is NaN or Infinity. - public static Volume FromCubicFeet(QuantityValue cubicfeet) + public static Volume FromCubicFeet(T cubicfeet) { - double value = (double) cubicfeet; - return new Volume(value, VolumeUnit.CubicFoot); + return new Volume(cubicfeet, VolumeUnit.CubicFoot); } /// /// Get from CubicHectometers. /// /// If value is NaN or Infinity. - public static Volume FromCubicHectometers(QuantityValue cubichectometers) + public static Volume FromCubicHectometers(T cubichectometers) { - double value = (double) cubichectometers; - return new Volume(value, VolumeUnit.CubicHectometer); + return new Volume(cubichectometers, VolumeUnit.CubicHectometer); } /// /// Get from CubicInches. /// /// If value is NaN or Infinity. - public static Volume FromCubicInches(QuantityValue cubicinches) + public static Volume FromCubicInches(T cubicinches) { - double value = (double) cubicinches; - return new Volume(value, VolumeUnit.CubicInch); + return new Volume(cubicinches, VolumeUnit.CubicInch); } /// /// Get from CubicKilometers. /// /// If value is NaN or Infinity. - public static Volume FromCubicKilometers(QuantityValue cubickilometers) + public static Volume FromCubicKilometers(T cubickilometers) { - double value = (double) cubickilometers; - return new Volume(value, VolumeUnit.CubicKilometer); + return new Volume(cubickilometers, VolumeUnit.CubicKilometer); } /// /// Get from CubicMeters. /// /// If value is NaN or Infinity. - public static Volume FromCubicMeters(QuantityValue cubicmeters) + public static Volume FromCubicMeters(T cubicmeters) { - double value = (double) cubicmeters; - return new Volume(value, VolumeUnit.CubicMeter); + return new Volume(cubicmeters, VolumeUnit.CubicMeter); } /// /// Get from CubicMicrometers. /// /// If value is NaN or Infinity. - public static Volume FromCubicMicrometers(QuantityValue cubicmicrometers) + public static Volume FromCubicMicrometers(T cubicmicrometers) { - double value = (double) cubicmicrometers; - return new Volume(value, VolumeUnit.CubicMicrometer); + return new Volume(cubicmicrometers, VolumeUnit.CubicMicrometer); } /// /// Get from CubicMiles. /// /// If value is NaN or Infinity. - public static Volume FromCubicMiles(QuantityValue cubicmiles) + public static Volume FromCubicMiles(T cubicmiles) { - double value = (double) cubicmiles; - return new Volume(value, VolumeUnit.CubicMile); + return new Volume(cubicmiles, VolumeUnit.CubicMile); } /// /// Get from CubicMillimeters. /// /// If value is NaN or Infinity. - public static Volume FromCubicMillimeters(QuantityValue cubicmillimeters) + public static Volume FromCubicMillimeters(T cubicmillimeters) { - double value = (double) cubicmillimeters; - return new Volume(value, VolumeUnit.CubicMillimeter); + return new Volume(cubicmillimeters, VolumeUnit.CubicMillimeter); } /// /// Get from CubicYards. /// /// If value is NaN or Infinity. - public static Volume FromCubicYards(QuantityValue cubicyards) + public static Volume FromCubicYards(T cubicyards) { - double value = (double) cubicyards; - return new Volume(value, VolumeUnit.CubicYard); + return new Volume(cubicyards, VolumeUnit.CubicYard); } /// /// Get from Deciliters. /// /// If value is NaN or Infinity. - public static Volume FromDeciliters(QuantityValue deciliters) + public static Volume FromDeciliters(T deciliters) { - double value = (double) deciliters; - return new Volume(value, VolumeUnit.Deciliter); + return new Volume(deciliters, VolumeUnit.Deciliter); } /// /// Get from HectocubicFeet. /// /// If value is NaN or Infinity. - public static Volume FromHectocubicFeet(QuantityValue hectocubicfeet) + public static Volume FromHectocubicFeet(T hectocubicfeet) { - double value = (double) hectocubicfeet; - return new Volume(value, VolumeUnit.HectocubicFoot); + return new Volume(hectocubicfeet, VolumeUnit.HectocubicFoot); } /// /// Get from HectocubicMeters. /// /// If value is NaN or Infinity. - public static Volume FromHectocubicMeters(QuantityValue hectocubicmeters) + public static Volume FromHectocubicMeters(T hectocubicmeters) { - double value = (double) hectocubicmeters; - return new Volume(value, VolumeUnit.HectocubicMeter); + return new Volume(hectocubicmeters, VolumeUnit.HectocubicMeter); } /// /// Get from Hectoliters. /// /// If value is NaN or Infinity. - public static Volume FromHectoliters(QuantityValue hectoliters) + public static Volume FromHectoliters(T hectoliters) { - double value = (double) hectoliters; - return new Volume(value, VolumeUnit.Hectoliter); + return new Volume(hectoliters, VolumeUnit.Hectoliter); } /// /// Get from ImperialBeerBarrels. /// /// If value is NaN or Infinity. - public static Volume FromImperialBeerBarrels(QuantityValue imperialbeerbarrels) + public static Volume FromImperialBeerBarrels(T imperialbeerbarrels) { - double value = (double) imperialbeerbarrels; - return new Volume(value, VolumeUnit.ImperialBeerBarrel); + return new Volume(imperialbeerbarrels, VolumeUnit.ImperialBeerBarrel); } /// /// Get from ImperialGallons. /// /// If value is NaN or Infinity. - public static Volume FromImperialGallons(QuantityValue imperialgallons) + public static Volume FromImperialGallons(T imperialgallons) { - double value = (double) imperialgallons; - return new Volume(value, VolumeUnit.ImperialGallon); + return new Volume(imperialgallons, VolumeUnit.ImperialGallon); } /// /// Get from ImperialOunces. /// /// If value is NaN or Infinity. - public static Volume FromImperialOunces(QuantityValue imperialounces) + public static Volume FromImperialOunces(T imperialounces) { - double value = (double) imperialounces; - return new Volume(value, VolumeUnit.ImperialOunce); + return new Volume(imperialounces, VolumeUnit.ImperialOunce); } /// /// Get from ImperialPints. /// /// If value is NaN or Infinity. - public static Volume FromImperialPints(QuantityValue imperialpints) + public static Volume FromImperialPints(T imperialpints) { - double value = (double) imperialpints; - return new Volume(value, VolumeUnit.ImperialPint); + return new Volume(imperialpints, VolumeUnit.ImperialPint); } /// /// Get from KilocubicFeet. /// /// If value is NaN or Infinity. - public static Volume FromKilocubicFeet(QuantityValue kilocubicfeet) + public static Volume FromKilocubicFeet(T kilocubicfeet) { - double value = (double) kilocubicfeet; - return new Volume(value, VolumeUnit.KilocubicFoot); + return new Volume(kilocubicfeet, VolumeUnit.KilocubicFoot); } /// /// Get from KilocubicMeters. /// /// If value is NaN or Infinity. - public static Volume FromKilocubicMeters(QuantityValue kilocubicmeters) + public static Volume FromKilocubicMeters(T kilocubicmeters) { - double value = (double) kilocubicmeters; - return new Volume(value, VolumeUnit.KilocubicMeter); + return new Volume(kilocubicmeters, VolumeUnit.KilocubicMeter); } /// /// Get from KiloimperialGallons. /// /// If value is NaN or Infinity. - public static Volume FromKiloimperialGallons(QuantityValue kiloimperialgallons) + public static Volume FromKiloimperialGallons(T kiloimperialgallons) { - double value = (double) kiloimperialgallons; - return new Volume(value, VolumeUnit.KiloimperialGallon); + return new Volume(kiloimperialgallons, VolumeUnit.KiloimperialGallon); } /// /// Get from Kiloliters. /// /// If value is NaN or Infinity. - public static Volume FromKiloliters(QuantityValue kiloliters) + public static Volume FromKiloliters(T kiloliters) { - double value = (double) kiloliters; - return new Volume(value, VolumeUnit.Kiloliter); + return new Volume(kiloliters, VolumeUnit.Kiloliter); } /// /// Get from KilousGallons. /// /// If value is NaN or Infinity. - public static Volume FromKilousGallons(QuantityValue kilousgallons) + public static Volume FromKilousGallons(T kilousgallons) { - double value = (double) kilousgallons; - return new Volume(value, VolumeUnit.KilousGallon); + return new Volume(kilousgallons, VolumeUnit.KilousGallon); } /// /// Get from Liters. /// /// If value is NaN or Infinity. - public static Volume FromLiters(QuantityValue liters) + public static Volume FromLiters(T liters) { - double value = (double) liters; - return new Volume(value, VolumeUnit.Liter); + return new Volume(liters, VolumeUnit.Liter); } /// /// Get from MegacubicFeet. /// /// If value is NaN or Infinity. - public static Volume FromMegacubicFeet(QuantityValue megacubicfeet) + public static Volume FromMegacubicFeet(T megacubicfeet) { - double value = (double) megacubicfeet; - return new Volume(value, VolumeUnit.MegacubicFoot); + return new Volume(megacubicfeet, VolumeUnit.MegacubicFoot); } /// /// Get from MegaimperialGallons. /// /// If value is NaN or Infinity. - public static Volume FromMegaimperialGallons(QuantityValue megaimperialgallons) + public static Volume FromMegaimperialGallons(T megaimperialgallons) { - double value = (double) megaimperialgallons; - return new Volume(value, VolumeUnit.MegaimperialGallon); + return new Volume(megaimperialgallons, VolumeUnit.MegaimperialGallon); } /// /// Get from Megaliters. /// /// If value is NaN or Infinity. - public static Volume FromMegaliters(QuantityValue megaliters) + public static Volume FromMegaliters(T megaliters) { - double value = (double) megaliters; - return new Volume(value, VolumeUnit.Megaliter); + return new Volume(megaliters, VolumeUnit.Megaliter); } /// /// Get from MegausGallons. /// /// If value is NaN or Infinity. - public static Volume FromMegausGallons(QuantityValue megausgallons) + public static Volume FromMegausGallons(T megausgallons) { - double value = (double) megausgallons; - return new Volume(value, VolumeUnit.MegausGallon); + return new Volume(megausgallons, VolumeUnit.MegausGallon); } /// /// Get from MetricCups. /// /// If value is NaN or Infinity. - public static Volume FromMetricCups(QuantityValue metriccups) + public static Volume FromMetricCups(T metriccups) { - double value = (double) metriccups; - return new Volume(value, VolumeUnit.MetricCup); + return new Volume(metriccups, VolumeUnit.MetricCup); } /// /// Get from MetricTeaspoons. /// /// If value is NaN or Infinity. - public static Volume FromMetricTeaspoons(QuantityValue metricteaspoons) + public static Volume FromMetricTeaspoons(T metricteaspoons) { - double value = (double) metricteaspoons; - return new Volume(value, VolumeUnit.MetricTeaspoon); + return new Volume(metricteaspoons, VolumeUnit.MetricTeaspoon); } /// /// Get from Microliters. /// /// If value is NaN or Infinity. - public static Volume FromMicroliters(QuantityValue microliters) + public static Volume FromMicroliters(T microliters) { - double value = (double) microliters; - return new Volume(value, VolumeUnit.Microliter); + return new Volume(microliters, VolumeUnit.Microliter); } /// /// Get from Milliliters. /// /// If value is NaN or Infinity. - public static Volume FromMilliliters(QuantityValue milliliters) + public static Volume FromMilliliters(T milliliters) { - double value = (double) milliliters; - return new Volume(value, VolumeUnit.Milliliter); + return new Volume(milliliters, VolumeUnit.Milliliter); } /// /// Get from OilBarrels. /// /// If value is NaN or Infinity. - public static Volume FromOilBarrels(QuantityValue oilbarrels) + public static Volume FromOilBarrels(T oilbarrels) { - double value = (double) oilbarrels; - return new Volume(value, VolumeUnit.OilBarrel); + return new Volume(oilbarrels, VolumeUnit.OilBarrel); } /// /// Get from UkTablespoons. /// /// If value is NaN or Infinity. - public static Volume FromUkTablespoons(QuantityValue uktablespoons) + public static Volume FromUkTablespoons(T uktablespoons) { - double value = (double) uktablespoons; - return new Volume(value, VolumeUnit.UkTablespoon); + return new Volume(uktablespoons, VolumeUnit.UkTablespoon); } /// /// Get from UsBeerBarrels. /// /// If value is NaN or Infinity. - public static Volume FromUsBeerBarrels(QuantityValue usbeerbarrels) + public static Volume FromUsBeerBarrels(T usbeerbarrels) { - double value = (double) usbeerbarrels; - return new Volume(value, VolumeUnit.UsBeerBarrel); + return new Volume(usbeerbarrels, VolumeUnit.UsBeerBarrel); } /// /// Get from UsCustomaryCups. /// /// If value is NaN or Infinity. - public static Volume FromUsCustomaryCups(QuantityValue uscustomarycups) + public static Volume FromUsCustomaryCups(T uscustomarycups) { - double value = (double) uscustomarycups; - return new Volume(value, VolumeUnit.UsCustomaryCup); + return new Volume(uscustomarycups, VolumeUnit.UsCustomaryCup); } /// /// Get from UsGallons. /// /// If value is NaN or Infinity. - public static Volume FromUsGallons(QuantityValue usgallons) + public static Volume FromUsGallons(T usgallons) { - double value = (double) usgallons; - return new Volume(value, VolumeUnit.UsGallon); + return new Volume(usgallons, VolumeUnit.UsGallon); } /// /// Get from UsLegalCups. /// /// If value is NaN or Infinity. - public static Volume FromUsLegalCups(QuantityValue uslegalcups) + public static Volume FromUsLegalCups(T uslegalcups) { - double value = (double) uslegalcups; - return new Volume(value, VolumeUnit.UsLegalCup); + return new Volume(uslegalcups, VolumeUnit.UsLegalCup); } /// /// Get from UsOunces. /// /// If value is NaN or Infinity. - public static Volume FromUsOunces(QuantityValue usounces) + public static Volume FromUsOunces(T usounces) { - double value = (double) usounces; - return new Volume(value, VolumeUnit.UsOunce); + return new Volume(usounces, VolumeUnit.UsOunce); } /// /// Get from UsPints. /// /// If value is NaN or Infinity. - public static Volume FromUsPints(QuantityValue uspints) + public static Volume FromUsPints(T uspints) { - double value = (double) uspints; - return new Volume(value, VolumeUnit.UsPint); + return new Volume(uspints, VolumeUnit.UsPint); } /// /// Get from UsQuarts. /// /// If value is NaN or Infinity. - public static Volume FromUsQuarts(QuantityValue usquarts) + public static Volume FromUsQuarts(T usquarts) { - double value = (double) usquarts; - return new Volume(value, VolumeUnit.UsQuart); + return new Volume(usquarts, VolumeUnit.UsQuart); } /// /// Get from UsTablespoons. /// /// If value is NaN or Infinity. - public static Volume FromUsTablespoons(QuantityValue ustablespoons) + public static Volume FromUsTablespoons(T ustablespoons) { - double value = (double) ustablespoons; - return new Volume(value, VolumeUnit.UsTablespoon); + return new Volume(ustablespoons, VolumeUnit.UsTablespoon); } /// /// Get from UsTeaspoons. /// /// If value is NaN or Infinity. - public static Volume FromUsTeaspoons(QuantityValue usteaspoons) + public static Volume FromUsTeaspoons(T usteaspoons) { - double value = (double) usteaspoons; - return new Volume(value, VolumeUnit.UsTeaspoon); + return new Volume(usteaspoons, VolumeUnit.UsTeaspoon); } /// @@ -903,9 +853,9 @@ public static Volume FromUsTeaspoons(QuantityValue usteaspoons) /// Value to convert from. /// Unit to convert from. /// unit value. - public static Volume From(QuantityValue value, VolumeUnit fromUnit) + public static Volume From(T value, VolumeUnit fromUnit) { - return new Volume((double)value, fromUnit); + return new Volume(value, fromUnit); } #endregion @@ -1059,43 +1009,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume /// Negate the value. public static Volume operator -(Volume right) { - return new Volume(-right.Value, right.Unit); + return new Volume(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static Volume operator +(Volume left, Volume right) { - return new Volume(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new Volume(value, left.Unit); } /// Get from subtracting two . public static Volume operator -(Volume left, Volume right) { - return new Volume(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new Volume(value, left.Unit); } /// Get from multiplying value and . - public static Volume operator *(double left, Volume right) + public static Volume operator *(T left, Volume right) { - return new Volume(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new Volume(value, right.Unit); } /// Get from multiplying value and . - public static Volume operator *(Volume left, double right) + public static Volume operator *(Volume left, T right) { - return new Volume(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new Volume(value, left.Unit); } /// Get from dividing by value. - public static Volume operator /(Volume left, double right) + public static Volume operator /(Volume left, T right) { - return new Volume(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new Volume(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(Volume left, Volume right) + public static T operator /(Volume left, Volume right) { - return left.CubicMeters / right.CubicMeters; + return CompiledLambdas.Divide(left.CubicMeters, right.CubicMeters); } #endregion @@ -1105,25 +1060,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume /// Returns true if less or equal to. public static bool operator <=(Volume left, Volume right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(Volume left, Volume right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(Volume left, Volume right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(Volume left, Volume right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -1152,7 +1107,7 @@ public int CompareTo(object obj) /// public int CompareTo(Volume other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -1169,7 +1124,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Volume other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1217,10 +1172,8 @@ public bool Equals(Volume other, double tolerance, ComparisonType comparisonT if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -1240,17 +1193,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(VolumeUnit unit) + public T As(VolumeUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1270,9 +1223,14 @@ double IQuantity.As(Enum unit) if(!(unit is VolumeUnit unitAsVolumeUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeUnit)} is supported.", nameof(unit)); - return As(unitAsVolumeUnit); + var asValue = As(unitAsVolumeUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(VolumeUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -1313,65 +1271,71 @@ public Volume ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(VolumeUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(VolumeUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case VolumeUnit.AcreFoot: return _value/0.000810714; - case VolumeUnit.AuTablespoon: return _value*2e-5; - case VolumeUnit.Centiliter: return (_value/1e3) * 1e-2d; - case VolumeUnit.CubicCentimeter: return _value/1e6; - case VolumeUnit.CubicDecimeter: return _value/1e3; - case VolumeUnit.CubicFoot: return _value*0.0283168; - case VolumeUnit.CubicHectometer: return _value*1e6; - case VolumeUnit.CubicInch: return _value*1.6387*1e-5; - case VolumeUnit.CubicKilometer: return _value*1e9; - case VolumeUnit.CubicMeter: return _value; - case VolumeUnit.CubicMicrometer: return _value/1e18; - case VolumeUnit.CubicMile: return _value*4.16818182544058e9; - case VolumeUnit.CubicMillimeter: return _value/1e9; - case VolumeUnit.CubicYard: return _value*0.764554858; - case VolumeUnit.Deciliter: return (_value/1e3) * 1e-1d; - case VolumeUnit.HectocubicFoot: return (_value*0.0283168) * 1e2d; - case VolumeUnit.HectocubicMeter: return (_value) * 1e2d; - case VolumeUnit.Hectoliter: return (_value/1e3) * 1e2d; - case VolumeUnit.ImperialBeerBarrel: return _value*0.16365924; - case VolumeUnit.ImperialGallon: return _value*0.00454609000000181429905810072407; - case VolumeUnit.ImperialOunce: return _value*2.8413062499962901241875439064617e-5; - case VolumeUnit.ImperialPint: return _value * 5.6826125e-4; - case VolumeUnit.KilocubicFoot: return (_value*0.0283168) * 1e3d; - case VolumeUnit.KilocubicMeter: return (_value) * 1e3d; - case VolumeUnit.KiloimperialGallon: return (_value*0.00454609000000181429905810072407) * 1e3d; - case VolumeUnit.Kiloliter: return (_value/1e3) * 1e3d; - case VolumeUnit.KilousGallon: return (_value*0.00378541) * 1e3d; - case VolumeUnit.Liter: return _value/1e3; - case VolumeUnit.MegacubicFoot: return (_value*0.0283168) * 1e6d; - case VolumeUnit.MegaimperialGallon: return (_value*0.00454609000000181429905810072407) * 1e6d; - case VolumeUnit.Megaliter: return (_value/1e3) * 1e6d; - case VolumeUnit.MegausGallon: return (_value*0.00378541) * 1e6d; - case VolumeUnit.MetricCup: return _value*0.00025; - case VolumeUnit.MetricTeaspoon: return _value*0.5e-5; - case VolumeUnit.Microliter: return (_value/1e3) * 1e-6d; - case VolumeUnit.Milliliter: return (_value/1e3) * 1e-3d; - case VolumeUnit.OilBarrel: return _value*0.158987294928; - case VolumeUnit.UkTablespoon: return _value*1.5e-5; - case VolumeUnit.UsBeerBarrel: return _value*0.1173477658; - case VolumeUnit.UsCustomaryCup: return _value*0.0002365882365; - case VolumeUnit.UsGallon: return _value*0.00378541; - case VolumeUnit.UsLegalCup: return _value*0.00024; - case VolumeUnit.UsOunce: return _value*2.957352956253760505068307980135e-5; - case VolumeUnit.UsPint: return _value*4.73176473e-4; - case VolumeUnit.UsQuart: return _value*9.46352946e-4; - case VolumeUnit.UsTablespoon: return _value*1.478676478125e-5; - case VolumeUnit.UsTeaspoon: return _value*4.92892159375e-6; + case VolumeUnit.AcreFoot: return Value/0.000810714; + case VolumeUnit.AuTablespoon: return Value*2e-5; + case VolumeUnit.Centiliter: return (Value/1e3) * 1e-2d; + case VolumeUnit.CubicCentimeter: return Value/1e6; + case VolumeUnit.CubicDecimeter: return Value/1e3; + case VolumeUnit.CubicFoot: return Value*0.0283168; + case VolumeUnit.CubicHectometer: return Value*1e6; + case VolumeUnit.CubicInch: return Value*1.6387*1e-5; + case VolumeUnit.CubicKilometer: return Value*1e9; + case VolumeUnit.CubicMeter: return Value; + case VolumeUnit.CubicMicrometer: return Value/1e18; + case VolumeUnit.CubicMile: return Value*4.16818182544058e9; + case VolumeUnit.CubicMillimeter: return Value/1e9; + case VolumeUnit.CubicYard: return Value*0.764554858; + case VolumeUnit.Deciliter: return (Value/1e3) * 1e-1d; + case VolumeUnit.HectocubicFoot: return (Value*0.0283168) * 1e2d; + case VolumeUnit.HectocubicMeter: return (Value) * 1e2d; + case VolumeUnit.Hectoliter: return (Value/1e3) * 1e2d; + case VolumeUnit.ImperialBeerBarrel: return Value*0.16365924; + case VolumeUnit.ImperialGallon: return Value*0.00454609000000181429905810072407; + case VolumeUnit.ImperialOunce: return Value*2.8413062499962901241875439064617e-5; + case VolumeUnit.ImperialPint: return Value * 5.6826125e-4; + case VolumeUnit.KilocubicFoot: return (Value*0.0283168) * 1e3d; + case VolumeUnit.KilocubicMeter: return (Value) * 1e3d; + case VolumeUnit.KiloimperialGallon: return (Value*0.00454609000000181429905810072407) * 1e3d; + case VolumeUnit.Kiloliter: return (Value/1e3) * 1e3d; + case VolumeUnit.KilousGallon: return (Value*0.00378541) * 1e3d; + case VolumeUnit.Liter: return Value/1e3; + case VolumeUnit.MegacubicFoot: return (Value*0.0283168) * 1e6d; + case VolumeUnit.MegaimperialGallon: return (Value*0.00454609000000181429905810072407) * 1e6d; + case VolumeUnit.Megaliter: return (Value/1e3) * 1e6d; + case VolumeUnit.MegausGallon: return (Value*0.00378541) * 1e6d; + case VolumeUnit.MetricCup: return Value*0.00025; + case VolumeUnit.MetricTeaspoon: return Value*0.5e-5; + case VolumeUnit.Microliter: return (Value/1e3) * 1e-6d; + case VolumeUnit.Milliliter: return (Value/1e3) * 1e-3d; + case VolumeUnit.OilBarrel: return Value*0.158987294928; + case VolumeUnit.UkTablespoon: return Value*1.5e-5; + case VolumeUnit.UsBeerBarrel: return Value*0.1173477658; + case VolumeUnit.UsCustomaryCup: return Value*0.0002365882365; + case VolumeUnit.UsGallon: return Value*0.00378541; + case VolumeUnit.UsLegalCup: return Value*0.00024; + case VolumeUnit.UsOunce: return Value*2.957352956253760505068307980135e-5; + case VolumeUnit.UsPint: return Value*4.73176473e-4; + case VolumeUnit.UsQuart: return Value*9.46352946e-4; + case VolumeUnit.UsTablespoon: return Value*1.478676478125e-5; + case VolumeUnit.UsTeaspoon: return Value*4.92892159375e-6; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -1388,10 +1352,10 @@ internal Volume ToBaseUnit() return new Volume(baseUnitValue, BaseUnit); } - private double GetValueAs(VolumeUnit unit) + private T GetValueAs(VolumeUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1545,7 +1509,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1560,37 +1524,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1614,17 +1578,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs index bd1f0f2d10..008e22c613 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs @@ -35,13 +35,8 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Concentration#Volume_concentration /// - public partial struct VolumeConcentration : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct VolumeConcentration : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -83,12 +78,12 @@ static VolumeConcentration() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public VolumeConcentration(double value, VolumeConcentrationUnit unit) + public VolumeConcentration(T value, VolumeConcentrationUnit unit) { if(unit == VolumeConcentrationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -100,14 +95,14 @@ public VolumeConcentration(double value, VolumeConcentrationUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public VolumeConcentration(double value, UnitSystem unitSystem) + public VolumeConcentration(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -149,7 +144,7 @@ public VolumeConcentration(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit DecimalFraction. /// - public static VolumeConcentration Zero { get; } = new VolumeConcentration(0, BaseUnit); + public static VolumeConcentration Zero { get; } = new VolumeConcentration((T)0, BaseUnit); #endregion @@ -158,7 +153,9 @@ public VolumeConcentration(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -188,102 +185,102 @@ public VolumeConcentration(double value, UnitSystem unitSystem) /// /// Get in CentilitersPerLiter. /// - public double CentilitersPerLiter => As(VolumeConcentrationUnit.CentilitersPerLiter); + public T CentilitersPerLiter => As(VolumeConcentrationUnit.CentilitersPerLiter); /// /// Get in CentilitersPerMililiter. /// - public double CentilitersPerMililiter => As(VolumeConcentrationUnit.CentilitersPerMililiter); + public T CentilitersPerMililiter => As(VolumeConcentrationUnit.CentilitersPerMililiter); /// /// Get in DecilitersPerLiter. /// - public double DecilitersPerLiter => As(VolumeConcentrationUnit.DecilitersPerLiter); + public T DecilitersPerLiter => As(VolumeConcentrationUnit.DecilitersPerLiter); /// /// Get in DecilitersPerMililiter. /// - public double DecilitersPerMililiter => As(VolumeConcentrationUnit.DecilitersPerMililiter); + public T DecilitersPerMililiter => As(VolumeConcentrationUnit.DecilitersPerMililiter); /// /// Get in DecimalFractions. /// - public double DecimalFractions => As(VolumeConcentrationUnit.DecimalFraction); + public T DecimalFractions => As(VolumeConcentrationUnit.DecimalFraction); /// /// Get in LitersPerLiter. /// - public double LitersPerLiter => As(VolumeConcentrationUnit.LitersPerLiter); + public T LitersPerLiter => As(VolumeConcentrationUnit.LitersPerLiter); /// /// Get in LitersPerMililiter. /// - public double LitersPerMililiter => As(VolumeConcentrationUnit.LitersPerMililiter); + public T LitersPerMililiter => As(VolumeConcentrationUnit.LitersPerMililiter); /// /// Get in MicrolitersPerLiter. /// - public double MicrolitersPerLiter => As(VolumeConcentrationUnit.MicrolitersPerLiter); + public T MicrolitersPerLiter => As(VolumeConcentrationUnit.MicrolitersPerLiter); /// /// Get in MicrolitersPerMililiter. /// - public double MicrolitersPerMililiter => As(VolumeConcentrationUnit.MicrolitersPerMililiter); + public T MicrolitersPerMililiter => As(VolumeConcentrationUnit.MicrolitersPerMililiter); /// /// Get in MillilitersPerLiter. /// - public double MillilitersPerLiter => As(VolumeConcentrationUnit.MillilitersPerLiter); + public T MillilitersPerLiter => As(VolumeConcentrationUnit.MillilitersPerLiter); /// /// Get in MillilitersPerMililiter. /// - public double MillilitersPerMililiter => As(VolumeConcentrationUnit.MillilitersPerMililiter); + public T MillilitersPerMililiter => As(VolumeConcentrationUnit.MillilitersPerMililiter); /// /// Get in NanolitersPerLiter. /// - public double NanolitersPerLiter => As(VolumeConcentrationUnit.NanolitersPerLiter); + public T NanolitersPerLiter => As(VolumeConcentrationUnit.NanolitersPerLiter); /// /// Get in NanolitersPerMililiter. /// - public double NanolitersPerMililiter => As(VolumeConcentrationUnit.NanolitersPerMililiter); + public T NanolitersPerMililiter => As(VolumeConcentrationUnit.NanolitersPerMililiter); /// /// Get in PartsPerBillion. /// - public double PartsPerBillion => As(VolumeConcentrationUnit.PartPerBillion); + public T PartsPerBillion => As(VolumeConcentrationUnit.PartPerBillion); /// /// Get in PartsPerMillion. /// - public double PartsPerMillion => As(VolumeConcentrationUnit.PartPerMillion); + public T PartsPerMillion => As(VolumeConcentrationUnit.PartPerMillion); /// /// Get in PartsPerThousand. /// - public double PartsPerThousand => As(VolumeConcentrationUnit.PartPerThousand); + public T PartsPerThousand => As(VolumeConcentrationUnit.PartPerThousand); /// /// Get in PartsPerTrillion. /// - public double PartsPerTrillion => As(VolumeConcentrationUnit.PartPerTrillion); + public T PartsPerTrillion => As(VolumeConcentrationUnit.PartPerTrillion); /// /// Get in Percent. /// - public double Percent => As(VolumeConcentrationUnit.Percent); + public T Percent => As(VolumeConcentrationUnit.Percent); /// /// Get in PicolitersPerLiter. /// - public double PicolitersPerLiter => As(VolumeConcentrationUnit.PicolitersPerLiter); + public T PicolitersPerLiter => As(VolumeConcentrationUnit.PicolitersPerLiter); /// /// Get in PicolitersPerMililiter. /// - public double PicolitersPerMililiter => As(VolumeConcentrationUnit.PicolitersPerMililiter); + public T PicolitersPerMililiter => As(VolumeConcentrationUnit.PicolitersPerMililiter); #endregion @@ -318,181 +315,161 @@ public static string GetAbbreviation(VolumeConcentrationUnit unit, [CanBeNull] I /// Get from CentilitersPerLiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromCentilitersPerLiter(QuantityValue centilitersperliter) + public static VolumeConcentration FromCentilitersPerLiter(T centilitersperliter) { - double value = (double) centilitersperliter; - return new VolumeConcentration(value, VolumeConcentrationUnit.CentilitersPerLiter); + return new VolumeConcentration(centilitersperliter, VolumeConcentrationUnit.CentilitersPerLiter); } /// /// Get from CentilitersPerMililiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromCentilitersPerMililiter(QuantityValue centiliterspermililiter) + public static VolumeConcentration FromCentilitersPerMililiter(T centiliterspermililiter) { - double value = (double) centiliterspermililiter; - return new VolumeConcentration(value, VolumeConcentrationUnit.CentilitersPerMililiter); + return new VolumeConcentration(centiliterspermililiter, VolumeConcentrationUnit.CentilitersPerMililiter); } /// /// Get from DecilitersPerLiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromDecilitersPerLiter(QuantityValue decilitersperliter) + public static VolumeConcentration FromDecilitersPerLiter(T decilitersperliter) { - double value = (double) decilitersperliter; - return new VolumeConcentration(value, VolumeConcentrationUnit.DecilitersPerLiter); + return new VolumeConcentration(decilitersperliter, VolumeConcentrationUnit.DecilitersPerLiter); } /// /// Get from DecilitersPerMililiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromDecilitersPerMililiter(QuantityValue deciliterspermililiter) + public static VolumeConcentration FromDecilitersPerMililiter(T deciliterspermililiter) { - double value = (double) deciliterspermililiter; - return new VolumeConcentration(value, VolumeConcentrationUnit.DecilitersPerMililiter); + return new VolumeConcentration(deciliterspermililiter, VolumeConcentrationUnit.DecilitersPerMililiter); } /// /// Get from DecimalFractions. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromDecimalFractions(QuantityValue decimalfractions) + public static VolumeConcentration FromDecimalFractions(T decimalfractions) { - double value = (double) decimalfractions; - return new VolumeConcentration(value, VolumeConcentrationUnit.DecimalFraction); + return new VolumeConcentration(decimalfractions, VolumeConcentrationUnit.DecimalFraction); } /// /// Get from LitersPerLiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromLitersPerLiter(QuantityValue litersperliter) + public static VolumeConcentration FromLitersPerLiter(T litersperliter) { - double value = (double) litersperliter; - return new VolumeConcentration(value, VolumeConcentrationUnit.LitersPerLiter); + return new VolumeConcentration(litersperliter, VolumeConcentrationUnit.LitersPerLiter); } /// /// Get from LitersPerMililiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromLitersPerMililiter(QuantityValue literspermililiter) + public static VolumeConcentration FromLitersPerMililiter(T literspermililiter) { - double value = (double) literspermililiter; - return new VolumeConcentration(value, VolumeConcentrationUnit.LitersPerMililiter); + return new VolumeConcentration(literspermililiter, VolumeConcentrationUnit.LitersPerMililiter); } /// /// Get from MicrolitersPerLiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromMicrolitersPerLiter(QuantityValue microlitersperliter) + public static VolumeConcentration FromMicrolitersPerLiter(T microlitersperliter) { - double value = (double) microlitersperliter; - return new VolumeConcentration(value, VolumeConcentrationUnit.MicrolitersPerLiter); + return new VolumeConcentration(microlitersperliter, VolumeConcentrationUnit.MicrolitersPerLiter); } /// /// Get from MicrolitersPerMililiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromMicrolitersPerMililiter(QuantityValue microliterspermililiter) + public static VolumeConcentration FromMicrolitersPerMililiter(T microliterspermililiter) { - double value = (double) microliterspermililiter; - return new VolumeConcentration(value, VolumeConcentrationUnit.MicrolitersPerMililiter); + return new VolumeConcentration(microliterspermililiter, VolumeConcentrationUnit.MicrolitersPerMililiter); } /// /// Get from MillilitersPerLiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromMillilitersPerLiter(QuantityValue millilitersperliter) + public static VolumeConcentration FromMillilitersPerLiter(T millilitersperliter) { - double value = (double) millilitersperliter; - return new VolumeConcentration(value, VolumeConcentrationUnit.MillilitersPerLiter); + return new VolumeConcentration(millilitersperliter, VolumeConcentrationUnit.MillilitersPerLiter); } /// /// Get from MillilitersPerMililiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromMillilitersPerMililiter(QuantityValue milliliterspermililiter) + public static VolumeConcentration FromMillilitersPerMililiter(T milliliterspermililiter) { - double value = (double) milliliterspermililiter; - return new VolumeConcentration(value, VolumeConcentrationUnit.MillilitersPerMililiter); + return new VolumeConcentration(milliliterspermililiter, VolumeConcentrationUnit.MillilitersPerMililiter); } /// /// Get from NanolitersPerLiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromNanolitersPerLiter(QuantityValue nanolitersperliter) + public static VolumeConcentration FromNanolitersPerLiter(T nanolitersperliter) { - double value = (double) nanolitersperliter; - return new VolumeConcentration(value, VolumeConcentrationUnit.NanolitersPerLiter); + return new VolumeConcentration(nanolitersperliter, VolumeConcentrationUnit.NanolitersPerLiter); } /// /// Get from NanolitersPerMililiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromNanolitersPerMililiter(QuantityValue nanoliterspermililiter) + public static VolumeConcentration FromNanolitersPerMililiter(T nanoliterspermililiter) { - double value = (double) nanoliterspermililiter; - return new VolumeConcentration(value, VolumeConcentrationUnit.NanolitersPerMililiter); + return new VolumeConcentration(nanoliterspermililiter, VolumeConcentrationUnit.NanolitersPerMililiter); } /// /// Get from PartsPerBillion. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromPartsPerBillion(QuantityValue partsperbillion) + public static VolumeConcentration FromPartsPerBillion(T partsperbillion) { - double value = (double) partsperbillion; - return new VolumeConcentration(value, VolumeConcentrationUnit.PartPerBillion); + return new VolumeConcentration(partsperbillion, VolumeConcentrationUnit.PartPerBillion); } /// /// Get from PartsPerMillion. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromPartsPerMillion(QuantityValue partspermillion) + public static VolumeConcentration FromPartsPerMillion(T partspermillion) { - double value = (double) partspermillion; - return new VolumeConcentration(value, VolumeConcentrationUnit.PartPerMillion); + return new VolumeConcentration(partspermillion, VolumeConcentrationUnit.PartPerMillion); } /// /// Get from PartsPerThousand. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromPartsPerThousand(QuantityValue partsperthousand) + public static VolumeConcentration FromPartsPerThousand(T partsperthousand) { - double value = (double) partsperthousand; - return new VolumeConcentration(value, VolumeConcentrationUnit.PartPerThousand); + return new VolumeConcentration(partsperthousand, VolumeConcentrationUnit.PartPerThousand); } /// /// Get from PartsPerTrillion. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromPartsPerTrillion(QuantityValue partspertrillion) + public static VolumeConcentration FromPartsPerTrillion(T partspertrillion) { - double value = (double) partspertrillion; - return new VolumeConcentration(value, VolumeConcentrationUnit.PartPerTrillion); + return new VolumeConcentration(partspertrillion, VolumeConcentrationUnit.PartPerTrillion); } /// /// Get from Percent. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromPercent(QuantityValue percent) + public static VolumeConcentration FromPercent(T percent) { - double value = (double) percent; - return new VolumeConcentration(value, VolumeConcentrationUnit.Percent); + return new VolumeConcentration(percent, VolumeConcentrationUnit.Percent); } /// /// Get from PicolitersPerLiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromPicolitersPerLiter(QuantityValue picolitersperliter) + public static VolumeConcentration FromPicolitersPerLiter(T picolitersperliter) { - double value = (double) picolitersperliter; - return new VolumeConcentration(value, VolumeConcentrationUnit.PicolitersPerLiter); + return new VolumeConcentration(picolitersperliter, VolumeConcentrationUnit.PicolitersPerLiter); } /// /// Get from PicolitersPerMililiter. /// /// If value is NaN or Infinity. - public static VolumeConcentration FromPicolitersPerMililiter(QuantityValue picoliterspermililiter) + public static VolumeConcentration FromPicolitersPerMililiter(T picoliterspermililiter) { - double value = (double) picoliterspermililiter; - return new VolumeConcentration(value, VolumeConcentrationUnit.PicolitersPerMililiter); + return new VolumeConcentration(picoliterspermililiter, VolumeConcentrationUnit.PicolitersPerMililiter); } /// @@ -501,9 +478,9 @@ public static VolumeConcentration FromPicolitersPerMililiter(QuantityValue pi /// Value to convert from. /// Unit to convert from. /// unit value. - public static VolumeConcentration From(QuantityValue value, VolumeConcentrationUnit fromUnit) + public static VolumeConcentration From(T value, VolumeConcentrationUnit fromUnit) { - return new VolumeConcentration((double)value, fromUnit); + return new VolumeConcentration(value, fromUnit); } #endregion @@ -657,43 +634,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume /// Negate the value. public static VolumeConcentration operator -(VolumeConcentration right) { - return new VolumeConcentration(-right.Value, right.Unit); + return new VolumeConcentration(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static VolumeConcentration operator +(VolumeConcentration left, VolumeConcentration right) { - return new VolumeConcentration(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new VolumeConcentration(value, left.Unit); } /// Get from subtracting two . public static VolumeConcentration operator -(VolumeConcentration left, VolumeConcentration right) { - return new VolumeConcentration(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new VolumeConcentration(value, left.Unit); } /// Get from multiplying value and . - public static VolumeConcentration operator *(double left, VolumeConcentration right) + public static VolumeConcentration operator *(T left, VolumeConcentration right) { - return new VolumeConcentration(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new VolumeConcentration(value, right.Unit); } /// Get from multiplying value and . - public static VolumeConcentration operator *(VolumeConcentration left, double right) + public static VolumeConcentration operator *(VolumeConcentration left, T right) { - return new VolumeConcentration(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new VolumeConcentration(value, left.Unit); } /// Get from dividing by value. - public static VolumeConcentration operator /(VolumeConcentration left, double right) + public static VolumeConcentration operator /(VolumeConcentration left, T right) { - return new VolumeConcentration(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new VolumeConcentration(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(VolumeConcentration left, VolumeConcentration right) + public static T operator /(VolumeConcentration left, VolumeConcentration right) { - return left.DecimalFractions / right.DecimalFractions; + return CompiledLambdas.Divide(left.DecimalFractions, right.DecimalFractions); } #endregion @@ -703,25 +685,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume /// Returns true if less or equal to. public static bool operator <=(VolumeConcentration left, VolumeConcentration right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(VolumeConcentration left, VolumeConcentration right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(VolumeConcentration left, VolumeConcentration right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(VolumeConcentration left, VolumeConcentration right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -750,7 +732,7 @@ public int CompareTo(object obj) /// public int CompareTo(VolumeConcentration other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -767,7 +749,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(VolumeConcentration other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -815,10 +797,8 @@ public bool Equals(VolumeConcentration other, double tolerance, ComparisonTyp if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -838,17 +818,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(VolumeConcentrationUnit unit) + public T As(VolumeConcentrationUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -868,9 +848,14 @@ double IQuantity.As(Enum unit) if(!(unit is VolumeConcentrationUnit unitAsVolumeConcentrationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeConcentrationUnit)} is supported.", nameof(unit)); - return As(unitAsVolumeConcentrationUnit); + var asValue = As(unitAsVolumeConcentrationUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(VolumeConcentrationUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -911,38 +896,44 @@ public VolumeConcentration ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(VolumeConcentrationUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(VolumeConcentrationUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case VolumeConcentrationUnit.CentilitersPerLiter: return (_value) * 1e-2d; - case VolumeConcentrationUnit.CentilitersPerMililiter: return (_value/1e-3) * 1e-2d; - case VolumeConcentrationUnit.DecilitersPerLiter: return (_value) * 1e-1d; - case VolumeConcentrationUnit.DecilitersPerMililiter: return (_value/1e-3) * 1e-1d; - case VolumeConcentrationUnit.DecimalFraction: return _value; - case VolumeConcentrationUnit.LitersPerLiter: return _value; - case VolumeConcentrationUnit.LitersPerMililiter: return _value/1e-3; - case VolumeConcentrationUnit.MicrolitersPerLiter: return (_value) * 1e-6d; - case VolumeConcentrationUnit.MicrolitersPerMililiter: return (_value/1e-3) * 1e-6d; - case VolumeConcentrationUnit.MillilitersPerLiter: return (_value) * 1e-3d; - case VolumeConcentrationUnit.MillilitersPerMililiter: return (_value/1e-3) * 1e-3d; - case VolumeConcentrationUnit.NanolitersPerLiter: return (_value) * 1e-9d; - case VolumeConcentrationUnit.NanolitersPerMililiter: return (_value/1e-3) * 1e-9d; - case VolumeConcentrationUnit.PartPerBillion: return _value/1e9; - case VolumeConcentrationUnit.PartPerMillion: return _value/1e6; - case VolumeConcentrationUnit.PartPerThousand: return _value/1e3; - case VolumeConcentrationUnit.PartPerTrillion: return _value/1e12; - case VolumeConcentrationUnit.Percent: return _value/1e2; - case VolumeConcentrationUnit.PicolitersPerLiter: return (_value) * 1e-12d; - case VolumeConcentrationUnit.PicolitersPerMililiter: return (_value/1e-3) * 1e-12d; + case VolumeConcentrationUnit.CentilitersPerLiter: return (Value) * 1e-2d; + case VolumeConcentrationUnit.CentilitersPerMililiter: return (Value/1e-3) * 1e-2d; + case VolumeConcentrationUnit.DecilitersPerLiter: return (Value) * 1e-1d; + case VolumeConcentrationUnit.DecilitersPerMililiter: return (Value/1e-3) * 1e-1d; + case VolumeConcentrationUnit.DecimalFraction: return Value; + case VolumeConcentrationUnit.LitersPerLiter: return Value; + case VolumeConcentrationUnit.LitersPerMililiter: return Value/1e-3; + case VolumeConcentrationUnit.MicrolitersPerLiter: return (Value) * 1e-6d; + case VolumeConcentrationUnit.MicrolitersPerMililiter: return (Value/1e-3) * 1e-6d; + case VolumeConcentrationUnit.MillilitersPerLiter: return (Value) * 1e-3d; + case VolumeConcentrationUnit.MillilitersPerMililiter: return (Value/1e-3) * 1e-3d; + case VolumeConcentrationUnit.NanolitersPerLiter: return (Value) * 1e-9d; + case VolumeConcentrationUnit.NanolitersPerMililiter: return (Value/1e-3) * 1e-9d; + case VolumeConcentrationUnit.PartPerBillion: return Value/1e9; + case VolumeConcentrationUnit.PartPerMillion: return Value/1e6; + case VolumeConcentrationUnit.PartPerThousand: return Value/1e3; + case VolumeConcentrationUnit.PartPerTrillion: return Value/1e12; + case VolumeConcentrationUnit.Percent: return Value/1e2; + case VolumeConcentrationUnit.PicolitersPerLiter: return (Value) * 1e-12d; + case VolumeConcentrationUnit.PicolitersPerMililiter: return (Value/1e-3) * 1e-12d; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -959,10 +950,10 @@ internal VolumeConcentration ToBaseUnit() return new VolumeConcentration(baseUnitValue, BaseUnit); } - private double GetValueAs(VolumeConcentrationUnit unit) + private T GetValueAs(VolumeConcentrationUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1089,7 +1080,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1104,37 +1095,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1158,17 +1149,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs index a84b63266d..be7cf83403 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q. /// - public partial struct VolumeFlow : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct VolumeFlow : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -109,12 +104,12 @@ static VolumeFlow() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public VolumeFlow(double value, VolumeFlowUnit unit) + public VolumeFlow(T value, VolumeFlowUnit unit) { if(unit == VolumeFlowUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -126,14 +121,14 @@ public VolumeFlow(double value, VolumeFlowUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public VolumeFlow(double value, UnitSystem unitSystem) + public VolumeFlow(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -175,7 +170,7 @@ public VolumeFlow(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerSecond. /// - public static VolumeFlow Zero { get; } = new VolumeFlow(0, BaseUnit); + public static VolumeFlow Zero { get; } = new VolumeFlow((T)0, BaseUnit); #endregion @@ -184,7 +179,9 @@ public VolumeFlow(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -214,247 +211,247 @@ public VolumeFlow(double value, UnitSystem unitSystem) /// /// Get in AcreFeetPerDay. /// - public double AcreFeetPerDay => As(VolumeFlowUnit.AcreFootPerDay); + public T AcreFeetPerDay => As(VolumeFlowUnit.AcreFootPerDay); /// /// Get in AcreFeetPerHour. /// - public double AcreFeetPerHour => As(VolumeFlowUnit.AcreFootPerHour); + public T AcreFeetPerHour => As(VolumeFlowUnit.AcreFootPerHour); /// /// Get in AcreFeetPerMinute. /// - public double AcreFeetPerMinute => As(VolumeFlowUnit.AcreFootPerMinute); + public T AcreFeetPerMinute => As(VolumeFlowUnit.AcreFootPerMinute); /// /// Get in AcreFeetPerSecond. /// - public double AcreFeetPerSecond => As(VolumeFlowUnit.AcreFootPerSecond); + public T AcreFeetPerSecond => As(VolumeFlowUnit.AcreFootPerSecond); /// /// Get in CentilitersPerDay. /// - public double CentilitersPerDay => As(VolumeFlowUnit.CentiliterPerDay); + public T CentilitersPerDay => As(VolumeFlowUnit.CentiliterPerDay); /// /// Get in CentilitersPerMinute. /// - public double CentilitersPerMinute => As(VolumeFlowUnit.CentiliterPerMinute); + public T CentilitersPerMinute => As(VolumeFlowUnit.CentiliterPerMinute); /// /// Get in CubicDecimetersPerMinute. /// - public double CubicDecimetersPerMinute => As(VolumeFlowUnit.CubicDecimeterPerMinute); + public T CubicDecimetersPerMinute => As(VolumeFlowUnit.CubicDecimeterPerMinute); /// /// Get in CubicFeetPerHour. /// - public double CubicFeetPerHour => As(VolumeFlowUnit.CubicFootPerHour); + public T CubicFeetPerHour => As(VolumeFlowUnit.CubicFootPerHour); /// /// Get in CubicFeetPerMinute. /// - public double CubicFeetPerMinute => As(VolumeFlowUnit.CubicFootPerMinute); + public T CubicFeetPerMinute => As(VolumeFlowUnit.CubicFootPerMinute); /// /// Get in CubicFeetPerSecond. /// - public double CubicFeetPerSecond => As(VolumeFlowUnit.CubicFootPerSecond); + public T CubicFeetPerSecond => As(VolumeFlowUnit.CubicFootPerSecond); /// /// Get in CubicMetersPerDay. /// - public double CubicMetersPerDay => As(VolumeFlowUnit.CubicMeterPerDay); + public T CubicMetersPerDay => As(VolumeFlowUnit.CubicMeterPerDay); /// /// Get in CubicMetersPerHour. /// - public double CubicMetersPerHour => As(VolumeFlowUnit.CubicMeterPerHour); + public T CubicMetersPerHour => As(VolumeFlowUnit.CubicMeterPerHour); /// /// Get in CubicMetersPerMinute. /// - public double CubicMetersPerMinute => As(VolumeFlowUnit.CubicMeterPerMinute); + public T CubicMetersPerMinute => As(VolumeFlowUnit.CubicMeterPerMinute); /// /// Get in CubicMetersPerSecond. /// - public double CubicMetersPerSecond => As(VolumeFlowUnit.CubicMeterPerSecond); + public T CubicMetersPerSecond => As(VolumeFlowUnit.CubicMeterPerSecond); /// /// Get in CubicMillimetersPerSecond. /// - public double CubicMillimetersPerSecond => As(VolumeFlowUnit.CubicMillimeterPerSecond); + public T CubicMillimetersPerSecond => As(VolumeFlowUnit.CubicMillimeterPerSecond); /// /// Get in CubicYardsPerDay. /// - public double CubicYardsPerDay => As(VolumeFlowUnit.CubicYardPerDay); + public T CubicYardsPerDay => As(VolumeFlowUnit.CubicYardPerDay); /// /// Get in CubicYardsPerHour. /// - public double CubicYardsPerHour => As(VolumeFlowUnit.CubicYardPerHour); + public T CubicYardsPerHour => As(VolumeFlowUnit.CubicYardPerHour); /// /// Get in CubicYardsPerMinute. /// - public double CubicYardsPerMinute => As(VolumeFlowUnit.CubicYardPerMinute); + public T CubicYardsPerMinute => As(VolumeFlowUnit.CubicYardPerMinute); /// /// Get in CubicYardsPerSecond. /// - public double CubicYardsPerSecond => As(VolumeFlowUnit.CubicYardPerSecond); + public T CubicYardsPerSecond => As(VolumeFlowUnit.CubicYardPerSecond); /// /// Get in DecilitersPerDay. /// - public double DecilitersPerDay => As(VolumeFlowUnit.DeciliterPerDay); + public T DecilitersPerDay => As(VolumeFlowUnit.DeciliterPerDay); /// /// Get in DecilitersPerMinute. /// - public double DecilitersPerMinute => As(VolumeFlowUnit.DeciliterPerMinute); + public T DecilitersPerMinute => As(VolumeFlowUnit.DeciliterPerMinute); /// /// Get in KilolitersPerDay. /// - public double KilolitersPerDay => As(VolumeFlowUnit.KiloliterPerDay); + public T KilolitersPerDay => As(VolumeFlowUnit.KiloliterPerDay); /// /// Get in KilolitersPerMinute. /// - public double KilolitersPerMinute => As(VolumeFlowUnit.KiloliterPerMinute); + public T KilolitersPerMinute => As(VolumeFlowUnit.KiloliterPerMinute); /// /// Get in KilousGallonsPerMinute. /// - public double KilousGallonsPerMinute => As(VolumeFlowUnit.KilousGallonPerMinute); + public T KilousGallonsPerMinute => As(VolumeFlowUnit.KilousGallonPerMinute); /// /// Get in LitersPerDay. /// - public double LitersPerDay => As(VolumeFlowUnit.LiterPerDay); + public T LitersPerDay => As(VolumeFlowUnit.LiterPerDay); /// /// Get in LitersPerHour. /// - public double LitersPerHour => As(VolumeFlowUnit.LiterPerHour); + public T LitersPerHour => As(VolumeFlowUnit.LiterPerHour); /// /// Get in LitersPerMinute. /// - public double LitersPerMinute => As(VolumeFlowUnit.LiterPerMinute); + public T LitersPerMinute => As(VolumeFlowUnit.LiterPerMinute); /// /// Get in LitersPerSecond. /// - public double LitersPerSecond => As(VolumeFlowUnit.LiterPerSecond); + public T LitersPerSecond => As(VolumeFlowUnit.LiterPerSecond); /// /// Get in MegalitersPerDay. /// - public double MegalitersPerDay => As(VolumeFlowUnit.MegaliterPerDay); + public T MegalitersPerDay => As(VolumeFlowUnit.MegaliterPerDay); /// /// Get in MegaukGallonsPerSecond. /// - public double MegaukGallonsPerSecond => As(VolumeFlowUnit.MegaukGallonPerSecond); + public T MegaukGallonsPerSecond => As(VolumeFlowUnit.MegaukGallonPerSecond); /// /// Get in MicrolitersPerDay. /// - public double MicrolitersPerDay => As(VolumeFlowUnit.MicroliterPerDay); + public T MicrolitersPerDay => As(VolumeFlowUnit.MicroliterPerDay); /// /// Get in MicrolitersPerMinute. /// - public double MicrolitersPerMinute => As(VolumeFlowUnit.MicroliterPerMinute); + public T MicrolitersPerMinute => As(VolumeFlowUnit.MicroliterPerMinute); /// /// Get in MillilitersPerDay. /// - public double MillilitersPerDay => As(VolumeFlowUnit.MilliliterPerDay); + public T MillilitersPerDay => As(VolumeFlowUnit.MilliliterPerDay); /// /// Get in MillilitersPerMinute. /// - public double MillilitersPerMinute => As(VolumeFlowUnit.MilliliterPerMinute); + public T MillilitersPerMinute => As(VolumeFlowUnit.MilliliterPerMinute); /// /// Get in MillionUsGallonsPerDay. /// - public double MillionUsGallonsPerDay => As(VolumeFlowUnit.MillionUsGallonsPerDay); + public T MillionUsGallonsPerDay => As(VolumeFlowUnit.MillionUsGallonsPerDay); /// /// Get in NanolitersPerDay. /// - public double NanolitersPerDay => As(VolumeFlowUnit.NanoliterPerDay); + public T NanolitersPerDay => As(VolumeFlowUnit.NanoliterPerDay); /// /// Get in NanolitersPerMinute. /// - public double NanolitersPerMinute => As(VolumeFlowUnit.NanoliterPerMinute); + public T NanolitersPerMinute => As(VolumeFlowUnit.NanoliterPerMinute); /// /// Get in OilBarrelsPerDay. /// - public double OilBarrelsPerDay => As(VolumeFlowUnit.OilBarrelPerDay); + public T OilBarrelsPerDay => As(VolumeFlowUnit.OilBarrelPerDay); /// /// Get in OilBarrelsPerHour. /// - public double OilBarrelsPerHour => As(VolumeFlowUnit.OilBarrelPerHour); + public T OilBarrelsPerHour => As(VolumeFlowUnit.OilBarrelPerHour); /// /// Get in OilBarrelsPerMinute. /// - public double OilBarrelsPerMinute => As(VolumeFlowUnit.OilBarrelPerMinute); + public T OilBarrelsPerMinute => As(VolumeFlowUnit.OilBarrelPerMinute); /// /// Get in OilBarrelsPerSecond. /// - public double OilBarrelsPerSecond => As(VolumeFlowUnit.OilBarrelPerSecond); + public T OilBarrelsPerSecond => As(VolumeFlowUnit.OilBarrelPerSecond); /// /// Get in UkGallonsPerDay. /// - public double UkGallonsPerDay => As(VolumeFlowUnit.UkGallonPerDay); + public T UkGallonsPerDay => As(VolumeFlowUnit.UkGallonPerDay); /// /// Get in UkGallonsPerHour. /// - public double UkGallonsPerHour => As(VolumeFlowUnit.UkGallonPerHour); + public T UkGallonsPerHour => As(VolumeFlowUnit.UkGallonPerHour); /// /// Get in UkGallonsPerMinute. /// - public double UkGallonsPerMinute => As(VolumeFlowUnit.UkGallonPerMinute); + public T UkGallonsPerMinute => As(VolumeFlowUnit.UkGallonPerMinute); /// /// Get in UkGallonsPerSecond. /// - public double UkGallonsPerSecond => As(VolumeFlowUnit.UkGallonPerSecond); + public T UkGallonsPerSecond => As(VolumeFlowUnit.UkGallonPerSecond); /// /// Get in UsGallonsPerDay. /// - public double UsGallonsPerDay => As(VolumeFlowUnit.UsGallonPerDay); + public T UsGallonsPerDay => As(VolumeFlowUnit.UsGallonPerDay); /// /// Get in UsGallonsPerHour. /// - public double UsGallonsPerHour => As(VolumeFlowUnit.UsGallonPerHour); + public T UsGallonsPerHour => As(VolumeFlowUnit.UsGallonPerHour); /// /// Get in UsGallonsPerMinute. /// - public double UsGallonsPerMinute => As(VolumeFlowUnit.UsGallonPerMinute); + public T UsGallonsPerMinute => As(VolumeFlowUnit.UsGallonPerMinute); /// /// Get in UsGallonsPerSecond. /// - public double UsGallonsPerSecond => As(VolumeFlowUnit.UsGallonPerSecond); + public T UsGallonsPerSecond => As(VolumeFlowUnit.UsGallonPerSecond); #endregion @@ -489,442 +486,393 @@ public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] IFormatPro /// Get from AcreFeetPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromAcreFeetPerDay(QuantityValue acrefeetperday) + public static VolumeFlow FromAcreFeetPerDay(T acrefeetperday) { - double value = (double) acrefeetperday; - return new VolumeFlow(value, VolumeFlowUnit.AcreFootPerDay); + return new VolumeFlow(acrefeetperday, VolumeFlowUnit.AcreFootPerDay); } /// /// Get from AcreFeetPerHour. /// /// If value is NaN or Infinity. - public static VolumeFlow FromAcreFeetPerHour(QuantityValue acrefeetperhour) + public static VolumeFlow FromAcreFeetPerHour(T acrefeetperhour) { - double value = (double) acrefeetperhour; - return new VolumeFlow(value, VolumeFlowUnit.AcreFootPerHour); + return new VolumeFlow(acrefeetperhour, VolumeFlowUnit.AcreFootPerHour); } /// /// Get from AcreFeetPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromAcreFeetPerMinute(QuantityValue acrefeetperminute) + public static VolumeFlow FromAcreFeetPerMinute(T acrefeetperminute) { - double value = (double) acrefeetperminute; - return new VolumeFlow(value, VolumeFlowUnit.AcreFootPerMinute); + return new VolumeFlow(acrefeetperminute, VolumeFlowUnit.AcreFootPerMinute); } /// /// Get from AcreFeetPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromAcreFeetPerSecond(QuantityValue acrefeetpersecond) + public static VolumeFlow FromAcreFeetPerSecond(T acrefeetpersecond) { - double value = (double) acrefeetpersecond; - return new VolumeFlow(value, VolumeFlowUnit.AcreFootPerSecond); + return new VolumeFlow(acrefeetpersecond, VolumeFlowUnit.AcreFootPerSecond); } /// /// Get from CentilitersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCentilitersPerDay(QuantityValue centilitersperday) + public static VolumeFlow FromCentilitersPerDay(T centilitersperday) { - double value = (double) centilitersperday; - return new VolumeFlow(value, VolumeFlowUnit.CentiliterPerDay); + return new VolumeFlow(centilitersperday, VolumeFlowUnit.CentiliterPerDay); } /// /// Get from CentilitersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCentilitersPerMinute(QuantityValue centilitersperminute) + public static VolumeFlow FromCentilitersPerMinute(T centilitersperminute) { - double value = (double) centilitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.CentiliterPerMinute); + return new VolumeFlow(centilitersperminute, VolumeFlowUnit.CentiliterPerMinute); } /// /// Get from CubicDecimetersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicDecimetersPerMinute(QuantityValue cubicdecimetersperminute) + public static VolumeFlow FromCubicDecimetersPerMinute(T cubicdecimetersperminute) { - double value = (double) cubicdecimetersperminute; - return new VolumeFlow(value, VolumeFlowUnit.CubicDecimeterPerMinute); + return new VolumeFlow(cubicdecimetersperminute, VolumeFlowUnit.CubicDecimeterPerMinute); } /// /// Get from CubicFeetPerHour. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicFeetPerHour(QuantityValue cubicfeetperhour) + public static VolumeFlow FromCubicFeetPerHour(T cubicfeetperhour) { - double value = (double) cubicfeetperhour; - return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerHour); + return new VolumeFlow(cubicfeetperhour, VolumeFlowUnit.CubicFootPerHour); } /// /// Get from CubicFeetPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicFeetPerMinute(QuantityValue cubicfeetperminute) + public static VolumeFlow FromCubicFeetPerMinute(T cubicfeetperminute) { - double value = (double) cubicfeetperminute; - return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerMinute); + return new VolumeFlow(cubicfeetperminute, VolumeFlowUnit.CubicFootPerMinute); } /// /// Get from CubicFeetPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicFeetPerSecond(QuantityValue cubicfeetpersecond) + public static VolumeFlow FromCubicFeetPerSecond(T cubicfeetpersecond) { - double value = (double) cubicfeetpersecond; - return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerSecond); + return new VolumeFlow(cubicfeetpersecond, VolumeFlowUnit.CubicFootPerSecond); } /// /// Get from CubicMetersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicMetersPerDay(QuantityValue cubicmetersperday) + public static VolumeFlow FromCubicMetersPerDay(T cubicmetersperday) { - double value = (double) cubicmetersperday; - return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerDay); + return new VolumeFlow(cubicmetersperday, VolumeFlowUnit.CubicMeterPerDay); } /// /// Get from CubicMetersPerHour. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicMetersPerHour(QuantityValue cubicmetersperhour) + public static VolumeFlow FromCubicMetersPerHour(T cubicmetersperhour) { - double value = (double) cubicmetersperhour; - return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerHour); + return new VolumeFlow(cubicmetersperhour, VolumeFlowUnit.CubicMeterPerHour); } /// /// Get from CubicMetersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicMetersPerMinute(QuantityValue cubicmetersperminute) + public static VolumeFlow FromCubicMetersPerMinute(T cubicmetersperminute) { - double value = (double) cubicmetersperminute; - return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerMinute); + return new VolumeFlow(cubicmetersperminute, VolumeFlowUnit.CubicMeterPerMinute); } /// /// Get from CubicMetersPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicMetersPerSecond(QuantityValue cubicmeterspersecond) + public static VolumeFlow FromCubicMetersPerSecond(T cubicmeterspersecond) { - double value = (double) cubicmeterspersecond; - return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerSecond); + return new VolumeFlow(cubicmeterspersecond, VolumeFlowUnit.CubicMeterPerSecond); } /// /// Get from CubicMillimetersPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicMillimetersPerSecond(QuantityValue cubicmillimeterspersecond) + public static VolumeFlow FromCubicMillimetersPerSecond(T cubicmillimeterspersecond) { - double value = (double) cubicmillimeterspersecond; - return new VolumeFlow(value, VolumeFlowUnit.CubicMillimeterPerSecond); + return new VolumeFlow(cubicmillimeterspersecond, VolumeFlowUnit.CubicMillimeterPerSecond); } /// /// Get from CubicYardsPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicYardsPerDay(QuantityValue cubicyardsperday) + public static VolumeFlow FromCubicYardsPerDay(T cubicyardsperday) { - double value = (double) cubicyardsperday; - return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerDay); + return new VolumeFlow(cubicyardsperday, VolumeFlowUnit.CubicYardPerDay); } /// /// Get from CubicYardsPerHour. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicYardsPerHour(QuantityValue cubicyardsperhour) + public static VolumeFlow FromCubicYardsPerHour(T cubicyardsperhour) { - double value = (double) cubicyardsperhour; - return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerHour); + return new VolumeFlow(cubicyardsperhour, VolumeFlowUnit.CubicYardPerHour); } /// /// Get from CubicYardsPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicYardsPerMinute(QuantityValue cubicyardsperminute) + public static VolumeFlow FromCubicYardsPerMinute(T cubicyardsperminute) { - double value = (double) cubicyardsperminute; - return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerMinute); + return new VolumeFlow(cubicyardsperminute, VolumeFlowUnit.CubicYardPerMinute); } /// /// Get from CubicYardsPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromCubicYardsPerSecond(QuantityValue cubicyardspersecond) + public static VolumeFlow FromCubicYardsPerSecond(T cubicyardspersecond) { - double value = (double) cubicyardspersecond; - return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerSecond); + return new VolumeFlow(cubicyardspersecond, VolumeFlowUnit.CubicYardPerSecond); } /// /// Get from DecilitersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromDecilitersPerDay(QuantityValue decilitersperday) + public static VolumeFlow FromDecilitersPerDay(T decilitersperday) { - double value = (double) decilitersperday; - return new VolumeFlow(value, VolumeFlowUnit.DeciliterPerDay); + return new VolumeFlow(decilitersperday, VolumeFlowUnit.DeciliterPerDay); } /// /// Get from DecilitersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromDecilitersPerMinute(QuantityValue decilitersperminute) + public static VolumeFlow FromDecilitersPerMinute(T decilitersperminute) { - double value = (double) decilitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.DeciliterPerMinute); + return new VolumeFlow(decilitersperminute, VolumeFlowUnit.DeciliterPerMinute); } /// /// Get from KilolitersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromKilolitersPerDay(QuantityValue kilolitersperday) + public static VolumeFlow FromKilolitersPerDay(T kilolitersperday) { - double value = (double) kilolitersperday; - return new VolumeFlow(value, VolumeFlowUnit.KiloliterPerDay); + return new VolumeFlow(kilolitersperday, VolumeFlowUnit.KiloliterPerDay); } /// /// Get from KilolitersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromKilolitersPerMinute(QuantityValue kilolitersperminute) + public static VolumeFlow FromKilolitersPerMinute(T kilolitersperminute) { - double value = (double) kilolitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.KiloliterPerMinute); + return new VolumeFlow(kilolitersperminute, VolumeFlowUnit.KiloliterPerMinute); } /// /// Get from KilousGallonsPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromKilousGallonsPerMinute(QuantityValue kilousgallonsperminute) + public static VolumeFlow FromKilousGallonsPerMinute(T kilousgallonsperminute) { - double value = (double) kilousgallonsperminute; - return new VolumeFlow(value, VolumeFlowUnit.KilousGallonPerMinute); + return new VolumeFlow(kilousgallonsperminute, VolumeFlowUnit.KilousGallonPerMinute); } /// /// Get from LitersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromLitersPerDay(QuantityValue litersperday) + public static VolumeFlow FromLitersPerDay(T litersperday) { - double value = (double) litersperday; - return new VolumeFlow(value, VolumeFlowUnit.LiterPerDay); + return new VolumeFlow(litersperday, VolumeFlowUnit.LiterPerDay); } /// /// Get from LitersPerHour. /// /// If value is NaN or Infinity. - public static VolumeFlow FromLitersPerHour(QuantityValue litersperhour) + public static VolumeFlow FromLitersPerHour(T litersperhour) { - double value = (double) litersperhour; - return new VolumeFlow(value, VolumeFlowUnit.LiterPerHour); + return new VolumeFlow(litersperhour, VolumeFlowUnit.LiterPerHour); } /// /// Get from LitersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromLitersPerMinute(QuantityValue litersperminute) + public static VolumeFlow FromLitersPerMinute(T litersperminute) { - double value = (double) litersperminute; - return new VolumeFlow(value, VolumeFlowUnit.LiterPerMinute); + return new VolumeFlow(litersperminute, VolumeFlowUnit.LiterPerMinute); } /// /// Get from LitersPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromLitersPerSecond(QuantityValue literspersecond) + public static VolumeFlow FromLitersPerSecond(T literspersecond) { - double value = (double) literspersecond; - return new VolumeFlow(value, VolumeFlowUnit.LiterPerSecond); + return new VolumeFlow(literspersecond, VolumeFlowUnit.LiterPerSecond); } /// /// Get from MegalitersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromMegalitersPerDay(QuantityValue megalitersperday) + public static VolumeFlow FromMegalitersPerDay(T megalitersperday) { - double value = (double) megalitersperday; - return new VolumeFlow(value, VolumeFlowUnit.MegaliterPerDay); + return new VolumeFlow(megalitersperday, VolumeFlowUnit.MegaliterPerDay); } /// /// Get from MegaukGallonsPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromMegaukGallonsPerSecond(QuantityValue megaukgallonspersecond) + public static VolumeFlow FromMegaukGallonsPerSecond(T megaukgallonspersecond) { - double value = (double) megaukgallonspersecond; - return new VolumeFlow(value, VolumeFlowUnit.MegaukGallonPerSecond); + return new VolumeFlow(megaukgallonspersecond, VolumeFlowUnit.MegaukGallonPerSecond); } /// /// Get from MicrolitersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromMicrolitersPerDay(QuantityValue microlitersperday) + public static VolumeFlow FromMicrolitersPerDay(T microlitersperday) { - double value = (double) microlitersperday; - return new VolumeFlow(value, VolumeFlowUnit.MicroliterPerDay); + return new VolumeFlow(microlitersperday, VolumeFlowUnit.MicroliterPerDay); } /// /// Get from MicrolitersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromMicrolitersPerMinute(QuantityValue microlitersperminute) + public static VolumeFlow FromMicrolitersPerMinute(T microlitersperminute) { - double value = (double) microlitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.MicroliterPerMinute); + return new VolumeFlow(microlitersperminute, VolumeFlowUnit.MicroliterPerMinute); } /// /// Get from MillilitersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromMillilitersPerDay(QuantityValue millilitersperday) + public static VolumeFlow FromMillilitersPerDay(T millilitersperday) { - double value = (double) millilitersperday; - return new VolumeFlow(value, VolumeFlowUnit.MilliliterPerDay); + return new VolumeFlow(millilitersperday, VolumeFlowUnit.MilliliterPerDay); } /// /// Get from MillilitersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromMillilitersPerMinute(QuantityValue millilitersperminute) + public static VolumeFlow FromMillilitersPerMinute(T millilitersperminute) { - double value = (double) millilitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.MilliliterPerMinute); + return new VolumeFlow(millilitersperminute, VolumeFlowUnit.MilliliterPerMinute); } /// /// Get from MillionUsGallonsPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromMillionUsGallonsPerDay(QuantityValue millionusgallonsperday) + public static VolumeFlow FromMillionUsGallonsPerDay(T millionusgallonsperday) { - double value = (double) millionusgallonsperday; - return new VolumeFlow(value, VolumeFlowUnit.MillionUsGallonsPerDay); + return new VolumeFlow(millionusgallonsperday, VolumeFlowUnit.MillionUsGallonsPerDay); } /// /// Get from NanolitersPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromNanolitersPerDay(QuantityValue nanolitersperday) + public static VolumeFlow FromNanolitersPerDay(T nanolitersperday) { - double value = (double) nanolitersperday; - return new VolumeFlow(value, VolumeFlowUnit.NanoliterPerDay); + return new VolumeFlow(nanolitersperday, VolumeFlowUnit.NanoliterPerDay); } /// /// Get from NanolitersPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromNanolitersPerMinute(QuantityValue nanolitersperminute) + public static VolumeFlow FromNanolitersPerMinute(T nanolitersperminute) { - double value = (double) nanolitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.NanoliterPerMinute); + return new VolumeFlow(nanolitersperminute, VolumeFlowUnit.NanoliterPerMinute); } /// /// Get from OilBarrelsPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromOilBarrelsPerDay(QuantityValue oilbarrelsperday) + public static VolumeFlow FromOilBarrelsPerDay(T oilbarrelsperday) { - double value = (double) oilbarrelsperday; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerDay); + return new VolumeFlow(oilbarrelsperday, VolumeFlowUnit.OilBarrelPerDay); } /// /// Get from OilBarrelsPerHour. /// /// If value is NaN or Infinity. - public static VolumeFlow FromOilBarrelsPerHour(QuantityValue oilbarrelsperhour) + public static VolumeFlow FromOilBarrelsPerHour(T oilbarrelsperhour) { - double value = (double) oilbarrelsperhour; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerHour); + return new VolumeFlow(oilbarrelsperhour, VolumeFlowUnit.OilBarrelPerHour); } /// /// Get from OilBarrelsPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromOilBarrelsPerMinute(QuantityValue oilbarrelsperminute) + public static VolumeFlow FromOilBarrelsPerMinute(T oilbarrelsperminute) { - double value = (double) oilbarrelsperminute; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerMinute); + return new VolumeFlow(oilbarrelsperminute, VolumeFlowUnit.OilBarrelPerMinute); } /// /// Get from OilBarrelsPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromOilBarrelsPerSecond(QuantityValue oilbarrelspersecond) + public static VolumeFlow FromOilBarrelsPerSecond(T oilbarrelspersecond) { - double value = (double) oilbarrelspersecond; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerSecond); + return new VolumeFlow(oilbarrelspersecond, VolumeFlowUnit.OilBarrelPerSecond); } /// /// Get from UkGallonsPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromUkGallonsPerDay(QuantityValue ukgallonsperday) + public static VolumeFlow FromUkGallonsPerDay(T ukgallonsperday) { - double value = (double) ukgallonsperday; - return new VolumeFlow(value, VolumeFlowUnit.UkGallonPerDay); + return new VolumeFlow(ukgallonsperday, VolumeFlowUnit.UkGallonPerDay); } /// /// Get from UkGallonsPerHour. /// /// If value is NaN or Infinity. - public static VolumeFlow FromUkGallonsPerHour(QuantityValue ukgallonsperhour) + public static VolumeFlow FromUkGallonsPerHour(T ukgallonsperhour) { - double value = (double) ukgallonsperhour; - return new VolumeFlow(value, VolumeFlowUnit.UkGallonPerHour); + return new VolumeFlow(ukgallonsperhour, VolumeFlowUnit.UkGallonPerHour); } /// /// Get from UkGallonsPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromUkGallonsPerMinute(QuantityValue ukgallonsperminute) + public static VolumeFlow FromUkGallonsPerMinute(T ukgallonsperminute) { - double value = (double) ukgallonsperminute; - return new VolumeFlow(value, VolumeFlowUnit.UkGallonPerMinute); + return new VolumeFlow(ukgallonsperminute, VolumeFlowUnit.UkGallonPerMinute); } /// /// Get from UkGallonsPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromUkGallonsPerSecond(QuantityValue ukgallonspersecond) + public static VolumeFlow FromUkGallonsPerSecond(T ukgallonspersecond) { - double value = (double) ukgallonspersecond; - return new VolumeFlow(value, VolumeFlowUnit.UkGallonPerSecond); + return new VolumeFlow(ukgallonspersecond, VolumeFlowUnit.UkGallonPerSecond); } /// /// Get from UsGallonsPerDay. /// /// If value is NaN or Infinity. - public static VolumeFlow FromUsGallonsPerDay(QuantityValue usgallonsperday) + public static VolumeFlow FromUsGallonsPerDay(T usgallonsperday) { - double value = (double) usgallonsperday; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerDay); + return new VolumeFlow(usgallonsperday, VolumeFlowUnit.UsGallonPerDay); } /// /// Get from UsGallonsPerHour. /// /// If value is NaN or Infinity. - public static VolumeFlow FromUsGallonsPerHour(QuantityValue usgallonsperhour) + public static VolumeFlow FromUsGallonsPerHour(T usgallonsperhour) { - double value = (double) usgallonsperhour; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerHour); + return new VolumeFlow(usgallonsperhour, VolumeFlowUnit.UsGallonPerHour); } /// /// Get from UsGallonsPerMinute. /// /// If value is NaN or Infinity. - public static VolumeFlow FromUsGallonsPerMinute(QuantityValue usgallonsperminute) + public static VolumeFlow FromUsGallonsPerMinute(T usgallonsperminute) { - double value = (double) usgallonsperminute; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerMinute); + return new VolumeFlow(usgallonsperminute, VolumeFlowUnit.UsGallonPerMinute); } /// /// Get from UsGallonsPerSecond. /// /// If value is NaN or Infinity. - public static VolumeFlow FromUsGallonsPerSecond(QuantityValue usgallonspersecond) + public static VolumeFlow FromUsGallonsPerSecond(T usgallonspersecond) { - double value = (double) usgallonspersecond; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerSecond); + return new VolumeFlow(usgallonspersecond, VolumeFlowUnit.UsGallonPerSecond); } /// @@ -933,9 +881,9 @@ public static VolumeFlow FromUsGallonsPerSecond(QuantityValue usgallonspersec /// Value to convert from. /// Unit to convert from. /// unit value. - public static VolumeFlow From(QuantityValue value, VolumeFlowUnit fromUnit) + public static VolumeFlow From(T value, VolumeFlowUnit fromUnit) { - return new VolumeFlow((double)value, fromUnit); + return new VolumeFlow(value, fromUnit); } #endregion @@ -1089,43 +1037,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume /// Negate the value. public static VolumeFlow operator -(VolumeFlow right) { - return new VolumeFlow(-right.Value, right.Unit); + return new VolumeFlow(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static VolumeFlow operator +(VolumeFlow left, VolumeFlow right) { - return new VolumeFlow(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new VolumeFlow(value, left.Unit); } /// Get from subtracting two . public static VolumeFlow operator -(VolumeFlow left, VolumeFlow right) { - return new VolumeFlow(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new VolumeFlow(value, left.Unit); } /// Get from multiplying value and . - public static VolumeFlow operator *(double left, VolumeFlow right) + public static VolumeFlow operator *(T left, VolumeFlow right) { - return new VolumeFlow(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new VolumeFlow(value, right.Unit); } /// Get from multiplying value and . - public static VolumeFlow operator *(VolumeFlow left, double right) + public static VolumeFlow operator *(VolumeFlow left, T right) { - return new VolumeFlow(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new VolumeFlow(value, left.Unit); } /// Get from dividing by value. - public static VolumeFlow operator /(VolumeFlow left, double right) + public static VolumeFlow operator /(VolumeFlow left, T right) { - return new VolumeFlow(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new VolumeFlow(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(VolumeFlow left, VolumeFlow right) + public static T operator /(VolumeFlow left, VolumeFlow right) { - return left.CubicMetersPerSecond / right.CubicMetersPerSecond; + return CompiledLambdas.Divide(left.CubicMetersPerSecond, right.CubicMetersPerSecond); } #endregion @@ -1135,25 +1088,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume /// Returns true if less or equal to. public static bool operator <=(VolumeFlow left, VolumeFlow right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(VolumeFlow left, VolumeFlow right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(VolumeFlow left, VolumeFlow right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(VolumeFlow left, VolumeFlow right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -1182,7 +1135,7 @@ public int CompareTo(object obj) /// public int CompareTo(VolumeFlow other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -1199,7 +1152,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(VolumeFlow other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1247,10 +1200,8 @@ public bool Equals(VolumeFlow other, double tolerance, ComparisonType compari if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -1270,17 +1221,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(VolumeFlowUnit unit) + public T As(VolumeFlowUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -1300,9 +1251,14 @@ double IQuantity.As(Enum unit) if(!(unit is VolumeFlowUnit unitAsVolumeFlowUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeFlowUnit)} is supported.", nameof(unit)); - return As(unitAsVolumeFlowUnit); + var asValue = As(unitAsVolumeFlowUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(VolumeFlowUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -1343,67 +1299,73 @@ public VolumeFlow ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(VolumeFlowUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(VolumeFlowUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case VolumeFlowUnit.AcreFootPerDay: return _value/70.0457; - case VolumeFlowUnit.AcreFootPerHour: return _value/2.91857; - case VolumeFlowUnit.AcreFootPerMinute: return _value/0.0486427916; - case VolumeFlowUnit.AcreFootPerSecond: return _value/0.000810713194; - case VolumeFlowUnit.CentiliterPerDay: return (_value/86400000) * 1e-2d; - case VolumeFlowUnit.CentiliterPerMinute: return (_value/60000.00000) * 1e-2d; - case VolumeFlowUnit.CubicDecimeterPerMinute: return _value/60000.00000; - case VolumeFlowUnit.CubicFootPerHour: return _value*7.8657907199999087346816086183876e-6; - case VolumeFlowUnit.CubicFootPerMinute: return _value/2118.88000326; - case VolumeFlowUnit.CubicFootPerSecond: return _value/35.314666721; - case VolumeFlowUnit.CubicMeterPerDay: return _value/86400; - case VolumeFlowUnit.CubicMeterPerHour: return _value/3600; - case VolumeFlowUnit.CubicMeterPerMinute: return _value/60; - case VolumeFlowUnit.CubicMeterPerSecond: return _value; - case VolumeFlowUnit.CubicMillimeterPerSecond: return _value*1e-9; - case VolumeFlowUnit.CubicYardPerDay: return _value/113007; - case VolumeFlowUnit.CubicYardPerHour: return _value*2.1237634944E-4; - case VolumeFlowUnit.CubicYardPerMinute: return _value*0.0127425809664; - case VolumeFlowUnit.CubicYardPerSecond: return _value*0.764554857984; - case VolumeFlowUnit.DeciliterPerDay: return (_value/86400000) * 1e-1d; - case VolumeFlowUnit.DeciliterPerMinute: return (_value/60000.00000) * 1e-1d; - case VolumeFlowUnit.KiloliterPerDay: return (_value/86400000) * 1e3d; - case VolumeFlowUnit.KiloliterPerMinute: return (_value/60000.00000) * 1e3d; - case VolumeFlowUnit.KilousGallonPerMinute: return _value/15.850323141489; - case VolumeFlowUnit.LiterPerDay: return _value/86400000; - case VolumeFlowUnit.LiterPerHour: return _value/3600000.000; - case VolumeFlowUnit.LiterPerMinute: return _value/60000.00000; - case VolumeFlowUnit.LiterPerSecond: return _value/1000; - case VolumeFlowUnit.MegaliterPerDay: return (_value/86400000) * 1e6d; - case VolumeFlowUnit.MegaukGallonPerSecond: return (_value/219.969) * 1e6d; - case VolumeFlowUnit.MicroliterPerDay: return (_value/86400000) * 1e-6d; - case VolumeFlowUnit.MicroliterPerMinute: return (_value/60000.00000) * 1e-6d; - case VolumeFlowUnit.MilliliterPerDay: return (_value/86400000) * 1e-3d; - case VolumeFlowUnit.MilliliterPerMinute: return (_value/60000.00000) * 1e-3d; - case VolumeFlowUnit.MillionUsGallonsPerDay: return _value/22.824465227; - case VolumeFlowUnit.NanoliterPerDay: return (_value/86400000) * 1e-9d; - case VolumeFlowUnit.NanoliterPerMinute: return (_value/60000.00000) * 1e-9d; - case VolumeFlowUnit.OilBarrelPerDay: return _value*1.8401307283333333333333333333333e-6; - case VolumeFlowUnit.OilBarrelPerHour: return _value*4.41631375e-5; - case VolumeFlowUnit.OilBarrelPerMinute: return _value*2.64978825e-3; - case VolumeFlowUnit.OilBarrelPerSecond: return _value/6.28981; - case VolumeFlowUnit.UkGallonPerDay: return _value/19005304; - case VolumeFlowUnit.UkGallonPerHour: return _value/791887.667; - case VolumeFlowUnit.UkGallonPerMinute: return _value/13198.2; - case VolumeFlowUnit.UkGallonPerSecond: return _value/219.969; - case VolumeFlowUnit.UsGallonPerDay: return _value/22824465.227; - case VolumeFlowUnit.UsGallonPerHour: return _value/951019.38848933424; - case VolumeFlowUnit.UsGallonPerMinute: return _value/15850.323141489; - case VolumeFlowUnit.UsGallonPerSecond: return _value/264.1720523581484; + case VolumeFlowUnit.AcreFootPerDay: return Value/70.0457; + case VolumeFlowUnit.AcreFootPerHour: return Value/2.91857; + case VolumeFlowUnit.AcreFootPerMinute: return Value/0.0486427916; + case VolumeFlowUnit.AcreFootPerSecond: return Value/0.000810713194; + case VolumeFlowUnit.CentiliterPerDay: return (Value/86400000) * 1e-2d; + case VolumeFlowUnit.CentiliterPerMinute: return (Value/60000.00000) * 1e-2d; + case VolumeFlowUnit.CubicDecimeterPerMinute: return Value/60000.00000; + case VolumeFlowUnit.CubicFootPerHour: return Value*7.8657907199999087346816086183876e-6; + case VolumeFlowUnit.CubicFootPerMinute: return Value/2118.88000326; + case VolumeFlowUnit.CubicFootPerSecond: return Value/35.314666721; + case VolumeFlowUnit.CubicMeterPerDay: return Value/86400; + case VolumeFlowUnit.CubicMeterPerHour: return Value/3600; + case VolumeFlowUnit.CubicMeterPerMinute: return Value/60; + case VolumeFlowUnit.CubicMeterPerSecond: return Value; + case VolumeFlowUnit.CubicMillimeterPerSecond: return Value*1e-9; + case VolumeFlowUnit.CubicYardPerDay: return Value/113007; + case VolumeFlowUnit.CubicYardPerHour: return Value*2.1237634944E-4; + case VolumeFlowUnit.CubicYardPerMinute: return Value*0.0127425809664; + case VolumeFlowUnit.CubicYardPerSecond: return Value*0.764554857984; + case VolumeFlowUnit.DeciliterPerDay: return (Value/86400000) * 1e-1d; + case VolumeFlowUnit.DeciliterPerMinute: return (Value/60000.00000) * 1e-1d; + case VolumeFlowUnit.KiloliterPerDay: return (Value/86400000) * 1e3d; + case VolumeFlowUnit.KiloliterPerMinute: return (Value/60000.00000) * 1e3d; + case VolumeFlowUnit.KilousGallonPerMinute: return Value/15.850323141489; + case VolumeFlowUnit.LiterPerDay: return Value/86400000; + case VolumeFlowUnit.LiterPerHour: return Value/3600000.000; + case VolumeFlowUnit.LiterPerMinute: return Value/60000.00000; + case VolumeFlowUnit.LiterPerSecond: return Value/1000; + case VolumeFlowUnit.MegaliterPerDay: return (Value/86400000) * 1e6d; + case VolumeFlowUnit.MegaukGallonPerSecond: return (Value/219.969) * 1e6d; + case VolumeFlowUnit.MicroliterPerDay: return (Value/86400000) * 1e-6d; + case VolumeFlowUnit.MicroliterPerMinute: return (Value/60000.00000) * 1e-6d; + case VolumeFlowUnit.MilliliterPerDay: return (Value/86400000) * 1e-3d; + case VolumeFlowUnit.MilliliterPerMinute: return (Value/60000.00000) * 1e-3d; + case VolumeFlowUnit.MillionUsGallonsPerDay: return Value/22.824465227; + case VolumeFlowUnit.NanoliterPerDay: return (Value/86400000) * 1e-9d; + case VolumeFlowUnit.NanoliterPerMinute: return (Value/60000.00000) * 1e-9d; + case VolumeFlowUnit.OilBarrelPerDay: return Value*1.8401307283333333333333333333333e-6; + case VolumeFlowUnit.OilBarrelPerHour: return Value*4.41631375e-5; + case VolumeFlowUnit.OilBarrelPerMinute: return Value*2.64978825e-3; + case VolumeFlowUnit.OilBarrelPerSecond: return Value/6.28981; + case VolumeFlowUnit.UkGallonPerDay: return Value/19005304; + case VolumeFlowUnit.UkGallonPerHour: return Value/791887.667; + case VolumeFlowUnit.UkGallonPerMinute: return Value/13198.2; + case VolumeFlowUnit.UkGallonPerSecond: return Value/219.969; + case VolumeFlowUnit.UsGallonPerDay: return Value/22824465.227; + case VolumeFlowUnit.UsGallonPerHour: return Value/951019.38848933424; + case VolumeFlowUnit.UsGallonPerMinute: return Value/15850.323141489; + case VolumeFlowUnit.UsGallonPerSecond: return Value/264.1720523581484; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -1420,10 +1382,10 @@ internal VolumeFlow ToBaseUnit() return new VolumeFlow(baseUnitValue, BaseUnit); } - private double GetValueAs(VolumeFlowUnit unit) + private T GetValueAs(VolumeFlowUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -1579,7 +1541,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -1594,37 +1556,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -1648,17 +1610,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs index f2b686a155..9bd32c64f5 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -32,13 +32,8 @@ namespace UnitsNet /// /// Volume, typically of fluid, that a container can hold within a unit of length. /// - public partial struct VolumePerLength : IQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + public partial struct VolumePerLength : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - /// /// The unit this quantity was constructed with. /// @@ -63,12 +58,12 @@ static VolumePerLength() /// The numeric value to construct this quantity with. /// The unit representation to construct this quantity with. /// If value is NaN or Infinity. - public VolumePerLength(double value, VolumePerLengthUnit unit) + public VolumePerLength(T value, VolumePerLengthUnit unit) { if(unit == VolumePerLengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = unit; } @@ -80,14 +75,14 @@ public VolumePerLength(double value, VolumePerLengthUnit unit) /// The unit system to create the quantity with. /// The given is null. /// No unit was found for the given . - public VolumePerLength(double value, UnitSystem unitSystem) + public VolumePerLength(T value, UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + Value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -129,7 +124,7 @@ public VolumePerLength(double value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerMeter. /// - public static VolumePerLength Zero { get; } = new VolumePerLength(0, BaseUnit); + public static VolumePerLength Zero { get; } = new VolumePerLength((T)0, BaseUnit); #endregion @@ -138,7 +133,9 @@ public VolumePerLength(double value, UnitSystem unitSystem) /// /// The numeric value this quantity was constructed with. /// - public double Value => _value; + public T Value{ get; } + + double IQuantity.Value => Convert.ToDouble(Value); Enum IQuantity.Unit => Unit; @@ -168,17 +165,17 @@ public VolumePerLength(double value, UnitSystem unitSystem) /// /// Get in CubicMetersPerMeter. /// - public double CubicMetersPerMeter => As(VolumePerLengthUnit.CubicMeterPerMeter); + public T CubicMetersPerMeter => As(VolumePerLengthUnit.CubicMeterPerMeter); /// /// Get in LitersPerMeter. /// - public double LitersPerMeter => As(VolumePerLengthUnit.LiterPerMeter); + public T LitersPerMeter => As(VolumePerLengthUnit.LiterPerMeter); /// /// Get in OilBarrelsPerFoot. /// - public double OilBarrelsPerFoot => As(VolumePerLengthUnit.OilBarrelPerFoot); + public T OilBarrelsPerFoot => As(VolumePerLengthUnit.OilBarrelPerFoot); #endregion @@ -213,28 +210,25 @@ public static string GetAbbreviation(VolumePerLengthUnit unit, [CanBeNull] IForm /// Get from CubicMetersPerMeter. /// /// If value is NaN or Infinity. - public static VolumePerLength FromCubicMetersPerMeter(QuantityValue cubicmeterspermeter) + public static VolumePerLength FromCubicMetersPerMeter(T cubicmeterspermeter) { - double value = (double) cubicmeterspermeter; - return new VolumePerLength(value, VolumePerLengthUnit.CubicMeterPerMeter); + return new VolumePerLength(cubicmeterspermeter, VolumePerLengthUnit.CubicMeterPerMeter); } /// /// Get from LitersPerMeter. /// /// If value is NaN or Infinity. - public static VolumePerLength FromLitersPerMeter(QuantityValue literspermeter) + public static VolumePerLength FromLitersPerMeter(T literspermeter) { - double value = (double) literspermeter; - return new VolumePerLength(value, VolumePerLengthUnit.LiterPerMeter); + return new VolumePerLength(literspermeter, VolumePerLengthUnit.LiterPerMeter); } /// /// Get from OilBarrelsPerFoot. /// /// If value is NaN or Infinity. - public static VolumePerLength FromOilBarrelsPerFoot(QuantityValue oilbarrelsperfoot) + public static VolumePerLength FromOilBarrelsPerFoot(T oilbarrelsperfoot) { - double value = (double) oilbarrelsperfoot; - return new VolumePerLength(value, VolumePerLengthUnit.OilBarrelPerFoot); + return new VolumePerLength(oilbarrelsperfoot, VolumePerLengthUnit.OilBarrelPerFoot); } /// @@ -243,9 +237,9 @@ public static VolumePerLength FromOilBarrelsPerFoot(QuantityValue oilbarrelsp /// Value to convert from. /// Unit to convert from. /// unit value. - public static VolumePerLength From(QuantityValue value, VolumePerLengthUnit fromUnit) + public static VolumePerLength From(T value, VolumePerLengthUnit fromUnit) { - return new VolumePerLength((double)value, fromUnit); + return new VolumePerLength(value, fromUnit); } #endregion @@ -399,43 +393,48 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume /// Negate the value. public static VolumePerLength operator -(VolumePerLength right) { - return new VolumePerLength(-right.Value, right.Unit); + return new VolumePerLength(CompiledLambdas.Negate(right.Value), right.Unit); } /// Get from adding two . public static VolumePerLength operator +(VolumePerLength left, VolumePerLength right) { - return new VolumePerLength(left.Value + right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Add(left.Value, right.GetValueAs(left.Unit)); + return new VolumePerLength(value, left.Unit); } /// Get from subtracting two . public static VolumePerLength operator -(VolumePerLength left, VolumePerLength right) { - return new VolumePerLength(left.Value - right.GetValueAs(left.Unit), left.Unit); + var value = CompiledLambdas.Subtract(left.Value, right.GetValueAs(left.Unit)); + return new VolumePerLength(value, left.Unit); } /// Get from multiplying value and . - public static VolumePerLength operator *(double left, VolumePerLength right) + public static VolumePerLength operator *(T left, VolumePerLength right) { - return new VolumePerLength(left * right.Value, right.Unit); + var value = CompiledLambdas.Multiply(left, right.Value); + return new VolumePerLength(value, right.Unit); } /// Get from multiplying value and . - public static VolumePerLength operator *(VolumePerLength left, double right) + public static VolumePerLength operator *(VolumePerLength left, T right) { - return new VolumePerLength(left.Value * right, left.Unit); + var value = CompiledLambdas.Multiply(left.Value, right); + return new VolumePerLength(value, left.Unit); } /// Get from dividing by value. - public static VolumePerLength operator /(VolumePerLength left, double right) + public static VolumePerLength operator /(VolumePerLength left, T right) { - return new VolumePerLength(left.Value / right, left.Unit); + var value = CompiledLambdas.Divide(left.Value, right); + return new VolumePerLength(value, left.Unit); } /// Get ratio value from dividing by . - public static double operator /(VolumePerLength left, VolumePerLength right) + public static T operator /(VolumePerLength left, VolumePerLength right) { - return left.CubicMetersPerMeter / right.CubicMetersPerMeter; + return CompiledLambdas.Divide(left.CubicMetersPerMeter, right.CubicMetersPerMeter); } #endregion @@ -445,25 +444,25 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume /// Returns true if less or equal to. public static bool operator <=(VolumePerLength left, VolumePerLength right) { - return left.Value <= right.GetValueAs(left.Unit); + return CompiledLambdas.LessThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than or equal to. public static bool operator >=(VolumePerLength left, VolumePerLength right) { - return left.Value >= right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThanOrEqual(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if less than. public static bool operator <(VolumePerLength left, VolumePerLength right) { - return left.Value < right.GetValueAs(left.Unit); + return CompiledLambdas.LessThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if greater than. public static bool operator >(VolumePerLength left, VolumePerLength right) { - return left.Value > right.GetValueAs(left.Unit); + return CompiledLambdas.GreaterThan(left.Value, right.GetValueAs(left.Unit)); } /// Returns true if exactly equal. @@ -492,7 +491,7 @@ public int CompareTo(object obj) /// public int CompareTo(VolumePerLength other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + return System.Collections.Generic.Comparer.Default.Compare(Value, other.GetValueAs(this.Unit)); } /// @@ -509,7 +508,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(VolumePerLength other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return Value.Equals(other.GetValueAs(this.Unit)); } /// @@ -557,10 +556,8 @@ public bool Equals(VolumePerLength other, double tolerance, ComparisonType co if(tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + var otherValueInThisUnits = other.As(this.Unit); + return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); } /// @@ -580,17 +577,17 @@ public override int GetHashCode() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(VolumePerLengthUnit unit) + public T As(VolumePerLengthUnit unit) { if(Unit == unit) - return Convert.ToDouble(Value); + return Value; var converted = GetValueAs(unit); - return Convert.ToDouble(converted); + return converted; } /// - public double As(UnitSystem unitSystem) + public T As(UnitSystem unitSystem) { if(unitSystem == null) throw new ArgumentNullException(nameof(unitSystem)); @@ -610,9 +607,14 @@ double IQuantity.As(Enum unit) if(!(unit is VolumePerLengthUnit unitAsVolumePerLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumePerLengthUnit)} is supported.", nameof(unit)); - return As(unitAsVolumePerLengthUnit); + var asValue = As(unitAsVolumePerLengthUnit); + return Convert.ToDouble(asValue); } + double IQuantity.As(UnitSystem unitSystem) => Convert.ToDouble(As(unitSystem)); + + double IQuantity.As(VolumePerLengthUnit unit) => Convert.ToDouble(As(unit)); + /// /// Converts this to another with the unit representation . /// @@ -653,21 +655,27 @@ public VolumePerLength ToUnit(UnitSystem unitSystem) /// IQuantity IQuantity.ToUnit(VolumePerLengthUnit unit) => ToUnit(unit); + /// + IQuantityT IQuantityT.ToUnit(VolumePerLengthUnit unit) => ToUnit(unit); + /// IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// + IQuantityT IQuantityT.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. /// /// The value in the base unit representation. - private double GetValueInBaseUnit() + private T GetValueInBaseUnit() { switch(Unit) { - case VolumePerLengthUnit.CubicMeterPerMeter: return _value; - case VolumePerLengthUnit.LiterPerMeter: return _value/1000; - case VolumePerLengthUnit.OilBarrelPerFoot: return _value/1.91713408; + case VolumePerLengthUnit.CubicMeterPerMeter: return Value; + case VolumePerLengthUnit.LiterPerMeter: return Value/1000; + case VolumePerLengthUnit.OilBarrelPerFoot: return Value/1.91713408; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -684,10 +692,10 @@ internal VolumePerLength ToBaseUnit() return new VolumePerLength(baseUnitValue, BaseUnit); } - private double GetValueAs(VolumePerLengthUnit unit) + private T GetValueAs(VolumePerLengthUnit unit) { if(Unit == unit) - return _value; + return Value; var baseUnitValue = GetValueInBaseUnit(); @@ -797,7 +805,7 @@ bool IConvertible.ToBoolean(IFormatProvider provider) byte IConvertible.ToByte(IFormatProvider provider) { - return Convert.ToByte(_value); + return Convert.ToByte(Value); } char IConvertible.ToChar(IFormatProvider provider) @@ -812,37 +820,37 @@ DateTime IConvertible.ToDateTime(IFormatProvider provider) decimal IConvertible.ToDecimal(IFormatProvider provider) { - return Convert.ToDecimal(_value); + return Convert.ToDecimal(Value); } double IConvertible.ToDouble(IFormatProvider provider) { - return Convert.ToDouble(_value); + return Convert.ToDouble(Value); } short IConvertible.ToInt16(IFormatProvider provider) { - return Convert.ToInt16(_value); + return Convert.ToInt16(Value); } int IConvertible.ToInt32(IFormatProvider provider) { - return Convert.ToInt32(_value); + return Convert.ToInt32(Value); } long IConvertible.ToInt64(IFormatProvider provider) { - return Convert.ToInt64(_value); + return Convert.ToInt64(Value); } sbyte IConvertible.ToSByte(IFormatProvider provider) { - return Convert.ToSByte(_value); + return Convert.ToSByte(Value); } float IConvertible.ToSingle(IFormatProvider provider) { - return Convert.ToSingle(_value); + return Convert.ToSingle(Value); } string IConvertible.ToString(IFormatProvider provider) @@ -866,17 +874,17 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) ushort IConvertible.ToUInt16(IFormatProvider provider) { - return Convert.ToUInt16(_value); + return Convert.ToUInt16(Value); } uint IConvertible.ToUInt32(IFormatProvider provider) { - return Convert.ToUInt32(_value); + return Convert.ToUInt32(Value); } ulong IConvertible.ToUInt64(IFormatProvider provider) { - return Convert.ToUInt64(_value); + return Convert.ToUInt64(Value); } #endregion diff --git a/UnitsNet/IQuantityT.cs b/UnitsNet/IQuantityT.cs new file mode 100644 index 0000000000..51e62cc836 --- /dev/null +++ b/UnitsNet/IQuantityT.cs @@ -0,0 +1,81 @@ +// Licensed under MIT No Attribution, see LICENSE file at the root. +// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. + +using System; + +namespace UnitsNet +{ + /// + /// Represents a quantity. + /// + public interface IQuantityT : IQuantity + { + /// + /// Gets the value in the given unit. + /// + /// The unit enum value. The unit must be compatible, so for you should provide a value. + /// Value converted to the specified unit. + /// Wrong unit enum type was given. + new T As( Enum unit ); + + /// + /// Gets the value in the unit determined by the given . If multiple units were found for the given , + /// the first match will be used. + /// + /// The to convert the quantity value to. + /// The converted value. + new T As( UnitSystem unitSystem ); + + /// + /// The value this quantity was constructed with. See also . + /// + new T Value { get; } + + /// + /// Converts to a quantity with the given unit representation, which affects things like . + /// + /// The unit enum value. The unit must be compatible, so for you should provide a value. + /// A new quantity with the given unit. + new IQuantityT ToUnit( Enum unit ); + + /// + /// Converts to a quantity with a unit determined by the given , which affects things like . + /// If multiple units were found for the given , the first match will be used. + /// + /// The to convert the quantity to. + /// A new quantity with the determined unit. + new IQuantityT ToUnit( UnitSystem unitSystem ); + } + + /// + /// A stronger typed interface where the unit enum type is known, to avoid passing in the + /// wrong unit enum type and not having to cast from . + /// + /// + /// IQuantity{LengthUnit} length; + /// double centimeters = length.As(LengthUnit.Centimeter); // Type safety on enum type + /// + public interface IQuantityT : IQuantity where TUnitType : Enum + { + /// + /// Convert to a unit representation . + /// + /// Value converted to the specified unit. + new T As( TUnitType unit ); + + /// + /// Converts to a quantity with the given unit representation, which affects things like . + /// + /// The unit enum value. + /// A new quantity with the given unit. + new IQuantityT ToUnit( TUnitType unit ); + + /// + /// Converts to a quantity with a unit determined by the given , which affects things like . + /// If multiple units were found for the given , the first match will be used. + /// + /// The to convert the quantity to. + /// A new quantity with the determined unit. + new IQuantityT ToUnit( UnitSystem unitSystem ); + } +} diff --git a/UnitsNet/QuantityValue.cs b/UnitsNet/QuantityValue.cs index 66ad890316..9cfea9a021 100644 --- a/UnitsNet/QuantityValue.cs +++ b/UnitsNet/QuantityValue.cs @@ -1,6 +1,7 @@ // Licensed under MIT No Attribution, see LICENSE file at the root. // Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. +using System; using UnitsNet.InternalHelpers; namespace UnitsNet @@ -92,6 +93,16 @@ public static explicit operator decimal(QuantityValue number) #endregion + /// + /// Converts the value to type T. + /// + /// The type to convert to. + /// The value as T. + public T ConvertTo() + { + return _value.HasValue ? (T)Convert.ChangeType(_value, typeof(T)) : (T)Convert.ChangeType(_valueDecimal, typeof(T)); + } + /// Returns the string representation of the numeric value. public override string ToString() { From 47d61287e767b27d5b8307dac65d6d27c2a457de Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Wed, 30 Dec 2020 01:31:02 +0100 Subject: [PATCH 11/13] Fix compile errors in number extensions --- .../UnitsNetGen/NumberExtensionsGenerator.cs | 6 +- .../NumberExtensionsTestClassGenerator.cs | 4 +- .../NumberToAccelerationExtensionsTest.g.cs | 30 +- ...mberToAmountOfSubstanceExtensionsTest.g.cs | 32 +- .../NumberToAmplitudeRatioExtensionsTest.g.cs | 10 +- .../NumberToAngleExtensionsTest.g.cs | 30 +- .../NumberToApparentEnergyExtensionsTest.g.cs | 8 +- .../NumberToApparentPowerExtensionsTest.g.cs | 10 +- .../NumberToAreaDensityExtensionsTest.g.cs | 4 +- .../NumberToAreaExtensionsTest.g.cs | 30 +- ...erToAreaMomentOfInertiaExtensionsTest.g.cs | 14 +- .../NumberToBitRateExtensionsTest.g.cs | 54 +-- ...SpecificFuelConsumptionExtensionsTest.g.cs | 8 +- .../NumberToCapacitanceExtensionsTest.g.cs | 16 +- ...cientOfThermalExpansionExtensionsTest.g.cs | 8 +- .../NumberToDensityExtensionsTest.g.cs | 82 ++--- .../NumberToDurationExtensionsTest.g.cs | 22 +- ...umberToDynamicViscosityExtensionsTest.g.cs | 22 +- ...berToElectricAdmittanceExtensionsTest.g.cs | 10 +- ...ToElectricChargeDensityExtensionsTest.g.cs | 4 +- .../NumberToElectricChargeExtensionsTest.g.cs | 12 +- ...erToElectricConductanceExtensionsTest.g.cs | 8 +- ...rToElectricConductivityExtensionsTest.g.cs | 8 +- ...oElectricCurrentDensityExtensionsTest.g.cs | 8 +- ...NumberToElectricCurrentExtensionsTest.g.cs | 18 +- ...ElectricCurrentGradientExtensionsTest.g.cs | 10 +- .../NumberToElectricFieldExtensionsTest.g.cs | 4 +- ...berToElectricInductanceExtensionsTest.g.cs | 10 +- ...erToElectricPotentialAcExtensionsTest.g.cs | 12 +- ...tricPotentialChangeRateExtensionsTest.g.cs | 42 +-- ...erToElectricPotentialDcExtensionsTest.g.cs | 12 +- ...mberToElectricPotentialExtensionsTest.g.cs | 12 +- ...berToElectricResistanceExtensionsTest.g.cs | 14 +- ...erToElectricResistivityExtensionsTest.g.cs | 30 +- ...ricSurfaceChargeDensityExtensionsTest.g.cs | 8 +- .../NumberToEnergyExtensionsTest.g.cs | 74 ++-- .../NumberToEntropyExtensionsTest.g.cs | 16 +- ...NumberToForceChangeRateExtensionsTest.g.cs | 24 +- .../NumberToForceExtensionsTest.g.cs | 32 +- .../NumberToForcePerLengthExtensionsTest.g.cs | 78 ++-- .../NumberToFrequencyExtensionsTest.g.cs | 22 +- .../NumberToFuelEfficiencyExtensionsTest.g.cs | 10 +- .../NumberToHeatFluxExtensionsTest.g.cs | 38 +- ...HeatTransferCoefficientExtensionsTest.g.cs | 8 +- .../NumberToIlluminanceExtensionsTest.g.cs | 10 +- .../NumberToInformationExtensionsTest.g.cs | 54 +-- .../NumberToIrradianceExtensionsTest.g.cs | 30 +- .../NumberToIrradiationExtensionsTest.g.cs | 16 +- ...berToKinematicViscosityExtensionsTest.g.cs | 18 +- .../NumberToLapseRateExtensionsTest.g.cs | 4 +- .../NumberToLengthExtensionsTest.g.cs | 68 ++-- .../NumberToLevelExtensionsTest.g.cs | 6 +- .../NumberToLinearDensityExtensionsTest.g.cs | 30 +- ...berToLinearPowerDensityExtensionsTest.g.cs | 52 +-- .../NumberToLuminosityExtensionsTest.g.cs | 30 +- .../NumberToLuminousFluxExtensionsTest.g.cs | 4 +- ...mberToLuminousIntensityExtensionsTest.g.cs | 4 +- .../NumberToMagneticFieldExtensionsTest.g.cs | 12 +- .../NumberToMagneticFluxExtensionsTest.g.cs | 4 +- .../NumberToMagnetizationExtensionsTest.g.cs | 4 +- ...mberToMassConcentrationExtensionsTest.g.cs | 96 ++--- .../NumberToMassExtensionsTest.g.cs | 52 +-- .../NumberToMassFlowExtensionsTest.g.cs | 68 ++-- .../NumberToMassFluxExtensionsTest.g.cs | 26 +- .../NumberToMassFractionExtensionsTest.g.cs | 50 +-- ...erToMassMomentOfInertiaExtensionsTest.g.cs | 58 +-- .../NumberToMolarEnergyExtensionsTest.g.cs | 8 +- .../NumberToMolarEntropyExtensionsTest.g.cs | 8 +- .../NumberToMolarMassExtensionsTest.g.cs | 26 +- .../NumberToMolarityExtensionsTest.g.cs | 18 +- .../NumberToPermeabilityExtensionsTest.g.cs | 4 +- .../NumberToPermittivityExtensionsTest.g.cs | 4 +- .../NumberToPowerDensityExtensionsTest.g.cs | 90 ++--- .../NumberToPowerExtensionsTest.g.cs | 52 +-- .../NumberToPowerRatioExtensionsTest.g.cs | 6 +- ...berToPressureChangeRateExtensionsTest.g.cs | 16 +- .../NumberToPressureExtensionsTest.g.cs | 86 ++--- ...NumberToRatioChangeRateExtensionsTest.g.cs | 6 +- .../NumberToRatioExtensionsTest.g.cs | 14 +- .../NumberToReactiveEnergyExtensionsTest.g.cs | 8 +- .../NumberToReactivePowerExtensionsTest.g.cs | 10 +- ...umberToRelativeHumidityExtensionsTest.g.cs | 4 +- ...oRotationalAccelerationExtensionsTest.g.cs | 10 +- ...NumberToRotationalSpeedExtensionsTest.g.cs | 28 +- ...erToRotationalStiffnessExtensionsTest.g.cs | 68 ++-- ...ionalStiffnessPerLengthExtensionsTest.g.cs | 12 +- .../NumberToSolidAngleExtensionsTest.g.cs | 4 +- .../NumberToSpecificEnergyExtensionsTest.g.cs | 52 +-- ...NumberToSpecificEntropyExtensionsTest.g.cs | 20 +- .../NumberToSpecificVolumeExtensionsTest.g.cs | 8 +- .../NumberToSpecificWeightExtensionsTest.g.cs | 36 +- .../NumberToSpeedExtensionsTest.g.cs | 66 ++-- ...ToTemperatureChangeRateExtensionsTest.g.cs | 22 +- ...umberToTemperatureDeltaExtensionsTest.g.cs | 20 +- .../NumberToTemperatureExtensionsTest.g.cs | 22 +- ...erToThermalConductivityExtensionsTest.g.cs | 6 +- ...mberToThermalResistanceExtensionsTest.g.cs | 12 +- .../NumberToTorqueExtensionsTest.g.cs | 46 +-- ...NumberToTorquePerLengthExtensionsTest.g.cs | 44 +-- .../NumberToTurbidityExtensionsTest.g.cs | 4 +- .../NumberToVitaminAExtensionsTest.g.cs | 4 +- ...erToVolumeConcentrationExtensionsTest.g.cs | 42 +-- .../NumberToVolumeExtensionsTest.g.cs | 104 +++--- .../NumberToVolumeFlowExtensionsTest.g.cs | 114 +++--- ...NumberToVolumePerLengthExtensionsTest.g.cs | 16 +- ...oWarpingMomentOfInertiaExtensionsTest.g.cs | 14 +- .../NumberToAccelerationExtensions.g.cs | 84 ++--- .../NumberToAmountOfSubstanceExtensions.g.cs | 90 ++--- .../NumberToAmplitudeRatioExtensions.g.cs | 24 +- .../NumberToAngleExtensions.g.cs | 84 ++--- .../NumberToApparentEnergyExtensions.g.cs | 18 +- .../NumberToApparentPowerExtensions.g.cs | 24 +- .../NumberToAreaDensityExtensions.g.cs | 6 +- .../GeneratedCode/NumberToAreaExtensions.g.cs | 84 ++--- ...NumberToAreaMomentOfInertiaExtensions.g.cs | 36 +- .../NumberToBitRateExtensions.g.cs | 156 ++++---- ...rakeSpecificFuelConsumptionExtensions.g.cs | 18 +- .../NumberToCapacitanceExtensions.g.cs | 42 +-- ...efficientOfThermalExpansionExtensions.g.cs | 18 +- .../NumberToDensityExtensions.g.cs | 240 ++++++------- .../NumberToDurationExtensions.g.cs | 60 ++-- .../NumberToDynamicViscosityExtensions.g.cs | 60 ++-- .../NumberToElectricAdmittanceExtensions.g.cs | 24 +- ...mberToElectricChargeDensityExtensions.g.cs | 6 +- .../NumberToElectricChargeExtensions.g.cs | 30 +- ...NumberToElectricConductanceExtensions.g.cs | 18 +- ...umberToElectricConductivityExtensions.g.cs | 18 +- ...berToElectricCurrentDensityExtensions.g.cs | 18 +- .../NumberToElectricCurrentExtensions.g.cs | 48 +-- ...erToElectricCurrentGradientExtensions.g.cs | 24 +- .../NumberToElectricFieldExtensions.g.cs | 6 +- .../NumberToElectricInductanceExtensions.g.cs | 24 +- ...NumberToElectricPotentialAcExtensions.g.cs | 30 +- ...ElectricPotentialChangeRateExtensions.g.cs | 120 +++---- ...NumberToElectricPotentialDcExtensions.g.cs | 30 +- .../NumberToElectricPotentialExtensions.g.cs | 30 +- .../NumberToElectricResistanceExtensions.g.cs | 36 +- ...NumberToElectricResistivityExtensions.g.cs | 84 ++--- ...lectricSurfaceChargeDensityExtensions.g.cs | 18 +- .../NumberToEnergyExtensions.g.cs | 216 +++++------ .../NumberToEntropyExtensions.g.cs | 42 +-- .../NumberToForceChangeRateExtensions.g.cs | 66 ++-- .../NumberToForceExtensions.g.cs | 90 ++--- .../NumberToForcePerLengthExtensions.g.cs | 228 ++++++------ .../NumberToFrequencyExtensions.g.cs | 60 ++-- .../NumberToFuelEfficiencyExtensions.g.cs | 24 +- .../NumberToHeatFluxExtensions.g.cs | 108 +++--- ...erToHeatTransferCoefficientExtensions.g.cs | 18 +- .../NumberToIlluminanceExtensions.g.cs | 24 +- .../NumberToInformationExtensions.g.cs | 156 ++++---- .../NumberToIrradianceExtensions.g.cs | 84 ++--- .../NumberToIrradiationExtensions.g.cs | 42 +-- .../NumberToKinematicViscosityExtensions.g.cs | 48 +-- .../NumberToLapseRateExtensions.g.cs | 6 +- .../NumberToLengthExtensions.g.cs | 198 +++++------ .../NumberToLevelExtensions.g.cs | 12 +- .../NumberToLinearDensityExtensions.g.cs | 84 ++--- .../NumberToLinearPowerDensityExtensions.g.cs | 150 ++++---- .../NumberToLuminosityExtensions.g.cs | 84 ++--- .../NumberToLuminousFluxExtensions.g.cs | 6 +- .../NumberToLuminousIntensityExtensions.g.cs | 6 +- .../NumberToMagneticFieldExtensions.g.cs | 30 +- .../NumberToMagneticFluxExtensions.g.cs | 6 +- .../NumberToMagnetizationExtensions.g.cs | 6 +- .../NumberToMassConcentrationExtensions.g.cs | 282 +++++++-------- .../GeneratedCode/NumberToMassExtensions.g.cs | 150 ++++---- .../NumberToMassFlowExtensions.g.cs | 198 +++++------ .../NumberToMassFluxExtensions.g.cs | 72 ++-- .../NumberToMassFractionExtensions.g.cs | 144 ++++---- ...NumberToMassMomentOfInertiaExtensions.g.cs | 168 ++++----- .../NumberToMolarEnergyExtensions.g.cs | 18 +- .../NumberToMolarEntropyExtensions.g.cs | 18 +- .../NumberToMolarMassExtensions.g.cs | 72 ++-- .../NumberToMolarityExtensions.g.cs | 48 +-- .../NumberToPermeabilityExtensions.g.cs | 6 +- .../NumberToPermittivityExtensions.g.cs | 6 +- .../NumberToPowerDensityExtensions.g.cs | 264 +++++++------- .../NumberToPowerExtensions.g.cs | 150 ++++---- .../NumberToPowerRatioExtensions.g.cs | 12 +- .../NumberToPressureChangeRateExtensions.g.cs | 42 +-- .../NumberToPressureExtensions.g.cs | 252 ++++++------- .../NumberToRatioChangeRateExtensions.g.cs | 12 +- .../NumberToRatioExtensions.g.cs | 36 +- .../NumberToReactiveEnergyExtensions.g.cs | 18 +- .../NumberToReactivePowerExtensions.g.cs | 24 +- .../NumberToRelativeHumidityExtensions.g.cs | 6 +- ...berToRotationalAccelerationExtensions.g.cs | 24 +- .../NumberToRotationalSpeedExtensions.g.cs | 78 ++-- ...NumberToRotationalStiffnessExtensions.g.cs | 198 +++++------ ...otationalStiffnessPerLengthExtensions.g.cs | 30 +- .../NumberToSolidAngleExtensions.g.cs | 6 +- .../NumberToSpecificEnergyExtensions.g.cs | 150 ++++---- .../NumberToSpecificEntropyExtensions.g.cs | 54 +-- .../NumberToSpecificVolumeExtensions.g.cs | 18 +- .../NumberToSpecificWeightExtensions.g.cs | 102 +++--- .../NumberToSpeedExtensions.g.cs | 192 +++++----- ...mberToTemperatureChangeRateExtensions.g.cs | 60 ++-- .../NumberToTemperatureDeltaExtensions.g.cs | 54 +-- .../NumberToTemperatureExtensions.g.cs | 60 ++-- ...NumberToThermalConductivityExtensions.g.cs | 12 +- .../NumberToThermalResistanceExtensions.g.cs | 30 +- .../NumberToTorqueExtensions.g.cs | 132 +++---- .../NumberToTorquePerLengthExtensions.g.cs | 126 +++---- .../NumberToTurbidityExtensions.g.cs | 6 +- .../NumberToVitaminAExtensions.g.cs | 6 +- ...NumberToVolumeConcentrationExtensions.g.cs | 120 +++---- .../NumberToVolumeExtensions.g.cs | 306 ++++++++-------- .../NumberToVolumeFlowExtensions.g.cs | 336 +++++++++--------- .../NumberToVolumePerLengthExtensions.g.cs | 42 +-- ...berToWarpingMomentOfInertiaExtensions.g.cs | 36 +- 210 files changed, 5161 insertions(+), 5161 deletions(-) diff --git a/CodeGen/Generators/UnitsNetGen/NumberExtensionsGenerator.cs b/CodeGen/Generators/UnitsNetGen/NumberExtensionsGenerator.cs index bfc73f0433..759cb4f8cd 100644 --- a/CodeGen/Generators/UnitsNetGen/NumberExtensionsGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/NumberExtensionsGenerator.cs @@ -38,12 +38,12 @@ public static class NumberTo{_quantityName}Extensions foreach (var unit in _units) { Writer.WL(2, $@" -/// "); +/// "); Writer.WLIfText(2, GetObsoleteAttributeOrNull(unit.ObsoleteText)); - Writer.WL(2, $@"public static {_quantityName} {unit.PluralName}(this T value) => - {_quantityName}.From{unit.PluralName}(Convert.ToDouble(value)); + Writer.WL(2, $@"public static {_quantityName} {unit.PluralName}(this T value) => + {_quantityName}.From{unit.PluralName}(Convert.ToDouble(value)); "); } diff --git a/CodeGen/Generators/UnitsNetGen/NumberExtensionsTestClassGenerator.cs b/CodeGen/Generators/UnitsNetGen/NumberExtensionsTestClassGenerator.cs index 6c75a8c1e4..f7a96e47f3 100644 --- a/CodeGen/Generators/UnitsNetGen/NumberExtensionsTestClassGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/NumberExtensionsTestClassGenerator.cs @@ -28,7 +28,7 @@ public override string Generate() using Xunit; namespace UnitsNet.Tests -{{ +{{ public class NumberTo{_quantityName}ExtensionsTests {{"); @@ -40,7 +40,7 @@ public class NumberTo{_quantityName}ExtensionsTests Writer.WLIfText(2, GetObsoleteAttributeOrNull(unit.ObsoleteText)); Writer.WL(2, $@"public void NumberTo{unit.PluralName}Test() => - Assert.Equal({_quantityName}.From{unit.PluralName}(2), 2.{unit.PluralName}()); + Assert.Equal({_quantityName}.From{unit.PluralName}(2), 2.{unit.PluralName}()); "); } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAccelerationExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAccelerationExtensionsTest.g.cs index e7825c4d36..0b9688f17a 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAccelerationExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAccelerationExtensionsTest.g.cs @@ -21,64 +21,64 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToAccelerationExtensionsTests { [Fact] public void NumberToCentimetersPerSecondSquaredTest() => - Assert.Equal(Acceleration.FromCentimetersPerSecondSquared(2), 2.CentimetersPerSecondSquared()); + Assert.Equal(Acceleration.FromCentimetersPerSecondSquared(2), 2.CentimetersPerSecondSquared()); [Fact] public void NumberToDecimetersPerSecondSquaredTest() => - Assert.Equal(Acceleration.FromDecimetersPerSecondSquared(2), 2.DecimetersPerSecondSquared()); + Assert.Equal(Acceleration.FromDecimetersPerSecondSquared(2), 2.DecimetersPerSecondSquared()); [Fact] public void NumberToFeetPerSecondSquaredTest() => - Assert.Equal(Acceleration.FromFeetPerSecondSquared(2), 2.FeetPerSecondSquared()); + Assert.Equal(Acceleration.FromFeetPerSecondSquared(2), 2.FeetPerSecondSquared()); [Fact] public void NumberToInchesPerSecondSquaredTest() => - Assert.Equal(Acceleration.FromInchesPerSecondSquared(2), 2.InchesPerSecondSquared()); + Assert.Equal(Acceleration.FromInchesPerSecondSquared(2), 2.InchesPerSecondSquared()); [Fact] public void NumberToKilometersPerSecondSquaredTest() => - Assert.Equal(Acceleration.FromKilometersPerSecondSquared(2), 2.KilometersPerSecondSquared()); + Assert.Equal(Acceleration.FromKilometersPerSecondSquared(2), 2.KilometersPerSecondSquared()); [Fact] public void NumberToKnotsPerHourTest() => - Assert.Equal(Acceleration.FromKnotsPerHour(2), 2.KnotsPerHour()); + Assert.Equal(Acceleration.FromKnotsPerHour(2), 2.KnotsPerHour()); [Fact] public void NumberToKnotsPerMinuteTest() => - Assert.Equal(Acceleration.FromKnotsPerMinute(2), 2.KnotsPerMinute()); + Assert.Equal(Acceleration.FromKnotsPerMinute(2), 2.KnotsPerMinute()); [Fact] public void NumberToKnotsPerSecondTest() => - Assert.Equal(Acceleration.FromKnotsPerSecond(2), 2.KnotsPerSecond()); + Assert.Equal(Acceleration.FromKnotsPerSecond(2), 2.KnotsPerSecond()); [Fact] public void NumberToMetersPerSecondSquaredTest() => - Assert.Equal(Acceleration.FromMetersPerSecondSquared(2), 2.MetersPerSecondSquared()); + Assert.Equal(Acceleration.FromMetersPerSecondSquared(2), 2.MetersPerSecondSquared()); [Fact] public void NumberToMicrometersPerSecondSquaredTest() => - Assert.Equal(Acceleration.FromMicrometersPerSecondSquared(2), 2.MicrometersPerSecondSquared()); + Assert.Equal(Acceleration.FromMicrometersPerSecondSquared(2), 2.MicrometersPerSecondSquared()); [Fact] public void NumberToMillimetersPerSecondSquaredTest() => - Assert.Equal(Acceleration.FromMillimetersPerSecondSquared(2), 2.MillimetersPerSecondSquared()); + Assert.Equal(Acceleration.FromMillimetersPerSecondSquared(2), 2.MillimetersPerSecondSquared()); [Fact] public void NumberToMillistandardGravityTest() => - Assert.Equal(Acceleration.FromMillistandardGravity(2), 2.MillistandardGravity()); + Assert.Equal(Acceleration.FromMillistandardGravity(2), 2.MillistandardGravity()); [Fact] public void NumberToNanometersPerSecondSquaredTest() => - Assert.Equal(Acceleration.FromNanometersPerSecondSquared(2), 2.NanometersPerSecondSquared()); + Assert.Equal(Acceleration.FromNanometersPerSecondSquared(2), 2.NanometersPerSecondSquared()); [Fact] public void NumberToStandardGravityTest() => - Assert.Equal(Acceleration.FromStandardGravity(2), 2.StandardGravity()); + Assert.Equal(Acceleration.FromStandardGravity(2), 2.StandardGravity()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAmountOfSubstanceExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAmountOfSubstanceExtensionsTest.g.cs index 7197c0edac..02c943929f 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAmountOfSubstanceExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAmountOfSubstanceExtensionsTest.g.cs @@ -21,68 +21,68 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToAmountOfSubstanceExtensionsTests { [Fact] public void NumberToCentimolesTest() => - Assert.Equal(AmountOfSubstance.FromCentimoles(2), 2.Centimoles()); + Assert.Equal(AmountOfSubstance.FromCentimoles(2), 2.Centimoles()); [Fact] public void NumberToCentipoundMolesTest() => - Assert.Equal(AmountOfSubstance.FromCentipoundMoles(2), 2.CentipoundMoles()); + Assert.Equal(AmountOfSubstance.FromCentipoundMoles(2), 2.CentipoundMoles()); [Fact] public void NumberToDecimolesTest() => - Assert.Equal(AmountOfSubstance.FromDecimoles(2), 2.Decimoles()); + Assert.Equal(AmountOfSubstance.FromDecimoles(2), 2.Decimoles()); [Fact] public void NumberToDecipoundMolesTest() => - Assert.Equal(AmountOfSubstance.FromDecipoundMoles(2), 2.DecipoundMoles()); + Assert.Equal(AmountOfSubstance.FromDecipoundMoles(2), 2.DecipoundMoles()); [Fact] public void NumberToKilomolesTest() => - Assert.Equal(AmountOfSubstance.FromKilomoles(2), 2.Kilomoles()); + Assert.Equal(AmountOfSubstance.FromKilomoles(2), 2.Kilomoles()); [Fact] public void NumberToKilopoundMolesTest() => - Assert.Equal(AmountOfSubstance.FromKilopoundMoles(2), 2.KilopoundMoles()); + Assert.Equal(AmountOfSubstance.FromKilopoundMoles(2), 2.KilopoundMoles()); [Fact] public void NumberToMegamolesTest() => - Assert.Equal(AmountOfSubstance.FromMegamoles(2), 2.Megamoles()); + Assert.Equal(AmountOfSubstance.FromMegamoles(2), 2.Megamoles()); [Fact] public void NumberToMicromolesTest() => - Assert.Equal(AmountOfSubstance.FromMicromoles(2), 2.Micromoles()); + Assert.Equal(AmountOfSubstance.FromMicromoles(2), 2.Micromoles()); [Fact] public void NumberToMicropoundMolesTest() => - Assert.Equal(AmountOfSubstance.FromMicropoundMoles(2), 2.MicropoundMoles()); + Assert.Equal(AmountOfSubstance.FromMicropoundMoles(2), 2.MicropoundMoles()); [Fact] public void NumberToMillimolesTest() => - Assert.Equal(AmountOfSubstance.FromMillimoles(2), 2.Millimoles()); + Assert.Equal(AmountOfSubstance.FromMillimoles(2), 2.Millimoles()); [Fact] public void NumberToMillipoundMolesTest() => - Assert.Equal(AmountOfSubstance.FromMillipoundMoles(2), 2.MillipoundMoles()); + Assert.Equal(AmountOfSubstance.FromMillipoundMoles(2), 2.MillipoundMoles()); [Fact] public void NumberToMolesTest() => - Assert.Equal(AmountOfSubstance.FromMoles(2), 2.Moles()); + Assert.Equal(AmountOfSubstance.FromMoles(2), 2.Moles()); [Fact] public void NumberToNanomolesTest() => - Assert.Equal(AmountOfSubstance.FromNanomoles(2), 2.Nanomoles()); + Assert.Equal(AmountOfSubstance.FromNanomoles(2), 2.Nanomoles()); [Fact] public void NumberToNanopoundMolesTest() => - Assert.Equal(AmountOfSubstance.FromNanopoundMoles(2), 2.NanopoundMoles()); + Assert.Equal(AmountOfSubstance.FromNanopoundMoles(2), 2.NanopoundMoles()); [Fact] public void NumberToPoundMolesTest() => - Assert.Equal(AmountOfSubstance.FromPoundMoles(2), 2.PoundMoles()); + Assert.Equal(AmountOfSubstance.FromPoundMoles(2), 2.PoundMoles()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAmplitudeRatioExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAmplitudeRatioExtensionsTest.g.cs index 33b41517be..a2f6325bb1 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAmplitudeRatioExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAmplitudeRatioExtensionsTest.g.cs @@ -21,24 +21,24 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToAmplitudeRatioExtensionsTests { [Fact] public void NumberToDecibelMicrovoltsTest() => - Assert.Equal(AmplitudeRatio.FromDecibelMicrovolts(2), 2.DecibelMicrovolts()); + Assert.Equal(AmplitudeRatio.FromDecibelMicrovolts(2), 2.DecibelMicrovolts()); [Fact] public void NumberToDecibelMillivoltsTest() => - Assert.Equal(AmplitudeRatio.FromDecibelMillivolts(2), 2.DecibelMillivolts()); + Assert.Equal(AmplitudeRatio.FromDecibelMillivolts(2), 2.DecibelMillivolts()); [Fact] public void NumberToDecibelsUnloadedTest() => - Assert.Equal(AmplitudeRatio.FromDecibelsUnloaded(2), 2.DecibelsUnloaded()); + Assert.Equal(AmplitudeRatio.FromDecibelsUnloaded(2), 2.DecibelsUnloaded()); [Fact] public void NumberToDecibelVoltsTest() => - Assert.Equal(AmplitudeRatio.FromDecibelVolts(2), 2.DecibelVolts()); + Assert.Equal(AmplitudeRatio.FromDecibelVolts(2), 2.DecibelVolts()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAngleExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAngleExtensionsTest.g.cs index 9d34cc85c0..78a0e1bbb6 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAngleExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAngleExtensionsTest.g.cs @@ -21,64 +21,64 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToAngleExtensionsTests { [Fact] public void NumberToArcminutesTest() => - Assert.Equal(Angle.FromArcminutes(2), 2.Arcminutes()); + Assert.Equal(Angle.FromArcminutes(2), 2.Arcminutes()); [Fact] public void NumberToArcsecondsTest() => - Assert.Equal(Angle.FromArcseconds(2), 2.Arcseconds()); + Assert.Equal(Angle.FromArcseconds(2), 2.Arcseconds()); [Fact] public void NumberToCentiradiansTest() => - Assert.Equal(Angle.FromCentiradians(2), 2.Centiradians()); + Assert.Equal(Angle.FromCentiradians(2), 2.Centiradians()); [Fact] public void NumberToDeciradiansTest() => - Assert.Equal(Angle.FromDeciradians(2), 2.Deciradians()); + Assert.Equal(Angle.FromDeciradians(2), 2.Deciradians()); [Fact] public void NumberToDegreesTest() => - Assert.Equal(Angle.FromDegrees(2), 2.Degrees()); + Assert.Equal(Angle.FromDegrees(2), 2.Degrees()); [Fact] public void NumberToGradiansTest() => - Assert.Equal(Angle.FromGradians(2), 2.Gradians()); + Assert.Equal(Angle.FromGradians(2), 2.Gradians()); [Fact] public void NumberToMicrodegreesTest() => - Assert.Equal(Angle.FromMicrodegrees(2), 2.Microdegrees()); + Assert.Equal(Angle.FromMicrodegrees(2), 2.Microdegrees()); [Fact] public void NumberToMicroradiansTest() => - Assert.Equal(Angle.FromMicroradians(2), 2.Microradians()); + Assert.Equal(Angle.FromMicroradians(2), 2.Microradians()); [Fact] public void NumberToMillidegreesTest() => - Assert.Equal(Angle.FromMillidegrees(2), 2.Millidegrees()); + Assert.Equal(Angle.FromMillidegrees(2), 2.Millidegrees()); [Fact] public void NumberToMilliradiansTest() => - Assert.Equal(Angle.FromMilliradians(2), 2.Milliradians()); + Assert.Equal(Angle.FromMilliradians(2), 2.Milliradians()); [Fact] public void NumberToNanodegreesTest() => - Assert.Equal(Angle.FromNanodegrees(2), 2.Nanodegrees()); + Assert.Equal(Angle.FromNanodegrees(2), 2.Nanodegrees()); [Fact] public void NumberToNanoradiansTest() => - Assert.Equal(Angle.FromNanoradians(2), 2.Nanoradians()); + Assert.Equal(Angle.FromNanoradians(2), 2.Nanoradians()); [Fact] public void NumberToRadiansTest() => - Assert.Equal(Angle.FromRadians(2), 2.Radians()); + Assert.Equal(Angle.FromRadians(2), 2.Radians()); [Fact] public void NumberToRevolutionsTest() => - Assert.Equal(Angle.FromRevolutions(2), 2.Revolutions()); + Assert.Equal(Angle.FromRevolutions(2), 2.Revolutions()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToApparentEnergyExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToApparentEnergyExtensionsTest.g.cs index 218daac837..cea943d671 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToApparentEnergyExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToApparentEnergyExtensionsTest.g.cs @@ -21,20 +21,20 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToApparentEnergyExtensionsTests { [Fact] public void NumberToKilovoltampereHoursTest() => - Assert.Equal(ApparentEnergy.FromKilovoltampereHours(2), 2.KilovoltampereHours()); + Assert.Equal(ApparentEnergy.FromKilovoltampereHours(2), 2.KilovoltampereHours()); [Fact] public void NumberToMegavoltampereHoursTest() => - Assert.Equal(ApparentEnergy.FromMegavoltampereHours(2), 2.MegavoltampereHours()); + Assert.Equal(ApparentEnergy.FromMegavoltampereHours(2), 2.MegavoltampereHours()); [Fact] public void NumberToVoltampereHoursTest() => - Assert.Equal(ApparentEnergy.FromVoltampereHours(2), 2.VoltampereHours()); + Assert.Equal(ApparentEnergy.FromVoltampereHours(2), 2.VoltampereHours()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToApparentPowerExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToApparentPowerExtensionsTest.g.cs index c7855d37da..736989efc4 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToApparentPowerExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToApparentPowerExtensionsTest.g.cs @@ -21,24 +21,24 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToApparentPowerExtensionsTests { [Fact] public void NumberToGigavoltamperesTest() => - Assert.Equal(ApparentPower.FromGigavoltamperes(2), 2.Gigavoltamperes()); + Assert.Equal(ApparentPower.FromGigavoltamperes(2), 2.Gigavoltamperes()); [Fact] public void NumberToKilovoltamperesTest() => - Assert.Equal(ApparentPower.FromKilovoltamperes(2), 2.Kilovoltamperes()); + Assert.Equal(ApparentPower.FromKilovoltamperes(2), 2.Kilovoltamperes()); [Fact] public void NumberToMegavoltamperesTest() => - Assert.Equal(ApparentPower.FromMegavoltamperes(2), 2.Megavoltamperes()); + Assert.Equal(ApparentPower.FromMegavoltamperes(2), 2.Megavoltamperes()); [Fact] public void NumberToVoltamperesTest() => - Assert.Equal(ApparentPower.FromVoltamperes(2), 2.Voltamperes()); + Assert.Equal(ApparentPower.FromVoltamperes(2), 2.Voltamperes()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAreaDensityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAreaDensityExtensionsTest.g.cs index e5f721ddc0..d78fd1895e 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAreaDensityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAreaDensityExtensionsTest.g.cs @@ -21,12 +21,12 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToAreaDensityExtensionsTests { [Fact] public void NumberToKilogramsPerSquareMeterTest() => - Assert.Equal(AreaDensity.FromKilogramsPerSquareMeter(2), 2.KilogramsPerSquareMeter()); + Assert.Equal(AreaDensity.FromKilogramsPerSquareMeter(2), 2.KilogramsPerSquareMeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAreaExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAreaExtensionsTest.g.cs index 4f35ec9d41..7e1c193dbf 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAreaExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAreaExtensionsTest.g.cs @@ -21,64 +21,64 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToAreaExtensionsTests { [Fact] public void NumberToAcresTest() => - Assert.Equal(Area.FromAcres(2), 2.Acres()); + Assert.Equal(Area.FromAcres(2), 2.Acres()); [Fact] public void NumberToHectaresTest() => - Assert.Equal(Area.FromHectares(2), 2.Hectares()); + Assert.Equal(Area.FromHectares(2), 2.Hectares()); [Fact] public void NumberToSquareCentimetersTest() => - Assert.Equal(Area.FromSquareCentimeters(2), 2.SquareCentimeters()); + Assert.Equal(Area.FromSquareCentimeters(2), 2.SquareCentimeters()); [Fact] public void NumberToSquareDecimetersTest() => - Assert.Equal(Area.FromSquareDecimeters(2), 2.SquareDecimeters()); + Assert.Equal(Area.FromSquareDecimeters(2), 2.SquareDecimeters()); [Fact] public void NumberToSquareFeetTest() => - Assert.Equal(Area.FromSquareFeet(2), 2.SquareFeet()); + Assert.Equal(Area.FromSquareFeet(2), 2.SquareFeet()); [Fact] public void NumberToSquareInchesTest() => - Assert.Equal(Area.FromSquareInches(2), 2.SquareInches()); + Assert.Equal(Area.FromSquareInches(2), 2.SquareInches()); [Fact] public void NumberToSquareKilometersTest() => - Assert.Equal(Area.FromSquareKilometers(2), 2.SquareKilometers()); + Assert.Equal(Area.FromSquareKilometers(2), 2.SquareKilometers()); [Fact] public void NumberToSquareMetersTest() => - Assert.Equal(Area.FromSquareMeters(2), 2.SquareMeters()); + Assert.Equal(Area.FromSquareMeters(2), 2.SquareMeters()); [Fact] public void NumberToSquareMicrometersTest() => - Assert.Equal(Area.FromSquareMicrometers(2), 2.SquareMicrometers()); + Assert.Equal(Area.FromSquareMicrometers(2), 2.SquareMicrometers()); [Fact] public void NumberToSquareMilesTest() => - Assert.Equal(Area.FromSquareMiles(2), 2.SquareMiles()); + Assert.Equal(Area.FromSquareMiles(2), 2.SquareMiles()); [Fact] public void NumberToSquareMillimetersTest() => - Assert.Equal(Area.FromSquareMillimeters(2), 2.SquareMillimeters()); + Assert.Equal(Area.FromSquareMillimeters(2), 2.SquareMillimeters()); [Fact] public void NumberToSquareNauticalMilesTest() => - Assert.Equal(Area.FromSquareNauticalMiles(2), 2.SquareNauticalMiles()); + Assert.Equal(Area.FromSquareNauticalMiles(2), 2.SquareNauticalMiles()); [Fact] public void NumberToSquareYardsTest() => - Assert.Equal(Area.FromSquareYards(2), 2.SquareYards()); + Assert.Equal(Area.FromSquareYards(2), 2.SquareYards()); [Fact] public void NumberToUsSurveySquareFeetTest() => - Assert.Equal(Area.FromUsSurveySquareFeet(2), 2.UsSurveySquareFeet()); + Assert.Equal(Area.FromUsSurveySquareFeet(2), 2.UsSurveySquareFeet()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAreaMomentOfInertiaExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAreaMomentOfInertiaExtensionsTest.g.cs index 217dc33c30..52e32526d3 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAreaMomentOfInertiaExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAreaMomentOfInertiaExtensionsTest.g.cs @@ -21,32 +21,32 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToAreaMomentOfInertiaExtensionsTests { [Fact] public void NumberToCentimetersToTheFourthTest() => - Assert.Equal(AreaMomentOfInertia.FromCentimetersToTheFourth(2), 2.CentimetersToTheFourth()); + Assert.Equal(AreaMomentOfInertia.FromCentimetersToTheFourth(2), 2.CentimetersToTheFourth()); [Fact] public void NumberToDecimetersToTheFourthTest() => - Assert.Equal(AreaMomentOfInertia.FromDecimetersToTheFourth(2), 2.DecimetersToTheFourth()); + Assert.Equal(AreaMomentOfInertia.FromDecimetersToTheFourth(2), 2.DecimetersToTheFourth()); [Fact] public void NumberToFeetToTheFourthTest() => - Assert.Equal(AreaMomentOfInertia.FromFeetToTheFourth(2), 2.FeetToTheFourth()); + Assert.Equal(AreaMomentOfInertia.FromFeetToTheFourth(2), 2.FeetToTheFourth()); [Fact] public void NumberToInchesToTheFourthTest() => - Assert.Equal(AreaMomentOfInertia.FromInchesToTheFourth(2), 2.InchesToTheFourth()); + Assert.Equal(AreaMomentOfInertia.FromInchesToTheFourth(2), 2.InchesToTheFourth()); [Fact] public void NumberToMetersToTheFourthTest() => - Assert.Equal(AreaMomentOfInertia.FromMetersToTheFourth(2), 2.MetersToTheFourth()); + Assert.Equal(AreaMomentOfInertia.FromMetersToTheFourth(2), 2.MetersToTheFourth()); [Fact] public void NumberToMillimetersToTheFourthTest() => - Assert.Equal(AreaMomentOfInertia.FromMillimetersToTheFourth(2), 2.MillimetersToTheFourth()); + Assert.Equal(AreaMomentOfInertia.FromMillimetersToTheFourth(2), 2.MillimetersToTheFourth()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToBitRateExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToBitRateExtensionsTest.g.cs index 46afbcae68..dae2842870 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToBitRateExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToBitRateExtensionsTest.g.cs @@ -21,112 +21,112 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToBitRateExtensionsTests { [Fact] public void NumberToBitsPerSecondTest() => - Assert.Equal(BitRate.FromBitsPerSecond(2), 2.BitsPerSecond()); + Assert.Equal(BitRate.FromBitsPerSecond(2), 2.BitsPerSecond()); [Fact] public void NumberToBytesPerSecondTest() => - Assert.Equal(BitRate.FromBytesPerSecond(2), 2.BytesPerSecond()); + Assert.Equal(BitRate.FromBytesPerSecond(2), 2.BytesPerSecond()); [Fact] public void NumberToExabitsPerSecondTest() => - Assert.Equal(BitRate.FromExabitsPerSecond(2), 2.ExabitsPerSecond()); + Assert.Equal(BitRate.FromExabitsPerSecond(2), 2.ExabitsPerSecond()); [Fact] public void NumberToExabytesPerSecondTest() => - Assert.Equal(BitRate.FromExabytesPerSecond(2), 2.ExabytesPerSecond()); + Assert.Equal(BitRate.FromExabytesPerSecond(2), 2.ExabytesPerSecond()); [Fact] public void NumberToExbibitsPerSecondTest() => - Assert.Equal(BitRate.FromExbibitsPerSecond(2), 2.ExbibitsPerSecond()); + Assert.Equal(BitRate.FromExbibitsPerSecond(2), 2.ExbibitsPerSecond()); [Fact] public void NumberToExbibytesPerSecondTest() => - Assert.Equal(BitRate.FromExbibytesPerSecond(2), 2.ExbibytesPerSecond()); + Assert.Equal(BitRate.FromExbibytesPerSecond(2), 2.ExbibytesPerSecond()); [Fact] public void NumberToGibibitsPerSecondTest() => - Assert.Equal(BitRate.FromGibibitsPerSecond(2), 2.GibibitsPerSecond()); + Assert.Equal(BitRate.FromGibibitsPerSecond(2), 2.GibibitsPerSecond()); [Fact] public void NumberToGibibytesPerSecondTest() => - Assert.Equal(BitRate.FromGibibytesPerSecond(2), 2.GibibytesPerSecond()); + Assert.Equal(BitRate.FromGibibytesPerSecond(2), 2.GibibytesPerSecond()); [Fact] public void NumberToGigabitsPerSecondTest() => - Assert.Equal(BitRate.FromGigabitsPerSecond(2), 2.GigabitsPerSecond()); + Assert.Equal(BitRate.FromGigabitsPerSecond(2), 2.GigabitsPerSecond()); [Fact] public void NumberToGigabytesPerSecondTest() => - Assert.Equal(BitRate.FromGigabytesPerSecond(2), 2.GigabytesPerSecond()); + Assert.Equal(BitRate.FromGigabytesPerSecond(2), 2.GigabytesPerSecond()); [Fact] public void NumberToKibibitsPerSecondTest() => - Assert.Equal(BitRate.FromKibibitsPerSecond(2), 2.KibibitsPerSecond()); + Assert.Equal(BitRate.FromKibibitsPerSecond(2), 2.KibibitsPerSecond()); [Fact] public void NumberToKibibytesPerSecondTest() => - Assert.Equal(BitRate.FromKibibytesPerSecond(2), 2.KibibytesPerSecond()); + Assert.Equal(BitRate.FromKibibytesPerSecond(2), 2.KibibytesPerSecond()); [Fact] public void NumberToKilobitsPerSecondTest() => - Assert.Equal(BitRate.FromKilobitsPerSecond(2), 2.KilobitsPerSecond()); + Assert.Equal(BitRate.FromKilobitsPerSecond(2), 2.KilobitsPerSecond()); [Fact] public void NumberToKilobytesPerSecondTest() => - Assert.Equal(BitRate.FromKilobytesPerSecond(2), 2.KilobytesPerSecond()); + Assert.Equal(BitRate.FromKilobytesPerSecond(2), 2.KilobytesPerSecond()); [Fact] public void NumberToMebibitsPerSecondTest() => - Assert.Equal(BitRate.FromMebibitsPerSecond(2), 2.MebibitsPerSecond()); + Assert.Equal(BitRate.FromMebibitsPerSecond(2), 2.MebibitsPerSecond()); [Fact] public void NumberToMebibytesPerSecondTest() => - Assert.Equal(BitRate.FromMebibytesPerSecond(2), 2.MebibytesPerSecond()); + Assert.Equal(BitRate.FromMebibytesPerSecond(2), 2.MebibytesPerSecond()); [Fact] public void NumberToMegabitsPerSecondTest() => - Assert.Equal(BitRate.FromMegabitsPerSecond(2), 2.MegabitsPerSecond()); + Assert.Equal(BitRate.FromMegabitsPerSecond(2), 2.MegabitsPerSecond()); [Fact] public void NumberToMegabytesPerSecondTest() => - Assert.Equal(BitRate.FromMegabytesPerSecond(2), 2.MegabytesPerSecond()); + Assert.Equal(BitRate.FromMegabytesPerSecond(2), 2.MegabytesPerSecond()); [Fact] public void NumberToPebibitsPerSecondTest() => - Assert.Equal(BitRate.FromPebibitsPerSecond(2), 2.PebibitsPerSecond()); + Assert.Equal(BitRate.FromPebibitsPerSecond(2), 2.PebibitsPerSecond()); [Fact] public void NumberToPebibytesPerSecondTest() => - Assert.Equal(BitRate.FromPebibytesPerSecond(2), 2.PebibytesPerSecond()); + Assert.Equal(BitRate.FromPebibytesPerSecond(2), 2.PebibytesPerSecond()); [Fact] public void NumberToPetabitsPerSecondTest() => - Assert.Equal(BitRate.FromPetabitsPerSecond(2), 2.PetabitsPerSecond()); + Assert.Equal(BitRate.FromPetabitsPerSecond(2), 2.PetabitsPerSecond()); [Fact] public void NumberToPetabytesPerSecondTest() => - Assert.Equal(BitRate.FromPetabytesPerSecond(2), 2.PetabytesPerSecond()); + Assert.Equal(BitRate.FromPetabytesPerSecond(2), 2.PetabytesPerSecond()); [Fact] public void NumberToTebibitsPerSecondTest() => - Assert.Equal(BitRate.FromTebibitsPerSecond(2), 2.TebibitsPerSecond()); + Assert.Equal(BitRate.FromTebibitsPerSecond(2), 2.TebibitsPerSecond()); [Fact] public void NumberToTebibytesPerSecondTest() => - Assert.Equal(BitRate.FromTebibytesPerSecond(2), 2.TebibytesPerSecond()); + Assert.Equal(BitRate.FromTebibytesPerSecond(2), 2.TebibytesPerSecond()); [Fact] public void NumberToTerabitsPerSecondTest() => - Assert.Equal(BitRate.FromTerabitsPerSecond(2), 2.TerabitsPerSecond()); + Assert.Equal(BitRate.FromTerabitsPerSecond(2), 2.TerabitsPerSecond()); [Fact] public void NumberToTerabytesPerSecondTest() => - Assert.Equal(BitRate.FromTerabytesPerSecond(2), 2.TerabytesPerSecond()); + Assert.Equal(BitRate.FromTerabytesPerSecond(2), 2.TerabytesPerSecond()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToBrakeSpecificFuelConsumptionExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToBrakeSpecificFuelConsumptionExtensionsTest.g.cs index 3d229d9f32..24db5d5d76 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToBrakeSpecificFuelConsumptionExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToBrakeSpecificFuelConsumptionExtensionsTest.g.cs @@ -21,20 +21,20 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToBrakeSpecificFuelConsumptionExtensionsTests { [Fact] public void NumberToGramsPerKiloWattHourTest() => - Assert.Equal(BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(2), 2.GramsPerKiloWattHour()); + Assert.Equal(BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(2), 2.GramsPerKiloWattHour()); [Fact] public void NumberToKilogramsPerJouleTest() => - Assert.Equal(BrakeSpecificFuelConsumption.FromKilogramsPerJoule(2), 2.KilogramsPerJoule()); + Assert.Equal(BrakeSpecificFuelConsumption.FromKilogramsPerJoule(2), 2.KilogramsPerJoule()); [Fact] public void NumberToPoundsPerMechanicalHorsepowerHourTest() => - Assert.Equal(BrakeSpecificFuelConsumption.FromPoundsPerMechanicalHorsepowerHour(2), 2.PoundsPerMechanicalHorsepowerHour()); + Assert.Equal(BrakeSpecificFuelConsumption.FromPoundsPerMechanicalHorsepowerHour(2), 2.PoundsPerMechanicalHorsepowerHour()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToCapacitanceExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToCapacitanceExtensionsTest.g.cs index 5fb028ebfd..138ed16f70 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToCapacitanceExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToCapacitanceExtensionsTest.g.cs @@ -21,36 +21,36 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToCapacitanceExtensionsTests { [Fact] public void NumberToFaradsTest() => - Assert.Equal(Capacitance.FromFarads(2), 2.Farads()); + Assert.Equal(Capacitance.FromFarads(2), 2.Farads()); [Fact] public void NumberToKilofaradsTest() => - Assert.Equal(Capacitance.FromKilofarads(2), 2.Kilofarads()); + Assert.Equal(Capacitance.FromKilofarads(2), 2.Kilofarads()); [Fact] public void NumberToMegafaradsTest() => - Assert.Equal(Capacitance.FromMegafarads(2), 2.Megafarads()); + Assert.Equal(Capacitance.FromMegafarads(2), 2.Megafarads()); [Fact] public void NumberToMicrofaradsTest() => - Assert.Equal(Capacitance.FromMicrofarads(2), 2.Microfarads()); + Assert.Equal(Capacitance.FromMicrofarads(2), 2.Microfarads()); [Fact] public void NumberToMillifaradsTest() => - Assert.Equal(Capacitance.FromMillifarads(2), 2.Millifarads()); + Assert.Equal(Capacitance.FromMillifarads(2), 2.Millifarads()); [Fact] public void NumberToNanofaradsTest() => - Assert.Equal(Capacitance.FromNanofarads(2), 2.Nanofarads()); + Assert.Equal(Capacitance.FromNanofarads(2), 2.Nanofarads()); [Fact] public void NumberToPicofaradsTest() => - Assert.Equal(Capacitance.FromPicofarads(2), 2.Picofarads()); + Assert.Equal(Capacitance.FromPicofarads(2), 2.Picofarads()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToCoefficientOfThermalExpansionExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToCoefficientOfThermalExpansionExtensionsTest.g.cs index fa1a8d2a47..5068c53ce9 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToCoefficientOfThermalExpansionExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToCoefficientOfThermalExpansionExtensionsTest.g.cs @@ -21,20 +21,20 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToCoefficientOfThermalExpansionExtensionsTests { [Fact] public void NumberToInverseDegreeCelsiusTest() => - Assert.Equal(CoefficientOfThermalExpansion.FromInverseDegreeCelsius(2), 2.InverseDegreeCelsius()); + Assert.Equal(CoefficientOfThermalExpansion.FromInverseDegreeCelsius(2), 2.InverseDegreeCelsius()); [Fact] public void NumberToInverseDegreeFahrenheitTest() => - Assert.Equal(CoefficientOfThermalExpansion.FromInverseDegreeFahrenheit(2), 2.InverseDegreeFahrenheit()); + Assert.Equal(CoefficientOfThermalExpansion.FromInverseDegreeFahrenheit(2), 2.InverseDegreeFahrenheit()); [Fact] public void NumberToInverseKelvinTest() => - Assert.Equal(CoefficientOfThermalExpansion.FromInverseKelvin(2), 2.InverseKelvin()); + Assert.Equal(CoefficientOfThermalExpansion.FromInverseKelvin(2), 2.InverseKelvin()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDensityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDensityExtensionsTest.g.cs index 59f917e45e..50697c067c 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDensityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDensityExtensionsTest.g.cs @@ -21,168 +21,168 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToDensityExtensionsTests { [Fact] public void NumberToCentigramsPerDeciLiterTest() => - Assert.Equal(Density.FromCentigramsPerDeciLiter(2), 2.CentigramsPerDeciLiter()); + Assert.Equal(Density.FromCentigramsPerDeciLiter(2), 2.CentigramsPerDeciLiter()); [Fact] public void NumberToCentigramsPerLiterTest() => - Assert.Equal(Density.FromCentigramsPerLiter(2), 2.CentigramsPerLiter()); + Assert.Equal(Density.FromCentigramsPerLiter(2), 2.CentigramsPerLiter()); [Fact] public void NumberToCentigramsPerMilliliterTest() => - Assert.Equal(Density.FromCentigramsPerMilliliter(2), 2.CentigramsPerMilliliter()); + Assert.Equal(Density.FromCentigramsPerMilliliter(2), 2.CentigramsPerMilliliter()); [Fact] public void NumberToDecigramsPerDeciLiterTest() => - Assert.Equal(Density.FromDecigramsPerDeciLiter(2), 2.DecigramsPerDeciLiter()); + Assert.Equal(Density.FromDecigramsPerDeciLiter(2), 2.DecigramsPerDeciLiter()); [Fact] public void NumberToDecigramsPerLiterTest() => - Assert.Equal(Density.FromDecigramsPerLiter(2), 2.DecigramsPerLiter()); + Assert.Equal(Density.FromDecigramsPerLiter(2), 2.DecigramsPerLiter()); [Fact] public void NumberToDecigramsPerMilliliterTest() => - Assert.Equal(Density.FromDecigramsPerMilliliter(2), 2.DecigramsPerMilliliter()); + Assert.Equal(Density.FromDecigramsPerMilliliter(2), 2.DecigramsPerMilliliter()); [Fact] public void NumberToGramsPerCubicCentimeterTest() => - Assert.Equal(Density.FromGramsPerCubicCentimeter(2), 2.GramsPerCubicCentimeter()); + Assert.Equal(Density.FromGramsPerCubicCentimeter(2), 2.GramsPerCubicCentimeter()); [Fact] public void NumberToGramsPerCubicMeterTest() => - Assert.Equal(Density.FromGramsPerCubicMeter(2), 2.GramsPerCubicMeter()); + Assert.Equal(Density.FromGramsPerCubicMeter(2), 2.GramsPerCubicMeter()); [Fact] public void NumberToGramsPerCubicMillimeterTest() => - Assert.Equal(Density.FromGramsPerCubicMillimeter(2), 2.GramsPerCubicMillimeter()); + Assert.Equal(Density.FromGramsPerCubicMillimeter(2), 2.GramsPerCubicMillimeter()); [Fact] public void NumberToGramsPerDeciLiterTest() => - Assert.Equal(Density.FromGramsPerDeciLiter(2), 2.GramsPerDeciLiter()); + Assert.Equal(Density.FromGramsPerDeciLiter(2), 2.GramsPerDeciLiter()); [Fact] public void NumberToGramsPerLiterTest() => - Assert.Equal(Density.FromGramsPerLiter(2), 2.GramsPerLiter()); + Assert.Equal(Density.FromGramsPerLiter(2), 2.GramsPerLiter()); [Fact] public void NumberToGramsPerMilliliterTest() => - Assert.Equal(Density.FromGramsPerMilliliter(2), 2.GramsPerMilliliter()); + Assert.Equal(Density.FromGramsPerMilliliter(2), 2.GramsPerMilliliter()); [Fact] public void NumberToKilogramsPerCubicCentimeterTest() => - Assert.Equal(Density.FromKilogramsPerCubicCentimeter(2), 2.KilogramsPerCubicCentimeter()); + Assert.Equal(Density.FromKilogramsPerCubicCentimeter(2), 2.KilogramsPerCubicCentimeter()); [Fact] public void NumberToKilogramsPerCubicMeterTest() => - Assert.Equal(Density.FromKilogramsPerCubicMeter(2), 2.KilogramsPerCubicMeter()); + Assert.Equal(Density.FromKilogramsPerCubicMeter(2), 2.KilogramsPerCubicMeter()); [Fact] public void NumberToKilogramsPerCubicMillimeterTest() => - Assert.Equal(Density.FromKilogramsPerCubicMillimeter(2), 2.KilogramsPerCubicMillimeter()); + Assert.Equal(Density.FromKilogramsPerCubicMillimeter(2), 2.KilogramsPerCubicMillimeter()); [Fact] public void NumberToKilogramsPerLiterTest() => - Assert.Equal(Density.FromKilogramsPerLiter(2), 2.KilogramsPerLiter()); + Assert.Equal(Density.FromKilogramsPerLiter(2), 2.KilogramsPerLiter()); [Fact] public void NumberToKilopoundsPerCubicFootTest() => - Assert.Equal(Density.FromKilopoundsPerCubicFoot(2), 2.KilopoundsPerCubicFoot()); + Assert.Equal(Density.FromKilopoundsPerCubicFoot(2), 2.KilopoundsPerCubicFoot()); [Fact] public void NumberToKilopoundsPerCubicInchTest() => - Assert.Equal(Density.FromKilopoundsPerCubicInch(2), 2.KilopoundsPerCubicInch()); + Assert.Equal(Density.FromKilopoundsPerCubicInch(2), 2.KilopoundsPerCubicInch()); [Fact] public void NumberToMicrogramsPerCubicMeterTest() => - Assert.Equal(Density.FromMicrogramsPerCubicMeter(2), 2.MicrogramsPerCubicMeter()); + Assert.Equal(Density.FromMicrogramsPerCubicMeter(2), 2.MicrogramsPerCubicMeter()); [Fact] public void NumberToMicrogramsPerDeciLiterTest() => - Assert.Equal(Density.FromMicrogramsPerDeciLiter(2), 2.MicrogramsPerDeciLiter()); + Assert.Equal(Density.FromMicrogramsPerDeciLiter(2), 2.MicrogramsPerDeciLiter()); [Fact] public void NumberToMicrogramsPerLiterTest() => - Assert.Equal(Density.FromMicrogramsPerLiter(2), 2.MicrogramsPerLiter()); + Assert.Equal(Density.FromMicrogramsPerLiter(2), 2.MicrogramsPerLiter()); [Fact] public void NumberToMicrogramsPerMilliliterTest() => - Assert.Equal(Density.FromMicrogramsPerMilliliter(2), 2.MicrogramsPerMilliliter()); + Assert.Equal(Density.FromMicrogramsPerMilliliter(2), 2.MicrogramsPerMilliliter()); [Fact] public void NumberToMilligramsPerCubicMeterTest() => - Assert.Equal(Density.FromMilligramsPerCubicMeter(2), 2.MilligramsPerCubicMeter()); + Assert.Equal(Density.FromMilligramsPerCubicMeter(2), 2.MilligramsPerCubicMeter()); [Fact] public void NumberToMilligramsPerDeciLiterTest() => - Assert.Equal(Density.FromMilligramsPerDeciLiter(2), 2.MilligramsPerDeciLiter()); + Assert.Equal(Density.FromMilligramsPerDeciLiter(2), 2.MilligramsPerDeciLiter()); [Fact] public void NumberToMilligramsPerLiterTest() => - Assert.Equal(Density.FromMilligramsPerLiter(2), 2.MilligramsPerLiter()); + Assert.Equal(Density.FromMilligramsPerLiter(2), 2.MilligramsPerLiter()); [Fact] public void NumberToMilligramsPerMilliliterTest() => - Assert.Equal(Density.FromMilligramsPerMilliliter(2), 2.MilligramsPerMilliliter()); + Assert.Equal(Density.FromMilligramsPerMilliliter(2), 2.MilligramsPerMilliliter()); [Fact] public void NumberToNanogramsPerDeciLiterTest() => - Assert.Equal(Density.FromNanogramsPerDeciLiter(2), 2.NanogramsPerDeciLiter()); + Assert.Equal(Density.FromNanogramsPerDeciLiter(2), 2.NanogramsPerDeciLiter()); [Fact] public void NumberToNanogramsPerLiterTest() => - Assert.Equal(Density.FromNanogramsPerLiter(2), 2.NanogramsPerLiter()); + Assert.Equal(Density.FromNanogramsPerLiter(2), 2.NanogramsPerLiter()); [Fact] public void NumberToNanogramsPerMilliliterTest() => - Assert.Equal(Density.FromNanogramsPerMilliliter(2), 2.NanogramsPerMilliliter()); + Assert.Equal(Density.FromNanogramsPerMilliliter(2), 2.NanogramsPerMilliliter()); [Fact] public void NumberToPicogramsPerDeciLiterTest() => - Assert.Equal(Density.FromPicogramsPerDeciLiter(2), 2.PicogramsPerDeciLiter()); + Assert.Equal(Density.FromPicogramsPerDeciLiter(2), 2.PicogramsPerDeciLiter()); [Fact] public void NumberToPicogramsPerLiterTest() => - Assert.Equal(Density.FromPicogramsPerLiter(2), 2.PicogramsPerLiter()); + Assert.Equal(Density.FromPicogramsPerLiter(2), 2.PicogramsPerLiter()); [Fact] public void NumberToPicogramsPerMilliliterTest() => - Assert.Equal(Density.FromPicogramsPerMilliliter(2), 2.PicogramsPerMilliliter()); + Assert.Equal(Density.FromPicogramsPerMilliliter(2), 2.PicogramsPerMilliliter()); [Fact] public void NumberToPoundsPerCubicFootTest() => - Assert.Equal(Density.FromPoundsPerCubicFoot(2), 2.PoundsPerCubicFoot()); + Assert.Equal(Density.FromPoundsPerCubicFoot(2), 2.PoundsPerCubicFoot()); [Fact] public void NumberToPoundsPerCubicInchTest() => - Assert.Equal(Density.FromPoundsPerCubicInch(2), 2.PoundsPerCubicInch()); + Assert.Equal(Density.FromPoundsPerCubicInch(2), 2.PoundsPerCubicInch()); [Fact] public void NumberToPoundsPerImperialGallonTest() => - Assert.Equal(Density.FromPoundsPerImperialGallon(2), 2.PoundsPerImperialGallon()); + Assert.Equal(Density.FromPoundsPerImperialGallon(2), 2.PoundsPerImperialGallon()); [Fact] public void NumberToPoundsPerUSGallonTest() => - Assert.Equal(Density.FromPoundsPerUSGallon(2), 2.PoundsPerUSGallon()); + Assert.Equal(Density.FromPoundsPerUSGallon(2), 2.PoundsPerUSGallon()); [Fact] public void NumberToSlugsPerCubicFootTest() => - Assert.Equal(Density.FromSlugsPerCubicFoot(2), 2.SlugsPerCubicFoot()); + Assert.Equal(Density.FromSlugsPerCubicFoot(2), 2.SlugsPerCubicFoot()); [Fact] public void NumberToTonnesPerCubicCentimeterTest() => - Assert.Equal(Density.FromTonnesPerCubicCentimeter(2), 2.TonnesPerCubicCentimeter()); + Assert.Equal(Density.FromTonnesPerCubicCentimeter(2), 2.TonnesPerCubicCentimeter()); [Fact] public void NumberToTonnesPerCubicMeterTest() => - Assert.Equal(Density.FromTonnesPerCubicMeter(2), 2.TonnesPerCubicMeter()); + Assert.Equal(Density.FromTonnesPerCubicMeter(2), 2.TonnesPerCubicMeter()); [Fact] public void NumberToTonnesPerCubicMillimeterTest() => - Assert.Equal(Density.FromTonnesPerCubicMillimeter(2), 2.TonnesPerCubicMillimeter()); + Assert.Equal(Density.FromTonnesPerCubicMillimeter(2), 2.TonnesPerCubicMillimeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDurationExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDurationExtensionsTest.g.cs index 93fc192f86..06a70d4826 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDurationExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDurationExtensionsTest.g.cs @@ -21,48 +21,48 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToDurationExtensionsTests { [Fact] public void NumberToDaysTest() => - Assert.Equal(Duration.FromDays(2), 2.Days()); + Assert.Equal(Duration.FromDays(2), 2.Days()); [Fact] public void NumberToHoursTest() => - Assert.Equal(Duration.FromHours(2), 2.Hours()); + Assert.Equal(Duration.FromHours(2), 2.Hours()); [Fact] public void NumberToMicrosecondsTest() => - Assert.Equal(Duration.FromMicroseconds(2), 2.Microseconds()); + Assert.Equal(Duration.FromMicroseconds(2), 2.Microseconds()); [Fact] public void NumberToMillisecondsTest() => - Assert.Equal(Duration.FromMilliseconds(2), 2.Milliseconds()); + Assert.Equal(Duration.FromMilliseconds(2), 2.Milliseconds()); [Fact] public void NumberToMinutesTest() => - Assert.Equal(Duration.FromMinutes(2), 2.Minutes()); + Assert.Equal(Duration.FromMinutes(2), 2.Minutes()); [Fact] public void NumberToMonths30Test() => - Assert.Equal(Duration.FromMonths30(2), 2.Months30()); + Assert.Equal(Duration.FromMonths30(2), 2.Months30()); [Fact] public void NumberToNanosecondsTest() => - Assert.Equal(Duration.FromNanoseconds(2), 2.Nanoseconds()); + Assert.Equal(Duration.FromNanoseconds(2), 2.Nanoseconds()); [Fact] public void NumberToSecondsTest() => - Assert.Equal(Duration.FromSeconds(2), 2.Seconds()); + Assert.Equal(Duration.FromSeconds(2), 2.Seconds()); [Fact] public void NumberToWeeksTest() => - Assert.Equal(Duration.FromWeeks(2), 2.Weeks()); + Assert.Equal(Duration.FromWeeks(2), 2.Weeks()); [Fact] public void NumberToYears365Test() => - Assert.Equal(Duration.FromYears365(2), 2.Years365()); + Assert.Equal(Duration.FromYears365(2), 2.Years365()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDynamicViscosityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDynamicViscosityExtensionsTest.g.cs index f82aec3c5b..da83f442e1 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDynamicViscosityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDynamicViscosityExtensionsTest.g.cs @@ -21,48 +21,48 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToDynamicViscosityExtensionsTests { [Fact] public void NumberToCentipoiseTest() => - Assert.Equal(DynamicViscosity.FromCentipoise(2), 2.Centipoise()); + Assert.Equal(DynamicViscosity.FromCentipoise(2), 2.Centipoise()); [Fact] public void NumberToMicropascalSecondsTest() => - Assert.Equal(DynamicViscosity.FromMicropascalSeconds(2), 2.MicropascalSeconds()); + Assert.Equal(DynamicViscosity.FromMicropascalSeconds(2), 2.MicropascalSeconds()); [Fact] public void NumberToMillipascalSecondsTest() => - Assert.Equal(DynamicViscosity.FromMillipascalSeconds(2), 2.MillipascalSeconds()); + Assert.Equal(DynamicViscosity.FromMillipascalSeconds(2), 2.MillipascalSeconds()); [Fact] public void NumberToNewtonSecondsPerMeterSquaredTest() => - Assert.Equal(DynamicViscosity.FromNewtonSecondsPerMeterSquared(2), 2.NewtonSecondsPerMeterSquared()); + Assert.Equal(DynamicViscosity.FromNewtonSecondsPerMeterSquared(2), 2.NewtonSecondsPerMeterSquared()); [Fact] public void NumberToPascalSecondsTest() => - Assert.Equal(DynamicViscosity.FromPascalSeconds(2), 2.PascalSeconds()); + Assert.Equal(DynamicViscosity.FromPascalSeconds(2), 2.PascalSeconds()); [Fact] public void NumberToPoiseTest() => - Assert.Equal(DynamicViscosity.FromPoise(2), 2.Poise()); + Assert.Equal(DynamicViscosity.FromPoise(2), 2.Poise()); [Fact] public void NumberToPoundsForceSecondPerSquareFootTest() => - Assert.Equal(DynamicViscosity.FromPoundsForceSecondPerSquareFoot(2), 2.PoundsForceSecondPerSquareFoot()); + Assert.Equal(DynamicViscosity.FromPoundsForceSecondPerSquareFoot(2), 2.PoundsForceSecondPerSquareFoot()); [Fact] public void NumberToPoundsForceSecondPerSquareInchTest() => - Assert.Equal(DynamicViscosity.FromPoundsForceSecondPerSquareInch(2), 2.PoundsForceSecondPerSquareInch()); + Assert.Equal(DynamicViscosity.FromPoundsForceSecondPerSquareInch(2), 2.PoundsForceSecondPerSquareInch()); [Fact] public void NumberToPoundsPerFootSecondTest() => - Assert.Equal(DynamicViscosity.FromPoundsPerFootSecond(2), 2.PoundsPerFootSecond()); + Assert.Equal(DynamicViscosity.FromPoundsPerFootSecond(2), 2.PoundsPerFootSecond()); [Fact] public void NumberToReynsTest() => - Assert.Equal(DynamicViscosity.FromReyns(2), 2.Reyns()); + Assert.Equal(DynamicViscosity.FromReyns(2), 2.Reyns()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricAdmittanceExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricAdmittanceExtensionsTest.g.cs index 92e38cf4a3..bda61f3c96 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricAdmittanceExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricAdmittanceExtensionsTest.g.cs @@ -21,24 +21,24 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricAdmittanceExtensionsTests { [Fact] public void NumberToMicrosiemensTest() => - Assert.Equal(ElectricAdmittance.FromMicrosiemens(2), 2.Microsiemens()); + Assert.Equal(ElectricAdmittance.FromMicrosiemens(2), 2.Microsiemens()); [Fact] public void NumberToMillisiemensTest() => - Assert.Equal(ElectricAdmittance.FromMillisiemens(2), 2.Millisiemens()); + Assert.Equal(ElectricAdmittance.FromMillisiemens(2), 2.Millisiemens()); [Fact] public void NumberToNanosiemensTest() => - Assert.Equal(ElectricAdmittance.FromNanosiemens(2), 2.Nanosiemens()); + Assert.Equal(ElectricAdmittance.FromNanosiemens(2), 2.Nanosiemens()); [Fact] public void NumberToSiemensTest() => - Assert.Equal(ElectricAdmittance.FromSiemens(2), 2.Siemens()); + Assert.Equal(ElectricAdmittance.FromSiemens(2), 2.Siemens()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricChargeDensityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricChargeDensityExtensionsTest.g.cs index e947ba90e4..7a0300e80c 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricChargeDensityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricChargeDensityExtensionsTest.g.cs @@ -21,12 +21,12 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricChargeDensityExtensionsTests { [Fact] public void NumberToCoulombsPerCubicMeterTest() => - Assert.Equal(ElectricChargeDensity.FromCoulombsPerCubicMeter(2), 2.CoulombsPerCubicMeter()); + Assert.Equal(ElectricChargeDensity.FromCoulombsPerCubicMeter(2), 2.CoulombsPerCubicMeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricChargeExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricChargeExtensionsTest.g.cs index 2e2de22eb3..32d888f509 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricChargeExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricChargeExtensionsTest.g.cs @@ -21,28 +21,28 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricChargeExtensionsTests { [Fact] public void NumberToAmpereHoursTest() => - Assert.Equal(ElectricCharge.FromAmpereHours(2), 2.AmpereHours()); + Assert.Equal(ElectricCharge.FromAmpereHours(2), 2.AmpereHours()); [Fact] public void NumberToCoulombsTest() => - Assert.Equal(ElectricCharge.FromCoulombs(2), 2.Coulombs()); + Assert.Equal(ElectricCharge.FromCoulombs(2), 2.Coulombs()); [Fact] public void NumberToKiloampereHoursTest() => - Assert.Equal(ElectricCharge.FromKiloampereHours(2), 2.KiloampereHours()); + Assert.Equal(ElectricCharge.FromKiloampereHours(2), 2.KiloampereHours()); [Fact] public void NumberToMegaampereHoursTest() => - Assert.Equal(ElectricCharge.FromMegaampereHours(2), 2.MegaampereHours()); + Assert.Equal(ElectricCharge.FromMegaampereHours(2), 2.MegaampereHours()); [Fact] public void NumberToMilliampereHoursTest() => - Assert.Equal(ElectricCharge.FromMilliampereHours(2), 2.MilliampereHours()); + Assert.Equal(ElectricCharge.FromMilliampereHours(2), 2.MilliampereHours()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricConductanceExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricConductanceExtensionsTest.g.cs index e6640aa1d5..771b52fa39 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricConductanceExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricConductanceExtensionsTest.g.cs @@ -21,20 +21,20 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricConductanceExtensionsTests { [Fact] public void NumberToMicrosiemensTest() => - Assert.Equal(ElectricConductance.FromMicrosiemens(2), 2.Microsiemens()); + Assert.Equal(ElectricConductance.FromMicrosiemens(2), 2.Microsiemens()); [Fact] public void NumberToMillisiemensTest() => - Assert.Equal(ElectricConductance.FromMillisiemens(2), 2.Millisiemens()); + Assert.Equal(ElectricConductance.FromMillisiemens(2), 2.Millisiemens()); [Fact] public void NumberToSiemensTest() => - Assert.Equal(ElectricConductance.FromSiemens(2), 2.Siemens()); + Assert.Equal(ElectricConductance.FromSiemens(2), 2.Siemens()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricConductivityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricConductivityExtensionsTest.g.cs index 7abe9c5bbe..19d67fe30a 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricConductivityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricConductivityExtensionsTest.g.cs @@ -21,20 +21,20 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricConductivityExtensionsTests { [Fact] public void NumberToSiemensPerFootTest() => - Assert.Equal(ElectricConductivity.FromSiemensPerFoot(2), 2.SiemensPerFoot()); + Assert.Equal(ElectricConductivity.FromSiemensPerFoot(2), 2.SiemensPerFoot()); [Fact] public void NumberToSiemensPerInchTest() => - Assert.Equal(ElectricConductivity.FromSiemensPerInch(2), 2.SiemensPerInch()); + Assert.Equal(ElectricConductivity.FromSiemensPerInch(2), 2.SiemensPerInch()); [Fact] public void NumberToSiemensPerMeterTest() => - Assert.Equal(ElectricConductivity.FromSiemensPerMeter(2), 2.SiemensPerMeter()); + Assert.Equal(ElectricConductivity.FromSiemensPerMeter(2), 2.SiemensPerMeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricCurrentDensityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricCurrentDensityExtensionsTest.g.cs index d07398f18c..b66a856b46 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricCurrentDensityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricCurrentDensityExtensionsTest.g.cs @@ -21,20 +21,20 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricCurrentDensityExtensionsTests { [Fact] public void NumberToAmperesPerSquareFootTest() => - Assert.Equal(ElectricCurrentDensity.FromAmperesPerSquareFoot(2), 2.AmperesPerSquareFoot()); + Assert.Equal(ElectricCurrentDensity.FromAmperesPerSquareFoot(2), 2.AmperesPerSquareFoot()); [Fact] public void NumberToAmperesPerSquareInchTest() => - Assert.Equal(ElectricCurrentDensity.FromAmperesPerSquareInch(2), 2.AmperesPerSquareInch()); + Assert.Equal(ElectricCurrentDensity.FromAmperesPerSquareInch(2), 2.AmperesPerSquareInch()); [Fact] public void NumberToAmperesPerSquareMeterTest() => - Assert.Equal(ElectricCurrentDensity.FromAmperesPerSquareMeter(2), 2.AmperesPerSquareMeter()); + Assert.Equal(ElectricCurrentDensity.FromAmperesPerSquareMeter(2), 2.AmperesPerSquareMeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricCurrentExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricCurrentExtensionsTest.g.cs index a8e9233ca1..e4bc42a9a2 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricCurrentExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricCurrentExtensionsTest.g.cs @@ -21,40 +21,40 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricCurrentExtensionsTests { [Fact] public void NumberToAmperesTest() => - Assert.Equal(ElectricCurrent.FromAmperes(2), 2.Amperes()); + Assert.Equal(ElectricCurrent.FromAmperes(2), 2.Amperes()); [Fact] public void NumberToCentiamperesTest() => - Assert.Equal(ElectricCurrent.FromCentiamperes(2), 2.Centiamperes()); + Assert.Equal(ElectricCurrent.FromCentiamperes(2), 2.Centiamperes()); [Fact] public void NumberToKiloamperesTest() => - Assert.Equal(ElectricCurrent.FromKiloamperes(2), 2.Kiloamperes()); + Assert.Equal(ElectricCurrent.FromKiloamperes(2), 2.Kiloamperes()); [Fact] public void NumberToMegaamperesTest() => - Assert.Equal(ElectricCurrent.FromMegaamperes(2), 2.Megaamperes()); + Assert.Equal(ElectricCurrent.FromMegaamperes(2), 2.Megaamperes()); [Fact] public void NumberToMicroamperesTest() => - Assert.Equal(ElectricCurrent.FromMicroamperes(2), 2.Microamperes()); + Assert.Equal(ElectricCurrent.FromMicroamperes(2), 2.Microamperes()); [Fact] public void NumberToMilliamperesTest() => - Assert.Equal(ElectricCurrent.FromMilliamperes(2), 2.Milliamperes()); + Assert.Equal(ElectricCurrent.FromMilliamperes(2), 2.Milliamperes()); [Fact] public void NumberToNanoamperesTest() => - Assert.Equal(ElectricCurrent.FromNanoamperes(2), 2.Nanoamperes()); + Assert.Equal(ElectricCurrent.FromNanoamperes(2), 2.Nanoamperes()); [Fact] public void NumberToPicoamperesTest() => - Assert.Equal(ElectricCurrent.FromPicoamperes(2), 2.Picoamperes()); + Assert.Equal(ElectricCurrent.FromPicoamperes(2), 2.Picoamperes()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricCurrentGradientExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricCurrentGradientExtensionsTest.g.cs index e2df64f669..294954cb3e 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricCurrentGradientExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricCurrentGradientExtensionsTest.g.cs @@ -21,24 +21,24 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricCurrentGradientExtensionsTests { [Fact] public void NumberToAmperesPerMicrosecondTest() => - Assert.Equal(ElectricCurrentGradient.FromAmperesPerMicrosecond(2), 2.AmperesPerMicrosecond()); + Assert.Equal(ElectricCurrentGradient.FromAmperesPerMicrosecond(2), 2.AmperesPerMicrosecond()); [Fact] public void NumberToAmperesPerMillisecondTest() => - Assert.Equal(ElectricCurrentGradient.FromAmperesPerMillisecond(2), 2.AmperesPerMillisecond()); + Assert.Equal(ElectricCurrentGradient.FromAmperesPerMillisecond(2), 2.AmperesPerMillisecond()); [Fact] public void NumberToAmperesPerNanosecondTest() => - Assert.Equal(ElectricCurrentGradient.FromAmperesPerNanosecond(2), 2.AmperesPerNanosecond()); + Assert.Equal(ElectricCurrentGradient.FromAmperesPerNanosecond(2), 2.AmperesPerNanosecond()); [Fact] public void NumberToAmperesPerSecondTest() => - Assert.Equal(ElectricCurrentGradient.FromAmperesPerSecond(2), 2.AmperesPerSecond()); + Assert.Equal(ElectricCurrentGradient.FromAmperesPerSecond(2), 2.AmperesPerSecond()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricFieldExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricFieldExtensionsTest.g.cs index 633c0ad865..46d4c55fcb 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricFieldExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricFieldExtensionsTest.g.cs @@ -21,12 +21,12 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricFieldExtensionsTests { [Fact] public void NumberToVoltsPerMeterTest() => - Assert.Equal(ElectricField.FromVoltsPerMeter(2), 2.VoltsPerMeter()); + Assert.Equal(ElectricField.FromVoltsPerMeter(2), 2.VoltsPerMeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricInductanceExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricInductanceExtensionsTest.g.cs index 59869a90f2..cca05f069b 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricInductanceExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricInductanceExtensionsTest.g.cs @@ -21,24 +21,24 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricInductanceExtensionsTests { [Fact] public void NumberToHenriesTest() => - Assert.Equal(ElectricInductance.FromHenries(2), 2.Henries()); + Assert.Equal(ElectricInductance.FromHenries(2), 2.Henries()); [Fact] public void NumberToMicrohenriesTest() => - Assert.Equal(ElectricInductance.FromMicrohenries(2), 2.Microhenries()); + Assert.Equal(ElectricInductance.FromMicrohenries(2), 2.Microhenries()); [Fact] public void NumberToMillihenriesTest() => - Assert.Equal(ElectricInductance.FromMillihenries(2), 2.Millihenries()); + Assert.Equal(ElectricInductance.FromMillihenries(2), 2.Millihenries()); [Fact] public void NumberToNanohenriesTest() => - Assert.Equal(ElectricInductance.FromNanohenries(2), 2.Nanohenries()); + Assert.Equal(ElectricInductance.FromNanohenries(2), 2.Nanohenries()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialAcExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialAcExtensionsTest.g.cs index 54337c2287..845c68ff51 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialAcExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialAcExtensionsTest.g.cs @@ -21,28 +21,28 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricPotentialAcExtensionsTests { [Fact] public void NumberToKilovoltsAcTest() => - Assert.Equal(ElectricPotentialAc.FromKilovoltsAc(2), 2.KilovoltsAc()); + Assert.Equal(ElectricPotentialAc.FromKilovoltsAc(2), 2.KilovoltsAc()); [Fact] public void NumberToMegavoltsAcTest() => - Assert.Equal(ElectricPotentialAc.FromMegavoltsAc(2), 2.MegavoltsAc()); + Assert.Equal(ElectricPotentialAc.FromMegavoltsAc(2), 2.MegavoltsAc()); [Fact] public void NumberToMicrovoltsAcTest() => - Assert.Equal(ElectricPotentialAc.FromMicrovoltsAc(2), 2.MicrovoltsAc()); + Assert.Equal(ElectricPotentialAc.FromMicrovoltsAc(2), 2.MicrovoltsAc()); [Fact] public void NumberToMillivoltsAcTest() => - Assert.Equal(ElectricPotentialAc.FromMillivoltsAc(2), 2.MillivoltsAc()); + Assert.Equal(ElectricPotentialAc.FromMillivoltsAc(2), 2.MillivoltsAc()); [Fact] public void NumberToVoltsAcTest() => - Assert.Equal(ElectricPotentialAc.FromVoltsAc(2), 2.VoltsAc()); + Assert.Equal(ElectricPotentialAc.FromVoltsAc(2), 2.VoltsAc()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialChangeRateExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialChangeRateExtensionsTest.g.cs index ce9ca9e848..ca30d858fb 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialChangeRateExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialChangeRateExtensionsTest.g.cs @@ -21,88 +21,88 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricPotentialChangeRateExtensionsTests { [Fact] public void NumberToKilovoltsPerHoursTest() => - Assert.Equal(ElectricPotentialChangeRate.FromKilovoltsPerHours(2), 2.KilovoltsPerHours()); + Assert.Equal(ElectricPotentialChangeRate.FromKilovoltsPerHours(2), 2.KilovoltsPerHours()); [Fact] public void NumberToKilovoltsPerMicrosecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromKilovoltsPerMicroseconds(2), 2.KilovoltsPerMicroseconds()); + Assert.Equal(ElectricPotentialChangeRate.FromKilovoltsPerMicroseconds(2), 2.KilovoltsPerMicroseconds()); [Fact] public void NumberToKilovoltsPerMinutesTest() => - Assert.Equal(ElectricPotentialChangeRate.FromKilovoltsPerMinutes(2), 2.KilovoltsPerMinutes()); + Assert.Equal(ElectricPotentialChangeRate.FromKilovoltsPerMinutes(2), 2.KilovoltsPerMinutes()); [Fact] public void NumberToKilovoltsPerSecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromKilovoltsPerSeconds(2), 2.KilovoltsPerSeconds()); + Assert.Equal(ElectricPotentialChangeRate.FromKilovoltsPerSeconds(2), 2.KilovoltsPerSeconds()); [Fact] public void NumberToMegavoltsPerHoursTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMegavoltsPerHours(2), 2.MegavoltsPerHours()); + Assert.Equal(ElectricPotentialChangeRate.FromMegavoltsPerHours(2), 2.MegavoltsPerHours()); [Fact] public void NumberToMegavoltsPerMicrosecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMegavoltsPerMicroseconds(2), 2.MegavoltsPerMicroseconds()); + Assert.Equal(ElectricPotentialChangeRate.FromMegavoltsPerMicroseconds(2), 2.MegavoltsPerMicroseconds()); [Fact] public void NumberToMegavoltsPerMinutesTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMegavoltsPerMinutes(2), 2.MegavoltsPerMinutes()); + Assert.Equal(ElectricPotentialChangeRate.FromMegavoltsPerMinutes(2), 2.MegavoltsPerMinutes()); [Fact] public void NumberToMegavoltsPerSecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMegavoltsPerSeconds(2), 2.MegavoltsPerSeconds()); + Assert.Equal(ElectricPotentialChangeRate.FromMegavoltsPerSeconds(2), 2.MegavoltsPerSeconds()); [Fact] public void NumberToMicrovoltsPerHoursTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMicrovoltsPerHours(2), 2.MicrovoltsPerHours()); + Assert.Equal(ElectricPotentialChangeRate.FromMicrovoltsPerHours(2), 2.MicrovoltsPerHours()); [Fact] public void NumberToMicrovoltsPerMicrosecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMicrovoltsPerMicroseconds(2), 2.MicrovoltsPerMicroseconds()); + Assert.Equal(ElectricPotentialChangeRate.FromMicrovoltsPerMicroseconds(2), 2.MicrovoltsPerMicroseconds()); [Fact] public void NumberToMicrovoltsPerMinutesTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMicrovoltsPerMinutes(2), 2.MicrovoltsPerMinutes()); + Assert.Equal(ElectricPotentialChangeRate.FromMicrovoltsPerMinutes(2), 2.MicrovoltsPerMinutes()); [Fact] public void NumberToMicrovoltsPerSecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMicrovoltsPerSeconds(2), 2.MicrovoltsPerSeconds()); + Assert.Equal(ElectricPotentialChangeRate.FromMicrovoltsPerSeconds(2), 2.MicrovoltsPerSeconds()); [Fact] public void NumberToMillivoltsPerHoursTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMillivoltsPerHours(2), 2.MillivoltsPerHours()); + Assert.Equal(ElectricPotentialChangeRate.FromMillivoltsPerHours(2), 2.MillivoltsPerHours()); [Fact] public void NumberToMillivoltsPerMicrosecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMillivoltsPerMicroseconds(2), 2.MillivoltsPerMicroseconds()); + Assert.Equal(ElectricPotentialChangeRate.FromMillivoltsPerMicroseconds(2), 2.MillivoltsPerMicroseconds()); [Fact] public void NumberToMillivoltsPerMinutesTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMillivoltsPerMinutes(2), 2.MillivoltsPerMinutes()); + Assert.Equal(ElectricPotentialChangeRate.FromMillivoltsPerMinutes(2), 2.MillivoltsPerMinutes()); [Fact] public void NumberToMillivoltsPerSecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMillivoltsPerSeconds(2), 2.MillivoltsPerSeconds()); + Assert.Equal(ElectricPotentialChangeRate.FromMillivoltsPerSeconds(2), 2.MillivoltsPerSeconds()); [Fact] public void NumberToVoltsPerHoursTest() => - Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerHours(2), 2.VoltsPerHours()); + Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerHours(2), 2.VoltsPerHours()); [Fact] public void NumberToVoltsPerMicrosecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerMicroseconds(2), 2.VoltsPerMicroseconds()); + Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerMicroseconds(2), 2.VoltsPerMicroseconds()); [Fact] public void NumberToVoltsPerMinutesTest() => - Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerMinutes(2), 2.VoltsPerMinutes()); + Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerMinutes(2), 2.VoltsPerMinutes()); [Fact] public void NumberToVoltsPerSecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerSeconds(2), 2.VoltsPerSeconds()); + Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerSeconds(2), 2.VoltsPerSeconds()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialDcExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialDcExtensionsTest.g.cs index 2c058240c3..863857ba42 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialDcExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialDcExtensionsTest.g.cs @@ -21,28 +21,28 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricPotentialDcExtensionsTests { [Fact] public void NumberToKilovoltsDcTest() => - Assert.Equal(ElectricPotentialDc.FromKilovoltsDc(2), 2.KilovoltsDc()); + Assert.Equal(ElectricPotentialDc.FromKilovoltsDc(2), 2.KilovoltsDc()); [Fact] public void NumberToMegavoltsDcTest() => - Assert.Equal(ElectricPotentialDc.FromMegavoltsDc(2), 2.MegavoltsDc()); + Assert.Equal(ElectricPotentialDc.FromMegavoltsDc(2), 2.MegavoltsDc()); [Fact] public void NumberToMicrovoltsDcTest() => - Assert.Equal(ElectricPotentialDc.FromMicrovoltsDc(2), 2.MicrovoltsDc()); + Assert.Equal(ElectricPotentialDc.FromMicrovoltsDc(2), 2.MicrovoltsDc()); [Fact] public void NumberToMillivoltsDcTest() => - Assert.Equal(ElectricPotentialDc.FromMillivoltsDc(2), 2.MillivoltsDc()); + Assert.Equal(ElectricPotentialDc.FromMillivoltsDc(2), 2.MillivoltsDc()); [Fact] public void NumberToVoltsDcTest() => - Assert.Equal(ElectricPotentialDc.FromVoltsDc(2), 2.VoltsDc()); + Assert.Equal(ElectricPotentialDc.FromVoltsDc(2), 2.VoltsDc()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialExtensionsTest.g.cs index 799c7ae5bc..1d3166c3ef 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialExtensionsTest.g.cs @@ -21,28 +21,28 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricPotentialExtensionsTests { [Fact] public void NumberToKilovoltsTest() => - Assert.Equal(ElectricPotential.FromKilovolts(2), 2.Kilovolts()); + Assert.Equal(ElectricPotential.FromKilovolts(2), 2.Kilovolts()); [Fact] public void NumberToMegavoltsTest() => - Assert.Equal(ElectricPotential.FromMegavolts(2), 2.Megavolts()); + Assert.Equal(ElectricPotential.FromMegavolts(2), 2.Megavolts()); [Fact] public void NumberToMicrovoltsTest() => - Assert.Equal(ElectricPotential.FromMicrovolts(2), 2.Microvolts()); + Assert.Equal(ElectricPotential.FromMicrovolts(2), 2.Microvolts()); [Fact] public void NumberToMillivoltsTest() => - Assert.Equal(ElectricPotential.FromMillivolts(2), 2.Millivolts()); + Assert.Equal(ElectricPotential.FromMillivolts(2), 2.Millivolts()); [Fact] public void NumberToVoltsTest() => - Assert.Equal(ElectricPotential.FromVolts(2), 2.Volts()); + Assert.Equal(ElectricPotential.FromVolts(2), 2.Volts()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricResistanceExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricResistanceExtensionsTest.g.cs index ee33155d98..4bb943f9cf 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricResistanceExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricResistanceExtensionsTest.g.cs @@ -21,32 +21,32 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricResistanceExtensionsTests { [Fact] public void NumberToGigaohmsTest() => - Assert.Equal(ElectricResistance.FromGigaohms(2), 2.Gigaohms()); + Assert.Equal(ElectricResistance.FromGigaohms(2), 2.Gigaohms()); [Fact] public void NumberToKiloohmsTest() => - Assert.Equal(ElectricResistance.FromKiloohms(2), 2.Kiloohms()); + Assert.Equal(ElectricResistance.FromKiloohms(2), 2.Kiloohms()); [Fact] public void NumberToMegaohmsTest() => - Assert.Equal(ElectricResistance.FromMegaohms(2), 2.Megaohms()); + Assert.Equal(ElectricResistance.FromMegaohms(2), 2.Megaohms()); [Fact] public void NumberToMicroohmsTest() => - Assert.Equal(ElectricResistance.FromMicroohms(2), 2.Microohms()); + Assert.Equal(ElectricResistance.FromMicroohms(2), 2.Microohms()); [Fact] public void NumberToMilliohmsTest() => - Assert.Equal(ElectricResistance.FromMilliohms(2), 2.Milliohms()); + Assert.Equal(ElectricResistance.FromMilliohms(2), 2.Milliohms()); [Fact] public void NumberToOhmsTest() => - Assert.Equal(ElectricResistance.FromOhms(2), 2.Ohms()); + Assert.Equal(ElectricResistance.FromOhms(2), 2.Ohms()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricResistivityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricResistivityExtensionsTest.g.cs index 6a50c427e4..2fb6a8f77c 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricResistivityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricResistivityExtensionsTest.g.cs @@ -21,64 +21,64 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricResistivityExtensionsTests { [Fact] public void NumberToKiloohmsCentimeterTest() => - Assert.Equal(ElectricResistivity.FromKiloohmsCentimeter(2), 2.KiloohmsCentimeter()); + Assert.Equal(ElectricResistivity.FromKiloohmsCentimeter(2), 2.KiloohmsCentimeter()); [Fact] public void NumberToKiloohmMetersTest() => - Assert.Equal(ElectricResistivity.FromKiloohmMeters(2), 2.KiloohmMeters()); + Assert.Equal(ElectricResistivity.FromKiloohmMeters(2), 2.KiloohmMeters()); [Fact] public void NumberToMegaohmsCentimeterTest() => - Assert.Equal(ElectricResistivity.FromMegaohmsCentimeter(2), 2.MegaohmsCentimeter()); + Assert.Equal(ElectricResistivity.FromMegaohmsCentimeter(2), 2.MegaohmsCentimeter()); [Fact] public void NumberToMegaohmMetersTest() => - Assert.Equal(ElectricResistivity.FromMegaohmMeters(2), 2.MegaohmMeters()); + Assert.Equal(ElectricResistivity.FromMegaohmMeters(2), 2.MegaohmMeters()); [Fact] public void NumberToMicroohmsCentimeterTest() => - Assert.Equal(ElectricResistivity.FromMicroohmsCentimeter(2), 2.MicroohmsCentimeter()); + Assert.Equal(ElectricResistivity.FromMicroohmsCentimeter(2), 2.MicroohmsCentimeter()); [Fact] public void NumberToMicroohmMetersTest() => - Assert.Equal(ElectricResistivity.FromMicroohmMeters(2), 2.MicroohmMeters()); + Assert.Equal(ElectricResistivity.FromMicroohmMeters(2), 2.MicroohmMeters()); [Fact] public void NumberToMilliohmsCentimeterTest() => - Assert.Equal(ElectricResistivity.FromMilliohmsCentimeter(2), 2.MilliohmsCentimeter()); + Assert.Equal(ElectricResistivity.FromMilliohmsCentimeter(2), 2.MilliohmsCentimeter()); [Fact] public void NumberToMilliohmMetersTest() => - Assert.Equal(ElectricResistivity.FromMilliohmMeters(2), 2.MilliohmMeters()); + Assert.Equal(ElectricResistivity.FromMilliohmMeters(2), 2.MilliohmMeters()); [Fact] public void NumberToNanoohmsCentimeterTest() => - Assert.Equal(ElectricResistivity.FromNanoohmsCentimeter(2), 2.NanoohmsCentimeter()); + Assert.Equal(ElectricResistivity.FromNanoohmsCentimeter(2), 2.NanoohmsCentimeter()); [Fact] public void NumberToNanoohmMetersTest() => - Assert.Equal(ElectricResistivity.FromNanoohmMeters(2), 2.NanoohmMeters()); + Assert.Equal(ElectricResistivity.FromNanoohmMeters(2), 2.NanoohmMeters()); [Fact] public void NumberToOhmsCentimeterTest() => - Assert.Equal(ElectricResistivity.FromOhmsCentimeter(2), 2.OhmsCentimeter()); + Assert.Equal(ElectricResistivity.FromOhmsCentimeter(2), 2.OhmsCentimeter()); [Fact] public void NumberToOhmMetersTest() => - Assert.Equal(ElectricResistivity.FromOhmMeters(2), 2.OhmMeters()); + Assert.Equal(ElectricResistivity.FromOhmMeters(2), 2.OhmMeters()); [Fact] public void NumberToPicoohmsCentimeterTest() => - Assert.Equal(ElectricResistivity.FromPicoohmsCentimeter(2), 2.PicoohmsCentimeter()); + Assert.Equal(ElectricResistivity.FromPicoohmsCentimeter(2), 2.PicoohmsCentimeter()); [Fact] public void NumberToPicoohmMetersTest() => - Assert.Equal(ElectricResistivity.FromPicoohmMeters(2), 2.PicoohmMeters()); + Assert.Equal(ElectricResistivity.FromPicoohmMeters(2), 2.PicoohmMeters()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricSurfaceChargeDensityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricSurfaceChargeDensityExtensionsTest.g.cs index bc6ed172f7..21cbcbf6b2 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricSurfaceChargeDensityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricSurfaceChargeDensityExtensionsTest.g.cs @@ -21,20 +21,20 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToElectricSurfaceChargeDensityExtensionsTests { [Fact] public void NumberToCoulombsPerSquareCentimeterTest() => - Assert.Equal(ElectricSurfaceChargeDensity.FromCoulombsPerSquareCentimeter(2), 2.CoulombsPerSquareCentimeter()); + Assert.Equal(ElectricSurfaceChargeDensity.FromCoulombsPerSquareCentimeter(2), 2.CoulombsPerSquareCentimeter()); [Fact] public void NumberToCoulombsPerSquareInchTest() => - Assert.Equal(ElectricSurfaceChargeDensity.FromCoulombsPerSquareInch(2), 2.CoulombsPerSquareInch()); + Assert.Equal(ElectricSurfaceChargeDensity.FromCoulombsPerSquareInch(2), 2.CoulombsPerSquareInch()); [Fact] public void NumberToCoulombsPerSquareMeterTest() => - Assert.Equal(ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(2), 2.CoulombsPerSquareMeter()); + Assert.Equal(ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(2), 2.CoulombsPerSquareMeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToEnergyExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToEnergyExtensionsTest.g.cs index bfad6ae155..35d295396d 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToEnergyExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToEnergyExtensionsTest.g.cs @@ -21,152 +21,152 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToEnergyExtensionsTests { [Fact] public void NumberToBritishThermalUnitsTest() => - Assert.Equal(Energy.FromBritishThermalUnits(2), 2.BritishThermalUnits()); + Assert.Equal(Energy.FromBritishThermalUnits(2), 2.BritishThermalUnits()); [Fact] public void NumberToCaloriesTest() => - Assert.Equal(Energy.FromCalories(2), 2.Calories()); + Assert.Equal(Energy.FromCalories(2), 2.Calories()); [Fact] public void NumberToDecathermsEcTest() => - Assert.Equal(Energy.FromDecathermsEc(2), 2.DecathermsEc()); + Assert.Equal(Energy.FromDecathermsEc(2), 2.DecathermsEc()); [Fact] public void NumberToDecathermsImperialTest() => - Assert.Equal(Energy.FromDecathermsImperial(2), 2.DecathermsImperial()); + Assert.Equal(Energy.FromDecathermsImperial(2), 2.DecathermsImperial()); [Fact] public void NumberToDecathermsUsTest() => - Assert.Equal(Energy.FromDecathermsUs(2), 2.DecathermsUs()); + Assert.Equal(Energy.FromDecathermsUs(2), 2.DecathermsUs()); [Fact] public void NumberToElectronVoltsTest() => - Assert.Equal(Energy.FromElectronVolts(2), 2.ElectronVolts()); + Assert.Equal(Energy.FromElectronVolts(2), 2.ElectronVolts()); [Fact] public void NumberToErgsTest() => - Assert.Equal(Energy.FromErgs(2), 2.Ergs()); + Assert.Equal(Energy.FromErgs(2), 2.Ergs()); [Fact] public void NumberToFootPoundsTest() => - Assert.Equal(Energy.FromFootPounds(2), 2.FootPounds()); + Assert.Equal(Energy.FromFootPounds(2), 2.FootPounds()); [Fact] public void NumberToGigabritishThermalUnitsTest() => - Assert.Equal(Energy.FromGigabritishThermalUnits(2), 2.GigabritishThermalUnits()); + Assert.Equal(Energy.FromGigabritishThermalUnits(2), 2.GigabritishThermalUnits()); [Fact] public void NumberToGigaelectronVoltsTest() => - Assert.Equal(Energy.FromGigaelectronVolts(2), 2.GigaelectronVolts()); + Assert.Equal(Energy.FromGigaelectronVolts(2), 2.GigaelectronVolts()); [Fact] public void NumberToGigajoulesTest() => - Assert.Equal(Energy.FromGigajoules(2), 2.Gigajoules()); + Assert.Equal(Energy.FromGigajoules(2), 2.Gigajoules()); [Fact] public void NumberToGigawattDaysTest() => - Assert.Equal(Energy.FromGigawattDays(2), 2.GigawattDays()); + Assert.Equal(Energy.FromGigawattDays(2), 2.GigawattDays()); [Fact] public void NumberToGigawattHoursTest() => - Assert.Equal(Energy.FromGigawattHours(2), 2.GigawattHours()); + Assert.Equal(Energy.FromGigawattHours(2), 2.GigawattHours()); [Fact] public void NumberToHorsepowerHoursTest() => - Assert.Equal(Energy.FromHorsepowerHours(2), 2.HorsepowerHours()); + Assert.Equal(Energy.FromHorsepowerHours(2), 2.HorsepowerHours()); [Fact] public void NumberToJoulesTest() => - Assert.Equal(Energy.FromJoules(2), 2.Joules()); + Assert.Equal(Energy.FromJoules(2), 2.Joules()); [Fact] public void NumberToKilobritishThermalUnitsTest() => - Assert.Equal(Energy.FromKilobritishThermalUnits(2), 2.KilobritishThermalUnits()); + Assert.Equal(Energy.FromKilobritishThermalUnits(2), 2.KilobritishThermalUnits()); [Fact] public void NumberToKilocaloriesTest() => - Assert.Equal(Energy.FromKilocalories(2), 2.Kilocalories()); + Assert.Equal(Energy.FromKilocalories(2), 2.Kilocalories()); [Fact] public void NumberToKiloelectronVoltsTest() => - Assert.Equal(Energy.FromKiloelectronVolts(2), 2.KiloelectronVolts()); + Assert.Equal(Energy.FromKiloelectronVolts(2), 2.KiloelectronVolts()); [Fact] public void NumberToKilojoulesTest() => - Assert.Equal(Energy.FromKilojoules(2), 2.Kilojoules()); + Assert.Equal(Energy.FromKilojoules(2), 2.Kilojoules()); [Fact] public void NumberToKilowattDaysTest() => - Assert.Equal(Energy.FromKilowattDays(2), 2.KilowattDays()); + Assert.Equal(Energy.FromKilowattDays(2), 2.KilowattDays()); [Fact] public void NumberToKilowattHoursTest() => - Assert.Equal(Energy.FromKilowattHours(2), 2.KilowattHours()); + Assert.Equal(Energy.FromKilowattHours(2), 2.KilowattHours()); [Fact] public void NumberToMegabritishThermalUnitsTest() => - Assert.Equal(Energy.FromMegabritishThermalUnits(2), 2.MegabritishThermalUnits()); + Assert.Equal(Energy.FromMegabritishThermalUnits(2), 2.MegabritishThermalUnits()); [Fact] public void NumberToMegacaloriesTest() => - Assert.Equal(Energy.FromMegacalories(2), 2.Megacalories()); + Assert.Equal(Energy.FromMegacalories(2), 2.Megacalories()); [Fact] public void NumberToMegaelectronVoltsTest() => - Assert.Equal(Energy.FromMegaelectronVolts(2), 2.MegaelectronVolts()); + Assert.Equal(Energy.FromMegaelectronVolts(2), 2.MegaelectronVolts()); [Fact] public void NumberToMegajoulesTest() => - Assert.Equal(Energy.FromMegajoules(2), 2.Megajoules()); + Assert.Equal(Energy.FromMegajoules(2), 2.Megajoules()); [Fact] public void NumberToMegawattDaysTest() => - Assert.Equal(Energy.FromMegawattDays(2), 2.MegawattDays()); + Assert.Equal(Energy.FromMegawattDays(2), 2.MegawattDays()); [Fact] public void NumberToMegawattHoursTest() => - Assert.Equal(Energy.FromMegawattHours(2), 2.MegawattHours()); + Assert.Equal(Energy.FromMegawattHours(2), 2.MegawattHours()); [Fact] public void NumberToMillijoulesTest() => - Assert.Equal(Energy.FromMillijoules(2), 2.Millijoules()); + Assert.Equal(Energy.FromMillijoules(2), 2.Millijoules()); [Fact] public void NumberToTeraelectronVoltsTest() => - Assert.Equal(Energy.FromTeraelectronVolts(2), 2.TeraelectronVolts()); + Assert.Equal(Energy.FromTeraelectronVolts(2), 2.TeraelectronVolts()); [Fact] public void NumberToTerawattDaysTest() => - Assert.Equal(Energy.FromTerawattDays(2), 2.TerawattDays()); + Assert.Equal(Energy.FromTerawattDays(2), 2.TerawattDays()); [Fact] public void NumberToTerawattHoursTest() => - Assert.Equal(Energy.FromTerawattHours(2), 2.TerawattHours()); + Assert.Equal(Energy.FromTerawattHours(2), 2.TerawattHours()); [Fact] public void NumberToThermsEcTest() => - Assert.Equal(Energy.FromThermsEc(2), 2.ThermsEc()); + Assert.Equal(Energy.FromThermsEc(2), 2.ThermsEc()); [Fact] public void NumberToThermsImperialTest() => - Assert.Equal(Energy.FromThermsImperial(2), 2.ThermsImperial()); + Assert.Equal(Energy.FromThermsImperial(2), 2.ThermsImperial()); [Fact] public void NumberToThermsUsTest() => - Assert.Equal(Energy.FromThermsUs(2), 2.ThermsUs()); + Assert.Equal(Energy.FromThermsUs(2), 2.ThermsUs()); [Fact] public void NumberToWattDaysTest() => - Assert.Equal(Energy.FromWattDays(2), 2.WattDays()); + Assert.Equal(Energy.FromWattDays(2), 2.WattDays()); [Fact] public void NumberToWattHoursTest() => - Assert.Equal(Energy.FromWattHours(2), 2.WattHours()); + Assert.Equal(Energy.FromWattHours(2), 2.WattHours()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToEntropyExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToEntropyExtensionsTest.g.cs index c6cf992847..4cb431ebe8 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToEntropyExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToEntropyExtensionsTest.g.cs @@ -21,36 +21,36 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToEntropyExtensionsTests { [Fact] public void NumberToCaloriesPerKelvinTest() => - Assert.Equal(Entropy.FromCaloriesPerKelvin(2), 2.CaloriesPerKelvin()); + Assert.Equal(Entropy.FromCaloriesPerKelvin(2), 2.CaloriesPerKelvin()); [Fact] public void NumberToJoulesPerDegreeCelsiusTest() => - Assert.Equal(Entropy.FromJoulesPerDegreeCelsius(2), 2.JoulesPerDegreeCelsius()); + Assert.Equal(Entropy.FromJoulesPerDegreeCelsius(2), 2.JoulesPerDegreeCelsius()); [Fact] public void NumberToJoulesPerKelvinTest() => - Assert.Equal(Entropy.FromJoulesPerKelvin(2), 2.JoulesPerKelvin()); + Assert.Equal(Entropy.FromJoulesPerKelvin(2), 2.JoulesPerKelvin()); [Fact] public void NumberToKilocaloriesPerKelvinTest() => - Assert.Equal(Entropy.FromKilocaloriesPerKelvin(2), 2.KilocaloriesPerKelvin()); + Assert.Equal(Entropy.FromKilocaloriesPerKelvin(2), 2.KilocaloriesPerKelvin()); [Fact] public void NumberToKilojoulesPerDegreeCelsiusTest() => - Assert.Equal(Entropy.FromKilojoulesPerDegreeCelsius(2), 2.KilojoulesPerDegreeCelsius()); + Assert.Equal(Entropy.FromKilojoulesPerDegreeCelsius(2), 2.KilojoulesPerDegreeCelsius()); [Fact] public void NumberToKilojoulesPerKelvinTest() => - Assert.Equal(Entropy.FromKilojoulesPerKelvin(2), 2.KilojoulesPerKelvin()); + Assert.Equal(Entropy.FromKilojoulesPerKelvin(2), 2.KilojoulesPerKelvin()); [Fact] public void NumberToMegajoulesPerKelvinTest() => - Assert.Equal(Entropy.FromMegajoulesPerKelvin(2), 2.MegajoulesPerKelvin()); + Assert.Equal(Entropy.FromMegajoulesPerKelvin(2), 2.MegajoulesPerKelvin()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToForceChangeRateExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToForceChangeRateExtensionsTest.g.cs index c94a756ed7..a657b767c6 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToForceChangeRateExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToForceChangeRateExtensionsTest.g.cs @@ -21,52 +21,52 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToForceChangeRateExtensionsTests { [Fact] public void NumberToCentinewtonsPerSecondTest() => - Assert.Equal(ForceChangeRate.FromCentinewtonsPerSecond(2), 2.CentinewtonsPerSecond()); + Assert.Equal(ForceChangeRate.FromCentinewtonsPerSecond(2), 2.CentinewtonsPerSecond()); [Fact] public void NumberToDecanewtonsPerMinuteTest() => - Assert.Equal(ForceChangeRate.FromDecanewtonsPerMinute(2), 2.DecanewtonsPerMinute()); + Assert.Equal(ForceChangeRate.FromDecanewtonsPerMinute(2), 2.DecanewtonsPerMinute()); [Fact] public void NumberToDecanewtonsPerSecondTest() => - Assert.Equal(ForceChangeRate.FromDecanewtonsPerSecond(2), 2.DecanewtonsPerSecond()); + Assert.Equal(ForceChangeRate.FromDecanewtonsPerSecond(2), 2.DecanewtonsPerSecond()); [Fact] public void NumberToDecinewtonsPerSecondTest() => - Assert.Equal(ForceChangeRate.FromDecinewtonsPerSecond(2), 2.DecinewtonsPerSecond()); + Assert.Equal(ForceChangeRate.FromDecinewtonsPerSecond(2), 2.DecinewtonsPerSecond()); [Fact] public void NumberToKilonewtonsPerMinuteTest() => - Assert.Equal(ForceChangeRate.FromKilonewtonsPerMinute(2), 2.KilonewtonsPerMinute()); + Assert.Equal(ForceChangeRate.FromKilonewtonsPerMinute(2), 2.KilonewtonsPerMinute()); [Fact] public void NumberToKilonewtonsPerSecondTest() => - Assert.Equal(ForceChangeRate.FromKilonewtonsPerSecond(2), 2.KilonewtonsPerSecond()); + Assert.Equal(ForceChangeRate.FromKilonewtonsPerSecond(2), 2.KilonewtonsPerSecond()); [Fact] public void NumberToMicronewtonsPerSecondTest() => - Assert.Equal(ForceChangeRate.FromMicronewtonsPerSecond(2), 2.MicronewtonsPerSecond()); + Assert.Equal(ForceChangeRate.FromMicronewtonsPerSecond(2), 2.MicronewtonsPerSecond()); [Fact] public void NumberToMillinewtonsPerSecondTest() => - Assert.Equal(ForceChangeRate.FromMillinewtonsPerSecond(2), 2.MillinewtonsPerSecond()); + Assert.Equal(ForceChangeRate.FromMillinewtonsPerSecond(2), 2.MillinewtonsPerSecond()); [Fact] public void NumberToNanonewtonsPerSecondTest() => - Assert.Equal(ForceChangeRate.FromNanonewtonsPerSecond(2), 2.NanonewtonsPerSecond()); + Assert.Equal(ForceChangeRate.FromNanonewtonsPerSecond(2), 2.NanonewtonsPerSecond()); [Fact] public void NumberToNewtonsPerMinuteTest() => - Assert.Equal(ForceChangeRate.FromNewtonsPerMinute(2), 2.NewtonsPerMinute()); + Assert.Equal(ForceChangeRate.FromNewtonsPerMinute(2), 2.NewtonsPerMinute()); [Fact] public void NumberToNewtonsPerSecondTest() => - Assert.Equal(ForceChangeRate.FromNewtonsPerSecond(2), 2.NewtonsPerSecond()); + Assert.Equal(ForceChangeRate.FromNewtonsPerSecond(2), 2.NewtonsPerSecond()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToForceExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToForceExtensionsTest.g.cs index 1345478ea8..c102db43bf 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToForceExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToForceExtensionsTest.g.cs @@ -21,68 +21,68 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToForceExtensionsTests { [Fact] public void NumberToDecanewtonsTest() => - Assert.Equal(Force.FromDecanewtons(2), 2.Decanewtons()); + Assert.Equal(Force.FromDecanewtons(2), 2.Decanewtons()); [Fact] public void NumberToDyneTest() => - Assert.Equal(Force.FromDyne(2), 2.Dyne()); + Assert.Equal(Force.FromDyne(2), 2.Dyne()); [Fact] public void NumberToKilogramsForceTest() => - Assert.Equal(Force.FromKilogramsForce(2), 2.KilogramsForce()); + Assert.Equal(Force.FromKilogramsForce(2), 2.KilogramsForce()); [Fact] public void NumberToKilonewtonsTest() => - Assert.Equal(Force.FromKilonewtons(2), 2.Kilonewtons()); + Assert.Equal(Force.FromKilonewtons(2), 2.Kilonewtons()); [Fact] public void NumberToKiloPondsTest() => - Assert.Equal(Force.FromKiloPonds(2), 2.KiloPonds()); + Assert.Equal(Force.FromKiloPonds(2), 2.KiloPonds()); [Fact] public void NumberToKilopoundsForceTest() => - Assert.Equal(Force.FromKilopoundsForce(2), 2.KilopoundsForce()); + Assert.Equal(Force.FromKilopoundsForce(2), 2.KilopoundsForce()); [Fact] public void NumberToMeganewtonsTest() => - Assert.Equal(Force.FromMeganewtons(2), 2.Meganewtons()); + Assert.Equal(Force.FromMeganewtons(2), 2.Meganewtons()); [Fact] public void NumberToMicronewtonsTest() => - Assert.Equal(Force.FromMicronewtons(2), 2.Micronewtons()); + Assert.Equal(Force.FromMicronewtons(2), 2.Micronewtons()); [Fact] public void NumberToMillinewtonsTest() => - Assert.Equal(Force.FromMillinewtons(2), 2.Millinewtons()); + Assert.Equal(Force.FromMillinewtons(2), 2.Millinewtons()); [Fact] public void NumberToNewtonsTest() => - Assert.Equal(Force.FromNewtons(2), 2.Newtons()); + Assert.Equal(Force.FromNewtons(2), 2.Newtons()); [Fact] public void NumberToOunceForceTest() => - Assert.Equal(Force.FromOunceForce(2), 2.OunceForce()); + Assert.Equal(Force.FromOunceForce(2), 2.OunceForce()); [Fact] public void NumberToPoundalsTest() => - Assert.Equal(Force.FromPoundals(2), 2.Poundals()); + Assert.Equal(Force.FromPoundals(2), 2.Poundals()); [Fact] public void NumberToPoundsForceTest() => - Assert.Equal(Force.FromPoundsForce(2), 2.PoundsForce()); + Assert.Equal(Force.FromPoundsForce(2), 2.PoundsForce()); [Fact] public void NumberToShortTonsForceTest() => - Assert.Equal(Force.FromShortTonsForce(2), 2.ShortTonsForce()); + Assert.Equal(Force.FromShortTonsForce(2), 2.ShortTonsForce()); [Fact] public void NumberToTonnesForceTest() => - Assert.Equal(Force.FromTonnesForce(2), 2.TonnesForce()); + Assert.Equal(Force.FromTonnesForce(2), 2.TonnesForce()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToForcePerLengthExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToForcePerLengthExtensionsTest.g.cs index f8d99915a6..9ccad9ca5f 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToForcePerLengthExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToForcePerLengthExtensionsTest.g.cs @@ -21,160 +21,160 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToForcePerLengthExtensionsTests { [Fact] public void NumberToCentinewtonsPerCentimeterTest() => - Assert.Equal(ForcePerLength.FromCentinewtonsPerCentimeter(2), 2.CentinewtonsPerCentimeter()); + Assert.Equal(ForcePerLength.FromCentinewtonsPerCentimeter(2), 2.CentinewtonsPerCentimeter()); [Fact] public void NumberToCentinewtonsPerMeterTest() => - Assert.Equal(ForcePerLength.FromCentinewtonsPerMeter(2), 2.CentinewtonsPerMeter()); + Assert.Equal(ForcePerLength.FromCentinewtonsPerMeter(2), 2.CentinewtonsPerMeter()); [Fact] public void NumberToCentinewtonsPerMillimeterTest() => - Assert.Equal(ForcePerLength.FromCentinewtonsPerMillimeter(2), 2.CentinewtonsPerMillimeter()); + Assert.Equal(ForcePerLength.FromCentinewtonsPerMillimeter(2), 2.CentinewtonsPerMillimeter()); [Fact] public void NumberToDecanewtonsPerCentimeterTest() => - Assert.Equal(ForcePerLength.FromDecanewtonsPerCentimeter(2), 2.DecanewtonsPerCentimeter()); + Assert.Equal(ForcePerLength.FromDecanewtonsPerCentimeter(2), 2.DecanewtonsPerCentimeter()); [Fact] public void NumberToDecanewtonsPerMeterTest() => - Assert.Equal(ForcePerLength.FromDecanewtonsPerMeter(2), 2.DecanewtonsPerMeter()); + Assert.Equal(ForcePerLength.FromDecanewtonsPerMeter(2), 2.DecanewtonsPerMeter()); [Fact] public void NumberToDecanewtonsPerMillimeterTest() => - Assert.Equal(ForcePerLength.FromDecanewtonsPerMillimeter(2), 2.DecanewtonsPerMillimeter()); + Assert.Equal(ForcePerLength.FromDecanewtonsPerMillimeter(2), 2.DecanewtonsPerMillimeter()); [Fact] public void NumberToDecinewtonsPerCentimeterTest() => - Assert.Equal(ForcePerLength.FromDecinewtonsPerCentimeter(2), 2.DecinewtonsPerCentimeter()); + Assert.Equal(ForcePerLength.FromDecinewtonsPerCentimeter(2), 2.DecinewtonsPerCentimeter()); [Fact] public void NumberToDecinewtonsPerMeterTest() => - Assert.Equal(ForcePerLength.FromDecinewtonsPerMeter(2), 2.DecinewtonsPerMeter()); + Assert.Equal(ForcePerLength.FromDecinewtonsPerMeter(2), 2.DecinewtonsPerMeter()); [Fact] public void NumberToDecinewtonsPerMillimeterTest() => - Assert.Equal(ForcePerLength.FromDecinewtonsPerMillimeter(2), 2.DecinewtonsPerMillimeter()); + Assert.Equal(ForcePerLength.FromDecinewtonsPerMillimeter(2), 2.DecinewtonsPerMillimeter()); [Fact] public void NumberToKilogramsForcePerCentimeterTest() => - Assert.Equal(ForcePerLength.FromKilogramsForcePerCentimeter(2), 2.KilogramsForcePerCentimeter()); + Assert.Equal(ForcePerLength.FromKilogramsForcePerCentimeter(2), 2.KilogramsForcePerCentimeter()); [Fact] public void NumberToKilogramsForcePerMeterTest() => - Assert.Equal(ForcePerLength.FromKilogramsForcePerMeter(2), 2.KilogramsForcePerMeter()); + Assert.Equal(ForcePerLength.FromKilogramsForcePerMeter(2), 2.KilogramsForcePerMeter()); [Fact] public void NumberToKilogramsForcePerMillimeterTest() => - Assert.Equal(ForcePerLength.FromKilogramsForcePerMillimeter(2), 2.KilogramsForcePerMillimeter()); + Assert.Equal(ForcePerLength.FromKilogramsForcePerMillimeter(2), 2.KilogramsForcePerMillimeter()); [Fact] public void NumberToKilonewtonsPerCentimeterTest() => - Assert.Equal(ForcePerLength.FromKilonewtonsPerCentimeter(2), 2.KilonewtonsPerCentimeter()); + Assert.Equal(ForcePerLength.FromKilonewtonsPerCentimeter(2), 2.KilonewtonsPerCentimeter()); [Fact] public void NumberToKilonewtonsPerMeterTest() => - Assert.Equal(ForcePerLength.FromKilonewtonsPerMeter(2), 2.KilonewtonsPerMeter()); + Assert.Equal(ForcePerLength.FromKilonewtonsPerMeter(2), 2.KilonewtonsPerMeter()); [Fact] public void NumberToKilonewtonsPerMillimeterTest() => - Assert.Equal(ForcePerLength.FromKilonewtonsPerMillimeter(2), 2.KilonewtonsPerMillimeter()); + Assert.Equal(ForcePerLength.FromKilonewtonsPerMillimeter(2), 2.KilonewtonsPerMillimeter()); [Fact] public void NumberToKilopoundsForcePerFootTest() => - Assert.Equal(ForcePerLength.FromKilopoundsForcePerFoot(2), 2.KilopoundsForcePerFoot()); + Assert.Equal(ForcePerLength.FromKilopoundsForcePerFoot(2), 2.KilopoundsForcePerFoot()); [Fact] public void NumberToKilopoundsForcePerInchTest() => - Assert.Equal(ForcePerLength.FromKilopoundsForcePerInch(2), 2.KilopoundsForcePerInch()); + Assert.Equal(ForcePerLength.FromKilopoundsForcePerInch(2), 2.KilopoundsForcePerInch()); [Fact] public void NumberToMeganewtonsPerCentimeterTest() => - Assert.Equal(ForcePerLength.FromMeganewtonsPerCentimeter(2), 2.MeganewtonsPerCentimeter()); + Assert.Equal(ForcePerLength.FromMeganewtonsPerCentimeter(2), 2.MeganewtonsPerCentimeter()); [Fact] public void NumberToMeganewtonsPerMeterTest() => - Assert.Equal(ForcePerLength.FromMeganewtonsPerMeter(2), 2.MeganewtonsPerMeter()); + Assert.Equal(ForcePerLength.FromMeganewtonsPerMeter(2), 2.MeganewtonsPerMeter()); [Fact] public void NumberToMeganewtonsPerMillimeterTest() => - Assert.Equal(ForcePerLength.FromMeganewtonsPerMillimeter(2), 2.MeganewtonsPerMillimeter()); + Assert.Equal(ForcePerLength.FromMeganewtonsPerMillimeter(2), 2.MeganewtonsPerMillimeter()); [Fact] public void NumberToMicronewtonsPerCentimeterTest() => - Assert.Equal(ForcePerLength.FromMicronewtonsPerCentimeter(2), 2.MicronewtonsPerCentimeter()); + Assert.Equal(ForcePerLength.FromMicronewtonsPerCentimeter(2), 2.MicronewtonsPerCentimeter()); [Fact] public void NumberToMicronewtonsPerMeterTest() => - Assert.Equal(ForcePerLength.FromMicronewtonsPerMeter(2), 2.MicronewtonsPerMeter()); + Assert.Equal(ForcePerLength.FromMicronewtonsPerMeter(2), 2.MicronewtonsPerMeter()); [Fact] public void NumberToMicronewtonsPerMillimeterTest() => - Assert.Equal(ForcePerLength.FromMicronewtonsPerMillimeter(2), 2.MicronewtonsPerMillimeter()); + Assert.Equal(ForcePerLength.FromMicronewtonsPerMillimeter(2), 2.MicronewtonsPerMillimeter()); [Fact] public void NumberToMillinewtonsPerCentimeterTest() => - Assert.Equal(ForcePerLength.FromMillinewtonsPerCentimeter(2), 2.MillinewtonsPerCentimeter()); + Assert.Equal(ForcePerLength.FromMillinewtonsPerCentimeter(2), 2.MillinewtonsPerCentimeter()); [Fact] public void NumberToMillinewtonsPerMeterTest() => - Assert.Equal(ForcePerLength.FromMillinewtonsPerMeter(2), 2.MillinewtonsPerMeter()); + Assert.Equal(ForcePerLength.FromMillinewtonsPerMeter(2), 2.MillinewtonsPerMeter()); [Fact] public void NumberToMillinewtonsPerMillimeterTest() => - Assert.Equal(ForcePerLength.FromMillinewtonsPerMillimeter(2), 2.MillinewtonsPerMillimeter()); + Assert.Equal(ForcePerLength.FromMillinewtonsPerMillimeter(2), 2.MillinewtonsPerMillimeter()); [Fact] public void NumberToNanonewtonsPerCentimeterTest() => - Assert.Equal(ForcePerLength.FromNanonewtonsPerCentimeter(2), 2.NanonewtonsPerCentimeter()); + Assert.Equal(ForcePerLength.FromNanonewtonsPerCentimeter(2), 2.NanonewtonsPerCentimeter()); [Fact] public void NumberToNanonewtonsPerMeterTest() => - Assert.Equal(ForcePerLength.FromNanonewtonsPerMeter(2), 2.NanonewtonsPerMeter()); + Assert.Equal(ForcePerLength.FromNanonewtonsPerMeter(2), 2.NanonewtonsPerMeter()); [Fact] public void NumberToNanonewtonsPerMillimeterTest() => - Assert.Equal(ForcePerLength.FromNanonewtonsPerMillimeter(2), 2.NanonewtonsPerMillimeter()); + Assert.Equal(ForcePerLength.FromNanonewtonsPerMillimeter(2), 2.NanonewtonsPerMillimeter()); [Fact] public void NumberToNewtonsPerCentimeterTest() => - Assert.Equal(ForcePerLength.FromNewtonsPerCentimeter(2), 2.NewtonsPerCentimeter()); + Assert.Equal(ForcePerLength.FromNewtonsPerCentimeter(2), 2.NewtonsPerCentimeter()); [Fact] public void NumberToNewtonsPerMeterTest() => - Assert.Equal(ForcePerLength.FromNewtonsPerMeter(2), 2.NewtonsPerMeter()); + Assert.Equal(ForcePerLength.FromNewtonsPerMeter(2), 2.NewtonsPerMeter()); [Fact] public void NumberToNewtonsPerMillimeterTest() => - Assert.Equal(ForcePerLength.FromNewtonsPerMillimeter(2), 2.NewtonsPerMillimeter()); + Assert.Equal(ForcePerLength.FromNewtonsPerMillimeter(2), 2.NewtonsPerMillimeter()); [Fact] public void NumberToPoundsForcePerFootTest() => - Assert.Equal(ForcePerLength.FromPoundsForcePerFoot(2), 2.PoundsForcePerFoot()); + Assert.Equal(ForcePerLength.FromPoundsForcePerFoot(2), 2.PoundsForcePerFoot()); [Fact] public void NumberToPoundsForcePerInchTest() => - Assert.Equal(ForcePerLength.FromPoundsForcePerInch(2), 2.PoundsForcePerInch()); + Assert.Equal(ForcePerLength.FromPoundsForcePerInch(2), 2.PoundsForcePerInch()); [Fact] public void NumberToPoundsForcePerYardTest() => - Assert.Equal(ForcePerLength.FromPoundsForcePerYard(2), 2.PoundsForcePerYard()); + Assert.Equal(ForcePerLength.FromPoundsForcePerYard(2), 2.PoundsForcePerYard()); [Fact] public void NumberToTonnesForcePerCentimeterTest() => - Assert.Equal(ForcePerLength.FromTonnesForcePerCentimeter(2), 2.TonnesForcePerCentimeter()); + Assert.Equal(ForcePerLength.FromTonnesForcePerCentimeter(2), 2.TonnesForcePerCentimeter()); [Fact] public void NumberToTonnesForcePerMeterTest() => - Assert.Equal(ForcePerLength.FromTonnesForcePerMeter(2), 2.TonnesForcePerMeter()); + Assert.Equal(ForcePerLength.FromTonnesForcePerMeter(2), 2.TonnesForcePerMeter()); [Fact] public void NumberToTonnesForcePerMillimeterTest() => - Assert.Equal(ForcePerLength.FromTonnesForcePerMillimeter(2), 2.TonnesForcePerMillimeter()); + Assert.Equal(ForcePerLength.FromTonnesForcePerMillimeter(2), 2.TonnesForcePerMillimeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToFrequencyExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToFrequencyExtensionsTest.g.cs index 77824e7c6a..8e20b4f9d2 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToFrequencyExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToFrequencyExtensionsTest.g.cs @@ -21,48 +21,48 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToFrequencyExtensionsTests { [Fact] public void NumberToBeatsPerMinuteTest() => - Assert.Equal(Frequency.FromBeatsPerMinute(2), 2.BeatsPerMinute()); + Assert.Equal(Frequency.FromBeatsPerMinute(2), 2.BeatsPerMinute()); [Fact] public void NumberToCyclesPerHourTest() => - Assert.Equal(Frequency.FromCyclesPerHour(2), 2.CyclesPerHour()); + Assert.Equal(Frequency.FromCyclesPerHour(2), 2.CyclesPerHour()); [Fact] public void NumberToCyclesPerMinuteTest() => - Assert.Equal(Frequency.FromCyclesPerMinute(2), 2.CyclesPerMinute()); + Assert.Equal(Frequency.FromCyclesPerMinute(2), 2.CyclesPerMinute()); [Fact] public void NumberToGigahertzTest() => - Assert.Equal(Frequency.FromGigahertz(2), 2.Gigahertz()); + Assert.Equal(Frequency.FromGigahertz(2), 2.Gigahertz()); [Fact] public void NumberToHertzTest() => - Assert.Equal(Frequency.FromHertz(2), 2.Hertz()); + Assert.Equal(Frequency.FromHertz(2), 2.Hertz()); [Fact] public void NumberToKilohertzTest() => - Assert.Equal(Frequency.FromKilohertz(2), 2.Kilohertz()); + Assert.Equal(Frequency.FromKilohertz(2), 2.Kilohertz()); [Fact] public void NumberToMegahertzTest() => - Assert.Equal(Frequency.FromMegahertz(2), 2.Megahertz()); + Assert.Equal(Frequency.FromMegahertz(2), 2.Megahertz()); [Fact] public void NumberToPerSecondTest() => - Assert.Equal(Frequency.FromPerSecond(2), 2.PerSecond()); + Assert.Equal(Frequency.FromPerSecond(2), 2.PerSecond()); [Fact] public void NumberToRadiansPerSecondTest() => - Assert.Equal(Frequency.FromRadiansPerSecond(2), 2.RadiansPerSecond()); + Assert.Equal(Frequency.FromRadiansPerSecond(2), 2.RadiansPerSecond()); [Fact] public void NumberToTerahertzTest() => - Assert.Equal(Frequency.FromTerahertz(2), 2.Terahertz()); + Assert.Equal(Frequency.FromTerahertz(2), 2.Terahertz()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToFuelEfficiencyExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToFuelEfficiencyExtensionsTest.g.cs index a4a8ef5c87..1de68f5b66 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToFuelEfficiencyExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToFuelEfficiencyExtensionsTest.g.cs @@ -21,24 +21,24 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToFuelEfficiencyExtensionsTests { [Fact] public void NumberToKilometersPerLitersTest() => - Assert.Equal(FuelEfficiency.FromKilometersPerLiters(2), 2.KilometersPerLiters()); + Assert.Equal(FuelEfficiency.FromKilometersPerLiters(2), 2.KilometersPerLiters()); [Fact] public void NumberToLitersPer100KilometersTest() => - Assert.Equal(FuelEfficiency.FromLitersPer100Kilometers(2), 2.LitersPer100Kilometers()); + Assert.Equal(FuelEfficiency.FromLitersPer100Kilometers(2), 2.LitersPer100Kilometers()); [Fact] public void NumberToMilesPerUkGallonTest() => - Assert.Equal(FuelEfficiency.FromMilesPerUkGallon(2), 2.MilesPerUkGallon()); + Assert.Equal(FuelEfficiency.FromMilesPerUkGallon(2), 2.MilesPerUkGallon()); [Fact] public void NumberToMilesPerUsGallonTest() => - Assert.Equal(FuelEfficiency.FromMilesPerUsGallon(2), 2.MilesPerUsGallon()); + Assert.Equal(FuelEfficiency.FromMilesPerUsGallon(2), 2.MilesPerUsGallon()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToHeatFluxExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToHeatFluxExtensionsTest.g.cs index 1c6e35a100..2df8a1c78a 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToHeatFluxExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToHeatFluxExtensionsTest.g.cs @@ -21,80 +21,80 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToHeatFluxExtensionsTests { [Fact] public void NumberToBtusPerHourSquareFootTest() => - Assert.Equal(HeatFlux.FromBtusPerHourSquareFoot(2), 2.BtusPerHourSquareFoot()); + Assert.Equal(HeatFlux.FromBtusPerHourSquareFoot(2), 2.BtusPerHourSquareFoot()); [Fact] public void NumberToBtusPerMinuteSquareFootTest() => - Assert.Equal(HeatFlux.FromBtusPerMinuteSquareFoot(2), 2.BtusPerMinuteSquareFoot()); + Assert.Equal(HeatFlux.FromBtusPerMinuteSquareFoot(2), 2.BtusPerMinuteSquareFoot()); [Fact] public void NumberToBtusPerSecondSquareFootTest() => - Assert.Equal(HeatFlux.FromBtusPerSecondSquareFoot(2), 2.BtusPerSecondSquareFoot()); + Assert.Equal(HeatFlux.FromBtusPerSecondSquareFoot(2), 2.BtusPerSecondSquareFoot()); [Fact] public void NumberToBtusPerSecondSquareInchTest() => - Assert.Equal(HeatFlux.FromBtusPerSecondSquareInch(2), 2.BtusPerSecondSquareInch()); + Assert.Equal(HeatFlux.FromBtusPerSecondSquareInch(2), 2.BtusPerSecondSquareInch()); [Fact] public void NumberToCaloriesPerSecondSquareCentimeterTest() => - Assert.Equal(HeatFlux.FromCaloriesPerSecondSquareCentimeter(2), 2.CaloriesPerSecondSquareCentimeter()); + Assert.Equal(HeatFlux.FromCaloriesPerSecondSquareCentimeter(2), 2.CaloriesPerSecondSquareCentimeter()); [Fact] public void NumberToCentiwattsPerSquareMeterTest() => - Assert.Equal(HeatFlux.FromCentiwattsPerSquareMeter(2), 2.CentiwattsPerSquareMeter()); + Assert.Equal(HeatFlux.FromCentiwattsPerSquareMeter(2), 2.CentiwattsPerSquareMeter()); [Fact] public void NumberToDeciwattsPerSquareMeterTest() => - Assert.Equal(HeatFlux.FromDeciwattsPerSquareMeter(2), 2.DeciwattsPerSquareMeter()); + Assert.Equal(HeatFlux.FromDeciwattsPerSquareMeter(2), 2.DeciwattsPerSquareMeter()); [Fact] public void NumberToKilocaloriesPerHourSquareMeterTest() => - Assert.Equal(HeatFlux.FromKilocaloriesPerHourSquareMeter(2), 2.KilocaloriesPerHourSquareMeter()); + Assert.Equal(HeatFlux.FromKilocaloriesPerHourSquareMeter(2), 2.KilocaloriesPerHourSquareMeter()); [Fact] public void NumberToKilocaloriesPerSecondSquareCentimeterTest() => - Assert.Equal(HeatFlux.FromKilocaloriesPerSecondSquareCentimeter(2), 2.KilocaloriesPerSecondSquareCentimeter()); + Assert.Equal(HeatFlux.FromKilocaloriesPerSecondSquareCentimeter(2), 2.KilocaloriesPerSecondSquareCentimeter()); [Fact] public void NumberToKilowattsPerSquareMeterTest() => - Assert.Equal(HeatFlux.FromKilowattsPerSquareMeter(2), 2.KilowattsPerSquareMeter()); + Assert.Equal(HeatFlux.FromKilowattsPerSquareMeter(2), 2.KilowattsPerSquareMeter()); [Fact] public void NumberToMicrowattsPerSquareMeterTest() => - Assert.Equal(HeatFlux.FromMicrowattsPerSquareMeter(2), 2.MicrowattsPerSquareMeter()); + Assert.Equal(HeatFlux.FromMicrowattsPerSquareMeter(2), 2.MicrowattsPerSquareMeter()); [Fact] public void NumberToMilliwattsPerSquareMeterTest() => - Assert.Equal(HeatFlux.FromMilliwattsPerSquareMeter(2), 2.MilliwattsPerSquareMeter()); + Assert.Equal(HeatFlux.FromMilliwattsPerSquareMeter(2), 2.MilliwattsPerSquareMeter()); [Fact] public void NumberToNanowattsPerSquareMeterTest() => - Assert.Equal(HeatFlux.FromNanowattsPerSquareMeter(2), 2.NanowattsPerSquareMeter()); + Assert.Equal(HeatFlux.FromNanowattsPerSquareMeter(2), 2.NanowattsPerSquareMeter()); [Fact] public void NumberToPoundsForcePerFootSecondTest() => - Assert.Equal(HeatFlux.FromPoundsForcePerFootSecond(2), 2.PoundsForcePerFootSecond()); + Assert.Equal(HeatFlux.FromPoundsForcePerFootSecond(2), 2.PoundsForcePerFootSecond()); [Fact] public void NumberToPoundsPerSecondCubedTest() => - Assert.Equal(HeatFlux.FromPoundsPerSecondCubed(2), 2.PoundsPerSecondCubed()); + Assert.Equal(HeatFlux.FromPoundsPerSecondCubed(2), 2.PoundsPerSecondCubed()); [Fact] public void NumberToWattsPerSquareFootTest() => - Assert.Equal(HeatFlux.FromWattsPerSquareFoot(2), 2.WattsPerSquareFoot()); + Assert.Equal(HeatFlux.FromWattsPerSquareFoot(2), 2.WattsPerSquareFoot()); [Fact] public void NumberToWattsPerSquareInchTest() => - Assert.Equal(HeatFlux.FromWattsPerSquareInch(2), 2.WattsPerSquareInch()); + Assert.Equal(HeatFlux.FromWattsPerSquareInch(2), 2.WattsPerSquareInch()); [Fact] public void NumberToWattsPerSquareMeterTest() => - Assert.Equal(HeatFlux.FromWattsPerSquareMeter(2), 2.WattsPerSquareMeter()); + Assert.Equal(HeatFlux.FromWattsPerSquareMeter(2), 2.WattsPerSquareMeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToHeatTransferCoefficientExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToHeatTransferCoefficientExtensionsTest.g.cs index 511070611b..86cc63440e 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToHeatTransferCoefficientExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToHeatTransferCoefficientExtensionsTest.g.cs @@ -21,20 +21,20 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToHeatTransferCoefficientExtensionsTests { [Fact] public void NumberToBtusPerSquareFootDegreeFahrenheitTest() => - Assert.Equal(HeatTransferCoefficient.FromBtusPerSquareFootDegreeFahrenheit(2), 2.BtusPerSquareFootDegreeFahrenheit()); + Assert.Equal(HeatTransferCoefficient.FromBtusPerSquareFootDegreeFahrenheit(2), 2.BtusPerSquareFootDegreeFahrenheit()); [Fact] public void NumberToWattsPerSquareMeterCelsiusTest() => - Assert.Equal(HeatTransferCoefficient.FromWattsPerSquareMeterCelsius(2), 2.WattsPerSquareMeterCelsius()); + Assert.Equal(HeatTransferCoefficient.FromWattsPerSquareMeterCelsius(2), 2.WattsPerSquareMeterCelsius()); [Fact] public void NumberToWattsPerSquareMeterKelvinTest() => - Assert.Equal(HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(2), 2.WattsPerSquareMeterKelvin()); + Assert.Equal(HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(2), 2.WattsPerSquareMeterKelvin()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToIlluminanceExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToIlluminanceExtensionsTest.g.cs index f39ff3cdbd..525204a5c3 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToIlluminanceExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToIlluminanceExtensionsTest.g.cs @@ -21,24 +21,24 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToIlluminanceExtensionsTests { [Fact] public void NumberToKiloluxTest() => - Assert.Equal(Illuminance.FromKilolux(2), 2.Kilolux()); + Assert.Equal(Illuminance.FromKilolux(2), 2.Kilolux()); [Fact] public void NumberToLuxTest() => - Assert.Equal(Illuminance.FromLux(2), 2.Lux()); + Assert.Equal(Illuminance.FromLux(2), 2.Lux()); [Fact] public void NumberToMegaluxTest() => - Assert.Equal(Illuminance.FromMegalux(2), 2.Megalux()); + Assert.Equal(Illuminance.FromMegalux(2), 2.Megalux()); [Fact] public void NumberToMilliluxTest() => - Assert.Equal(Illuminance.FromMillilux(2), 2.Millilux()); + Assert.Equal(Illuminance.FromMillilux(2), 2.Millilux()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToInformationExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToInformationExtensionsTest.g.cs index 3f566f4025..0e7247cc02 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToInformationExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToInformationExtensionsTest.g.cs @@ -21,112 +21,112 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToInformationExtensionsTests { [Fact] public void NumberToBitsTest() => - Assert.Equal(Information.FromBits(2), 2.Bits()); + Assert.Equal(Information.FromBits(2), 2.Bits()); [Fact] public void NumberToBytesTest() => - Assert.Equal(Information.FromBytes(2), 2.Bytes()); + Assert.Equal(Information.FromBytes(2), 2.Bytes()); [Fact] public void NumberToExabitsTest() => - Assert.Equal(Information.FromExabits(2), 2.Exabits()); + Assert.Equal(Information.FromExabits(2), 2.Exabits()); [Fact] public void NumberToExabytesTest() => - Assert.Equal(Information.FromExabytes(2), 2.Exabytes()); + Assert.Equal(Information.FromExabytes(2), 2.Exabytes()); [Fact] public void NumberToExbibitsTest() => - Assert.Equal(Information.FromExbibits(2), 2.Exbibits()); + Assert.Equal(Information.FromExbibits(2), 2.Exbibits()); [Fact] public void NumberToExbibytesTest() => - Assert.Equal(Information.FromExbibytes(2), 2.Exbibytes()); + Assert.Equal(Information.FromExbibytes(2), 2.Exbibytes()); [Fact] public void NumberToGibibitsTest() => - Assert.Equal(Information.FromGibibits(2), 2.Gibibits()); + Assert.Equal(Information.FromGibibits(2), 2.Gibibits()); [Fact] public void NumberToGibibytesTest() => - Assert.Equal(Information.FromGibibytes(2), 2.Gibibytes()); + Assert.Equal(Information.FromGibibytes(2), 2.Gibibytes()); [Fact] public void NumberToGigabitsTest() => - Assert.Equal(Information.FromGigabits(2), 2.Gigabits()); + Assert.Equal(Information.FromGigabits(2), 2.Gigabits()); [Fact] public void NumberToGigabytesTest() => - Assert.Equal(Information.FromGigabytes(2), 2.Gigabytes()); + Assert.Equal(Information.FromGigabytes(2), 2.Gigabytes()); [Fact] public void NumberToKibibitsTest() => - Assert.Equal(Information.FromKibibits(2), 2.Kibibits()); + Assert.Equal(Information.FromKibibits(2), 2.Kibibits()); [Fact] public void NumberToKibibytesTest() => - Assert.Equal(Information.FromKibibytes(2), 2.Kibibytes()); + Assert.Equal(Information.FromKibibytes(2), 2.Kibibytes()); [Fact] public void NumberToKilobitsTest() => - Assert.Equal(Information.FromKilobits(2), 2.Kilobits()); + Assert.Equal(Information.FromKilobits(2), 2.Kilobits()); [Fact] public void NumberToKilobytesTest() => - Assert.Equal(Information.FromKilobytes(2), 2.Kilobytes()); + Assert.Equal(Information.FromKilobytes(2), 2.Kilobytes()); [Fact] public void NumberToMebibitsTest() => - Assert.Equal(Information.FromMebibits(2), 2.Mebibits()); + Assert.Equal(Information.FromMebibits(2), 2.Mebibits()); [Fact] public void NumberToMebibytesTest() => - Assert.Equal(Information.FromMebibytes(2), 2.Mebibytes()); + Assert.Equal(Information.FromMebibytes(2), 2.Mebibytes()); [Fact] public void NumberToMegabitsTest() => - Assert.Equal(Information.FromMegabits(2), 2.Megabits()); + Assert.Equal(Information.FromMegabits(2), 2.Megabits()); [Fact] public void NumberToMegabytesTest() => - Assert.Equal(Information.FromMegabytes(2), 2.Megabytes()); + Assert.Equal(Information.FromMegabytes(2), 2.Megabytes()); [Fact] public void NumberToPebibitsTest() => - Assert.Equal(Information.FromPebibits(2), 2.Pebibits()); + Assert.Equal(Information.FromPebibits(2), 2.Pebibits()); [Fact] public void NumberToPebibytesTest() => - Assert.Equal(Information.FromPebibytes(2), 2.Pebibytes()); + Assert.Equal(Information.FromPebibytes(2), 2.Pebibytes()); [Fact] public void NumberToPetabitsTest() => - Assert.Equal(Information.FromPetabits(2), 2.Petabits()); + Assert.Equal(Information.FromPetabits(2), 2.Petabits()); [Fact] public void NumberToPetabytesTest() => - Assert.Equal(Information.FromPetabytes(2), 2.Petabytes()); + Assert.Equal(Information.FromPetabytes(2), 2.Petabytes()); [Fact] public void NumberToTebibitsTest() => - Assert.Equal(Information.FromTebibits(2), 2.Tebibits()); + Assert.Equal(Information.FromTebibits(2), 2.Tebibits()); [Fact] public void NumberToTebibytesTest() => - Assert.Equal(Information.FromTebibytes(2), 2.Tebibytes()); + Assert.Equal(Information.FromTebibytes(2), 2.Tebibytes()); [Fact] public void NumberToTerabitsTest() => - Assert.Equal(Information.FromTerabits(2), 2.Terabits()); + Assert.Equal(Information.FromTerabits(2), 2.Terabits()); [Fact] public void NumberToTerabytesTest() => - Assert.Equal(Information.FromTerabytes(2), 2.Terabytes()); + Assert.Equal(Information.FromTerabytes(2), 2.Terabytes()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToIrradianceExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToIrradianceExtensionsTest.g.cs index 93a9cb1cbc..5a174f3365 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToIrradianceExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToIrradianceExtensionsTest.g.cs @@ -21,64 +21,64 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToIrradianceExtensionsTests { [Fact] public void NumberToKilowattsPerSquareCentimeterTest() => - Assert.Equal(Irradiance.FromKilowattsPerSquareCentimeter(2), 2.KilowattsPerSquareCentimeter()); + Assert.Equal(Irradiance.FromKilowattsPerSquareCentimeter(2), 2.KilowattsPerSquareCentimeter()); [Fact] public void NumberToKilowattsPerSquareMeterTest() => - Assert.Equal(Irradiance.FromKilowattsPerSquareMeter(2), 2.KilowattsPerSquareMeter()); + Assert.Equal(Irradiance.FromKilowattsPerSquareMeter(2), 2.KilowattsPerSquareMeter()); [Fact] public void NumberToMegawattsPerSquareCentimeterTest() => - Assert.Equal(Irradiance.FromMegawattsPerSquareCentimeter(2), 2.MegawattsPerSquareCentimeter()); + Assert.Equal(Irradiance.FromMegawattsPerSquareCentimeter(2), 2.MegawattsPerSquareCentimeter()); [Fact] public void NumberToMegawattsPerSquareMeterTest() => - Assert.Equal(Irradiance.FromMegawattsPerSquareMeter(2), 2.MegawattsPerSquareMeter()); + Assert.Equal(Irradiance.FromMegawattsPerSquareMeter(2), 2.MegawattsPerSquareMeter()); [Fact] public void NumberToMicrowattsPerSquareCentimeterTest() => - Assert.Equal(Irradiance.FromMicrowattsPerSquareCentimeter(2), 2.MicrowattsPerSquareCentimeter()); + Assert.Equal(Irradiance.FromMicrowattsPerSquareCentimeter(2), 2.MicrowattsPerSquareCentimeter()); [Fact] public void NumberToMicrowattsPerSquareMeterTest() => - Assert.Equal(Irradiance.FromMicrowattsPerSquareMeter(2), 2.MicrowattsPerSquareMeter()); + Assert.Equal(Irradiance.FromMicrowattsPerSquareMeter(2), 2.MicrowattsPerSquareMeter()); [Fact] public void NumberToMilliwattsPerSquareCentimeterTest() => - Assert.Equal(Irradiance.FromMilliwattsPerSquareCentimeter(2), 2.MilliwattsPerSquareCentimeter()); + Assert.Equal(Irradiance.FromMilliwattsPerSquareCentimeter(2), 2.MilliwattsPerSquareCentimeter()); [Fact] public void NumberToMilliwattsPerSquareMeterTest() => - Assert.Equal(Irradiance.FromMilliwattsPerSquareMeter(2), 2.MilliwattsPerSquareMeter()); + Assert.Equal(Irradiance.FromMilliwattsPerSquareMeter(2), 2.MilliwattsPerSquareMeter()); [Fact] public void NumberToNanowattsPerSquareCentimeterTest() => - Assert.Equal(Irradiance.FromNanowattsPerSquareCentimeter(2), 2.NanowattsPerSquareCentimeter()); + Assert.Equal(Irradiance.FromNanowattsPerSquareCentimeter(2), 2.NanowattsPerSquareCentimeter()); [Fact] public void NumberToNanowattsPerSquareMeterTest() => - Assert.Equal(Irradiance.FromNanowattsPerSquareMeter(2), 2.NanowattsPerSquareMeter()); + Assert.Equal(Irradiance.FromNanowattsPerSquareMeter(2), 2.NanowattsPerSquareMeter()); [Fact] public void NumberToPicowattsPerSquareCentimeterTest() => - Assert.Equal(Irradiance.FromPicowattsPerSquareCentimeter(2), 2.PicowattsPerSquareCentimeter()); + Assert.Equal(Irradiance.FromPicowattsPerSquareCentimeter(2), 2.PicowattsPerSquareCentimeter()); [Fact] public void NumberToPicowattsPerSquareMeterTest() => - Assert.Equal(Irradiance.FromPicowattsPerSquareMeter(2), 2.PicowattsPerSquareMeter()); + Assert.Equal(Irradiance.FromPicowattsPerSquareMeter(2), 2.PicowattsPerSquareMeter()); [Fact] public void NumberToWattsPerSquareCentimeterTest() => - Assert.Equal(Irradiance.FromWattsPerSquareCentimeter(2), 2.WattsPerSquareCentimeter()); + Assert.Equal(Irradiance.FromWattsPerSquareCentimeter(2), 2.WattsPerSquareCentimeter()); [Fact] public void NumberToWattsPerSquareMeterTest() => - Assert.Equal(Irradiance.FromWattsPerSquareMeter(2), 2.WattsPerSquareMeter()); + Assert.Equal(Irradiance.FromWattsPerSquareMeter(2), 2.WattsPerSquareMeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToIrradiationExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToIrradiationExtensionsTest.g.cs index f14afa4cb6..c9d35ace1b 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToIrradiationExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToIrradiationExtensionsTest.g.cs @@ -21,36 +21,36 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToIrradiationExtensionsTests { [Fact] public void NumberToJoulesPerSquareCentimeterTest() => - Assert.Equal(Irradiation.FromJoulesPerSquareCentimeter(2), 2.JoulesPerSquareCentimeter()); + Assert.Equal(Irradiation.FromJoulesPerSquareCentimeter(2), 2.JoulesPerSquareCentimeter()); [Fact] public void NumberToJoulesPerSquareMeterTest() => - Assert.Equal(Irradiation.FromJoulesPerSquareMeter(2), 2.JoulesPerSquareMeter()); + Assert.Equal(Irradiation.FromJoulesPerSquareMeter(2), 2.JoulesPerSquareMeter()); [Fact] public void NumberToJoulesPerSquareMillimeterTest() => - Assert.Equal(Irradiation.FromJoulesPerSquareMillimeter(2), 2.JoulesPerSquareMillimeter()); + Assert.Equal(Irradiation.FromJoulesPerSquareMillimeter(2), 2.JoulesPerSquareMillimeter()); [Fact] public void NumberToKilojoulesPerSquareMeterTest() => - Assert.Equal(Irradiation.FromKilojoulesPerSquareMeter(2), 2.KilojoulesPerSquareMeter()); + Assert.Equal(Irradiation.FromKilojoulesPerSquareMeter(2), 2.KilojoulesPerSquareMeter()); [Fact] public void NumberToKilowattHoursPerSquareMeterTest() => - Assert.Equal(Irradiation.FromKilowattHoursPerSquareMeter(2), 2.KilowattHoursPerSquareMeter()); + Assert.Equal(Irradiation.FromKilowattHoursPerSquareMeter(2), 2.KilowattHoursPerSquareMeter()); [Fact] public void NumberToMillijoulesPerSquareCentimeterTest() => - Assert.Equal(Irradiation.FromMillijoulesPerSquareCentimeter(2), 2.MillijoulesPerSquareCentimeter()); + Assert.Equal(Irradiation.FromMillijoulesPerSquareCentimeter(2), 2.MillijoulesPerSquareCentimeter()); [Fact] public void NumberToWattHoursPerSquareMeterTest() => - Assert.Equal(Irradiation.FromWattHoursPerSquareMeter(2), 2.WattHoursPerSquareMeter()); + Assert.Equal(Irradiation.FromWattHoursPerSquareMeter(2), 2.WattHoursPerSquareMeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToKinematicViscosityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToKinematicViscosityExtensionsTest.g.cs index 54ac9d71c4..0700adaa86 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToKinematicViscosityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToKinematicViscosityExtensionsTest.g.cs @@ -21,40 +21,40 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToKinematicViscosityExtensionsTests { [Fact] public void NumberToCentistokesTest() => - Assert.Equal(KinematicViscosity.FromCentistokes(2), 2.Centistokes()); + Assert.Equal(KinematicViscosity.FromCentistokes(2), 2.Centistokes()); [Fact] public void NumberToDecistokesTest() => - Assert.Equal(KinematicViscosity.FromDecistokes(2), 2.Decistokes()); + Assert.Equal(KinematicViscosity.FromDecistokes(2), 2.Decistokes()); [Fact] public void NumberToKilostokesTest() => - Assert.Equal(KinematicViscosity.FromKilostokes(2), 2.Kilostokes()); + Assert.Equal(KinematicViscosity.FromKilostokes(2), 2.Kilostokes()); [Fact] public void NumberToMicrostokesTest() => - Assert.Equal(KinematicViscosity.FromMicrostokes(2), 2.Microstokes()); + Assert.Equal(KinematicViscosity.FromMicrostokes(2), 2.Microstokes()); [Fact] public void NumberToMillistokesTest() => - Assert.Equal(KinematicViscosity.FromMillistokes(2), 2.Millistokes()); + Assert.Equal(KinematicViscosity.FromMillistokes(2), 2.Millistokes()); [Fact] public void NumberToNanostokesTest() => - Assert.Equal(KinematicViscosity.FromNanostokes(2), 2.Nanostokes()); + Assert.Equal(KinematicViscosity.FromNanostokes(2), 2.Nanostokes()); [Fact] public void NumberToSquareMetersPerSecondTest() => - Assert.Equal(KinematicViscosity.FromSquareMetersPerSecond(2), 2.SquareMetersPerSecond()); + Assert.Equal(KinematicViscosity.FromSquareMetersPerSecond(2), 2.SquareMetersPerSecond()); [Fact] public void NumberToStokesTest() => - Assert.Equal(KinematicViscosity.FromStokes(2), 2.Stokes()); + Assert.Equal(KinematicViscosity.FromStokes(2), 2.Stokes()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLapseRateExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLapseRateExtensionsTest.g.cs index a18304b716..01584c0e49 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLapseRateExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLapseRateExtensionsTest.g.cs @@ -21,12 +21,12 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToLapseRateExtensionsTests { [Fact] public void NumberToDegreesCelciusPerKilometerTest() => - Assert.Equal(LapseRate.FromDegreesCelciusPerKilometer(2), 2.DegreesCelciusPerKilometer()); + Assert.Equal(LapseRate.FromDegreesCelciusPerKilometer(2), 2.DegreesCelciusPerKilometer()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLengthExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLengthExtensionsTest.g.cs index 0c2e369277..62faa858c1 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLengthExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLengthExtensionsTest.g.cs @@ -21,140 +21,140 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToLengthExtensionsTests { [Fact] public void NumberToAstronomicalUnitsTest() => - Assert.Equal(Length.FromAstronomicalUnits(2), 2.AstronomicalUnits()); + Assert.Equal(Length.FromAstronomicalUnits(2), 2.AstronomicalUnits()); [Fact] public void NumberToCentimetersTest() => - Assert.Equal(Length.FromCentimeters(2), 2.Centimeters()); + Assert.Equal(Length.FromCentimeters(2), 2.Centimeters()); [Fact] public void NumberToChainsTest() => - Assert.Equal(Length.FromChains(2), 2.Chains()); + Assert.Equal(Length.FromChains(2), 2.Chains()); [Fact] public void NumberToDecimetersTest() => - Assert.Equal(Length.FromDecimeters(2), 2.Decimeters()); + Assert.Equal(Length.FromDecimeters(2), 2.Decimeters()); [Fact] public void NumberToDtpPicasTest() => - Assert.Equal(Length.FromDtpPicas(2), 2.DtpPicas()); + Assert.Equal(Length.FromDtpPicas(2), 2.DtpPicas()); [Fact] public void NumberToDtpPointsTest() => - Assert.Equal(Length.FromDtpPoints(2), 2.DtpPoints()); + Assert.Equal(Length.FromDtpPoints(2), 2.DtpPoints()); [Fact] public void NumberToFathomsTest() => - Assert.Equal(Length.FromFathoms(2), 2.Fathoms()); + Assert.Equal(Length.FromFathoms(2), 2.Fathoms()); [Fact] public void NumberToFeetTest() => - Assert.Equal(Length.FromFeet(2), 2.Feet()); + Assert.Equal(Length.FromFeet(2), 2.Feet()); [Fact] public void NumberToHandsTest() => - Assert.Equal(Length.FromHands(2), 2.Hands()); + Assert.Equal(Length.FromHands(2), 2.Hands()); [Fact] public void NumberToHectometersTest() => - Assert.Equal(Length.FromHectometers(2), 2.Hectometers()); + Assert.Equal(Length.FromHectometers(2), 2.Hectometers()); [Fact] public void NumberToInchesTest() => - Assert.Equal(Length.FromInches(2), 2.Inches()); + Assert.Equal(Length.FromInches(2), 2.Inches()); [Fact] public void NumberToKilolightYearsTest() => - Assert.Equal(Length.FromKilolightYears(2), 2.KilolightYears()); + Assert.Equal(Length.FromKilolightYears(2), 2.KilolightYears()); [Fact] public void NumberToKilometersTest() => - Assert.Equal(Length.FromKilometers(2), 2.Kilometers()); + Assert.Equal(Length.FromKilometers(2), 2.Kilometers()); [Fact] public void NumberToKiloparsecsTest() => - Assert.Equal(Length.FromKiloparsecs(2), 2.Kiloparsecs()); + Assert.Equal(Length.FromKiloparsecs(2), 2.Kiloparsecs()); [Fact] public void NumberToLightYearsTest() => - Assert.Equal(Length.FromLightYears(2), 2.LightYears()); + Assert.Equal(Length.FromLightYears(2), 2.LightYears()); [Fact] public void NumberToMegalightYearsTest() => - Assert.Equal(Length.FromMegalightYears(2), 2.MegalightYears()); + Assert.Equal(Length.FromMegalightYears(2), 2.MegalightYears()); [Fact] public void NumberToMegaparsecsTest() => - Assert.Equal(Length.FromMegaparsecs(2), 2.Megaparsecs()); + Assert.Equal(Length.FromMegaparsecs(2), 2.Megaparsecs()); [Fact] public void NumberToMetersTest() => - Assert.Equal(Length.FromMeters(2), 2.Meters()); + Assert.Equal(Length.FromMeters(2), 2.Meters()); [Fact] public void NumberToMicroinchesTest() => - Assert.Equal(Length.FromMicroinches(2), 2.Microinches()); + Assert.Equal(Length.FromMicroinches(2), 2.Microinches()); [Fact] public void NumberToMicrometersTest() => - Assert.Equal(Length.FromMicrometers(2), 2.Micrometers()); + Assert.Equal(Length.FromMicrometers(2), 2.Micrometers()); [Fact] public void NumberToMilsTest() => - Assert.Equal(Length.FromMils(2), 2.Mils()); + Assert.Equal(Length.FromMils(2), 2.Mils()); [Fact] public void NumberToMilesTest() => - Assert.Equal(Length.FromMiles(2), 2.Miles()); + Assert.Equal(Length.FromMiles(2), 2.Miles()); [Fact] public void NumberToMillimetersTest() => - Assert.Equal(Length.FromMillimeters(2), 2.Millimeters()); + Assert.Equal(Length.FromMillimeters(2), 2.Millimeters()); [Fact] public void NumberToNanometersTest() => - Assert.Equal(Length.FromNanometers(2), 2.Nanometers()); + Assert.Equal(Length.FromNanometers(2), 2.Nanometers()); [Fact] public void NumberToNauticalMilesTest() => - Assert.Equal(Length.FromNauticalMiles(2), 2.NauticalMiles()); + Assert.Equal(Length.FromNauticalMiles(2), 2.NauticalMiles()); [Fact] public void NumberToParsecsTest() => - Assert.Equal(Length.FromParsecs(2), 2.Parsecs()); + Assert.Equal(Length.FromParsecs(2), 2.Parsecs()); [Fact] public void NumberToPrinterPicasTest() => - Assert.Equal(Length.FromPrinterPicas(2), 2.PrinterPicas()); + Assert.Equal(Length.FromPrinterPicas(2), 2.PrinterPicas()); [Fact] public void NumberToPrinterPointsTest() => - Assert.Equal(Length.FromPrinterPoints(2), 2.PrinterPoints()); + Assert.Equal(Length.FromPrinterPoints(2), 2.PrinterPoints()); [Fact] public void NumberToShacklesTest() => - Assert.Equal(Length.FromShackles(2), 2.Shackles()); + Assert.Equal(Length.FromShackles(2), 2.Shackles()); [Fact] public void NumberToSolarRadiusesTest() => - Assert.Equal(Length.FromSolarRadiuses(2), 2.SolarRadiuses()); + Assert.Equal(Length.FromSolarRadiuses(2), 2.SolarRadiuses()); [Fact] public void NumberToTwipsTest() => - Assert.Equal(Length.FromTwips(2), 2.Twips()); + Assert.Equal(Length.FromTwips(2), 2.Twips()); [Fact] public void NumberToUsSurveyFeetTest() => - Assert.Equal(Length.FromUsSurveyFeet(2), 2.UsSurveyFeet()); + Assert.Equal(Length.FromUsSurveyFeet(2), 2.UsSurveyFeet()); [Fact] public void NumberToYardsTest() => - Assert.Equal(Length.FromYards(2), 2.Yards()); + Assert.Equal(Length.FromYards(2), 2.Yards()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLevelExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLevelExtensionsTest.g.cs index 02fc9efc9c..aca711d89c 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLevelExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLevelExtensionsTest.g.cs @@ -21,16 +21,16 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToLevelExtensionsTests { [Fact] public void NumberToDecibelsTest() => - Assert.Equal(Level.FromDecibels(2), 2.Decibels()); + Assert.Equal(Level.FromDecibels(2), 2.Decibels()); [Fact] public void NumberToNepersTest() => - Assert.Equal(Level.FromNepers(2), 2.Nepers()); + Assert.Equal(Level.FromNepers(2), 2.Nepers()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLinearDensityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLinearDensityExtensionsTest.g.cs index c070929075..a8d529725a 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLinearDensityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLinearDensityExtensionsTest.g.cs @@ -21,64 +21,64 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToLinearDensityExtensionsTests { [Fact] public void NumberToGramsPerCentimeterTest() => - Assert.Equal(LinearDensity.FromGramsPerCentimeter(2), 2.GramsPerCentimeter()); + Assert.Equal(LinearDensity.FromGramsPerCentimeter(2), 2.GramsPerCentimeter()); [Fact] public void NumberToGramsPerMeterTest() => - Assert.Equal(LinearDensity.FromGramsPerMeter(2), 2.GramsPerMeter()); + Assert.Equal(LinearDensity.FromGramsPerMeter(2), 2.GramsPerMeter()); [Fact] public void NumberToGramsPerMillimeterTest() => - Assert.Equal(LinearDensity.FromGramsPerMillimeter(2), 2.GramsPerMillimeter()); + Assert.Equal(LinearDensity.FromGramsPerMillimeter(2), 2.GramsPerMillimeter()); [Fact] public void NumberToKilogramsPerCentimeterTest() => - Assert.Equal(LinearDensity.FromKilogramsPerCentimeter(2), 2.KilogramsPerCentimeter()); + Assert.Equal(LinearDensity.FromKilogramsPerCentimeter(2), 2.KilogramsPerCentimeter()); [Fact] public void NumberToKilogramsPerMeterTest() => - Assert.Equal(LinearDensity.FromKilogramsPerMeter(2), 2.KilogramsPerMeter()); + Assert.Equal(LinearDensity.FromKilogramsPerMeter(2), 2.KilogramsPerMeter()); [Fact] public void NumberToKilogramsPerMillimeterTest() => - Assert.Equal(LinearDensity.FromKilogramsPerMillimeter(2), 2.KilogramsPerMillimeter()); + Assert.Equal(LinearDensity.FromKilogramsPerMillimeter(2), 2.KilogramsPerMillimeter()); [Fact] public void NumberToMicrogramsPerCentimeterTest() => - Assert.Equal(LinearDensity.FromMicrogramsPerCentimeter(2), 2.MicrogramsPerCentimeter()); + Assert.Equal(LinearDensity.FromMicrogramsPerCentimeter(2), 2.MicrogramsPerCentimeter()); [Fact] public void NumberToMicrogramsPerMeterTest() => - Assert.Equal(LinearDensity.FromMicrogramsPerMeter(2), 2.MicrogramsPerMeter()); + Assert.Equal(LinearDensity.FromMicrogramsPerMeter(2), 2.MicrogramsPerMeter()); [Fact] public void NumberToMicrogramsPerMillimeterTest() => - Assert.Equal(LinearDensity.FromMicrogramsPerMillimeter(2), 2.MicrogramsPerMillimeter()); + Assert.Equal(LinearDensity.FromMicrogramsPerMillimeter(2), 2.MicrogramsPerMillimeter()); [Fact] public void NumberToMilligramsPerCentimeterTest() => - Assert.Equal(LinearDensity.FromMilligramsPerCentimeter(2), 2.MilligramsPerCentimeter()); + Assert.Equal(LinearDensity.FromMilligramsPerCentimeter(2), 2.MilligramsPerCentimeter()); [Fact] public void NumberToMilligramsPerMeterTest() => - Assert.Equal(LinearDensity.FromMilligramsPerMeter(2), 2.MilligramsPerMeter()); + Assert.Equal(LinearDensity.FromMilligramsPerMeter(2), 2.MilligramsPerMeter()); [Fact] public void NumberToMilligramsPerMillimeterTest() => - Assert.Equal(LinearDensity.FromMilligramsPerMillimeter(2), 2.MilligramsPerMillimeter()); + Assert.Equal(LinearDensity.FromMilligramsPerMillimeter(2), 2.MilligramsPerMillimeter()); [Fact] public void NumberToPoundsPerFootTest() => - Assert.Equal(LinearDensity.FromPoundsPerFoot(2), 2.PoundsPerFoot()); + Assert.Equal(LinearDensity.FromPoundsPerFoot(2), 2.PoundsPerFoot()); [Fact] public void NumberToPoundsPerInchTest() => - Assert.Equal(LinearDensity.FromPoundsPerInch(2), 2.PoundsPerInch()); + Assert.Equal(LinearDensity.FromPoundsPerInch(2), 2.PoundsPerInch()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLinearPowerDensityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLinearPowerDensityExtensionsTest.g.cs index deb623e4dd..91bd874796 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLinearPowerDensityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLinearPowerDensityExtensionsTest.g.cs @@ -21,108 +21,108 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToLinearPowerDensityExtensionsTests { [Fact] public void NumberToGigawattsPerCentimeterTest() => - Assert.Equal(LinearPowerDensity.FromGigawattsPerCentimeter(2), 2.GigawattsPerCentimeter()); + Assert.Equal(LinearPowerDensity.FromGigawattsPerCentimeter(2), 2.GigawattsPerCentimeter()); [Fact] public void NumberToGigawattsPerFootTest() => - Assert.Equal(LinearPowerDensity.FromGigawattsPerFoot(2), 2.GigawattsPerFoot()); + Assert.Equal(LinearPowerDensity.FromGigawattsPerFoot(2), 2.GigawattsPerFoot()); [Fact] public void NumberToGigawattsPerInchTest() => - Assert.Equal(LinearPowerDensity.FromGigawattsPerInch(2), 2.GigawattsPerInch()); + Assert.Equal(LinearPowerDensity.FromGigawattsPerInch(2), 2.GigawattsPerInch()); [Fact] public void NumberToGigawattsPerMeterTest() => - Assert.Equal(LinearPowerDensity.FromGigawattsPerMeter(2), 2.GigawattsPerMeter()); + Assert.Equal(LinearPowerDensity.FromGigawattsPerMeter(2), 2.GigawattsPerMeter()); [Fact] public void NumberToGigawattsPerMillimeterTest() => - Assert.Equal(LinearPowerDensity.FromGigawattsPerMillimeter(2), 2.GigawattsPerMillimeter()); + Assert.Equal(LinearPowerDensity.FromGigawattsPerMillimeter(2), 2.GigawattsPerMillimeter()); [Fact] public void NumberToKilowattsPerCentimeterTest() => - Assert.Equal(LinearPowerDensity.FromKilowattsPerCentimeter(2), 2.KilowattsPerCentimeter()); + Assert.Equal(LinearPowerDensity.FromKilowattsPerCentimeter(2), 2.KilowattsPerCentimeter()); [Fact] public void NumberToKilowattsPerFootTest() => - Assert.Equal(LinearPowerDensity.FromKilowattsPerFoot(2), 2.KilowattsPerFoot()); + Assert.Equal(LinearPowerDensity.FromKilowattsPerFoot(2), 2.KilowattsPerFoot()); [Fact] public void NumberToKilowattsPerInchTest() => - Assert.Equal(LinearPowerDensity.FromKilowattsPerInch(2), 2.KilowattsPerInch()); + Assert.Equal(LinearPowerDensity.FromKilowattsPerInch(2), 2.KilowattsPerInch()); [Fact] public void NumberToKilowattsPerMeterTest() => - Assert.Equal(LinearPowerDensity.FromKilowattsPerMeter(2), 2.KilowattsPerMeter()); + Assert.Equal(LinearPowerDensity.FromKilowattsPerMeter(2), 2.KilowattsPerMeter()); [Fact] public void NumberToKilowattsPerMillimeterTest() => - Assert.Equal(LinearPowerDensity.FromKilowattsPerMillimeter(2), 2.KilowattsPerMillimeter()); + Assert.Equal(LinearPowerDensity.FromKilowattsPerMillimeter(2), 2.KilowattsPerMillimeter()); [Fact] public void NumberToMegawattsPerCentimeterTest() => - Assert.Equal(LinearPowerDensity.FromMegawattsPerCentimeter(2), 2.MegawattsPerCentimeter()); + Assert.Equal(LinearPowerDensity.FromMegawattsPerCentimeter(2), 2.MegawattsPerCentimeter()); [Fact] public void NumberToMegawattsPerFootTest() => - Assert.Equal(LinearPowerDensity.FromMegawattsPerFoot(2), 2.MegawattsPerFoot()); + Assert.Equal(LinearPowerDensity.FromMegawattsPerFoot(2), 2.MegawattsPerFoot()); [Fact] public void NumberToMegawattsPerInchTest() => - Assert.Equal(LinearPowerDensity.FromMegawattsPerInch(2), 2.MegawattsPerInch()); + Assert.Equal(LinearPowerDensity.FromMegawattsPerInch(2), 2.MegawattsPerInch()); [Fact] public void NumberToMegawattsPerMeterTest() => - Assert.Equal(LinearPowerDensity.FromMegawattsPerMeter(2), 2.MegawattsPerMeter()); + Assert.Equal(LinearPowerDensity.FromMegawattsPerMeter(2), 2.MegawattsPerMeter()); [Fact] public void NumberToMegawattsPerMillimeterTest() => - Assert.Equal(LinearPowerDensity.FromMegawattsPerMillimeter(2), 2.MegawattsPerMillimeter()); + Assert.Equal(LinearPowerDensity.FromMegawattsPerMillimeter(2), 2.MegawattsPerMillimeter()); [Fact] public void NumberToMilliwattsPerCentimeterTest() => - Assert.Equal(LinearPowerDensity.FromMilliwattsPerCentimeter(2), 2.MilliwattsPerCentimeter()); + Assert.Equal(LinearPowerDensity.FromMilliwattsPerCentimeter(2), 2.MilliwattsPerCentimeter()); [Fact] public void NumberToMilliwattsPerFootTest() => - Assert.Equal(LinearPowerDensity.FromMilliwattsPerFoot(2), 2.MilliwattsPerFoot()); + Assert.Equal(LinearPowerDensity.FromMilliwattsPerFoot(2), 2.MilliwattsPerFoot()); [Fact] public void NumberToMilliwattsPerInchTest() => - Assert.Equal(LinearPowerDensity.FromMilliwattsPerInch(2), 2.MilliwattsPerInch()); + Assert.Equal(LinearPowerDensity.FromMilliwattsPerInch(2), 2.MilliwattsPerInch()); [Fact] public void NumberToMilliwattsPerMeterTest() => - Assert.Equal(LinearPowerDensity.FromMilliwattsPerMeter(2), 2.MilliwattsPerMeter()); + Assert.Equal(LinearPowerDensity.FromMilliwattsPerMeter(2), 2.MilliwattsPerMeter()); [Fact] public void NumberToMilliwattsPerMillimeterTest() => - Assert.Equal(LinearPowerDensity.FromMilliwattsPerMillimeter(2), 2.MilliwattsPerMillimeter()); + Assert.Equal(LinearPowerDensity.FromMilliwattsPerMillimeter(2), 2.MilliwattsPerMillimeter()); [Fact] public void NumberToWattsPerCentimeterTest() => - Assert.Equal(LinearPowerDensity.FromWattsPerCentimeter(2), 2.WattsPerCentimeter()); + Assert.Equal(LinearPowerDensity.FromWattsPerCentimeter(2), 2.WattsPerCentimeter()); [Fact] public void NumberToWattsPerFootTest() => - Assert.Equal(LinearPowerDensity.FromWattsPerFoot(2), 2.WattsPerFoot()); + Assert.Equal(LinearPowerDensity.FromWattsPerFoot(2), 2.WattsPerFoot()); [Fact] public void NumberToWattsPerInchTest() => - Assert.Equal(LinearPowerDensity.FromWattsPerInch(2), 2.WattsPerInch()); + Assert.Equal(LinearPowerDensity.FromWattsPerInch(2), 2.WattsPerInch()); [Fact] public void NumberToWattsPerMeterTest() => - Assert.Equal(LinearPowerDensity.FromWattsPerMeter(2), 2.WattsPerMeter()); + Assert.Equal(LinearPowerDensity.FromWattsPerMeter(2), 2.WattsPerMeter()); [Fact] public void NumberToWattsPerMillimeterTest() => - Assert.Equal(LinearPowerDensity.FromWattsPerMillimeter(2), 2.WattsPerMillimeter()); + Assert.Equal(LinearPowerDensity.FromWattsPerMillimeter(2), 2.WattsPerMillimeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLuminosityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLuminosityExtensionsTest.g.cs index 0e4a7d8c7a..557493131e 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLuminosityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLuminosityExtensionsTest.g.cs @@ -21,64 +21,64 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToLuminosityExtensionsTests { [Fact] public void NumberToDecawattsTest() => - Assert.Equal(Luminosity.FromDecawatts(2), 2.Decawatts()); + Assert.Equal(Luminosity.FromDecawatts(2), 2.Decawatts()); [Fact] public void NumberToDeciwattsTest() => - Assert.Equal(Luminosity.FromDeciwatts(2), 2.Deciwatts()); + Assert.Equal(Luminosity.FromDeciwatts(2), 2.Deciwatts()); [Fact] public void NumberToFemtowattsTest() => - Assert.Equal(Luminosity.FromFemtowatts(2), 2.Femtowatts()); + Assert.Equal(Luminosity.FromFemtowatts(2), 2.Femtowatts()); [Fact] public void NumberToGigawattsTest() => - Assert.Equal(Luminosity.FromGigawatts(2), 2.Gigawatts()); + Assert.Equal(Luminosity.FromGigawatts(2), 2.Gigawatts()); [Fact] public void NumberToKilowattsTest() => - Assert.Equal(Luminosity.FromKilowatts(2), 2.Kilowatts()); + Assert.Equal(Luminosity.FromKilowatts(2), 2.Kilowatts()); [Fact] public void NumberToMegawattsTest() => - Assert.Equal(Luminosity.FromMegawatts(2), 2.Megawatts()); + Assert.Equal(Luminosity.FromMegawatts(2), 2.Megawatts()); [Fact] public void NumberToMicrowattsTest() => - Assert.Equal(Luminosity.FromMicrowatts(2), 2.Microwatts()); + Assert.Equal(Luminosity.FromMicrowatts(2), 2.Microwatts()); [Fact] public void NumberToMilliwattsTest() => - Assert.Equal(Luminosity.FromMilliwatts(2), 2.Milliwatts()); + Assert.Equal(Luminosity.FromMilliwatts(2), 2.Milliwatts()); [Fact] public void NumberToNanowattsTest() => - Assert.Equal(Luminosity.FromNanowatts(2), 2.Nanowatts()); + Assert.Equal(Luminosity.FromNanowatts(2), 2.Nanowatts()); [Fact] public void NumberToPetawattsTest() => - Assert.Equal(Luminosity.FromPetawatts(2), 2.Petawatts()); + Assert.Equal(Luminosity.FromPetawatts(2), 2.Petawatts()); [Fact] public void NumberToPicowattsTest() => - Assert.Equal(Luminosity.FromPicowatts(2), 2.Picowatts()); + Assert.Equal(Luminosity.FromPicowatts(2), 2.Picowatts()); [Fact] public void NumberToSolarLuminositiesTest() => - Assert.Equal(Luminosity.FromSolarLuminosities(2), 2.SolarLuminosities()); + Assert.Equal(Luminosity.FromSolarLuminosities(2), 2.SolarLuminosities()); [Fact] public void NumberToTerawattsTest() => - Assert.Equal(Luminosity.FromTerawatts(2), 2.Terawatts()); + Assert.Equal(Luminosity.FromTerawatts(2), 2.Terawatts()); [Fact] public void NumberToWattsTest() => - Assert.Equal(Luminosity.FromWatts(2), 2.Watts()); + Assert.Equal(Luminosity.FromWatts(2), 2.Watts()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLuminousFluxExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLuminousFluxExtensionsTest.g.cs index 4f2c476c67..57c03cfac2 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLuminousFluxExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLuminousFluxExtensionsTest.g.cs @@ -21,12 +21,12 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToLuminousFluxExtensionsTests { [Fact] public void NumberToLumensTest() => - Assert.Equal(LuminousFlux.FromLumens(2), 2.Lumens()); + Assert.Equal(LuminousFlux.FromLumens(2), 2.Lumens()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLuminousIntensityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLuminousIntensityExtensionsTest.g.cs index c5b91b4349..65b409be2b 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLuminousIntensityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToLuminousIntensityExtensionsTest.g.cs @@ -21,12 +21,12 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToLuminousIntensityExtensionsTests { [Fact] public void NumberToCandelaTest() => - Assert.Equal(LuminousIntensity.FromCandela(2), 2.Candela()); + Assert.Equal(LuminousIntensity.FromCandela(2), 2.Candela()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMagneticFieldExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMagneticFieldExtensionsTest.g.cs index ed49e1b4d1..3d72c1a677 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMagneticFieldExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMagneticFieldExtensionsTest.g.cs @@ -21,28 +21,28 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToMagneticFieldExtensionsTests { [Fact] public void NumberToGaussesTest() => - Assert.Equal(MagneticField.FromGausses(2), 2.Gausses()); + Assert.Equal(MagneticField.FromGausses(2), 2.Gausses()); [Fact] public void NumberToMicroteslasTest() => - Assert.Equal(MagneticField.FromMicroteslas(2), 2.Microteslas()); + Assert.Equal(MagneticField.FromMicroteslas(2), 2.Microteslas()); [Fact] public void NumberToMilliteslasTest() => - Assert.Equal(MagneticField.FromMilliteslas(2), 2.Milliteslas()); + Assert.Equal(MagneticField.FromMilliteslas(2), 2.Milliteslas()); [Fact] public void NumberToNanoteslasTest() => - Assert.Equal(MagneticField.FromNanoteslas(2), 2.Nanoteslas()); + Assert.Equal(MagneticField.FromNanoteslas(2), 2.Nanoteslas()); [Fact] public void NumberToTeslasTest() => - Assert.Equal(MagneticField.FromTeslas(2), 2.Teslas()); + Assert.Equal(MagneticField.FromTeslas(2), 2.Teslas()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMagneticFluxExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMagneticFluxExtensionsTest.g.cs index 5a801aba5f..88ae959f48 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMagneticFluxExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMagneticFluxExtensionsTest.g.cs @@ -21,12 +21,12 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToMagneticFluxExtensionsTests { [Fact] public void NumberToWebersTest() => - Assert.Equal(MagneticFlux.FromWebers(2), 2.Webers()); + Assert.Equal(MagneticFlux.FromWebers(2), 2.Webers()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMagnetizationExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMagnetizationExtensionsTest.g.cs index ed0696ed14..4fd939ac90 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMagnetizationExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMagnetizationExtensionsTest.g.cs @@ -21,12 +21,12 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToMagnetizationExtensionsTests { [Fact] public void NumberToAmperesPerMeterTest() => - Assert.Equal(Magnetization.FromAmperesPerMeter(2), 2.AmperesPerMeter()); + Assert.Equal(Magnetization.FromAmperesPerMeter(2), 2.AmperesPerMeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassConcentrationExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassConcentrationExtensionsTest.g.cs index 0271163856..2fdab98077 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassConcentrationExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassConcentrationExtensionsTest.g.cs @@ -21,196 +21,196 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToMassConcentrationExtensionsTests { [Fact] public void NumberToCentigramsPerDeciliterTest() => - Assert.Equal(MassConcentration.FromCentigramsPerDeciliter(2), 2.CentigramsPerDeciliter()); + Assert.Equal(MassConcentration.FromCentigramsPerDeciliter(2), 2.CentigramsPerDeciliter()); [Fact] public void NumberToCentigramsPerLiterTest() => - Assert.Equal(MassConcentration.FromCentigramsPerLiter(2), 2.CentigramsPerLiter()); + Assert.Equal(MassConcentration.FromCentigramsPerLiter(2), 2.CentigramsPerLiter()); [Fact] public void NumberToCentigramsPerMicroliterTest() => - Assert.Equal(MassConcentration.FromCentigramsPerMicroliter(2), 2.CentigramsPerMicroliter()); + Assert.Equal(MassConcentration.FromCentigramsPerMicroliter(2), 2.CentigramsPerMicroliter()); [Fact] public void NumberToCentigramsPerMilliliterTest() => - Assert.Equal(MassConcentration.FromCentigramsPerMilliliter(2), 2.CentigramsPerMilliliter()); + Assert.Equal(MassConcentration.FromCentigramsPerMilliliter(2), 2.CentigramsPerMilliliter()); [Fact] public void NumberToDecigramsPerDeciliterTest() => - Assert.Equal(MassConcentration.FromDecigramsPerDeciliter(2), 2.DecigramsPerDeciliter()); + Assert.Equal(MassConcentration.FromDecigramsPerDeciliter(2), 2.DecigramsPerDeciliter()); [Fact] public void NumberToDecigramsPerLiterTest() => - Assert.Equal(MassConcentration.FromDecigramsPerLiter(2), 2.DecigramsPerLiter()); + Assert.Equal(MassConcentration.FromDecigramsPerLiter(2), 2.DecigramsPerLiter()); [Fact] public void NumberToDecigramsPerMicroliterTest() => - Assert.Equal(MassConcentration.FromDecigramsPerMicroliter(2), 2.DecigramsPerMicroliter()); + Assert.Equal(MassConcentration.FromDecigramsPerMicroliter(2), 2.DecigramsPerMicroliter()); [Fact] public void NumberToDecigramsPerMilliliterTest() => - Assert.Equal(MassConcentration.FromDecigramsPerMilliliter(2), 2.DecigramsPerMilliliter()); + Assert.Equal(MassConcentration.FromDecigramsPerMilliliter(2), 2.DecigramsPerMilliliter()); [Fact] public void NumberToGramsPerCubicCentimeterTest() => - Assert.Equal(MassConcentration.FromGramsPerCubicCentimeter(2), 2.GramsPerCubicCentimeter()); + Assert.Equal(MassConcentration.FromGramsPerCubicCentimeter(2), 2.GramsPerCubicCentimeter()); [Fact] public void NumberToGramsPerCubicMeterTest() => - Assert.Equal(MassConcentration.FromGramsPerCubicMeter(2), 2.GramsPerCubicMeter()); + Assert.Equal(MassConcentration.FromGramsPerCubicMeter(2), 2.GramsPerCubicMeter()); [Fact] public void NumberToGramsPerCubicMillimeterTest() => - Assert.Equal(MassConcentration.FromGramsPerCubicMillimeter(2), 2.GramsPerCubicMillimeter()); + Assert.Equal(MassConcentration.FromGramsPerCubicMillimeter(2), 2.GramsPerCubicMillimeter()); [Fact] public void NumberToGramsPerDeciliterTest() => - Assert.Equal(MassConcentration.FromGramsPerDeciliter(2), 2.GramsPerDeciliter()); + Assert.Equal(MassConcentration.FromGramsPerDeciliter(2), 2.GramsPerDeciliter()); [Fact] public void NumberToGramsPerLiterTest() => - Assert.Equal(MassConcentration.FromGramsPerLiter(2), 2.GramsPerLiter()); + Assert.Equal(MassConcentration.FromGramsPerLiter(2), 2.GramsPerLiter()); [Fact] public void NumberToGramsPerMicroliterTest() => - Assert.Equal(MassConcentration.FromGramsPerMicroliter(2), 2.GramsPerMicroliter()); + Assert.Equal(MassConcentration.FromGramsPerMicroliter(2), 2.GramsPerMicroliter()); [Fact] public void NumberToGramsPerMilliliterTest() => - Assert.Equal(MassConcentration.FromGramsPerMilliliter(2), 2.GramsPerMilliliter()); + Assert.Equal(MassConcentration.FromGramsPerMilliliter(2), 2.GramsPerMilliliter()); [Fact] public void NumberToKilogramsPerCubicCentimeterTest() => - Assert.Equal(MassConcentration.FromKilogramsPerCubicCentimeter(2), 2.KilogramsPerCubicCentimeter()); + Assert.Equal(MassConcentration.FromKilogramsPerCubicCentimeter(2), 2.KilogramsPerCubicCentimeter()); [Fact] public void NumberToKilogramsPerCubicMeterTest() => - Assert.Equal(MassConcentration.FromKilogramsPerCubicMeter(2), 2.KilogramsPerCubicMeter()); + Assert.Equal(MassConcentration.FromKilogramsPerCubicMeter(2), 2.KilogramsPerCubicMeter()); [Fact] public void NumberToKilogramsPerCubicMillimeterTest() => - Assert.Equal(MassConcentration.FromKilogramsPerCubicMillimeter(2), 2.KilogramsPerCubicMillimeter()); + Assert.Equal(MassConcentration.FromKilogramsPerCubicMillimeter(2), 2.KilogramsPerCubicMillimeter()); [Fact] public void NumberToKilogramsPerLiterTest() => - Assert.Equal(MassConcentration.FromKilogramsPerLiter(2), 2.KilogramsPerLiter()); + Assert.Equal(MassConcentration.FromKilogramsPerLiter(2), 2.KilogramsPerLiter()); [Fact] public void NumberToKilopoundsPerCubicFootTest() => - Assert.Equal(MassConcentration.FromKilopoundsPerCubicFoot(2), 2.KilopoundsPerCubicFoot()); + Assert.Equal(MassConcentration.FromKilopoundsPerCubicFoot(2), 2.KilopoundsPerCubicFoot()); [Fact] public void NumberToKilopoundsPerCubicInchTest() => - Assert.Equal(MassConcentration.FromKilopoundsPerCubicInch(2), 2.KilopoundsPerCubicInch()); + Assert.Equal(MassConcentration.FromKilopoundsPerCubicInch(2), 2.KilopoundsPerCubicInch()); [Fact] public void NumberToMicrogramsPerCubicMeterTest() => - Assert.Equal(MassConcentration.FromMicrogramsPerCubicMeter(2), 2.MicrogramsPerCubicMeter()); + Assert.Equal(MassConcentration.FromMicrogramsPerCubicMeter(2), 2.MicrogramsPerCubicMeter()); [Fact] public void NumberToMicrogramsPerDeciliterTest() => - Assert.Equal(MassConcentration.FromMicrogramsPerDeciliter(2), 2.MicrogramsPerDeciliter()); + Assert.Equal(MassConcentration.FromMicrogramsPerDeciliter(2), 2.MicrogramsPerDeciliter()); [Fact] public void NumberToMicrogramsPerLiterTest() => - Assert.Equal(MassConcentration.FromMicrogramsPerLiter(2), 2.MicrogramsPerLiter()); + Assert.Equal(MassConcentration.FromMicrogramsPerLiter(2), 2.MicrogramsPerLiter()); [Fact] public void NumberToMicrogramsPerMicroliterTest() => - Assert.Equal(MassConcentration.FromMicrogramsPerMicroliter(2), 2.MicrogramsPerMicroliter()); + Assert.Equal(MassConcentration.FromMicrogramsPerMicroliter(2), 2.MicrogramsPerMicroliter()); [Fact] public void NumberToMicrogramsPerMilliliterTest() => - Assert.Equal(MassConcentration.FromMicrogramsPerMilliliter(2), 2.MicrogramsPerMilliliter()); + Assert.Equal(MassConcentration.FromMicrogramsPerMilliliter(2), 2.MicrogramsPerMilliliter()); [Fact] public void NumberToMilligramsPerCubicMeterTest() => - Assert.Equal(MassConcentration.FromMilligramsPerCubicMeter(2), 2.MilligramsPerCubicMeter()); + Assert.Equal(MassConcentration.FromMilligramsPerCubicMeter(2), 2.MilligramsPerCubicMeter()); [Fact] public void NumberToMilligramsPerDeciliterTest() => - Assert.Equal(MassConcentration.FromMilligramsPerDeciliter(2), 2.MilligramsPerDeciliter()); + Assert.Equal(MassConcentration.FromMilligramsPerDeciliter(2), 2.MilligramsPerDeciliter()); [Fact] public void NumberToMilligramsPerLiterTest() => - Assert.Equal(MassConcentration.FromMilligramsPerLiter(2), 2.MilligramsPerLiter()); + Assert.Equal(MassConcentration.FromMilligramsPerLiter(2), 2.MilligramsPerLiter()); [Fact] public void NumberToMilligramsPerMicroliterTest() => - Assert.Equal(MassConcentration.FromMilligramsPerMicroliter(2), 2.MilligramsPerMicroliter()); + Assert.Equal(MassConcentration.FromMilligramsPerMicroliter(2), 2.MilligramsPerMicroliter()); [Fact] public void NumberToMilligramsPerMilliliterTest() => - Assert.Equal(MassConcentration.FromMilligramsPerMilliliter(2), 2.MilligramsPerMilliliter()); + Assert.Equal(MassConcentration.FromMilligramsPerMilliliter(2), 2.MilligramsPerMilliliter()); [Fact] public void NumberToNanogramsPerDeciliterTest() => - Assert.Equal(MassConcentration.FromNanogramsPerDeciliter(2), 2.NanogramsPerDeciliter()); + Assert.Equal(MassConcentration.FromNanogramsPerDeciliter(2), 2.NanogramsPerDeciliter()); [Fact] public void NumberToNanogramsPerLiterTest() => - Assert.Equal(MassConcentration.FromNanogramsPerLiter(2), 2.NanogramsPerLiter()); + Assert.Equal(MassConcentration.FromNanogramsPerLiter(2), 2.NanogramsPerLiter()); [Fact] public void NumberToNanogramsPerMicroliterTest() => - Assert.Equal(MassConcentration.FromNanogramsPerMicroliter(2), 2.NanogramsPerMicroliter()); + Assert.Equal(MassConcentration.FromNanogramsPerMicroliter(2), 2.NanogramsPerMicroliter()); [Fact] public void NumberToNanogramsPerMilliliterTest() => - Assert.Equal(MassConcentration.FromNanogramsPerMilliliter(2), 2.NanogramsPerMilliliter()); + Assert.Equal(MassConcentration.FromNanogramsPerMilliliter(2), 2.NanogramsPerMilliliter()); [Fact] public void NumberToPicogramsPerDeciliterTest() => - Assert.Equal(MassConcentration.FromPicogramsPerDeciliter(2), 2.PicogramsPerDeciliter()); + Assert.Equal(MassConcentration.FromPicogramsPerDeciliter(2), 2.PicogramsPerDeciliter()); [Fact] public void NumberToPicogramsPerLiterTest() => - Assert.Equal(MassConcentration.FromPicogramsPerLiter(2), 2.PicogramsPerLiter()); + Assert.Equal(MassConcentration.FromPicogramsPerLiter(2), 2.PicogramsPerLiter()); [Fact] public void NumberToPicogramsPerMicroliterTest() => - Assert.Equal(MassConcentration.FromPicogramsPerMicroliter(2), 2.PicogramsPerMicroliter()); + Assert.Equal(MassConcentration.FromPicogramsPerMicroliter(2), 2.PicogramsPerMicroliter()); [Fact] public void NumberToPicogramsPerMilliliterTest() => - Assert.Equal(MassConcentration.FromPicogramsPerMilliliter(2), 2.PicogramsPerMilliliter()); + Assert.Equal(MassConcentration.FromPicogramsPerMilliliter(2), 2.PicogramsPerMilliliter()); [Fact] public void NumberToPoundsPerCubicFootTest() => - Assert.Equal(MassConcentration.FromPoundsPerCubicFoot(2), 2.PoundsPerCubicFoot()); + Assert.Equal(MassConcentration.FromPoundsPerCubicFoot(2), 2.PoundsPerCubicFoot()); [Fact] public void NumberToPoundsPerCubicInchTest() => - Assert.Equal(MassConcentration.FromPoundsPerCubicInch(2), 2.PoundsPerCubicInch()); + Assert.Equal(MassConcentration.FromPoundsPerCubicInch(2), 2.PoundsPerCubicInch()); [Fact] public void NumberToPoundsPerImperialGallonTest() => - Assert.Equal(MassConcentration.FromPoundsPerImperialGallon(2), 2.PoundsPerImperialGallon()); + Assert.Equal(MassConcentration.FromPoundsPerImperialGallon(2), 2.PoundsPerImperialGallon()); [Fact] public void NumberToPoundsPerUSGallonTest() => - Assert.Equal(MassConcentration.FromPoundsPerUSGallon(2), 2.PoundsPerUSGallon()); + Assert.Equal(MassConcentration.FromPoundsPerUSGallon(2), 2.PoundsPerUSGallon()); [Fact] public void NumberToSlugsPerCubicFootTest() => - Assert.Equal(MassConcentration.FromSlugsPerCubicFoot(2), 2.SlugsPerCubicFoot()); + Assert.Equal(MassConcentration.FromSlugsPerCubicFoot(2), 2.SlugsPerCubicFoot()); [Fact] public void NumberToTonnesPerCubicCentimeterTest() => - Assert.Equal(MassConcentration.FromTonnesPerCubicCentimeter(2), 2.TonnesPerCubicCentimeter()); + Assert.Equal(MassConcentration.FromTonnesPerCubicCentimeter(2), 2.TonnesPerCubicCentimeter()); [Fact] public void NumberToTonnesPerCubicMeterTest() => - Assert.Equal(MassConcentration.FromTonnesPerCubicMeter(2), 2.TonnesPerCubicMeter()); + Assert.Equal(MassConcentration.FromTonnesPerCubicMeter(2), 2.TonnesPerCubicMeter()); [Fact] public void NumberToTonnesPerCubicMillimeterTest() => - Assert.Equal(MassConcentration.FromTonnesPerCubicMillimeter(2), 2.TonnesPerCubicMillimeter()); + Assert.Equal(MassConcentration.FromTonnesPerCubicMillimeter(2), 2.TonnesPerCubicMillimeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassExtensionsTest.g.cs index 55dbe6f344..80fcaebf84 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassExtensionsTest.g.cs @@ -21,108 +21,108 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToMassExtensionsTests { [Fact] public void NumberToCentigramsTest() => - Assert.Equal(Mass.FromCentigrams(2), 2.Centigrams()); + Assert.Equal(Mass.FromCentigrams(2), 2.Centigrams()); [Fact] public void NumberToDecagramsTest() => - Assert.Equal(Mass.FromDecagrams(2), 2.Decagrams()); + Assert.Equal(Mass.FromDecagrams(2), 2.Decagrams()); [Fact] public void NumberToDecigramsTest() => - Assert.Equal(Mass.FromDecigrams(2), 2.Decigrams()); + Assert.Equal(Mass.FromDecigrams(2), 2.Decigrams()); [Fact] public void NumberToEarthMassesTest() => - Assert.Equal(Mass.FromEarthMasses(2), 2.EarthMasses()); + Assert.Equal(Mass.FromEarthMasses(2), 2.EarthMasses()); [Fact] public void NumberToGrainsTest() => - Assert.Equal(Mass.FromGrains(2), 2.Grains()); + Assert.Equal(Mass.FromGrains(2), 2.Grains()); [Fact] public void NumberToGramsTest() => - Assert.Equal(Mass.FromGrams(2), 2.Grams()); + Assert.Equal(Mass.FromGrams(2), 2.Grams()); [Fact] public void NumberToHectogramsTest() => - Assert.Equal(Mass.FromHectograms(2), 2.Hectograms()); + Assert.Equal(Mass.FromHectograms(2), 2.Hectograms()); [Fact] public void NumberToKilogramsTest() => - Assert.Equal(Mass.FromKilograms(2), 2.Kilograms()); + Assert.Equal(Mass.FromKilograms(2), 2.Kilograms()); [Fact] public void NumberToKilopoundsTest() => - Assert.Equal(Mass.FromKilopounds(2), 2.Kilopounds()); + Assert.Equal(Mass.FromKilopounds(2), 2.Kilopounds()); [Fact] public void NumberToKilotonnesTest() => - Assert.Equal(Mass.FromKilotonnes(2), 2.Kilotonnes()); + Assert.Equal(Mass.FromKilotonnes(2), 2.Kilotonnes()); [Fact] public void NumberToLongHundredweightTest() => - Assert.Equal(Mass.FromLongHundredweight(2), 2.LongHundredweight()); + Assert.Equal(Mass.FromLongHundredweight(2), 2.LongHundredweight()); [Fact] public void NumberToLongTonsTest() => - Assert.Equal(Mass.FromLongTons(2), 2.LongTons()); + Assert.Equal(Mass.FromLongTons(2), 2.LongTons()); [Fact] public void NumberToMegapoundsTest() => - Assert.Equal(Mass.FromMegapounds(2), 2.Megapounds()); + Assert.Equal(Mass.FromMegapounds(2), 2.Megapounds()); [Fact] public void NumberToMegatonnesTest() => - Assert.Equal(Mass.FromMegatonnes(2), 2.Megatonnes()); + Assert.Equal(Mass.FromMegatonnes(2), 2.Megatonnes()); [Fact] public void NumberToMicrogramsTest() => - Assert.Equal(Mass.FromMicrograms(2), 2.Micrograms()); + Assert.Equal(Mass.FromMicrograms(2), 2.Micrograms()); [Fact] public void NumberToMilligramsTest() => - Assert.Equal(Mass.FromMilligrams(2), 2.Milligrams()); + Assert.Equal(Mass.FromMilligrams(2), 2.Milligrams()); [Fact] public void NumberToNanogramsTest() => - Assert.Equal(Mass.FromNanograms(2), 2.Nanograms()); + Assert.Equal(Mass.FromNanograms(2), 2.Nanograms()); [Fact] public void NumberToOuncesTest() => - Assert.Equal(Mass.FromOunces(2), 2.Ounces()); + Assert.Equal(Mass.FromOunces(2), 2.Ounces()); [Fact] public void NumberToPoundsTest() => - Assert.Equal(Mass.FromPounds(2), 2.Pounds()); + Assert.Equal(Mass.FromPounds(2), 2.Pounds()); [Fact] public void NumberToShortHundredweightTest() => - Assert.Equal(Mass.FromShortHundredweight(2), 2.ShortHundredweight()); + Assert.Equal(Mass.FromShortHundredweight(2), 2.ShortHundredweight()); [Fact] public void NumberToShortTonsTest() => - Assert.Equal(Mass.FromShortTons(2), 2.ShortTons()); + Assert.Equal(Mass.FromShortTons(2), 2.ShortTons()); [Fact] public void NumberToSlugsTest() => - Assert.Equal(Mass.FromSlugs(2), 2.Slugs()); + Assert.Equal(Mass.FromSlugs(2), 2.Slugs()); [Fact] public void NumberToSolarMassesTest() => - Assert.Equal(Mass.FromSolarMasses(2), 2.SolarMasses()); + Assert.Equal(Mass.FromSolarMasses(2), 2.SolarMasses()); [Fact] public void NumberToStoneTest() => - Assert.Equal(Mass.FromStone(2), 2.Stone()); + Assert.Equal(Mass.FromStone(2), 2.Stone()); [Fact] public void NumberToTonnesTest() => - Assert.Equal(Mass.FromTonnes(2), 2.Tonnes()); + Assert.Equal(Mass.FromTonnes(2), 2.Tonnes()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassFlowExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassFlowExtensionsTest.g.cs index 4a18fd2c38..3e8010b3e1 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassFlowExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassFlowExtensionsTest.g.cs @@ -21,140 +21,140 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToMassFlowExtensionsTests { [Fact] public void NumberToCentigramsPerDayTest() => - Assert.Equal(MassFlow.FromCentigramsPerDay(2), 2.CentigramsPerDay()); + Assert.Equal(MassFlow.FromCentigramsPerDay(2), 2.CentigramsPerDay()); [Fact] public void NumberToCentigramsPerSecondTest() => - Assert.Equal(MassFlow.FromCentigramsPerSecond(2), 2.CentigramsPerSecond()); + Assert.Equal(MassFlow.FromCentigramsPerSecond(2), 2.CentigramsPerSecond()); [Fact] public void NumberToDecagramsPerDayTest() => - Assert.Equal(MassFlow.FromDecagramsPerDay(2), 2.DecagramsPerDay()); + Assert.Equal(MassFlow.FromDecagramsPerDay(2), 2.DecagramsPerDay()); [Fact] public void NumberToDecagramsPerSecondTest() => - Assert.Equal(MassFlow.FromDecagramsPerSecond(2), 2.DecagramsPerSecond()); + Assert.Equal(MassFlow.FromDecagramsPerSecond(2), 2.DecagramsPerSecond()); [Fact] public void NumberToDecigramsPerDayTest() => - Assert.Equal(MassFlow.FromDecigramsPerDay(2), 2.DecigramsPerDay()); + Assert.Equal(MassFlow.FromDecigramsPerDay(2), 2.DecigramsPerDay()); [Fact] public void NumberToDecigramsPerSecondTest() => - Assert.Equal(MassFlow.FromDecigramsPerSecond(2), 2.DecigramsPerSecond()); + Assert.Equal(MassFlow.FromDecigramsPerSecond(2), 2.DecigramsPerSecond()); [Fact] public void NumberToGramsPerDayTest() => - Assert.Equal(MassFlow.FromGramsPerDay(2), 2.GramsPerDay()); + Assert.Equal(MassFlow.FromGramsPerDay(2), 2.GramsPerDay()); [Fact] public void NumberToGramsPerHourTest() => - Assert.Equal(MassFlow.FromGramsPerHour(2), 2.GramsPerHour()); + Assert.Equal(MassFlow.FromGramsPerHour(2), 2.GramsPerHour()); [Fact] public void NumberToGramsPerSecondTest() => - Assert.Equal(MassFlow.FromGramsPerSecond(2), 2.GramsPerSecond()); + Assert.Equal(MassFlow.FromGramsPerSecond(2), 2.GramsPerSecond()); [Fact] public void NumberToHectogramsPerDayTest() => - Assert.Equal(MassFlow.FromHectogramsPerDay(2), 2.HectogramsPerDay()); + Assert.Equal(MassFlow.FromHectogramsPerDay(2), 2.HectogramsPerDay()); [Fact] public void NumberToHectogramsPerSecondTest() => - Assert.Equal(MassFlow.FromHectogramsPerSecond(2), 2.HectogramsPerSecond()); + Assert.Equal(MassFlow.FromHectogramsPerSecond(2), 2.HectogramsPerSecond()); [Fact] public void NumberToKilogramsPerDayTest() => - Assert.Equal(MassFlow.FromKilogramsPerDay(2), 2.KilogramsPerDay()); + Assert.Equal(MassFlow.FromKilogramsPerDay(2), 2.KilogramsPerDay()); [Fact] public void NumberToKilogramsPerHourTest() => - Assert.Equal(MassFlow.FromKilogramsPerHour(2), 2.KilogramsPerHour()); + Assert.Equal(MassFlow.FromKilogramsPerHour(2), 2.KilogramsPerHour()); [Fact] public void NumberToKilogramsPerMinuteTest() => - Assert.Equal(MassFlow.FromKilogramsPerMinute(2), 2.KilogramsPerMinute()); + Assert.Equal(MassFlow.FromKilogramsPerMinute(2), 2.KilogramsPerMinute()); [Fact] public void NumberToKilogramsPerSecondTest() => - Assert.Equal(MassFlow.FromKilogramsPerSecond(2), 2.KilogramsPerSecond()); + Assert.Equal(MassFlow.FromKilogramsPerSecond(2), 2.KilogramsPerSecond()); [Fact] public void NumberToMegagramsPerDayTest() => - Assert.Equal(MassFlow.FromMegagramsPerDay(2), 2.MegagramsPerDay()); + Assert.Equal(MassFlow.FromMegagramsPerDay(2), 2.MegagramsPerDay()); [Fact] public void NumberToMegapoundsPerDayTest() => - Assert.Equal(MassFlow.FromMegapoundsPerDay(2), 2.MegapoundsPerDay()); + Assert.Equal(MassFlow.FromMegapoundsPerDay(2), 2.MegapoundsPerDay()); [Fact] public void NumberToMegapoundsPerHourTest() => - Assert.Equal(MassFlow.FromMegapoundsPerHour(2), 2.MegapoundsPerHour()); + Assert.Equal(MassFlow.FromMegapoundsPerHour(2), 2.MegapoundsPerHour()); [Fact] public void NumberToMegapoundsPerMinuteTest() => - Assert.Equal(MassFlow.FromMegapoundsPerMinute(2), 2.MegapoundsPerMinute()); + Assert.Equal(MassFlow.FromMegapoundsPerMinute(2), 2.MegapoundsPerMinute()); [Fact] public void NumberToMegapoundsPerSecondTest() => - Assert.Equal(MassFlow.FromMegapoundsPerSecond(2), 2.MegapoundsPerSecond()); + Assert.Equal(MassFlow.FromMegapoundsPerSecond(2), 2.MegapoundsPerSecond()); [Fact] public void NumberToMicrogramsPerDayTest() => - Assert.Equal(MassFlow.FromMicrogramsPerDay(2), 2.MicrogramsPerDay()); + Assert.Equal(MassFlow.FromMicrogramsPerDay(2), 2.MicrogramsPerDay()); [Fact] public void NumberToMicrogramsPerSecondTest() => - Assert.Equal(MassFlow.FromMicrogramsPerSecond(2), 2.MicrogramsPerSecond()); + Assert.Equal(MassFlow.FromMicrogramsPerSecond(2), 2.MicrogramsPerSecond()); [Fact] public void NumberToMilligramsPerDayTest() => - Assert.Equal(MassFlow.FromMilligramsPerDay(2), 2.MilligramsPerDay()); + Assert.Equal(MassFlow.FromMilligramsPerDay(2), 2.MilligramsPerDay()); [Fact] public void NumberToMilligramsPerSecondTest() => - Assert.Equal(MassFlow.FromMilligramsPerSecond(2), 2.MilligramsPerSecond()); + Assert.Equal(MassFlow.FromMilligramsPerSecond(2), 2.MilligramsPerSecond()); [Fact] public void NumberToNanogramsPerDayTest() => - Assert.Equal(MassFlow.FromNanogramsPerDay(2), 2.NanogramsPerDay()); + Assert.Equal(MassFlow.FromNanogramsPerDay(2), 2.NanogramsPerDay()); [Fact] public void NumberToNanogramsPerSecondTest() => - Assert.Equal(MassFlow.FromNanogramsPerSecond(2), 2.NanogramsPerSecond()); + Assert.Equal(MassFlow.FromNanogramsPerSecond(2), 2.NanogramsPerSecond()); [Fact] public void NumberToPoundsPerDayTest() => - Assert.Equal(MassFlow.FromPoundsPerDay(2), 2.PoundsPerDay()); + Assert.Equal(MassFlow.FromPoundsPerDay(2), 2.PoundsPerDay()); [Fact] public void NumberToPoundsPerHourTest() => - Assert.Equal(MassFlow.FromPoundsPerHour(2), 2.PoundsPerHour()); + Assert.Equal(MassFlow.FromPoundsPerHour(2), 2.PoundsPerHour()); [Fact] public void NumberToPoundsPerMinuteTest() => - Assert.Equal(MassFlow.FromPoundsPerMinute(2), 2.PoundsPerMinute()); + Assert.Equal(MassFlow.FromPoundsPerMinute(2), 2.PoundsPerMinute()); [Fact] public void NumberToPoundsPerSecondTest() => - Assert.Equal(MassFlow.FromPoundsPerSecond(2), 2.PoundsPerSecond()); + Assert.Equal(MassFlow.FromPoundsPerSecond(2), 2.PoundsPerSecond()); [Fact] public void NumberToShortTonsPerHourTest() => - Assert.Equal(MassFlow.FromShortTonsPerHour(2), 2.ShortTonsPerHour()); + Assert.Equal(MassFlow.FromShortTonsPerHour(2), 2.ShortTonsPerHour()); [Fact] public void NumberToTonnesPerDayTest() => - Assert.Equal(MassFlow.FromTonnesPerDay(2), 2.TonnesPerDay()); + Assert.Equal(MassFlow.FromTonnesPerDay(2), 2.TonnesPerDay()); [Fact] public void NumberToTonnesPerHourTest() => - Assert.Equal(MassFlow.FromTonnesPerHour(2), 2.TonnesPerHour()); + Assert.Equal(MassFlow.FromTonnesPerHour(2), 2.TonnesPerHour()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassFluxExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassFluxExtensionsTest.g.cs index cab140f603..ff83f1dc5a 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassFluxExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassFluxExtensionsTest.g.cs @@ -21,56 +21,56 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToMassFluxExtensionsTests { [Fact] public void NumberToGramsPerHourPerSquareCentimeterTest() => - Assert.Equal(MassFlux.FromGramsPerHourPerSquareCentimeter(2), 2.GramsPerHourPerSquareCentimeter()); + Assert.Equal(MassFlux.FromGramsPerHourPerSquareCentimeter(2), 2.GramsPerHourPerSquareCentimeter()); [Fact] public void NumberToGramsPerHourPerSquareMeterTest() => - Assert.Equal(MassFlux.FromGramsPerHourPerSquareMeter(2), 2.GramsPerHourPerSquareMeter()); + Assert.Equal(MassFlux.FromGramsPerHourPerSquareMeter(2), 2.GramsPerHourPerSquareMeter()); [Fact] public void NumberToGramsPerHourPerSquareMillimeterTest() => - Assert.Equal(MassFlux.FromGramsPerHourPerSquareMillimeter(2), 2.GramsPerHourPerSquareMillimeter()); + Assert.Equal(MassFlux.FromGramsPerHourPerSquareMillimeter(2), 2.GramsPerHourPerSquareMillimeter()); [Fact] public void NumberToGramsPerSecondPerSquareCentimeterTest() => - Assert.Equal(MassFlux.FromGramsPerSecondPerSquareCentimeter(2), 2.GramsPerSecondPerSquareCentimeter()); + Assert.Equal(MassFlux.FromGramsPerSecondPerSquareCentimeter(2), 2.GramsPerSecondPerSquareCentimeter()); [Fact] public void NumberToGramsPerSecondPerSquareMeterTest() => - Assert.Equal(MassFlux.FromGramsPerSecondPerSquareMeter(2), 2.GramsPerSecondPerSquareMeter()); + Assert.Equal(MassFlux.FromGramsPerSecondPerSquareMeter(2), 2.GramsPerSecondPerSquareMeter()); [Fact] public void NumberToGramsPerSecondPerSquareMillimeterTest() => - Assert.Equal(MassFlux.FromGramsPerSecondPerSquareMillimeter(2), 2.GramsPerSecondPerSquareMillimeter()); + Assert.Equal(MassFlux.FromGramsPerSecondPerSquareMillimeter(2), 2.GramsPerSecondPerSquareMillimeter()); [Fact] public void NumberToKilogramsPerHourPerSquareCentimeterTest() => - Assert.Equal(MassFlux.FromKilogramsPerHourPerSquareCentimeter(2), 2.KilogramsPerHourPerSquareCentimeter()); + Assert.Equal(MassFlux.FromKilogramsPerHourPerSquareCentimeter(2), 2.KilogramsPerHourPerSquareCentimeter()); [Fact] public void NumberToKilogramsPerHourPerSquareMeterTest() => - Assert.Equal(MassFlux.FromKilogramsPerHourPerSquareMeter(2), 2.KilogramsPerHourPerSquareMeter()); + Assert.Equal(MassFlux.FromKilogramsPerHourPerSquareMeter(2), 2.KilogramsPerHourPerSquareMeter()); [Fact] public void NumberToKilogramsPerHourPerSquareMillimeterTest() => - Assert.Equal(MassFlux.FromKilogramsPerHourPerSquareMillimeter(2), 2.KilogramsPerHourPerSquareMillimeter()); + Assert.Equal(MassFlux.FromKilogramsPerHourPerSquareMillimeter(2), 2.KilogramsPerHourPerSquareMillimeter()); [Fact] public void NumberToKilogramsPerSecondPerSquareCentimeterTest() => - Assert.Equal(MassFlux.FromKilogramsPerSecondPerSquareCentimeter(2), 2.KilogramsPerSecondPerSquareCentimeter()); + Assert.Equal(MassFlux.FromKilogramsPerSecondPerSquareCentimeter(2), 2.KilogramsPerSecondPerSquareCentimeter()); [Fact] public void NumberToKilogramsPerSecondPerSquareMeterTest() => - Assert.Equal(MassFlux.FromKilogramsPerSecondPerSquareMeter(2), 2.KilogramsPerSecondPerSquareMeter()); + Assert.Equal(MassFlux.FromKilogramsPerSecondPerSquareMeter(2), 2.KilogramsPerSecondPerSquareMeter()); [Fact] public void NumberToKilogramsPerSecondPerSquareMillimeterTest() => - Assert.Equal(MassFlux.FromKilogramsPerSecondPerSquareMillimeter(2), 2.KilogramsPerSecondPerSquareMillimeter()); + Assert.Equal(MassFlux.FromKilogramsPerSecondPerSquareMillimeter(2), 2.KilogramsPerSecondPerSquareMillimeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassFractionExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassFractionExtensionsTest.g.cs index 30a444bb35..7e9d147a91 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassFractionExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassFractionExtensionsTest.g.cs @@ -21,104 +21,104 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToMassFractionExtensionsTests { [Fact] public void NumberToCentigramsPerGramTest() => - Assert.Equal(MassFraction.FromCentigramsPerGram(2), 2.CentigramsPerGram()); + Assert.Equal(MassFraction.FromCentigramsPerGram(2), 2.CentigramsPerGram()); [Fact] public void NumberToCentigramsPerKilogramTest() => - Assert.Equal(MassFraction.FromCentigramsPerKilogram(2), 2.CentigramsPerKilogram()); + Assert.Equal(MassFraction.FromCentigramsPerKilogram(2), 2.CentigramsPerKilogram()); [Fact] public void NumberToDecagramsPerGramTest() => - Assert.Equal(MassFraction.FromDecagramsPerGram(2), 2.DecagramsPerGram()); + Assert.Equal(MassFraction.FromDecagramsPerGram(2), 2.DecagramsPerGram()); [Fact] public void NumberToDecagramsPerKilogramTest() => - Assert.Equal(MassFraction.FromDecagramsPerKilogram(2), 2.DecagramsPerKilogram()); + Assert.Equal(MassFraction.FromDecagramsPerKilogram(2), 2.DecagramsPerKilogram()); [Fact] public void NumberToDecigramsPerGramTest() => - Assert.Equal(MassFraction.FromDecigramsPerGram(2), 2.DecigramsPerGram()); + Assert.Equal(MassFraction.FromDecigramsPerGram(2), 2.DecigramsPerGram()); [Fact] public void NumberToDecigramsPerKilogramTest() => - Assert.Equal(MassFraction.FromDecigramsPerKilogram(2), 2.DecigramsPerKilogram()); + Assert.Equal(MassFraction.FromDecigramsPerKilogram(2), 2.DecigramsPerKilogram()); [Fact] public void NumberToDecimalFractionsTest() => - Assert.Equal(MassFraction.FromDecimalFractions(2), 2.DecimalFractions()); + Assert.Equal(MassFraction.FromDecimalFractions(2), 2.DecimalFractions()); [Fact] public void NumberToGramsPerGramTest() => - Assert.Equal(MassFraction.FromGramsPerGram(2), 2.GramsPerGram()); + Assert.Equal(MassFraction.FromGramsPerGram(2), 2.GramsPerGram()); [Fact] public void NumberToGramsPerKilogramTest() => - Assert.Equal(MassFraction.FromGramsPerKilogram(2), 2.GramsPerKilogram()); + Assert.Equal(MassFraction.FromGramsPerKilogram(2), 2.GramsPerKilogram()); [Fact] public void NumberToHectogramsPerGramTest() => - Assert.Equal(MassFraction.FromHectogramsPerGram(2), 2.HectogramsPerGram()); + Assert.Equal(MassFraction.FromHectogramsPerGram(2), 2.HectogramsPerGram()); [Fact] public void NumberToHectogramsPerKilogramTest() => - Assert.Equal(MassFraction.FromHectogramsPerKilogram(2), 2.HectogramsPerKilogram()); + Assert.Equal(MassFraction.FromHectogramsPerKilogram(2), 2.HectogramsPerKilogram()); [Fact] public void NumberToKilogramsPerGramTest() => - Assert.Equal(MassFraction.FromKilogramsPerGram(2), 2.KilogramsPerGram()); + Assert.Equal(MassFraction.FromKilogramsPerGram(2), 2.KilogramsPerGram()); [Fact] public void NumberToKilogramsPerKilogramTest() => - Assert.Equal(MassFraction.FromKilogramsPerKilogram(2), 2.KilogramsPerKilogram()); + Assert.Equal(MassFraction.FromKilogramsPerKilogram(2), 2.KilogramsPerKilogram()); [Fact] public void NumberToMicrogramsPerGramTest() => - Assert.Equal(MassFraction.FromMicrogramsPerGram(2), 2.MicrogramsPerGram()); + Assert.Equal(MassFraction.FromMicrogramsPerGram(2), 2.MicrogramsPerGram()); [Fact] public void NumberToMicrogramsPerKilogramTest() => - Assert.Equal(MassFraction.FromMicrogramsPerKilogram(2), 2.MicrogramsPerKilogram()); + Assert.Equal(MassFraction.FromMicrogramsPerKilogram(2), 2.MicrogramsPerKilogram()); [Fact] public void NumberToMilligramsPerGramTest() => - Assert.Equal(MassFraction.FromMilligramsPerGram(2), 2.MilligramsPerGram()); + Assert.Equal(MassFraction.FromMilligramsPerGram(2), 2.MilligramsPerGram()); [Fact] public void NumberToMilligramsPerKilogramTest() => - Assert.Equal(MassFraction.FromMilligramsPerKilogram(2), 2.MilligramsPerKilogram()); + Assert.Equal(MassFraction.FromMilligramsPerKilogram(2), 2.MilligramsPerKilogram()); [Fact] public void NumberToNanogramsPerGramTest() => - Assert.Equal(MassFraction.FromNanogramsPerGram(2), 2.NanogramsPerGram()); + Assert.Equal(MassFraction.FromNanogramsPerGram(2), 2.NanogramsPerGram()); [Fact] public void NumberToNanogramsPerKilogramTest() => - Assert.Equal(MassFraction.FromNanogramsPerKilogram(2), 2.NanogramsPerKilogram()); + Assert.Equal(MassFraction.FromNanogramsPerKilogram(2), 2.NanogramsPerKilogram()); [Fact] public void NumberToPartsPerBillionTest() => - Assert.Equal(MassFraction.FromPartsPerBillion(2), 2.PartsPerBillion()); + Assert.Equal(MassFraction.FromPartsPerBillion(2), 2.PartsPerBillion()); [Fact] public void NumberToPartsPerMillionTest() => - Assert.Equal(MassFraction.FromPartsPerMillion(2), 2.PartsPerMillion()); + Assert.Equal(MassFraction.FromPartsPerMillion(2), 2.PartsPerMillion()); [Fact] public void NumberToPartsPerThousandTest() => - Assert.Equal(MassFraction.FromPartsPerThousand(2), 2.PartsPerThousand()); + Assert.Equal(MassFraction.FromPartsPerThousand(2), 2.PartsPerThousand()); [Fact] public void NumberToPartsPerTrillionTest() => - Assert.Equal(MassFraction.FromPartsPerTrillion(2), 2.PartsPerTrillion()); + Assert.Equal(MassFraction.FromPartsPerTrillion(2), 2.PartsPerTrillion()); [Fact] public void NumberToPercentTest() => - Assert.Equal(MassFraction.FromPercent(2), 2.Percent()); + Assert.Equal(MassFraction.FromPercent(2), 2.Percent()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassMomentOfInertiaExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassMomentOfInertiaExtensionsTest.g.cs index 533cb88df1..99beeed2a5 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassMomentOfInertiaExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMassMomentOfInertiaExtensionsTest.g.cs @@ -21,120 +21,120 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToMassMomentOfInertiaExtensionsTests { [Fact] public void NumberToGramSquareCentimetersTest() => - Assert.Equal(MassMomentOfInertia.FromGramSquareCentimeters(2), 2.GramSquareCentimeters()); + Assert.Equal(MassMomentOfInertia.FromGramSquareCentimeters(2), 2.GramSquareCentimeters()); [Fact] public void NumberToGramSquareDecimetersTest() => - Assert.Equal(MassMomentOfInertia.FromGramSquareDecimeters(2), 2.GramSquareDecimeters()); + Assert.Equal(MassMomentOfInertia.FromGramSquareDecimeters(2), 2.GramSquareDecimeters()); [Fact] public void NumberToGramSquareMetersTest() => - Assert.Equal(MassMomentOfInertia.FromGramSquareMeters(2), 2.GramSquareMeters()); + Assert.Equal(MassMomentOfInertia.FromGramSquareMeters(2), 2.GramSquareMeters()); [Fact] public void NumberToGramSquareMillimetersTest() => - Assert.Equal(MassMomentOfInertia.FromGramSquareMillimeters(2), 2.GramSquareMillimeters()); + Assert.Equal(MassMomentOfInertia.FromGramSquareMillimeters(2), 2.GramSquareMillimeters()); [Fact] public void NumberToKilogramSquareCentimetersTest() => - Assert.Equal(MassMomentOfInertia.FromKilogramSquareCentimeters(2), 2.KilogramSquareCentimeters()); + Assert.Equal(MassMomentOfInertia.FromKilogramSquareCentimeters(2), 2.KilogramSquareCentimeters()); [Fact] public void NumberToKilogramSquareDecimetersTest() => - Assert.Equal(MassMomentOfInertia.FromKilogramSquareDecimeters(2), 2.KilogramSquareDecimeters()); + Assert.Equal(MassMomentOfInertia.FromKilogramSquareDecimeters(2), 2.KilogramSquareDecimeters()); [Fact] public void NumberToKilogramSquareMetersTest() => - Assert.Equal(MassMomentOfInertia.FromKilogramSquareMeters(2), 2.KilogramSquareMeters()); + Assert.Equal(MassMomentOfInertia.FromKilogramSquareMeters(2), 2.KilogramSquareMeters()); [Fact] public void NumberToKilogramSquareMillimetersTest() => - Assert.Equal(MassMomentOfInertia.FromKilogramSquareMillimeters(2), 2.KilogramSquareMillimeters()); + Assert.Equal(MassMomentOfInertia.FromKilogramSquareMillimeters(2), 2.KilogramSquareMillimeters()); [Fact] public void NumberToKilotonneSquareCentimetersTest() => - Assert.Equal(MassMomentOfInertia.FromKilotonneSquareCentimeters(2), 2.KilotonneSquareCentimeters()); + Assert.Equal(MassMomentOfInertia.FromKilotonneSquareCentimeters(2), 2.KilotonneSquareCentimeters()); [Fact] public void NumberToKilotonneSquareDecimetersTest() => - Assert.Equal(MassMomentOfInertia.FromKilotonneSquareDecimeters(2), 2.KilotonneSquareDecimeters()); + Assert.Equal(MassMomentOfInertia.FromKilotonneSquareDecimeters(2), 2.KilotonneSquareDecimeters()); [Fact] public void NumberToKilotonneSquareMetersTest() => - Assert.Equal(MassMomentOfInertia.FromKilotonneSquareMeters(2), 2.KilotonneSquareMeters()); + Assert.Equal(MassMomentOfInertia.FromKilotonneSquareMeters(2), 2.KilotonneSquareMeters()); [Fact] public void NumberToKilotonneSquareMilimetersTest() => - Assert.Equal(MassMomentOfInertia.FromKilotonneSquareMilimeters(2), 2.KilotonneSquareMilimeters()); + Assert.Equal(MassMomentOfInertia.FromKilotonneSquareMilimeters(2), 2.KilotonneSquareMilimeters()); [Fact] public void NumberToMegatonneSquareCentimetersTest() => - Assert.Equal(MassMomentOfInertia.FromMegatonneSquareCentimeters(2), 2.MegatonneSquareCentimeters()); + Assert.Equal(MassMomentOfInertia.FromMegatonneSquareCentimeters(2), 2.MegatonneSquareCentimeters()); [Fact] public void NumberToMegatonneSquareDecimetersTest() => - Assert.Equal(MassMomentOfInertia.FromMegatonneSquareDecimeters(2), 2.MegatonneSquareDecimeters()); + Assert.Equal(MassMomentOfInertia.FromMegatonneSquareDecimeters(2), 2.MegatonneSquareDecimeters()); [Fact] public void NumberToMegatonneSquareMetersTest() => - Assert.Equal(MassMomentOfInertia.FromMegatonneSquareMeters(2), 2.MegatonneSquareMeters()); + Assert.Equal(MassMomentOfInertia.FromMegatonneSquareMeters(2), 2.MegatonneSquareMeters()); [Fact] public void NumberToMegatonneSquareMilimetersTest() => - Assert.Equal(MassMomentOfInertia.FromMegatonneSquareMilimeters(2), 2.MegatonneSquareMilimeters()); + Assert.Equal(MassMomentOfInertia.FromMegatonneSquareMilimeters(2), 2.MegatonneSquareMilimeters()); [Fact] public void NumberToMilligramSquareCentimetersTest() => - Assert.Equal(MassMomentOfInertia.FromMilligramSquareCentimeters(2), 2.MilligramSquareCentimeters()); + Assert.Equal(MassMomentOfInertia.FromMilligramSquareCentimeters(2), 2.MilligramSquareCentimeters()); [Fact] public void NumberToMilligramSquareDecimetersTest() => - Assert.Equal(MassMomentOfInertia.FromMilligramSquareDecimeters(2), 2.MilligramSquareDecimeters()); + Assert.Equal(MassMomentOfInertia.FromMilligramSquareDecimeters(2), 2.MilligramSquareDecimeters()); [Fact] public void NumberToMilligramSquareMetersTest() => - Assert.Equal(MassMomentOfInertia.FromMilligramSquareMeters(2), 2.MilligramSquareMeters()); + Assert.Equal(MassMomentOfInertia.FromMilligramSquareMeters(2), 2.MilligramSquareMeters()); [Fact] public void NumberToMilligramSquareMillimetersTest() => - Assert.Equal(MassMomentOfInertia.FromMilligramSquareMillimeters(2), 2.MilligramSquareMillimeters()); + Assert.Equal(MassMomentOfInertia.FromMilligramSquareMillimeters(2), 2.MilligramSquareMillimeters()); [Fact] public void NumberToPoundSquareFeetTest() => - Assert.Equal(MassMomentOfInertia.FromPoundSquareFeet(2), 2.PoundSquareFeet()); + Assert.Equal(MassMomentOfInertia.FromPoundSquareFeet(2), 2.PoundSquareFeet()); [Fact] public void NumberToPoundSquareInchesTest() => - Assert.Equal(MassMomentOfInertia.FromPoundSquareInches(2), 2.PoundSquareInches()); + Assert.Equal(MassMomentOfInertia.FromPoundSquareInches(2), 2.PoundSquareInches()); [Fact] public void NumberToSlugSquareFeetTest() => - Assert.Equal(MassMomentOfInertia.FromSlugSquareFeet(2), 2.SlugSquareFeet()); + Assert.Equal(MassMomentOfInertia.FromSlugSquareFeet(2), 2.SlugSquareFeet()); [Fact] public void NumberToSlugSquareInchesTest() => - Assert.Equal(MassMomentOfInertia.FromSlugSquareInches(2), 2.SlugSquareInches()); + Assert.Equal(MassMomentOfInertia.FromSlugSquareInches(2), 2.SlugSquareInches()); [Fact] public void NumberToTonneSquareCentimetersTest() => - Assert.Equal(MassMomentOfInertia.FromTonneSquareCentimeters(2), 2.TonneSquareCentimeters()); + Assert.Equal(MassMomentOfInertia.FromTonneSquareCentimeters(2), 2.TonneSquareCentimeters()); [Fact] public void NumberToTonneSquareDecimetersTest() => - Assert.Equal(MassMomentOfInertia.FromTonneSquareDecimeters(2), 2.TonneSquareDecimeters()); + Assert.Equal(MassMomentOfInertia.FromTonneSquareDecimeters(2), 2.TonneSquareDecimeters()); [Fact] public void NumberToTonneSquareMetersTest() => - Assert.Equal(MassMomentOfInertia.FromTonneSquareMeters(2), 2.TonneSquareMeters()); + Assert.Equal(MassMomentOfInertia.FromTonneSquareMeters(2), 2.TonneSquareMeters()); [Fact] public void NumberToTonneSquareMilimetersTest() => - Assert.Equal(MassMomentOfInertia.FromTonneSquareMilimeters(2), 2.TonneSquareMilimeters()); + Assert.Equal(MassMomentOfInertia.FromTonneSquareMilimeters(2), 2.TonneSquareMilimeters()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolarEnergyExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolarEnergyExtensionsTest.g.cs index 888625a0aa..64a5dd5f03 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolarEnergyExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolarEnergyExtensionsTest.g.cs @@ -21,20 +21,20 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToMolarEnergyExtensionsTests { [Fact] public void NumberToJoulesPerMoleTest() => - Assert.Equal(MolarEnergy.FromJoulesPerMole(2), 2.JoulesPerMole()); + Assert.Equal(MolarEnergy.FromJoulesPerMole(2), 2.JoulesPerMole()); [Fact] public void NumberToKilojoulesPerMoleTest() => - Assert.Equal(MolarEnergy.FromKilojoulesPerMole(2), 2.KilojoulesPerMole()); + Assert.Equal(MolarEnergy.FromKilojoulesPerMole(2), 2.KilojoulesPerMole()); [Fact] public void NumberToMegajoulesPerMoleTest() => - Assert.Equal(MolarEnergy.FromMegajoulesPerMole(2), 2.MegajoulesPerMole()); + Assert.Equal(MolarEnergy.FromMegajoulesPerMole(2), 2.MegajoulesPerMole()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolarEntropyExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolarEntropyExtensionsTest.g.cs index c38670149e..86dea9633f 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolarEntropyExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolarEntropyExtensionsTest.g.cs @@ -21,20 +21,20 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToMolarEntropyExtensionsTests { [Fact] public void NumberToJoulesPerMoleKelvinTest() => - Assert.Equal(MolarEntropy.FromJoulesPerMoleKelvin(2), 2.JoulesPerMoleKelvin()); + Assert.Equal(MolarEntropy.FromJoulesPerMoleKelvin(2), 2.JoulesPerMoleKelvin()); [Fact] public void NumberToKilojoulesPerMoleKelvinTest() => - Assert.Equal(MolarEntropy.FromKilojoulesPerMoleKelvin(2), 2.KilojoulesPerMoleKelvin()); + Assert.Equal(MolarEntropy.FromKilojoulesPerMoleKelvin(2), 2.KilojoulesPerMoleKelvin()); [Fact] public void NumberToMegajoulesPerMoleKelvinTest() => - Assert.Equal(MolarEntropy.FromMegajoulesPerMoleKelvin(2), 2.MegajoulesPerMoleKelvin()); + Assert.Equal(MolarEntropy.FromMegajoulesPerMoleKelvin(2), 2.MegajoulesPerMoleKelvin()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolarMassExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolarMassExtensionsTest.g.cs index 435f467260..1d572ed114 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolarMassExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolarMassExtensionsTest.g.cs @@ -21,56 +21,56 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToMolarMassExtensionsTests { [Fact] public void NumberToCentigramsPerMoleTest() => - Assert.Equal(MolarMass.FromCentigramsPerMole(2), 2.CentigramsPerMole()); + Assert.Equal(MolarMass.FromCentigramsPerMole(2), 2.CentigramsPerMole()); [Fact] public void NumberToDecagramsPerMoleTest() => - Assert.Equal(MolarMass.FromDecagramsPerMole(2), 2.DecagramsPerMole()); + Assert.Equal(MolarMass.FromDecagramsPerMole(2), 2.DecagramsPerMole()); [Fact] public void NumberToDecigramsPerMoleTest() => - Assert.Equal(MolarMass.FromDecigramsPerMole(2), 2.DecigramsPerMole()); + Assert.Equal(MolarMass.FromDecigramsPerMole(2), 2.DecigramsPerMole()); [Fact] public void NumberToGramsPerMoleTest() => - Assert.Equal(MolarMass.FromGramsPerMole(2), 2.GramsPerMole()); + Assert.Equal(MolarMass.FromGramsPerMole(2), 2.GramsPerMole()); [Fact] public void NumberToHectogramsPerMoleTest() => - Assert.Equal(MolarMass.FromHectogramsPerMole(2), 2.HectogramsPerMole()); + Assert.Equal(MolarMass.FromHectogramsPerMole(2), 2.HectogramsPerMole()); [Fact] public void NumberToKilogramsPerMoleTest() => - Assert.Equal(MolarMass.FromKilogramsPerMole(2), 2.KilogramsPerMole()); + Assert.Equal(MolarMass.FromKilogramsPerMole(2), 2.KilogramsPerMole()); [Fact] public void NumberToKilopoundsPerMoleTest() => - Assert.Equal(MolarMass.FromKilopoundsPerMole(2), 2.KilopoundsPerMole()); + Assert.Equal(MolarMass.FromKilopoundsPerMole(2), 2.KilopoundsPerMole()); [Fact] public void NumberToMegapoundsPerMoleTest() => - Assert.Equal(MolarMass.FromMegapoundsPerMole(2), 2.MegapoundsPerMole()); + Assert.Equal(MolarMass.FromMegapoundsPerMole(2), 2.MegapoundsPerMole()); [Fact] public void NumberToMicrogramsPerMoleTest() => - Assert.Equal(MolarMass.FromMicrogramsPerMole(2), 2.MicrogramsPerMole()); + Assert.Equal(MolarMass.FromMicrogramsPerMole(2), 2.MicrogramsPerMole()); [Fact] public void NumberToMilligramsPerMoleTest() => - Assert.Equal(MolarMass.FromMilligramsPerMole(2), 2.MilligramsPerMole()); + Assert.Equal(MolarMass.FromMilligramsPerMole(2), 2.MilligramsPerMole()); [Fact] public void NumberToNanogramsPerMoleTest() => - Assert.Equal(MolarMass.FromNanogramsPerMole(2), 2.NanogramsPerMole()); + Assert.Equal(MolarMass.FromNanogramsPerMole(2), 2.NanogramsPerMole()); [Fact] public void NumberToPoundsPerMoleTest() => - Assert.Equal(MolarMass.FromPoundsPerMole(2), 2.PoundsPerMole()); + Assert.Equal(MolarMass.FromPoundsPerMole(2), 2.PoundsPerMole()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolarityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolarityExtensionsTest.g.cs index 6e77305d5d..bc7540d82b 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolarityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolarityExtensionsTest.g.cs @@ -21,40 +21,40 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToMolarityExtensionsTests { [Fact] public void NumberToCentimolesPerLiterTest() => - Assert.Equal(Molarity.FromCentimolesPerLiter(2), 2.CentimolesPerLiter()); + Assert.Equal(Molarity.FromCentimolesPerLiter(2), 2.CentimolesPerLiter()); [Fact] public void NumberToDecimolesPerLiterTest() => - Assert.Equal(Molarity.FromDecimolesPerLiter(2), 2.DecimolesPerLiter()); + Assert.Equal(Molarity.FromDecimolesPerLiter(2), 2.DecimolesPerLiter()); [Fact] public void NumberToMicromolesPerLiterTest() => - Assert.Equal(Molarity.FromMicromolesPerLiter(2), 2.MicromolesPerLiter()); + Assert.Equal(Molarity.FromMicromolesPerLiter(2), 2.MicromolesPerLiter()); [Fact] public void NumberToMillimolesPerLiterTest() => - Assert.Equal(Molarity.FromMillimolesPerLiter(2), 2.MillimolesPerLiter()); + Assert.Equal(Molarity.FromMillimolesPerLiter(2), 2.MillimolesPerLiter()); [Fact] public void NumberToMolesPerCubicMeterTest() => - Assert.Equal(Molarity.FromMolesPerCubicMeter(2), 2.MolesPerCubicMeter()); + Assert.Equal(Molarity.FromMolesPerCubicMeter(2), 2.MolesPerCubicMeter()); [Fact] public void NumberToMolesPerLiterTest() => - Assert.Equal(Molarity.FromMolesPerLiter(2), 2.MolesPerLiter()); + Assert.Equal(Molarity.FromMolesPerLiter(2), 2.MolesPerLiter()); [Fact] public void NumberToNanomolesPerLiterTest() => - Assert.Equal(Molarity.FromNanomolesPerLiter(2), 2.NanomolesPerLiter()); + Assert.Equal(Molarity.FromNanomolesPerLiter(2), 2.NanomolesPerLiter()); [Fact] public void NumberToPicomolesPerLiterTest() => - Assert.Equal(Molarity.FromPicomolesPerLiter(2), 2.PicomolesPerLiter()); + Assert.Equal(Molarity.FromPicomolesPerLiter(2), 2.PicomolesPerLiter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPermeabilityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPermeabilityExtensionsTest.g.cs index adcc4a1ec7..3f99ce0971 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPermeabilityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPermeabilityExtensionsTest.g.cs @@ -21,12 +21,12 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToPermeabilityExtensionsTests { [Fact] public void NumberToHenriesPerMeterTest() => - Assert.Equal(Permeability.FromHenriesPerMeter(2), 2.HenriesPerMeter()); + Assert.Equal(Permeability.FromHenriesPerMeter(2), 2.HenriesPerMeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPermittivityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPermittivityExtensionsTest.g.cs index 7dbc097268..de253de1f7 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPermittivityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPermittivityExtensionsTest.g.cs @@ -21,12 +21,12 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToPermittivityExtensionsTests { [Fact] public void NumberToFaradsPerMeterTest() => - Assert.Equal(Permittivity.FromFaradsPerMeter(2), 2.FaradsPerMeter()); + Assert.Equal(Permittivity.FromFaradsPerMeter(2), 2.FaradsPerMeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPowerDensityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPowerDensityExtensionsTest.g.cs index 44a77db4e3..8b8a308ed8 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPowerDensityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPowerDensityExtensionsTest.g.cs @@ -21,184 +21,184 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToPowerDensityExtensionsTests { [Fact] public void NumberToDecawattsPerCubicFootTest() => - Assert.Equal(PowerDensity.FromDecawattsPerCubicFoot(2), 2.DecawattsPerCubicFoot()); + Assert.Equal(PowerDensity.FromDecawattsPerCubicFoot(2), 2.DecawattsPerCubicFoot()); [Fact] public void NumberToDecawattsPerCubicInchTest() => - Assert.Equal(PowerDensity.FromDecawattsPerCubicInch(2), 2.DecawattsPerCubicInch()); + Assert.Equal(PowerDensity.FromDecawattsPerCubicInch(2), 2.DecawattsPerCubicInch()); [Fact] public void NumberToDecawattsPerCubicMeterTest() => - Assert.Equal(PowerDensity.FromDecawattsPerCubicMeter(2), 2.DecawattsPerCubicMeter()); + Assert.Equal(PowerDensity.FromDecawattsPerCubicMeter(2), 2.DecawattsPerCubicMeter()); [Fact] public void NumberToDecawattsPerLiterTest() => - Assert.Equal(PowerDensity.FromDecawattsPerLiter(2), 2.DecawattsPerLiter()); + Assert.Equal(PowerDensity.FromDecawattsPerLiter(2), 2.DecawattsPerLiter()); [Fact] public void NumberToDeciwattsPerCubicFootTest() => - Assert.Equal(PowerDensity.FromDeciwattsPerCubicFoot(2), 2.DeciwattsPerCubicFoot()); + Assert.Equal(PowerDensity.FromDeciwattsPerCubicFoot(2), 2.DeciwattsPerCubicFoot()); [Fact] public void NumberToDeciwattsPerCubicInchTest() => - Assert.Equal(PowerDensity.FromDeciwattsPerCubicInch(2), 2.DeciwattsPerCubicInch()); + Assert.Equal(PowerDensity.FromDeciwattsPerCubicInch(2), 2.DeciwattsPerCubicInch()); [Fact] public void NumberToDeciwattsPerCubicMeterTest() => - Assert.Equal(PowerDensity.FromDeciwattsPerCubicMeter(2), 2.DeciwattsPerCubicMeter()); + Assert.Equal(PowerDensity.FromDeciwattsPerCubicMeter(2), 2.DeciwattsPerCubicMeter()); [Fact] public void NumberToDeciwattsPerLiterTest() => - Assert.Equal(PowerDensity.FromDeciwattsPerLiter(2), 2.DeciwattsPerLiter()); + Assert.Equal(PowerDensity.FromDeciwattsPerLiter(2), 2.DeciwattsPerLiter()); [Fact] public void NumberToGigawattsPerCubicFootTest() => - Assert.Equal(PowerDensity.FromGigawattsPerCubicFoot(2), 2.GigawattsPerCubicFoot()); + Assert.Equal(PowerDensity.FromGigawattsPerCubicFoot(2), 2.GigawattsPerCubicFoot()); [Fact] public void NumberToGigawattsPerCubicInchTest() => - Assert.Equal(PowerDensity.FromGigawattsPerCubicInch(2), 2.GigawattsPerCubicInch()); + Assert.Equal(PowerDensity.FromGigawattsPerCubicInch(2), 2.GigawattsPerCubicInch()); [Fact] public void NumberToGigawattsPerCubicMeterTest() => - Assert.Equal(PowerDensity.FromGigawattsPerCubicMeter(2), 2.GigawattsPerCubicMeter()); + Assert.Equal(PowerDensity.FromGigawattsPerCubicMeter(2), 2.GigawattsPerCubicMeter()); [Fact] public void NumberToGigawattsPerLiterTest() => - Assert.Equal(PowerDensity.FromGigawattsPerLiter(2), 2.GigawattsPerLiter()); + Assert.Equal(PowerDensity.FromGigawattsPerLiter(2), 2.GigawattsPerLiter()); [Fact] public void NumberToKilowattsPerCubicFootTest() => - Assert.Equal(PowerDensity.FromKilowattsPerCubicFoot(2), 2.KilowattsPerCubicFoot()); + Assert.Equal(PowerDensity.FromKilowattsPerCubicFoot(2), 2.KilowattsPerCubicFoot()); [Fact] public void NumberToKilowattsPerCubicInchTest() => - Assert.Equal(PowerDensity.FromKilowattsPerCubicInch(2), 2.KilowattsPerCubicInch()); + Assert.Equal(PowerDensity.FromKilowattsPerCubicInch(2), 2.KilowattsPerCubicInch()); [Fact] public void NumberToKilowattsPerCubicMeterTest() => - Assert.Equal(PowerDensity.FromKilowattsPerCubicMeter(2), 2.KilowattsPerCubicMeter()); + Assert.Equal(PowerDensity.FromKilowattsPerCubicMeter(2), 2.KilowattsPerCubicMeter()); [Fact] public void NumberToKilowattsPerLiterTest() => - Assert.Equal(PowerDensity.FromKilowattsPerLiter(2), 2.KilowattsPerLiter()); + Assert.Equal(PowerDensity.FromKilowattsPerLiter(2), 2.KilowattsPerLiter()); [Fact] public void NumberToMegawattsPerCubicFootTest() => - Assert.Equal(PowerDensity.FromMegawattsPerCubicFoot(2), 2.MegawattsPerCubicFoot()); + Assert.Equal(PowerDensity.FromMegawattsPerCubicFoot(2), 2.MegawattsPerCubicFoot()); [Fact] public void NumberToMegawattsPerCubicInchTest() => - Assert.Equal(PowerDensity.FromMegawattsPerCubicInch(2), 2.MegawattsPerCubicInch()); + Assert.Equal(PowerDensity.FromMegawattsPerCubicInch(2), 2.MegawattsPerCubicInch()); [Fact] public void NumberToMegawattsPerCubicMeterTest() => - Assert.Equal(PowerDensity.FromMegawattsPerCubicMeter(2), 2.MegawattsPerCubicMeter()); + Assert.Equal(PowerDensity.FromMegawattsPerCubicMeter(2), 2.MegawattsPerCubicMeter()); [Fact] public void NumberToMegawattsPerLiterTest() => - Assert.Equal(PowerDensity.FromMegawattsPerLiter(2), 2.MegawattsPerLiter()); + Assert.Equal(PowerDensity.FromMegawattsPerLiter(2), 2.MegawattsPerLiter()); [Fact] public void NumberToMicrowattsPerCubicFootTest() => - Assert.Equal(PowerDensity.FromMicrowattsPerCubicFoot(2), 2.MicrowattsPerCubicFoot()); + Assert.Equal(PowerDensity.FromMicrowattsPerCubicFoot(2), 2.MicrowattsPerCubicFoot()); [Fact] public void NumberToMicrowattsPerCubicInchTest() => - Assert.Equal(PowerDensity.FromMicrowattsPerCubicInch(2), 2.MicrowattsPerCubicInch()); + Assert.Equal(PowerDensity.FromMicrowattsPerCubicInch(2), 2.MicrowattsPerCubicInch()); [Fact] public void NumberToMicrowattsPerCubicMeterTest() => - Assert.Equal(PowerDensity.FromMicrowattsPerCubicMeter(2), 2.MicrowattsPerCubicMeter()); + Assert.Equal(PowerDensity.FromMicrowattsPerCubicMeter(2), 2.MicrowattsPerCubicMeter()); [Fact] public void NumberToMicrowattsPerLiterTest() => - Assert.Equal(PowerDensity.FromMicrowattsPerLiter(2), 2.MicrowattsPerLiter()); + Assert.Equal(PowerDensity.FromMicrowattsPerLiter(2), 2.MicrowattsPerLiter()); [Fact] public void NumberToMilliwattsPerCubicFootTest() => - Assert.Equal(PowerDensity.FromMilliwattsPerCubicFoot(2), 2.MilliwattsPerCubicFoot()); + Assert.Equal(PowerDensity.FromMilliwattsPerCubicFoot(2), 2.MilliwattsPerCubicFoot()); [Fact] public void NumberToMilliwattsPerCubicInchTest() => - Assert.Equal(PowerDensity.FromMilliwattsPerCubicInch(2), 2.MilliwattsPerCubicInch()); + Assert.Equal(PowerDensity.FromMilliwattsPerCubicInch(2), 2.MilliwattsPerCubicInch()); [Fact] public void NumberToMilliwattsPerCubicMeterTest() => - Assert.Equal(PowerDensity.FromMilliwattsPerCubicMeter(2), 2.MilliwattsPerCubicMeter()); + Assert.Equal(PowerDensity.FromMilliwattsPerCubicMeter(2), 2.MilliwattsPerCubicMeter()); [Fact] public void NumberToMilliwattsPerLiterTest() => - Assert.Equal(PowerDensity.FromMilliwattsPerLiter(2), 2.MilliwattsPerLiter()); + Assert.Equal(PowerDensity.FromMilliwattsPerLiter(2), 2.MilliwattsPerLiter()); [Fact] public void NumberToNanowattsPerCubicFootTest() => - Assert.Equal(PowerDensity.FromNanowattsPerCubicFoot(2), 2.NanowattsPerCubicFoot()); + Assert.Equal(PowerDensity.FromNanowattsPerCubicFoot(2), 2.NanowattsPerCubicFoot()); [Fact] public void NumberToNanowattsPerCubicInchTest() => - Assert.Equal(PowerDensity.FromNanowattsPerCubicInch(2), 2.NanowattsPerCubicInch()); + Assert.Equal(PowerDensity.FromNanowattsPerCubicInch(2), 2.NanowattsPerCubicInch()); [Fact] public void NumberToNanowattsPerCubicMeterTest() => - Assert.Equal(PowerDensity.FromNanowattsPerCubicMeter(2), 2.NanowattsPerCubicMeter()); + Assert.Equal(PowerDensity.FromNanowattsPerCubicMeter(2), 2.NanowattsPerCubicMeter()); [Fact] public void NumberToNanowattsPerLiterTest() => - Assert.Equal(PowerDensity.FromNanowattsPerLiter(2), 2.NanowattsPerLiter()); + Assert.Equal(PowerDensity.FromNanowattsPerLiter(2), 2.NanowattsPerLiter()); [Fact] public void NumberToPicowattsPerCubicFootTest() => - Assert.Equal(PowerDensity.FromPicowattsPerCubicFoot(2), 2.PicowattsPerCubicFoot()); + Assert.Equal(PowerDensity.FromPicowattsPerCubicFoot(2), 2.PicowattsPerCubicFoot()); [Fact] public void NumberToPicowattsPerCubicInchTest() => - Assert.Equal(PowerDensity.FromPicowattsPerCubicInch(2), 2.PicowattsPerCubicInch()); + Assert.Equal(PowerDensity.FromPicowattsPerCubicInch(2), 2.PicowattsPerCubicInch()); [Fact] public void NumberToPicowattsPerCubicMeterTest() => - Assert.Equal(PowerDensity.FromPicowattsPerCubicMeter(2), 2.PicowattsPerCubicMeter()); + Assert.Equal(PowerDensity.FromPicowattsPerCubicMeter(2), 2.PicowattsPerCubicMeter()); [Fact] public void NumberToPicowattsPerLiterTest() => - Assert.Equal(PowerDensity.FromPicowattsPerLiter(2), 2.PicowattsPerLiter()); + Assert.Equal(PowerDensity.FromPicowattsPerLiter(2), 2.PicowattsPerLiter()); [Fact] public void NumberToTerawattsPerCubicFootTest() => - Assert.Equal(PowerDensity.FromTerawattsPerCubicFoot(2), 2.TerawattsPerCubicFoot()); + Assert.Equal(PowerDensity.FromTerawattsPerCubicFoot(2), 2.TerawattsPerCubicFoot()); [Fact] public void NumberToTerawattsPerCubicInchTest() => - Assert.Equal(PowerDensity.FromTerawattsPerCubicInch(2), 2.TerawattsPerCubicInch()); + Assert.Equal(PowerDensity.FromTerawattsPerCubicInch(2), 2.TerawattsPerCubicInch()); [Fact] public void NumberToTerawattsPerCubicMeterTest() => - Assert.Equal(PowerDensity.FromTerawattsPerCubicMeter(2), 2.TerawattsPerCubicMeter()); + Assert.Equal(PowerDensity.FromTerawattsPerCubicMeter(2), 2.TerawattsPerCubicMeter()); [Fact] public void NumberToTerawattsPerLiterTest() => - Assert.Equal(PowerDensity.FromTerawattsPerLiter(2), 2.TerawattsPerLiter()); + Assert.Equal(PowerDensity.FromTerawattsPerLiter(2), 2.TerawattsPerLiter()); [Fact] public void NumberToWattsPerCubicFootTest() => - Assert.Equal(PowerDensity.FromWattsPerCubicFoot(2), 2.WattsPerCubicFoot()); + Assert.Equal(PowerDensity.FromWattsPerCubicFoot(2), 2.WattsPerCubicFoot()); [Fact] public void NumberToWattsPerCubicInchTest() => - Assert.Equal(PowerDensity.FromWattsPerCubicInch(2), 2.WattsPerCubicInch()); + Assert.Equal(PowerDensity.FromWattsPerCubicInch(2), 2.WattsPerCubicInch()); [Fact] public void NumberToWattsPerCubicMeterTest() => - Assert.Equal(PowerDensity.FromWattsPerCubicMeter(2), 2.WattsPerCubicMeter()); + Assert.Equal(PowerDensity.FromWattsPerCubicMeter(2), 2.WattsPerCubicMeter()); [Fact] public void NumberToWattsPerLiterTest() => - Assert.Equal(PowerDensity.FromWattsPerLiter(2), 2.WattsPerLiter()); + Assert.Equal(PowerDensity.FromWattsPerLiter(2), 2.WattsPerLiter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPowerExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPowerExtensionsTest.g.cs index a9cf5b5f94..6fc25b4b36 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPowerExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPowerExtensionsTest.g.cs @@ -21,108 +21,108 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToPowerExtensionsTests { [Fact] public void NumberToBoilerHorsepowerTest() => - Assert.Equal(Power.FromBoilerHorsepower(2), 2.BoilerHorsepower()); + Assert.Equal(Power.FromBoilerHorsepower(2), 2.BoilerHorsepower()); [Fact] public void NumberToBritishThermalUnitsPerHourTest() => - Assert.Equal(Power.FromBritishThermalUnitsPerHour(2), 2.BritishThermalUnitsPerHour()); + Assert.Equal(Power.FromBritishThermalUnitsPerHour(2), 2.BritishThermalUnitsPerHour()); [Fact] public void NumberToDecawattsTest() => - Assert.Equal(Power.FromDecawatts(2), 2.Decawatts()); + Assert.Equal(Power.FromDecawatts(2), 2.Decawatts()); [Fact] public void NumberToDeciwattsTest() => - Assert.Equal(Power.FromDeciwatts(2), 2.Deciwatts()); + Assert.Equal(Power.FromDeciwatts(2), 2.Deciwatts()); [Fact] public void NumberToElectricalHorsepowerTest() => - Assert.Equal(Power.FromElectricalHorsepower(2), 2.ElectricalHorsepower()); + Assert.Equal(Power.FromElectricalHorsepower(2), 2.ElectricalHorsepower()); [Fact] public void NumberToFemtowattsTest() => - Assert.Equal(Power.FromFemtowatts(2), 2.Femtowatts()); + Assert.Equal(Power.FromFemtowatts(2), 2.Femtowatts()); [Fact] public void NumberToGigajoulesPerHourTest() => - Assert.Equal(Power.FromGigajoulesPerHour(2), 2.GigajoulesPerHour()); + Assert.Equal(Power.FromGigajoulesPerHour(2), 2.GigajoulesPerHour()); [Fact] public void NumberToGigawattsTest() => - Assert.Equal(Power.FromGigawatts(2), 2.Gigawatts()); + Assert.Equal(Power.FromGigawatts(2), 2.Gigawatts()); [Fact] public void NumberToHydraulicHorsepowerTest() => - Assert.Equal(Power.FromHydraulicHorsepower(2), 2.HydraulicHorsepower()); + Assert.Equal(Power.FromHydraulicHorsepower(2), 2.HydraulicHorsepower()); [Fact] public void NumberToJoulesPerHourTest() => - Assert.Equal(Power.FromJoulesPerHour(2), 2.JoulesPerHour()); + Assert.Equal(Power.FromJoulesPerHour(2), 2.JoulesPerHour()); [Fact] public void NumberToKilobritishThermalUnitsPerHourTest() => - Assert.Equal(Power.FromKilobritishThermalUnitsPerHour(2), 2.KilobritishThermalUnitsPerHour()); + Assert.Equal(Power.FromKilobritishThermalUnitsPerHour(2), 2.KilobritishThermalUnitsPerHour()); [Fact] public void NumberToKilojoulesPerHourTest() => - Assert.Equal(Power.FromKilojoulesPerHour(2), 2.KilojoulesPerHour()); + Assert.Equal(Power.FromKilojoulesPerHour(2), 2.KilojoulesPerHour()); [Fact] public void NumberToKilowattsTest() => - Assert.Equal(Power.FromKilowatts(2), 2.Kilowatts()); + Assert.Equal(Power.FromKilowatts(2), 2.Kilowatts()); [Fact] public void NumberToMechanicalHorsepowerTest() => - Assert.Equal(Power.FromMechanicalHorsepower(2), 2.MechanicalHorsepower()); + Assert.Equal(Power.FromMechanicalHorsepower(2), 2.MechanicalHorsepower()); [Fact] public void NumberToMegajoulesPerHourTest() => - Assert.Equal(Power.FromMegajoulesPerHour(2), 2.MegajoulesPerHour()); + Assert.Equal(Power.FromMegajoulesPerHour(2), 2.MegajoulesPerHour()); [Fact] public void NumberToMegawattsTest() => - Assert.Equal(Power.FromMegawatts(2), 2.Megawatts()); + Assert.Equal(Power.FromMegawatts(2), 2.Megawatts()); [Fact] public void NumberToMetricHorsepowerTest() => - Assert.Equal(Power.FromMetricHorsepower(2), 2.MetricHorsepower()); + Assert.Equal(Power.FromMetricHorsepower(2), 2.MetricHorsepower()); [Fact] public void NumberToMicrowattsTest() => - Assert.Equal(Power.FromMicrowatts(2), 2.Microwatts()); + Assert.Equal(Power.FromMicrowatts(2), 2.Microwatts()); [Fact] public void NumberToMillijoulesPerHourTest() => - Assert.Equal(Power.FromMillijoulesPerHour(2), 2.MillijoulesPerHour()); + Assert.Equal(Power.FromMillijoulesPerHour(2), 2.MillijoulesPerHour()); [Fact] public void NumberToMilliwattsTest() => - Assert.Equal(Power.FromMilliwatts(2), 2.Milliwatts()); + Assert.Equal(Power.FromMilliwatts(2), 2.Milliwatts()); [Fact] public void NumberToNanowattsTest() => - Assert.Equal(Power.FromNanowatts(2), 2.Nanowatts()); + Assert.Equal(Power.FromNanowatts(2), 2.Nanowatts()); [Fact] public void NumberToPetawattsTest() => - Assert.Equal(Power.FromPetawatts(2), 2.Petawatts()); + Assert.Equal(Power.FromPetawatts(2), 2.Petawatts()); [Fact] public void NumberToPicowattsTest() => - Assert.Equal(Power.FromPicowatts(2), 2.Picowatts()); + Assert.Equal(Power.FromPicowatts(2), 2.Picowatts()); [Fact] public void NumberToTerawattsTest() => - Assert.Equal(Power.FromTerawatts(2), 2.Terawatts()); + Assert.Equal(Power.FromTerawatts(2), 2.Terawatts()); [Fact] public void NumberToWattsTest() => - Assert.Equal(Power.FromWatts(2), 2.Watts()); + Assert.Equal(Power.FromWatts(2), 2.Watts()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPowerRatioExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPowerRatioExtensionsTest.g.cs index f9cb9ce23d..394d3d139d 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPowerRatioExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPowerRatioExtensionsTest.g.cs @@ -21,16 +21,16 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToPowerRatioExtensionsTests { [Fact] public void NumberToDecibelMilliwattsTest() => - Assert.Equal(PowerRatio.FromDecibelMilliwatts(2), 2.DecibelMilliwatts()); + Assert.Equal(PowerRatio.FromDecibelMilliwatts(2), 2.DecibelMilliwatts()); [Fact] public void NumberToDecibelWattsTest() => - Assert.Equal(PowerRatio.FromDecibelWatts(2), 2.DecibelWatts()); + Assert.Equal(PowerRatio.FromDecibelWatts(2), 2.DecibelWatts()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPressureChangeRateExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPressureChangeRateExtensionsTest.g.cs index 5187b44395..c0d1a3db15 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPressureChangeRateExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPressureChangeRateExtensionsTest.g.cs @@ -21,36 +21,36 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToPressureChangeRateExtensionsTests { [Fact] public void NumberToAtmospheresPerSecondTest() => - Assert.Equal(PressureChangeRate.FromAtmospheresPerSecond(2), 2.AtmospheresPerSecond()); + Assert.Equal(PressureChangeRate.FromAtmospheresPerSecond(2), 2.AtmospheresPerSecond()); [Fact] public void NumberToKilopascalsPerMinuteTest() => - Assert.Equal(PressureChangeRate.FromKilopascalsPerMinute(2), 2.KilopascalsPerMinute()); + Assert.Equal(PressureChangeRate.FromKilopascalsPerMinute(2), 2.KilopascalsPerMinute()); [Fact] public void NumberToKilopascalsPerSecondTest() => - Assert.Equal(PressureChangeRate.FromKilopascalsPerSecond(2), 2.KilopascalsPerSecond()); + Assert.Equal(PressureChangeRate.FromKilopascalsPerSecond(2), 2.KilopascalsPerSecond()); [Fact] public void NumberToMegapascalsPerMinuteTest() => - Assert.Equal(PressureChangeRate.FromMegapascalsPerMinute(2), 2.MegapascalsPerMinute()); + Assert.Equal(PressureChangeRate.FromMegapascalsPerMinute(2), 2.MegapascalsPerMinute()); [Fact] public void NumberToMegapascalsPerSecondTest() => - Assert.Equal(PressureChangeRate.FromMegapascalsPerSecond(2), 2.MegapascalsPerSecond()); + Assert.Equal(PressureChangeRate.FromMegapascalsPerSecond(2), 2.MegapascalsPerSecond()); [Fact] public void NumberToPascalsPerMinuteTest() => - Assert.Equal(PressureChangeRate.FromPascalsPerMinute(2), 2.PascalsPerMinute()); + Assert.Equal(PressureChangeRate.FromPascalsPerMinute(2), 2.PascalsPerMinute()); [Fact] public void NumberToPascalsPerSecondTest() => - Assert.Equal(PressureChangeRate.FromPascalsPerSecond(2), 2.PascalsPerSecond()); + Assert.Equal(PressureChangeRate.FromPascalsPerSecond(2), 2.PascalsPerSecond()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPressureExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPressureExtensionsTest.g.cs index 5995faa37c..a8c0b5e364 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPressureExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPressureExtensionsTest.g.cs @@ -21,176 +21,176 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToPressureExtensionsTests { [Fact] public void NumberToAtmospheresTest() => - Assert.Equal(Pressure.FromAtmospheres(2), 2.Atmospheres()); + Assert.Equal(Pressure.FromAtmospheres(2), 2.Atmospheres()); [Fact] public void NumberToBarsTest() => - Assert.Equal(Pressure.FromBars(2), 2.Bars()); + Assert.Equal(Pressure.FromBars(2), 2.Bars()); [Fact] public void NumberToCentibarsTest() => - Assert.Equal(Pressure.FromCentibars(2), 2.Centibars()); + Assert.Equal(Pressure.FromCentibars(2), 2.Centibars()); [Fact] public void NumberToDecapascalsTest() => - Assert.Equal(Pressure.FromDecapascals(2), 2.Decapascals()); + Assert.Equal(Pressure.FromDecapascals(2), 2.Decapascals()); [Fact] public void NumberToDecibarsTest() => - Assert.Equal(Pressure.FromDecibars(2), 2.Decibars()); + Assert.Equal(Pressure.FromDecibars(2), 2.Decibars()); [Fact] public void NumberToDynesPerSquareCentimeterTest() => - Assert.Equal(Pressure.FromDynesPerSquareCentimeter(2), 2.DynesPerSquareCentimeter()); + Assert.Equal(Pressure.FromDynesPerSquareCentimeter(2), 2.DynesPerSquareCentimeter()); [Fact] public void NumberToFeetOfHeadTest() => - Assert.Equal(Pressure.FromFeetOfHead(2), 2.FeetOfHead()); + Assert.Equal(Pressure.FromFeetOfHead(2), 2.FeetOfHead()); [Fact] public void NumberToGigapascalsTest() => - Assert.Equal(Pressure.FromGigapascals(2), 2.Gigapascals()); + Assert.Equal(Pressure.FromGigapascals(2), 2.Gigapascals()); [Fact] public void NumberToHectopascalsTest() => - Assert.Equal(Pressure.FromHectopascals(2), 2.Hectopascals()); + Assert.Equal(Pressure.FromHectopascals(2), 2.Hectopascals()); [Fact] public void NumberToInchesOfMercuryTest() => - Assert.Equal(Pressure.FromInchesOfMercury(2), 2.InchesOfMercury()); + Assert.Equal(Pressure.FromInchesOfMercury(2), 2.InchesOfMercury()); [Fact] public void NumberToInchesOfWaterColumnTest() => - Assert.Equal(Pressure.FromInchesOfWaterColumn(2), 2.InchesOfWaterColumn()); + Assert.Equal(Pressure.FromInchesOfWaterColumn(2), 2.InchesOfWaterColumn()); [Fact] public void NumberToKilobarsTest() => - Assert.Equal(Pressure.FromKilobars(2), 2.Kilobars()); + Assert.Equal(Pressure.FromKilobars(2), 2.Kilobars()); [Fact] public void NumberToKilogramsForcePerSquareCentimeterTest() => - Assert.Equal(Pressure.FromKilogramsForcePerSquareCentimeter(2), 2.KilogramsForcePerSquareCentimeter()); + Assert.Equal(Pressure.FromKilogramsForcePerSquareCentimeter(2), 2.KilogramsForcePerSquareCentimeter()); [Fact] public void NumberToKilogramsForcePerSquareMeterTest() => - Assert.Equal(Pressure.FromKilogramsForcePerSquareMeter(2), 2.KilogramsForcePerSquareMeter()); + Assert.Equal(Pressure.FromKilogramsForcePerSquareMeter(2), 2.KilogramsForcePerSquareMeter()); [Fact] public void NumberToKilogramsForcePerSquareMillimeterTest() => - Assert.Equal(Pressure.FromKilogramsForcePerSquareMillimeter(2), 2.KilogramsForcePerSquareMillimeter()); + Assert.Equal(Pressure.FromKilogramsForcePerSquareMillimeter(2), 2.KilogramsForcePerSquareMillimeter()); [Fact] public void NumberToKilonewtonsPerSquareCentimeterTest() => - Assert.Equal(Pressure.FromKilonewtonsPerSquareCentimeter(2), 2.KilonewtonsPerSquareCentimeter()); + Assert.Equal(Pressure.FromKilonewtonsPerSquareCentimeter(2), 2.KilonewtonsPerSquareCentimeter()); [Fact] public void NumberToKilonewtonsPerSquareMeterTest() => - Assert.Equal(Pressure.FromKilonewtonsPerSquareMeter(2), 2.KilonewtonsPerSquareMeter()); + Assert.Equal(Pressure.FromKilonewtonsPerSquareMeter(2), 2.KilonewtonsPerSquareMeter()); [Fact] public void NumberToKilonewtonsPerSquareMillimeterTest() => - Assert.Equal(Pressure.FromKilonewtonsPerSquareMillimeter(2), 2.KilonewtonsPerSquareMillimeter()); + Assert.Equal(Pressure.FromKilonewtonsPerSquareMillimeter(2), 2.KilonewtonsPerSquareMillimeter()); [Fact] public void NumberToKilopascalsTest() => - Assert.Equal(Pressure.FromKilopascals(2), 2.Kilopascals()); + Assert.Equal(Pressure.FromKilopascals(2), 2.Kilopascals()); [Fact] public void NumberToKilopoundsForcePerSquareFootTest() => - Assert.Equal(Pressure.FromKilopoundsForcePerSquareFoot(2), 2.KilopoundsForcePerSquareFoot()); + Assert.Equal(Pressure.FromKilopoundsForcePerSquareFoot(2), 2.KilopoundsForcePerSquareFoot()); [Fact] public void NumberToKilopoundsForcePerSquareInchTest() => - Assert.Equal(Pressure.FromKilopoundsForcePerSquareInch(2), 2.KilopoundsForcePerSquareInch()); + Assert.Equal(Pressure.FromKilopoundsForcePerSquareInch(2), 2.KilopoundsForcePerSquareInch()); [Fact] public void NumberToMegabarsTest() => - Assert.Equal(Pressure.FromMegabars(2), 2.Megabars()); + Assert.Equal(Pressure.FromMegabars(2), 2.Megabars()); [Fact] public void NumberToMeganewtonsPerSquareMeterTest() => - Assert.Equal(Pressure.FromMeganewtonsPerSquareMeter(2), 2.MeganewtonsPerSquareMeter()); + Assert.Equal(Pressure.FromMeganewtonsPerSquareMeter(2), 2.MeganewtonsPerSquareMeter()); [Fact] public void NumberToMegapascalsTest() => - Assert.Equal(Pressure.FromMegapascals(2), 2.Megapascals()); + Assert.Equal(Pressure.FromMegapascals(2), 2.Megapascals()); [Fact] public void NumberToMetersOfHeadTest() => - Assert.Equal(Pressure.FromMetersOfHead(2), 2.MetersOfHead()); + Assert.Equal(Pressure.FromMetersOfHead(2), 2.MetersOfHead()); [Fact] public void NumberToMicrobarsTest() => - Assert.Equal(Pressure.FromMicrobars(2), 2.Microbars()); + Assert.Equal(Pressure.FromMicrobars(2), 2.Microbars()); [Fact] public void NumberToMicropascalsTest() => - Assert.Equal(Pressure.FromMicropascals(2), 2.Micropascals()); + Assert.Equal(Pressure.FromMicropascals(2), 2.Micropascals()); [Fact] public void NumberToMillibarsTest() => - Assert.Equal(Pressure.FromMillibars(2), 2.Millibars()); + Assert.Equal(Pressure.FromMillibars(2), 2.Millibars()); [Fact] public void NumberToMillimetersOfMercuryTest() => - Assert.Equal(Pressure.FromMillimetersOfMercury(2), 2.MillimetersOfMercury()); + Assert.Equal(Pressure.FromMillimetersOfMercury(2), 2.MillimetersOfMercury()); [Fact] public void NumberToMillipascalsTest() => - Assert.Equal(Pressure.FromMillipascals(2), 2.Millipascals()); + Assert.Equal(Pressure.FromMillipascals(2), 2.Millipascals()); [Fact] public void NumberToNewtonsPerSquareCentimeterTest() => - Assert.Equal(Pressure.FromNewtonsPerSquareCentimeter(2), 2.NewtonsPerSquareCentimeter()); + Assert.Equal(Pressure.FromNewtonsPerSquareCentimeter(2), 2.NewtonsPerSquareCentimeter()); [Fact] public void NumberToNewtonsPerSquareMeterTest() => - Assert.Equal(Pressure.FromNewtonsPerSquareMeter(2), 2.NewtonsPerSquareMeter()); + Assert.Equal(Pressure.FromNewtonsPerSquareMeter(2), 2.NewtonsPerSquareMeter()); [Fact] public void NumberToNewtonsPerSquareMillimeterTest() => - Assert.Equal(Pressure.FromNewtonsPerSquareMillimeter(2), 2.NewtonsPerSquareMillimeter()); + Assert.Equal(Pressure.FromNewtonsPerSquareMillimeter(2), 2.NewtonsPerSquareMillimeter()); [Fact] public void NumberToPascalsTest() => - Assert.Equal(Pressure.FromPascals(2), 2.Pascals()); + Assert.Equal(Pressure.FromPascals(2), 2.Pascals()); [Fact] public void NumberToPoundsForcePerSquareFootTest() => - Assert.Equal(Pressure.FromPoundsForcePerSquareFoot(2), 2.PoundsForcePerSquareFoot()); + Assert.Equal(Pressure.FromPoundsForcePerSquareFoot(2), 2.PoundsForcePerSquareFoot()); [Fact] public void NumberToPoundsForcePerSquareInchTest() => - Assert.Equal(Pressure.FromPoundsForcePerSquareInch(2), 2.PoundsForcePerSquareInch()); + Assert.Equal(Pressure.FromPoundsForcePerSquareInch(2), 2.PoundsForcePerSquareInch()); [Fact] public void NumberToPoundsPerInchSecondSquaredTest() => - Assert.Equal(Pressure.FromPoundsPerInchSecondSquared(2), 2.PoundsPerInchSecondSquared()); + Assert.Equal(Pressure.FromPoundsPerInchSecondSquared(2), 2.PoundsPerInchSecondSquared()); [Fact] public void NumberToTechnicalAtmospheresTest() => - Assert.Equal(Pressure.FromTechnicalAtmospheres(2), 2.TechnicalAtmospheres()); + Assert.Equal(Pressure.FromTechnicalAtmospheres(2), 2.TechnicalAtmospheres()); [Fact] public void NumberToTonnesForcePerSquareCentimeterTest() => - Assert.Equal(Pressure.FromTonnesForcePerSquareCentimeter(2), 2.TonnesForcePerSquareCentimeter()); + Assert.Equal(Pressure.FromTonnesForcePerSquareCentimeter(2), 2.TonnesForcePerSquareCentimeter()); [Fact] public void NumberToTonnesForcePerSquareMeterTest() => - Assert.Equal(Pressure.FromTonnesForcePerSquareMeter(2), 2.TonnesForcePerSquareMeter()); + Assert.Equal(Pressure.FromTonnesForcePerSquareMeter(2), 2.TonnesForcePerSquareMeter()); [Fact] public void NumberToTonnesForcePerSquareMillimeterTest() => - Assert.Equal(Pressure.FromTonnesForcePerSquareMillimeter(2), 2.TonnesForcePerSquareMillimeter()); + Assert.Equal(Pressure.FromTonnesForcePerSquareMillimeter(2), 2.TonnesForcePerSquareMillimeter()); [Fact] public void NumberToTorrsTest() => - Assert.Equal(Pressure.FromTorrs(2), 2.Torrs()); + Assert.Equal(Pressure.FromTorrs(2), 2.Torrs()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRatioChangeRateExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRatioChangeRateExtensionsTest.g.cs index 2c8909a213..c860e0a7c9 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRatioChangeRateExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRatioChangeRateExtensionsTest.g.cs @@ -21,16 +21,16 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToRatioChangeRateExtensionsTests { [Fact] public void NumberToDecimalFractionsPerSecondTest() => - Assert.Equal(RatioChangeRate.FromDecimalFractionsPerSecond(2), 2.DecimalFractionsPerSecond()); + Assert.Equal(RatioChangeRate.FromDecimalFractionsPerSecond(2), 2.DecimalFractionsPerSecond()); [Fact] public void NumberToPercentsPerSecondTest() => - Assert.Equal(RatioChangeRate.FromPercentsPerSecond(2), 2.PercentsPerSecond()); + Assert.Equal(RatioChangeRate.FromPercentsPerSecond(2), 2.PercentsPerSecond()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRatioExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRatioExtensionsTest.g.cs index 29cd75e5d6..c50a54759f 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRatioExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRatioExtensionsTest.g.cs @@ -21,32 +21,32 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToRatioExtensionsTests { [Fact] public void NumberToDecimalFractionsTest() => - Assert.Equal(Ratio.FromDecimalFractions(2), 2.DecimalFractions()); + Assert.Equal(Ratio.FromDecimalFractions(2), 2.DecimalFractions()); [Fact] public void NumberToPartsPerBillionTest() => - Assert.Equal(Ratio.FromPartsPerBillion(2), 2.PartsPerBillion()); + Assert.Equal(Ratio.FromPartsPerBillion(2), 2.PartsPerBillion()); [Fact] public void NumberToPartsPerMillionTest() => - Assert.Equal(Ratio.FromPartsPerMillion(2), 2.PartsPerMillion()); + Assert.Equal(Ratio.FromPartsPerMillion(2), 2.PartsPerMillion()); [Fact] public void NumberToPartsPerThousandTest() => - Assert.Equal(Ratio.FromPartsPerThousand(2), 2.PartsPerThousand()); + Assert.Equal(Ratio.FromPartsPerThousand(2), 2.PartsPerThousand()); [Fact] public void NumberToPartsPerTrillionTest() => - Assert.Equal(Ratio.FromPartsPerTrillion(2), 2.PartsPerTrillion()); + Assert.Equal(Ratio.FromPartsPerTrillion(2), 2.PartsPerTrillion()); [Fact] public void NumberToPercentTest() => - Assert.Equal(Ratio.FromPercent(2), 2.Percent()); + Assert.Equal(Ratio.FromPercent(2), 2.Percent()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToReactiveEnergyExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToReactiveEnergyExtensionsTest.g.cs index 76b08293df..9e6b4a01ae 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToReactiveEnergyExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToReactiveEnergyExtensionsTest.g.cs @@ -21,20 +21,20 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToReactiveEnergyExtensionsTests { [Fact] public void NumberToKilovoltampereReactiveHoursTest() => - Assert.Equal(ReactiveEnergy.FromKilovoltampereReactiveHours(2), 2.KilovoltampereReactiveHours()); + Assert.Equal(ReactiveEnergy.FromKilovoltampereReactiveHours(2), 2.KilovoltampereReactiveHours()); [Fact] public void NumberToMegavoltampereReactiveHoursTest() => - Assert.Equal(ReactiveEnergy.FromMegavoltampereReactiveHours(2), 2.MegavoltampereReactiveHours()); + Assert.Equal(ReactiveEnergy.FromMegavoltampereReactiveHours(2), 2.MegavoltampereReactiveHours()); [Fact] public void NumberToVoltampereReactiveHoursTest() => - Assert.Equal(ReactiveEnergy.FromVoltampereReactiveHours(2), 2.VoltampereReactiveHours()); + Assert.Equal(ReactiveEnergy.FromVoltampereReactiveHours(2), 2.VoltampereReactiveHours()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToReactivePowerExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToReactivePowerExtensionsTest.g.cs index 5634f70bef..d54a48eac5 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToReactivePowerExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToReactivePowerExtensionsTest.g.cs @@ -21,24 +21,24 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToReactivePowerExtensionsTests { [Fact] public void NumberToGigavoltamperesReactiveTest() => - Assert.Equal(ReactivePower.FromGigavoltamperesReactive(2), 2.GigavoltamperesReactive()); + Assert.Equal(ReactivePower.FromGigavoltamperesReactive(2), 2.GigavoltamperesReactive()); [Fact] public void NumberToKilovoltamperesReactiveTest() => - Assert.Equal(ReactivePower.FromKilovoltamperesReactive(2), 2.KilovoltamperesReactive()); + Assert.Equal(ReactivePower.FromKilovoltamperesReactive(2), 2.KilovoltamperesReactive()); [Fact] public void NumberToMegavoltamperesReactiveTest() => - Assert.Equal(ReactivePower.FromMegavoltamperesReactive(2), 2.MegavoltamperesReactive()); + Assert.Equal(ReactivePower.FromMegavoltamperesReactive(2), 2.MegavoltamperesReactive()); [Fact] public void NumberToVoltamperesReactiveTest() => - Assert.Equal(ReactivePower.FromVoltamperesReactive(2), 2.VoltamperesReactive()); + Assert.Equal(ReactivePower.FromVoltamperesReactive(2), 2.VoltamperesReactive()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRelativeHumidityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRelativeHumidityExtensionsTest.g.cs index 22c13239c9..b016980395 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRelativeHumidityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRelativeHumidityExtensionsTest.g.cs @@ -21,12 +21,12 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToRelativeHumidityExtensionsTests { [Fact] public void NumberToPercentTest() => - Assert.Equal(RelativeHumidity.FromPercent(2), 2.Percent()); + Assert.Equal(RelativeHumidity.FromPercent(2), 2.Percent()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRotationalAccelerationExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRotationalAccelerationExtensionsTest.g.cs index 76ec15463c..58b4f5965d 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRotationalAccelerationExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRotationalAccelerationExtensionsTest.g.cs @@ -21,24 +21,24 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToRotationalAccelerationExtensionsTests { [Fact] public void NumberToDegreesPerSecondSquaredTest() => - Assert.Equal(RotationalAcceleration.FromDegreesPerSecondSquared(2), 2.DegreesPerSecondSquared()); + Assert.Equal(RotationalAcceleration.FromDegreesPerSecondSquared(2), 2.DegreesPerSecondSquared()); [Fact] public void NumberToRadiansPerSecondSquaredTest() => - Assert.Equal(RotationalAcceleration.FromRadiansPerSecondSquared(2), 2.RadiansPerSecondSquared()); + Assert.Equal(RotationalAcceleration.FromRadiansPerSecondSquared(2), 2.RadiansPerSecondSquared()); [Fact] public void NumberToRevolutionsPerMinutePerSecondTest() => - Assert.Equal(RotationalAcceleration.FromRevolutionsPerMinutePerSecond(2), 2.RevolutionsPerMinutePerSecond()); + Assert.Equal(RotationalAcceleration.FromRevolutionsPerMinutePerSecond(2), 2.RevolutionsPerMinutePerSecond()); [Fact] public void NumberToRevolutionsPerSecondSquaredTest() => - Assert.Equal(RotationalAcceleration.FromRevolutionsPerSecondSquared(2), 2.RevolutionsPerSecondSquared()); + Assert.Equal(RotationalAcceleration.FromRevolutionsPerSecondSquared(2), 2.RevolutionsPerSecondSquared()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRotationalSpeedExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRotationalSpeedExtensionsTest.g.cs index 15ee76c684..1fb3015038 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRotationalSpeedExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRotationalSpeedExtensionsTest.g.cs @@ -21,60 +21,60 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToRotationalSpeedExtensionsTests { [Fact] public void NumberToCentiradiansPerSecondTest() => - Assert.Equal(RotationalSpeed.FromCentiradiansPerSecond(2), 2.CentiradiansPerSecond()); + Assert.Equal(RotationalSpeed.FromCentiradiansPerSecond(2), 2.CentiradiansPerSecond()); [Fact] public void NumberToDeciradiansPerSecondTest() => - Assert.Equal(RotationalSpeed.FromDeciradiansPerSecond(2), 2.DeciradiansPerSecond()); + Assert.Equal(RotationalSpeed.FromDeciradiansPerSecond(2), 2.DeciradiansPerSecond()); [Fact] public void NumberToDegreesPerMinuteTest() => - Assert.Equal(RotationalSpeed.FromDegreesPerMinute(2), 2.DegreesPerMinute()); + Assert.Equal(RotationalSpeed.FromDegreesPerMinute(2), 2.DegreesPerMinute()); [Fact] public void NumberToDegreesPerSecondTest() => - Assert.Equal(RotationalSpeed.FromDegreesPerSecond(2), 2.DegreesPerSecond()); + Assert.Equal(RotationalSpeed.FromDegreesPerSecond(2), 2.DegreesPerSecond()); [Fact] public void NumberToMicrodegreesPerSecondTest() => - Assert.Equal(RotationalSpeed.FromMicrodegreesPerSecond(2), 2.MicrodegreesPerSecond()); + Assert.Equal(RotationalSpeed.FromMicrodegreesPerSecond(2), 2.MicrodegreesPerSecond()); [Fact] public void NumberToMicroradiansPerSecondTest() => - Assert.Equal(RotationalSpeed.FromMicroradiansPerSecond(2), 2.MicroradiansPerSecond()); + Assert.Equal(RotationalSpeed.FromMicroradiansPerSecond(2), 2.MicroradiansPerSecond()); [Fact] public void NumberToMillidegreesPerSecondTest() => - Assert.Equal(RotationalSpeed.FromMillidegreesPerSecond(2), 2.MillidegreesPerSecond()); + Assert.Equal(RotationalSpeed.FromMillidegreesPerSecond(2), 2.MillidegreesPerSecond()); [Fact] public void NumberToMilliradiansPerSecondTest() => - Assert.Equal(RotationalSpeed.FromMilliradiansPerSecond(2), 2.MilliradiansPerSecond()); + Assert.Equal(RotationalSpeed.FromMilliradiansPerSecond(2), 2.MilliradiansPerSecond()); [Fact] public void NumberToNanodegreesPerSecondTest() => - Assert.Equal(RotationalSpeed.FromNanodegreesPerSecond(2), 2.NanodegreesPerSecond()); + Assert.Equal(RotationalSpeed.FromNanodegreesPerSecond(2), 2.NanodegreesPerSecond()); [Fact] public void NumberToNanoradiansPerSecondTest() => - Assert.Equal(RotationalSpeed.FromNanoradiansPerSecond(2), 2.NanoradiansPerSecond()); + Assert.Equal(RotationalSpeed.FromNanoradiansPerSecond(2), 2.NanoradiansPerSecond()); [Fact] public void NumberToRadiansPerSecondTest() => - Assert.Equal(RotationalSpeed.FromRadiansPerSecond(2), 2.RadiansPerSecond()); + Assert.Equal(RotationalSpeed.FromRadiansPerSecond(2), 2.RadiansPerSecond()); [Fact] public void NumberToRevolutionsPerMinuteTest() => - Assert.Equal(RotationalSpeed.FromRevolutionsPerMinute(2), 2.RevolutionsPerMinute()); + Assert.Equal(RotationalSpeed.FromRevolutionsPerMinute(2), 2.RevolutionsPerMinute()); [Fact] public void NumberToRevolutionsPerSecondTest() => - Assert.Equal(RotationalSpeed.FromRevolutionsPerSecond(2), 2.RevolutionsPerSecond()); + Assert.Equal(RotationalSpeed.FromRevolutionsPerSecond(2), 2.RevolutionsPerSecond()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRotationalStiffnessExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRotationalStiffnessExtensionsTest.g.cs index ad4161b976..9a089e7c20 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRotationalStiffnessExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRotationalStiffnessExtensionsTest.g.cs @@ -21,140 +21,140 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToRotationalStiffnessExtensionsTests { [Fact] public void NumberToCentinewtonMetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromCentinewtonMetersPerDegree(2), 2.CentinewtonMetersPerDegree()); + Assert.Equal(RotationalStiffness.FromCentinewtonMetersPerDegree(2), 2.CentinewtonMetersPerDegree()); [Fact] public void NumberToCentinewtonMillimetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromCentinewtonMillimetersPerDegree(2), 2.CentinewtonMillimetersPerDegree()); + Assert.Equal(RotationalStiffness.FromCentinewtonMillimetersPerDegree(2), 2.CentinewtonMillimetersPerDegree()); [Fact] public void NumberToCentinewtonMillimetersPerRadianTest() => - Assert.Equal(RotationalStiffness.FromCentinewtonMillimetersPerRadian(2), 2.CentinewtonMillimetersPerRadian()); + Assert.Equal(RotationalStiffness.FromCentinewtonMillimetersPerRadian(2), 2.CentinewtonMillimetersPerRadian()); [Fact] public void NumberToDecanewtonMetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromDecanewtonMetersPerDegree(2), 2.DecanewtonMetersPerDegree()); + Assert.Equal(RotationalStiffness.FromDecanewtonMetersPerDegree(2), 2.DecanewtonMetersPerDegree()); [Fact] public void NumberToDecanewtonMillimetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromDecanewtonMillimetersPerDegree(2), 2.DecanewtonMillimetersPerDegree()); + Assert.Equal(RotationalStiffness.FromDecanewtonMillimetersPerDegree(2), 2.DecanewtonMillimetersPerDegree()); [Fact] public void NumberToDecanewtonMillimetersPerRadianTest() => - Assert.Equal(RotationalStiffness.FromDecanewtonMillimetersPerRadian(2), 2.DecanewtonMillimetersPerRadian()); + Assert.Equal(RotationalStiffness.FromDecanewtonMillimetersPerRadian(2), 2.DecanewtonMillimetersPerRadian()); [Fact] public void NumberToDecinewtonMetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromDecinewtonMetersPerDegree(2), 2.DecinewtonMetersPerDegree()); + Assert.Equal(RotationalStiffness.FromDecinewtonMetersPerDegree(2), 2.DecinewtonMetersPerDegree()); [Fact] public void NumberToDecinewtonMillimetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromDecinewtonMillimetersPerDegree(2), 2.DecinewtonMillimetersPerDegree()); + Assert.Equal(RotationalStiffness.FromDecinewtonMillimetersPerDegree(2), 2.DecinewtonMillimetersPerDegree()); [Fact] public void NumberToDecinewtonMillimetersPerRadianTest() => - Assert.Equal(RotationalStiffness.FromDecinewtonMillimetersPerRadian(2), 2.DecinewtonMillimetersPerRadian()); + Assert.Equal(RotationalStiffness.FromDecinewtonMillimetersPerRadian(2), 2.DecinewtonMillimetersPerRadian()); [Fact] public void NumberToKilonewtonMetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromKilonewtonMetersPerDegree(2), 2.KilonewtonMetersPerDegree()); + Assert.Equal(RotationalStiffness.FromKilonewtonMetersPerDegree(2), 2.KilonewtonMetersPerDegree()); [Fact] public void NumberToKilonewtonMetersPerRadianTest() => - Assert.Equal(RotationalStiffness.FromKilonewtonMetersPerRadian(2), 2.KilonewtonMetersPerRadian()); + Assert.Equal(RotationalStiffness.FromKilonewtonMetersPerRadian(2), 2.KilonewtonMetersPerRadian()); [Fact] public void NumberToKilonewtonMillimetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromKilonewtonMillimetersPerDegree(2), 2.KilonewtonMillimetersPerDegree()); + Assert.Equal(RotationalStiffness.FromKilonewtonMillimetersPerDegree(2), 2.KilonewtonMillimetersPerDegree()); [Fact] public void NumberToKilonewtonMillimetersPerRadianTest() => - Assert.Equal(RotationalStiffness.FromKilonewtonMillimetersPerRadian(2), 2.KilonewtonMillimetersPerRadian()); + Assert.Equal(RotationalStiffness.FromKilonewtonMillimetersPerRadian(2), 2.KilonewtonMillimetersPerRadian()); [Fact] public void NumberToKilopoundForceFeetPerDegreesTest() => - Assert.Equal(RotationalStiffness.FromKilopoundForceFeetPerDegrees(2), 2.KilopoundForceFeetPerDegrees()); + Assert.Equal(RotationalStiffness.FromKilopoundForceFeetPerDegrees(2), 2.KilopoundForceFeetPerDegrees()); [Fact] public void NumberToMeganewtonMetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromMeganewtonMetersPerDegree(2), 2.MeganewtonMetersPerDegree()); + Assert.Equal(RotationalStiffness.FromMeganewtonMetersPerDegree(2), 2.MeganewtonMetersPerDegree()); [Fact] public void NumberToMeganewtonMetersPerRadianTest() => - Assert.Equal(RotationalStiffness.FromMeganewtonMetersPerRadian(2), 2.MeganewtonMetersPerRadian()); + Assert.Equal(RotationalStiffness.FromMeganewtonMetersPerRadian(2), 2.MeganewtonMetersPerRadian()); [Fact] public void NumberToMeganewtonMillimetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromMeganewtonMillimetersPerDegree(2), 2.MeganewtonMillimetersPerDegree()); + Assert.Equal(RotationalStiffness.FromMeganewtonMillimetersPerDegree(2), 2.MeganewtonMillimetersPerDegree()); [Fact] public void NumberToMeganewtonMillimetersPerRadianTest() => - Assert.Equal(RotationalStiffness.FromMeganewtonMillimetersPerRadian(2), 2.MeganewtonMillimetersPerRadian()); + Assert.Equal(RotationalStiffness.FromMeganewtonMillimetersPerRadian(2), 2.MeganewtonMillimetersPerRadian()); [Fact] public void NumberToMicronewtonMetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromMicronewtonMetersPerDegree(2), 2.MicronewtonMetersPerDegree()); + Assert.Equal(RotationalStiffness.FromMicronewtonMetersPerDegree(2), 2.MicronewtonMetersPerDegree()); [Fact] public void NumberToMicronewtonMillimetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromMicronewtonMillimetersPerDegree(2), 2.MicronewtonMillimetersPerDegree()); + Assert.Equal(RotationalStiffness.FromMicronewtonMillimetersPerDegree(2), 2.MicronewtonMillimetersPerDegree()); [Fact] public void NumberToMicronewtonMillimetersPerRadianTest() => - Assert.Equal(RotationalStiffness.FromMicronewtonMillimetersPerRadian(2), 2.MicronewtonMillimetersPerRadian()); + Assert.Equal(RotationalStiffness.FromMicronewtonMillimetersPerRadian(2), 2.MicronewtonMillimetersPerRadian()); [Fact] public void NumberToMillinewtonMetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromMillinewtonMetersPerDegree(2), 2.MillinewtonMetersPerDegree()); + Assert.Equal(RotationalStiffness.FromMillinewtonMetersPerDegree(2), 2.MillinewtonMetersPerDegree()); [Fact] public void NumberToMillinewtonMillimetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromMillinewtonMillimetersPerDegree(2), 2.MillinewtonMillimetersPerDegree()); + Assert.Equal(RotationalStiffness.FromMillinewtonMillimetersPerDegree(2), 2.MillinewtonMillimetersPerDegree()); [Fact] public void NumberToMillinewtonMillimetersPerRadianTest() => - Assert.Equal(RotationalStiffness.FromMillinewtonMillimetersPerRadian(2), 2.MillinewtonMillimetersPerRadian()); + Assert.Equal(RotationalStiffness.FromMillinewtonMillimetersPerRadian(2), 2.MillinewtonMillimetersPerRadian()); [Fact] public void NumberToNanonewtonMetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromNanonewtonMetersPerDegree(2), 2.NanonewtonMetersPerDegree()); + Assert.Equal(RotationalStiffness.FromNanonewtonMetersPerDegree(2), 2.NanonewtonMetersPerDegree()); [Fact] public void NumberToNanonewtonMillimetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromNanonewtonMillimetersPerDegree(2), 2.NanonewtonMillimetersPerDegree()); + Assert.Equal(RotationalStiffness.FromNanonewtonMillimetersPerDegree(2), 2.NanonewtonMillimetersPerDegree()); [Fact] public void NumberToNanonewtonMillimetersPerRadianTest() => - Assert.Equal(RotationalStiffness.FromNanonewtonMillimetersPerRadian(2), 2.NanonewtonMillimetersPerRadian()); + Assert.Equal(RotationalStiffness.FromNanonewtonMillimetersPerRadian(2), 2.NanonewtonMillimetersPerRadian()); [Fact] public void NumberToNewtonMetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromNewtonMetersPerDegree(2), 2.NewtonMetersPerDegree()); + Assert.Equal(RotationalStiffness.FromNewtonMetersPerDegree(2), 2.NewtonMetersPerDegree()); [Fact] public void NumberToNewtonMetersPerRadianTest() => - Assert.Equal(RotationalStiffness.FromNewtonMetersPerRadian(2), 2.NewtonMetersPerRadian()); + Assert.Equal(RotationalStiffness.FromNewtonMetersPerRadian(2), 2.NewtonMetersPerRadian()); [Fact] public void NumberToNewtonMillimetersPerDegreeTest() => - Assert.Equal(RotationalStiffness.FromNewtonMillimetersPerDegree(2), 2.NewtonMillimetersPerDegree()); + Assert.Equal(RotationalStiffness.FromNewtonMillimetersPerDegree(2), 2.NewtonMillimetersPerDegree()); [Fact] public void NumberToNewtonMillimetersPerRadianTest() => - Assert.Equal(RotationalStiffness.FromNewtonMillimetersPerRadian(2), 2.NewtonMillimetersPerRadian()); + Assert.Equal(RotationalStiffness.FromNewtonMillimetersPerRadian(2), 2.NewtonMillimetersPerRadian()); [Fact] public void NumberToPoundForceFeetPerRadianTest() => - Assert.Equal(RotationalStiffness.FromPoundForceFeetPerRadian(2), 2.PoundForceFeetPerRadian()); + Assert.Equal(RotationalStiffness.FromPoundForceFeetPerRadian(2), 2.PoundForceFeetPerRadian()); [Fact] public void NumberToPoundForceFeetPerDegreesTest() => - Assert.Equal(RotationalStiffness.FromPoundForceFeetPerDegrees(2), 2.PoundForceFeetPerDegrees()); + Assert.Equal(RotationalStiffness.FromPoundForceFeetPerDegrees(2), 2.PoundForceFeetPerDegrees()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRotationalStiffnessPerLengthExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRotationalStiffnessPerLengthExtensionsTest.g.cs index 8f93a44bd1..15350812bf 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRotationalStiffnessPerLengthExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToRotationalStiffnessPerLengthExtensionsTest.g.cs @@ -21,28 +21,28 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToRotationalStiffnessPerLengthExtensionsTests { [Fact] public void NumberToKilonewtonMetersPerRadianPerMeterTest() => - Assert.Equal(RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(2), 2.KilonewtonMetersPerRadianPerMeter()); + Assert.Equal(RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(2), 2.KilonewtonMetersPerRadianPerMeter()); [Fact] public void NumberToKilopoundForceFeetPerDegreesPerFeetTest() => - Assert.Equal(RotationalStiffnessPerLength.FromKilopoundForceFeetPerDegreesPerFeet(2), 2.KilopoundForceFeetPerDegreesPerFeet()); + Assert.Equal(RotationalStiffnessPerLength.FromKilopoundForceFeetPerDegreesPerFeet(2), 2.KilopoundForceFeetPerDegreesPerFeet()); [Fact] public void NumberToMeganewtonMetersPerRadianPerMeterTest() => - Assert.Equal(RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(2), 2.MeganewtonMetersPerRadianPerMeter()); + Assert.Equal(RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(2), 2.MeganewtonMetersPerRadianPerMeter()); [Fact] public void NumberToNewtonMetersPerRadianPerMeterTest() => - Assert.Equal(RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(2), 2.NewtonMetersPerRadianPerMeter()); + Assert.Equal(RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(2), 2.NewtonMetersPerRadianPerMeter()); [Fact] public void NumberToPoundForceFeetPerDegreesPerFeetTest() => - Assert.Equal(RotationalStiffnessPerLength.FromPoundForceFeetPerDegreesPerFeet(2), 2.PoundForceFeetPerDegreesPerFeet()); + Assert.Equal(RotationalStiffnessPerLength.FromPoundForceFeetPerDegreesPerFeet(2), 2.PoundForceFeetPerDegreesPerFeet()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSolidAngleExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSolidAngleExtensionsTest.g.cs index 2f62ef1c62..0dc93b1df4 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSolidAngleExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSolidAngleExtensionsTest.g.cs @@ -21,12 +21,12 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToSolidAngleExtensionsTests { [Fact] public void NumberToSteradiansTest() => - Assert.Equal(SolidAngle.FromSteradians(2), 2.Steradians()); + Assert.Equal(SolidAngle.FromSteradians(2), 2.Steradians()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpecificEnergyExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpecificEnergyExtensionsTest.g.cs index 93e772d161..6d21b31e5f 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpecificEnergyExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpecificEnergyExtensionsTest.g.cs @@ -21,108 +21,108 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToSpecificEnergyExtensionsTests { [Fact] public void NumberToBtuPerPoundTest() => - Assert.Equal(SpecificEnergy.FromBtuPerPound(2), 2.BtuPerPound()); + Assert.Equal(SpecificEnergy.FromBtuPerPound(2), 2.BtuPerPound()); [Fact] public void NumberToCaloriesPerGramTest() => - Assert.Equal(SpecificEnergy.FromCaloriesPerGram(2), 2.CaloriesPerGram()); + Assert.Equal(SpecificEnergy.FromCaloriesPerGram(2), 2.CaloriesPerGram()); [Fact] public void NumberToGigawattDaysPerKilogramTest() => - Assert.Equal(SpecificEnergy.FromGigawattDaysPerKilogram(2), 2.GigawattDaysPerKilogram()); + Assert.Equal(SpecificEnergy.FromGigawattDaysPerKilogram(2), 2.GigawattDaysPerKilogram()); [Fact] public void NumberToGigawattDaysPerShortTonTest() => - Assert.Equal(SpecificEnergy.FromGigawattDaysPerShortTon(2), 2.GigawattDaysPerShortTon()); + Assert.Equal(SpecificEnergy.FromGigawattDaysPerShortTon(2), 2.GigawattDaysPerShortTon()); [Fact] public void NumberToGigawattDaysPerTonneTest() => - Assert.Equal(SpecificEnergy.FromGigawattDaysPerTonne(2), 2.GigawattDaysPerTonne()); + Assert.Equal(SpecificEnergy.FromGigawattDaysPerTonne(2), 2.GigawattDaysPerTonne()); [Fact] public void NumberToGigawattHoursPerKilogramTest() => - Assert.Equal(SpecificEnergy.FromGigawattHoursPerKilogram(2), 2.GigawattHoursPerKilogram()); + Assert.Equal(SpecificEnergy.FromGigawattHoursPerKilogram(2), 2.GigawattHoursPerKilogram()); [Fact] public void NumberToJoulesPerKilogramTest() => - Assert.Equal(SpecificEnergy.FromJoulesPerKilogram(2), 2.JoulesPerKilogram()); + Assert.Equal(SpecificEnergy.FromJoulesPerKilogram(2), 2.JoulesPerKilogram()); [Fact] public void NumberToKilocaloriesPerGramTest() => - Assert.Equal(SpecificEnergy.FromKilocaloriesPerGram(2), 2.KilocaloriesPerGram()); + Assert.Equal(SpecificEnergy.FromKilocaloriesPerGram(2), 2.KilocaloriesPerGram()); [Fact] public void NumberToKilojoulesPerKilogramTest() => - Assert.Equal(SpecificEnergy.FromKilojoulesPerKilogram(2), 2.KilojoulesPerKilogram()); + Assert.Equal(SpecificEnergy.FromKilojoulesPerKilogram(2), 2.KilojoulesPerKilogram()); [Fact] public void NumberToKilowattDaysPerKilogramTest() => - Assert.Equal(SpecificEnergy.FromKilowattDaysPerKilogram(2), 2.KilowattDaysPerKilogram()); + Assert.Equal(SpecificEnergy.FromKilowattDaysPerKilogram(2), 2.KilowattDaysPerKilogram()); [Fact] public void NumberToKilowattDaysPerShortTonTest() => - Assert.Equal(SpecificEnergy.FromKilowattDaysPerShortTon(2), 2.KilowattDaysPerShortTon()); + Assert.Equal(SpecificEnergy.FromKilowattDaysPerShortTon(2), 2.KilowattDaysPerShortTon()); [Fact] public void NumberToKilowattDaysPerTonneTest() => - Assert.Equal(SpecificEnergy.FromKilowattDaysPerTonne(2), 2.KilowattDaysPerTonne()); + Assert.Equal(SpecificEnergy.FromKilowattDaysPerTonne(2), 2.KilowattDaysPerTonne()); [Fact] public void NumberToKilowattHoursPerKilogramTest() => - Assert.Equal(SpecificEnergy.FromKilowattHoursPerKilogram(2), 2.KilowattHoursPerKilogram()); + Assert.Equal(SpecificEnergy.FromKilowattHoursPerKilogram(2), 2.KilowattHoursPerKilogram()); [Fact] public void NumberToMegajoulesPerKilogramTest() => - Assert.Equal(SpecificEnergy.FromMegajoulesPerKilogram(2), 2.MegajoulesPerKilogram()); + Assert.Equal(SpecificEnergy.FromMegajoulesPerKilogram(2), 2.MegajoulesPerKilogram()); [Fact] public void NumberToMegawattDaysPerKilogramTest() => - Assert.Equal(SpecificEnergy.FromMegawattDaysPerKilogram(2), 2.MegawattDaysPerKilogram()); + Assert.Equal(SpecificEnergy.FromMegawattDaysPerKilogram(2), 2.MegawattDaysPerKilogram()); [Fact] public void NumberToMegawattDaysPerShortTonTest() => - Assert.Equal(SpecificEnergy.FromMegawattDaysPerShortTon(2), 2.MegawattDaysPerShortTon()); + Assert.Equal(SpecificEnergy.FromMegawattDaysPerShortTon(2), 2.MegawattDaysPerShortTon()); [Fact] public void NumberToMegawattDaysPerTonneTest() => - Assert.Equal(SpecificEnergy.FromMegawattDaysPerTonne(2), 2.MegawattDaysPerTonne()); + Assert.Equal(SpecificEnergy.FromMegawattDaysPerTonne(2), 2.MegawattDaysPerTonne()); [Fact] public void NumberToMegawattHoursPerKilogramTest() => - Assert.Equal(SpecificEnergy.FromMegawattHoursPerKilogram(2), 2.MegawattHoursPerKilogram()); + Assert.Equal(SpecificEnergy.FromMegawattHoursPerKilogram(2), 2.MegawattHoursPerKilogram()); [Fact] public void NumberToTerawattDaysPerKilogramTest() => - Assert.Equal(SpecificEnergy.FromTerawattDaysPerKilogram(2), 2.TerawattDaysPerKilogram()); + Assert.Equal(SpecificEnergy.FromTerawattDaysPerKilogram(2), 2.TerawattDaysPerKilogram()); [Fact] public void NumberToTerawattDaysPerShortTonTest() => - Assert.Equal(SpecificEnergy.FromTerawattDaysPerShortTon(2), 2.TerawattDaysPerShortTon()); + Assert.Equal(SpecificEnergy.FromTerawattDaysPerShortTon(2), 2.TerawattDaysPerShortTon()); [Fact] public void NumberToTerawattDaysPerTonneTest() => - Assert.Equal(SpecificEnergy.FromTerawattDaysPerTonne(2), 2.TerawattDaysPerTonne()); + Assert.Equal(SpecificEnergy.FromTerawattDaysPerTonne(2), 2.TerawattDaysPerTonne()); [Fact] public void NumberToWattDaysPerKilogramTest() => - Assert.Equal(SpecificEnergy.FromWattDaysPerKilogram(2), 2.WattDaysPerKilogram()); + Assert.Equal(SpecificEnergy.FromWattDaysPerKilogram(2), 2.WattDaysPerKilogram()); [Fact] public void NumberToWattDaysPerShortTonTest() => - Assert.Equal(SpecificEnergy.FromWattDaysPerShortTon(2), 2.WattDaysPerShortTon()); + Assert.Equal(SpecificEnergy.FromWattDaysPerShortTon(2), 2.WattDaysPerShortTon()); [Fact] public void NumberToWattDaysPerTonneTest() => - Assert.Equal(SpecificEnergy.FromWattDaysPerTonne(2), 2.WattDaysPerTonne()); + Assert.Equal(SpecificEnergy.FromWattDaysPerTonne(2), 2.WattDaysPerTonne()); [Fact] public void NumberToWattHoursPerKilogramTest() => - Assert.Equal(SpecificEnergy.FromWattHoursPerKilogram(2), 2.WattHoursPerKilogram()); + Assert.Equal(SpecificEnergy.FromWattHoursPerKilogram(2), 2.WattHoursPerKilogram()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpecificEntropyExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpecificEntropyExtensionsTest.g.cs index 95593fbdf9..116910a4ad 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpecificEntropyExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpecificEntropyExtensionsTest.g.cs @@ -21,44 +21,44 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToSpecificEntropyExtensionsTests { [Fact] public void NumberToBtusPerPoundFahrenheitTest() => - Assert.Equal(SpecificEntropy.FromBtusPerPoundFahrenheit(2), 2.BtusPerPoundFahrenheit()); + Assert.Equal(SpecificEntropy.FromBtusPerPoundFahrenheit(2), 2.BtusPerPoundFahrenheit()); [Fact] public void NumberToCaloriesPerGramKelvinTest() => - Assert.Equal(SpecificEntropy.FromCaloriesPerGramKelvin(2), 2.CaloriesPerGramKelvin()); + Assert.Equal(SpecificEntropy.FromCaloriesPerGramKelvin(2), 2.CaloriesPerGramKelvin()); [Fact] public void NumberToJoulesPerKilogramDegreeCelsiusTest() => - Assert.Equal(SpecificEntropy.FromJoulesPerKilogramDegreeCelsius(2), 2.JoulesPerKilogramDegreeCelsius()); + Assert.Equal(SpecificEntropy.FromJoulesPerKilogramDegreeCelsius(2), 2.JoulesPerKilogramDegreeCelsius()); [Fact] public void NumberToJoulesPerKilogramKelvinTest() => - Assert.Equal(SpecificEntropy.FromJoulesPerKilogramKelvin(2), 2.JoulesPerKilogramKelvin()); + Assert.Equal(SpecificEntropy.FromJoulesPerKilogramKelvin(2), 2.JoulesPerKilogramKelvin()); [Fact] public void NumberToKilocaloriesPerGramKelvinTest() => - Assert.Equal(SpecificEntropy.FromKilocaloriesPerGramKelvin(2), 2.KilocaloriesPerGramKelvin()); + Assert.Equal(SpecificEntropy.FromKilocaloriesPerGramKelvin(2), 2.KilocaloriesPerGramKelvin()); [Fact] public void NumberToKilojoulesPerKilogramDegreeCelsiusTest() => - Assert.Equal(SpecificEntropy.FromKilojoulesPerKilogramDegreeCelsius(2), 2.KilojoulesPerKilogramDegreeCelsius()); + Assert.Equal(SpecificEntropy.FromKilojoulesPerKilogramDegreeCelsius(2), 2.KilojoulesPerKilogramDegreeCelsius()); [Fact] public void NumberToKilojoulesPerKilogramKelvinTest() => - Assert.Equal(SpecificEntropy.FromKilojoulesPerKilogramKelvin(2), 2.KilojoulesPerKilogramKelvin()); + Assert.Equal(SpecificEntropy.FromKilojoulesPerKilogramKelvin(2), 2.KilojoulesPerKilogramKelvin()); [Fact] public void NumberToMegajoulesPerKilogramDegreeCelsiusTest() => - Assert.Equal(SpecificEntropy.FromMegajoulesPerKilogramDegreeCelsius(2), 2.MegajoulesPerKilogramDegreeCelsius()); + Assert.Equal(SpecificEntropy.FromMegajoulesPerKilogramDegreeCelsius(2), 2.MegajoulesPerKilogramDegreeCelsius()); [Fact] public void NumberToMegajoulesPerKilogramKelvinTest() => - Assert.Equal(SpecificEntropy.FromMegajoulesPerKilogramKelvin(2), 2.MegajoulesPerKilogramKelvin()); + Assert.Equal(SpecificEntropy.FromMegajoulesPerKilogramKelvin(2), 2.MegajoulesPerKilogramKelvin()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpecificVolumeExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpecificVolumeExtensionsTest.g.cs index f38987467e..7310366ec4 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpecificVolumeExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpecificVolumeExtensionsTest.g.cs @@ -21,20 +21,20 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToSpecificVolumeExtensionsTests { [Fact] public void NumberToCubicFeetPerPoundTest() => - Assert.Equal(SpecificVolume.FromCubicFeetPerPound(2), 2.CubicFeetPerPound()); + Assert.Equal(SpecificVolume.FromCubicFeetPerPound(2), 2.CubicFeetPerPound()); [Fact] public void NumberToCubicMetersPerKilogramTest() => - Assert.Equal(SpecificVolume.FromCubicMetersPerKilogram(2), 2.CubicMetersPerKilogram()); + Assert.Equal(SpecificVolume.FromCubicMetersPerKilogram(2), 2.CubicMetersPerKilogram()); [Fact] public void NumberToMillicubicMetersPerKilogramTest() => - Assert.Equal(SpecificVolume.FromMillicubicMetersPerKilogram(2), 2.MillicubicMetersPerKilogram()); + Assert.Equal(SpecificVolume.FromMillicubicMetersPerKilogram(2), 2.MillicubicMetersPerKilogram()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpecificWeightExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpecificWeightExtensionsTest.g.cs index 5b86231aee..a5c1a1d3df 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpecificWeightExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpecificWeightExtensionsTest.g.cs @@ -21,76 +21,76 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToSpecificWeightExtensionsTests { [Fact] public void NumberToKilogramsForcePerCubicCentimeterTest() => - Assert.Equal(SpecificWeight.FromKilogramsForcePerCubicCentimeter(2), 2.KilogramsForcePerCubicCentimeter()); + Assert.Equal(SpecificWeight.FromKilogramsForcePerCubicCentimeter(2), 2.KilogramsForcePerCubicCentimeter()); [Fact] public void NumberToKilogramsForcePerCubicMeterTest() => - Assert.Equal(SpecificWeight.FromKilogramsForcePerCubicMeter(2), 2.KilogramsForcePerCubicMeter()); + Assert.Equal(SpecificWeight.FromKilogramsForcePerCubicMeter(2), 2.KilogramsForcePerCubicMeter()); [Fact] public void NumberToKilogramsForcePerCubicMillimeterTest() => - Assert.Equal(SpecificWeight.FromKilogramsForcePerCubicMillimeter(2), 2.KilogramsForcePerCubicMillimeter()); + Assert.Equal(SpecificWeight.FromKilogramsForcePerCubicMillimeter(2), 2.KilogramsForcePerCubicMillimeter()); [Fact] public void NumberToKilonewtonsPerCubicCentimeterTest() => - Assert.Equal(SpecificWeight.FromKilonewtonsPerCubicCentimeter(2), 2.KilonewtonsPerCubicCentimeter()); + Assert.Equal(SpecificWeight.FromKilonewtonsPerCubicCentimeter(2), 2.KilonewtonsPerCubicCentimeter()); [Fact] public void NumberToKilonewtonsPerCubicMeterTest() => - Assert.Equal(SpecificWeight.FromKilonewtonsPerCubicMeter(2), 2.KilonewtonsPerCubicMeter()); + Assert.Equal(SpecificWeight.FromKilonewtonsPerCubicMeter(2), 2.KilonewtonsPerCubicMeter()); [Fact] public void NumberToKilonewtonsPerCubicMillimeterTest() => - Assert.Equal(SpecificWeight.FromKilonewtonsPerCubicMillimeter(2), 2.KilonewtonsPerCubicMillimeter()); + Assert.Equal(SpecificWeight.FromKilonewtonsPerCubicMillimeter(2), 2.KilonewtonsPerCubicMillimeter()); [Fact] public void NumberToKilopoundsForcePerCubicFootTest() => - Assert.Equal(SpecificWeight.FromKilopoundsForcePerCubicFoot(2), 2.KilopoundsForcePerCubicFoot()); + Assert.Equal(SpecificWeight.FromKilopoundsForcePerCubicFoot(2), 2.KilopoundsForcePerCubicFoot()); [Fact] public void NumberToKilopoundsForcePerCubicInchTest() => - Assert.Equal(SpecificWeight.FromKilopoundsForcePerCubicInch(2), 2.KilopoundsForcePerCubicInch()); + Assert.Equal(SpecificWeight.FromKilopoundsForcePerCubicInch(2), 2.KilopoundsForcePerCubicInch()); [Fact] public void NumberToMeganewtonsPerCubicMeterTest() => - Assert.Equal(SpecificWeight.FromMeganewtonsPerCubicMeter(2), 2.MeganewtonsPerCubicMeter()); + Assert.Equal(SpecificWeight.FromMeganewtonsPerCubicMeter(2), 2.MeganewtonsPerCubicMeter()); [Fact] public void NumberToNewtonsPerCubicCentimeterTest() => - Assert.Equal(SpecificWeight.FromNewtonsPerCubicCentimeter(2), 2.NewtonsPerCubicCentimeter()); + Assert.Equal(SpecificWeight.FromNewtonsPerCubicCentimeter(2), 2.NewtonsPerCubicCentimeter()); [Fact] public void NumberToNewtonsPerCubicMeterTest() => - Assert.Equal(SpecificWeight.FromNewtonsPerCubicMeter(2), 2.NewtonsPerCubicMeter()); + Assert.Equal(SpecificWeight.FromNewtonsPerCubicMeter(2), 2.NewtonsPerCubicMeter()); [Fact] public void NumberToNewtonsPerCubicMillimeterTest() => - Assert.Equal(SpecificWeight.FromNewtonsPerCubicMillimeter(2), 2.NewtonsPerCubicMillimeter()); + Assert.Equal(SpecificWeight.FromNewtonsPerCubicMillimeter(2), 2.NewtonsPerCubicMillimeter()); [Fact] public void NumberToPoundsForcePerCubicFootTest() => - Assert.Equal(SpecificWeight.FromPoundsForcePerCubicFoot(2), 2.PoundsForcePerCubicFoot()); + Assert.Equal(SpecificWeight.FromPoundsForcePerCubicFoot(2), 2.PoundsForcePerCubicFoot()); [Fact] public void NumberToPoundsForcePerCubicInchTest() => - Assert.Equal(SpecificWeight.FromPoundsForcePerCubicInch(2), 2.PoundsForcePerCubicInch()); + Assert.Equal(SpecificWeight.FromPoundsForcePerCubicInch(2), 2.PoundsForcePerCubicInch()); [Fact] public void NumberToTonnesForcePerCubicCentimeterTest() => - Assert.Equal(SpecificWeight.FromTonnesForcePerCubicCentimeter(2), 2.TonnesForcePerCubicCentimeter()); + Assert.Equal(SpecificWeight.FromTonnesForcePerCubicCentimeter(2), 2.TonnesForcePerCubicCentimeter()); [Fact] public void NumberToTonnesForcePerCubicMeterTest() => - Assert.Equal(SpecificWeight.FromTonnesForcePerCubicMeter(2), 2.TonnesForcePerCubicMeter()); + Assert.Equal(SpecificWeight.FromTonnesForcePerCubicMeter(2), 2.TonnesForcePerCubicMeter()); [Fact] public void NumberToTonnesForcePerCubicMillimeterTest() => - Assert.Equal(SpecificWeight.FromTonnesForcePerCubicMillimeter(2), 2.TonnesForcePerCubicMillimeter()); + Assert.Equal(SpecificWeight.FromTonnesForcePerCubicMillimeter(2), 2.TonnesForcePerCubicMillimeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpeedExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpeedExtensionsTest.g.cs index cf82f33e6c..5100b97ca6 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpeedExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpeedExtensionsTest.g.cs @@ -21,136 +21,136 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToSpeedExtensionsTests { [Fact] public void NumberToCentimetersPerHourTest() => - Assert.Equal(Speed.FromCentimetersPerHour(2), 2.CentimetersPerHour()); + Assert.Equal(Speed.FromCentimetersPerHour(2), 2.CentimetersPerHour()); [Fact] public void NumberToCentimetersPerMinutesTest() => - Assert.Equal(Speed.FromCentimetersPerMinutes(2), 2.CentimetersPerMinutes()); + Assert.Equal(Speed.FromCentimetersPerMinutes(2), 2.CentimetersPerMinutes()); [Fact] public void NumberToCentimetersPerSecondTest() => - Assert.Equal(Speed.FromCentimetersPerSecond(2), 2.CentimetersPerSecond()); + Assert.Equal(Speed.FromCentimetersPerSecond(2), 2.CentimetersPerSecond()); [Fact] public void NumberToDecimetersPerMinutesTest() => - Assert.Equal(Speed.FromDecimetersPerMinutes(2), 2.DecimetersPerMinutes()); + Assert.Equal(Speed.FromDecimetersPerMinutes(2), 2.DecimetersPerMinutes()); [Fact] public void NumberToDecimetersPerSecondTest() => - Assert.Equal(Speed.FromDecimetersPerSecond(2), 2.DecimetersPerSecond()); + Assert.Equal(Speed.FromDecimetersPerSecond(2), 2.DecimetersPerSecond()); [Fact] public void NumberToFeetPerHourTest() => - Assert.Equal(Speed.FromFeetPerHour(2), 2.FeetPerHour()); + Assert.Equal(Speed.FromFeetPerHour(2), 2.FeetPerHour()); [Fact] public void NumberToFeetPerMinuteTest() => - Assert.Equal(Speed.FromFeetPerMinute(2), 2.FeetPerMinute()); + Assert.Equal(Speed.FromFeetPerMinute(2), 2.FeetPerMinute()); [Fact] public void NumberToFeetPerSecondTest() => - Assert.Equal(Speed.FromFeetPerSecond(2), 2.FeetPerSecond()); + Assert.Equal(Speed.FromFeetPerSecond(2), 2.FeetPerSecond()); [Fact] public void NumberToInchesPerHourTest() => - Assert.Equal(Speed.FromInchesPerHour(2), 2.InchesPerHour()); + Assert.Equal(Speed.FromInchesPerHour(2), 2.InchesPerHour()); [Fact] public void NumberToInchesPerMinuteTest() => - Assert.Equal(Speed.FromInchesPerMinute(2), 2.InchesPerMinute()); + Assert.Equal(Speed.FromInchesPerMinute(2), 2.InchesPerMinute()); [Fact] public void NumberToInchesPerSecondTest() => - Assert.Equal(Speed.FromInchesPerSecond(2), 2.InchesPerSecond()); + Assert.Equal(Speed.FromInchesPerSecond(2), 2.InchesPerSecond()); [Fact] public void NumberToKilometersPerHourTest() => - Assert.Equal(Speed.FromKilometersPerHour(2), 2.KilometersPerHour()); + Assert.Equal(Speed.FromKilometersPerHour(2), 2.KilometersPerHour()); [Fact] public void NumberToKilometersPerMinutesTest() => - Assert.Equal(Speed.FromKilometersPerMinutes(2), 2.KilometersPerMinutes()); + Assert.Equal(Speed.FromKilometersPerMinutes(2), 2.KilometersPerMinutes()); [Fact] public void NumberToKilometersPerSecondTest() => - Assert.Equal(Speed.FromKilometersPerSecond(2), 2.KilometersPerSecond()); + Assert.Equal(Speed.FromKilometersPerSecond(2), 2.KilometersPerSecond()); [Fact] public void NumberToKnotsTest() => - Assert.Equal(Speed.FromKnots(2), 2.Knots()); + Assert.Equal(Speed.FromKnots(2), 2.Knots()); [Fact] public void NumberToMetersPerHourTest() => - Assert.Equal(Speed.FromMetersPerHour(2), 2.MetersPerHour()); + Assert.Equal(Speed.FromMetersPerHour(2), 2.MetersPerHour()); [Fact] public void NumberToMetersPerMinutesTest() => - Assert.Equal(Speed.FromMetersPerMinutes(2), 2.MetersPerMinutes()); + Assert.Equal(Speed.FromMetersPerMinutes(2), 2.MetersPerMinutes()); [Fact] public void NumberToMetersPerSecondTest() => - Assert.Equal(Speed.FromMetersPerSecond(2), 2.MetersPerSecond()); + Assert.Equal(Speed.FromMetersPerSecond(2), 2.MetersPerSecond()); [Fact] public void NumberToMicrometersPerMinutesTest() => - Assert.Equal(Speed.FromMicrometersPerMinutes(2), 2.MicrometersPerMinutes()); + Assert.Equal(Speed.FromMicrometersPerMinutes(2), 2.MicrometersPerMinutes()); [Fact] public void NumberToMicrometersPerSecondTest() => - Assert.Equal(Speed.FromMicrometersPerSecond(2), 2.MicrometersPerSecond()); + Assert.Equal(Speed.FromMicrometersPerSecond(2), 2.MicrometersPerSecond()); [Fact] public void NumberToMilesPerHourTest() => - Assert.Equal(Speed.FromMilesPerHour(2), 2.MilesPerHour()); + Assert.Equal(Speed.FromMilesPerHour(2), 2.MilesPerHour()); [Fact] public void NumberToMillimetersPerHourTest() => - Assert.Equal(Speed.FromMillimetersPerHour(2), 2.MillimetersPerHour()); + Assert.Equal(Speed.FromMillimetersPerHour(2), 2.MillimetersPerHour()); [Fact] public void NumberToMillimetersPerMinutesTest() => - Assert.Equal(Speed.FromMillimetersPerMinutes(2), 2.MillimetersPerMinutes()); + Assert.Equal(Speed.FromMillimetersPerMinutes(2), 2.MillimetersPerMinutes()); [Fact] public void NumberToMillimetersPerSecondTest() => - Assert.Equal(Speed.FromMillimetersPerSecond(2), 2.MillimetersPerSecond()); + Assert.Equal(Speed.FromMillimetersPerSecond(2), 2.MillimetersPerSecond()); [Fact] public void NumberToNanometersPerMinutesTest() => - Assert.Equal(Speed.FromNanometersPerMinutes(2), 2.NanometersPerMinutes()); + Assert.Equal(Speed.FromNanometersPerMinutes(2), 2.NanometersPerMinutes()); [Fact] public void NumberToNanometersPerSecondTest() => - Assert.Equal(Speed.FromNanometersPerSecond(2), 2.NanometersPerSecond()); + Assert.Equal(Speed.FromNanometersPerSecond(2), 2.NanometersPerSecond()); [Fact] public void NumberToUsSurveyFeetPerHourTest() => - Assert.Equal(Speed.FromUsSurveyFeetPerHour(2), 2.UsSurveyFeetPerHour()); + Assert.Equal(Speed.FromUsSurveyFeetPerHour(2), 2.UsSurveyFeetPerHour()); [Fact] public void NumberToUsSurveyFeetPerMinuteTest() => - Assert.Equal(Speed.FromUsSurveyFeetPerMinute(2), 2.UsSurveyFeetPerMinute()); + Assert.Equal(Speed.FromUsSurveyFeetPerMinute(2), 2.UsSurveyFeetPerMinute()); [Fact] public void NumberToUsSurveyFeetPerSecondTest() => - Assert.Equal(Speed.FromUsSurveyFeetPerSecond(2), 2.UsSurveyFeetPerSecond()); + Assert.Equal(Speed.FromUsSurveyFeetPerSecond(2), 2.UsSurveyFeetPerSecond()); [Fact] public void NumberToYardsPerHourTest() => - Assert.Equal(Speed.FromYardsPerHour(2), 2.YardsPerHour()); + Assert.Equal(Speed.FromYardsPerHour(2), 2.YardsPerHour()); [Fact] public void NumberToYardsPerMinuteTest() => - Assert.Equal(Speed.FromYardsPerMinute(2), 2.YardsPerMinute()); + Assert.Equal(Speed.FromYardsPerMinute(2), 2.YardsPerMinute()); [Fact] public void NumberToYardsPerSecondTest() => - Assert.Equal(Speed.FromYardsPerSecond(2), 2.YardsPerSecond()); + Assert.Equal(Speed.FromYardsPerSecond(2), 2.YardsPerSecond()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureChangeRateExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureChangeRateExtensionsTest.g.cs index 957a586266..cb87b03be7 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureChangeRateExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureChangeRateExtensionsTest.g.cs @@ -21,48 +21,48 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToTemperatureChangeRateExtensionsTests { [Fact] public void NumberToCentidegreesCelsiusPerSecondTest() => - Assert.Equal(TemperatureChangeRate.FromCentidegreesCelsiusPerSecond(2), 2.CentidegreesCelsiusPerSecond()); + Assert.Equal(TemperatureChangeRate.FromCentidegreesCelsiusPerSecond(2), 2.CentidegreesCelsiusPerSecond()); [Fact] public void NumberToDecadegreesCelsiusPerSecondTest() => - Assert.Equal(TemperatureChangeRate.FromDecadegreesCelsiusPerSecond(2), 2.DecadegreesCelsiusPerSecond()); + Assert.Equal(TemperatureChangeRate.FromDecadegreesCelsiusPerSecond(2), 2.DecadegreesCelsiusPerSecond()); [Fact] public void NumberToDecidegreesCelsiusPerSecondTest() => - Assert.Equal(TemperatureChangeRate.FromDecidegreesCelsiusPerSecond(2), 2.DecidegreesCelsiusPerSecond()); + Assert.Equal(TemperatureChangeRate.FromDecidegreesCelsiusPerSecond(2), 2.DecidegreesCelsiusPerSecond()); [Fact] public void NumberToDegreesCelsiusPerMinuteTest() => - Assert.Equal(TemperatureChangeRate.FromDegreesCelsiusPerMinute(2), 2.DegreesCelsiusPerMinute()); + Assert.Equal(TemperatureChangeRate.FromDegreesCelsiusPerMinute(2), 2.DegreesCelsiusPerMinute()); [Fact] public void NumberToDegreesCelsiusPerSecondTest() => - Assert.Equal(TemperatureChangeRate.FromDegreesCelsiusPerSecond(2), 2.DegreesCelsiusPerSecond()); + Assert.Equal(TemperatureChangeRate.FromDegreesCelsiusPerSecond(2), 2.DegreesCelsiusPerSecond()); [Fact] public void NumberToHectodegreesCelsiusPerSecondTest() => - Assert.Equal(TemperatureChangeRate.FromHectodegreesCelsiusPerSecond(2), 2.HectodegreesCelsiusPerSecond()); + Assert.Equal(TemperatureChangeRate.FromHectodegreesCelsiusPerSecond(2), 2.HectodegreesCelsiusPerSecond()); [Fact] public void NumberToKilodegreesCelsiusPerSecondTest() => - Assert.Equal(TemperatureChangeRate.FromKilodegreesCelsiusPerSecond(2), 2.KilodegreesCelsiusPerSecond()); + Assert.Equal(TemperatureChangeRate.FromKilodegreesCelsiusPerSecond(2), 2.KilodegreesCelsiusPerSecond()); [Fact] public void NumberToMicrodegreesCelsiusPerSecondTest() => - Assert.Equal(TemperatureChangeRate.FromMicrodegreesCelsiusPerSecond(2), 2.MicrodegreesCelsiusPerSecond()); + Assert.Equal(TemperatureChangeRate.FromMicrodegreesCelsiusPerSecond(2), 2.MicrodegreesCelsiusPerSecond()); [Fact] public void NumberToMillidegreesCelsiusPerSecondTest() => - Assert.Equal(TemperatureChangeRate.FromMillidegreesCelsiusPerSecond(2), 2.MillidegreesCelsiusPerSecond()); + Assert.Equal(TemperatureChangeRate.FromMillidegreesCelsiusPerSecond(2), 2.MillidegreesCelsiusPerSecond()); [Fact] public void NumberToNanodegreesCelsiusPerSecondTest() => - Assert.Equal(TemperatureChangeRate.FromNanodegreesCelsiusPerSecond(2), 2.NanodegreesCelsiusPerSecond()); + Assert.Equal(TemperatureChangeRate.FromNanodegreesCelsiusPerSecond(2), 2.NanodegreesCelsiusPerSecond()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureDeltaExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureDeltaExtensionsTest.g.cs index ca32dbe18b..c36b58765c 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureDeltaExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureDeltaExtensionsTest.g.cs @@ -21,44 +21,44 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToTemperatureDeltaExtensionsTests { [Fact] public void NumberToDegreesCelsiusTest() => - Assert.Equal(TemperatureDelta.FromDegreesCelsius(2), 2.DegreesCelsius()); + Assert.Equal(TemperatureDelta.FromDegreesCelsius(2), 2.DegreesCelsius()); [Fact] public void NumberToDegreesDelisleTest() => - Assert.Equal(TemperatureDelta.FromDegreesDelisle(2), 2.DegreesDelisle()); + Assert.Equal(TemperatureDelta.FromDegreesDelisle(2), 2.DegreesDelisle()); [Fact] public void NumberToDegreesFahrenheitTest() => - Assert.Equal(TemperatureDelta.FromDegreesFahrenheit(2), 2.DegreesFahrenheit()); + Assert.Equal(TemperatureDelta.FromDegreesFahrenheit(2), 2.DegreesFahrenheit()); [Fact] public void NumberToDegreesNewtonTest() => - Assert.Equal(TemperatureDelta.FromDegreesNewton(2), 2.DegreesNewton()); + Assert.Equal(TemperatureDelta.FromDegreesNewton(2), 2.DegreesNewton()); [Fact] public void NumberToDegreesRankineTest() => - Assert.Equal(TemperatureDelta.FromDegreesRankine(2), 2.DegreesRankine()); + Assert.Equal(TemperatureDelta.FromDegreesRankine(2), 2.DegreesRankine()); [Fact] public void NumberToDegreesReaumurTest() => - Assert.Equal(TemperatureDelta.FromDegreesReaumur(2), 2.DegreesReaumur()); + Assert.Equal(TemperatureDelta.FromDegreesReaumur(2), 2.DegreesReaumur()); [Fact] public void NumberToDegreesRoemerTest() => - Assert.Equal(TemperatureDelta.FromDegreesRoemer(2), 2.DegreesRoemer()); + Assert.Equal(TemperatureDelta.FromDegreesRoemer(2), 2.DegreesRoemer()); [Fact] public void NumberToKelvinsTest() => - Assert.Equal(TemperatureDelta.FromKelvins(2), 2.Kelvins()); + Assert.Equal(TemperatureDelta.FromKelvins(2), 2.Kelvins()); [Fact] public void NumberToMillidegreesCelsiusTest() => - Assert.Equal(TemperatureDelta.FromMillidegreesCelsius(2), 2.MillidegreesCelsius()); + Assert.Equal(TemperatureDelta.FromMillidegreesCelsius(2), 2.MillidegreesCelsius()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureExtensionsTest.g.cs index fd5ca1843a..d462297f34 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureExtensionsTest.g.cs @@ -21,48 +21,48 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToTemperatureExtensionsTests { [Fact] public void NumberToDegreesCelsiusTest() => - Assert.Equal(Temperature.FromDegreesCelsius(2), 2.DegreesCelsius()); + Assert.Equal(Temperature.FromDegreesCelsius(2), 2.DegreesCelsius()); [Fact] public void NumberToDegreesDelisleTest() => - Assert.Equal(Temperature.FromDegreesDelisle(2), 2.DegreesDelisle()); + Assert.Equal(Temperature.FromDegreesDelisle(2), 2.DegreesDelisle()); [Fact] public void NumberToDegreesFahrenheitTest() => - Assert.Equal(Temperature.FromDegreesFahrenheit(2), 2.DegreesFahrenheit()); + Assert.Equal(Temperature.FromDegreesFahrenheit(2), 2.DegreesFahrenheit()); [Fact] public void NumberToDegreesNewtonTest() => - Assert.Equal(Temperature.FromDegreesNewton(2), 2.DegreesNewton()); + Assert.Equal(Temperature.FromDegreesNewton(2), 2.DegreesNewton()); [Fact] public void NumberToDegreesRankineTest() => - Assert.Equal(Temperature.FromDegreesRankine(2), 2.DegreesRankine()); + Assert.Equal(Temperature.FromDegreesRankine(2), 2.DegreesRankine()); [Fact] public void NumberToDegreesReaumurTest() => - Assert.Equal(Temperature.FromDegreesReaumur(2), 2.DegreesReaumur()); + Assert.Equal(Temperature.FromDegreesReaumur(2), 2.DegreesReaumur()); [Fact] public void NumberToDegreesRoemerTest() => - Assert.Equal(Temperature.FromDegreesRoemer(2), 2.DegreesRoemer()); + Assert.Equal(Temperature.FromDegreesRoemer(2), 2.DegreesRoemer()); [Fact] public void NumberToKelvinsTest() => - Assert.Equal(Temperature.FromKelvins(2), 2.Kelvins()); + Assert.Equal(Temperature.FromKelvins(2), 2.Kelvins()); [Fact] public void NumberToMillidegreesCelsiusTest() => - Assert.Equal(Temperature.FromMillidegreesCelsius(2), 2.MillidegreesCelsius()); + Assert.Equal(Temperature.FromMillidegreesCelsius(2), 2.MillidegreesCelsius()); [Fact] public void NumberToSolarTemperaturesTest() => - Assert.Equal(Temperature.FromSolarTemperatures(2), 2.SolarTemperatures()); + Assert.Equal(Temperature.FromSolarTemperatures(2), 2.SolarTemperatures()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToThermalConductivityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToThermalConductivityExtensionsTest.g.cs index 8a5e51b160..c5eddbe155 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToThermalConductivityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToThermalConductivityExtensionsTest.g.cs @@ -21,16 +21,16 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToThermalConductivityExtensionsTests { [Fact] public void NumberToBtusPerHourFootFahrenheitTest() => - Assert.Equal(ThermalConductivity.FromBtusPerHourFootFahrenheit(2), 2.BtusPerHourFootFahrenheit()); + Assert.Equal(ThermalConductivity.FromBtusPerHourFootFahrenheit(2), 2.BtusPerHourFootFahrenheit()); [Fact] public void NumberToWattsPerMeterKelvinTest() => - Assert.Equal(ThermalConductivity.FromWattsPerMeterKelvin(2), 2.WattsPerMeterKelvin()); + Assert.Equal(ThermalConductivity.FromWattsPerMeterKelvin(2), 2.WattsPerMeterKelvin()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToThermalResistanceExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToThermalResistanceExtensionsTest.g.cs index bd498813b2..a636d7fe16 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToThermalResistanceExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToThermalResistanceExtensionsTest.g.cs @@ -21,28 +21,28 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToThermalResistanceExtensionsTests { [Fact] public void NumberToHourSquareFeetDegreesFahrenheitPerBtuTest() => - Assert.Equal(ThermalResistance.FromHourSquareFeetDegreesFahrenheitPerBtu(2), 2.HourSquareFeetDegreesFahrenheitPerBtu()); + Assert.Equal(ThermalResistance.FromHourSquareFeetDegreesFahrenheitPerBtu(2), 2.HourSquareFeetDegreesFahrenheitPerBtu()); [Fact] public void NumberToSquareCentimeterHourDegreesCelsiusPerKilocalorieTest() => - Assert.Equal(ThermalResistance.FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(2), 2.SquareCentimeterHourDegreesCelsiusPerKilocalorie()); + Assert.Equal(ThermalResistance.FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(2), 2.SquareCentimeterHourDegreesCelsiusPerKilocalorie()); [Fact] public void NumberToSquareCentimeterKelvinsPerWattTest() => - Assert.Equal(ThermalResistance.FromSquareCentimeterKelvinsPerWatt(2), 2.SquareCentimeterKelvinsPerWatt()); + Assert.Equal(ThermalResistance.FromSquareCentimeterKelvinsPerWatt(2), 2.SquareCentimeterKelvinsPerWatt()); [Fact] public void NumberToSquareMeterDegreesCelsiusPerWattTest() => - Assert.Equal(ThermalResistance.FromSquareMeterDegreesCelsiusPerWatt(2), 2.SquareMeterDegreesCelsiusPerWatt()); + Assert.Equal(ThermalResistance.FromSquareMeterDegreesCelsiusPerWatt(2), 2.SquareMeterDegreesCelsiusPerWatt()); [Fact] public void NumberToSquareMeterKelvinsPerKilowattTest() => - Assert.Equal(ThermalResistance.FromSquareMeterKelvinsPerKilowatt(2), 2.SquareMeterKelvinsPerKilowatt()); + Assert.Equal(ThermalResistance.FromSquareMeterKelvinsPerKilowatt(2), 2.SquareMeterKelvinsPerKilowatt()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTorqueExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTorqueExtensionsTest.g.cs index ed843a6c9c..0876ecf5b7 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTorqueExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTorqueExtensionsTest.g.cs @@ -21,96 +21,96 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToTorqueExtensionsTests { [Fact] public void NumberToKilogramForceCentimetersTest() => - Assert.Equal(Torque.FromKilogramForceCentimeters(2), 2.KilogramForceCentimeters()); + Assert.Equal(Torque.FromKilogramForceCentimeters(2), 2.KilogramForceCentimeters()); [Fact] public void NumberToKilogramForceMetersTest() => - Assert.Equal(Torque.FromKilogramForceMeters(2), 2.KilogramForceMeters()); + Assert.Equal(Torque.FromKilogramForceMeters(2), 2.KilogramForceMeters()); [Fact] public void NumberToKilogramForceMillimetersTest() => - Assert.Equal(Torque.FromKilogramForceMillimeters(2), 2.KilogramForceMillimeters()); + Assert.Equal(Torque.FromKilogramForceMillimeters(2), 2.KilogramForceMillimeters()); [Fact] public void NumberToKilonewtonCentimetersTest() => - Assert.Equal(Torque.FromKilonewtonCentimeters(2), 2.KilonewtonCentimeters()); + Assert.Equal(Torque.FromKilonewtonCentimeters(2), 2.KilonewtonCentimeters()); [Fact] public void NumberToKilonewtonMetersTest() => - Assert.Equal(Torque.FromKilonewtonMeters(2), 2.KilonewtonMeters()); + Assert.Equal(Torque.FromKilonewtonMeters(2), 2.KilonewtonMeters()); [Fact] public void NumberToKilonewtonMillimetersTest() => - Assert.Equal(Torque.FromKilonewtonMillimeters(2), 2.KilonewtonMillimeters()); + Assert.Equal(Torque.FromKilonewtonMillimeters(2), 2.KilonewtonMillimeters()); [Fact] public void NumberToKilopoundForceFeetTest() => - Assert.Equal(Torque.FromKilopoundForceFeet(2), 2.KilopoundForceFeet()); + Assert.Equal(Torque.FromKilopoundForceFeet(2), 2.KilopoundForceFeet()); [Fact] public void NumberToKilopoundForceInchesTest() => - Assert.Equal(Torque.FromKilopoundForceInches(2), 2.KilopoundForceInches()); + Assert.Equal(Torque.FromKilopoundForceInches(2), 2.KilopoundForceInches()); [Fact] public void NumberToMeganewtonCentimetersTest() => - Assert.Equal(Torque.FromMeganewtonCentimeters(2), 2.MeganewtonCentimeters()); + Assert.Equal(Torque.FromMeganewtonCentimeters(2), 2.MeganewtonCentimeters()); [Fact] public void NumberToMeganewtonMetersTest() => - Assert.Equal(Torque.FromMeganewtonMeters(2), 2.MeganewtonMeters()); + Assert.Equal(Torque.FromMeganewtonMeters(2), 2.MeganewtonMeters()); [Fact] public void NumberToMeganewtonMillimetersTest() => - Assert.Equal(Torque.FromMeganewtonMillimeters(2), 2.MeganewtonMillimeters()); + Assert.Equal(Torque.FromMeganewtonMillimeters(2), 2.MeganewtonMillimeters()); [Fact] public void NumberToMegapoundForceFeetTest() => - Assert.Equal(Torque.FromMegapoundForceFeet(2), 2.MegapoundForceFeet()); + Assert.Equal(Torque.FromMegapoundForceFeet(2), 2.MegapoundForceFeet()); [Fact] public void NumberToMegapoundForceInchesTest() => - Assert.Equal(Torque.FromMegapoundForceInches(2), 2.MegapoundForceInches()); + Assert.Equal(Torque.FromMegapoundForceInches(2), 2.MegapoundForceInches()); [Fact] public void NumberToNewtonCentimetersTest() => - Assert.Equal(Torque.FromNewtonCentimeters(2), 2.NewtonCentimeters()); + Assert.Equal(Torque.FromNewtonCentimeters(2), 2.NewtonCentimeters()); [Fact] public void NumberToNewtonMetersTest() => - Assert.Equal(Torque.FromNewtonMeters(2), 2.NewtonMeters()); + Assert.Equal(Torque.FromNewtonMeters(2), 2.NewtonMeters()); [Fact] public void NumberToNewtonMillimetersTest() => - Assert.Equal(Torque.FromNewtonMillimeters(2), 2.NewtonMillimeters()); + Assert.Equal(Torque.FromNewtonMillimeters(2), 2.NewtonMillimeters()); [Fact] public void NumberToPoundalFeetTest() => - Assert.Equal(Torque.FromPoundalFeet(2), 2.PoundalFeet()); + Assert.Equal(Torque.FromPoundalFeet(2), 2.PoundalFeet()); [Fact] public void NumberToPoundForceFeetTest() => - Assert.Equal(Torque.FromPoundForceFeet(2), 2.PoundForceFeet()); + Assert.Equal(Torque.FromPoundForceFeet(2), 2.PoundForceFeet()); [Fact] public void NumberToPoundForceInchesTest() => - Assert.Equal(Torque.FromPoundForceInches(2), 2.PoundForceInches()); + Assert.Equal(Torque.FromPoundForceInches(2), 2.PoundForceInches()); [Fact] public void NumberToTonneForceCentimetersTest() => - Assert.Equal(Torque.FromTonneForceCentimeters(2), 2.TonneForceCentimeters()); + Assert.Equal(Torque.FromTonneForceCentimeters(2), 2.TonneForceCentimeters()); [Fact] public void NumberToTonneForceMetersTest() => - Assert.Equal(Torque.FromTonneForceMeters(2), 2.TonneForceMeters()); + Assert.Equal(Torque.FromTonneForceMeters(2), 2.TonneForceMeters()); [Fact] public void NumberToTonneForceMillimetersTest() => - Assert.Equal(Torque.FromTonneForceMillimeters(2), 2.TonneForceMillimeters()); + Assert.Equal(Torque.FromTonneForceMillimeters(2), 2.TonneForceMillimeters()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTorquePerLengthExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTorquePerLengthExtensionsTest.g.cs index ea0406f6b3..c87e55fd37 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTorquePerLengthExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTorquePerLengthExtensionsTest.g.cs @@ -21,92 +21,92 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToTorquePerLengthExtensionsTests { [Fact] public void NumberToKilogramForceCentimetersPerMeterTest() => - Assert.Equal(TorquePerLength.FromKilogramForceCentimetersPerMeter(2), 2.KilogramForceCentimetersPerMeter()); + Assert.Equal(TorquePerLength.FromKilogramForceCentimetersPerMeter(2), 2.KilogramForceCentimetersPerMeter()); [Fact] public void NumberToKilogramForceMetersPerMeterTest() => - Assert.Equal(TorquePerLength.FromKilogramForceMetersPerMeter(2), 2.KilogramForceMetersPerMeter()); + Assert.Equal(TorquePerLength.FromKilogramForceMetersPerMeter(2), 2.KilogramForceMetersPerMeter()); [Fact] public void NumberToKilogramForceMillimetersPerMeterTest() => - Assert.Equal(TorquePerLength.FromKilogramForceMillimetersPerMeter(2), 2.KilogramForceMillimetersPerMeter()); + Assert.Equal(TorquePerLength.FromKilogramForceMillimetersPerMeter(2), 2.KilogramForceMillimetersPerMeter()); [Fact] public void NumberToKilonewtonCentimetersPerMeterTest() => - Assert.Equal(TorquePerLength.FromKilonewtonCentimetersPerMeter(2), 2.KilonewtonCentimetersPerMeter()); + Assert.Equal(TorquePerLength.FromKilonewtonCentimetersPerMeter(2), 2.KilonewtonCentimetersPerMeter()); [Fact] public void NumberToKilonewtonMetersPerMeterTest() => - Assert.Equal(TorquePerLength.FromKilonewtonMetersPerMeter(2), 2.KilonewtonMetersPerMeter()); + Assert.Equal(TorquePerLength.FromKilonewtonMetersPerMeter(2), 2.KilonewtonMetersPerMeter()); [Fact] public void NumberToKilonewtonMillimetersPerMeterTest() => - Assert.Equal(TorquePerLength.FromKilonewtonMillimetersPerMeter(2), 2.KilonewtonMillimetersPerMeter()); + Assert.Equal(TorquePerLength.FromKilonewtonMillimetersPerMeter(2), 2.KilonewtonMillimetersPerMeter()); [Fact] public void NumberToKilopoundForceFeetPerFootTest() => - Assert.Equal(TorquePerLength.FromKilopoundForceFeetPerFoot(2), 2.KilopoundForceFeetPerFoot()); + Assert.Equal(TorquePerLength.FromKilopoundForceFeetPerFoot(2), 2.KilopoundForceFeetPerFoot()); [Fact] public void NumberToKilopoundForceInchesPerFootTest() => - Assert.Equal(TorquePerLength.FromKilopoundForceInchesPerFoot(2), 2.KilopoundForceInchesPerFoot()); + Assert.Equal(TorquePerLength.FromKilopoundForceInchesPerFoot(2), 2.KilopoundForceInchesPerFoot()); [Fact] public void NumberToMeganewtonCentimetersPerMeterTest() => - Assert.Equal(TorquePerLength.FromMeganewtonCentimetersPerMeter(2), 2.MeganewtonCentimetersPerMeter()); + Assert.Equal(TorquePerLength.FromMeganewtonCentimetersPerMeter(2), 2.MeganewtonCentimetersPerMeter()); [Fact] public void NumberToMeganewtonMetersPerMeterTest() => - Assert.Equal(TorquePerLength.FromMeganewtonMetersPerMeter(2), 2.MeganewtonMetersPerMeter()); + Assert.Equal(TorquePerLength.FromMeganewtonMetersPerMeter(2), 2.MeganewtonMetersPerMeter()); [Fact] public void NumberToMeganewtonMillimetersPerMeterTest() => - Assert.Equal(TorquePerLength.FromMeganewtonMillimetersPerMeter(2), 2.MeganewtonMillimetersPerMeter()); + Assert.Equal(TorquePerLength.FromMeganewtonMillimetersPerMeter(2), 2.MeganewtonMillimetersPerMeter()); [Fact] public void NumberToMegapoundForceFeetPerFootTest() => - Assert.Equal(TorquePerLength.FromMegapoundForceFeetPerFoot(2), 2.MegapoundForceFeetPerFoot()); + Assert.Equal(TorquePerLength.FromMegapoundForceFeetPerFoot(2), 2.MegapoundForceFeetPerFoot()); [Fact] public void NumberToMegapoundForceInchesPerFootTest() => - Assert.Equal(TorquePerLength.FromMegapoundForceInchesPerFoot(2), 2.MegapoundForceInchesPerFoot()); + Assert.Equal(TorquePerLength.FromMegapoundForceInchesPerFoot(2), 2.MegapoundForceInchesPerFoot()); [Fact] public void NumberToNewtonCentimetersPerMeterTest() => - Assert.Equal(TorquePerLength.FromNewtonCentimetersPerMeter(2), 2.NewtonCentimetersPerMeter()); + Assert.Equal(TorquePerLength.FromNewtonCentimetersPerMeter(2), 2.NewtonCentimetersPerMeter()); [Fact] public void NumberToNewtonMetersPerMeterTest() => - Assert.Equal(TorquePerLength.FromNewtonMetersPerMeter(2), 2.NewtonMetersPerMeter()); + Assert.Equal(TorquePerLength.FromNewtonMetersPerMeter(2), 2.NewtonMetersPerMeter()); [Fact] public void NumberToNewtonMillimetersPerMeterTest() => - Assert.Equal(TorquePerLength.FromNewtonMillimetersPerMeter(2), 2.NewtonMillimetersPerMeter()); + Assert.Equal(TorquePerLength.FromNewtonMillimetersPerMeter(2), 2.NewtonMillimetersPerMeter()); [Fact] public void NumberToPoundForceFeetPerFootTest() => - Assert.Equal(TorquePerLength.FromPoundForceFeetPerFoot(2), 2.PoundForceFeetPerFoot()); + Assert.Equal(TorquePerLength.FromPoundForceFeetPerFoot(2), 2.PoundForceFeetPerFoot()); [Fact] public void NumberToPoundForceInchesPerFootTest() => - Assert.Equal(TorquePerLength.FromPoundForceInchesPerFoot(2), 2.PoundForceInchesPerFoot()); + Assert.Equal(TorquePerLength.FromPoundForceInchesPerFoot(2), 2.PoundForceInchesPerFoot()); [Fact] public void NumberToTonneForceCentimetersPerMeterTest() => - Assert.Equal(TorquePerLength.FromTonneForceCentimetersPerMeter(2), 2.TonneForceCentimetersPerMeter()); + Assert.Equal(TorquePerLength.FromTonneForceCentimetersPerMeter(2), 2.TonneForceCentimetersPerMeter()); [Fact] public void NumberToTonneForceMetersPerMeterTest() => - Assert.Equal(TorquePerLength.FromTonneForceMetersPerMeter(2), 2.TonneForceMetersPerMeter()); + Assert.Equal(TorquePerLength.FromTonneForceMetersPerMeter(2), 2.TonneForceMetersPerMeter()); [Fact] public void NumberToTonneForceMillimetersPerMeterTest() => - Assert.Equal(TorquePerLength.FromTonneForceMillimetersPerMeter(2), 2.TonneForceMillimetersPerMeter()); + Assert.Equal(TorquePerLength.FromTonneForceMillimetersPerMeter(2), 2.TonneForceMillimetersPerMeter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTurbidityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTurbidityExtensionsTest.g.cs index 139508cfb1..7395a32eb8 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTurbidityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTurbidityExtensionsTest.g.cs @@ -21,12 +21,12 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToTurbidityExtensionsTests { [Fact] public void NumberToNTUTest() => - Assert.Equal(Turbidity.FromNTU(2), 2.NTU()); + Assert.Equal(Turbidity.FromNTU(2), 2.NTU()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVitaminAExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVitaminAExtensionsTest.g.cs index 8db270be0c..30386e71eb 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVitaminAExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVitaminAExtensionsTest.g.cs @@ -21,12 +21,12 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToVitaminAExtensionsTests { [Fact] public void NumberToInternationalUnitsTest() => - Assert.Equal(VitaminA.FromInternationalUnits(2), 2.InternationalUnits()); + Assert.Equal(VitaminA.FromInternationalUnits(2), 2.InternationalUnits()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeConcentrationExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeConcentrationExtensionsTest.g.cs index 2fe16bdcdf..ac762ce5e9 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeConcentrationExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeConcentrationExtensionsTest.g.cs @@ -21,88 +21,88 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToVolumeConcentrationExtensionsTests { [Fact] public void NumberToCentilitersPerLiterTest() => - Assert.Equal(VolumeConcentration.FromCentilitersPerLiter(2), 2.CentilitersPerLiter()); + Assert.Equal(VolumeConcentration.FromCentilitersPerLiter(2), 2.CentilitersPerLiter()); [Fact] public void NumberToCentilitersPerMililiterTest() => - Assert.Equal(VolumeConcentration.FromCentilitersPerMililiter(2), 2.CentilitersPerMililiter()); + Assert.Equal(VolumeConcentration.FromCentilitersPerMililiter(2), 2.CentilitersPerMililiter()); [Fact] public void NumberToDecilitersPerLiterTest() => - Assert.Equal(VolumeConcentration.FromDecilitersPerLiter(2), 2.DecilitersPerLiter()); + Assert.Equal(VolumeConcentration.FromDecilitersPerLiter(2), 2.DecilitersPerLiter()); [Fact] public void NumberToDecilitersPerMililiterTest() => - Assert.Equal(VolumeConcentration.FromDecilitersPerMililiter(2), 2.DecilitersPerMililiter()); + Assert.Equal(VolumeConcentration.FromDecilitersPerMililiter(2), 2.DecilitersPerMililiter()); [Fact] public void NumberToDecimalFractionsTest() => - Assert.Equal(VolumeConcentration.FromDecimalFractions(2), 2.DecimalFractions()); + Assert.Equal(VolumeConcentration.FromDecimalFractions(2), 2.DecimalFractions()); [Fact] public void NumberToLitersPerLiterTest() => - Assert.Equal(VolumeConcentration.FromLitersPerLiter(2), 2.LitersPerLiter()); + Assert.Equal(VolumeConcentration.FromLitersPerLiter(2), 2.LitersPerLiter()); [Fact] public void NumberToLitersPerMililiterTest() => - Assert.Equal(VolumeConcentration.FromLitersPerMililiter(2), 2.LitersPerMililiter()); + Assert.Equal(VolumeConcentration.FromLitersPerMililiter(2), 2.LitersPerMililiter()); [Fact] public void NumberToMicrolitersPerLiterTest() => - Assert.Equal(VolumeConcentration.FromMicrolitersPerLiter(2), 2.MicrolitersPerLiter()); + Assert.Equal(VolumeConcentration.FromMicrolitersPerLiter(2), 2.MicrolitersPerLiter()); [Fact] public void NumberToMicrolitersPerMililiterTest() => - Assert.Equal(VolumeConcentration.FromMicrolitersPerMililiter(2), 2.MicrolitersPerMililiter()); + Assert.Equal(VolumeConcentration.FromMicrolitersPerMililiter(2), 2.MicrolitersPerMililiter()); [Fact] public void NumberToMillilitersPerLiterTest() => - Assert.Equal(VolumeConcentration.FromMillilitersPerLiter(2), 2.MillilitersPerLiter()); + Assert.Equal(VolumeConcentration.FromMillilitersPerLiter(2), 2.MillilitersPerLiter()); [Fact] public void NumberToMillilitersPerMililiterTest() => - Assert.Equal(VolumeConcentration.FromMillilitersPerMililiter(2), 2.MillilitersPerMililiter()); + Assert.Equal(VolumeConcentration.FromMillilitersPerMililiter(2), 2.MillilitersPerMililiter()); [Fact] public void NumberToNanolitersPerLiterTest() => - Assert.Equal(VolumeConcentration.FromNanolitersPerLiter(2), 2.NanolitersPerLiter()); + Assert.Equal(VolumeConcentration.FromNanolitersPerLiter(2), 2.NanolitersPerLiter()); [Fact] public void NumberToNanolitersPerMililiterTest() => - Assert.Equal(VolumeConcentration.FromNanolitersPerMililiter(2), 2.NanolitersPerMililiter()); + Assert.Equal(VolumeConcentration.FromNanolitersPerMililiter(2), 2.NanolitersPerMililiter()); [Fact] public void NumberToPartsPerBillionTest() => - Assert.Equal(VolumeConcentration.FromPartsPerBillion(2), 2.PartsPerBillion()); + Assert.Equal(VolumeConcentration.FromPartsPerBillion(2), 2.PartsPerBillion()); [Fact] public void NumberToPartsPerMillionTest() => - Assert.Equal(VolumeConcentration.FromPartsPerMillion(2), 2.PartsPerMillion()); + Assert.Equal(VolumeConcentration.FromPartsPerMillion(2), 2.PartsPerMillion()); [Fact] public void NumberToPartsPerThousandTest() => - Assert.Equal(VolumeConcentration.FromPartsPerThousand(2), 2.PartsPerThousand()); + Assert.Equal(VolumeConcentration.FromPartsPerThousand(2), 2.PartsPerThousand()); [Fact] public void NumberToPartsPerTrillionTest() => - Assert.Equal(VolumeConcentration.FromPartsPerTrillion(2), 2.PartsPerTrillion()); + Assert.Equal(VolumeConcentration.FromPartsPerTrillion(2), 2.PartsPerTrillion()); [Fact] public void NumberToPercentTest() => - Assert.Equal(VolumeConcentration.FromPercent(2), 2.Percent()); + Assert.Equal(VolumeConcentration.FromPercent(2), 2.Percent()); [Fact] public void NumberToPicolitersPerLiterTest() => - Assert.Equal(VolumeConcentration.FromPicolitersPerLiter(2), 2.PicolitersPerLiter()); + Assert.Equal(VolumeConcentration.FromPicolitersPerLiter(2), 2.PicolitersPerLiter()); [Fact] public void NumberToPicolitersPerMililiterTest() => - Assert.Equal(VolumeConcentration.FromPicolitersPerMililiter(2), 2.PicolitersPerMililiter()); + Assert.Equal(VolumeConcentration.FromPicolitersPerMililiter(2), 2.PicolitersPerMililiter()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeExtensionsTest.g.cs index e157164a66..f338b078d1 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeExtensionsTest.g.cs @@ -21,212 +21,212 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToVolumeExtensionsTests { [Fact] public void NumberToAcreFeetTest() => - Assert.Equal(Volume.FromAcreFeet(2), 2.AcreFeet()); + Assert.Equal(Volume.FromAcreFeet(2), 2.AcreFeet()); [Fact] public void NumberToAuTablespoonsTest() => - Assert.Equal(Volume.FromAuTablespoons(2), 2.AuTablespoons()); + Assert.Equal(Volume.FromAuTablespoons(2), 2.AuTablespoons()); [Fact] public void NumberToBoardFeetTest() => - Assert.Equal(Volume.FromBoardFeet(2), 2.BoardFeet()); + Assert.Equal(Volume.FromBoardFeet(2), 2.BoardFeet()); [Fact] public void NumberToCentilitersTest() => - Assert.Equal(Volume.FromCentiliters(2), 2.Centiliters()); + Assert.Equal(Volume.FromCentiliters(2), 2.Centiliters()); [Fact] public void NumberToCubicCentimetersTest() => - Assert.Equal(Volume.FromCubicCentimeters(2), 2.CubicCentimeters()); + Assert.Equal(Volume.FromCubicCentimeters(2), 2.CubicCentimeters()); [Fact] public void NumberToCubicDecimetersTest() => - Assert.Equal(Volume.FromCubicDecimeters(2), 2.CubicDecimeters()); + Assert.Equal(Volume.FromCubicDecimeters(2), 2.CubicDecimeters()); [Fact] public void NumberToCubicFeetTest() => - Assert.Equal(Volume.FromCubicFeet(2), 2.CubicFeet()); + Assert.Equal(Volume.FromCubicFeet(2), 2.CubicFeet()); [Fact] public void NumberToCubicHectometersTest() => - Assert.Equal(Volume.FromCubicHectometers(2), 2.CubicHectometers()); + Assert.Equal(Volume.FromCubicHectometers(2), 2.CubicHectometers()); [Fact] public void NumberToCubicInchesTest() => - Assert.Equal(Volume.FromCubicInches(2), 2.CubicInches()); + Assert.Equal(Volume.FromCubicInches(2), 2.CubicInches()); [Fact] public void NumberToCubicKilometersTest() => - Assert.Equal(Volume.FromCubicKilometers(2), 2.CubicKilometers()); + Assert.Equal(Volume.FromCubicKilometers(2), 2.CubicKilometers()); [Fact] public void NumberToCubicMetersTest() => - Assert.Equal(Volume.FromCubicMeters(2), 2.CubicMeters()); + Assert.Equal(Volume.FromCubicMeters(2), 2.CubicMeters()); [Fact] public void NumberToCubicMicrometersTest() => - Assert.Equal(Volume.FromCubicMicrometers(2), 2.CubicMicrometers()); + Assert.Equal(Volume.FromCubicMicrometers(2), 2.CubicMicrometers()); [Fact] public void NumberToCubicMilesTest() => - Assert.Equal(Volume.FromCubicMiles(2), 2.CubicMiles()); + Assert.Equal(Volume.FromCubicMiles(2), 2.CubicMiles()); [Fact] public void NumberToCubicMillimetersTest() => - Assert.Equal(Volume.FromCubicMillimeters(2), 2.CubicMillimeters()); + Assert.Equal(Volume.FromCubicMillimeters(2), 2.CubicMillimeters()); [Fact] public void NumberToCubicYardsTest() => - Assert.Equal(Volume.FromCubicYards(2), 2.CubicYards()); + Assert.Equal(Volume.FromCubicYards(2), 2.CubicYards()); [Fact] public void NumberToDecausGallonsTest() => - Assert.Equal(Volume.FromDecausGallons(2), 2.DecausGallons()); + Assert.Equal(Volume.FromDecausGallons(2), 2.DecausGallons()); [Fact] public void NumberToDecilitersTest() => - Assert.Equal(Volume.FromDeciliters(2), 2.Deciliters()); + Assert.Equal(Volume.FromDeciliters(2), 2.Deciliters()); [Fact] public void NumberToDeciusGallonsTest() => - Assert.Equal(Volume.FromDeciusGallons(2), 2.DeciusGallons()); + Assert.Equal(Volume.FromDeciusGallons(2), 2.DeciusGallons()); [Fact] public void NumberToHectocubicFeetTest() => - Assert.Equal(Volume.FromHectocubicFeet(2), 2.HectocubicFeet()); + Assert.Equal(Volume.FromHectocubicFeet(2), 2.HectocubicFeet()); [Fact] public void NumberToHectocubicMetersTest() => - Assert.Equal(Volume.FromHectocubicMeters(2), 2.HectocubicMeters()); + Assert.Equal(Volume.FromHectocubicMeters(2), 2.HectocubicMeters()); [Fact] public void NumberToHectolitersTest() => - Assert.Equal(Volume.FromHectoliters(2), 2.Hectoliters()); + Assert.Equal(Volume.FromHectoliters(2), 2.Hectoliters()); [Fact] public void NumberToHectousGallonsTest() => - Assert.Equal(Volume.FromHectousGallons(2), 2.HectousGallons()); + Assert.Equal(Volume.FromHectousGallons(2), 2.HectousGallons()); [Fact] public void NumberToImperialBeerBarrelsTest() => - Assert.Equal(Volume.FromImperialBeerBarrels(2), 2.ImperialBeerBarrels()); + Assert.Equal(Volume.FromImperialBeerBarrels(2), 2.ImperialBeerBarrels()); [Fact] public void NumberToImperialGallonsTest() => - Assert.Equal(Volume.FromImperialGallons(2), 2.ImperialGallons()); + Assert.Equal(Volume.FromImperialGallons(2), 2.ImperialGallons()); [Fact] public void NumberToImperialOuncesTest() => - Assert.Equal(Volume.FromImperialOunces(2), 2.ImperialOunces()); + Assert.Equal(Volume.FromImperialOunces(2), 2.ImperialOunces()); [Fact] public void NumberToImperialPintsTest() => - Assert.Equal(Volume.FromImperialPints(2), 2.ImperialPints()); + Assert.Equal(Volume.FromImperialPints(2), 2.ImperialPints()); [Fact] public void NumberToKilocubicFeetTest() => - Assert.Equal(Volume.FromKilocubicFeet(2), 2.KilocubicFeet()); + Assert.Equal(Volume.FromKilocubicFeet(2), 2.KilocubicFeet()); [Fact] public void NumberToKilocubicMetersTest() => - Assert.Equal(Volume.FromKilocubicMeters(2), 2.KilocubicMeters()); + Assert.Equal(Volume.FromKilocubicMeters(2), 2.KilocubicMeters()); [Fact] public void NumberToKiloimperialGallonsTest() => - Assert.Equal(Volume.FromKiloimperialGallons(2), 2.KiloimperialGallons()); + Assert.Equal(Volume.FromKiloimperialGallons(2), 2.KiloimperialGallons()); [Fact] public void NumberToKilolitersTest() => - Assert.Equal(Volume.FromKiloliters(2), 2.Kiloliters()); + Assert.Equal(Volume.FromKiloliters(2), 2.Kiloliters()); [Fact] public void NumberToKilousGallonsTest() => - Assert.Equal(Volume.FromKilousGallons(2), 2.KilousGallons()); + Assert.Equal(Volume.FromKilousGallons(2), 2.KilousGallons()); [Fact] public void NumberToLitersTest() => - Assert.Equal(Volume.FromLiters(2), 2.Liters()); + Assert.Equal(Volume.FromLiters(2), 2.Liters()); [Fact] public void NumberToMegacubicFeetTest() => - Assert.Equal(Volume.FromMegacubicFeet(2), 2.MegacubicFeet()); + Assert.Equal(Volume.FromMegacubicFeet(2), 2.MegacubicFeet()); [Fact] public void NumberToMegaimperialGallonsTest() => - Assert.Equal(Volume.FromMegaimperialGallons(2), 2.MegaimperialGallons()); + Assert.Equal(Volume.FromMegaimperialGallons(2), 2.MegaimperialGallons()); [Fact] public void NumberToMegalitersTest() => - Assert.Equal(Volume.FromMegaliters(2), 2.Megaliters()); + Assert.Equal(Volume.FromMegaliters(2), 2.Megaliters()); [Fact] public void NumberToMegausGallonsTest() => - Assert.Equal(Volume.FromMegausGallons(2), 2.MegausGallons()); + Assert.Equal(Volume.FromMegausGallons(2), 2.MegausGallons()); [Fact] public void NumberToMetricCupsTest() => - Assert.Equal(Volume.FromMetricCups(2), 2.MetricCups()); + Assert.Equal(Volume.FromMetricCups(2), 2.MetricCups()); [Fact] public void NumberToMetricTeaspoonsTest() => - Assert.Equal(Volume.FromMetricTeaspoons(2), 2.MetricTeaspoons()); + Assert.Equal(Volume.FromMetricTeaspoons(2), 2.MetricTeaspoons()); [Fact] public void NumberToMicrolitersTest() => - Assert.Equal(Volume.FromMicroliters(2), 2.Microliters()); + Assert.Equal(Volume.FromMicroliters(2), 2.Microliters()); [Fact] public void NumberToMillilitersTest() => - Assert.Equal(Volume.FromMilliliters(2), 2.Milliliters()); + Assert.Equal(Volume.FromMilliliters(2), 2.Milliliters()); [Fact] public void NumberToOilBarrelsTest() => - Assert.Equal(Volume.FromOilBarrels(2), 2.OilBarrels()); + Assert.Equal(Volume.FromOilBarrels(2), 2.OilBarrels()); [Fact] public void NumberToUkTablespoonsTest() => - Assert.Equal(Volume.FromUkTablespoons(2), 2.UkTablespoons()); + Assert.Equal(Volume.FromUkTablespoons(2), 2.UkTablespoons()); [Fact] public void NumberToUsBeerBarrelsTest() => - Assert.Equal(Volume.FromUsBeerBarrels(2), 2.UsBeerBarrels()); + Assert.Equal(Volume.FromUsBeerBarrels(2), 2.UsBeerBarrels()); [Fact] public void NumberToUsCustomaryCupsTest() => - Assert.Equal(Volume.FromUsCustomaryCups(2), 2.UsCustomaryCups()); + Assert.Equal(Volume.FromUsCustomaryCups(2), 2.UsCustomaryCups()); [Fact] public void NumberToUsGallonsTest() => - Assert.Equal(Volume.FromUsGallons(2), 2.UsGallons()); + Assert.Equal(Volume.FromUsGallons(2), 2.UsGallons()); [Fact] public void NumberToUsLegalCupsTest() => - Assert.Equal(Volume.FromUsLegalCups(2), 2.UsLegalCups()); + Assert.Equal(Volume.FromUsLegalCups(2), 2.UsLegalCups()); [Fact] public void NumberToUsOuncesTest() => - Assert.Equal(Volume.FromUsOunces(2), 2.UsOunces()); + Assert.Equal(Volume.FromUsOunces(2), 2.UsOunces()); [Fact] public void NumberToUsPintsTest() => - Assert.Equal(Volume.FromUsPints(2), 2.UsPints()); + Assert.Equal(Volume.FromUsPints(2), 2.UsPints()); [Fact] public void NumberToUsQuartsTest() => - Assert.Equal(Volume.FromUsQuarts(2), 2.UsQuarts()); + Assert.Equal(Volume.FromUsQuarts(2), 2.UsQuarts()); [Fact] public void NumberToUsTablespoonsTest() => - Assert.Equal(Volume.FromUsTablespoons(2), 2.UsTablespoons()); + Assert.Equal(Volume.FromUsTablespoons(2), 2.UsTablespoons()); [Fact] public void NumberToUsTeaspoonsTest() => - Assert.Equal(Volume.FromUsTeaspoons(2), 2.UsTeaspoons()); + Assert.Equal(Volume.FromUsTeaspoons(2), 2.UsTeaspoons()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeFlowExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeFlowExtensionsTest.g.cs index 2aeedf0c9a..a11f2cc276 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeFlowExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeFlowExtensionsTest.g.cs @@ -21,232 +21,232 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToVolumeFlowExtensionsTests { [Fact] public void NumberToAcreFeetPerDayTest() => - Assert.Equal(VolumeFlow.FromAcreFeetPerDay(2), 2.AcreFeetPerDay()); + Assert.Equal(VolumeFlow.FromAcreFeetPerDay(2), 2.AcreFeetPerDay()); [Fact] public void NumberToAcreFeetPerHourTest() => - Assert.Equal(VolumeFlow.FromAcreFeetPerHour(2), 2.AcreFeetPerHour()); + Assert.Equal(VolumeFlow.FromAcreFeetPerHour(2), 2.AcreFeetPerHour()); [Fact] public void NumberToAcreFeetPerMinuteTest() => - Assert.Equal(VolumeFlow.FromAcreFeetPerMinute(2), 2.AcreFeetPerMinute()); + Assert.Equal(VolumeFlow.FromAcreFeetPerMinute(2), 2.AcreFeetPerMinute()); [Fact] public void NumberToAcreFeetPerSecondTest() => - Assert.Equal(VolumeFlow.FromAcreFeetPerSecond(2), 2.AcreFeetPerSecond()); + Assert.Equal(VolumeFlow.FromAcreFeetPerSecond(2), 2.AcreFeetPerSecond()); [Fact] public void NumberToCentilitersPerDayTest() => - Assert.Equal(VolumeFlow.FromCentilitersPerDay(2), 2.CentilitersPerDay()); + Assert.Equal(VolumeFlow.FromCentilitersPerDay(2), 2.CentilitersPerDay()); [Fact] public void NumberToCentilitersPerMinuteTest() => - Assert.Equal(VolumeFlow.FromCentilitersPerMinute(2), 2.CentilitersPerMinute()); + Assert.Equal(VolumeFlow.FromCentilitersPerMinute(2), 2.CentilitersPerMinute()); [Fact] public void NumberToCentilitersPerSecondTest() => - Assert.Equal(VolumeFlow.FromCentilitersPerSecond(2), 2.CentilitersPerSecond()); + Assert.Equal(VolumeFlow.FromCentilitersPerSecond(2), 2.CentilitersPerSecond()); [Fact] public void NumberToCubicCentimetersPerMinuteTest() => - Assert.Equal(VolumeFlow.FromCubicCentimetersPerMinute(2), 2.CubicCentimetersPerMinute()); + Assert.Equal(VolumeFlow.FromCubicCentimetersPerMinute(2), 2.CubicCentimetersPerMinute()); [Fact] public void NumberToCubicDecimetersPerMinuteTest() => - Assert.Equal(VolumeFlow.FromCubicDecimetersPerMinute(2), 2.CubicDecimetersPerMinute()); + Assert.Equal(VolumeFlow.FromCubicDecimetersPerMinute(2), 2.CubicDecimetersPerMinute()); [Fact] public void NumberToCubicFeetPerHourTest() => - Assert.Equal(VolumeFlow.FromCubicFeetPerHour(2), 2.CubicFeetPerHour()); + Assert.Equal(VolumeFlow.FromCubicFeetPerHour(2), 2.CubicFeetPerHour()); [Fact] public void NumberToCubicFeetPerMinuteTest() => - Assert.Equal(VolumeFlow.FromCubicFeetPerMinute(2), 2.CubicFeetPerMinute()); + Assert.Equal(VolumeFlow.FromCubicFeetPerMinute(2), 2.CubicFeetPerMinute()); [Fact] public void NumberToCubicFeetPerSecondTest() => - Assert.Equal(VolumeFlow.FromCubicFeetPerSecond(2), 2.CubicFeetPerSecond()); + Assert.Equal(VolumeFlow.FromCubicFeetPerSecond(2), 2.CubicFeetPerSecond()); [Fact] public void NumberToCubicMetersPerDayTest() => - Assert.Equal(VolumeFlow.FromCubicMetersPerDay(2), 2.CubicMetersPerDay()); + Assert.Equal(VolumeFlow.FromCubicMetersPerDay(2), 2.CubicMetersPerDay()); [Fact] public void NumberToCubicMetersPerHourTest() => - Assert.Equal(VolumeFlow.FromCubicMetersPerHour(2), 2.CubicMetersPerHour()); + Assert.Equal(VolumeFlow.FromCubicMetersPerHour(2), 2.CubicMetersPerHour()); [Fact] public void NumberToCubicMetersPerMinuteTest() => - Assert.Equal(VolumeFlow.FromCubicMetersPerMinute(2), 2.CubicMetersPerMinute()); + Assert.Equal(VolumeFlow.FromCubicMetersPerMinute(2), 2.CubicMetersPerMinute()); [Fact] public void NumberToCubicMetersPerSecondTest() => - Assert.Equal(VolumeFlow.FromCubicMetersPerSecond(2), 2.CubicMetersPerSecond()); + Assert.Equal(VolumeFlow.FromCubicMetersPerSecond(2), 2.CubicMetersPerSecond()); [Fact] public void NumberToCubicMillimetersPerSecondTest() => - Assert.Equal(VolumeFlow.FromCubicMillimetersPerSecond(2), 2.CubicMillimetersPerSecond()); + Assert.Equal(VolumeFlow.FromCubicMillimetersPerSecond(2), 2.CubicMillimetersPerSecond()); [Fact] public void NumberToCubicYardsPerDayTest() => - Assert.Equal(VolumeFlow.FromCubicYardsPerDay(2), 2.CubicYardsPerDay()); + Assert.Equal(VolumeFlow.FromCubicYardsPerDay(2), 2.CubicYardsPerDay()); [Fact] public void NumberToCubicYardsPerHourTest() => - Assert.Equal(VolumeFlow.FromCubicYardsPerHour(2), 2.CubicYardsPerHour()); + Assert.Equal(VolumeFlow.FromCubicYardsPerHour(2), 2.CubicYardsPerHour()); [Fact] public void NumberToCubicYardsPerMinuteTest() => - Assert.Equal(VolumeFlow.FromCubicYardsPerMinute(2), 2.CubicYardsPerMinute()); + Assert.Equal(VolumeFlow.FromCubicYardsPerMinute(2), 2.CubicYardsPerMinute()); [Fact] public void NumberToCubicYardsPerSecondTest() => - Assert.Equal(VolumeFlow.FromCubicYardsPerSecond(2), 2.CubicYardsPerSecond()); + Assert.Equal(VolumeFlow.FromCubicYardsPerSecond(2), 2.CubicYardsPerSecond()); [Fact] public void NumberToDecilitersPerDayTest() => - Assert.Equal(VolumeFlow.FromDecilitersPerDay(2), 2.DecilitersPerDay()); + Assert.Equal(VolumeFlow.FromDecilitersPerDay(2), 2.DecilitersPerDay()); [Fact] public void NumberToDecilitersPerMinuteTest() => - Assert.Equal(VolumeFlow.FromDecilitersPerMinute(2), 2.DecilitersPerMinute()); + Assert.Equal(VolumeFlow.FromDecilitersPerMinute(2), 2.DecilitersPerMinute()); [Fact] public void NumberToDecilitersPerSecondTest() => - Assert.Equal(VolumeFlow.FromDecilitersPerSecond(2), 2.DecilitersPerSecond()); + Assert.Equal(VolumeFlow.FromDecilitersPerSecond(2), 2.DecilitersPerSecond()); [Fact] public void NumberToKilolitersPerDayTest() => - Assert.Equal(VolumeFlow.FromKilolitersPerDay(2), 2.KilolitersPerDay()); + Assert.Equal(VolumeFlow.FromKilolitersPerDay(2), 2.KilolitersPerDay()); [Fact] public void NumberToKilolitersPerMinuteTest() => - Assert.Equal(VolumeFlow.FromKilolitersPerMinute(2), 2.KilolitersPerMinute()); + Assert.Equal(VolumeFlow.FromKilolitersPerMinute(2), 2.KilolitersPerMinute()); [Fact] public void NumberToKilolitersPerSecondTest() => - Assert.Equal(VolumeFlow.FromKilolitersPerSecond(2), 2.KilolitersPerSecond()); + Assert.Equal(VolumeFlow.FromKilolitersPerSecond(2), 2.KilolitersPerSecond()); [Fact] public void NumberToKilousGallonsPerMinuteTest() => - Assert.Equal(VolumeFlow.FromKilousGallonsPerMinute(2), 2.KilousGallonsPerMinute()); + Assert.Equal(VolumeFlow.FromKilousGallonsPerMinute(2), 2.KilousGallonsPerMinute()); [Fact] public void NumberToLitersPerDayTest() => - Assert.Equal(VolumeFlow.FromLitersPerDay(2), 2.LitersPerDay()); + Assert.Equal(VolumeFlow.FromLitersPerDay(2), 2.LitersPerDay()); [Fact] public void NumberToLitersPerHourTest() => - Assert.Equal(VolumeFlow.FromLitersPerHour(2), 2.LitersPerHour()); + Assert.Equal(VolumeFlow.FromLitersPerHour(2), 2.LitersPerHour()); [Fact] public void NumberToLitersPerMinuteTest() => - Assert.Equal(VolumeFlow.FromLitersPerMinute(2), 2.LitersPerMinute()); + Assert.Equal(VolumeFlow.FromLitersPerMinute(2), 2.LitersPerMinute()); [Fact] public void NumberToLitersPerSecondTest() => - Assert.Equal(VolumeFlow.FromLitersPerSecond(2), 2.LitersPerSecond()); + Assert.Equal(VolumeFlow.FromLitersPerSecond(2), 2.LitersPerSecond()); [Fact] public void NumberToMegalitersPerDayTest() => - Assert.Equal(VolumeFlow.FromMegalitersPerDay(2), 2.MegalitersPerDay()); + Assert.Equal(VolumeFlow.FromMegalitersPerDay(2), 2.MegalitersPerDay()); [Fact] public void NumberToMegaukGallonsPerSecondTest() => - Assert.Equal(VolumeFlow.FromMegaukGallonsPerSecond(2), 2.MegaukGallonsPerSecond()); + Assert.Equal(VolumeFlow.FromMegaukGallonsPerSecond(2), 2.MegaukGallonsPerSecond()); [Fact] public void NumberToMicrolitersPerDayTest() => - Assert.Equal(VolumeFlow.FromMicrolitersPerDay(2), 2.MicrolitersPerDay()); + Assert.Equal(VolumeFlow.FromMicrolitersPerDay(2), 2.MicrolitersPerDay()); [Fact] public void NumberToMicrolitersPerMinuteTest() => - Assert.Equal(VolumeFlow.FromMicrolitersPerMinute(2), 2.MicrolitersPerMinute()); + Assert.Equal(VolumeFlow.FromMicrolitersPerMinute(2), 2.MicrolitersPerMinute()); [Fact] public void NumberToMicrolitersPerSecondTest() => - Assert.Equal(VolumeFlow.FromMicrolitersPerSecond(2), 2.MicrolitersPerSecond()); + Assert.Equal(VolumeFlow.FromMicrolitersPerSecond(2), 2.MicrolitersPerSecond()); [Fact] public void NumberToMillilitersPerDayTest() => - Assert.Equal(VolumeFlow.FromMillilitersPerDay(2), 2.MillilitersPerDay()); + Assert.Equal(VolumeFlow.FromMillilitersPerDay(2), 2.MillilitersPerDay()); [Fact] public void NumberToMillilitersPerMinuteTest() => - Assert.Equal(VolumeFlow.FromMillilitersPerMinute(2), 2.MillilitersPerMinute()); + Assert.Equal(VolumeFlow.FromMillilitersPerMinute(2), 2.MillilitersPerMinute()); [Fact] public void NumberToMillilitersPerSecondTest() => - Assert.Equal(VolumeFlow.FromMillilitersPerSecond(2), 2.MillilitersPerSecond()); + Assert.Equal(VolumeFlow.FromMillilitersPerSecond(2), 2.MillilitersPerSecond()); [Fact] public void NumberToMillionUsGallonsPerDayTest() => - Assert.Equal(VolumeFlow.FromMillionUsGallonsPerDay(2), 2.MillionUsGallonsPerDay()); + Assert.Equal(VolumeFlow.FromMillionUsGallonsPerDay(2), 2.MillionUsGallonsPerDay()); [Fact] public void NumberToNanolitersPerDayTest() => - Assert.Equal(VolumeFlow.FromNanolitersPerDay(2), 2.NanolitersPerDay()); + Assert.Equal(VolumeFlow.FromNanolitersPerDay(2), 2.NanolitersPerDay()); [Fact] public void NumberToNanolitersPerMinuteTest() => - Assert.Equal(VolumeFlow.FromNanolitersPerMinute(2), 2.NanolitersPerMinute()); + Assert.Equal(VolumeFlow.FromNanolitersPerMinute(2), 2.NanolitersPerMinute()); [Fact] public void NumberToNanolitersPerSecondTest() => - Assert.Equal(VolumeFlow.FromNanolitersPerSecond(2), 2.NanolitersPerSecond()); + Assert.Equal(VolumeFlow.FromNanolitersPerSecond(2), 2.NanolitersPerSecond()); [Fact] public void NumberToOilBarrelsPerDayTest() => - Assert.Equal(VolumeFlow.FromOilBarrelsPerDay(2), 2.OilBarrelsPerDay()); + Assert.Equal(VolumeFlow.FromOilBarrelsPerDay(2), 2.OilBarrelsPerDay()); [Fact] public void NumberToOilBarrelsPerHourTest() => - Assert.Equal(VolumeFlow.FromOilBarrelsPerHour(2), 2.OilBarrelsPerHour()); + Assert.Equal(VolumeFlow.FromOilBarrelsPerHour(2), 2.OilBarrelsPerHour()); [Fact] public void NumberToOilBarrelsPerMinuteTest() => - Assert.Equal(VolumeFlow.FromOilBarrelsPerMinute(2), 2.OilBarrelsPerMinute()); + Assert.Equal(VolumeFlow.FromOilBarrelsPerMinute(2), 2.OilBarrelsPerMinute()); [Fact] public void NumberToOilBarrelsPerSecondTest() => - Assert.Equal(VolumeFlow.FromOilBarrelsPerSecond(2), 2.OilBarrelsPerSecond()); + Assert.Equal(VolumeFlow.FromOilBarrelsPerSecond(2), 2.OilBarrelsPerSecond()); [Fact] public void NumberToUkGallonsPerDayTest() => - Assert.Equal(VolumeFlow.FromUkGallonsPerDay(2), 2.UkGallonsPerDay()); + Assert.Equal(VolumeFlow.FromUkGallonsPerDay(2), 2.UkGallonsPerDay()); [Fact] public void NumberToUkGallonsPerHourTest() => - Assert.Equal(VolumeFlow.FromUkGallonsPerHour(2), 2.UkGallonsPerHour()); + Assert.Equal(VolumeFlow.FromUkGallonsPerHour(2), 2.UkGallonsPerHour()); [Fact] public void NumberToUkGallonsPerMinuteTest() => - Assert.Equal(VolumeFlow.FromUkGallonsPerMinute(2), 2.UkGallonsPerMinute()); + Assert.Equal(VolumeFlow.FromUkGallonsPerMinute(2), 2.UkGallonsPerMinute()); [Fact] public void NumberToUkGallonsPerSecondTest() => - Assert.Equal(VolumeFlow.FromUkGallonsPerSecond(2), 2.UkGallonsPerSecond()); + Assert.Equal(VolumeFlow.FromUkGallonsPerSecond(2), 2.UkGallonsPerSecond()); [Fact] public void NumberToUsGallonsPerDayTest() => - Assert.Equal(VolumeFlow.FromUsGallonsPerDay(2), 2.UsGallonsPerDay()); + Assert.Equal(VolumeFlow.FromUsGallonsPerDay(2), 2.UsGallonsPerDay()); [Fact] public void NumberToUsGallonsPerHourTest() => - Assert.Equal(VolumeFlow.FromUsGallonsPerHour(2), 2.UsGallonsPerHour()); + Assert.Equal(VolumeFlow.FromUsGallonsPerHour(2), 2.UsGallonsPerHour()); [Fact] public void NumberToUsGallonsPerMinuteTest() => - Assert.Equal(VolumeFlow.FromUsGallonsPerMinute(2), 2.UsGallonsPerMinute()); + Assert.Equal(VolumeFlow.FromUsGallonsPerMinute(2), 2.UsGallonsPerMinute()); [Fact] public void NumberToUsGallonsPerSecondTest() => - Assert.Equal(VolumeFlow.FromUsGallonsPerSecond(2), 2.UsGallonsPerSecond()); + Assert.Equal(VolumeFlow.FromUsGallonsPerSecond(2), 2.UsGallonsPerSecond()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumePerLengthExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumePerLengthExtensionsTest.g.cs index 7ed77c9124..b6fccfc504 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumePerLengthExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumePerLengthExtensionsTest.g.cs @@ -21,36 +21,36 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToVolumePerLengthExtensionsTests { [Fact] public void NumberToCubicMetersPerMeterTest() => - Assert.Equal(VolumePerLength.FromCubicMetersPerMeter(2), 2.CubicMetersPerMeter()); + Assert.Equal(VolumePerLength.FromCubicMetersPerMeter(2), 2.CubicMetersPerMeter()); [Fact] public void NumberToCubicYardsPerFootTest() => - Assert.Equal(VolumePerLength.FromCubicYardsPerFoot(2), 2.CubicYardsPerFoot()); + Assert.Equal(VolumePerLength.FromCubicYardsPerFoot(2), 2.CubicYardsPerFoot()); [Fact] public void NumberToCubicYardsPerUsSurveyFootTest() => - Assert.Equal(VolumePerLength.FromCubicYardsPerUsSurveyFoot(2), 2.CubicYardsPerUsSurveyFoot()); + Assert.Equal(VolumePerLength.FromCubicYardsPerUsSurveyFoot(2), 2.CubicYardsPerUsSurveyFoot()); [Fact] public void NumberToLitersPerKilometerTest() => - Assert.Equal(VolumePerLength.FromLitersPerKilometer(2), 2.LitersPerKilometer()); + Assert.Equal(VolumePerLength.FromLitersPerKilometer(2), 2.LitersPerKilometer()); [Fact] public void NumberToLitersPerMeterTest() => - Assert.Equal(VolumePerLength.FromLitersPerMeter(2), 2.LitersPerMeter()); + Assert.Equal(VolumePerLength.FromLitersPerMeter(2), 2.LitersPerMeter()); [Fact] public void NumberToLitersPerMillimeterTest() => - Assert.Equal(VolumePerLength.FromLitersPerMillimeter(2), 2.LitersPerMillimeter()); + Assert.Equal(VolumePerLength.FromLitersPerMillimeter(2), 2.LitersPerMillimeter()); [Fact] public void NumberToOilBarrelsPerFootTest() => - Assert.Equal(VolumePerLength.FromOilBarrelsPerFoot(2), 2.OilBarrelsPerFoot()); + Assert.Equal(VolumePerLength.FromOilBarrelsPerFoot(2), 2.OilBarrelsPerFoot()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToWarpingMomentOfInertiaExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToWarpingMomentOfInertiaExtensionsTest.g.cs index c8f804a162..e8776e487a 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToWarpingMomentOfInertiaExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToWarpingMomentOfInertiaExtensionsTest.g.cs @@ -21,32 +21,32 @@ using Xunit; namespace UnitsNet.Tests -{ +{ public class NumberToWarpingMomentOfInertiaExtensionsTests { [Fact] public void NumberToCentimetersToTheSixthTest() => - Assert.Equal(WarpingMomentOfInertia.FromCentimetersToTheSixth(2), 2.CentimetersToTheSixth()); + Assert.Equal(WarpingMomentOfInertia.FromCentimetersToTheSixth(2), 2.CentimetersToTheSixth()); [Fact] public void NumberToDecimetersToTheSixthTest() => - Assert.Equal(WarpingMomentOfInertia.FromDecimetersToTheSixth(2), 2.DecimetersToTheSixth()); + Assert.Equal(WarpingMomentOfInertia.FromDecimetersToTheSixth(2), 2.DecimetersToTheSixth()); [Fact] public void NumberToFeetToTheSixthTest() => - Assert.Equal(WarpingMomentOfInertia.FromFeetToTheSixth(2), 2.FeetToTheSixth()); + Assert.Equal(WarpingMomentOfInertia.FromFeetToTheSixth(2), 2.FeetToTheSixth()); [Fact] public void NumberToInchesToTheSixthTest() => - Assert.Equal(WarpingMomentOfInertia.FromInchesToTheSixth(2), 2.InchesToTheSixth()); + Assert.Equal(WarpingMomentOfInertia.FromInchesToTheSixth(2), 2.InchesToTheSixth()); [Fact] public void NumberToMetersToTheSixthTest() => - Assert.Equal(WarpingMomentOfInertia.FromMetersToTheSixth(2), 2.MetersToTheSixth()); + Assert.Equal(WarpingMomentOfInertia.FromMetersToTheSixth(2), 2.MetersToTheSixth()); [Fact] public void NumberToMillimetersToTheSixthTest() => - Assert.Equal(WarpingMomentOfInertia.FromMillimetersToTheSixth(2), 2.MillimetersToTheSixth()); + Assert.Equal(WarpingMomentOfInertia.FromMillimetersToTheSixth(2), 2.MillimetersToTheSixth()); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToAccelerationExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToAccelerationExtensions.g.cs index c0e6e96b35..e7a60e5dc8 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToAccelerationExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToAccelerationExtensions.g.cs @@ -28,61 +28,61 @@ namespace UnitsNet.NumberExtensions.NumberToAcceleration /// public static class NumberToAccelerationExtensions { - /// - public static Acceleration CentimetersPerSecondSquared(this T value) => - Acceleration.FromCentimetersPerSecondSquared(Convert.ToDouble(value)); + /// + public static Acceleration CentimetersPerSecondSquared(this T value) => + Acceleration.FromCentimetersPerSecondSquared(Convert.ToDouble(value)); - /// - public static Acceleration DecimetersPerSecondSquared(this T value) => - Acceleration.FromDecimetersPerSecondSquared(Convert.ToDouble(value)); + /// + public static Acceleration DecimetersPerSecondSquared(this T value) => + Acceleration.FromDecimetersPerSecondSquared(Convert.ToDouble(value)); - /// - public static Acceleration FeetPerSecondSquared(this T value) => - Acceleration.FromFeetPerSecondSquared(Convert.ToDouble(value)); + /// + public static Acceleration FeetPerSecondSquared(this T value) => + Acceleration.FromFeetPerSecondSquared(Convert.ToDouble(value)); - /// - public static Acceleration InchesPerSecondSquared(this T value) => - Acceleration.FromInchesPerSecondSquared(Convert.ToDouble(value)); + /// + public static Acceleration InchesPerSecondSquared(this T value) => + Acceleration.FromInchesPerSecondSquared(Convert.ToDouble(value)); - /// - public static Acceleration KilometersPerSecondSquared(this T value) => - Acceleration.FromKilometersPerSecondSquared(Convert.ToDouble(value)); + /// + public static Acceleration KilometersPerSecondSquared(this T value) => + Acceleration.FromKilometersPerSecondSquared(Convert.ToDouble(value)); - /// - public static Acceleration KnotsPerHour(this T value) => - Acceleration.FromKnotsPerHour(Convert.ToDouble(value)); + /// + public static Acceleration KnotsPerHour(this T value) => + Acceleration.FromKnotsPerHour(Convert.ToDouble(value)); - /// - public static Acceleration KnotsPerMinute(this T value) => - Acceleration.FromKnotsPerMinute(Convert.ToDouble(value)); + /// + public static Acceleration KnotsPerMinute(this T value) => + Acceleration.FromKnotsPerMinute(Convert.ToDouble(value)); - /// - public static Acceleration KnotsPerSecond(this T value) => - Acceleration.FromKnotsPerSecond(Convert.ToDouble(value)); + /// + public static Acceleration KnotsPerSecond(this T value) => + Acceleration.FromKnotsPerSecond(Convert.ToDouble(value)); - /// - public static Acceleration MetersPerSecondSquared(this T value) => - Acceleration.FromMetersPerSecondSquared(Convert.ToDouble(value)); + /// + public static Acceleration MetersPerSecondSquared(this T value) => + Acceleration.FromMetersPerSecondSquared(Convert.ToDouble(value)); - /// - public static Acceleration MicrometersPerSecondSquared(this T value) => - Acceleration.FromMicrometersPerSecondSquared(Convert.ToDouble(value)); + /// + public static Acceleration MicrometersPerSecondSquared(this T value) => + Acceleration.FromMicrometersPerSecondSquared(Convert.ToDouble(value)); - /// - public static Acceleration MillimetersPerSecondSquared(this T value) => - Acceleration.FromMillimetersPerSecondSquared(Convert.ToDouble(value)); + /// + public static Acceleration MillimetersPerSecondSquared(this T value) => + Acceleration.FromMillimetersPerSecondSquared(Convert.ToDouble(value)); - /// - public static Acceleration MillistandardGravity(this T value) => - Acceleration.FromMillistandardGravity(Convert.ToDouble(value)); + /// + public static Acceleration MillistandardGravity(this T value) => + Acceleration.FromMillistandardGravity(Convert.ToDouble(value)); - /// - public static Acceleration NanometersPerSecondSquared(this T value) => - Acceleration.FromNanometersPerSecondSquared(Convert.ToDouble(value)); + /// + public static Acceleration NanometersPerSecondSquared(this T value) => + Acceleration.FromNanometersPerSecondSquared(Convert.ToDouble(value)); - /// - public static Acceleration StandardGravity(this T value) => - Acceleration.FromStandardGravity(Convert.ToDouble(value)); + /// + public static Acceleration StandardGravity(this T value) => + Acceleration.FromStandardGravity(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToAmountOfSubstanceExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToAmountOfSubstanceExtensions.g.cs index bed53ac973..11bfefd679 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToAmountOfSubstanceExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToAmountOfSubstanceExtensions.g.cs @@ -28,65 +28,65 @@ namespace UnitsNet.NumberExtensions.NumberToAmountOfSubstance /// public static class NumberToAmountOfSubstanceExtensions { - /// - public static AmountOfSubstance Centimoles(this T value) => - AmountOfSubstance.FromCentimoles(Convert.ToDouble(value)); + /// + public static AmountOfSubstance Centimoles(this T value) => + AmountOfSubstance.FromCentimoles(Convert.ToDouble(value)); - /// - public static AmountOfSubstance CentipoundMoles(this T value) => - AmountOfSubstance.FromCentipoundMoles(Convert.ToDouble(value)); + /// + public static AmountOfSubstance CentipoundMoles(this T value) => + AmountOfSubstance.FromCentipoundMoles(Convert.ToDouble(value)); - /// - public static AmountOfSubstance Decimoles(this T value) => - AmountOfSubstance.FromDecimoles(Convert.ToDouble(value)); + /// + public static AmountOfSubstance Decimoles(this T value) => + AmountOfSubstance.FromDecimoles(Convert.ToDouble(value)); - /// - public static AmountOfSubstance DecipoundMoles(this T value) => - AmountOfSubstance.FromDecipoundMoles(Convert.ToDouble(value)); + /// + public static AmountOfSubstance DecipoundMoles(this T value) => + AmountOfSubstance.FromDecipoundMoles(Convert.ToDouble(value)); - /// - public static AmountOfSubstance Kilomoles(this T value) => - AmountOfSubstance.FromKilomoles(Convert.ToDouble(value)); + /// + public static AmountOfSubstance Kilomoles(this T value) => + AmountOfSubstance.FromKilomoles(Convert.ToDouble(value)); - /// - public static AmountOfSubstance KilopoundMoles(this T value) => - AmountOfSubstance.FromKilopoundMoles(Convert.ToDouble(value)); + /// + public static AmountOfSubstance KilopoundMoles(this T value) => + AmountOfSubstance.FromKilopoundMoles(Convert.ToDouble(value)); - /// - public static AmountOfSubstance Megamoles(this T value) => - AmountOfSubstance.FromMegamoles(Convert.ToDouble(value)); + /// + public static AmountOfSubstance Megamoles(this T value) => + AmountOfSubstance.FromMegamoles(Convert.ToDouble(value)); - /// - public static AmountOfSubstance Micromoles(this T value) => - AmountOfSubstance.FromMicromoles(Convert.ToDouble(value)); + /// + public static AmountOfSubstance Micromoles(this T value) => + AmountOfSubstance.FromMicromoles(Convert.ToDouble(value)); - /// - public static AmountOfSubstance MicropoundMoles(this T value) => - AmountOfSubstance.FromMicropoundMoles(Convert.ToDouble(value)); + /// + public static AmountOfSubstance MicropoundMoles(this T value) => + AmountOfSubstance.FromMicropoundMoles(Convert.ToDouble(value)); - /// - public static AmountOfSubstance Millimoles(this T value) => - AmountOfSubstance.FromMillimoles(Convert.ToDouble(value)); + /// + public static AmountOfSubstance Millimoles(this T value) => + AmountOfSubstance.FromMillimoles(Convert.ToDouble(value)); - /// - public static AmountOfSubstance MillipoundMoles(this T value) => - AmountOfSubstance.FromMillipoundMoles(Convert.ToDouble(value)); + /// + public static AmountOfSubstance MillipoundMoles(this T value) => + AmountOfSubstance.FromMillipoundMoles(Convert.ToDouble(value)); - /// - public static AmountOfSubstance Moles(this T value) => - AmountOfSubstance.FromMoles(Convert.ToDouble(value)); + /// + public static AmountOfSubstance Moles(this T value) => + AmountOfSubstance.FromMoles(Convert.ToDouble(value)); - /// - public static AmountOfSubstance Nanomoles(this T value) => - AmountOfSubstance.FromNanomoles(Convert.ToDouble(value)); + /// + public static AmountOfSubstance Nanomoles(this T value) => + AmountOfSubstance.FromNanomoles(Convert.ToDouble(value)); - /// - public static AmountOfSubstance NanopoundMoles(this T value) => - AmountOfSubstance.FromNanopoundMoles(Convert.ToDouble(value)); + /// + public static AmountOfSubstance NanopoundMoles(this T value) => + AmountOfSubstance.FromNanopoundMoles(Convert.ToDouble(value)); - /// - public static AmountOfSubstance PoundMoles(this T value) => - AmountOfSubstance.FromPoundMoles(Convert.ToDouble(value)); + /// + public static AmountOfSubstance PoundMoles(this T value) => + AmountOfSubstance.FromPoundMoles(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToAmplitudeRatioExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToAmplitudeRatioExtensions.g.cs index a694f8660d..1b0b3be17f 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToAmplitudeRatioExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToAmplitudeRatioExtensions.g.cs @@ -28,21 +28,21 @@ namespace UnitsNet.NumberExtensions.NumberToAmplitudeRatio /// public static class NumberToAmplitudeRatioExtensions { - /// - public static AmplitudeRatio DecibelMicrovolts(this T value) => - AmplitudeRatio.FromDecibelMicrovolts(Convert.ToDouble(value)); + /// + public static AmplitudeRatio DecibelMicrovolts(this T value) => + AmplitudeRatio.FromDecibelMicrovolts(Convert.ToDouble(value)); - /// - public static AmplitudeRatio DecibelMillivolts(this T value) => - AmplitudeRatio.FromDecibelMillivolts(Convert.ToDouble(value)); + /// + public static AmplitudeRatio DecibelMillivolts(this T value) => + AmplitudeRatio.FromDecibelMillivolts(Convert.ToDouble(value)); - /// - public static AmplitudeRatio DecibelsUnloaded(this T value) => - AmplitudeRatio.FromDecibelsUnloaded(Convert.ToDouble(value)); + /// + public static AmplitudeRatio DecibelsUnloaded(this T value) => + AmplitudeRatio.FromDecibelsUnloaded(Convert.ToDouble(value)); - /// - public static AmplitudeRatio DecibelVolts(this T value) => - AmplitudeRatio.FromDecibelVolts(Convert.ToDouble(value)); + /// + public static AmplitudeRatio DecibelVolts(this T value) => + AmplitudeRatio.FromDecibelVolts(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToAngleExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToAngleExtensions.g.cs index 42404c0baa..2f235d28ff 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToAngleExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToAngleExtensions.g.cs @@ -28,61 +28,61 @@ namespace UnitsNet.NumberExtensions.NumberToAngle /// public static class NumberToAngleExtensions { - /// - public static Angle Arcminutes(this T value) => - Angle.FromArcminutes(Convert.ToDouble(value)); + /// + public static Angle Arcminutes(this T value) => + Angle.FromArcminutes(Convert.ToDouble(value)); - /// - public static Angle Arcseconds(this T value) => - Angle.FromArcseconds(Convert.ToDouble(value)); + /// + public static Angle Arcseconds(this T value) => + Angle.FromArcseconds(Convert.ToDouble(value)); - /// - public static Angle Centiradians(this T value) => - Angle.FromCentiradians(Convert.ToDouble(value)); + /// + public static Angle Centiradians(this T value) => + Angle.FromCentiradians(Convert.ToDouble(value)); - /// - public static Angle Deciradians(this T value) => - Angle.FromDeciradians(Convert.ToDouble(value)); + /// + public static Angle Deciradians(this T value) => + Angle.FromDeciradians(Convert.ToDouble(value)); - /// - public static Angle Degrees(this T value) => - Angle.FromDegrees(Convert.ToDouble(value)); + /// + public static Angle Degrees(this T value) => + Angle.FromDegrees(Convert.ToDouble(value)); - /// - public static Angle Gradians(this T value) => - Angle.FromGradians(Convert.ToDouble(value)); + /// + public static Angle Gradians(this T value) => + Angle.FromGradians(Convert.ToDouble(value)); - /// - public static Angle Microdegrees(this T value) => - Angle.FromMicrodegrees(Convert.ToDouble(value)); + /// + public static Angle Microdegrees(this T value) => + Angle.FromMicrodegrees(Convert.ToDouble(value)); - /// - public static Angle Microradians(this T value) => - Angle.FromMicroradians(Convert.ToDouble(value)); + /// + public static Angle Microradians(this T value) => + Angle.FromMicroradians(Convert.ToDouble(value)); - /// - public static Angle Millidegrees(this T value) => - Angle.FromMillidegrees(Convert.ToDouble(value)); + /// + public static Angle Millidegrees(this T value) => + Angle.FromMillidegrees(Convert.ToDouble(value)); - /// - public static Angle Milliradians(this T value) => - Angle.FromMilliradians(Convert.ToDouble(value)); + /// + public static Angle Milliradians(this T value) => + Angle.FromMilliradians(Convert.ToDouble(value)); - /// - public static Angle Nanodegrees(this T value) => - Angle.FromNanodegrees(Convert.ToDouble(value)); + /// + public static Angle Nanodegrees(this T value) => + Angle.FromNanodegrees(Convert.ToDouble(value)); - /// - public static Angle Nanoradians(this T value) => - Angle.FromNanoradians(Convert.ToDouble(value)); + /// + public static Angle Nanoradians(this T value) => + Angle.FromNanoradians(Convert.ToDouble(value)); - /// - public static Angle Radians(this T value) => - Angle.FromRadians(Convert.ToDouble(value)); + /// + public static Angle Radians(this T value) => + Angle.FromRadians(Convert.ToDouble(value)); - /// - public static Angle Revolutions(this T value) => - Angle.FromRevolutions(Convert.ToDouble(value)); + /// + public static Angle Revolutions(this T value) => + Angle.FromRevolutions(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToApparentEnergyExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToApparentEnergyExtensions.g.cs index 4057b6edd8..ca8b799bef 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToApparentEnergyExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToApparentEnergyExtensions.g.cs @@ -28,17 +28,17 @@ namespace UnitsNet.NumberExtensions.NumberToApparentEnergy /// public static class NumberToApparentEnergyExtensions { - /// - public static ApparentEnergy KilovoltampereHours(this T value) => - ApparentEnergy.FromKilovoltampereHours(Convert.ToDouble(value)); + /// + public static ApparentEnergy KilovoltampereHours(this T value) => + ApparentEnergy.FromKilovoltampereHours(Convert.ToDouble(value)); - /// - public static ApparentEnergy MegavoltampereHours(this T value) => - ApparentEnergy.FromMegavoltampereHours(Convert.ToDouble(value)); + /// + public static ApparentEnergy MegavoltampereHours(this T value) => + ApparentEnergy.FromMegavoltampereHours(Convert.ToDouble(value)); - /// - public static ApparentEnergy VoltampereHours(this T value) => - ApparentEnergy.FromVoltampereHours(Convert.ToDouble(value)); + /// + public static ApparentEnergy VoltampereHours(this T value) => + ApparentEnergy.FromVoltampereHours(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToApparentPowerExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToApparentPowerExtensions.g.cs index 95751cd60d..46586aeff8 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToApparentPowerExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToApparentPowerExtensions.g.cs @@ -28,21 +28,21 @@ namespace UnitsNet.NumberExtensions.NumberToApparentPower /// public static class NumberToApparentPowerExtensions { - /// - public static ApparentPower Gigavoltamperes(this T value) => - ApparentPower.FromGigavoltamperes(Convert.ToDouble(value)); + /// + public static ApparentPower Gigavoltamperes(this T value) => + ApparentPower.FromGigavoltamperes(Convert.ToDouble(value)); - /// - public static ApparentPower Kilovoltamperes(this T value) => - ApparentPower.FromKilovoltamperes(Convert.ToDouble(value)); + /// + public static ApparentPower Kilovoltamperes(this T value) => + ApparentPower.FromKilovoltamperes(Convert.ToDouble(value)); - /// - public static ApparentPower Megavoltamperes(this T value) => - ApparentPower.FromMegavoltamperes(Convert.ToDouble(value)); + /// + public static ApparentPower Megavoltamperes(this T value) => + ApparentPower.FromMegavoltamperes(Convert.ToDouble(value)); - /// - public static ApparentPower Voltamperes(this T value) => - ApparentPower.FromVoltamperes(Convert.ToDouble(value)); + /// + public static ApparentPower Voltamperes(this T value) => + ApparentPower.FromVoltamperes(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToAreaDensityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToAreaDensityExtensions.g.cs index 7a0eef6f25..68bb5e4012 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToAreaDensityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToAreaDensityExtensions.g.cs @@ -28,9 +28,9 @@ namespace UnitsNet.NumberExtensions.NumberToAreaDensity /// public static class NumberToAreaDensityExtensions { - /// - public static AreaDensity KilogramsPerSquareMeter(this T value) => - AreaDensity.FromKilogramsPerSquareMeter(Convert.ToDouble(value)); + /// + public static AreaDensity KilogramsPerSquareMeter(this T value) => + AreaDensity.FromKilogramsPerSquareMeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToAreaExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToAreaExtensions.g.cs index 7cf095da34..f0d4a4ede3 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToAreaExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToAreaExtensions.g.cs @@ -28,61 +28,61 @@ namespace UnitsNet.NumberExtensions.NumberToArea /// public static class NumberToAreaExtensions { - /// - public static Area Acres(this T value) => - Area.FromAcres(Convert.ToDouble(value)); + /// + public static Area Acres(this T value) => + Area.FromAcres(Convert.ToDouble(value)); - /// - public static Area Hectares(this T value) => - Area.FromHectares(Convert.ToDouble(value)); + /// + public static Area Hectares(this T value) => + Area.FromHectares(Convert.ToDouble(value)); - /// - public static Area SquareCentimeters(this T value) => - Area.FromSquareCentimeters(Convert.ToDouble(value)); + /// + public static Area SquareCentimeters(this T value) => + Area.FromSquareCentimeters(Convert.ToDouble(value)); - /// - public static Area SquareDecimeters(this T value) => - Area.FromSquareDecimeters(Convert.ToDouble(value)); + /// + public static Area SquareDecimeters(this T value) => + Area.FromSquareDecimeters(Convert.ToDouble(value)); - /// - public static Area SquareFeet(this T value) => - Area.FromSquareFeet(Convert.ToDouble(value)); + /// + public static Area SquareFeet(this T value) => + Area.FromSquareFeet(Convert.ToDouble(value)); - /// - public static Area SquareInches(this T value) => - Area.FromSquareInches(Convert.ToDouble(value)); + /// + public static Area SquareInches(this T value) => + Area.FromSquareInches(Convert.ToDouble(value)); - /// - public static Area SquareKilometers(this T value) => - Area.FromSquareKilometers(Convert.ToDouble(value)); + /// + public static Area SquareKilometers(this T value) => + Area.FromSquareKilometers(Convert.ToDouble(value)); - /// - public static Area SquareMeters(this T value) => - Area.FromSquareMeters(Convert.ToDouble(value)); + /// + public static Area SquareMeters(this T value) => + Area.FromSquareMeters(Convert.ToDouble(value)); - /// - public static Area SquareMicrometers(this T value) => - Area.FromSquareMicrometers(Convert.ToDouble(value)); + /// + public static Area SquareMicrometers(this T value) => + Area.FromSquareMicrometers(Convert.ToDouble(value)); - /// - public static Area SquareMiles(this T value) => - Area.FromSquareMiles(Convert.ToDouble(value)); + /// + public static Area SquareMiles(this T value) => + Area.FromSquareMiles(Convert.ToDouble(value)); - /// - public static Area SquareMillimeters(this T value) => - Area.FromSquareMillimeters(Convert.ToDouble(value)); + /// + public static Area SquareMillimeters(this T value) => + Area.FromSquareMillimeters(Convert.ToDouble(value)); - /// - public static Area SquareNauticalMiles(this T value) => - Area.FromSquareNauticalMiles(Convert.ToDouble(value)); + /// + public static Area SquareNauticalMiles(this T value) => + Area.FromSquareNauticalMiles(Convert.ToDouble(value)); - /// - public static Area SquareYards(this T value) => - Area.FromSquareYards(Convert.ToDouble(value)); + /// + public static Area SquareYards(this T value) => + Area.FromSquareYards(Convert.ToDouble(value)); - /// - public static Area UsSurveySquareFeet(this T value) => - Area.FromUsSurveySquareFeet(Convert.ToDouble(value)); + /// + public static Area UsSurveySquareFeet(this T value) => + Area.FromUsSurveySquareFeet(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToAreaMomentOfInertiaExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToAreaMomentOfInertiaExtensions.g.cs index 8b969b6019..9ec44a693d 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToAreaMomentOfInertiaExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToAreaMomentOfInertiaExtensions.g.cs @@ -28,29 +28,29 @@ namespace UnitsNet.NumberExtensions.NumberToAreaMomentOfInertia /// public static class NumberToAreaMomentOfInertiaExtensions { - /// - public static AreaMomentOfInertia CentimetersToTheFourth(this T value) => - AreaMomentOfInertia.FromCentimetersToTheFourth(Convert.ToDouble(value)); + /// + public static AreaMomentOfInertia CentimetersToTheFourth(this T value) => + AreaMomentOfInertia.FromCentimetersToTheFourth(Convert.ToDouble(value)); - /// - public static AreaMomentOfInertia DecimetersToTheFourth(this T value) => - AreaMomentOfInertia.FromDecimetersToTheFourth(Convert.ToDouble(value)); + /// + public static AreaMomentOfInertia DecimetersToTheFourth(this T value) => + AreaMomentOfInertia.FromDecimetersToTheFourth(Convert.ToDouble(value)); - /// - public static AreaMomentOfInertia FeetToTheFourth(this T value) => - AreaMomentOfInertia.FromFeetToTheFourth(Convert.ToDouble(value)); + /// + public static AreaMomentOfInertia FeetToTheFourth(this T value) => + AreaMomentOfInertia.FromFeetToTheFourth(Convert.ToDouble(value)); - /// - public static AreaMomentOfInertia InchesToTheFourth(this T value) => - AreaMomentOfInertia.FromInchesToTheFourth(Convert.ToDouble(value)); + /// + public static AreaMomentOfInertia InchesToTheFourth(this T value) => + AreaMomentOfInertia.FromInchesToTheFourth(Convert.ToDouble(value)); - /// - public static AreaMomentOfInertia MetersToTheFourth(this T value) => - AreaMomentOfInertia.FromMetersToTheFourth(Convert.ToDouble(value)); + /// + public static AreaMomentOfInertia MetersToTheFourth(this T value) => + AreaMomentOfInertia.FromMetersToTheFourth(Convert.ToDouble(value)); - /// - public static AreaMomentOfInertia MillimetersToTheFourth(this T value) => - AreaMomentOfInertia.FromMillimetersToTheFourth(Convert.ToDouble(value)); + /// + public static AreaMomentOfInertia MillimetersToTheFourth(this T value) => + AreaMomentOfInertia.FromMillimetersToTheFourth(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToBitRateExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToBitRateExtensions.g.cs index 31a893e811..f56f382182 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToBitRateExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToBitRateExtensions.g.cs @@ -28,109 +28,109 @@ namespace UnitsNet.NumberExtensions.NumberToBitRate /// public static class NumberToBitRateExtensions { - /// - public static BitRate BitsPerSecond(this T value) => - BitRate.FromBitsPerSecond(Convert.ToDouble(value)); + /// + public static BitRate BitsPerSecond(this T value) => + BitRate.FromBitsPerSecond(Convert.ToDouble(value)); - /// - public static BitRate BytesPerSecond(this T value) => - BitRate.FromBytesPerSecond(Convert.ToDouble(value)); + /// + public static BitRate BytesPerSecond(this T value) => + BitRate.FromBytesPerSecond(Convert.ToDouble(value)); - /// - public static BitRate ExabitsPerSecond(this T value) => - BitRate.FromExabitsPerSecond(Convert.ToDouble(value)); + /// + public static BitRate ExabitsPerSecond(this T value) => + BitRate.FromExabitsPerSecond(Convert.ToDouble(value)); - /// - public static BitRate ExabytesPerSecond(this T value) => - BitRate.FromExabytesPerSecond(Convert.ToDouble(value)); + /// + public static BitRate ExabytesPerSecond(this T value) => + BitRate.FromExabytesPerSecond(Convert.ToDouble(value)); - /// - public static BitRate ExbibitsPerSecond(this T value) => - BitRate.FromExbibitsPerSecond(Convert.ToDouble(value)); + /// + public static BitRate ExbibitsPerSecond(this T value) => + BitRate.FromExbibitsPerSecond(Convert.ToDouble(value)); - /// - public static BitRate ExbibytesPerSecond(this T value) => - BitRate.FromExbibytesPerSecond(Convert.ToDouble(value)); + /// + public static BitRate ExbibytesPerSecond(this T value) => + BitRate.FromExbibytesPerSecond(Convert.ToDouble(value)); - /// - public static BitRate GibibitsPerSecond(this T value) => - BitRate.FromGibibitsPerSecond(Convert.ToDouble(value)); + /// + public static BitRate GibibitsPerSecond(this T value) => + BitRate.FromGibibitsPerSecond(Convert.ToDouble(value)); - /// - public static BitRate GibibytesPerSecond(this T value) => - BitRate.FromGibibytesPerSecond(Convert.ToDouble(value)); + /// + public static BitRate GibibytesPerSecond(this T value) => + BitRate.FromGibibytesPerSecond(Convert.ToDouble(value)); - /// - public static BitRate GigabitsPerSecond(this T value) => - BitRate.FromGigabitsPerSecond(Convert.ToDouble(value)); + /// + public static BitRate GigabitsPerSecond(this T value) => + BitRate.FromGigabitsPerSecond(Convert.ToDouble(value)); - /// - public static BitRate GigabytesPerSecond(this T value) => - BitRate.FromGigabytesPerSecond(Convert.ToDouble(value)); + /// + public static BitRate GigabytesPerSecond(this T value) => + BitRate.FromGigabytesPerSecond(Convert.ToDouble(value)); - /// - public static BitRate KibibitsPerSecond(this T value) => - BitRate.FromKibibitsPerSecond(Convert.ToDouble(value)); + /// + public static BitRate KibibitsPerSecond(this T value) => + BitRate.FromKibibitsPerSecond(Convert.ToDouble(value)); - /// - public static BitRate KibibytesPerSecond(this T value) => - BitRate.FromKibibytesPerSecond(Convert.ToDouble(value)); + /// + public static BitRate KibibytesPerSecond(this T value) => + BitRate.FromKibibytesPerSecond(Convert.ToDouble(value)); - /// - public static BitRate KilobitsPerSecond(this T value) => - BitRate.FromKilobitsPerSecond(Convert.ToDouble(value)); + /// + public static BitRate KilobitsPerSecond(this T value) => + BitRate.FromKilobitsPerSecond(Convert.ToDouble(value)); - /// - public static BitRate KilobytesPerSecond(this T value) => - BitRate.FromKilobytesPerSecond(Convert.ToDouble(value)); + /// + public static BitRate KilobytesPerSecond(this T value) => + BitRate.FromKilobytesPerSecond(Convert.ToDouble(value)); - /// - public static BitRate MebibitsPerSecond(this T value) => - BitRate.FromMebibitsPerSecond(Convert.ToDouble(value)); + /// + public static BitRate MebibitsPerSecond(this T value) => + BitRate.FromMebibitsPerSecond(Convert.ToDouble(value)); - /// - public static BitRate MebibytesPerSecond(this T value) => - BitRate.FromMebibytesPerSecond(Convert.ToDouble(value)); + /// + public static BitRate MebibytesPerSecond(this T value) => + BitRate.FromMebibytesPerSecond(Convert.ToDouble(value)); - /// - public static BitRate MegabitsPerSecond(this T value) => - BitRate.FromMegabitsPerSecond(Convert.ToDouble(value)); + /// + public static BitRate MegabitsPerSecond(this T value) => + BitRate.FromMegabitsPerSecond(Convert.ToDouble(value)); - /// - public static BitRate MegabytesPerSecond(this T value) => - BitRate.FromMegabytesPerSecond(Convert.ToDouble(value)); + /// + public static BitRate MegabytesPerSecond(this T value) => + BitRate.FromMegabytesPerSecond(Convert.ToDouble(value)); - /// - public static BitRate PebibitsPerSecond(this T value) => - BitRate.FromPebibitsPerSecond(Convert.ToDouble(value)); + /// + public static BitRate PebibitsPerSecond(this T value) => + BitRate.FromPebibitsPerSecond(Convert.ToDouble(value)); - /// - public static BitRate PebibytesPerSecond(this T value) => - BitRate.FromPebibytesPerSecond(Convert.ToDouble(value)); + /// + public static BitRate PebibytesPerSecond(this T value) => + BitRate.FromPebibytesPerSecond(Convert.ToDouble(value)); - /// - public static BitRate PetabitsPerSecond(this T value) => - BitRate.FromPetabitsPerSecond(Convert.ToDouble(value)); + /// + public static BitRate PetabitsPerSecond(this T value) => + BitRate.FromPetabitsPerSecond(Convert.ToDouble(value)); - /// - public static BitRate PetabytesPerSecond(this T value) => - BitRate.FromPetabytesPerSecond(Convert.ToDouble(value)); + /// + public static BitRate PetabytesPerSecond(this T value) => + BitRate.FromPetabytesPerSecond(Convert.ToDouble(value)); - /// - public static BitRate TebibitsPerSecond(this T value) => - BitRate.FromTebibitsPerSecond(Convert.ToDouble(value)); + /// + public static BitRate TebibitsPerSecond(this T value) => + BitRate.FromTebibitsPerSecond(Convert.ToDouble(value)); - /// - public static BitRate TebibytesPerSecond(this T value) => - BitRate.FromTebibytesPerSecond(Convert.ToDouble(value)); + /// + public static BitRate TebibytesPerSecond(this T value) => + BitRate.FromTebibytesPerSecond(Convert.ToDouble(value)); - /// - public static BitRate TerabitsPerSecond(this T value) => - BitRate.FromTerabitsPerSecond(Convert.ToDouble(value)); + /// + public static BitRate TerabitsPerSecond(this T value) => + BitRate.FromTerabitsPerSecond(Convert.ToDouble(value)); - /// - public static BitRate TerabytesPerSecond(this T value) => - BitRate.FromTerabytesPerSecond(Convert.ToDouble(value)); + /// + public static BitRate TerabytesPerSecond(this T value) => + BitRate.FromTerabytesPerSecond(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToBrakeSpecificFuelConsumptionExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToBrakeSpecificFuelConsumptionExtensions.g.cs index 9f5e229d54..08b25ff880 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToBrakeSpecificFuelConsumptionExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToBrakeSpecificFuelConsumptionExtensions.g.cs @@ -28,17 +28,17 @@ namespace UnitsNet.NumberExtensions.NumberToBrakeSpecificFuelConsumption /// public static class NumberToBrakeSpecificFuelConsumptionExtensions { - /// - public static BrakeSpecificFuelConsumption GramsPerKiloWattHour(this T value) => - BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(Convert.ToDouble(value)); + /// + public static BrakeSpecificFuelConsumption GramsPerKiloWattHour(this T value) => + BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(Convert.ToDouble(value)); - /// - public static BrakeSpecificFuelConsumption KilogramsPerJoule(this T value) => - BrakeSpecificFuelConsumption.FromKilogramsPerJoule(Convert.ToDouble(value)); + /// + public static BrakeSpecificFuelConsumption KilogramsPerJoule(this T value) => + BrakeSpecificFuelConsumption.FromKilogramsPerJoule(Convert.ToDouble(value)); - /// - public static BrakeSpecificFuelConsumption PoundsPerMechanicalHorsepowerHour(this T value) => - BrakeSpecificFuelConsumption.FromPoundsPerMechanicalHorsepowerHour(Convert.ToDouble(value)); + /// + public static BrakeSpecificFuelConsumption PoundsPerMechanicalHorsepowerHour(this T value) => + BrakeSpecificFuelConsumption.FromPoundsPerMechanicalHorsepowerHour(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToCapacitanceExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToCapacitanceExtensions.g.cs index e9e5dd8c49..d266a4b0a1 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToCapacitanceExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToCapacitanceExtensions.g.cs @@ -28,33 +28,33 @@ namespace UnitsNet.NumberExtensions.NumberToCapacitance /// public static class NumberToCapacitanceExtensions { - /// - public static Capacitance Farads(this T value) => - Capacitance.FromFarads(Convert.ToDouble(value)); + /// + public static Capacitance Farads(this T value) => + Capacitance.FromFarads(Convert.ToDouble(value)); - /// - public static Capacitance Kilofarads(this T value) => - Capacitance.FromKilofarads(Convert.ToDouble(value)); + /// + public static Capacitance Kilofarads(this T value) => + Capacitance.FromKilofarads(Convert.ToDouble(value)); - /// - public static Capacitance Megafarads(this T value) => - Capacitance.FromMegafarads(Convert.ToDouble(value)); + /// + public static Capacitance Megafarads(this T value) => + Capacitance.FromMegafarads(Convert.ToDouble(value)); - /// - public static Capacitance Microfarads(this T value) => - Capacitance.FromMicrofarads(Convert.ToDouble(value)); + /// + public static Capacitance Microfarads(this T value) => + Capacitance.FromMicrofarads(Convert.ToDouble(value)); - /// - public static Capacitance Millifarads(this T value) => - Capacitance.FromMillifarads(Convert.ToDouble(value)); + /// + public static Capacitance Millifarads(this T value) => + Capacitance.FromMillifarads(Convert.ToDouble(value)); - /// - public static Capacitance Nanofarads(this T value) => - Capacitance.FromNanofarads(Convert.ToDouble(value)); + /// + public static Capacitance Nanofarads(this T value) => + Capacitance.FromNanofarads(Convert.ToDouble(value)); - /// - public static Capacitance Picofarads(this T value) => - Capacitance.FromPicofarads(Convert.ToDouble(value)); + /// + public static Capacitance Picofarads(this T value) => + Capacitance.FromPicofarads(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToCoefficientOfThermalExpansionExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToCoefficientOfThermalExpansionExtensions.g.cs index b322c0478e..143d6b6318 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToCoefficientOfThermalExpansionExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToCoefficientOfThermalExpansionExtensions.g.cs @@ -28,17 +28,17 @@ namespace UnitsNet.NumberExtensions.NumberToCoefficientOfThermalExpansion /// public static class NumberToCoefficientOfThermalExpansionExtensions { - /// - public static CoefficientOfThermalExpansion InverseDegreeCelsius(this T value) => - CoefficientOfThermalExpansion.FromInverseDegreeCelsius(Convert.ToDouble(value)); + /// + public static CoefficientOfThermalExpansion InverseDegreeCelsius(this T value) => + CoefficientOfThermalExpansion.FromInverseDegreeCelsius(Convert.ToDouble(value)); - /// - public static CoefficientOfThermalExpansion InverseDegreeFahrenheit(this T value) => - CoefficientOfThermalExpansion.FromInverseDegreeFahrenheit(Convert.ToDouble(value)); + /// + public static CoefficientOfThermalExpansion InverseDegreeFahrenheit(this T value) => + CoefficientOfThermalExpansion.FromInverseDegreeFahrenheit(Convert.ToDouble(value)); - /// - public static CoefficientOfThermalExpansion InverseKelvin(this T value) => - CoefficientOfThermalExpansion.FromInverseKelvin(Convert.ToDouble(value)); + /// + public static CoefficientOfThermalExpansion InverseKelvin(this T value) => + CoefficientOfThermalExpansion.FromInverseKelvin(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToDensityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToDensityExtensions.g.cs index 6385b7f766..881b7ca800 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToDensityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToDensityExtensions.g.cs @@ -28,165 +28,165 @@ namespace UnitsNet.NumberExtensions.NumberToDensity /// public static class NumberToDensityExtensions { - /// - public static Density CentigramsPerDeciLiter(this T value) => - Density.FromCentigramsPerDeciLiter(Convert.ToDouble(value)); + /// + public static Density CentigramsPerDeciLiter(this T value) => + Density.FromCentigramsPerDeciLiter(Convert.ToDouble(value)); - /// - public static Density CentigramsPerLiter(this T value) => - Density.FromCentigramsPerLiter(Convert.ToDouble(value)); + /// + public static Density CentigramsPerLiter(this T value) => + Density.FromCentigramsPerLiter(Convert.ToDouble(value)); - /// - public static Density CentigramsPerMilliliter(this T value) => - Density.FromCentigramsPerMilliliter(Convert.ToDouble(value)); + /// + public static Density CentigramsPerMilliliter(this T value) => + Density.FromCentigramsPerMilliliter(Convert.ToDouble(value)); - /// - public static Density DecigramsPerDeciLiter(this T value) => - Density.FromDecigramsPerDeciLiter(Convert.ToDouble(value)); + /// + public static Density DecigramsPerDeciLiter(this T value) => + Density.FromDecigramsPerDeciLiter(Convert.ToDouble(value)); - /// - public static Density DecigramsPerLiter(this T value) => - Density.FromDecigramsPerLiter(Convert.ToDouble(value)); + /// + public static Density DecigramsPerLiter(this T value) => + Density.FromDecigramsPerLiter(Convert.ToDouble(value)); - /// - public static Density DecigramsPerMilliliter(this T value) => - Density.FromDecigramsPerMilliliter(Convert.ToDouble(value)); + /// + public static Density DecigramsPerMilliliter(this T value) => + Density.FromDecigramsPerMilliliter(Convert.ToDouble(value)); - /// - public static Density GramsPerCubicCentimeter(this T value) => - Density.FromGramsPerCubicCentimeter(Convert.ToDouble(value)); + /// + public static Density GramsPerCubicCentimeter(this T value) => + Density.FromGramsPerCubicCentimeter(Convert.ToDouble(value)); - /// - public static Density GramsPerCubicMeter(this T value) => - Density.FromGramsPerCubicMeter(Convert.ToDouble(value)); + /// + public static Density GramsPerCubicMeter(this T value) => + Density.FromGramsPerCubicMeter(Convert.ToDouble(value)); - /// - public static Density GramsPerCubicMillimeter(this T value) => - Density.FromGramsPerCubicMillimeter(Convert.ToDouble(value)); + /// + public static Density GramsPerCubicMillimeter(this T value) => + Density.FromGramsPerCubicMillimeter(Convert.ToDouble(value)); - /// - public static Density GramsPerDeciLiter(this T value) => - Density.FromGramsPerDeciLiter(Convert.ToDouble(value)); + /// + public static Density GramsPerDeciLiter(this T value) => + Density.FromGramsPerDeciLiter(Convert.ToDouble(value)); - /// - public static Density GramsPerLiter(this T value) => - Density.FromGramsPerLiter(Convert.ToDouble(value)); + /// + public static Density GramsPerLiter(this T value) => + Density.FromGramsPerLiter(Convert.ToDouble(value)); - /// - public static Density GramsPerMilliliter(this T value) => - Density.FromGramsPerMilliliter(Convert.ToDouble(value)); + /// + public static Density GramsPerMilliliter(this T value) => + Density.FromGramsPerMilliliter(Convert.ToDouble(value)); - /// - public static Density KilogramsPerCubicCentimeter(this T value) => - Density.FromKilogramsPerCubicCentimeter(Convert.ToDouble(value)); + /// + public static Density KilogramsPerCubicCentimeter(this T value) => + Density.FromKilogramsPerCubicCentimeter(Convert.ToDouble(value)); - /// - public static Density KilogramsPerCubicMeter(this T value) => - Density.FromKilogramsPerCubicMeter(Convert.ToDouble(value)); + /// + public static Density KilogramsPerCubicMeter(this T value) => + Density.FromKilogramsPerCubicMeter(Convert.ToDouble(value)); - /// - public static Density KilogramsPerCubicMillimeter(this T value) => - Density.FromKilogramsPerCubicMillimeter(Convert.ToDouble(value)); + /// + public static Density KilogramsPerCubicMillimeter(this T value) => + Density.FromKilogramsPerCubicMillimeter(Convert.ToDouble(value)); - /// - public static Density KilogramsPerLiter(this T value) => - Density.FromKilogramsPerLiter(Convert.ToDouble(value)); + /// + public static Density KilogramsPerLiter(this T value) => + Density.FromKilogramsPerLiter(Convert.ToDouble(value)); - /// - public static Density KilopoundsPerCubicFoot(this T value) => - Density.FromKilopoundsPerCubicFoot(Convert.ToDouble(value)); + /// + public static Density KilopoundsPerCubicFoot(this T value) => + Density.FromKilopoundsPerCubicFoot(Convert.ToDouble(value)); - /// - public static Density KilopoundsPerCubicInch(this T value) => - Density.FromKilopoundsPerCubicInch(Convert.ToDouble(value)); + /// + public static Density KilopoundsPerCubicInch(this T value) => + Density.FromKilopoundsPerCubicInch(Convert.ToDouble(value)); - /// - public static Density MicrogramsPerCubicMeter(this T value) => - Density.FromMicrogramsPerCubicMeter(Convert.ToDouble(value)); + /// + public static Density MicrogramsPerCubicMeter(this T value) => + Density.FromMicrogramsPerCubicMeter(Convert.ToDouble(value)); - /// - public static Density MicrogramsPerDeciLiter(this T value) => - Density.FromMicrogramsPerDeciLiter(Convert.ToDouble(value)); + /// + public static Density MicrogramsPerDeciLiter(this T value) => + Density.FromMicrogramsPerDeciLiter(Convert.ToDouble(value)); - /// - public static Density MicrogramsPerLiter(this T value) => - Density.FromMicrogramsPerLiter(Convert.ToDouble(value)); + /// + public static Density MicrogramsPerLiter(this T value) => + Density.FromMicrogramsPerLiter(Convert.ToDouble(value)); - /// - public static Density MicrogramsPerMilliliter(this T value) => - Density.FromMicrogramsPerMilliliter(Convert.ToDouble(value)); + /// + public static Density MicrogramsPerMilliliter(this T value) => + Density.FromMicrogramsPerMilliliter(Convert.ToDouble(value)); - /// - public static Density MilligramsPerCubicMeter(this T value) => - Density.FromMilligramsPerCubicMeter(Convert.ToDouble(value)); + /// + public static Density MilligramsPerCubicMeter(this T value) => + Density.FromMilligramsPerCubicMeter(Convert.ToDouble(value)); - /// - public static Density MilligramsPerDeciLiter(this T value) => - Density.FromMilligramsPerDeciLiter(Convert.ToDouble(value)); + /// + public static Density MilligramsPerDeciLiter(this T value) => + Density.FromMilligramsPerDeciLiter(Convert.ToDouble(value)); - /// - public static Density MilligramsPerLiter(this T value) => - Density.FromMilligramsPerLiter(Convert.ToDouble(value)); + /// + public static Density MilligramsPerLiter(this T value) => + Density.FromMilligramsPerLiter(Convert.ToDouble(value)); - /// - public static Density MilligramsPerMilliliter(this T value) => - Density.FromMilligramsPerMilliliter(Convert.ToDouble(value)); + /// + public static Density MilligramsPerMilliliter(this T value) => + Density.FromMilligramsPerMilliliter(Convert.ToDouble(value)); - /// - public static Density NanogramsPerDeciLiter(this T value) => - Density.FromNanogramsPerDeciLiter(Convert.ToDouble(value)); + /// + public static Density NanogramsPerDeciLiter(this T value) => + Density.FromNanogramsPerDeciLiter(Convert.ToDouble(value)); - /// - public static Density NanogramsPerLiter(this T value) => - Density.FromNanogramsPerLiter(Convert.ToDouble(value)); + /// + public static Density NanogramsPerLiter(this T value) => + Density.FromNanogramsPerLiter(Convert.ToDouble(value)); - /// - public static Density NanogramsPerMilliliter(this T value) => - Density.FromNanogramsPerMilliliter(Convert.ToDouble(value)); + /// + public static Density NanogramsPerMilliliter(this T value) => + Density.FromNanogramsPerMilliliter(Convert.ToDouble(value)); - /// - public static Density PicogramsPerDeciLiter(this T value) => - Density.FromPicogramsPerDeciLiter(Convert.ToDouble(value)); + /// + public static Density PicogramsPerDeciLiter(this T value) => + Density.FromPicogramsPerDeciLiter(Convert.ToDouble(value)); - /// - public static Density PicogramsPerLiter(this T value) => - Density.FromPicogramsPerLiter(Convert.ToDouble(value)); + /// + public static Density PicogramsPerLiter(this T value) => + Density.FromPicogramsPerLiter(Convert.ToDouble(value)); - /// - public static Density PicogramsPerMilliliter(this T value) => - Density.FromPicogramsPerMilliliter(Convert.ToDouble(value)); + /// + public static Density PicogramsPerMilliliter(this T value) => + Density.FromPicogramsPerMilliliter(Convert.ToDouble(value)); - /// - public static Density PoundsPerCubicFoot(this T value) => - Density.FromPoundsPerCubicFoot(Convert.ToDouble(value)); + /// + public static Density PoundsPerCubicFoot(this T value) => + Density.FromPoundsPerCubicFoot(Convert.ToDouble(value)); - /// - public static Density PoundsPerCubicInch(this T value) => - Density.FromPoundsPerCubicInch(Convert.ToDouble(value)); + /// + public static Density PoundsPerCubicInch(this T value) => + Density.FromPoundsPerCubicInch(Convert.ToDouble(value)); - /// - public static Density PoundsPerImperialGallon(this T value) => - Density.FromPoundsPerImperialGallon(Convert.ToDouble(value)); + /// + public static Density PoundsPerImperialGallon(this T value) => + Density.FromPoundsPerImperialGallon(Convert.ToDouble(value)); - /// - public static Density PoundsPerUSGallon(this T value) => - Density.FromPoundsPerUSGallon(Convert.ToDouble(value)); + /// + public static Density PoundsPerUSGallon(this T value) => + Density.FromPoundsPerUSGallon(Convert.ToDouble(value)); - /// - public static Density SlugsPerCubicFoot(this T value) => - Density.FromSlugsPerCubicFoot(Convert.ToDouble(value)); + /// + public static Density SlugsPerCubicFoot(this T value) => + Density.FromSlugsPerCubicFoot(Convert.ToDouble(value)); - /// - public static Density TonnesPerCubicCentimeter(this T value) => - Density.FromTonnesPerCubicCentimeter(Convert.ToDouble(value)); + /// + public static Density TonnesPerCubicCentimeter(this T value) => + Density.FromTonnesPerCubicCentimeter(Convert.ToDouble(value)); - /// - public static Density TonnesPerCubicMeter(this T value) => - Density.FromTonnesPerCubicMeter(Convert.ToDouble(value)); + /// + public static Density TonnesPerCubicMeter(this T value) => + Density.FromTonnesPerCubicMeter(Convert.ToDouble(value)); - /// - public static Density TonnesPerCubicMillimeter(this T value) => - Density.FromTonnesPerCubicMillimeter(Convert.ToDouble(value)); + /// + public static Density TonnesPerCubicMillimeter(this T value) => + Density.FromTonnesPerCubicMillimeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToDurationExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToDurationExtensions.g.cs index cac5629017..fc62dd2f01 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToDurationExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToDurationExtensions.g.cs @@ -28,45 +28,45 @@ namespace UnitsNet.NumberExtensions.NumberToDuration /// public static class NumberToDurationExtensions { - /// - public static Duration Days(this T value) => - Duration.FromDays(Convert.ToDouble(value)); + /// + public static Duration Days(this T value) => + Duration.FromDays(Convert.ToDouble(value)); - /// - public static Duration Hours(this T value) => - Duration.FromHours(Convert.ToDouble(value)); + /// + public static Duration Hours(this T value) => + Duration.FromHours(Convert.ToDouble(value)); - /// - public static Duration Microseconds(this T value) => - Duration.FromMicroseconds(Convert.ToDouble(value)); + /// + public static Duration Microseconds(this T value) => + Duration.FromMicroseconds(Convert.ToDouble(value)); - /// - public static Duration Milliseconds(this T value) => - Duration.FromMilliseconds(Convert.ToDouble(value)); + /// + public static Duration Milliseconds(this T value) => + Duration.FromMilliseconds(Convert.ToDouble(value)); - /// - public static Duration Minutes(this T value) => - Duration.FromMinutes(Convert.ToDouble(value)); + /// + public static Duration Minutes(this T value) => + Duration.FromMinutes(Convert.ToDouble(value)); - /// - public static Duration Months30(this T value) => - Duration.FromMonths30(Convert.ToDouble(value)); + /// + public static Duration Months30(this T value) => + Duration.FromMonths30(Convert.ToDouble(value)); - /// - public static Duration Nanoseconds(this T value) => - Duration.FromNanoseconds(Convert.ToDouble(value)); + /// + public static Duration Nanoseconds(this T value) => + Duration.FromNanoseconds(Convert.ToDouble(value)); - /// - public static Duration Seconds(this T value) => - Duration.FromSeconds(Convert.ToDouble(value)); + /// + public static Duration Seconds(this T value) => + Duration.FromSeconds(Convert.ToDouble(value)); - /// - public static Duration Weeks(this T value) => - Duration.FromWeeks(Convert.ToDouble(value)); + /// + public static Duration Weeks(this T value) => + Duration.FromWeeks(Convert.ToDouble(value)); - /// - public static Duration Years365(this T value) => - Duration.FromYears365(Convert.ToDouble(value)); + /// + public static Duration Years365(this T value) => + Duration.FromYears365(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToDynamicViscosityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToDynamicViscosityExtensions.g.cs index 245167e3c2..3ef559dd1f 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToDynamicViscosityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToDynamicViscosityExtensions.g.cs @@ -28,45 +28,45 @@ namespace UnitsNet.NumberExtensions.NumberToDynamicViscosity /// public static class NumberToDynamicViscosityExtensions { - /// - public static DynamicViscosity Centipoise(this T value) => - DynamicViscosity.FromCentipoise(Convert.ToDouble(value)); + /// + public static DynamicViscosity Centipoise(this T value) => + DynamicViscosity.FromCentipoise(Convert.ToDouble(value)); - /// - public static DynamicViscosity MicropascalSeconds(this T value) => - DynamicViscosity.FromMicropascalSeconds(Convert.ToDouble(value)); + /// + public static DynamicViscosity MicropascalSeconds(this T value) => + DynamicViscosity.FromMicropascalSeconds(Convert.ToDouble(value)); - /// - public static DynamicViscosity MillipascalSeconds(this T value) => - DynamicViscosity.FromMillipascalSeconds(Convert.ToDouble(value)); + /// + public static DynamicViscosity MillipascalSeconds(this T value) => + DynamicViscosity.FromMillipascalSeconds(Convert.ToDouble(value)); - /// - public static DynamicViscosity NewtonSecondsPerMeterSquared(this T value) => - DynamicViscosity.FromNewtonSecondsPerMeterSquared(Convert.ToDouble(value)); + /// + public static DynamicViscosity NewtonSecondsPerMeterSquared(this T value) => + DynamicViscosity.FromNewtonSecondsPerMeterSquared(Convert.ToDouble(value)); - /// - public static DynamicViscosity PascalSeconds(this T value) => - DynamicViscosity.FromPascalSeconds(Convert.ToDouble(value)); + /// + public static DynamicViscosity PascalSeconds(this T value) => + DynamicViscosity.FromPascalSeconds(Convert.ToDouble(value)); - /// - public static DynamicViscosity Poise(this T value) => - DynamicViscosity.FromPoise(Convert.ToDouble(value)); + /// + public static DynamicViscosity Poise(this T value) => + DynamicViscosity.FromPoise(Convert.ToDouble(value)); - /// - public static DynamicViscosity PoundsForceSecondPerSquareFoot(this T value) => - DynamicViscosity.FromPoundsForceSecondPerSquareFoot(Convert.ToDouble(value)); + /// + public static DynamicViscosity PoundsForceSecondPerSquareFoot(this T value) => + DynamicViscosity.FromPoundsForceSecondPerSquareFoot(Convert.ToDouble(value)); - /// - public static DynamicViscosity PoundsForceSecondPerSquareInch(this T value) => - DynamicViscosity.FromPoundsForceSecondPerSquareInch(Convert.ToDouble(value)); + /// + public static DynamicViscosity PoundsForceSecondPerSquareInch(this T value) => + DynamicViscosity.FromPoundsForceSecondPerSquareInch(Convert.ToDouble(value)); - /// - public static DynamicViscosity PoundsPerFootSecond(this T value) => - DynamicViscosity.FromPoundsPerFootSecond(Convert.ToDouble(value)); + /// + public static DynamicViscosity PoundsPerFootSecond(this T value) => + DynamicViscosity.FromPoundsPerFootSecond(Convert.ToDouble(value)); - /// - public static DynamicViscosity Reyns(this T value) => - DynamicViscosity.FromReyns(Convert.ToDouble(value)); + /// + public static DynamicViscosity Reyns(this T value) => + DynamicViscosity.FromReyns(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricAdmittanceExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricAdmittanceExtensions.g.cs index a1ffe0522b..cd44f60ad3 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricAdmittanceExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricAdmittanceExtensions.g.cs @@ -28,21 +28,21 @@ namespace UnitsNet.NumberExtensions.NumberToElectricAdmittance /// public static class NumberToElectricAdmittanceExtensions { - /// - public static ElectricAdmittance Microsiemens(this T value) => - ElectricAdmittance.FromMicrosiemens(Convert.ToDouble(value)); + /// + public static ElectricAdmittance Microsiemens(this T value) => + ElectricAdmittance.FromMicrosiemens(Convert.ToDouble(value)); - /// - public static ElectricAdmittance Millisiemens(this T value) => - ElectricAdmittance.FromMillisiemens(Convert.ToDouble(value)); + /// + public static ElectricAdmittance Millisiemens(this T value) => + ElectricAdmittance.FromMillisiemens(Convert.ToDouble(value)); - /// - public static ElectricAdmittance Nanosiemens(this T value) => - ElectricAdmittance.FromNanosiemens(Convert.ToDouble(value)); + /// + public static ElectricAdmittance Nanosiemens(this T value) => + ElectricAdmittance.FromNanosiemens(Convert.ToDouble(value)); - /// - public static ElectricAdmittance Siemens(this T value) => - ElectricAdmittance.FromSiemens(Convert.ToDouble(value)); + /// + public static ElectricAdmittance Siemens(this T value) => + ElectricAdmittance.FromSiemens(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricChargeDensityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricChargeDensityExtensions.g.cs index c0b341cb5d..d2b00d1df8 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricChargeDensityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricChargeDensityExtensions.g.cs @@ -28,9 +28,9 @@ namespace UnitsNet.NumberExtensions.NumberToElectricChargeDensity /// public static class NumberToElectricChargeDensityExtensions { - /// - public static ElectricChargeDensity CoulombsPerCubicMeter(this T value) => - ElectricChargeDensity.FromCoulombsPerCubicMeter(Convert.ToDouble(value)); + /// + public static ElectricChargeDensity CoulombsPerCubicMeter(this T value) => + ElectricChargeDensity.FromCoulombsPerCubicMeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricChargeExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricChargeExtensions.g.cs index a11430480d..628a620fe0 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricChargeExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricChargeExtensions.g.cs @@ -28,25 +28,25 @@ namespace UnitsNet.NumberExtensions.NumberToElectricCharge /// public static class NumberToElectricChargeExtensions { - /// - public static ElectricCharge AmpereHours(this T value) => - ElectricCharge.FromAmpereHours(Convert.ToDouble(value)); + /// + public static ElectricCharge AmpereHours(this T value) => + ElectricCharge.FromAmpereHours(Convert.ToDouble(value)); - /// - public static ElectricCharge Coulombs(this T value) => - ElectricCharge.FromCoulombs(Convert.ToDouble(value)); + /// + public static ElectricCharge Coulombs(this T value) => + ElectricCharge.FromCoulombs(Convert.ToDouble(value)); - /// - public static ElectricCharge KiloampereHours(this T value) => - ElectricCharge.FromKiloampereHours(Convert.ToDouble(value)); + /// + public static ElectricCharge KiloampereHours(this T value) => + ElectricCharge.FromKiloampereHours(Convert.ToDouble(value)); - /// - public static ElectricCharge MegaampereHours(this T value) => - ElectricCharge.FromMegaampereHours(Convert.ToDouble(value)); + /// + public static ElectricCharge MegaampereHours(this T value) => + ElectricCharge.FromMegaampereHours(Convert.ToDouble(value)); - /// - public static ElectricCharge MilliampereHours(this T value) => - ElectricCharge.FromMilliampereHours(Convert.ToDouble(value)); + /// + public static ElectricCharge MilliampereHours(this T value) => + ElectricCharge.FromMilliampereHours(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricConductanceExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricConductanceExtensions.g.cs index 19e68d6a04..0e327b94e6 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricConductanceExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricConductanceExtensions.g.cs @@ -28,17 +28,17 @@ namespace UnitsNet.NumberExtensions.NumberToElectricConductance /// public static class NumberToElectricConductanceExtensions { - /// - public static ElectricConductance Microsiemens(this T value) => - ElectricConductance.FromMicrosiemens(Convert.ToDouble(value)); + /// + public static ElectricConductance Microsiemens(this T value) => + ElectricConductance.FromMicrosiemens(Convert.ToDouble(value)); - /// - public static ElectricConductance Millisiemens(this T value) => - ElectricConductance.FromMillisiemens(Convert.ToDouble(value)); + /// + public static ElectricConductance Millisiemens(this T value) => + ElectricConductance.FromMillisiemens(Convert.ToDouble(value)); - /// - public static ElectricConductance Siemens(this T value) => - ElectricConductance.FromSiemens(Convert.ToDouble(value)); + /// + public static ElectricConductance Siemens(this T value) => + ElectricConductance.FromSiemens(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricConductivityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricConductivityExtensions.g.cs index 01f045f4bd..0f33def1fe 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricConductivityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricConductivityExtensions.g.cs @@ -28,17 +28,17 @@ namespace UnitsNet.NumberExtensions.NumberToElectricConductivity /// public static class NumberToElectricConductivityExtensions { - /// - public static ElectricConductivity SiemensPerFoot(this T value) => - ElectricConductivity.FromSiemensPerFoot(Convert.ToDouble(value)); + /// + public static ElectricConductivity SiemensPerFoot(this T value) => + ElectricConductivity.FromSiemensPerFoot(Convert.ToDouble(value)); - /// - public static ElectricConductivity SiemensPerInch(this T value) => - ElectricConductivity.FromSiemensPerInch(Convert.ToDouble(value)); + /// + public static ElectricConductivity SiemensPerInch(this T value) => + ElectricConductivity.FromSiemensPerInch(Convert.ToDouble(value)); - /// - public static ElectricConductivity SiemensPerMeter(this T value) => - ElectricConductivity.FromSiemensPerMeter(Convert.ToDouble(value)); + /// + public static ElectricConductivity SiemensPerMeter(this T value) => + ElectricConductivity.FromSiemensPerMeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricCurrentDensityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricCurrentDensityExtensions.g.cs index ac6b7ad918..8f96dc4c1d 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricCurrentDensityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricCurrentDensityExtensions.g.cs @@ -28,17 +28,17 @@ namespace UnitsNet.NumberExtensions.NumberToElectricCurrentDensity /// public static class NumberToElectricCurrentDensityExtensions { - /// - public static ElectricCurrentDensity AmperesPerSquareFoot(this T value) => - ElectricCurrentDensity.FromAmperesPerSquareFoot(Convert.ToDouble(value)); + /// + public static ElectricCurrentDensity AmperesPerSquareFoot(this T value) => + ElectricCurrentDensity.FromAmperesPerSquareFoot(Convert.ToDouble(value)); - /// - public static ElectricCurrentDensity AmperesPerSquareInch(this T value) => - ElectricCurrentDensity.FromAmperesPerSquareInch(Convert.ToDouble(value)); + /// + public static ElectricCurrentDensity AmperesPerSquareInch(this T value) => + ElectricCurrentDensity.FromAmperesPerSquareInch(Convert.ToDouble(value)); - /// - public static ElectricCurrentDensity AmperesPerSquareMeter(this T value) => - ElectricCurrentDensity.FromAmperesPerSquareMeter(Convert.ToDouble(value)); + /// + public static ElectricCurrentDensity AmperesPerSquareMeter(this T value) => + ElectricCurrentDensity.FromAmperesPerSquareMeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricCurrentExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricCurrentExtensions.g.cs index 0cdd105a1a..955f20d112 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricCurrentExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricCurrentExtensions.g.cs @@ -28,37 +28,37 @@ namespace UnitsNet.NumberExtensions.NumberToElectricCurrent /// public static class NumberToElectricCurrentExtensions { - /// - public static ElectricCurrent Amperes(this T value) => - ElectricCurrent.FromAmperes(Convert.ToDouble(value)); + /// + public static ElectricCurrent Amperes(this T value) => + ElectricCurrent.FromAmperes(Convert.ToDouble(value)); - /// - public static ElectricCurrent Centiamperes(this T value) => - ElectricCurrent.FromCentiamperes(Convert.ToDouble(value)); + /// + public static ElectricCurrent Centiamperes(this T value) => + ElectricCurrent.FromCentiamperes(Convert.ToDouble(value)); - /// - public static ElectricCurrent Kiloamperes(this T value) => - ElectricCurrent.FromKiloamperes(Convert.ToDouble(value)); + /// + public static ElectricCurrent Kiloamperes(this T value) => + ElectricCurrent.FromKiloamperes(Convert.ToDouble(value)); - /// - public static ElectricCurrent Megaamperes(this T value) => - ElectricCurrent.FromMegaamperes(Convert.ToDouble(value)); + /// + public static ElectricCurrent Megaamperes(this T value) => + ElectricCurrent.FromMegaamperes(Convert.ToDouble(value)); - /// - public static ElectricCurrent Microamperes(this T value) => - ElectricCurrent.FromMicroamperes(Convert.ToDouble(value)); + /// + public static ElectricCurrent Microamperes(this T value) => + ElectricCurrent.FromMicroamperes(Convert.ToDouble(value)); - /// - public static ElectricCurrent Milliamperes(this T value) => - ElectricCurrent.FromMilliamperes(Convert.ToDouble(value)); + /// + public static ElectricCurrent Milliamperes(this T value) => + ElectricCurrent.FromMilliamperes(Convert.ToDouble(value)); - /// - public static ElectricCurrent Nanoamperes(this T value) => - ElectricCurrent.FromNanoamperes(Convert.ToDouble(value)); + /// + public static ElectricCurrent Nanoamperes(this T value) => + ElectricCurrent.FromNanoamperes(Convert.ToDouble(value)); - /// - public static ElectricCurrent Picoamperes(this T value) => - ElectricCurrent.FromPicoamperes(Convert.ToDouble(value)); + /// + public static ElectricCurrent Picoamperes(this T value) => + ElectricCurrent.FromPicoamperes(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricCurrentGradientExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricCurrentGradientExtensions.g.cs index 3127d6707b..689ed93fb4 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricCurrentGradientExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricCurrentGradientExtensions.g.cs @@ -28,21 +28,21 @@ namespace UnitsNet.NumberExtensions.NumberToElectricCurrentGradient /// public static class NumberToElectricCurrentGradientExtensions { - /// - public static ElectricCurrentGradient AmperesPerMicrosecond(this T value) => - ElectricCurrentGradient.FromAmperesPerMicrosecond(Convert.ToDouble(value)); + /// + public static ElectricCurrentGradient AmperesPerMicrosecond(this T value) => + ElectricCurrentGradient.FromAmperesPerMicrosecond(Convert.ToDouble(value)); - /// - public static ElectricCurrentGradient AmperesPerMillisecond(this T value) => - ElectricCurrentGradient.FromAmperesPerMillisecond(Convert.ToDouble(value)); + /// + public static ElectricCurrentGradient AmperesPerMillisecond(this T value) => + ElectricCurrentGradient.FromAmperesPerMillisecond(Convert.ToDouble(value)); - /// - public static ElectricCurrentGradient AmperesPerNanosecond(this T value) => - ElectricCurrentGradient.FromAmperesPerNanosecond(Convert.ToDouble(value)); + /// + public static ElectricCurrentGradient AmperesPerNanosecond(this T value) => + ElectricCurrentGradient.FromAmperesPerNanosecond(Convert.ToDouble(value)); - /// - public static ElectricCurrentGradient AmperesPerSecond(this T value) => - ElectricCurrentGradient.FromAmperesPerSecond(Convert.ToDouble(value)); + /// + public static ElectricCurrentGradient AmperesPerSecond(this T value) => + ElectricCurrentGradient.FromAmperesPerSecond(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricFieldExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricFieldExtensions.g.cs index 3e7ca73ec7..f9d2225018 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricFieldExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricFieldExtensions.g.cs @@ -28,9 +28,9 @@ namespace UnitsNet.NumberExtensions.NumberToElectricField /// public static class NumberToElectricFieldExtensions { - /// - public static ElectricField VoltsPerMeter(this T value) => - ElectricField.FromVoltsPerMeter(Convert.ToDouble(value)); + /// + public static ElectricField VoltsPerMeter(this T value) => + ElectricField.FromVoltsPerMeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricInductanceExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricInductanceExtensions.g.cs index e376d6fe9b..ad6d068c63 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricInductanceExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricInductanceExtensions.g.cs @@ -28,21 +28,21 @@ namespace UnitsNet.NumberExtensions.NumberToElectricInductance /// public static class NumberToElectricInductanceExtensions { - /// - public static ElectricInductance Henries(this T value) => - ElectricInductance.FromHenries(Convert.ToDouble(value)); + /// + public static ElectricInductance Henries(this T value) => + ElectricInductance.FromHenries(Convert.ToDouble(value)); - /// - public static ElectricInductance Microhenries(this T value) => - ElectricInductance.FromMicrohenries(Convert.ToDouble(value)); + /// + public static ElectricInductance Microhenries(this T value) => + ElectricInductance.FromMicrohenries(Convert.ToDouble(value)); - /// - public static ElectricInductance Millihenries(this T value) => - ElectricInductance.FromMillihenries(Convert.ToDouble(value)); + /// + public static ElectricInductance Millihenries(this T value) => + ElectricInductance.FromMillihenries(Convert.ToDouble(value)); - /// - public static ElectricInductance Nanohenries(this T value) => - ElectricInductance.FromNanohenries(Convert.ToDouble(value)); + /// + public static ElectricInductance Nanohenries(this T value) => + ElectricInductance.FromNanohenries(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialAcExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialAcExtensions.g.cs index a208716732..06185ad6f0 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialAcExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialAcExtensions.g.cs @@ -28,25 +28,25 @@ namespace UnitsNet.NumberExtensions.NumberToElectricPotentialAc /// public static class NumberToElectricPotentialAcExtensions { - /// - public static ElectricPotentialAc KilovoltsAc(this T value) => - ElectricPotentialAc.FromKilovoltsAc(Convert.ToDouble(value)); + /// + public static ElectricPotentialAc KilovoltsAc(this T value) => + ElectricPotentialAc.FromKilovoltsAc(Convert.ToDouble(value)); - /// - public static ElectricPotentialAc MegavoltsAc(this T value) => - ElectricPotentialAc.FromMegavoltsAc(Convert.ToDouble(value)); + /// + public static ElectricPotentialAc MegavoltsAc(this T value) => + ElectricPotentialAc.FromMegavoltsAc(Convert.ToDouble(value)); - /// - public static ElectricPotentialAc MicrovoltsAc(this T value) => - ElectricPotentialAc.FromMicrovoltsAc(Convert.ToDouble(value)); + /// + public static ElectricPotentialAc MicrovoltsAc(this T value) => + ElectricPotentialAc.FromMicrovoltsAc(Convert.ToDouble(value)); - /// - public static ElectricPotentialAc MillivoltsAc(this T value) => - ElectricPotentialAc.FromMillivoltsAc(Convert.ToDouble(value)); + /// + public static ElectricPotentialAc MillivoltsAc(this T value) => + ElectricPotentialAc.FromMillivoltsAc(Convert.ToDouble(value)); - /// - public static ElectricPotentialAc VoltsAc(this T value) => - ElectricPotentialAc.FromVoltsAc(Convert.ToDouble(value)); + /// + public static ElectricPotentialAc VoltsAc(this T value) => + ElectricPotentialAc.FromVoltsAc(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialChangeRateExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialChangeRateExtensions.g.cs index 1490787c3d..dc4f355c21 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialChangeRateExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialChangeRateExtensions.g.cs @@ -28,85 +28,85 @@ namespace UnitsNet.NumberExtensions.NumberToElectricPotentialChangeRate /// public static class NumberToElectricPotentialChangeRateExtensions { - /// - public static ElectricPotentialChangeRate KilovoltsPerHours(this T value) => - ElectricPotentialChangeRate.FromKilovoltsPerHours(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate KilovoltsPerHours(this T value) => + ElectricPotentialChangeRate.FromKilovoltsPerHours(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate KilovoltsPerMicroseconds(this T value) => - ElectricPotentialChangeRate.FromKilovoltsPerMicroseconds(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate KilovoltsPerMicroseconds(this T value) => + ElectricPotentialChangeRate.FromKilovoltsPerMicroseconds(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate KilovoltsPerMinutes(this T value) => - ElectricPotentialChangeRate.FromKilovoltsPerMinutes(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate KilovoltsPerMinutes(this T value) => + ElectricPotentialChangeRate.FromKilovoltsPerMinutes(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate KilovoltsPerSeconds(this T value) => - ElectricPotentialChangeRate.FromKilovoltsPerSeconds(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate KilovoltsPerSeconds(this T value) => + ElectricPotentialChangeRate.FromKilovoltsPerSeconds(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MegavoltsPerHours(this T value) => - ElectricPotentialChangeRate.FromMegavoltsPerHours(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate MegavoltsPerHours(this T value) => + ElectricPotentialChangeRate.FromMegavoltsPerHours(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MegavoltsPerMicroseconds(this T value) => - ElectricPotentialChangeRate.FromMegavoltsPerMicroseconds(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate MegavoltsPerMicroseconds(this T value) => + ElectricPotentialChangeRate.FromMegavoltsPerMicroseconds(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MegavoltsPerMinutes(this T value) => - ElectricPotentialChangeRate.FromMegavoltsPerMinutes(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate MegavoltsPerMinutes(this T value) => + ElectricPotentialChangeRate.FromMegavoltsPerMinutes(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MegavoltsPerSeconds(this T value) => - ElectricPotentialChangeRate.FromMegavoltsPerSeconds(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate MegavoltsPerSeconds(this T value) => + ElectricPotentialChangeRate.FromMegavoltsPerSeconds(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MicrovoltsPerHours(this T value) => - ElectricPotentialChangeRate.FromMicrovoltsPerHours(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate MicrovoltsPerHours(this T value) => + ElectricPotentialChangeRate.FromMicrovoltsPerHours(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MicrovoltsPerMicroseconds(this T value) => - ElectricPotentialChangeRate.FromMicrovoltsPerMicroseconds(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate MicrovoltsPerMicroseconds(this T value) => + ElectricPotentialChangeRate.FromMicrovoltsPerMicroseconds(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MicrovoltsPerMinutes(this T value) => - ElectricPotentialChangeRate.FromMicrovoltsPerMinutes(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate MicrovoltsPerMinutes(this T value) => + ElectricPotentialChangeRate.FromMicrovoltsPerMinutes(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MicrovoltsPerSeconds(this T value) => - ElectricPotentialChangeRate.FromMicrovoltsPerSeconds(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate MicrovoltsPerSeconds(this T value) => + ElectricPotentialChangeRate.FromMicrovoltsPerSeconds(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MillivoltsPerHours(this T value) => - ElectricPotentialChangeRate.FromMillivoltsPerHours(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate MillivoltsPerHours(this T value) => + ElectricPotentialChangeRate.FromMillivoltsPerHours(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MillivoltsPerMicroseconds(this T value) => - ElectricPotentialChangeRate.FromMillivoltsPerMicroseconds(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate MillivoltsPerMicroseconds(this T value) => + ElectricPotentialChangeRate.FromMillivoltsPerMicroseconds(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MillivoltsPerMinutes(this T value) => - ElectricPotentialChangeRate.FromMillivoltsPerMinutes(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate MillivoltsPerMinutes(this T value) => + ElectricPotentialChangeRate.FromMillivoltsPerMinutes(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MillivoltsPerSeconds(this T value) => - ElectricPotentialChangeRate.FromMillivoltsPerSeconds(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate MillivoltsPerSeconds(this T value) => + ElectricPotentialChangeRate.FromMillivoltsPerSeconds(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate VoltsPerHours(this T value) => - ElectricPotentialChangeRate.FromVoltsPerHours(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate VoltsPerHours(this T value) => + ElectricPotentialChangeRate.FromVoltsPerHours(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate VoltsPerMicroseconds(this T value) => - ElectricPotentialChangeRate.FromVoltsPerMicroseconds(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate VoltsPerMicroseconds(this T value) => + ElectricPotentialChangeRate.FromVoltsPerMicroseconds(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate VoltsPerMinutes(this T value) => - ElectricPotentialChangeRate.FromVoltsPerMinutes(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate VoltsPerMinutes(this T value) => + ElectricPotentialChangeRate.FromVoltsPerMinutes(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate VoltsPerSeconds(this T value) => - ElectricPotentialChangeRate.FromVoltsPerSeconds(Convert.ToDouble(value)); + /// + public static ElectricPotentialChangeRate VoltsPerSeconds(this T value) => + ElectricPotentialChangeRate.FromVoltsPerSeconds(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialDcExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialDcExtensions.g.cs index 25bb0d3375..7c3d6f0319 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialDcExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialDcExtensions.g.cs @@ -28,25 +28,25 @@ namespace UnitsNet.NumberExtensions.NumberToElectricPotentialDc /// public static class NumberToElectricPotentialDcExtensions { - /// - public static ElectricPotentialDc KilovoltsDc(this T value) => - ElectricPotentialDc.FromKilovoltsDc(Convert.ToDouble(value)); + /// + public static ElectricPotentialDc KilovoltsDc(this T value) => + ElectricPotentialDc.FromKilovoltsDc(Convert.ToDouble(value)); - /// - public static ElectricPotentialDc MegavoltsDc(this T value) => - ElectricPotentialDc.FromMegavoltsDc(Convert.ToDouble(value)); + /// + public static ElectricPotentialDc MegavoltsDc(this T value) => + ElectricPotentialDc.FromMegavoltsDc(Convert.ToDouble(value)); - /// - public static ElectricPotentialDc MicrovoltsDc(this T value) => - ElectricPotentialDc.FromMicrovoltsDc(Convert.ToDouble(value)); + /// + public static ElectricPotentialDc MicrovoltsDc(this T value) => + ElectricPotentialDc.FromMicrovoltsDc(Convert.ToDouble(value)); - /// - public static ElectricPotentialDc MillivoltsDc(this T value) => - ElectricPotentialDc.FromMillivoltsDc(Convert.ToDouble(value)); + /// + public static ElectricPotentialDc MillivoltsDc(this T value) => + ElectricPotentialDc.FromMillivoltsDc(Convert.ToDouble(value)); - /// - public static ElectricPotentialDc VoltsDc(this T value) => - ElectricPotentialDc.FromVoltsDc(Convert.ToDouble(value)); + /// + public static ElectricPotentialDc VoltsDc(this T value) => + ElectricPotentialDc.FromVoltsDc(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialExtensions.g.cs index 9c1e477a24..ca0f1761f6 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialExtensions.g.cs @@ -28,25 +28,25 @@ namespace UnitsNet.NumberExtensions.NumberToElectricPotential /// public static class NumberToElectricPotentialExtensions { - /// - public static ElectricPotential Kilovolts(this T value) => - ElectricPotential.FromKilovolts(Convert.ToDouble(value)); + /// + public static ElectricPotential Kilovolts(this T value) => + ElectricPotential.FromKilovolts(Convert.ToDouble(value)); - /// - public static ElectricPotential Megavolts(this T value) => - ElectricPotential.FromMegavolts(Convert.ToDouble(value)); + /// + public static ElectricPotential Megavolts(this T value) => + ElectricPotential.FromMegavolts(Convert.ToDouble(value)); - /// - public static ElectricPotential Microvolts(this T value) => - ElectricPotential.FromMicrovolts(Convert.ToDouble(value)); + /// + public static ElectricPotential Microvolts(this T value) => + ElectricPotential.FromMicrovolts(Convert.ToDouble(value)); - /// - public static ElectricPotential Millivolts(this T value) => - ElectricPotential.FromMillivolts(Convert.ToDouble(value)); + /// + public static ElectricPotential Millivolts(this T value) => + ElectricPotential.FromMillivolts(Convert.ToDouble(value)); - /// - public static ElectricPotential Volts(this T value) => - ElectricPotential.FromVolts(Convert.ToDouble(value)); + /// + public static ElectricPotential Volts(this T value) => + ElectricPotential.FromVolts(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricResistanceExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricResistanceExtensions.g.cs index ba32c38726..4be60818e2 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricResistanceExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricResistanceExtensions.g.cs @@ -28,29 +28,29 @@ namespace UnitsNet.NumberExtensions.NumberToElectricResistance /// public static class NumberToElectricResistanceExtensions { - /// - public static ElectricResistance Gigaohms(this T value) => - ElectricResistance.FromGigaohms(Convert.ToDouble(value)); + /// + public static ElectricResistance Gigaohms(this T value) => + ElectricResistance.FromGigaohms(Convert.ToDouble(value)); - /// - public static ElectricResistance Kiloohms(this T value) => - ElectricResistance.FromKiloohms(Convert.ToDouble(value)); + /// + public static ElectricResistance Kiloohms(this T value) => + ElectricResistance.FromKiloohms(Convert.ToDouble(value)); - /// - public static ElectricResistance Megaohms(this T value) => - ElectricResistance.FromMegaohms(Convert.ToDouble(value)); + /// + public static ElectricResistance Megaohms(this T value) => + ElectricResistance.FromMegaohms(Convert.ToDouble(value)); - /// - public static ElectricResistance Microohms(this T value) => - ElectricResistance.FromMicroohms(Convert.ToDouble(value)); + /// + public static ElectricResistance Microohms(this T value) => + ElectricResistance.FromMicroohms(Convert.ToDouble(value)); - /// - public static ElectricResistance Milliohms(this T value) => - ElectricResistance.FromMilliohms(Convert.ToDouble(value)); + /// + public static ElectricResistance Milliohms(this T value) => + ElectricResistance.FromMilliohms(Convert.ToDouble(value)); - /// - public static ElectricResistance Ohms(this T value) => - ElectricResistance.FromOhms(Convert.ToDouble(value)); + /// + public static ElectricResistance Ohms(this T value) => + ElectricResistance.FromOhms(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricResistivityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricResistivityExtensions.g.cs index ceba3142bb..59d956b904 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricResistivityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricResistivityExtensions.g.cs @@ -28,61 +28,61 @@ namespace UnitsNet.NumberExtensions.NumberToElectricResistivity /// public static class NumberToElectricResistivityExtensions { - /// - public static ElectricResistivity KiloohmsCentimeter(this T value) => - ElectricResistivity.FromKiloohmsCentimeter(Convert.ToDouble(value)); + /// + public static ElectricResistivity KiloohmsCentimeter(this T value) => + ElectricResistivity.FromKiloohmsCentimeter(Convert.ToDouble(value)); - /// - public static ElectricResistivity KiloohmMeters(this T value) => - ElectricResistivity.FromKiloohmMeters(Convert.ToDouble(value)); + /// + public static ElectricResistivity KiloohmMeters(this T value) => + ElectricResistivity.FromKiloohmMeters(Convert.ToDouble(value)); - /// - public static ElectricResistivity MegaohmsCentimeter(this T value) => - ElectricResistivity.FromMegaohmsCentimeter(Convert.ToDouble(value)); + /// + public static ElectricResistivity MegaohmsCentimeter(this T value) => + ElectricResistivity.FromMegaohmsCentimeter(Convert.ToDouble(value)); - /// - public static ElectricResistivity MegaohmMeters(this T value) => - ElectricResistivity.FromMegaohmMeters(Convert.ToDouble(value)); + /// + public static ElectricResistivity MegaohmMeters(this T value) => + ElectricResistivity.FromMegaohmMeters(Convert.ToDouble(value)); - /// - public static ElectricResistivity MicroohmsCentimeter(this T value) => - ElectricResistivity.FromMicroohmsCentimeter(Convert.ToDouble(value)); + /// + public static ElectricResistivity MicroohmsCentimeter(this T value) => + ElectricResistivity.FromMicroohmsCentimeter(Convert.ToDouble(value)); - /// - public static ElectricResistivity MicroohmMeters(this T value) => - ElectricResistivity.FromMicroohmMeters(Convert.ToDouble(value)); + /// + public static ElectricResistivity MicroohmMeters(this T value) => + ElectricResistivity.FromMicroohmMeters(Convert.ToDouble(value)); - /// - public static ElectricResistivity MilliohmsCentimeter(this T value) => - ElectricResistivity.FromMilliohmsCentimeter(Convert.ToDouble(value)); + /// + public static ElectricResistivity MilliohmsCentimeter(this T value) => + ElectricResistivity.FromMilliohmsCentimeter(Convert.ToDouble(value)); - /// - public static ElectricResistivity MilliohmMeters(this T value) => - ElectricResistivity.FromMilliohmMeters(Convert.ToDouble(value)); + /// + public static ElectricResistivity MilliohmMeters(this T value) => + ElectricResistivity.FromMilliohmMeters(Convert.ToDouble(value)); - /// - public static ElectricResistivity NanoohmsCentimeter(this T value) => - ElectricResistivity.FromNanoohmsCentimeter(Convert.ToDouble(value)); + /// + public static ElectricResistivity NanoohmsCentimeter(this T value) => + ElectricResistivity.FromNanoohmsCentimeter(Convert.ToDouble(value)); - /// - public static ElectricResistivity NanoohmMeters(this T value) => - ElectricResistivity.FromNanoohmMeters(Convert.ToDouble(value)); + /// + public static ElectricResistivity NanoohmMeters(this T value) => + ElectricResistivity.FromNanoohmMeters(Convert.ToDouble(value)); - /// - public static ElectricResistivity OhmsCentimeter(this T value) => - ElectricResistivity.FromOhmsCentimeter(Convert.ToDouble(value)); + /// + public static ElectricResistivity OhmsCentimeter(this T value) => + ElectricResistivity.FromOhmsCentimeter(Convert.ToDouble(value)); - /// - public static ElectricResistivity OhmMeters(this T value) => - ElectricResistivity.FromOhmMeters(Convert.ToDouble(value)); + /// + public static ElectricResistivity OhmMeters(this T value) => + ElectricResistivity.FromOhmMeters(Convert.ToDouble(value)); - /// - public static ElectricResistivity PicoohmsCentimeter(this T value) => - ElectricResistivity.FromPicoohmsCentimeter(Convert.ToDouble(value)); + /// + public static ElectricResistivity PicoohmsCentimeter(this T value) => + ElectricResistivity.FromPicoohmsCentimeter(Convert.ToDouble(value)); - /// - public static ElectricResistivity PicoohmMeters(this T value) => - ElectricResistivity.FromPicoohmMeters(Convert.ToDouble(value)); + /// + public static ElectricResistivity PicoohmMeters(this T value) => + ElectricResistivity.FromPicoohmMeters(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricSurfaceChargeDensityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricSurfaceChargeDensityExtensions.g.cs index 32ee1c1576..6c389f40c1 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricSurfaceChargeDensityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricSurfaceChargeDensityExtensions.g.cs @@ -28,17 +28,17 @@ namespace UnitsNet.NumberExtensions.NumberToElectricSurfaceChargeDensity /// public static class NumberToElectricSurfaceChargeDensityExtensions { - /// - public static ElectricSurfaceChargeDensity CoulombsPerSquareCentimeter(this T value) => - ElectricSurfaceChargeDensity.FromCoulombsPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static ElectricSurfaceChargeDensity CoulombsPerSquareCentimeter(this T value) => + ElectricSurfaceChargeDensity.FromCoulombsPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static ElectricSurfaceChargeDensity CoulombsPerSquareInch(this T value) => - ElectricSurfaceChargeDensity.FromCoulombsPerSquareInch(Convert.ToDouble(value)); + /// + public static ElectricSurfaceChargeDensity CoulombsPerSquareInch(this T value) => + ElectricSurfaceChargeDensity.FromCoulombsPerSquareInch(Convert.ToDouble(value)); - /// - public static ElectricSurfaceChargeDensity CoulombsPerSquareMeter(this T value) => - ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(Convert.ToDouble(value)); + /// + public static ElectricSurfaceChargeDensity CoulombsPerSquareMeter(this T value) => + ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToEnergyExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToEnergyExtensions.g.cs index 1b30087cf6..6c34314a56 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToEnergyExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToEnergyExtensions.g.cs @@ -28,149 +28,149 @@ namespace UnitsNet.NumberExtensions.NumberToEnergy /// public static class NumberToEnergyExtensions { - /// - public static Energy BritishThermalUnits(this T value) => - Energy.FromBritishThermalUnits(Convert.ToDouble(value)); + /// + public static Energy BritishThermalUnits(this T value) => + Energy.FromBritishThermalUnits(Convert.ToDouble(value)); - /// - public static Energy Calories(this T value) => - Energy.FromCalories(Convert.ToDouble(value)); + /// + public static Energy Calories(this T value) => + Energy.FromCalories(Convert.ToDouble(value)); - /// - public static Energy DecathermsEc(this T value) => - Energy.FromDecathermsEc(Convert.ToDouble(value)); + /// + public static Energy DecathermsEc(this T value) => + Energy.FromDecathermsEc(Convert.ToDouble(value)); - /// - public static Energy DecathermsImperial(this T value) => - Energy.FromDecathermsImperial(Convert.ToDouble(value)); + /// + public static Energy DecathermsImperial(this T value) => + Energy.FromDecathermsImperial(Convert.ToDouble(value)); - /// - public static Energy DecathermsUs(this T value) => - Energy.FromDecathermsUs(Convert.ToDouble(value)); + /// + public static Energy DecathermsUs(this T value) => + Energy.FromDecathermsUs(Convert.ToDouble(value)); - /// - public static Energy ElectronVolts(this T value) => - Energy.FromElectronVolts(Convert.ToDouble(value)); + /// + public static Energy ElectronVolts(this T value) => + Energy.FromElectronVolts(Convert.ToDouble(value)); - /// - public static Energy Ergs(this T value) => - Energy.FromErgs(Convert.ToDouble(value)); + /// + public static Energy Ergs(this T value) => + Energy.FromErgs(Convert.ToDouble(value)); - /// - public static Energy FootPounds(this T value) => - Energy.FromFootPounds(Convert.ToDouble(value)); + /// + public static Energy FootPounds(this T value) => + Energy.FromFootPounds(Convert.ToDouble(value)); - /// - public static Energy GigabritishThermalUnits(this T value) => - Energy.FromGigabritishThermalUnits(Convert.ToDouble(value)); + /// + public static Energy GigabritishThermalUnits(this T value) => + Energy.FromGigabritishThermalUnits(Convert.ToDouble(value)); - /// - public static Energy GigaelectronVolts(this T value) => - Energy.FromGigaelectronVolts(Convert.ToDouble(value)); + /// + public static Energy GigaelectronVolts(this T value) => + Energy.FromGigaelectronVolts(Convert.ToDouble(value)); - /// - public static Energy Gigajoules(this T value) => - Energy.FromGigajoules(Convert.ToDouble(value)); + /// + public static Energy Gigajoules(this T value) => + Energy.FromGigajoules(Convert.ToDouble(value)); - /// - public static Energy GigawattDays(this T value) => - Energy.FromGigawattDays(Convert.ToDouble(value)); + /// + public static Energy GigawattDays(this T value) => + Energy.FromGigawattDays(Convert.ToDouble(value)); - /// - public static Energy GigawattHours(this T value) => - Energy.FromGigawattHours(Convert.ToDouble(value)); + /// + public static Energy GigawattHours(this T value) => + Energy.FromGigawattHours(Convert.ToDouble(value)); - /// - public static Energy HorsepowerHours(this T value) => - Energy.FromHorsepowerHours(Convert.ToDouble(value)); + /// + public static Energy HorsepowerHours(this T value) => + Energy.FromHorsepowerHours(Convert.ToDouble(value)); - /// - public static Energy Joules(this T value) => - Energy.FromJoules(Convert.ToDouble(value)); + /// + public static Energy Joules(this T value) => + Energy.FromJoules(Convert.ToDouble(value)); - /// - public static Energy KilobritishThermalUnits(this T value) => - Energy.FromKilobritishThermalUnits(Convert.ToDouble(value)); + /// + public static Energy KilobritishThermalUnits(this T value) => + Energy.FromKilobritishThermalUnits(Convert.ToDouble(value)); - /// - public static Energy Kilocalories(this T value) => - Energy.FromKilocalories(Convert.ToDouble(value)); + /// + public static Energy Kilocalories(this T value) => + Energy.FromKilocalories(Convert.ToDouble(value)); - /// - public static Energy KiloelectronVolts(this T value) => - Energy.FromKiloelectronVolts(Convert.ToDouble(value)); + /// + public static Energy KiloelectronVolts(this T value) => + Energy.FromKiloelectronVolts(Convert.ToDouble(value)); - /// - public static Energy Kilojoules(this T value) => - Energy.FromKilojoules(Convert.ToDouble(value)); + /// + public static Energy Kilojoules(this T value) => + Energy.FromKilojoules(Convert.ToDouble(value)); - /// - public static Energy KilowattDays(this T value) => - Energy.FromKilowattDays(Convert.ToDouble(value)); + /// + public static Energy KilowattDays(this T value) => + Energy.FromKilowattDays(Convert.ToDouble(value)); - /// - public static Energy KilowattHours(this T value) => - Energy.FromKilowattHours(Convert.ToDouble(value)); + /// + public static Energy KilowattHours(this T value) => + Energy.FromKilowattHours(Convert.ToDouble(value)); - /// - public static Energy MegabritishThermalUnits(this T value) => - Energy.FromMegabritishThermalUnits(Convert.ToDouble(value)); + /// + public static Energy MegabritishThermalUnits(this T value) => + Energy.FromMegabritishThermalUnits(Convert.ToDouble(value)); - /// - public static Energy Megacalories(this T value) => - Energy.FromMegacalories(Convert.ToDouble(value)); + /// + public static Energy Megacalories(this T value) => + Energy.FromMegacalories(Convert.ToDouble(value)); - /// - public static Energy MegaelectronVolts(this T value) => - Energy.FromMegaelectronVolts(Convert.ToDouble(value)); + /// + public static Energy MegaelectronVolts(this T value) => + Energy.FromMegaelectronVolts(Convert.ToDouble(value)); - /// - public static Energy Megajoules(this T value) => - Energy.FromMegajoules(Convert.ToDouble(value)); + /// + public static Energy Megajoules(this T value) => + Energy.FromMegajoules(Convert.ToDouble(value)); - /// - public static Energy MegawattDays(this T value) => - Energy.FromMegawattDays(Convert.ToDouble(value)); + /// + public static Energy MegawattDays(this T value) => + Energy.FromMegawattDays(Convert.ToDouble(value)); - /// - public static Energy MegawattHours(this T value) => - Energy.FromMegawattHours(Convert.ToDouble(value)); + /// + public static Energy MegawattHours(this T value) => + Energy.FromMegawattHours(Convert.ToDouble(value)); - /// - public static Energy Millijoules(this T value) => - Energy.FromMillijoules(Convert.ToDouble(value)); + /// + public static Energy Millijoules(this T value) => + Energy.FromMillijoules(Convert.ToDouble(value)); - /// - public static Energy TeraelectronVolts(this T value) => - Energy.FromTeraelectronVolts(Convert.ToDouble(value)); + /// + public static Energy TeraelectronVolts(this T value) => + Energy.FromTeraelectronVolts(Convert.ToDouble(value)); - /// - public static Energy TerawattDays(this T value) => - Energy.FromTerawattDays(Convert.ToDouble(value)); + /// + public static Energy TerawattDays(this T value) => + Energy.FromTerawattDays(Convert.ToDouble(value)); - /// - public static Energy TerawattHours(this T value) => - Energy.FromTerawattHours(Convert.ToDouble(value)); + /// + public static Energy TerawattHours(this T value) => + Energy.FromTerawattHours(Convert.ToDouble(value)); - /// - public static Energy ThermsEc(this T value) => - Energy.FromThermsEc(Convert.ToDouble(value)); + /// + public static Energy ThermsEc(this T value) => + Energy.FromThermsEc(Convert.ToDouble(value)); - /// - public static Energy ThermsImperial(this T value) => - Energy.FromThermsImperial(Convert.ToDouble(value)); + /// + public static Energy ThermsImperial(this T value) => + Energy.FromThermsImperial(Convert.ToDouble(value)); - /// - public static Energy ThermsUs(this T value) => - Energy.FromThermsUs(Convert.ToDouble(value)); + /// + public static Energy ThermsUs(this T value) => + Energy.FromThermsUs(Convert.ToDouble(value)); - /// - public static Energy WattDays(this T value) => - Energy.FromWattDays(Convert.ToDouble(value)); + /// + public static Energy WattDays(this T value) => + Energy.FromWattDays(Convert.ToDouble(value)); - /// - public static Energy WattHours(this T value) => - Energy.FromWattHours(Convert.ToDouble(value)); + /// + public static Energy WattHours(this T value) => + Energy.FromWattHours(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToEntropyExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToEntropyExtensions.g.cs index 380fc72caf..a30cbcbaf3 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToEntropyExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToEntropyExtensions.g.cs @@ -28,33 +28,33 @@ namespace UnitsNet.NumberExtensions.NumberToEntropy /// public static class NumberToEntropyExtensions { - /// - public static Entropy CaloriesPerKelvin(this T value) => - Entropy.FromCaloriesPerKelvin(Convert.ToDouble(value)); + /// + public static Entropy CaloriesPerKelvin(this T value) => + Entropy.FromCaloriesPerKelvin(Convert.ToDouble(value)); - /// - public static Entropy JoulesPerDegreeCelsius(this T value) => - Entropy.FromJoulesPerDegreeCelsius(Convert.ToDouble(value)); + /// + public static Entropy JoulesPerDegreeCelsius(this T value) => + Entropy.FromJoulesPerDegreeCelsius(Convert.ToDouble(value)); - /// - public static Entropy JoulesPerKelvin(this T value) => - Entropy.FromJoulesPerKelvin(Convert.ToDouble(value)); + /// + public static Entropy JoulesPerKelvin(this T value) => + Entropy.FromJoulesPerKelvin(Convert.ToDouble(value)); - /// - public static Entropy KilocaloriesPerKelvin(this T value) => - Entropy.FromKilocaloriesPerKelvin(Convert.ToDouble(value)); + /// + public static Entropy KilocaloriesPerKelvin(this T value) => + Entropy.FromKilocaloriesPerKelvin(Convert.ToDouble(value)); - /// - public static Entropy KilojoulesPerDegreeCelsius(this T value) => - Entropy.FromKilojoulesPerDegreeCelsius(Convert.ToDouble(value)); + /// + public static Entropy KilojoulesPerDegreeCelsius(this T value) => + Entropy.FromKilojoulesPerDegreeCelsius(Convert.ToDouble(value)); - /// - public static Entropy KilojoulesPerKelvin(this T value) => - Entropy.FromKilojoulesPerKelvin(Convert.ToDouble(value)); + /// + public static Entropy KilojoulesPerKelvin(this T value) => + Entropy.FromKilojoulesPerKelvin(Convert.ToDouble(value)); - /// - public static Entropy MegajoulesPerKelvin(this T value) => - Entropy.FromMegajoulesPerKelvin(Convert.ToDouble(value)); + /// + public static Entropy MegajoulesPerKelvin(this T value) => + Entropy.FromMegajoulesPerKelvin(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToForceChangeRateExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToForceChangeRateExtensions.g.cs index df75da1487..1cc2f7d52c 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToForceChangeRateExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToForceChangeRateExtensions.g.cs @@ -28,49 +28,49 @@ namespace UnitsNet.NumberExtensions.NumberToForceChangeRate /// public static class NumberToForceChangeRateExtensions { - /// - public static ForceChangeRate CentinewtonsPerSecond(this T value) => - ForceChangeRate.FromCentinewtonsPerSecond(Convert.ToDouble(value)); + /// + public static ForceChangeRate CentinewtonsPerSecond(this T value) => + ForceChangeRate.FromCentinewtonsPerSecond(Convert.ToDouble(value)); - /// - public static ForceChangeRate DecanewtonsPerMinute(this T value) => - ForceChangeRate.FromDecanewtonsPerMinute(Convert.ToDouble(value)); + /// + public static ForceChangeRate DecanewtonsPerMinute(this T value) => + ForceChangeRate.FromDecanewtonsPerMinute(Convert.ToDouble(value)); - /// - public static ForceChangeRate DecanewtonsPerSecond(this T value) => - ForceChangeRate.FromDecanewtonsPerSecond(Convert.ToDouble(value)); + /// + public static ForceChangeRate DecanewtonsPerSecond(this T value) => + ForceChangeRate.FromDecanewtonsPerSecond(Convert.ToDouble(value)); - /// - public static ForceChangeRate DecinewtonsPerSecond(this T value) => - ForceChangeRate.FromDecinewtonsPerSecond(Convert.ToDouble(value)); + /// + public static ForceChangeRate DecinewtonsPerSecond(this T value) => + ForceChangeRate.FromDecinewtonsPerSecond(Convert.ToDouble(value)); - /// - public static ForceChangeRate KilonewtonsPerMinute(this T value) => - ForceChangeRate.FromKilonewtonsPerMinute(Convert.ToDouble(value)); + /// + public static ForceChangeRate KilonewtonsPerMinute(this T value) => + ForceChangeRate.FromKilonewtonsPerMinute(Convert.ToDouble(value)); - /// - public static ForceChangeRate KilonewtonsPerSecond(this T value) => - ForceChangeRate.FromKilonewtonsPerSecond(Convert.ToDouble(value)); + /// + public static ForceChangeRate KilonewtonsPerSecond(this T value) => + ForceChangeRate.FromKilonewtonsPerSecond(Convert.ToDouble(value)); - /// - public static ForceChangeRate MicronewtonsPerSecond(this T value) => - ForceChangeRate.FromMicronewtonsPerSecond(Convert.ToDouble(value)); + /// + public static ForceChangeRate MicronewtonsPerSecond(this T value) => + ForceChangeRate.FromMicronewtonsPerSecond(Convert.ToDouble(value)); - /// - public static ForceChangeRate MillinewtonsPerSecond(this T value) => - ForceChangeRate.FromMillinewtonsPerSecond(Convert.ToDouble(value)); + /// + public static ForceChangeRate MillinewtonsPerSecond(this T value) => + ForceChangeRate.FromMillinewtonsPerSecond(Convert.ToDouble(value)); - /// - public static ForceChangeRate NanonewtonsPerSecond(this T value) => - ForceChangeRate.FromNanonewtonsPerSecond(Convert.ToDouble(value)); + /// + public static ForceChangeRate NanonewtonsPerSecond(this T value) => + ForceChangeRate.FromNanonewtonsPerSecond(Convert.ToDouble(value)); - /// - public static ForceChangeRate NewtonsPerMinute(this T value) => - ForceChangeRate.FromNewtonsPerMinute(Convert.ToDouble(value)); + /// + public static ForceChangeRate NewtonsPerMinute(this T value) => + ForceChangeRate.FromNewtonsPerMinute(Convert.ToDouble(value)); - /// - public static ForceChangeRate NewtonsPerSecond(this T value) => - ForceChangeRate.FromNewtonsPerSecond(Convert.ToDouble(value)); + /// + public static ForceChangeRate NewtonsPerSecond(this T value) => + ForceChangeRate.FromNewtonsPerSecond(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToForceExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToForceExtensions.g.cs index 2bb99d88f9..d424e8d81c 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToForceExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToForceExtensions.g.cs @@ -28,65 +28,65 @@ namespace UnitsNet.NumberExtensions.NumberToForce /// public static class NumberToForceExtensions { - /// - public static Force Decanewtons(this T value) => - Force.FromDecanewtons(Convert.ToDouble(value)); + /// + public static Force Decanewtons(this T value) => + Force.FromDecanewtons(Convert.ToDouble(value)); - /// - public static Force Dyne(this T value) => - Force.FromDyne(Convert.ToDouble(value)); + /// + public static Force Dyne(this T value) => + Force.FromDyne(Convert.ToDouble(value)); - /// - public static Force KilogramsForce(this T value) => - Force.FromKilogramsForce(Convert.ToDouble(value)); + /// + public static Force KilogramsForce(this T value) => + Force.FromKilogramsForce(Convert.ToDouble(value)); - /// - public static Force Kilonewtons(this T value) => - Force.FromKilonewtons(Convert.ToDouble(value)); + /// + public static Force Kilonewtons(this T value) => + Force.FromKilonewtons(Convert.ToDouble(value)); - /// - public static Force KiloPonds(this T value) => - Force.FromKiloPonds(Convert.ToDouble(value)); + /// + public static Force KiloPonds(this T value) => + Force.FromKiloPonds(Convert.ToDouble(value)); - /// - public static Force KilopoundsForce(this T value) => - Force.FromKilopoundsForce(Convert.ToDouble(value)); + /// + public static Force KilopoundsForce(this T value) => + Force.FromKilopoundsForce(Convert.ToDouble(value)); - /// - public static Force Meganewtons(this T value) => - Force.FromMeganewtons(Convert.ToDouble(value)); + /// + public static Force Meganewtons(this T value) => + Force.FromMeganewtons(Convert.ToDouble(value)); - /// - public static Force Micronewtons(this T value) => - Force.FromMicronewtons(Convert.ToDouble(value)); + /// + public static Force Micronewtons(this T value) => + Force.FromMicronewtons(Convert.ToDouble(value)); - /// - public static Force Millinewtons(this T value) => - Force.FromMillinewtons(Convert.ToDouble(value)); + /// + public static Force Millinewtons(this T value) => + Force.FromMillinewtons(Convert.ToDouble(value)); - /// - public static Force Newtons(this T value) => - Force.FromNewtons(Convert.ToDouble(value)); + /// + public static Force Newtons(this T value) => + Force.FromNewtons(Convert.ToDouble(value)); - /// - public static Force OunceForce(this T value) => - Force.FromOunceForce(Convert.ToDouble(value)); + /// + public static Force OunceForce(this T value) => + Force.FromOunceForce(Convert.ToDouble(value)); - /// - public static Force Poundals(this T value) => - Force.FromPoundals(Convert.ToDouble(value)); + /// + public static Force Poundals(this T value) => + Force.FromPoundals(Convert.ToDouble(value)); - /// - public static Force PoundsForce(this T value) => - Force.FromPoundsForce(Convert.ToDouble(value)); + /// + public static Force PoundsForce(this T value) => + Force.FromPoundsForce(Convert.ToDouble(value)); - /// - public static Force ShortTonsForce(this T value) => - Force.FromShortTonsForce(Convert.ToDouble(value)); + /// + public static Force ShortTonsForce(this T value) => + Force.FromShortTonsForce(Convert.ToDouble(value)); - /// - public static Force TonnesForce(this T value) => - Force.FromTonnesForce(Convert.ToDouble(value)); + /// + public static Force TonnesForce(this T value) => + Force.FromTonnesForce(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToForcePerLengthExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToForcePerLengthExtensions.g.cs index 7c0c66f78d..d3c8ce9175 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToForcePerLengthExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToForcePerLengthExtensions.g.cs @@ -28,157 +28,157 @@ namespace UnitsNet.NumberExtensions.NumberToForcePerLength /// public static class NumberToForcePerLengthExtensions { - /// - public static ForcePerLength CentinewtonsPerCentimeter(this T value) => - ForcePerLength.FromCentinewtonsPerCentimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength CentinewtonsPerCentimeter(this T value) => + ForcePerLength.FromCentinewtonsPerCentimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength CentinewtonsPerMeter(this T value) => - ForcePerLength.FromCentinewtonsPerMeter(Convert.ToDouble(value)); + /// + public static ForcePerLength CentinewtonsPerMeter(this T value) => + ForcePerLength.FromCentinewtonsPerMeter(Convert.ToDouble(value)); - /// - public static ForcePerLength CentinewtonsPerMillimeter(this T value) => - ForcePerLength.FromCentinewtonsPerMillimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength CentinewtonsPerMillimeter(this T value) => + ForcePerLength.FromCentinewtonsPerMillimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength DecanewtonsPerCentimeter(this T value) => - ForcePerLength.FromDecanewtonsPerCentimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength DecanewtonsPerCentimeter(this T value) => + ForcePerLength.FromDecanewtonsPerCentimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength DecanewtonsPerMeter(this T value) => - ForcePerLength.FromDecanewtonsPerMeter(Convert.ToDouble(value)); + /// + public static ForcePerLength DecanewtonsPerMeter(this T value) => + ForcePerLength.FromDecanewtonsPerMeter(Convert.ToDouble(value)); - /// - public static ForcePerLength DecanewtonsPerMillimeter(this T value) => - ForcePerLength.FromDecanewtonsPerMillimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength DecanewtonsPerMillimeter(this T value) => + ForcePerLength.FromDecanewtonsPerMillimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength DecinewtonsPerCentimeter(this T value) => - ForcePerLength.FromDecinewtonsPerCentimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength DecinewtonsPerCentimeter(this T value) => + ForcePerLength.FromDecinewtonsPerCentimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength DecinewtonsPerMeter(this T value) => - ForcePerLength.FromDecinewtonsPerMeter(Convert.ToDouble(value)); + /// + public static ForcePerLength DecinewtonsPerMeter(this T value) => + ForcePerLength.FromDecinewtonsPerMeter(Convert.ToDouble(value)); - /// - public static ForcePerLength DecinewtonsPerMillimeter(this T value) => - ForcePerLength.FromDecinewtonsPerMillimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength DecinewtonsPerMillimeter(this T value) => + ForcePerLength.FromDecinewtonsPerMillimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength KilogramsForcePerCentimeter(this T value) => - ForcePerLength.FromKilogramsForcePerCentimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength KilogramsForcePerCentimeter(this T value) => + ForcePerLength.FromKilogramsForcePerCentimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength KilogramsForcePerMeter(this T value) => - ForcePerLength.FromKilogramsForcePerMeter(Convert.ToDouble(value)); + /// + public static ForcePerLength KilogramsForcePerMeter(this T value) => + ForcePerLength.FromKilogramsForcePerMeter(Convert.ToDouble(value)); - /// - public static ForcePerLength KilogramsForcePerMillimeter(this T value) => - ForcePerLength.FromKilogramsForcePerMillimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength KilogramsForcePerMillimeter(this T value) => + ForcePerLength.FromKilogramsForcePerMillimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength KilonewtonsPerCentimeter(this T value) => - ForcePerLength.FromKilonewtonsPerCentimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength KilonewtonsPerCentimeter(this T value) => + ForcePerLength.FromKilonewtonsPerCentimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength KilonewtonsPerMeter(this T value) => - ForcePerLength.FromKilonewtonsPerMeter(Convert.ToDouble(value)); + /// + public static ForcePerLength KilonewtonsPerMeter(this T value) => + ForcePerLength.FromKilonewtonsPerMeter(Convert.ToDouble(value)); - /// - public static ForcePerLength KilonewtonsPerMillimeter(this T value) => - ForcePerLength.FromKilonewtonsPerMillimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength KilonewtonsPerMillimeter(this T value) => + ForcePerLength.FromKilonewtonsPerMillimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength KilopoundsForcePerFoot(this T value) => - ForcePerLength.FromKilopoundsForcePerFoot(Convert.ToDouble(value)); + /// + public static ForcePerLength KilopoundsForcePerFoot(this T value) => + ForcePerLength.FromKilopoundsForcePerFoot(Convert.ToDouble(value)); - /// - public static ForcePerLength KilopoundsForcePerInch(this T value) => - ForcePerLength.FromKilopoundsForcePerInch(Convert.ToDouble(value)); + /// + public static ForcePerLength KilopoundsForcePerInch(this T value) => + ForcePerLength.FromKilopoundsForcePerInch(Convert.ToDouble(value)); - /// - public static ForcePerLength MeganewtonsPerCentimeter(this T value) => - ForcePerLength.FromMeganewtonsPerCentimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength MeganewtonsPerCentimeter(this T value) => + ForcePerLength.FromMeganewtonsPerCentimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength MeganewtonsPerMeter(this T value) => - ForcePerLength.FromMeganewtonsPerMeter(Convert.ToDouble(value)); + /// + public static ForcePerLength MeganewtonsPerMeter(this T value) => + ForcePerLength.FromMeganewtonsPerMeter(Convert.ToDouble(value)); - /// - public static ForcePerLength MeganewtonsPerMillimeter(this T value) => - ForcePerLength.FromMeganewtonsPerMillimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength MeganewtonsPerMillimeter(this T value) => + ForcePerLength.FromMeganewtonsPerMillimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength MicronewtonsPerCentimeter(this T value) => - ForcePerLength.FromMicronewtonsPerCentimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength MicronewtonsPerCentimeter(this T value) => + ForcePerLength.FromMicronewtonsPerCentimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength MicronewtonsPerMeter(this T value) => - ForcePerLength.FromMicronewtonsPerMeter(Convert.ToDouble(value)); + /// + public static ForcePerLength MicronewtonsPerMeter(this T value) => + ForcePerLength.FromMicronewtonsPerMeter(Convert.ToDouble(value)); - /// - public static ForcePerLength MicronewtonsPerMillimeter(this T value) => - ForcePerLength.FromMicronewtonsPerMillimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength MicronewtonsPerMillimeter(this T value) => + ForcePerLength.FromMicronewtonsPerMillimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength MillinewtonsPerCentimeter(this T value) => - ForcePerLength.FromMillinewtonsPerCentimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength MillinewtonsPerCentimeter(this T value) => + ForcePerLength.FromMillinewtonsPerCentimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength MillinewtonsPerMeter(this T value) => - ForcePerLength.FromMillinewtonsPerMeter(Convert.ToDouble(value)); + /// + public static ForcePerLength MillinewtonsPerMeter(this T value) => + ForcePerLength.FromMillinewtonsPerMeter(Convert.ToDouble(value)); - /// - public static ForcePerLength MillinewtonsPerMillimeter(this T value) => - ForcePerLength.FromMillinewtonsPerMillimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength MillinewtonsPerMillimeter(this T value) => + ForcePerLength.FromMillinewtonsPerMillimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength NanonewtonsPerCentimeter(this T value) => - ForcePerLength.FromNanonewtonsPerCentimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength NanonewtonsPerCentimeter(this T value) => + ForcePerLength.FromNanonewtonsPerCentimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength NanonewtonsPerMeter(this T value) => - ForcePerLength.FromNanonewtonsPerMeter(Convert.ToDouble(value)); + /// + public static ForcePerLength NanonewtonsPerMeter(this T value) => + ForcePerLength.FromNanonewtonsPerMeter(Convert.ToDouble(value)); - /// - public static ForcePerLength NanonewtonsPerMillimeter(this T value) => - ForcePerLength.FromNanonewtonsPerMillimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength NanonewtonsPerMillimeter(this T value) => + ForcePerLength.FromNanonewtonsPerMillimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength NewtonsPerCentimeter(this T value) => - ForcePerLength.FromNewtonsPerCentimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength NewtonsPerCentimeter(this T value) => + ForcePerLength.FromNewtonsPerCentimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength NewtonsPerMeter(this T value) => - ForcePerLength.FromNewtonsPerMeter(Convert.ToDouble(value)); + /// + public static ForcePerLength NewtonsPerMeter(this T value) => + ForcePerLength.FromNewtonsPerMeter(Convert.ToDouble(value)); - /// - public static ForcePerLength NewtonsPerMillimeter(this T value) => - ForcePerLength.FromNewtonsPerMillimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength NewtonsPerMillimeter(this T value) => + ForcePerLength.FromNewtonsPerMillimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength PoundsForcePerFoot(this T value) => - ForcePerLength.FromPoundsForcePerFoot(Convert.ToDouble(value)); + /// + public static ForcePerLength PoundsForcePerFoot(this T value) => + ForcePerLength.FromPoundsForcePerFoot(Convert.ToDouble(value)); - /// - public static ForcePerLength PoundsForcePerInch(this T value) => - ForcePerLength.FromPoundsForcePerInch(Convert.ToDouble(value)); + /// + public static ForcePerLength PoundsForcePerInch(this T value) => + ForcePerLength.FromPoundsForcePerInch(Convert.ToDouble(value)); - /// - public static ForcePerLength PoundsForcePerYard(this T value) => - ForcePerLength.FromPoundsForcePerYard(Convert.ToDouble(value)); + /// + public static ForcePerLength PoundsForcePerYard(this T value) => + ForcePerLength.FromPoundsForcePerYard(Convert.ToDouble(value)); - /// - public static ForcePerLength TonnesForcePerCentimeter(this T value) => - ForcePerLength.FromTonnesForcePerCentimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength TonnesForcePerCentimeter(this T value) => + ForcePerLength.FromTonnesForcePerCentimeter(Convert.ToDouble(value)); - /// - public static ForcePerLength TonnesForcePerMeter(this T value) => - ForcePerLength.FromTonnesForcePerMeter(Convert.ToDouble(value)); + /// + public static ForcePerLength TonnesForcePerMeter(this T value) => + ForcePerLength.FromTonnesForcePerMeter(Convert.ToDouble(value)); - /// - public static ForcePerLength TonnesForcePerMillimeter(this T value) => - ForcePerLength.FromTonnesForcePerMillimeter(Convert.ToDouble(value)); + /// + public static ForcePerLength TonnesForcePerMillimeter(this T value) => + ForcePerLength.FromTonnesForcePerMillimeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToFrequencyExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToFrequencyExtensions.g.cs index 4d0e5b5979..d7ae42c33e 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToFrequencyExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToFrequencyExtensions.g.cs @@ -28,45 +28,45 @@ namespace UnitsNet.NumberExtensions.NumberToFrequency /// public static class NumberToFrequencyExtensions { - /// - public static Frequency BeatsPerMinute(this T value) => - Frequency.FromBeatsPerMinute(Convert.ToDouble(value)); + /// + public static Frequency BeatsPerMinute(this T value) => + Frequency.FromBeatsPerMinute(Convert.ToDouble(value)); - /// - public static Frequency CyclesPerHour(this T value) => - Frequency.FromCyclesPerHour(Convert.ToDouble(value)); + /// + public static Frequency CyclesPerHour(this T value) => + Frequency.FromCyclesPerHour(Convert.ToDouble(value)); - /// - public static Frequency CyclesPerMinute(this T value) => - Frequency.FromCyclesPerMinute(Convert.ToDouble(value)); + /// + public static Frequency CyclesPerMinute(this T value) => + Frequency.FromCyclesPerMinute(Convert.ToDouble(value)); - /// - public static Frequency Gigahertz(this T value) => - Frequency.FromGigahertz(Convert.ToDouble(value)); + /// + public static Frequency Gigahertz(this T value) => + Frequency.FromGigahertz(Convert.ToDouble(value)); - /// - public static Frequency Hertz(this T value) => - Frequency.FromHertz(Convert.ToDouble(value)); + /// + public static Frequency Hertz(this T value) => + Frequency.FromHertz(Convert.ToDouble(value)); - /// - public static Frequency Kilohertz(this T value) => - Frequency.FromKilohertz(Convert.ToDouble(value)); + /// + public static Frequency Kilohertz(this T value) => + Frequency.FromKilohertz(Convert.ToDouble(value)); - /// - public static Frequency Megahertz(this T value) => - Frequency.FromMegahertz(Convert.ToDouble(value)); + /// + public static Frequency Megahertz(this T value) => + Frequency.FromMegahertz(Convert.ToDouble(value)); - /// - public static Frequency PerSecond(this T value) => - Frequency.FromPerSecond(Convert.ToDouble(value)); + /// + public static Frequency PerSecond(this T value) => + Frequency.FromPerSecond(Convert.ToDouble(value)); - /// - public static Frequency RadiansPerSecond(this T value) => - Frequency.FromRadiansPerSecond(Convert.ToDouble(value)); + /// + public static Frequency RadiansPerSecond(this T value) => + Frequency.FromRadiansPerSecond(Convert.ToDouble(value)); - /// - public static Frequency Terahertz(this T value) => - Frequency.FromTerahertz(Convert.ToDouble(value)); + /// + public static Frequency Terahertz(this T value) => + Frequency.FromTerahertz(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToFuelEfficiencyExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToFuelEfficiencyExtensions.g.cs index 784bed62b5..51763f7531 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToFuelEfficiencyExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToFuelEfficiencyExtensions.g.cs @@ -28,21 +28,21 @@ namespace UnitsNet.NumberExtensions.NumberToFuelEfficiency /// public static class NumberToFuelEfficiencyExtensions { - /// - public static FuelEfficiency KilometersPerLiters(this T value) => - FuelEfficiency.FromKilometersPerLiters(Convert.ToDouble(value)); + /// + public static FuelEfficiency KilometersPerLiters(this T value) => + FuelEfficiency.FromKilometersPerLiters(Convert.ToDouble(value)); - /// - public static FuelEfficiency LitersPer100Kilometers(this T value) => - FuelEfficiency.FromLitersPer100Kilometers(Convert.ToDouble(value)); + /// + public static FuelEfficiency LitersPer100Kilometers(this T value) => + FuelEfficiency.FromLitersPer100Kilometers(Convert.ToDouble(value)); - /// - public static FuelEfficiency MilesPerUkGallon(this T value) => - FuelEfficiency.FromMilesPerUkGallon(Convert.ToDouble(value)); + /// + public static FuelEfficiency MilesPerUkGallon(this T value) => + FuelEfficiency.FromMilesPerUkGallon(Convert.ToDouble(value)); - /// - public static FuelEfficiency MilesPerUsGallon(this T value) => - FuelEfficiency.FromMilesPerUsGallon(Convert.ToDouble(value)); + /// + public static FuelEfficiency MilesPerUsGallon(this T value) => + FuelEfficiency.FromMilesPerUsGallon(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToHeatFluxExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToHeatFluxExtensions.g.cs index 883c9e3a6f..cf35b9ecc3 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToHeatFluxExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToHeatFluxExtensions.g.cs @@ -28,77 +28,77 @@ namespace UnitsNet.NumberExtensions.NumberToHeatFlux /// public static class NumberToHeatFluxExtensions { - /// - public static HeatFlux BtusPerHourSquareFoot(this T value) => - HeatFlux.FromBtusPerHourSquareFoot(Convert.ToDouble(value)); + /// + public static HeatFlux BtusPerHourSquareFoot(this T value) => + HeatFlux.FromBtusPerHourSquareFoot(Convert.ToDouble(value)); - /// - public static HeatFlux BtusPerMinuteSquareFoot(this T value) => - HeatFlux.FromBtusPerMinuteSquareFoot(Convert.ToDouble(value)); + /// + public static HeatFlux BtusPerMinuteSquareFoot(this T value) => + HeatFlux.FromBtusPerMinuteSquareFoot(Convert.ToDouble(value)); - /// - public static HeatFlux BtusPerSecondSquareFoot(this T value) => - HeatFlux.FromBtusPerSecondSquareFoot(Convert.ToDouble(value)); + /// + public static HeatFlux BtusPerSecondSquareFoot(this T value) => + HeatFlux.FromBtusPerSecondSquareFoot(Convert.ToDouble(value)); - /// - public static HeatFlux BtusPerSecondSquareInch(this T value) => - HeatFlux.FromBtusPerSecondSquareInch(Convert.ToDouble(value)); + /// + public static HeatFlux BtusPerSecondSquareInch(this T value) => + HeatFlux.FromBtusPerSecondSquareInch(Convert.ToDouble(value)); - /// - public static HeatFlux CaloriesPerSecondSquareCentimeter(this T value) => - HeatFlux.FromCaloriesPerSecondSquareCentimeter(Convert.ToDouble(value)); + /// + public static HeatFlux CaloriesPerSecondSquareCentimeter(this T value) => + HeatFlux.FromCaloriesPerSecondSquareCentimeter(Convert.ToDouble(value)); - /// - public static HeatFlux CentiwattsPerSquareMeter(this T value) => - HeatFlux.FromCentiwattsPerSquareMeter(Convert.ToDouble(value)); + /// + public static HeatFlux CentiwattsPerSquareMeter(this T value) => + HeatFlux.FromCentiwattsPerSquareMeter(Convert.ToDouble(value)); - /// - public static HeatFlux DeciwattsPerSquareMeter(this T value) => - HeatFlux.FromDeciwattsPerSquareMeter(Convert.ToDouble(value)); + /// + public static HeatFlux DeciwattsPerSquareMeter(this T value) => + HeatFlux.FromDeciwattsPerSquareMeter(Convert.ToDouble(value)); - /// - public static HeatFlux KilocaloriesPerHourSquareMeter(this T value) => - HeatFlux.FromKilocaloriesPerHourSquareMeter(Convert.ToDouble(value)); + /// + public static HeatFlux KilocaloriesPerHourSquareMeter(this T value) => + HeatFlux.FromKilocaloriesPerHourSquareMeter(Convert.ToDouble(value)); - /// - public static HeatFlux KilocaloriesPerSecondSquareCentimeter(this T value) => - HeatFlux.FromKilocaloriesPerSecondSquareCentimeter(Convert.ToDouble(value)); + /// + public static HeatFlux KilocaloriesPerSecondSquareCentimeter(this T value) => + HeatFlux.FromKilocaloriesPerSecondSquareCentimeter(Convert.ToDouble(value)); - /// - public static HeatFlux KilowattsPerSquareMeter(this T value) => - HeatFlux.FromKilowattsPerSquareMeter(Convert.ToDouble(value)); + /// + public static HeatFlux KilowattsPerSquareMeter(this T value) => + HeatFlux.FromKilowattsPerSquareMeter(Convert.ToDouble(value)); - /// - public static HeatFlux MicrowattsPerSquareMeter(this T value) => - HeatFlux.FromMicrowattsPerSquareMeter(Convert.ToDouble(value)); + /// + public static HeatFlux MicrowattsPerSquareMeter(this T value) => + HeatFlux.FromMicrowattsPerSquareMeter(Convert.ToDouble(value)); - /// - public static HeatFlux MilliwattsPerSquareMeter(this T value) => - HeatFlux.FromMilliwattsPerSquareMeter(Convert.ToDouble(value)); + /// + public static HeatFlux MilliwattsPerSquareMeter(this T value) => + HeatFlux.FromMilliwattsPerSquareMeter(Convert.ToDouble(value)); - /// - public static HeatFlux NanowattsPerSquareMeter(this T value) => - HeatFlux.FromNanowattsPerSquareMeter(Convert.ToDouble(value)); + /// + public static HeatFlux NanowattsPerSquareMeter(this T value) => + HeatFlux.FromNanowattsPerSquareMeter(Convert.ToDouble(value)); - /// - public static HeatFlux PoundsForcePerFootSecond(this T value) => - HeatFlux.FromPoundsForcePerFootSecond(Convert.ToDouble(value)); + /// + public static HeatFlux PoundsForcePerFootSecond(this T value) => + HeatFlux.FromPoundsForcePerFootSecond(Convert.ToDouble(value)); - /// - public static HeatFlux PoundsPerSecondCubed(this T value) => - HeatFlux.FromPoundsPerSecondCubed(Convert.ToDouble(value)); + /// + public static HeatFlux PoundsPerSecondCubed(this T value) => + HeatFlux.FromPoundsPerSecondCubed(Convert.ToDouble(value)); - /// - public static HeatFlux WattsPerSquareFoot(this T value) => - HeatFlux.FromWattsPerSquareFoot(Convert.ToDouble(value)); + /// + public static HeatFlux WattsPerSquareFoot(this T value) => + HeatFlux.FromWattsPerSquareFoot(Convert.ToDouble(value)); - /// - public static HeatFlux WattsPerSquareInch(this T value) => - HeatFlux.FromWattsPerSquareInch(Convert.ToDouble(value)); + /// + public static HeatFlux WattsPerSquareInch(this T value) => + HeatFlux.FromWattsPerSquareInch(Convert.ToDouble(value)); - /// - public static HeatFlux WattsPerSquareMeter(this T value) => - HeatFlux.FromWattsPerSquareMeter(Convert.ToDouble(value)); + /// + public static HeatFlux WattsPerSquareMeter(this T value) => + HeatFlux.FromWattsPerSquareMeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToHeatTransferCoefficientExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToHeatTransferCoefficientExtensions.g.cs index b003ea6162..4bdc7a5ccb 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToHeatTransferCoefficientExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToHeatTransferCoefficientExtensions.g.cs @@ -28,17 +28,17 @@ namespace UnitsNet.NumberExtensions.NumberToHeatTransferCoefficient /// public static class NumberToHeatTransferCoefficientExtensions { - /// - public static HeatTransferCoefficient BtusPerSquareFootDegreeFahrenheit(this T value) => - HeatTransferCoefficient.FromBtusPerSquareFootDegreeFahrenheit(Convert.ToDouble(value)); + /// + public static HeatTransferCoefficient BtusPerSquareFootDegreeFahrenheit(this T value) => + HeatTransferCoefficient.FromBtusPerSquareFootDegreeFahrenheit(Convert.ToDouble(value)); - /// - public static HeatTransferCoefficient WattsPerSquareMeterCelsius(this T value) => - HeatTransferCoefficient.FromWattsPerSquareMeterCelsius(Convert.ToDouble(value)); + /// + public static HeatTransferCoefficient WattsPerSquareMeterCelsius(this T value) => + HeatTransferCoefficient.FromWattsPerSquareMeterCelsius(Convert.ToDouble(value)); - /// - public static HeatTransferCoefficient WattsPerSquareMeterKelvin(this T value) => - HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(Convert.ToDouble(value)); + /// + public static HeatTransferCoefficient WattsPerSquareMeterKelvin(this T value) => + HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToIlluminanceExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToIlluminanceExtensions.g.cs index b6249c0ee0..a2a827acc1 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToIlluminanceExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToIlluminanceExtensions.g.cs @@ -28,21 +28,21 @@ namespace UnitsNet.NumberExtensions.NumberToIlluminance /// public static class NumberToIlluminanceExtensions { - /// - public static Illuminance Kilolux(this T value) => - Illuminance.FromKilolux(Convert.ToDouble(value)); + /// + public static Illuminance Kilolux(this T value) => + Illuminance.FromKilolux(Convert.ToDouble(value)); - /// - public static Illuminance Lux(this T value) => - Illuminance.FromLux(Convert.ToDouble(value)); + /// + public static Illuminance Lux(this T value) => + Illuminance.FromLux(Convert.ToDouble(value)); - /// - public static Illuminance Megalux(this T value) => - Illuminance.FromMegalux(Convert.ToDouble(value)); + /// + public static Illuminance Megalux(this T value) => + Illuminance.FromMegalux(Convert.ToDouble(value)); - /// - public static Illuminance Millilux(this T value) => - Illuminance.FromMillilux(Convert.ToDouble(value)); + /// + public static Illuminance Millilux(this T value) => + Illuminance.FromMillilux(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToInformationExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToInformationExtensions.g.cs index 120e3dda4a..428e5f1dd8 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToInformationExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToInformationExtensions.g.cs @@ -28,109 +28,109 @@ namespace UnitsNet.NumberExtensions.NumberToInformation /// public static class NumberToInformationExtensions { - /// - public static Information Bits(this T value) => - Information.FromBits(Convert.ToDouble(value)); + /// + public static Information Bits(this T value) => + Information.FromBits(Convert.ToDouble(value)); - /// - public static Information Bytes(this T value) => - Information.FromBytes(Convert.ToDouble(value)); + /// + public static Information Bytes(this T value) => + Information.FromBytes(Convert.ToDouble(value)); - /// - public static Information Exabits(this T value) => - Information.FromExabits(Convert.ToDouble(value)); + /// + public static Information Exabits(this T value) => + Information.FromExabits(Convert.ToDouble(value)); - /// - public static Information Exabytes(this T value) => - Information.FromExabytes(Convert.ToDouble(value)); + /// + public static Information Exabytes(this T value) => + Information.FromExabytes(Convert.ToDouble(value)); - /// - public static Information Exbibits(this T value) => - Information.FromExbibits(Convert.ToDouble(value)); + /// + public static Information Exbibits(this T value) => + Information.FromExbibits(Convert.ToDouble(value)); - /// - public static Information Exbibytes(this T value) => - Information.FromExbibytes(Convert.ToDouble(value)); + /// + public static Information Exbibytes(this T value) => + Information.FromExbibytes(Convert.ToDouble(value)); - /// - public static Information Gibibits(this T value) => - Information.FromGibibits(Convert.ToDouble(value)); + /// + public static Information Gibibits(this T value) => + Information.FromGibibits(Convert.ToDouble(value)); - /// - public static Information Gibibytes(this T value) => - Information.FromGibibytes(Convert.ToDouble(value)); + /// + public static Information Gibibytes(this T value) => + Information.FromGibibytes(Convert.ToDouble(value)); - /// - public static Information Gigabits(this T value) => - Information.FromGigabits(Convert.ToDouble(value)); + /// + public static Information Gigabits(this T value) => + Information.FromGigabits(Convert.ToDouble(value)); - /// - public static Information Gigabytes(this T value) => - Information.FromGigabytes(Convert.ToDouble(value)); + /// + public static Information Gigabytes(this T value) => + Information.FromGigabytes(Convert.ToDouble(value)); - /// - public static Information Kibibits(this T value) => - Information.FromKibibits(Convert.ToDouble(value)); + /// + public static Information Kibibits(this T value) => + Information.FromKibibits(Convert.ToDouble(value)); - /// - public static Information Kibibytes(this T value) => - Information.FromKibibytes(Convert.ToDouble(value)); + /// + public static Information Kibibytes(this T value) => + Information.FromKibibytes(Convert.ToDouble(value)); - /// - public static Information Kilobits(this T value) => - Information.FromKilobits(Convert.ToDouble(value)); + /// + public static Information Kilobits(this T value) => + Information.FromKilobits(Convert.ToDouble(value)); - /// - public static Information Kilobytes(this T value) => - Information.FromKilobytes(Convert.ToDouble(value)); + /// + public static Information Kilobytes(this T value) => + Information.FromKilobytes(Convert.ToDouble(value)); - /// - public static Information Mebibits(this T value) => - Information.FromMebibits(Convert.ToDouble(value)); + /// + public static Information Mebibits(this T value) => + Information.FromMebibits(Convert.ToDouble(value)); - /// - public static Information Mebibytes(this T value) => - Information.FromMebibytes(Convert.ToDouble(value)); + /// + public static Information Mebibytes(this T value) => + Information.FromMebibytes(Convert.ToDouble(value)); - /// - public static Information Megabits(this T value) => - Information.FromMegabits(Convert.ToDouble(value)); + /// + public static Information Megabits(this T value) => + Information.FromMegabits(Convert.ToDouble(value)); - /// - public static Information Megabytes(this T value) => - Information.FromMegabytes(Convert.ToDouble(value)); + /// + public static Information Megabytes(this T value) => + Information.FromMegabytes(Convert.ToDouble(value)); - /// - public static Information Pebibits(this T value) => - Information.FromPebibits(Convert.ToDouble(value)); + /// + public static Information Pebibits(this T value) => + Information.FromPebibits(Convert.ToDouble(value)); - /// - public static Information Pebibytes(this T value) => - Information.FromPebibytes(Convert.ToDouble(value)); + /// + public static Information Pebibytes(this T value) => + Information.FromPebibytes(Convert.ToDouble(value)); - /// - public static Information Petabits(this T value) => - Information.FromPetabits(Convert.ToDouble(value)); + /// + public static Information Petabits(this T value) => + Information.FromPetabits(Convert.ToDouble(value)); - /// - public static Information Petabytes(this T value) => - Information.FromPetabytes(Convert.ToDouble(value)); + /// + public static Information Petabytes(this T value) => + Information.FromPetabytes(Convert.ToDouble(value)); - /// - public static Information Tebibits(this T value) => - Information.FromTebibits(Convert.ToDouble(value)); + /// + public static Information Tebibits(this T value) => + Information.FromTebibits(Convert.ToDouble(value)); - /// - public static Information Tebibytes(this T value) => - Information.FromTebibytes(Convert.ToDouble(value)); + /// + public static Information Tebibytes(this T value) => + Information.FromTebibytes(Convert.ToDouble(value)); - /// - public static Information Terabits(this T value) => - Information.FromTerabits(Convert.ToDouble(value)); + /// + public static Information Terabits(this T value) => + Information.FromTerabits(Convert.ToDouble(value)); - /// - public static Information Terabytes(this T value) => - Information.FromTerabytes(Convert.ToDouble(value)); + /// + public static Information Terabytes(this T value) => + Information.FromTerabytes(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToIrradianceExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToIrradianceExtensions.g.cs index 734ffc433c..671283838b 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToIrradianceExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToIrradianceExtensions.g.cs @@ -28,61 +28,61 @@ namespace UnitsNet.NumberExtensions.NumberToIrradiance /// public static class NumberToIrradianceExtensions { - /// - public static Irradiance KilowattsPerSquareCentimeter(this T value) => - Irradiance.FromKilowattsPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static Irradiance KilowattsPerSquareCentimeter(this T value) => + Irradiance.FromKilowattsPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static Irradiance KilowattsPerSquareMeter(this T value) => - Irradiance.FromKilowattsPerSquareMeter(Convert.ToDouble(value)); + /// + public static Irradiance KilowattsPerSquareMeter(this T value) => + Irradiance.FromKilowattsPerSquareMeter(Convert.ToDouble(value)); - /// - public static Irradiance MegawattsPerSquareCentimeter(this T value) => - Irradiance.FromMegawattsPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static Irradiance MegawattsPerSquareCentimeter(this T value) => + Irradiance.FromMegawattsPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static Irradiance MegawattsPerSquareMeter(this T value) => - Irradiance.FromMegawattsPerSquareMeter(Convert.ToDouble(value)); + /// + public static Irradiance MegawattsPerSquareMeter(this T value) => + Irradiance.FromMegawattsPerSquareMeter(Convert.ToDouble(value)); - /// - public static Irradiance MicrowattsPerSquareCentimeter(this T value) => - Irradiance.FromMicrowattsPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static Irradiance MicrowattsPerSquareCentimeter(this T value) => + Irradiance.FromMicrowattsPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static Irradiance MicrowattsPerSquareMeter(this T value) => - Irradiance.FromMicrowattsPerSquareMeter(Convert.ToDouble(value)); + /// + public static Irradiance MicrowattsPerSquareMeter(this T value) => + Irradiance.FromMicrowattsPerSquareMeter(Convert.ToDouble(value)); - /// - public static Irradiance MilliwattsPerSquareCentimeter(this T value) => - Irradiance.FromMilliwattsPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static Irradiance MilliwattsPerSquareCentimeter(this T value) => + Irradiance.FromMilliwattsPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static Irradiance MilliwattsPerSquareMeter(this T value) => - Irradiance.FromMilliwattsPerSquareMeter(Convert.ToDouble(value)); + /// + public static Irradiance MilliwattsPerSquareMeter(this T value) => + Irradiance.FromMilliwattsPerSquareMeter(Convert.ToDouble(value)); - /// - public static Irradiance NanowattsPerSquareCentimeter(this T value) => - Irradiance.FromNanowattsPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static Irradiance NanowattsPerSquareCentimeter(this T value) => + Irradiance.FromNanowattsPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static Irradiance NanowattsPerSquareMeter(this T value) => - Irradiance.FromNanowattsPerSquareMeter(Convert.ToDouble(value)); + /// + public static Irradiance NanowattsPerSquareMeter(this T value) => + Irradiance.FromNanowattsPerSquareMeter(Convert.ToDouble(value)); - /// - public static Irradiance PicowattsPerSquareCentimeter(this T value) => - Irradiance.FromPicowattsPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static Irradiance PicowattsPerSquareCentimeter(this T value) => + Irradiance.FromPicowattsPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static Irradiance PicowattsPerSquareMeter(this T value) => - Irradiance.FromPicowattsPerSquareMeter(Convert.ToDouble(value)); + /// + public static Irradiance PicowattsPerSquareMeter(this T value) => + Irradiance.FromPicowattsPerSquareMeter(Convert.ToDouble(value)); - /// - public static Irradiance WattsPerSquareCentimeter(this T value) => - Irradiance.FromWattsPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static Irradiance WattsPerSquareCentimeter(this T value) => + Irradiance.FromWattsPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static Irradiance WattsPerSquareMeter(this T value) => - Irradiance.FromWattsPerSquareMeter(Convert.ToDouble(value)); + /// + public static Irradiance WattsPerSquareMeter(this T value) => + Irradiance.FromWattsPerSquareMeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToIrradiationExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToIrradiationExtensions.g.cs index 9e088ab29f..239e887b9d 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToIrradiationExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToIrradiationExtensions.g.cs @@ -28,33 +28,33 @@ namespace UnitsNet.NumberExtensions.NumberToIrradiation /// public static class NumberToIrradiationExtensions { - /// - public static Irradiation JoulesPerSquareCentimeter(this T value) => - Irradiation.FromJoulesPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static Irradiation JoulesPerSquareCentimeter(this T value) => + Irradiation.FromJoulesPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static Irradiation JoulesPerSquareMeter(this T value) => - Irradiation.FromJoulesPerSquareMeter(Convert.ToDouble(value)); + /// + public static Irradiation JoulesPerSquareMeter(this T value) => + Irradiation.FromJoulesPerSquareMeter(Convert.ToDouble(value)); - /// - public static Irradiation JoulesPerSquareMillimeter(this T value) => - Irradiation.FromJoulesPerSquareMillimeter(Convert.ToDouble(value)); + /// + public static Irradiation JoulesPerSquareMillimeter(this T value) => + Irradiation.FromJoulesPerSquareMillimeter(Convert.ToDouble(value)); - /// - public static Irradiation KilojoulesPerSquareMeter(this T value) => - Irradiation.FromKilojoulesPerSquareMeter(Convert.ToDouble(value)); + /// + public static Irradiation KilojoulesPerSquareMeter(this T value) => + Irradiation.FromKilojoulesPerSquareMeter(Convert.ToDouble(value)); - /// - public static Irradiation KilowattHoursPerSquareMeter(this T value) => - Irradiation.FromKilowattHoursPerSquareMeter(Convert.ToDouble(value)); + /// + public static Irradiation KilowattHoursPerSquareMeter(this T value) => + Irradiation.FromKilowattHoursPerSquareMeter(Convert.ToDouble(value)); - /// - public static Irradiation MillijoulesPerSquareCentimeter(this T value) => - Irradiation.FromMillijoulesPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static Irradiation MillijoulesPerSquareCentimeter(this T value) => + Irradiation.FromMillijoulesPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static Irradiation WattHoursPerSquareMeter(this T value) => - Irradiation.FromWattHoursPerSquareMeter(Convert.ToDouble(value)); + /// + public static Irradiation WattHoursPerSquareMeter(this T value) => + Irradiation.FromWattHoursPerSquareMeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToKinematicViscosityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToKinematicViscosityExtensions.g.cs index f60882e932..e3f77067ef 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToKinematicViscosityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToKinematicViscosityExtensions.g.cs @@ -28,37 +28,37 @@ namespace UnitsNet.NumberExtensions.NumberToKinematicViscosity /// public static class NumberToKinematicViscosityExtensions { - /// - public static KinematicViscosity Centistokes(this T value) => - KinematicViscosity.FromCentistokes(Convert.ToDouble(value)); + /// + public static KinematicViscosity Centistokes(this T value) => + KinematicViscosity.FromCentistokes(Convert.ToDouble(value)); - /// - public static KinematicViscosity Decistokes(this T value) => - KinematicViscosity.FromDecistokes(Convert.ToDouble(value)); + /// + public static KinematicViscosity Decistokes(this T value) => + KinematicViscosity.FromDecistokes(Convert.ToDouble(value)); - /// - public static KinematicViscosity Kilostokes(this T value) => - KinematicViscosity.FromKilostokes(Convert.ToDouble(value)); + /// + public static KinematicViscosity Kilostokes(this T value) => + KinematicViscosity.FromKilostokes(Convert.ToDouble(value)); - /// - public static KinematicViscosity Microstokes(this T value) => - KinematicViscosity.FromMicrostokes(Convert.ToDouble(value)); + /// + public static KinematicViscosity Microstokes(this T value) => + KinematicViscosity.FromMicrostokes(Convert.ToDouble(value)); - /// - public static KinematicViscosity Millistokes(this T value) => - KinematicViscosity.FromMillistokes(Convert.ToDouble(value)); + /// + public static KinematicViscosity Millistokes(this T value) => + KinematicViscosity.FromMillistokes(Convert.ToDouble(value)); - /// - public static KinematicViscosity Nanostokes(this T value) => - KinematicViscosity.FromNanostokes(Convert.ToDouble(value)); + /// + public static KinematicViscosity Nanostokes(this T value) => + KinematicViscosity.FromNanostokes(Convert.ToDouble(value)); - /// - public static KinematicViscosity SquareMetersPerSecond(this T value) => - KinematicViscosity.FromSquareMetersPerSecond(Convert.ToDouble(value)); + /// + public static KinematicViscosity SquareMetersPerSecond(this T value) => + KinematicViscosity.FromSquareMetersPerSecond(Convert.ToDouble(value)); - /// - public static KinematicViscosity Stokes(this T value) => - KinematicViscosity.FromStokes(Convert.ToDouble(value)); + /// + public static KinematicViscosity Stokes(this T value) => + KinematicViscosity.FromStokes(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToLapseRateExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToLapseRateExtensions.g.cs index e80f4d7a13..1594dd1ad1 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToLapseRateExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToLapseRateExtensions.g.cs @@ -28,9 +28,9 @@ namespace UnitsNet.NumberExtensions.NumberToLapseRate /// public static class NumberToLapseRateExtensions { - /// - public static LapseRate DegreesCelciusPerKilometer(this T value) => - LapseRate.FromDegreesCelciusPerKilometer(Convert.ToDouble(value)); + /// + public static LapseRate DegreesCelciusPerKilometer(this T value) => + LapseRate.FromDegreesCelciusPerKilometer(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToLengthExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToLengthExtensions.g.cs index f1f5e9245d..5f6b4577e0 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToLengthExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToLengthExtensions.g.cs @@ -28,137 +28,137 @@ namespace UnitsNet.NumberExtensions.NumberToLength /// public static class NumberToLengthExtensions { - /// - public static Length AstronomicalUnits(this T value) => - Length.FromAstronomicalUnits(Convert.ToDouble(value)); + /// + public static Length AstronomicalUnits(this T value) => + Length.FromAstronomicalUnits(Convert.ToDouble(value)); - /// - public static Length Centimeters(this T value) => - Length.FromCentimeters(Convert.ToDouble(value)); + /// + public static Length Centimeters(this T value) => + Length.FromCentimeters(Convert.ToDouble(value)); - /// - public static Length Chains(this T value) => - Length.FromChains(Convert.ToDouble(value)); + /// + public static Length Chains(this T value) => + Length.FromChains(Convert.ToDouble(value)); - /// - public static Length Decimeters(this T value) => - Length.FromDecimeters(Convert.ToDouble(value)); + /// + public static Length Decimeters(this T value) => + Length.FromDecimeters(Convert.ToDouble(value)); - /// - public static Length DtpPicas(this T value) => - Length.FromDtpPicas(Convert.ToDouble(value)); + /// + public static Length DtpPicas(this T value) => + Length.FromDtpPicas(Convert.ToDouble(value)); - /// - public static Length DtpPoints(this T value) => - Length.FromDtpPoints(Convert.ToDouble(value)); + /// + public static Length DtpPoints(this T value) => + Length.FromDtpPoints(Convert.ToDouble(value)); - /// - public static Length Fathoms(this T value) => - Length.FromFathoms(Convert.ToDouble(value)); + /// + public static Length Fathoms(this T value) => + Length.FromFathoms(Convert.ToDouble(value)); - /// - public static Length Feet(this T value) => - Length.FromFeet(Convert.ToDouble(value)); + /// + public static Length Feet(this T value) => + Length.FromFeet(Convert.ToDouble(value)); - /// - public static Length Hands(this T value) => - Length.FromHands(Convert.ToDouble(value)); + /// + public static Length Hands(this T value) => + Length.FromHands(Convert.ToDouble(value)); - /// - public static Length Hectometers(this T value) => - Length.FromHectometers(Convert.ToDouble(value)); + /// + public static Length Hectometers(this T value) => + Length.FromHectometers(Convert.ToDouble(value)); - /// - public static Length Inches(this T value) => - Length.FromInches(Convert.ToDouble(value)); + /// + public static Length Inches(this T value) => + Length.FromInches(Convert.ToDouble(value)); - /// - public static Length KilolightYears(this T value) => - Length.FromKilolightYears(Convert.ToDouble(value)); + /// + public static Length KilolightYears(this T value) => + Length.FromKilolightYears(Convert.ToDouble(value)); - /// - public static Length Kilometers(this T value) => - Length.FromKilometers(Convert.ToDouble(value)); + /// + public static Length Kilometers(this T value) => + Length.FromKilometers(Convert.ToDouble(value)); - /// - public static Length Kiloparsecs(this T value) => - Length.FromKiloparsecs(Convert.ToDouble(value)); + /// + public static Length Kiloparsecs(this T value) => + Length.FromKiloparsecs(Convert.ToDouble(value)); - /// - public static Length LightYears(this T value) => - Length.FromLightYears(Convert.ToDouble(value)); + /// + public static Length LightYears(this T value) => + Length.FromLightYears(Convert.ToDouble(value)); - /// - public static Length MegalightYears(this T value) => - Length.FromMegalightYears(Convert.ToDouble(value)); + /// + public static Length MegalightYears(this T value) => + Length.FromMegalightYears(Convert.ToDouble(value)); - /// - public static Length Megaparsecs(this T value) => - Length.FromMegaparsecs(Convert.ToDouble(value)); + /// + public static Length Megaparsecs(this T value) => + Length.FromMegaparsecs(Convert.ToDouble(value)); - /// - public static Length Meters(this T value) => - Length.FromMeters(Convert.ToDouble(value)); + /// + public static Length Meters(this T value) => + Length.FromMeters(Convert.ToDouble(value)); - /// - public static Length Microinches(this T value) => - Length.FromMicroinches(Convert.ToDouble(value)); + /// + public static Length Microinches(this T value) => + Length.FromMicroinches(Convert.ToDouble(value)); - /// - public static Length Micrometers(this T value) => - Length.FromMicrometers(Convert.ToDouble(value)); + /// + public static Length Micrometers(this T value) => + Length.FromMicrometers(Convert.ToDouble(value)); - /// - public static Length Mils(this T value) => - Length.FromMils(Convert.ToDouble(value)); + /// + public static Length Mils(this T value) => + Length.FromMils(Convert.ToDouble(value)); - /// - public static Length Miles(this T value) => - Length.FromMiles(Convert.ToDouble(value)); + /// + public static Length Miles(this T value) => + Length.FromMiles(Convert.ToDouble(value)); - /// - public static Length Millimeters(this T value) => - Length.FromMillimeters(Convert.ToDouble(value)); + /// + public static Length Millimeters(this T value) => + Length.FromMillimeters(Convert.ToDouble(value)); - /// - public static Length Nanometers(this T value) => - Length.FromNanometers(Convert.ToDouble(value)); + /// + public static Length Nanometers(this T value) => + Length.FromNanometers(Convert.ToDouble(value)); - /// - public static Length NauticalMiles(this T value) => - Length.FromNauticalMiles(Convert.ToDouble(value)); + /// + public static Length NauticalMiles(this T value) => + Length.FromNauticalMiles(Convert.ToDouble(value)); - /// - public static Length Parsecs(this T value) => - Length.FromParsecs(Convert.ToDouble(value)); + /// + public static Length Parsecs(this T value) => + Length.FromParsecs(Convert.ToDouble(value)); - /// - public static Length PrinterPicas(this T value) => - Length.FromPrinterPicas(Convert.ToDouble(value)); + /// + public static Length PrinterPicas(this T value) => + Length.FromPrinterPicas(Convert.ToDouble(value)); - /// - public static Length PrinterPoints(this T value) => - Length.FromPrinterPoints(Convert.ToDouble(value)); + /// + public static Length PrinterPoints(this T value) => + Length.FromPrinterPoints(Convert.ToDouble(value)); - /// - public static Length Shackles(this T value) => - Length.FromShackles(Convert.ToDouble(value)); + /// + public static Length Shackles(this T value) => + Length.FromShackles(Convert.ToDouble(value)); - /// - public static Length SolarRadiuses(this T value) => - Length.FromSolarRadiuses(Convert.ToDouble(value)); + /// + public static Length SolarRadiuses(this T value) => + Length.FromSolarRadiuses(Convert.ToDouble(value)); - /// - public static Length Twips(this T value) => - Length.FromTwips(Convert.ToDouble(value)); + /// + public static Length Twips(this T value) => + Length.FromTwips(Convert.ToDouble(value)); - /// - public static Length UsSurveyFeet(this T value) => - Length.FromUsSurveyFeet(Convert.ToDouble(value)); + /// + public static Length UsSurveyFeet(this T value) => + Length.FromUsSurveyFeet(Convert.ToDouble(value)); - /// - public static Length Yards(this T value) => - Length.FromYards(Convert.ToDouble(value)); + /// + public static Length Yards(this T value) => + Length.FromYards(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToLevelExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToLevelExtensions.g.cs index 80242ee0a7..c71c4e26e2 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToLevelExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToLevelExtensions.g.cs @@ -28,13 +28,13 @@ namespace UnitsNet.NumberExtensions.NumberToLevel /// public static class NumberToLevelExtensions { - /// - public static Level Decibels(this T value) => - Level.FromDecibels(Convert.ToDouble(value)); + /// + public static Level Decibels(this T value) => + Level.FromDecibels(Convert.ToDouble(value)); - /// - public static Level Nepers(this T value) => - Level.FromNepers(Convert.ToDouble(value)); + /// + public static Level Nepers(this T value) => + Level.FromNepers(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToLinearDensityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToLinearDensityExtensions.g.cs index 36eebf3c54..61b83e0c8a 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToLinearDensityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToLinearDensityExtensions.g.cs @@ -28,61 +28,61 @@ namespace UnitsNet.NumberExtensions.NumberToLinearDensity /// public static class NumberToLinearDensityExtensions { - /// - public static LinearDensity GramsPerCentimeter(this T value) => - LinearDensity.FromGramsPerCentimeter(Convert.ToDouble(value)); + /// + public static LinearDensity GramsPerCentimeter(this T value) => + LinearDensity.FromGramsPerCentimeter(Convert.ToDouble(value)); - /// - public static LinearDensity GramsPerMeter(this T value) => - LinearDensity.FromGramsPerMeter(Convert.ToDouble(value)); + /// + public static LinearDensity GramsPerMeter(this T value) => + LinearDensity.FromGramsPerMeter(Convert.ToDouble(value)); - /// - public static LinearDensity GramsPerMillimeter(this T value) => - LinearDensity.FromGramsPerMillimeter(Convert.ToDouble(value)); + /// + public static LinearDensity GramsPerMillimeter(this T value) => + LinearDensity.FromGramsPerMillimeter(Convert.ToDouble(value)); - /// - public static LinearDensity KilogramsPerCentimeter(this T value) => - LinearDensity.FromKilogramsPerCentimeter(Convert.ToDouble(value)); + /// + public static LinearDensity KilogramsPerCentimeter(this T value) => + LinearDensity.FromKilogramsPerCentimeter(Convert.ToDouble(value)); - /// - public static LinearDensity KilogramsPerMeter(this T value) => - LinearDensity.FromKilogramsPerMeter(Convert.ToDouble(value)); + /// + public static LinearDensity KilogramsPerMeter(this T value) => + LinearDensity.FromKilogramsPerMeter(Convert.ToDouble(value)); - /// - public static LinearDensity KilogramsPerMillimeter(this T value) => - LinearDensity.FromKilogramsPerMillimeter(Convert.ToDouble(value)); + /// + public static LinearDensity KilogramsPerMillimeter(this T value) => + LinearDensity.FromKilogramsPerMillimeter(Convert.ToDouble(value)); - /// - public static LinearDensity MicrogramsPerCentimeter(this T value) => - LinearDensity.FromMicrogramsPerCentimeter(Convert.ToDouble(value)); + /// + public static LinearDensity MicrogramsPerCentimeter(this T value) => + LinearDensity.FromMicrogramsPerCentimeter(Convert.ToDouble(value)); - /// - public static LinearDensity MicrogramsPerMeter(this T value) => - LinearDensity.FromMicrogramsPerMeter(Convert.ToDouble(value)); + /// + public static LinearDensity MicrogramsPerMeter(this T value) => + LinearDensity.FromMicrogramsPerMeter(Convert.ToDouble(value)); - /// - public static LinearDensity MicrogramsPerMillimeter(this T value) => - LinearDensity.FromMicrogramsPerMillimeter(Convert.ToDouble(value)); + /// + public static LinearDensity MicrogramsPerMillimeter(this T value) => + LinearDensity.FromMicrogramsPerMillimeter(Convert.ToDouble(value)); - /// - public static LinearDensity MilligramsPerCentimeter(this T value) => - LinearDensity.FromMilligramsPerCentimeter(Convert.ToDouble(value)); + /// + public static LinearDensity MilligramsPerCentimeter(this T value) => + LinearDensity.FromMilligramsPerCentimeter(Convert.ToDouble(value)); - /// - public static LinearDensity MilligramsPerMeter(this T value) => - LinearDensity.FromMilligramsPerMeter(Convert.ToDouble(value)); + /// + public static LinearDensity MilligramsPerMeter(this T value) => + LinearDensity.FromMilligramsPerMeter(Convert.ToDouble(value)); - /// - public static LinearDensity MilligramsPerMillimeter(this T value) => - LinearDensity.FromMilligramsPerMillimeter(Convert.ToDouble(value)); + /// + public static LinearDensity MilligramsPerMillimeter(this T value) => + LinearDensity.FromMilligramsPerMillimeter(Convert.ToDouble(value)); - /// - public static LinearDensity PoundsPerFoot(this T value) => - LinearDensity.FromPoundsPerFoot(Convert.ToDouble(value)); + /// + public static LinearDensity PoundsPerFoot(this T value) => + LinearDensity.FromPoundsPerFoot(Convert.ToDouble(value)); - /// - public static LinearDensity PoundsPerInch(this T value) => - LinearDensity.FromPoundsPerInch(Convert.ToDouble(value)); + /// + public static LinearDensity PoundsPerInch(this T value) => + LinearDensity.FromPoundsPerInch(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToLinearPowerDensityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToLinearPowerDensityExtensions.g.cs index 0e7a859fa0..ce985b81a4 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToLinearPowerDensityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToLinearPowerDensityExtensions.g.cs @@ -28,105 +28,105 @@ namespace UnitsNet.NumberExtensions.NumberToLinearPowerDensity /// public static class NumberToLinearPowerDensityExtensions { - /// - public static LinearPowerDensity GigawattsPerCentimeter(this T value) => - LinearPowerDensity.FromGigawattsPerCentimeter(Convert.ToDouble(value)); + /// + public static LinearPowerDensity GigawattsPerCentimeter(this T value) => + LinearPowerDensity.FromGigawattsPerCentimeter(Convert.ToDouble(value)); - /// - public static LinearPowerDensity GigawattsPerFoot(this T value) => - LinearPowerDensity.FromGigawattsPerFoot(Convert.ToDouble(value)); + /// + public static LinearPowerDensity GigawattsPerFoot(this T value) => + LinearPowerDensity.FromGigawattsPerFoot(Convert.ToDouble(value)); - /// - public static LinearPowerDensity GigawattsPerInch(this T value) => - LinearPowerDensity.FromGigawattsPerInch(Convert.ToDouble(value)); + /// + public static LinearPowerDensity GigawattsPerInch(this T value) => + LinearPowerDensity.FromGigawattsPerInch(Convert.ToDouble(value)); - /// - public static LinearPowerDensity GigawattsPerMeter(this T value) => - LinearPowerDensity.FromGigawattsPerMeter(Convert.ToDouble(value)); + /// + public static LinearPowerDensity GigawattsPerMeter(this T value) => + LinearPowerDensity.FromGigawattsPerMeter(Convert.ToDouble(value)); - /// - public static LinearPowerDensity GigawattsPerMillimeter(this T value) => - LinearPowerDensity.FromGigawattsPerMillimeter(Convert.ToDouble(value)); + /// + public static LinearPowerDensity GigawattsPerMillimeter(this T value) => + LinearPowerDensity.FromGigawattsPerMillimeter(Convert.ToDouble(value)); - /// - public static LinearPowerDensity KilowattsPerCentimeter(this T value) => - LinearPowerDensity.FromKilowattsPerCentimeter(Convert.ToDouble(value)); + /// + public static LinearPowerDensity KilowattsPerCentimeter(this T value) => + LinearPowerDensity.FromKilowattsPerCentimeter(Convert.ToDouble(value)); - /// - public static LinearPowerDensity KilowattsPerFoot(this T value) => - LinearPowerDensity.FromKilowattsPerFoot(Convert.ToDouble(value)); + /// + public static LinearPowerDensity KilowattsPerFoot(this T value) => + LinearPowerDensity.FromKilowattsPerFoot(Convert.ToDouble(value)); - /// - public static LinearPowerDensity KilowattsPerInch(this T value) => - LinearPowerDensity.FromKilowattsPerInch(Convert.ToDouble(value)); + /// + public static LinearPowerDensity KilowattsPerInch(this T value) => + LinearPowerDensity.FromKilowattsPerInch(Convert.ToDouble(value)); - /// - public static LinearPowerDensity KilowattsPerMeter(this T value) => - LinearPowerDensity.FromKilowattsPerMeter(Convert.ToDouble(value)); + /// + public static LinearPowerDensity KilowattsPerMeter(this T value) => + LinearPowerDensity.FromKilowattsPerMeter(Convert.ToDouble(value)); - /// - public static LinearPowerDensity KilowattsPerMillimeter(this T value) => - LinearPowerDensity.FromKilowattsPerMillimeter(Convert.ToDouble(value)); + /// + public static LinearPowerDensity KilowattsPerMillimeter(this T value) => + LinearPowerDensity.FromKilowattsPerMillimeter(Convert.ToDouble(value)); - /// - public static LinearPowerDensity MegawattsPerCentimeter(this T value) => - LinearPowerDensity.FromMegawattsPerCentimeter(Convert.ToDouble(value)); + /// + public static LinearPowerDensity MegawattsPerCentimeter(this T value) => + LinearPowerDensity.FromMegawattsPerCentimeter(Convert.ToDouble(value)); - /// - public static LinearPowerDensity MegawattsPerFoot(this T value) => - LinearPowerDensity.FromMegawattsPerFoot(Convert.ToDouble(value)); + /// + public static LinearPowerDensity MegawattsPerFoot(this T value) => + LinearPowerDensity.FromMegawattsPerFoot(Convert.ToDouble(value)); - /// - public static LinearPowerDensity MegawattsPerInch(this T value) => - LinearPowerDensity.FromMegawattsPerInch(Convert.ToDouble(value)); + /// + public static LinearPowerDensity MegawattsPerInch(this T value) => + LinearPowerDensity.FromMegawattsPerInch(Convert.ToDouble(value)); - /// - public static LinearPowerDensity MegawattsPerMeter(this T value) => - LinearPowerDensity.FromMegawattsPerMeter(Convert.ToDouble(value)); + /// + public static LinearPowerDensity MegawattsPerMeter(this T value) => + LinearPowerDensity.FromMegawattsPerMeter(Convert.ToDouble(value)); - /// - public static LinearPowerDensity MegawattsPerMillimeter(this T value) => - LinearPowerDensity.FromMegawattsPerMillimeter(Convert.ToDouble(value)); + /// + public static LinearPowerDensity MegawattsPerMillimeter(this T value) => + LinearPowerDensity.FromMegawattsPerMillimeter(Convert.ToDouble(value)); - /// - public static LinearPowerDensity MilliwattsPerCentimeter(this T value) => - LinearPowerDensity.FromMilliwattsPerCentimeter(Convert.ToDouble(value)); + /// + public static LinearPowerDensity MilliwattsPerCentimeter(this T value) => + LinearPowerDensity.FromMilliwattsPerCentimeter(Convert.ToDouble(value)); - /// - public static LinearPowerDensity MilliwattsPerFoot(this T value) => - LinearPowerDensity.FromMilliwattsPerFoot(Convert.ToDouble(value)); + /// + public static LinearPowerDensity MilliwattsPerFoot(this T value) => + LinearPowerDensity.FromMilliwattsPerFoot(Convert.ToDouble(value)); - /// - public static LinearPowerDensity MilliwattsPerInch(this T value) => - LinearPowerDensity.FromMilliwattsPerInch(Convert.ToDouble(value)); + /// + public static LinearPowerDensity MilliwattsPerInch(this T value) => + LinearPowerDensity.FromMilliwattsPerInch(Convert.ToDouble(value)); - /// - public static LinearPowerDensity MilliwattsPerMeter(this T value) => - LinearPowerDensity.FromMilliwattsPerMeter(Convert.ToDouble(value)); + /// + public static LinearPowerDensity MilliwattsPerMeter(this T value) => + LinearPowerDensity.FromMilliwattsPerMeter(Convert.ToDouble(value)); - /// - public static LinearPowerDensity MilliwattsPerMillimeter(this T value) => - LinearPowerDensity.FromMilliwattsPerMillimeter(Convert.ToDouble(value)); + /// + public static LinearPowerDensity MilliwattsPerMillimeter(this T value) => + LinearPowerDensity.FromMilliwattsPerMillimeter(Convert.ToDouble(value)); - /// - public static LinearPowerDensity WattsPerCentimeter(this T value) => - LinearPowerDensity.FromWattsPerCentimeter(Convert.ToDouble(value)); + /// + public static LinearPowerDensity WattsPerCentimeter(this T value) => + LinearPowerDensity.FromWattsPerCentimeter(Convert.ToDouble(value)); - /// - public static LinearPowerDensity WattsPerFoot(this T value) => - LinearPowerDensity.FromWattsPerFoot(Convert.ToDouble(value)); + /// + public static LinearPowerDensity WattsPerFoot(this T value) => + LinearPowerDensity.FromWattsPerFoot(Convert.ToDouble(value)); - /// - public static LinearPowerDensity WattsPerInch(this T value) => - LinearPowerDensity.FromWattsPerInch(Convert.ToDouble(value)); + /// + public static LinearPowerDensity WattsPerInch(this T value) => + LinearPowerDensity.FromWattsPerInch(Convert.ToDouble(value)); - /// - public static LinearPowerDensity WattsPerMeter(this T value) => - LinearPowerDensity.FromWattsPerMeter(Convert.ToDouble(value)); + /// + public static LinearPowerDensity WattsPerMeter(this T value) => + LinearPowerDensity.FromWattsPerMeter(Convert.ToDouble(value)); - /// - public static LinearPowerDensity WattsPerMillimeter(this T value) => - LinearPowerDensity.FromWattsPerMillimeter(Convert.ToDouble(value)); + /// + public static LinearPowerDensity WattsPerMillimeter(this T value) => + LinearPowerDensity.FromWattsPerMillimeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToLuminosityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToLuminosityExtensions.g.cs index 878ac9b958..bac9c8cf9d 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToLuminosityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToLuminosityExtensions.g.cs @@ -28,61 +28,61 @@ namespace UnitsNet.NumberExtensions.NumberToLuminosity /// public static class NumberToLuminosityExtensions { - /// - public static Luminosity Decawatts(this T value) => - Luminosity.FromDecawatts(Convert.ToDouble(value)); + /// + public static Luminosity Decawatts(this T value) => + Luminosity.FromDecawatts(Convert.ToDouble(value)); - /// - public static Luminosity Deciwatts(this T value) => - Luminosity.FromDeciwatts(Convert.ToDouble(value)); + /// + public static Luminosity Deciwatts(this T value) => + Luminosity.FromDeciwatts(Convert.ToDouble(value)); - /// - public static Luminosity Femtowatts(this T value) => - Luminosity.FromFemtowatts(Convert.ToDouble(value)); + /// + public static Luminosity Femtowatts(this T value) => + Luminosity.FromFemtowatts(Convert.ToDouble(value)); - /// - public static Luminosity Gigawatts(this T value) => - Luminosity.FromGigawatts(Convert.ToDouble(value)); + /// + public static Luminosity Gigawatts(this T value) => + Luminosity.FromGigawatts(Convert.ToDouble(value)); - /// - public static Luminosity Kilowatts(this T value) => - Luminosity.FromKilowatts(Convert.ToDouble(value)); + /// + public static Luminosity Kilowatts(this T value) => + Luminosity.FromKilowatts(Convert.ToDouble(value)); - /// - public static Luminosity Megawatts(this T value) => - Luminosity.FromMegawatts(Convert.ToDouble(value)); + /// + public static Luminosity Megawatts(this T value) => + Luminosity.FromMegawatts(Convert.ToDouble(value)); - /// - public static Luminosity Microwatts(this T value) => - Luminosity.FromMicrowatts(Convert.ToDouble(value)); + /// + public static Luminosity Microwatts(this T value) => + Luminosity.FromMicrowatts(Convert.ToDouble(value)); - /// - public static Luminosity Milliwatts(this T value) => - Luminosity.FromMilliwatts(Convert.ToDouble(value)); + /// + public static Luminosity Milliwatts(this T value) => + Luminosity.FromMilliwatts(Convert.ToDouble(value)); - /// - public static Luminosity Nanowatts(this T value) => - Luminosity.FromNanowatts(Convert.ToDouble(value)); + /// + public static Luminosity Nanowatts(this T value) => + Luminosity.FromNanowatts(Convert.ToDouble(value)); - /// - public static Luminosity Petawatts(this T value) => - Luminosity.FromPetawatts(Convert.ToDouble(value)); + /// + public static Luminosity Petawatts(this T value) => + Luminosity.FromPetawatts(Convert.ToDouble(value)); - /// - public static Luminosity Picowatts(this T value) => - Luminosity.FromPicowatts(Convert.ToDouble(value)); + /// + public static Luminosity Picowatts(this T value) => + Luminosity.FromPicowatts(Convert.ToDouble(value)); - /// - public static Luminosity SolarLuminosities(this T value) => - Luminosity.FromSolarLuminosities(Convert.ToDouble(value)); + /// + public static Luminosity SolarLuminosities(this T value) => + Luminosity.FromSolarLuminosities(Convert.ToDouble(value)); - /// - public static Luminosity Terawatts(this T value) => - Luminosity.FromTerawatts(Convert.ToDouble(value)); + /// + public static Luminosity Terawatts(this T value) => + Luminosity.FromTerawatts(Convert.ToDouble(value)); - /// - public static Luminosity Watts(this T value) => - Luminosity.FromWatts(Convert.ToDouble(value)); + /// + public static Luminosity Watts(this T value) => + Luminosity.FromWatts(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToLuminousFluxExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToLuminousFluxExtensions.g.cs index d23550d5a5..b4fdc3b2e9 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToLuminousFluxExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToLuminousFluxExtensions.g.cs @@ -28,9 +28,9 @@ namespace UnitsNet.NumberExtensions.NumberToLuminousFlux /// public static class NumberToLuminousFluxExtensions { - /// - public static LuminousFlux Lumens(this T value) => - LuminousFlux.FromLumens(Convert.ToDouble(value)); + /// + public static LuminousFlux Lumens(this T value) => + LuminousFlux.FromLumens(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToLuminousIntensityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToLuminousIntensityExtensions.g.cs index ce02177e7f..c8db5fe806 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToLuminousIntensityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToLuminousIntensityExtensions.g.cs @@ -28,9 +28,9 @@ namespace UnitsNet.NumberExtensions.NumberToLuminousIntensity /// public static class NumberToLuminousIntensityExtensions { - /// - public static LuminousIntensity Candela(this T value) => - LuminousIntensity.FromCandela(Convert.ToDouble(value)); + /// + public static LuminousIntensity Candela(this T value) => + LuminousIntensity.FromCandela(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMagneticFieldExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMagneticFieldExtensions.g.cs index 722a1c5b1f..5a598cd490 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMagneticFieldExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMagneticFieldExtensions.g.cs @@ -28,25 +28,25 @@ namespace UnitsNet.NumberExtensions.NumberToMagneticField /// public static class NumberToMagneticFieldExtensions { - /// - public static MagneticField Gausses(this T value) => - MagneticField.FromGausses(Convert.ToDouble(value)); + /// + public static MagneticField Gausses(this T value) => + MagneticField.FromGausses(Convert.ToDouble(value)); - /// - public static MagneticField Microteslas(this T value) => - MagneticField.FromMicroteslas(Convert.ToDouble(value)); + /// + public static MagneticField Microteslas(this T value) => + MagneticField.FromMicroteslas(Convert.ToDouble(value)); - /// - public static MagneticField Milliteslas(this T value) => - MagneticField.FromMilliteslas(Convert.ToDouble(value)); + /// + public static MagneticField Milliteslas(this T value) => + MagneticField.FromMilliteslas(Convert.ToDouble(value)); - /// - public static MagneticField Nanoteslas(this T value) => - MagneticField.FromNanoteslas(Convert.ToDouble(value)); + /// + public static MagneticField Nanoteslas(this T value) => + MagneticField.FromNanoteslas(Convert.ToDouble(value)); - /// - public static MagneticField Teslas(this T value) => - MagneticField.FromTeslas(Convert.ToDouble(value)); + /// + public static MagneticField Teslas(this T value) => + MagneticField.FromTeslas(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMagneticFluxExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMagneticFluxExtensions.g.cs index 4c598f62ea..8e20cd9fcf 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMagneticFluxExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMagneticFluxExtensions.g.cs @@ -28,9 +28,9 @@ namespace UnitsNet.NumberExtensions.NumberToMagneticFlux /// public static class NumberToMagneticFluxExtensions { - /// - public static MagneticFlux Webers(this T value) => - MagneticFlux.FromWebers(Convert.ToDouble(value)); + /// + public static MagneticFlux Webers(this T value) => + MagneticFlux.FromWebers(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMagnetizationExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMagnetizationExtensions.g.cs index 28704e19dd..c5431f5ae6 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMagnetizationExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMagnetizationExtensions.g.cs @@ -28,9 +28,9 @@ namespace UnitsNet.NumberExtensions.NumberToMagnetization /// public static class NumberToMagnetizationExtensions { - /// - public static Magnetization AmperesPerMeter(this T value) => - Magnetization.FromAmperesPerMeter(Convert.ToDouble(value)); + /// + public static Magnetization AmperesPerMeter(this T value) => + Magnetization.FromAmperesPerMeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassConcentrationExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassConcentrationExtensions.g.cs index 0979ffa03b..fe99f89054 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassConcentrationExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassConcentrationExtensions.g.cs @@ -28,193 +28,193 @@ namespace UnitsNet.NumberExtensions.NumberToMassConcentration /// public static class NumberToMassConcentrationExtensions { - /// - public static MassConcentration CentigramsPerDeciliter(this T value) => - MassConcentration.FromCentigramsPerDeciliter(Convert.ToDouble(value)); + /// + public static MassConcentration CentigramsPerDeciliter(this T value) => + MassConcentration.FromCentigramsPerDeciliter(Convert.ToDouble(value)); - /// - public static MassConcentration CentigramsPerLiter(this T value) => - MassConcentration.FromCentigramsPerLiter(Convert.ToDouble(value)); + /// + public static MassConcentration CentigramsPerLiter(this T value) => + MassConcentration.FromCentigramsPerLiter(Convert.ToDouble(value)); - /// - public static MassConcentration CentigramsPerMicroliter(this T value) => - MassConcentration.FromCentigramsPerMicroliter(Convert.ToDouble(value)); + /// + public static MassConcentration CentigramsPerMicroliter(this T value) => + MassConcentration.FromCentigramsPerMicroliter(Convert.ToDouble(value)); - /// - public static MassConcentration CentigramsPerMilliliter(this T value) => - MassConcentration.FromCentigramsPerMilliliter(Convert.ToDouble(value)); + /// + public static MassConcentration CentigramsPerMilliliter(this T value) => + MassConcentration.FromCentigramsPerMilliliter(Convert.ToDouble(value)); - /// - public static MassConcentration DecigramsPerDeciliter(this T value) => - MassConcentration.FromDecigramsPerDeciliter(Convert.ToDouble(value)); + /// + public static MassConcentration DecigramsPerDeciliter(this T value) => + MassConcentration.FromDecigramsPerDeciliter(Convert.ToDouble(value)); - /// - public static MassConcentration DecigramsPerLiter(this T value) => - MassConcentration.FromDecigramsPerLiter(Convert.ToDouble(value)); + /// + public static MassConcentration DecigramsPerLiter(this T value) => + MassConcentration.FromDecigramsPerLiter(Convert.ToDouble(value)); - /// - public static MassConcentration DecigramsPerMicroliter(this T value) => - MassConcentration.FromDecigramsPerMicroliter(Convert.ToDouble(value)); + /// + public static MassConcentration DecigramsPerMicroliter(this T value) => + MassConcentration.FromDecigramsPerMicroliter(Convert.ToDouble(value)); - /// - public static MassConcentration DecigramsPerMilliliter(this T value) => - MassConcentration.FromDecigramsPerMilliliter(Convert.ToDouble(value)); + /// + public static MassConcentration DecigramsPerMilliliter(this T value) => + MassConcentration.FromDecigramsPerMilliliter(Convert.ToDouble(value)); - /// - public static MassConcentration GramsPerCubicCentimeter(this T value) => - MassConcentration.FromGramsPerCubicCentimeter(Convert.ToDouble(value)); + /// + public static MassConcentration GramsPerCubicCentimeter(this T value) => + MassConcentration.FromGramsPerCubicCentimeter(Convert.ToDouble(value)); - /// - public static MassConcentration GramsPerCubicMeter(this T value) => - MassConcentration.FromGramsPerCubicMeter(Convert.ToDouble(value)); + /// + public static MassConcentration GramsPerCubicMeter(this T value) => + MassConcentration.FromGramsPerCubicMeter(Convert.ToDouble(value)); - /// - public static MassConcentration GramsPerCubicMillimeter(this T value) => - MassConcentration.FromGramsPerCubicMillimeter(Convert.ToDouble(value)); + /// + public static MassConcentration GramsPerCubicMillimeter(this T value) => + MassConcentration.FromGramsPerCubicMillimeter(Convert.ToDouble(value)); - /// - public static MassConcentration GramsPerDeciliter(this T value) => - MassConcentration.FromGramsPerDeciliter(Convert.ToDouble(value)); + /// + public static MassConcentration GramsPerDeciliter(this T value) => + MassConcentration.FromGramsPerDeciliter(Convert.ToDouble(value)); - /// - public static MassConcentration GramsPerLiter(this T value) => - MassConcentration.FromGramsPerLiter(Convert.ToDouble(value)); + /// + public static MassConcentration GramsPerLiter(this T value) => + MassConcentration.FromGramsPerLiter(Convert.ToDouble(value)); - /// - public static MassConcentration GramsPerMicroliter(this T value) => - MassConcentration.FromGramsPerMicroliter(Convert.ToDouble(value)); + /// + public static MassConcentration GramsPerMicroliter(this T value) => + MassConcentration.FromGramsPerMicroliter(Convert.ToDouble(value)); - /// - public static MassConcentration GramsPerMilliliter(this T value) => - MassConcentration.FromGramsPerMilliliter(Convert.ToDouble(value)); + /// + public static MassConcentration GramsPerMilliliter(this T value) => + MassConcentration.FromGramsPerMilliliter(Convert.ToDouble(value)); - /// - public static MassConcentration KilogramsPerCubicCentimeter(this T value) => - MassConcentration.FromKilogramsPerCubicCentimeter(Convert.ToDouble(value)); + /// + public static MassConcentration KilogramsPerCubicCentimeter(this T value) => + MassConcentration.FromKilogramsPerCubicCentimeter(Convert.ToDouble(value)); - /// - public static MassConcentration KilogramsPerCubicMeter(this T value) => - MassConcentration.FromKilogramsPerCubicMeter(Convert.ToDouble(value)); + /// + public static MassConcentration KilogramsPerCubicMeter(this T value) => + MassConcentration.FromKilogramsPerCubicMeter(Convert.ToDouble(value)); - /// - public static MassConcentration KilogramsPerCubicMillimeter(this T value) => - MassConcentration.FromKilogramsPerCubicMillimeter(Convert.ToDouble(value)); + /// + public static MassConcentration KilogramsPerCubicMillimeter(this T value) => + MassConcentration.FromKilogramsPerCubicMillimeter(Convert.ToDouble(value)); - /// - public static MassConcentration KilogramsPerLiter(this T value) => - MassConcentration.FromKilogramsPerLiter(Convert.ToDouble(value)); + /// + public static MassConcentration KilogramsPerLiter(this T value) => + MassConcentration.FromKilogramsPerLiter(Convert.ToDouble(value)); - /// - public static MassConcentration KilopoundsPerCubicFoot(this T value) => - MassConcentration.FromKilopoundsPerCubicFoot(Convert.ToDouble(value)); + /// + public static MassConcentration KilopoundsPerCubicFoot(this T value) => + MassConcentration.FromKilopoundsPerCubicFoot(Convert.ToDouble(value)); - /// - public static MassConcentration KilopoundsPerCubicInch(this T value) => - MassConcentration.FromKilopoundsPerCubicInch(Convert.ToDouble(value)); + /// + public static MassConcentration KilopoundsPerCubicInch(this T value) => + MassConcentration.FromKilopoundsPerCubicInch(Convert.ToDouble(value)); - /// - public static MassConcentration MicrogramsPerCubicMeter(this T value) => - MassConcentration.FromMicrogramsPerCubicMeter(Convert.ToDouble(value)); + /// + public static MassConcentration MicrogramsPerCubicMeter(this T value) => + MassConcentration.FromMicrogramsPerCubicMeter(Convert.ToDouble(value)); - /// - public static MassConcentration MicrogramsPerDeciliter(this T value) => - MassConcentration.FromMicrogramsPerDeciliter(Convert.ToDouble(value)); + /// + public static MassConcentration MicrogramsPerDeciliter(this T value) => + MassConcentration.FromMicrogramsPerDeciliter(Convert.ToDouble(value)); - /// - public static MassConcentration MicrogramsPerLiter(this T value) => - MassConcentration.FromMicrogramsPerLiter(Convert.ToDouble(value)); + /// + public static MassConcentration MicrogramsPerLiter(this T value) => + MassConcentration.FromMicrogramsPerLiter(Convert.ToDouble(value)); - /// - public static MassConcentration MicrogramsPerMicroliter(this T value) => - MassConcentration.FromMicrogramsPerMicroliter(Convert.ToDouble(value)); + /// + public static MassConcentration MicrogramsPerMicroliter(this T value) => + MassConcentration.FromMicrogramsPerMicroliter(Convert.ToDouble(value)); - /// - public static MassConcentration MicrogramsPerMilliliter(this T value) => - MassConcentration.FromMicrogramsPerMilliliter(Convert.ToDouble(value)); + /// + public static MassConcentration MicrogramsPerMilliliter(this T value) => + MassConcentration.FromMicrogramsPerMilliliter(Convert.ToDouble(value)); - /// - public static MassConcentration MilligramsPerCubicMeter(this T value) => - MassConcentration.FromMilligramsPerCubicMeter(Convert.ToDouble(value)); + /// + public static MassConcentration MilligramsPerCubicMeter(this T value) => + MassConcentration.FromMilligramsPerCubicMeter(Convert.ToDouble(value)); - /// - public static MassConcentration MilligramsPerDeciliter(this T value) => - MassConcentration.FromMilligramsPerDeciliter(Convert.ToDouble(value)); + /// + public static MassConcentration MilligramsPerDeciliter(this T value) => + MassConcentration.FromMilligramsPerDeciliter(Convert.ToDouble(value)); - /// - public static MassConcentration MilligramsPerLiter(this T value) => - MassConcentration.FromMilligramsPerLiter(Convert.ToDouble(value)); + /// + public static MassConcentration MilligramsPerLiter(this T value) => + MassConcentration.FromMilligramsPerLiter(Convert.ToDouble(value)); - /// - public static MassConcentration MilligramsPerMicroliter(this T value) => - MassConcentration.FromMilligramsPerMicroliter(Convert.ToDouble(value)); + /// + public static MassConcentration MilligramsPerMicroliter(this T value) => + MassConcentration.FromMilligramsPerMicroliter(Convert.ToDouble(value)); - /// - public static MassConcentration MilligramsPerMilliliter(this T value) => - MassConcentration.FromMilligramsPerMilliliter(Convert.ToDouble(value)); + /// + public static MassConcentration MilligramsPerMilliliter(this T value) => + MassConcentration.FromMilligramsPerMilliliter(Convert.ToDouble(value)); - /// - public static MassConcentration NanogramsPerDeciliter(this T value) => - MassConcentration.FromNanogramsPerDeciliter(Convert.ToDouble(value)); + /// + public static MassConcentration NanogramsPerDeciliter(this T value) => + MassConcentration.FromNanogramsPerDeciliter(Convert.ToDouble(value)); - /// - public static MassConcentration NanogramsPerLiter(this T value) => - MassConcentration.FromNanogramsPerLiter(Convert.ToDouble(value)); + /// + public static MassConcentration NanogramsPerLiter(this T value) => + MassConcentration.FromNanogramsPerLiter(Convert.ToDouble(value)); - /// - public static MassConcentration NanogramsPerMicroliter(this T value) => - MassConcentration.FromNanogramsPerMicroliter(Convert.ToDouble(value)); + /// + public static MassConcentration NanogramsPerMicroliter(this T value) => + MassConcentration.FromNanogramsPerMicroliter(Convert.ToDouble(value)); - /// - public static MassConcentration NanogramsPerMilliliter(this T value) => - MassConcentration.FromNanogramsPerMilliliter(Convert.ToDouble(value)); + /// + public static MassConcentration NanogramsPerMilliliter(this T value) => + MassConcentration.FromNanogramsPerMilliliter(Convert.ToDouble(value)); - /// - public static MassConcentration PicogramsPerDeciliter(this T value) => - MassConcentration.FromPicogramsPerDeciliter(Convert.ToDouble(value)); + /// + public static MassConcentration PicogramsPerDeciliter(this T value) => + MassConcentration.FromPicogramsPerDeciliter(Convert.ToDouble(value)); - /// - public static MassConcentration PicogramsPerLiter(this T value) => - MassConcentration.FromPicogramsPerLiter(Convert.ToDouble(value)); + /// + public static MassConcentration PicogramsPerLiter(this T value) => + MassConcentration.FromPicogramsPerLiter(Convert.ToDouble(value)); - /// - public static MassConcentration PicogramsPerMicroliter(this T value) => - MassConcentration.FromPicogramsPerMicroliter(Convert.ToDouble(value)); + /// + public static MassConcentration PicogramsPerMicroliter(this T value) => + MassConcentration.FromPicogramsPerMicroliter(Convert.ToDouble(value)); - /// - public static MassConcentration PicogramsPerMilliliter(this T value) => - MassConcentration.FromPicogramsPerMilliliter(Convert.ToDouble(value)); + /// + public static MassConcentration PicogramsPerMilliliter(this T value) => + MassConcentration.FromPicogramsPerMilliliter(Convert.ToDouble(value)); - /// - public static MassConcentration PoundsPerCubicFoot(this T value) => - MassConcentration.FromPoundsPerCubicFoot(Convert.ToDouble(value)); + /// + public static MassConcentration PoundsPerCubicFoot(this T value) => + MassConcentration.FromPoundsPerCubicFoot(Convert.ToDouble(value)); - /// - public static MassConcentration PoundsPerCubicInch(this T value) => - MassConcentration.FromPoundsPerCubicInch(Convert.ToDouble(value)); + /// + public static MassConcentration PoundsPerCubicInch(this T value) => + MassConcentration.FromPoundsPerCubicInch(Convert.ToDouble(value)); - /// - public static MassConcentration PoundsPerImperialGallon(this T value) => - MassConcentration.FromPoundsPerImperialGallon(Convert.ToDouble(value)); + /// + public static MassConcentration PoundsPerImperialGallon(this T value) => + MassConcentration.FromPoundsPerImperialGallon(Convert.ToDouble(value)); - /// - public static MassConcentration PoundsPerUSGallon(this T value) => - MassConcentration.FromPoundsPerUSGallon(Convert.ToDouble(value)); + /// + public static MassConcentration PoundsPerUSGallon(this T value) => + MassConcentration.FromPoundsPerUSGallon(Convert.ToDouble(value)); - /// - public static MassConcentration SlugsPerCubicFoot(this T value) => - MassConcentration.FromSlugsPerCubicFoot(Convert.ToDouble(value)); + /// + public static MassConcentration SlugsPerCubicFoot(this T value) => + MassConcentration.FromSlugsPerCubicFoot(Convert.ToDouble(value)); - /// - public static MassConcentration TonnesPerCubicCentimeter(this T value) => - MassConcentration.FromTonnesPerCubicCentimeter(Convert.ToDouble(value)); + /// + public static MassConcentration TonnesPerCubicCentimeter(this T value) => + MassConcentration.FromTonnesPerCubicCentimeter(Convert.ToDouble(value)); - /// - public static MassConcentration TonnesPerCubicMeter(this T value) => - MassConcentration.FromTonnesPerCubicMeter(Convert.ToDouble(value)); + /// + public static MassConcentration TonnesPerCubicMeter(this T value) => + MassConcentration.FromTonnesPerCubicMeter(Convert.ToDouble(value)); - /// - public static MassConcentration TonnesPerCubicMillimeter(this T value) => - MassConcentration.FromTonnesPerCubicMillimeter(Convert.ToDouble(value)); + /// + public static MassConcentration TonnesPerCubicMillimeter(this T value) => + MassConcentration.FromTonnesPerCubicMillimeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassExtensions.g.cs index 907e00bc31..b18423d07a 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassExtensions.g.cs @@ -28,105 +28,105 @@ namespace UnitsNet.NumberExtensions.NumberToMass /// public static class NumberToMassExtensions { - /// - public static Mass Centigrams(this T value) => - Mass.FromCentigrams(Convert.ToDouble(value)); + /// + public static Mass Centigrams(this T value) => + Mass.FromCentigrams(Convert.ToDouble(value)); - /// - public static Mass Decagrams(this T value) => - Mass.FromDecagrams(Convert.ToDouble(value)); + /// + public static Mass Decagrams(this T value) => + Mass.FromDecagrams(Convert.ToDouble(value)); - /// - public static Mass Decigrams(this T value) => - Mass.FromDecigrams(Convert.ToDouble(value)); + /// + public static Mass Decigrams(this T value) => + Mass.FromDecigrams(Convert.ToDouble(value)); - /// - public static Mass EarthMasses(this T value) => - Mass.FromEarthMasses(Convert.ToDouble(value)); + /// + public static Mass EarthMasses(this T value) => + Mass.FromEarthMasses(Convert.ToDouble(value)); - /// - public static Mass Grains(this T value) => - Mass.FromGrains(Convert.ToDouble(value)); + /// + public static Mass Grains(this T value) => + Mass.FromGrains(Convert.ToDouble(value)); - /// - public static Mass Grams(this T value) => - Mass.FromGrams(Convert.ToDouble(value)); + /// + public static Mass Grams(this T value) => + Mass.FromGrams(Convert.ToDouble(value)); - /// - public static Mass Hectograms(this T value) => - Mass.FromHectograms(Convert.ToDouble(value)); + /// + public static Mass Hectograms(this T value) => + Mass.FromHectograms(Convert.ToDouble(value)); - /// - public static Mass Kilograms(this T value) => - Mass.FromKilograms(Convert.ToDouble(value)); + /// + public static Mass Kilograms(this T value) => + Mass.FromKilograms(Convert.ToDouble(value)); - /// - public static Mass Kilopounds(this T value) => - Mass.FromKilopounds(Convert.ToDouble(value)); + /// + public static Mass Kilopounds(this T value) => + Mass.FromKilopounds(Convert.ToDouble(value)); - /// - public static Mass Kilotonnes(this T value) => - Mass.FromKilotonnes(Convert.ToDouble(value)); + /// + public static Mass Kilotonnes(this T value) => + Mass.FromKilotonnes(Convert.ToDouble(value)); - /// - public static Mass LongHundredweight(this T value) => - Mass.FromLongHundredweight(Convert.ToDouble(value)); + /// + public static Mass LongHundredweight(this T value) => + Mass.FromLongHundredweight(Convert.ToDouble(value)); - /// - public static Mass LongTons(this T value) => - Mass.FromLongTons(Convert.ToDouble(value)); + /// + public static Mass LongTons(this T value) => + Mass.FromLongTons(Convert.ToDouble(value)); - /// - public static Mass Megapounds(this T value) => - Mass.FromMegapounds(Convert.ToDouble(value)); + /// + public static Mass Megapounds(this T value) => + Mass.FromMegapounds(Convert.ToDouble(value)); - /// - public static Mass Megatonnes(this T value) => - Mass.FromMegatonnes(Convert.ToDouble(value)); + /// + public static Mass Megatonnes(this T value) => + Mass.FromMegatonnes(Convert.ToDouble(value)); - /// - public static Mass Micrograms(this T value) => - Mass.FromMicrograms(Convert.ToDouble(value)); + /// + public static Mass Micrograms(this T value) => + Mass.FromMicrograms(Convert.ToDouble(value)); - /// - public static Mass Milligrams(this T value) => - Mass.FromMilligrams(Convert.ToDouble(value)); + /// + public static Mass Milligrams(this T value) => + Mass.FromMilligrams(Convert.ToDouble(value)); - /// - public static Mass Nanograms(this T value) => - Mass.FromNanograms(Convert.ToDouble(value)); + /// + public static Mass Nanograms(this T value) => + Mass.FromNanograms(Convert.ToDouble(value)); - /// - public static Mass Ounces(this T value) => - Mass.FromOunces(Convert.ToDouble(value)); + /// + public static Mass Ounces(this T value) => + Mass.FromOunces(Convert.ToDouble(value)); - /// - public static Mass Pounds(this T value) => - Mass.FromPounds(Convert.ToDouble(value)); + /// + public static Mass Pounds(this T value) => + Mass.FromPounds(Convert.ToDouble(value)); - /// - public static Mass ShortHundredweight(this T value) => - Mass.FromShortHundredweight(Convert.ToDouble(value)); + /// + public static Mass ShortHundredweight(this T value) => + Mass.FromShortHundredweight(Convert.ToDouble(value)); - /// - public static Mass ShortTons(this T value) => - Mass.FromShortTons(Convert.ToDouble(value)); + /// + public static Mass ShortTons(this T value) => + Mass.FromShortTons(Convert.ToDouble(value)); - /// - public static Mass Slugs(this T value) => - Mass.FromSlugs(Convert.ToDouble(value)); + /// + public static Mass Slugs(this T value) => + Mass.FromSlugs(Convert.ToDouble(value)); - /// - public static Mass SolarMasses(this T value) => - Mass.FromSolarMasses(Convert.ToDouble(value)); + /// + public static Mass SolarMasses(this T value) => + Mass.FromSolarMasses(Convert.ToDouble(value)); - /// - public static Mass Stone(this T value) => - Mass.FromStone(Convert.ToDouble(value)); + /// + public static Mass Stone(this T value) => + Mass.FromStone(Convert.ToDouble(value)); - /// - public static Mass Tonnes(this T value) => - Mass.FromTonnes(Convert.ToDouble(value)); + /// + public static Mass Tonnes(this T value) => + Mass.FromTonnes(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassFlowExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassFlowExtensions.g.cs index 9217485672..249aaeccfe 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassFlowExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassFlowExtensions.g.cs @@ -28,137 +28,137 @@ namespace UnitsNet.NumberExtensions.NumberToMassFlow /// public static class NumberToMassFlowExtensions { - /// - public static MassFlow CentigramsPerDay(this T value) => - MassFlow.FromCentigramsPerDay(Convert.ToDouble(value)); + /// + public static MassFlow CentigramsPerDay(this T value) => + MassFlow.FromCentigramsPerDay(Convert.ToDouble(value)); - /// - public static MassFlow CentigramsPerSecond(this T value) => - MassFlow.FromCentigramsPerSecond(Convert.ToDouble(value)); + /// + public static MassFlow CentigramsPerSecond(this T value) => + MassFlow.FromCentigramsPerSecond(Convert.ToDouble(value)); - /// - public static MassFlow DecagramsPerDay(this T value) => - MassFlow.FromDecagramsPerDay(Convert.ToDouble(value)); + /// + public static MassFlow DecagramsPerDay(this T value) => + MassFlow.FromDecagramsPerDay(Convert.ToDouble(value)); - /// - public static MassFlow DecagramsPerSecond(this T value) => - MassFlow.FromDecagramsPerSecond(Convert.ToDouble(value)); + /// + public static MassFlow DecagramsPerSecond(this T value) => + MassFlow.FromDecagramsPerSecond(Convert.ToDouble(value)); - /// - public static MassFlow DecigramsPerDay(this T value) => - MassFlow.FromDecigramsPerDay(Convert.ToDouble(value)); + /// + public static MassFlow DecigramsPerDay(this T value) => + MassFlow.FromDecigramsPerDay(Convert.ToDouble(value)); - /// - public static MassFlow DecigramsPerSecond(this T value) => - MassFlow.FromDecigramsPerSecond(Convert.ToDouble(value)); + /// + public static MassFlow DecigramsPerSecond(this T value) => + MassFlow.FromDecigramsPerSecond(Convert.ToDouble(value)); - /// - public static MassFlow GramsPerDay(this T value) => - MassFlow.FromGramsPerDay(Convert.ToDouble(value)); + /// + public static MassFlow GramsPerDay(this T value) => + MassFlow.FromGramsPerDay(Convert.ToDouble(value)); - /// - public static MassFlow GramsPerHour(this T value) => - MassFlow.FromGramsPerHour(Convert.ToDouble(value)); + /// + public static MassFlow GramsPerHour(this T value) => + MassFlow.FromGramsPerHour(Convert.ToDouble(value)); - /// - public static MassFlow GramsPerSecond(this T value) => - MassFlow.FromGramsPerSecond(Convert.ToDouble(value)); + /// + public static MassFlow GramsPerSecond(this T value) => + MassFlow.FromGramsPerSecond(Convert.ToDouble(value)); - /// - public static MassFlow HectogramsPerDay(this T value) => - MassFlow.FromHectogramsPerDay(Convert.ToDouble(value)); + /// + public static MassFlow HectogramsPerDay(this T value) => + MassFlow.FromHectogramsPerDay(Convert.ToDouble(value)); - /// - public static MassFlow HectogramsPerSecond(this T value) => - MassFlow.FromHectogramsPerSecond(Convert.ToDouble(value)); + /// + public static MassFlow HectogramsPerSecond(this T value) => + MassFlow.FromHectogramsPerSecond(Convert.ToDouble(value)); - /// - public static MassFlow KilogramsPerDay(this T value) => - MassFlow.FromKilogramsPerDay(Convert.ToDouble(value)); + /// + public static MassFlow KilogramsPerDay(this T value) => + MassFlow.FromKilogramsPerDay(Convert.ToDouble(value)); - /// - public static MassFlow KilogramsPerHour(this T value) => - MassFlow.FromKilogramsPerHour(Convert.ToDouble(value)); + /// + public static MassFlow KilogramsPerHour(this T value) => + MassFlow.FromKilogramsPerHour(Convert.ToDouble(value)); - /// - public static MassFlow KilogramsPerMinute(this T value) => - MassFlow.FromKilogramsPerMinute(Convert.ToDouble(value)); + /// + public static MassFlow KilogramsPerMinute(this T value) => + MassFlow.FromKilogramsPerMinute(Convert.ToDouble(value)); - /// - public static MassFlow KilogramsPerSecond(this T value) => - MassFlow.FromKilogramsPerSecond(Convert.ToDouble(value)); + /// + public static MassFlow KilogramsPerSecond(this T value) => + MassFlow.FromKilogramsPerSecond(Convert.ToDouble(value)); - /// - public static MassFlow MegagramsPerDay(this T value) => - MassFlow.FromMegagramsPerDay(Convert.ToDouble(value)); + /// + public static MassFlow MegagramsPerDay(this T value) => + MassFlow.FromMegagramsPerDay(Convert.ToDouble(value)); - /// - public static MassFlow MegapoundsPerDay(this T value) => - MassFlow.FromMegapoundsPerDay(Convert.ToDouble(value)); + /// + public static MassFlow MegapoundsPerDay(this T value) => + MassFlow.FromMegapoundsPerDay(Convert.ToDouble(value)); - /// - public static MassFlow MegapoundsPerHour(this T value) => - MassFlow.FromMegapoundsPerHour(Convert.ToDouble(value)); + /// + public static MassFlow MegapoundsPerHour(this T value) => + MassFlow.FromMegapoundsPerHour(Convert.ToDouble(value)); - /// - public static MassFlow MegapoundsPerMinute(this T value) => - MassFlow.FromMegapoundsPerMinute(Convert.ToDouble(value)); + /// + public static MassFlow MegapoundsPerMinute(this T value) => + MassFlow.FromMegapoundsPerMinute(Convert.ToDouble(value)); - /// - public static MassFlow MegapoundsPerSecond(this T value) => - MassFlow.FromMegapoundsPerSecond(Convert.ToDouble(value)); + /// + public static MassFlow MegapoundsPerSecond(this T value) => + MassFlow.FromMegapoundsPerSecond(Convert.ToDouble(value)); - /// - public static MassFlow MicrogramsPerDay(this T value) => - MassFlow.FromMicrogramsPerDay(Convert.ToDouble(value)); + /// + public static MassFlow MicrogramsPerDay(this T value) => + MassFlow.FromMicrogramsPerDay(Convert.ToDouble(value)); - /// - public static MassFlow MicrogramsPerSecond(this T value) => - MassFlow.FromMicrogramsPerSecond(Convert.ToDouble(value)); + /// + public static MassFlow MicrogramsPerSecond(this T value) => + MassFlow.FromMicrogramsPerSecond(Convert.ToDouble(value)); - /// - public static MassFlow MilligramsPerDay(this T value) => - MassFlow.FromMilligramsPerDay(Convert.ToDouble(value)); + /// + public static MassFlow MilligramsPerDay(this T value) => + MassFlow.FromMilligramsPerDay(Convert.ToDouble(value)); - /// - public static MassFlow MilligramsPerSecond(this T value) => - MassFlow.FromMilligramsPerSecond(Convert.ToDouble(value)); + /// + public static MassFlow MilligramsPerSecond(this T value) => + MassFlow.FromMilligramsPerSecond(Convert.ToDouble(value)); - /// - public static MassFlow NanogramsPerDay(this T value) => - MassFlow.FromNanogramsPerDay(Convert.ToDouble(value)); + /// + public static MassFlow NanogramsPerDay(this T value) => + MassFlow.FromNanogramsPerDay(Convert.ToDouble(value)); - /// - public static MassFlow NanogramsPerSecond(this T value) => - MassFlow.FromNanogramsPerSecond(Convert.ToDouble(value)); + /// + public static MassFlow NanogramsPerSecond(this T value) => + MassFlow.FromNanogramsPerSecond(Convert.ToDouble(value)); - /// - public static MassFlow PoundsPerDay(this T value) => - MassFlow.FromPoundsPerDay(Convert.ToDouble(value)); + /// + public static MassFlow PoundsPerDay(this T value) => + MassFlow.FromPoundsPerDay(Convert.ToDouble(value)); - /// - public static MassFlow PoundsPerHour(this T value) => - MassFlow.FromPoundsPerHour(Convert.ToDouble(value)); + /// + public static MassFlow PoundsPerHour(this T value) => + MassFlow.FromPoundsPerHour(Convert.ToDouble(value)); - /// - public static MassFlow PoundsPerMinute(this T value) => - MassFlow.FromPoundsPerMinute(Convert.ToDouble(value)); + /// + public static MassFlow PoundsPerMinute(this T value) => + MassFlow.FromPoundsPerMinute(Convert.ToDouble(value)); - /// - public static MassFlow PoundsPerSecond(this T value) => - MassFlow.FromPoundsPerSecond(Convert.ToDouble(value)); + /// + public static MassFlow PoundsPerSecond(this T value) => + MassFlow.FromPoundsPerSecond(Convert.ToDouble(value)); - /// - public static MassFlow ShortTonsPerHour(this T value) => - MassFlow.FromShortTonsPerHour(Convert.ToDouble(value)); + /// + public static MassFlow ShortTonsPerHour(this T value) => + MassFlow.FromShortTonsPerHour(Convert.ToDouble(value)); - /// - public static MassFlow TonnesPerDay(this T value) => - MassFlow.FromTonnesPerDay(Convert.ToDouble(value)); + /// + public static MassFlow TonnesPerDay(this T value) => + MassFlow.FromTonnesPerDay(Convert.ToDouble(value)); - /// - public static MassFlow TonnesPerHour(this T value) => - MassFlow.FromTonnesPerHour(Convert.ToDouble(value)); + /// + public static MassFlow TonnesPerHour(this T value) => + MassFlow.FromTonnesPerHour(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassFluxExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassFluxExtensions.g.cs index a91acf9031..c87fddb181 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassFluxExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassFluxExtensions.g.cs @@ -28,53 +28,53 @@ namespace UnitsNet.NumberExtensions.NumberToMassFlux /// public static class NumberToMassFluxExtensions { - /// - public static MassFlux GramsPerHourPerSquareCentimeter(this T value) => - MassFlux.FromGramsPerHourPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static MassFlux GramsPerHourPerSquareCentimeter(this T value) => + MassFlux.FromGramsPerHourPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static MassFlux GramsPerHourPerSquareMeter(this T value) => - MassFlux.FromGramsPerHourPerSquareMeter(Convert.ToDouble(value)); + /// + public static MassFlux GramsPerHourPerSquareMeter(this T value) => + MassFlux.FromGramsPerHourPerSquareMeter(Convert.ToDouble(value)); - /// - public static MassFlux GramsPerHourPerSquareMillimeter(this T value) => - MassFlux.FromGramsPerHourPerSquareMillimeter(Convert.ToDouble(value)); + /// + public static MassFlux GramsPerHourPerSquareMillimeter(this T value) => + MassFlux.FromGramsPerHourPerSquareMillimeter(Convert.ToDouble(value)); - /// - public static MassFlux GramsPerSecondPerSquareCentimeter(this T value) => - MassFlux.FromGramsPerSecondPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static MassFlux GramsPerSecondPerSquareCentimeter(this T value) => + MassFlux.FromGramsPerSecondPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static MassFlux GramsPerSecondPerSquareMeter(this T value) => - MassFlux.FromGramsPerSecondPerSquareMeter(Convert.ToDouble(value)); + /// + public static MassFlux GramsPerSecondPerSquareMeter(this T value) => + MassFlux.FromGramsPerSecondPerSquareMeter(Convert.ToDouble(value)); - /// - public static MassFlux GramsPerSecondPerSquareMillimeter(this T value) => - MassFlux.FromGramsPerSecondPerSquareMillimeter(Convert.ToDouble(value)); + /// + public static MassFlux GramsPerSecondPerSquareMillimeter(this T value) => + MassFlux.FromGramsPerSecondPerSquareMillimeter(Convert.ToDouble(value)); - /// - public static MassFlux KilogramsPerHourPerSquareCentimeter(this T value) => - MassFlux.FromKilogramsPerHourPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static MassFlux KilogramsPerHourPerSquareCentimeter(this T value) => + MassFlux.FromKilogramsPerHourPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static MassFlux KilogramsPerHourPerSquareMeter(this T value) => - MassFlux.FromKilogramsPerHourPerSquareMeter(Convert.ToDouble(value)); + /// + public static MassFlux KilogramsPerHourPerSquareMeter(this T value) => + MassFlux.FromKilogramsPerHourPerSquareMeter(Convert.ToDouble(value)); - /// - public static MassFlux KilogramsPerHourPerSquareMillimeter(this T value) => - MassFlux.FromKilogramsPerHourPerSquareMillimeter(Convert.ToDouble(value)); + /// + public static MassFlux KilogramsPerHourPerSquareMillimeter(this T value) => + MassFlux.FromKilogramsPerHourPerSquareMillimeter(Convert.ToDouble(value)); - /// - public static MassFlux KilogramsPerSecondPerSquareCentimeter(this T value) => - MassFlux.FromKilogramsPerSecondPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static MassFlux KilogramsPerSecondPerSquareCentimeter(this T value) => + MassFlux.FromKilogramsPerSecondPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static MassFlux KilogramsPerSecondPerSquareMeter(this T value) => - MassFlux.FromKilogramsPerSecondPerSquareMeter(Convert.ToDouble(value)); + /// + public static MassFlux KilogramsPerSecondPerSquareMeter(this T value) => + MassFlux.FromKilogramsPerSecondPerSquareMeter(Convert.ToDouble(value)); - /// - public static MassFlux KilogramsPerSecondPerSquareMillimeter(this T value) => - MassFlux.FromKilogramsPerSecondPerSquareMillimeter(Convert.ToDouble(value)); + /// + public static MassFlux KilogramsPerSecondPerSquareMillimeter(this T value) => + MassFlux.FromKilogramsPerSecondPerSquareMillimeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassFractionExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassFractionExtensions.g.cs index 95385c3373..a64e942369 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassFractionExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassFractionExtensions.g.cs @@ -28,101 +28,101 @@ namespace UnitsNet.NumberExtensions.NumberToMassFraction /// public static class NumberToMassFractionExtensions { - /// - public static MassFraction CentigramsPerGram(this T value) => - MassFraction.FromCentigramsPerGram(Convert.ToDouble(value)); + /// + public static MassFraction CentigramsPerGram(this T value) => + MassFraction.FromCentigramsPerGram(Convert.ToDouble(value)); - /// - public static MassFraction CentigramsPerKilogram(this T value) => - MassFraction.FromCentigramsPerKilogram(Convert.ToDouble(value)); + /// + public static MassFraction CentigramsPerKilogram(this T value) => + MassFraction.FromCentigramsPerKilogram(Convert.ToDouble(value)); - /// - public static MassFraction DecagramsPerGram(this T value) => - MassFraction.FromDecagramsPerGram(Convert.ToDouble(value)); + /// + public static MassFraction DecagramsPerGram(this T value) => + MassFraction.FromDecagramsPerGram(Convert.ToDouble(value)); - /// - public static MassFraction DecagramsPerKilogram(this T value) => - MassFraction.FromDecagramsPerKilogram(Convert.ToDouble(value)); + /// + public static MassFraction DecagramsPerKilogram(this T value) => + MassFraction.FromDecagramsPerKilogram(Convert.ToDouble(value)); - /// - public static MassFraction DecigramsPerGram(this T value) => - MassFraction.FromDecigramsPerGram(Convert.ToDouble(value)); + /// + public static MassFraction DecigramsPerGram(this T value) => + MassFraction.FromDecigramsPerGram(Convert.ToDouble(value)); - /// - public static MassFraction DecigramsPerKilogram(this T value) => - MassFraction.FromDecigramsPerKilogram(Convert.ToDouble(value)); + /// + public static MassFraction DecigramsPerKilogram(this T value) => + MassFraction.FromDecigramsPerKilogram(Convert.ToDouble(value)); - /// - public static MassFraction DecimalFractions(this T value) => - MassFraction.FromDecimalFractions(Convert.ToDouble(value)); + /// + public static MassFraction DecimalFractions(this T value) => + MassFraction.FromDecimalFractions(Convert.ToDouble(value)); - /// - public static MassFraction GramsPerGram(this T value) => - MassFraction.FromGramsPerGram(Convert.ToDouble(value)); + /// + public static MassFraction GramsPerGram(this T value) => + MassFraction.FromGramsPerGram(Convert.ToDouble(value)); - /// - public static MassFraction GramsPerKilogram(this T value) => - MassFraction.FromGramsPerKilogram(Convert.ToDouble(value)); + /// + public static MassFraction GramsPerKilogram(this T value) => + MassFraction.FromGramsPerKilogram(Convert.ToDouble(value)); - /// - public static MassFraction HectogramsPerGram(this T value) => - MassFraction.FromHectogramsPerGram(Convert.ToDouble(value)); + /// + public static MassFraction HectogramsPerGram(this T value) => + MassFraction.FromHectogramsPerGram(Convert.ToDouble(value)); - /// - public static MassFraction HectogramsPerKilogram(this T value) => - MassFraction.FromHectogramsPerKilogram(Convert.ToDouble(value)); + /// + public static MassFraction HectogramsPerKilogram(this T value) => + MassFraction.FromHectogramsPerKilogram(Convert.ToDouble(value)); - /// - public static MassFraction KilogramsPerGram(this T value) => - MassFraction.FromKilogramsPerGram(Convert.ToDouble(value)); + /// + public static MassFraction KilogramsPerGram(this T value) => + MassFraction.FromKilogramsPerGram(Convert.ToDouble(value)); - /// - public static MassFraction KilogramsPerKilogram(this T value) => - MassFraction.FromKilogramsPerKilogram(Convert.ToDouble(value)); + /// + public static MassFraction KilogramsPerKilogram(this T value) => + MassFraction.FromKilogramsPerKilogram(Convert.ToDouble(value)); - /// - public static MassFraction MicrogramsPerGram(this T value) => - MassFraction.FromMicrogramsPerGram(Convert.ToDouble(value)); + /// + public static MassFraction MicrogramsPerGram(this T value) => + MassFraction.FromMicrogramsPerGram(Convert.ToDouble(value)); - /// - public static MassFraction MicrogramsPerKilogram(this T value) => - MassFraction.FromMicrogramsPerKilogram(Convert.ToDouble(value)); + /// + public static MassFraction MicrogramsPerKilogram(this T value) => + MassFraction.FromMicrogramsPerKilogram(Convert.ToDouble(value)); - /// - public static MassFraction MilligramsPerGram(this T value) => - MassFraction.FromMilligramsPerGram(Convert.ToDouble(value)); + /// + public static MassFraction MilligramsPerGram(this T value) => + MassFraction.FromMilligramsPerGram(Convert.ToDouble(value)); - /// - public static MassFraction MilligramsPerKilogram(this T value) => - MassFraction.FromMilligramsPerKilogram(Convert.ToDouble(value)); + /// + public static MassFraction MilligramsPerKilogram(this T value) => + MassFraction.FromMilligramsPerKilogram(Convert.ToDouble(value)); - /// - public static MassFraction NanogramsPerGram(this T value) => - MassFraction.FromNanogramsPerGram(Convert.ToDouble(value)); + /// + public static MassFraction NanogramsPerGram(this T value) => + MassFraction.FromNanogramsPerGram(Convert.ToDouble(value)); - /// - public static MassFraction NanogramsPerKilogram(this T value) => - MassFraction.FromNanogramsPerKilogram(Convert.ToDouble(value)); + /// + public static MassFraction NanogramsPerKilogram(this T value) => + MassFraction.FromNanogramsPerKilogram(Convert.ToDouble(value)); - /// - public static MassFraction PartsPerBillion(this T value) => - MassFraction.FromPartsPerBillion(Convert.ToDouble(value)); + /// + public static MassFraction PartsPerBillion(this T value) => + MassFraction.FromPartsPerBillion(Convert.ToDouble(value)); - /// - public static MassFraction PartsPerMillion(this T value) => - MassFraction.FromPartsPerMillion(Convert.ToDouble(value)); + /// + public static MassFraction PartsPerMillion(this T value) => + MassFraction.FromPartsPerMillion(Convert.ToDouble(value)); - /// - public static MassFraction PartsPerThousand(this T value) => - MassFraction.FromPartsPerThousand(Convert.ToDouble(value)); + /// + public static MassFraction PartsPerThousand(this T value) => + MassFraction.FromPartsPerThousand(Convert.ToDouble(value)); - /// - public static MassFraction PartsPerTrillion(this T value) => - MassFraction.FromPartsPerTrillion(Convert.ToDouble(value)); + /// + public static MassFraction PartsPerTrillion(this T value) => + MassFraction.FromPartsPerTrillion(Convert.ToDouble(value)); - /// - public static MassFraction Percent(this T value) => - MassFraction.FromPercent(Convert.ToDouble(value)); + /// + public static MassFraction Percent(this T value) => + MassFraction.FromPercent(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassMomentOfInertiaExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassMomentOfInertiaExtensions.g.cs index c66173ceb9..cf1df3d336 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassMomentOfInertiaExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMassMomentOfInertiaExtensions.g.cs @@ -28,117 +28,117 @@ namespace UnitsNet.NumberExtensions.NumberToMassMomentOfInertia /// public static class NumberToMassMomentOfInertiaExtensions { - /// - public static MassMomentOfInertia GramSquareCentimeters(this T value) => - MassMomentOfInertia.FromGramSquareCentimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia GramSquareCentimeters(this T value) => + MassMomentOfInertia.FromGramSquareCentimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia GramSquareDecimeters(this T value) => - MassMomentOfInertia.FromGramSquareDecimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia GramSquareDecimeters(this T value) => + MassMomentOfInertia.FromGramSquareDecimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia GramSquareMeters(this T value) => - MassMomentOfInertia.FromGramSquareMeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia GramSquareMeters(this T value) => + MassMomentOfInertia.FromGramSquareMeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia GramSquareMillimeters(this T value) => - MassMomentOfInertia.FromGramSquareMillimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia GramSquareMillimeters(this T value) => + MassMomentOfInertia.FromGramSquareMillimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia KilogramSquareCentimeters(this T value) => - MassMomentOfInertia.FromKilogramSquareCentimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia KilogramSquareCentimeters(this T value) => + MassMomentOfInertia.FromKilogramSquareCentimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia KilogramSquareDecimeters(this T value) => - MassMomentOfInertia.FromKilogramSquareDecimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia KilogramSquareDecimeters(this T value) => + MassMomentOfInertia.FromKilogramSquareDecimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia KilogramSquareMeters(this T value) => - MassMomentOfInertia.FromKilogramSquareMeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia KilogramSquareMeters(this T value) => + MassMomentOfInertia.FromKilogramSquareMeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia KilogramSquareMillimeters(this T value) => - MassMomentOfInertia.FromKilogramSquareMillimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia KilogramSquareMillimeters(this T value) => + MassMomentOfInertia.FromKilogramSquareMillimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia KilotonneSquareCentimeters(this T value) => - MassMomentOfInertia.FromKilotonneSquareCentimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia KilotonneSquareCentimeters(this T value) => + MassMomentOfInertia.FromKilotonneSquareCentimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia KilotonneSquareDecimeters(this T value) => - MassMomentOfInertia.FromKilotonneSquareDecimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia KilotonneSquareDecimeters(this T value) => + MassMomentOfInertia.FromKilotonneSquareDecimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia KilotonneSquareMeters(this T value) => - MassMomentOfInertia.FromKilotonneSquareMeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia KilotonneSquareMeters(this T value) => + MassMomentOfInertia.FromKilotonneSquareMeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia KilotonneSquareMilimeters(this T value) => - MassMomentOfInertia.FromKilotonneSquareMilimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia KilotonneSquareMilimeters(this T value) => + MassMomentOfInertia.FromKilotonneSquareMilimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia MegatonneSquareCentimeters(this T value) => - MassMomentOfInertia.FromMegatonneSquareCentimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia MegatonneSquareCentimeters(this T value) => + MassMomentOfInertia.FromMegatonneSquareCentimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia MegatonneSquareDecimeters(this T value) => - MassMomentOfInertia.FromMegatonneSquareDecimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia MegatonneSquareDecimeters(this T value) => + MassMomentOfInertia.FromMegatonneSquareDecimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia MegatonneSquareMeters(this T value) => - MassMomentOfInertia.FromMegatonneSquareMeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia MegatonneSquareMeters(this T value) => + MassMomentOfInertia.FromMegatonneSquareMeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia MegatonneSquareMilimeters(this T value) => - MassMomentOfInertia.FromMegatonneSquareMilimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia MegatonneSquareMilimeters(this T value) => + MassMomentOfInertia.FromMegatonneSquareMilimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia MilligramSquareCentimeters(this T value) => - MassMomentOfInertia.FromMilligramSquareCentimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia MilligramSquareCentimeters(this T value) => + MassMomentOfInertia.FromMilligramSquareCentimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia MilligramSquareDecimeters(this T value) => - MassMomentOfInertia.FromMilligramSquareDecimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia MilligramSquareDecimeters(this T value) => + MassMomentOfInertia.FromMilligramSquareDecimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia MilligramSquareMeters(this T value) => - MassMomentOfInertia.FromMilligramSquareMeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia MilligramSquareMeters(this T value) => + MassMomentOfInertia.FromMilligramSquareMeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia MilligramSquareMillimeters(this T value) => - MassMomentOfInertia.FromMilligramSquareMillimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia MilligramSquareMillimeters(this T value) => + MassMomentOfInertia.FromMilligramSquareMillimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia PoundSquareFeet(this T value) => - MassMomentOfInertia.FromPoundSquareFeet(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia PoundSquareFeet(this T value) => + MassMomentOfInertia.FromPoundSquareFeet(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia PoundSquareInches(this T value) => - MassMomentOfInertia.FromPoundSquareInches(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia PoundSquareInches(this T value) => + MassMomentOfInertia.FromPoundSquareInches(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia SlugSquareFeet(this T value) => - MassMomentOfInertia.FromSlugSquareFeet(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia SlugSquareFeet(this T value) => + MassMomentOfInertia.FromSlugSquareFeet(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia SlugSquareInches(this T value) => - MassMomentOfInertia.FromSlugSquareInches(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia SlugSquareInches(this T value) => + MassMomentOfInertia.FromSlugSquareInches(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia TonneSquareCentimeters(this T value) => - MassMomentOfInertia.FromTonneSquareCentimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia TonneSquareCentimeters(this T value) => + MassMomentOfInertia.FromTonneSquareCentimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia TonneSquareDecimeters(this T value) => - MassMomentOfInertia.FromTonneSquareDecimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia TonneSquareDecimeters(this T value) => + MassMomentOfInertia.FromTonneSquareDecimeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia TonneSquareMeters(this T value) => - MassMomentOfInertia.FromTonneSquareMeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia TonneSquareMeters(this T value) => + MassMomentOfInertia.FromTonneSquareMeters(Convert.ToDouble(value)); - /// - public static MassMomentOfInertia TonneSquareMilimeters(this T value) => - MassMomentOfInertia.FromTonneSquareMilimeters(Convert.ToDouble(value)); + /// + public static MassMomentOfInertia TonneSquareMilimeters(this T value) => + MassMomentOfInertia.FromTonneSquareMilimeters(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMolarEnergyExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMolarEnergyExtensions.g.cs index c3d9f40848..769bcdbcf5 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMolarEnergyExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMolarEnergyExtensions.g.cs @@ -28,17 +28,17 @@ namespace UnitsNet.NumberExtensions.NumberToMolarEnergy /// public static class NumberToMolarEnergyExtensions { - /// - public static MolarEnergy JoulesPerMole(this T value) => - MolarEnergy.FromJoulesPerMole(Convert.ToDouble(value)); + /// + public static MolarEnergy JoulesPerMole(this T value) => + MolarEnergy.FromJoulesPerMole(Convert.ToDouble(value)); - /// - public static MolarEnergy KilojoulesPerMole(this T value) => - MolarEnergy.FromKilojoulesPerMole(Convert.ToDouble(value)); + /// + public static MolarEnergy KilojoulesPerMole(this T value) => + MolarEnergy.FromKilojoulesPerMole(Convert.ToDouble(value)); - /// - public static MolarEnergy MegajoulesPerMole(this T value) => - MolarEnergy.FromMegajoulesPerMole(Convert.ToDouble(value)); + /// + public static MolarEnergy MegajoulesPerMole(this T value) => + MolarEnergy.FromMegajoulesPerMole(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMolarEntropyExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMolarEntropyExtensions.g.cs index bdf9b9f62a..f5b372268a 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMolarEntropyExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMolarEntropyExtensions.g.cs @@ -28,17 +28,17 @@ namespace UnitsNet.NumberExtensions.NumberToMolarEntropy /// public static class NumberToMolarEntropyExtensions { - /// - public static MolarEntropy JoulesPerMoleKelvin(this T value) => - MolarEntropy.FromJoulesPerMoleKelvin(Convert.ToDouble(value)); + /// + public static MolarEntropy JoulesPerMoleKelvin(this T value) => + MolarEntropy.FromJoulesPerMoleKelvin(Convert.ToDouble(value)); - /// - public static MolarEntropy KilojoulesPerMoleKelvin(this T value) => - MolarEntropy.FromKilojoulesPerMoleKelvin(Convert.ToDouble(value)); + /// + public static MolarEntropy KilojoulesPerMoleKelvin(this T value) => + MolarEntropy.FromKilojoulesPerMoleKelvin(Convert.ToDouble(value)); - /// - public static MolarEntropy MegajoulesPerMoleKelvin(this T value) => - MolarEntropy.FromMegajoulesPerMoleKelvin(Convert.ToDouble(value)); + /// + public static MolarEntropy MegajoulesPerMoleKelvin(this T value) => + MolarEntropy.FromMegajoulesPerMoleKelvin(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMolarMassExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMolarMassExtensions.g.cs index 0770fe5a8f..b7242bfd16 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMolarMassExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMolarMassExtensions.g.cs @@ -28,53 +28,53 @@ namespace UnitsNet.NumberExtensions.NumberToMolarMass /// public static class NumberToMolarMassExtensions { - /// - public static MolarMass CentigramsPerMole(this T value) => - MolarMass.FromCentigramsPerMole(Convert.ToDouble(value)); + /// + public static MolarMass CentigramsPerMole(this T value) => + MolarMass.FromCentigramsPerMole(Convert.ToDouble(value)); - /// - public static MolarMass DecagramsPerMole(this T value) => - MolarMass.FromDecagramsPerMole(Convert.ToDouble(value)); + /// + public static MolarMass DecagramsPerMole(this T value) => + MolarMass.FromDecagramsPerMole(Convert.ToDouble(value)); - /// - public static MolarMass DecigramsPerMole(this T value) => - MolarMass.FromDecigramsPerMole(Convert.ToDouble(value)); + /// + public static MolarMass DecigramsPerMole(this T value) => + MolarMass.FromDecigramsPerMole(Convert.ToDouble(value)); - /// - public static MolarMass GramsPerMole(this T value) => - MolarMass.FromGramsPerMole(Convert.ToDouble(value)); + /// + public static MolarMass GramsPerMole(this T value) => + MolarMass.FromGramsPerMole(Convert.ToDouble(value)); - /// - public static MolarMass HectogramsPerMole(this T value) => - MolarMass.FromHectogramsPerMole(Convert.ToDouble(value)); + /// + public static MolarMass HectogramsPerMole(this T value) => + MolarMass.FromHectogramsPerMole(Convert.ToDouble(value)); - /// - public static MolarMass KilogramsPerMole(this T value) => - MolarMass.FromKilogramsPerMole(Convert.ToDouble(value)); + /// + public static MolarMass KilogramsPerMole(this T value) => + MolarMass.FromKilogramsPerMole(Convert.ToDouble(value)); - /// - public static MolarMass KilopoundsPerMole(this T value) => - MolarMass.FromKilopoundsPerMole(Convert.ToDouble(value)); + /// + public static MolarMass KilopoundsPerMole(this T value) => + MolarMass.FromKilopoundsPerMole(Convert.ToDouble(value)); - /// - public static MolarMass MegapoundsPerMole(this T value) => - MolarMass.FromMegapoundsPerMole(Convert.ToDouble(value)); + /// + public static MolarMass MegapoundsPerMole(this T value) => + MolarMass.FromMegapoundsPerMole(Convert.ToDouble(value)); - /// - public static MolarMass MicrogramsPerMole(this T value) => - MolarMass.FromMicrogramsPerMole(Convert.ToDouble(value)); + /// + public static MolarMass MicrogramsPerMole(this T value) => + MolarMass.FromMicrogramsPerMole(Convert.ToDouble(value)); - /// - public static MolarMass MilligramsPerMole(this T value) => - MolarMass.FromMilligramsPerMole(Convert.ToDouble(value)); + /// + public static MolarMass MilligramsPerMole(this T value) => + MolarMass.FromMilligramsPerMole(Convert.ToDouble(value)); - /// - public static MolarMass NanogramsPerMole(this T value) => - MolarMass.FromNanogramsPerMole(Convert.ToDouble(value)); + /// + public static MolarMass NanogramsPerMole(this T value) => + MolarMass.FromNanogramsPerMole(Convert.ToDouble(value)); - /// - public static MolarMass PoundsPerMole(this T value) => - MolarMass.FromPoundsPerMole(Convert.ToDouble(value)); + /// + public static MolarMass PoundsPerMole(this T value) => + MolarMass.FromPoundsPerMole(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMolarityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMolarityExtensions.g.cs index 1a950102be..7ef886a20e 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToMolarityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToMolarityExtensions.g.cs @@ -28,37 +28,37 @@ namespace UnitsNet.NumberExtensions.NumberToMolarity /// public static class NumberToMolarityExtensions { - /// - public static Molarity CentimolesPerLiter(this T value) => - Molarity.FromCentimolesPerLiter(Convert.ToDouble(value)); + /// + public static Molarity CentimolesPerLiter(this T value) => + Molarity.FromCentimolesPerLiter(Convert.ToDouble(value)); - /// - public static Molarity DecimolesPerLiter(this T value) => - Molarity.FromDecimolesPerLiter(Convert.ToDouble(value)); + /// + public static Molarity DecimolesPerLiter(this T value) => + Molarity.FromDecimolesPerLiter(Convert.ToDouble(value)); - /// - public static Molarity MicromolesPerLiter(this T value) => - Molarity.FromMicromolesPerLiter(Convert.ToDouble(value)); + /// + public static Molarity MicromolesPerLiter(this T value) => + Molarity.FromMicromolesPerLiter(Convert.ToDouble(value)); - /// - public static Molarity MillimolesPerLiter(this T value) => - Molarity.FromMillimolesPerLiter(Convert.ToDouble(value)); + /// + public static Molarity MillimolesPerLiter(this T value) => + Molarity.FromMillimolesPerLiter(Convert.ToDouble(value)); - /// - public static Molarity MolesPerCubicMeter(this T value) => - Molarity.FromMolesPerCubicMeter(Convert.ToDouble(value)); + /// + public static Molarity MolesPerCubicMeter(this T value) => + Molarity.FromMolesPerCubicMeter(Convert.ToDouble(value)); - /// - public static Molarity MolesPerLiter(this T value) => - Molarity.FromMolesPerLiter(Convert.ToDouble(value)); + /// + public static Molarity MolesPerLiter(this T value) => + Molarity.FromMolesPerLiter(Convert.ToDouble(value)); - /// - public static Molarity NanomolesPerLiter(this T value) => - Molarity.FromNanomolesPerLiter(Convert.ToDouble(value)); + /// + public static Molarity NanomolesPerLiter(this T value) => + Molarity.FromNanomolesPerLiter(Convert.ToDouble(value)); - /// - public static Molarity PicomolesPerLiter(this T value) => - Molarity.FromPicomolesPerLiter(Convert.ToDouble(value)); + /// + public static Molarity PicomolesPerLiter(this T value) => + Molarity.FromPicomolesPerLiter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToPermeabilityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToPermeabilityExtensions.g.cs index 799e265fa9..d4463b218c 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToPermeabilityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToPermeabilityExtensions.g.cs @@ -28,9 +28,9 @@ namespace UnitsNet.NumberExtensions.NumberToPermeability /// public static class NumberToPermeabilityExtensions { - /// - public static Permeability HenriesPerMeter(this T value) => - Permeability.FromHenriesPerMeter(Convert.ToDouble(value)); + /// + public static Permeability HenriesPerMeter(this T value) => + Permeability.FromHenriesPerMeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToPermittivityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToPermittivityExtensions.g.cs index d663acc786..263b5d35b7 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToPermittivityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToPermittivityExtensions.g.cs @@ -28,9 +28,9 @@ namespace UnitsNet.NumberExtensions.NumberToPermittivity /// public static class NumberToPermittivityExtensions { - /// - public static Permittivity FaradsPerMeter(this T value) => - Permittivity.FromFaradsPerMeter(Convert.ToDouble(value)); + /// + public static Permittivity FaradsPerMeter(this T value) => + Permittivity.FromFaradsPerMeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToPowerDensityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToPowerDensityExtensions.g.cs index db29982fa6..27d592580c 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToPowerDensityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToPowerDensityExtensions.g.cs @@ -28,181 +28,181 @@ namespace UnitsNet.NumberExtensions.NumberToPowerDensity /// public static class NumberToPowerDensityExtensions { - /// - public static PowerDensity DecawattsPerCubicFoot(this T value) => - PowerDensity.FromDecawattsPerCubicFoot(Convert.ToDouble(value)); + /// + public static PowerDensity DecawattsPerCubicFoot(this T value) => + PowerDensity.FromDecawattsPerCubicFoot(Convert.ToDouble(value)); - /// - public static PowerDensity DecawattsPerCubicInch(this T value) => - PowerDensity.FromDecawattsPerCubicInch(Convert.ToDouble(value)); + /// + public static PowerDensity DecawattsPerCubicInch(this T value) => + PowerDensity.FromDecawattsPerCubicInch(Convert.ToDouble(value)); - /// - public static PowerDensity DecawattsPerCubicMeter(this T value) => - PowerDensity.FromDecawattsPerCubicMeter(Convert.ToDouble(value)); + /// + public static PowerDensity DecawattsPerCubicMeter(this T value) => + PowerDensity.FromDecawattsPerCubicMeter(Convert.ToDouble(value)); - /// - public static PowerDensity DecawattsPerLiter(this T value) => - PowerDensity.FromDecawattsPerLiter(Convert.ToDouble(value)); + /// + public static PowerDensity DecawattsPerLiter(this T value) => + PowerDensity.FromDecawattsPerLiter(Convert.ToDouble(value)); - /// - public static PowerDensity DeciwattsPerCubicFoot(this T value) => - PowerDensity.FromDeciwattsPerCubicFoot(Convert.ToDouble(value)); + /// + public static PowerDensity DeciwattsPerCubicFoot(this T value) => + PowerDensity.FromDeciwattsPerCubicFoot(Convert.ToDouble(value)); - /// - public static PowerDensity DeciwattsPerCubicInch(this T value) => - PowerDensity.FromDeciwattsPerCubicInch(Convert.ToDouble(value)); + /// + public static PowerDensity DeciwattsPerCubicInch(this T value) => + PowerDensity.FromDeciwattsPerCubicInch(Convert.ToDouble(value)); - /// - public static PowerDensity DeciwattsPerCubicMeter(this T value) => - PowerDensity.FromDeciwattsPerCubicMeter(Convert.ToDouble(value)); + /// + public static PowerDensity DeciwattsPerCubicMeter(this T value) => + PowerDensity.FromDeciwattsPerCubicMeter(Convert.ToDouble(value)); - /// - public static PowerDensity DeciwattsPerLiter(this T value) => - PowerDensity.FromDeciwattsPerLiter(Convert.ToDouble(value)); + /// + public static PowerDensity DeciwattsPerLiter(this T value) => + PowerDensity.FromDeciwattsPerLiter(Convert.ToDouble(value)); - /// - public static PowerDensity GigawattsPerCubicFoot(this T value) => - PowerDensity.FromGigawattsPerCubicFoot(Convert.ToDouble(value)); + /// + public static PowerDensity GigawattsPerCubicFoot(this T value) => + PowerDensity.FromGigawattsPerCubicFoot(Convert.ToDouble(value)); - /// - public static PowerDensity GigawattsPerCubicInch(this T value) => - PowerDensity.FromGigawattsPerCubicInch(Convert.ToDouble(value)); + /// + public static PowerDensity GigawattsPerCubicInch(this T value) => + PowerDensity.FromGigawattsPerCubicInch(Convert.ToDouble(value)); - /// - public static PowerDensity GigawattsPerCubicMeter(this T value) => - PowerDensity.FromGigawattsPerCubicMeter(Convert.ToDouble(value)); + /// + public static PowerDensity GigawattsPerCubicMeter(this T value) => + PowerDensity.FromGigawattsPerCubicMeter(Convert.ToDouble(value)); - /// - public static PowerDensity GigawattsPerLiter(this T value) => - PowerDensity.FromGigawattsPerLiter(Convert.ToDouble(value)); + /// + public static PowerDensity GigawattsPerLiter(this T value) => + PowerDensity.FromGigawattsPerLiter(Convert.ToDouble(value)); - /// - public static PowerDensity KilowattsPerCubicFoot(this T value) => - PowerDensity.FromKilowattsPerCubicFoot(Convert.ToDouble(value)); + /// + public static PowerDensity KilowattsPerCubicFoot(this T value) => + PowerDensity.FromKilowattsPerCubicFoot(Convert.ToDouble(value)); - /// - public static PowerDensity KilowattsPerCubicInch(this T value) => - PowerDensity.FromKilowattsPerCubicInch(Convert.ToDouble(value)); + /// + public static PowerDensity KilowattsPerCubicInch(this T value) => + PowerDensity.FromKilowattsPerCubicInch(Convert.ToDouble(value)); - /// - public static PowerDensity KilowattsPerCubicMeter(this T value) => - PowerDensity.FromKilowattsPerCubicMeter(Convert.ToDouble(value)); + /// + public static PowerDensity KilowattsPerCubicMeter(this T value) => + PowerDensity.FromKilowattsPerCubicMeter(Convert.ToDouble(value)); - /// - public static PowerDensity KilowattsPerLiter(this T value) => - PowerDensity.FromKilowattsPerLiter(Convert.ToDouble(value)); + /// + public static PowerDensity KilowattsPerLiter(this T value) => + PowerDensity.FromKilowattsPerLiter(Convert.ToDouble(value)); - /// - public static PowerDensity MegawattsPerCubicFoot(this T value) => - PowerDensity.FromMegawattsPerCubicFoot(Convert.ToDouble(value)); + /// + public static PowerDensity MegawattsPerCubicFoot(this T value) => + PowerDensity.FromMegawattsPerCubicFoot(Convert.ToDouble(value)); - /// - public static PowerDensity MegawattsPerCubicInch(this T value) => - PowerDensity.FromMegawattsPerCubicInch(Convert.ToDouble(value)); + /// + public static PowerDensity MegawattsPerCubicInch(this T value) => + PowerDensity.FromMegawattsPerCubicInch(Convert.ToDouble(value)); - /// - public static PowerDensity MegawattsPerCubicMeter(this T value) => - PowerDensity.FromMegawattsPerCubicMeter(Convert.ToDouble(value)); + /// + public static PowerDensity MegawattsPerCubicMeter(this T value) => + PowerDensity.FromMegawattsPerCubicMeter(Convert.ToDouble(value)); - /// - public static PowerDensity MegawattsPerLiter(this T value) => - PowerDensity.FromMegawattsPerLiter(Convert.ToDouble(value)); + /// + public static PowerDensity MegawattsPerLiter(this T value) => + PowerDensity.FromMegawattsPerLiter(Convert.ToDouble(value)); - /// - public static PowerDensity MicrowattsPerCubicFoot(this T value) => - PowerDensity.FromMicrowattsPerCubicFoot(Convert.ToDouble(value)); + /// + public static PowerDensity MicrowattsPerCubicFoot(this T value) => + PowerDensity.FromMicrowattsPerCubicFoot(Convert.ToDouble(value)); - /// - public static PowerDensity MicrowattsPerCubicInch(this T value) => - PowerDensity.FromMicrowattsPerCubicInch(Convert.ToDouble(value)); + /// + public static PowerDensity MicrowattsPerCubicInch(this T value) => + PowerDensity.FromMicrowattsPerCubicInch(Convert.ToDouble(value)); - /// - public static PowerDensity MicrowattsPerCubicMeter(this T value) => - PowerDensity.FromMicrowattsPerCubicMeter(Convert.ToDouble(value)); + /// + public static PowerDensity MicrowattsPerCubicMeter(this T value) => + PowerDensity.FromMicrowattsPerCubicMeter(Convert.ToDouble(value)); - /// - public static PowerDensity MicrowattsPerLiter(this T value) => - PowerDensity.FromMicrowattsPerLiter(Convert.ToDouble(value)); + /// + public static PowerDensity MicrowattsPerLiter(this T value) => + PowerDensity.FromMicrowattsPerLiter(Convert.ToDouble(value)); - /// - public static PowerDensity MilliwattsPerCubicFoot(this T value) => - PowerDensity.FromMilliwattsPerCubicFoot(Convert.ToDouble(value)); + /// + public static PowerDensity MilliwattsPerCubicFoot(this T value) => + PowerDensity.FromMilliwattsPerCubicFoot(Convert.ToDouble(value)); - /// - public static PowerDensity MilliwattsPerCubicInch(this T value) => - PowerDensity.FromMilliwattsPerCubicInch(Convert.ToDouble(value)); + /// + public static PowerDensity MilliwattsPerCubicInch(this T value) => + PowerDensity.FromMilliwattsPerCubicInch(Convert.ToDouble(value)); - /// - public static PowerDensity MilliwattsPerCubicMeter(this T value) => - PowerDensity.FromMilliwattsPerCubicMeter(Convert.ToDouble(value)); + /// + public static PowerDensity MilliwattsPerCubicMeter(this T value) => + PowerDensity.FromMilliwattsPerCubicMeter(Convert.ToDouble(value)); - /// - public static PowerDensity MilliwattsPerLiter(this T value) => - PowerDensity.FromMilliwattsPerLiter(Convert.ToDouble(value)); + /// + public static PowerDensity MilliwattsPerLiter(this T value) => + PowerDensity.FromMilliwattsPerLiter(Convert.ToDouble(value)); - /// - public static PowerDensity NanowattsPerCubicFoot(this T value) => - PowerDensity.FromNanowattsPerCubicFoot(Convert.ToDouble(value)); + /// + public static PowerDensity NanowattsPerCubicFoot(this T value) => + PowerDensity.FromNanowattsPerCubicFoot(Convert.ToDouble(value)); - /// - public static PowerDensity NanowattsPerCubicInch(this T value) => - PowerDensity.FromNanowattsPerCubicInch(Convert.ToDouble(value)); + /// + public static PowerDensity NanowattsPerCubicInch(this T value) => + PowerDensity.FromNanowattsPerCubicInch(Convert.ToDouble(value)); - /// - public static PowerDensity NanowattsPerCubicMeter(this T value) => - PowerDensity.FromNanowattsPerCubicMeter(Convert.ToDouble(value)); + /// + public static PowerDensity NanowattsPerCubicMeter(this T value) => + PowerDensity.FromNanowattsPerCubicMeter(Convert.ToDouble(value)); - /// - public static PowerDensity NanowattsPerLiter(this T value) => - PowerDensity.FromNanowattsPerLiter(Convert.ToDouble(value)); + /// + public static PowerDensity NanowattsPerLiter(this T value) => + PowerDensity.FromNanowattsPerLiter(Convert.ToDouble(value)); - /// - public static PowerDensity PicowattsPerCubicFoot(this T value) => - PowerDensity.FromPicowattsPerCubicFoot(Convert.ToDouble(value)); + /// + public static PowerDensity PicowattsPerCubicFoot(this T value) => + PowerDensity.FromPicowattsPerCubicFoot(Convert.ToDouble(value)); - /// - public static PowerDensity PicowattsPerCubicInch(this T value) => - PowerDensity.FromPicowattsPerCubicInch(Convert.ToDouble(value)); + /// + public static PowerDensity PicowattsPerCubicInch(this T value) => + PowerDensity.FromPicowattsPerCubicInch(Convert.ToDouble(value)); - /// - public static PowerDensity PicowattsPerCubicMeter(this T value) => - PowerDensity.FromPicowattsPerCubicMeter(Convert.ToDouble(value)); + /// + public static PowerDensity PicowattsPerCubicMeter(this T value) => + PowerDensity.FromPicowattsPerCubicMeter(Convert.ToDouble(value)); - /// - public static PowerDensity PicowattsPerLiter(this T value) => - PowerDensity.FromPicowattsPerLiter(Convert.ToDouble(value)); + /// + public static PowerDensity PicowattsPerLiter(this T value) => + PowerDensity.FromPicowattsPerLiter(Convert.ToDouble(value)); - /// - public static PowerDensity TerawattsPerCubicFoot(this T value) => - PowerDensity.FromTerawattsPerCubicFoot(Convert.ToDouble(value)); + /// + public static PowerDensity TerawattsPerCubicFoot(this T value) => + PowerDensity.FromTerawattsPerCubicFoot(Convert.ToDouble(value)); - /// - public static PowerDensity TerawattsPerCubicInch(this T value) => - PowerDensity.FromTerawattsPerCubicInch(Convert.ToDouble(value)); + /// + public static PowerDensity TerawattsPerCubicInch(this T value) => + PowerDensity.FromTerawattsPerCubicInch(Convert.ToDouble(value)); - /// - public static PowerDensity TerawattsPerCubicMeter(this T value) => - PowerDensity.FromTerawattsPerCubicMeter(Convert.ToDouble(value)); + /// + public static PowerDensity TerawattsPerCubicMeter(this T value) => + PowerDensity.FromTerawattsPerCubicMeter(Convert.ToDouble(value)); - /// - public static PowerDensity TerawattsPerLiter(this T value) => - PowerDensity.FromTerawattsPerLiter(Convert.ToDouble(value)); + /// + public static PowerDensity TerawattsPerLiter(this T value) => + PowerDensity.FromTerawattsPerLiter(Convert.ToDouble(value)); - /// - public static PowerDensity WattsPerCubicFoot(this T value) => - PowerDensity.FromWattsPerCubicFoot(Convert.ToDouble(value)); + /// + public static PowerDensity WattsPerCubicFoot(this T value) => + PowerDensity.FromWattsPerCubicFoot(Convert.ToDouble(value)); - /// - public static PowerDensity WattsPerCubicInch(this T value) => - PowerDensity.FromWattsPerCubicInch(Convert.ToDouble(value)); + /// + public static PowerDensity WattsPerCubicInch(this T value) => + PowerDensity.FromWattsPerCubicInch(Convert.ToDouble(value)); - /// - public static PowerDensity WattsPerCubicMeter(this T value) => - PowerDensity.FromWattsPerCubicMeter(Convert.ToDouble(value)); + /// + public static PowerDensity WattsPerCubicMeter(this T value) => + PowerDensity.FromWattsPerCubicMeter(Convert.ToDouble(value)); - /// - public static PowerDensity WattsPerLiter(this T value) => - PowerDensity.FromWattsPerLiter(Convert.ToDouble(value)); + /// + public static PowerDensity WattsPerLiter(this T value) => + PowerDensity.FromWattsPerLiter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToPowerExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToPowerExtensions.g.cs index 1ec415d506..db3ac700ae 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToPowerExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToPowerExtensions.g.cs @@ -28,105 +28,105 @@ namespace UnitsNet.NumberExtensions.NumberToPower /// public static class NumberToPowerExtensions { - /// - public static Power BoilerHorsepower(this T value) => - Power.FromBoilerHorsepower(Convert.ToDouble(value)); + /// + public static Power BoilerHorsepower(this T value) => + Power.FromBoilerHorsepower(Convert.ToDouble(value)); - /// - public static Power BritishThermalUnitsPerHour(this T value) => - Power.FromBritishThermalUnitsPerHour(Convert.ToDouble(value)); + /// + public static Power BritishThermalUnitsPerHour(this T value) => + Power.FromBritishThermalUnitsPerHour(Convert.ToDouble(value)); - /// - public static Power Decawatts(this T value) => - Power.FromDecawatts(Convert.ToDouble(value)); + /// + public static Power Decawatts(this T value) => + Power.FromDecawatts(Convert.ToDouble(value)); - /// - public static Power Deciwatts(this T value) => - Power.FromDeciwatts(Convert.ToDouble(value)); + /// + public static Power Deciwatts(this T value) => + Power.FromDeciwatts(Convert.ToDouble(value)); - /// - public static Power ElectricalHorsepower(this T value) => - Power.FromElectricalHorsepower(Convert.ToDouble(value)); + /// + public static Power ElectricalHorsepower(this T value) => + Power.FromElectricalHorsepower(Convert.ToDouble(value)); - /// - public static Power Femtowatts(this T value) => - Power.FromFemtowatts(Convert.ToDouble(value)); + /// + public static Power Femtowatts(this T value) => + Power.FromFemtowatts(Convert.ToDouble(value)); - /// - public static Power GigajoulesPerHour(this T value) => - Power.FromGigajoulesPerHour(Convert.ToDouble(value)); + /// + public static Power GigajoulesPerHour(this T value) => + Power.FromGigajoulesPerHour(Convert.ToDouble(value)); - /// - public static Power Gigawatts(this T value) => - Power.FromGigawatts(Convert.ToDouble(value)); + /// + public static Power Gigawatts(this T value) => + Power.FromGigawatts(Convert.ToDouble(value)); - /// - public static Power HydraulicHorsepower(this T value) => - Power.FromHydraulicHorsepower(Convert.ToDouble(value)); + /// + public static Power HydraulicHorsepower(this T value) => + Power.FromHydraulicHorsepower(Convert.ToDouble(value)); - /// - public static Power JoulesPerHour(this T value) => - Power.FromJoulesPerHour(Convert.ToDouble(value)); + /// + public static Power JoulesPerHour(this T value) => + Power.FromJoulesPerHour(Convert.ToDouble(value)); - /// - public static Power KilobritishThermalUnitsPerHour(this T value) => - Power.FromKilobritishThermalUnitsPerHour(Convert.ToDouble(value)); + /// + public static Power KilobritishThermalUnitsPerHour(this T value) => + Power.FromKilobritishThermalUnitsPerHour(Convert.ToDouble(value)); - /// - public static Power KilojoulesPerHour(this T value) => - Power.FromKilojoulesPerHour(Convert.ToDouble(value)); + /// + public static Power KilojoulesPerHour(this T value) => + Power.FromKilojoulesPerHour(Convert.ToDouble(value)); - /// - public static Power Kilowatts(this T value) => - Power.FromKilowatts(Convert.ToDouble(value)); + /// + public static Power Kilowatts(this T value) => + Power.FromKilowatts(Convert.ToDouble(value)); - /// - public static Power MechanicalHorsepower(this T value) => - Power.FromMechanicalHorsepower(Convert.ToDouble(value)); + /// + public static Power MechanicalHorsepower(this T value) => + Power.FromMechanicalHorsepower(Convert.ToDouble(value)); - /// - public static Power MegajoulesPerHour(this T value) => - Power.FromMegajoulesPerHour(Convert.ToDouble(value)); + /// + public static Power MegajoulesPerHour(this T value) => + Power.FromMegajoulesPerHour(Convert.ToDouble(value)); - /// - public static Power Megawatts(this T value) => - Power.FromMegawatts(Convert.ToDouble(value)); + /// + public static Power Megawatts(this T value) => + Power.FromMegawatts(Convert.ToDouble(value)); - /// - public static Power MetricHorsepower(this T value) => - Power.FromMetricHorsepower(Convert.ToDouble(value)); + /// + public static Power MetricHorsepower(this T value) => + Power.FromMetricHorsepower(Convert.ToDouble(value)); - /// - public static Power Microwatts(this T value) => - Power.FromMicrowatts(Convert.ToDouble(value)); + /// + public static Power Microwatts(this T value) => + Power.FromMicrowatts(Convert.ToDouble(value)); - /// - public static Power MillijoulesPerHour(this T value) => - Power.FromMillijoulesPerHour(Convert.ToDouble(value)); + /// + public static Power MillijoulesPerHour(this T value) => + Power.FromMillijoulesPerHour(Convert.ToDouble(value)); - /// - public static Power Milliwatts(this T value) => - Power.FromMilliwatts(Convert.ToDouble(value)); + /// + public static Power Milliwatts(this T value) => + Power.FromMilliwatts(Convert.ToDouble(value)); - /// - public static Power Nanowatts(this T value) => - Power.FromNanowatts(Convert.ToDouble(value)); + /// + public static Power Nanowatts(this T value) => + Power.FromNanowatts(Convert.ToDouble(value)); - /// - public static Power Petawatts(this T value) => - Power.FromPetawatts(Convert.ToDouble(value)); + /// + public static Power Petawatts(this T value) => + Power.FromPetawatts(Convert.ToDouble(value)); - /// - public static Power Picowatts(this T value) => - Power.FromPicowatts(Convert.ToDouble(value)); + /// + public static Power Picowatts(this T value) => + Power.FromPicowatts(Convert.ToDouble(value)); - /// - public static Power Terawatts(this T value) => - Power.FromTerawatts(Convert.ToDouble(value)); + /// + public static Power Terawatts(this T value) => + Power.FromTerawatts(Convert.ToDouble(value)); - /// - public static Power Watts(this T value) => - Power.FromWatts(Convert.ToDouble(value)); + /// + public static Power Watts(this T value) => + Power.FromWatts(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToPowerRatioExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToPowerRatioExtensions.g.cs index 8f39d1efc9..8fc77a94e2 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToPowerRatioExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToPowerRatioExtensions.g.cs @@ -28,13 +28,13 @@ namespace UnitsNet.NumberExtensions.NumberToPowerRatio /// public static class NumberToPowerRatioExtensions { - /// - public static PowerRatio DecibelMilliwatts(this T value) => - PowerRatio.FromDecibelMilliwatts(Convert.ToDouble(value)); + /// + public static PowerRatio DecibelMilliwatts(this T value) => + PowerRatio.FromDecibelMilliwatts(Convert.ToDouble(value)); - /// - public static PowerRatio DecibelWatts(this T value) => - PowerRatio.FromDecibelWatts(Convert.ToDouble(value)); + /// + public static PowerRatio DecibelWatts(this T value) => + PowerRatio.FromDecibelWatts(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToPressureChangeRateExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToPressureChangeRateExtensions.g.cs index f503510093..e98a4a3a58 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToPressureChangeRateExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToPressureChangeRateExtensions.g.cs @@ -28,33 +28,33 @@ namespace UnitsNet.NumberExtensions.NumberToPressureChangeRate /// public static class NumberToPressureChangeRateExtensions { - /// - public static PressureChangeRate AtmospheresPerSecond(this T value) => - PressureChangeRate.FromAtmospheresPerSecond(Convert.ToDouble(value)); + /// + public static PressureChangeRate AtmospheresPerSecond(this T value) => + PressureChangeRate.FromAtmospheresPerSecond(Convert.ToDouble(value)); - /// - public static PressureChangeRate KilopascalsPerMinute(this T value) => - PressureChangeRate.FromKilopascalsPerMinute(Convert.ToDouble(value)); + /// + public static PressureChangeRate KilopascalsPerMinute(this T value) => + PressureChangeRate.FromKilopascalsPerMinute(Convert.ToDouble(value)); - /// - public static PressureChangeRate KilopascalsPerSecond(this T value) => - PressureChangeRate.FromKilopascalsPerSecond(Convert.ToDouble(value)); + /// + public static PressureChangeRate KilopascalsPerSecond(this T value) => + PressureChangeRate.FromKilopascalsPerSecond(Convert.ToDouble(value)); - /// - public static PressureChangeRate MegapascalsPerMinute(this T value) => - PressureChangeRate.FromMegapascalsPerMinute(Convert.ToDouble(value)); + /// + public static PressureChangeRate MegapascalsPerMinute(this T value) => + PressureChangeRate.FromMegapascalsPerMinute(Convert.ToDouble(value)); - /// - public static PressureChangeRate MegapascalsPerSecond(this T value) => - PressureChangeRate.FromMegapascalsPerSecond(Convert.ToDouble(value)); + /// + public static PressureChangeRate MegapascalsPerSecond(this T value) => + PressureChangeRate.FromMegapascalsPerSecond(Convert.ToDouble(value)); - /// - public static PressureChangeRate PascalsPerMinute(this T value) => - PressureChangeRate.FromPascalsPerMinute(Convert.ToDouble(value)); + /// + public static PressureChangeRate PascalsPerMinute(this T value) => + PressureChangeRate.FromPascalsPerMinute(Convert.ToDouble(value)); - /// - public static PressureChangeRate PascalsPerSecond(this T value) => - PressureChangeRate.FromPascalsPerSecond(Convert.ToDouble(value)); + /// + public static PressureChangeRate PascalsPerSecond(this T value) => + PressureChangeRate.FromPascalsPerSecond(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToPressureExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToPressureExtensions.g.cs index 7d4ec48053..1a8e2339b2 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToPressureExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToPressureExtensions.g.cs @@ -28,173 +28,173 @@ namespace UnitsNet.NumberExtensions.NumberToPressure /// public static class NumberToPressureExtensions { - /// - public static Pressure Atmospheres(this T value) => - Pressure.FromAtmospheres(Convert.ToDouble(value)); + /// + public static Pressure Atmospheres(this T value) => + Pressure.FromAtmospheres(Convert.ToDouble(value)); - /// - public static Pressure Bars(this T value) => - Pressure.FromBars(Convert.ToDouble(value)); + /// + public static Pressure Bars(this T value) => + Pressure.FromBars(Convert.ToDouble(value)); - /// - public static Pressure Centibars(this T value) => - Pressure.FromCentibars(Convert.ToDouble(value)); + /// + public static Pressure Centibars(this T value) => + Pressure.FromCentibars(Convert.ToDouble(value)); - /// - public static Pressure Decapascals(this T value) => - Pressure.FromDecapascals(Convert.ToDouble(value)); + /// + public static Pressure Decapascals(this T value) => + Pressure.FromDecapascals(Convert.ToDouble(value)); - /// - public static Pressure Decibars(this T value) => - Pressure.FromDecibars(Convert.ToDouble(value)); + /// + public static Pressure Decibars(this T value) => + Pressure.FromDecibars(Convert.ToDouble(value)); - /// - public static Pressure DynesPerSquareCentimeter(this T value) => - Pressure.FromDynesPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static Pressure DynesPerSquareCentimeter(this T value) => + Pressure.FromDynesPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static Pressure FeetOfHead(this T value) => - Pressure.FromFeetOfHead(Convert.ToDouble(value)); + /// + public static Pressure FeetOfHead(this T value) => + Pressure.FromFeetOfHead(Convert.ToDouble(value)); - /// - public static Pressure Gigapascals(this T value) => - Pressure.FromGigapascals(Convert.ToDouble(value)); + /// + public static Pressure Gigapascals(this T value) => + Pressure.FromGigapascals(Convert.ToDouble(value)); - /// - public static Pressure Hectopascals(this T value) => - Pressure.FromHectopascals(Convert.ToDouble(value)); + /// + public static Pressure Hectopascals(this T value) => + Pressure.FromHectopascals(Convert.ToDouble(value)); - /// - public static Pressure InchesOfMercury(this T value) => - Pressure.FromInchesOfMercury(Convert.ToDouble(value)); + /// + public static Pressure InchesOfMercury(this T value) => + Pressure.FromInchesOfMercury(Convert.ToDouble(value)); - /// - public static Pressure InchesOfWaterColumn(this T value) => - Pressure.FromInchesOfWaterColumn(Convert.ToDouble(value)); + /// + public static Pressure InchesOfWaterColumn(this T value) => + Pressure.FromInchesOfWaterColumn(Convert.ToDouble(value)); - /// - public static Pressure Kilobars(this T value) => - Pressure.FromKilobars(Convert.ToDouble(value)); + /// + public static Pressure Kilobars(this T value) => + Pressure.FromKilobars(Convert.ToDouble(value)); - /// - public static Pressure KilogramsForcePerSquareCentimeter(this T value) => - Pressure.FromKilogramsForcePerSquareCentimeter(Convert.ToDouble(value)); + /// + public static Pressure KilogramsForcePerSquareCentimeter(this T value) => + Pressure.FromKilogramsForcePerSquareCentimeter(Convert.ToDouble(value)); - /// - public static Pressure KilogramsForcePerSquareMeter(this T value) => - Pressure.FromKilogramsForcePerSquareMeter(Convert.ToDouble(value)); + /// + public static Pressure KilogramsForcePerSquareMeter(this T value) => + Pressure.FromKilogramsForcePerSquareMeter(Convert.ToDouble(value)); - /// - public static Pressure KilogramsForcePerSquareMillimeter(this T value) => - Pressure.FromKilogramsForcePerSquareMillimeter(Convert.ToDouble(value)); + /// + public static Pressure KilogramsForcePerSquareMillimeter(this T value) => + Pressure.FromKilogramsForcePerSquareMillimeter(Convert.ToDouble(value)); - /// - public static Pressure KilonewtonsPerSquareCentimeter(this T value) => - Pressure.FromKilonewtonsPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static Pressure KilonewtonsPerSquareCentimeter(this T value) => + Pressure.FromKilonewtonsPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static Pressure KilonewtonsPerSquareMeter(this T value) => - Pressure.FromKilonewtonsPerSquareMeter(Convert.ToDouble(value)); + /// + public static Pressure KilonewtonsPerSquareMeter(this T value) => + Pressure.FromKilonewtonsPerSquareMeter(Convert.ToDouble(value)); - /// - public static Pressure KilonewtonsPerSquareMillimeter(this T value) => - Pressure.FromKilonewtonsPerSquareMillimeter(Convert.ToDouble(value)); + /// + public static Pressure KilonewtonsPerSquareMillimeter(this T value) => + Pressure.FromKilonewtonsPerSquareMillimeter(Convert.ToDouble(value)); - /// - public static Pressure Kilopascals(this T value) => - Pressure.FromKilopascals(Convert.ToDouble(value)); + /// + public static Pressure Kilopascals(this T value) => + Pressure.FromKilopascals(Convert.ToDouble(value)); - /// - public static Pressure KilopoundsForcePerSquareFoot(this T value) => - Pressure.FromKilopoundsForcePerSquareFoot(Convert.ToDouble(value)); + /// + public static Pressure KilopoundsForcePerSquareFoot(this T value) => + Pressure.FromKilopoundsForcePerSquareFoot(Convert.ToDouble(value)); - /// - public static Pressure KilopoundsForcePerSquareInch(this T value) => - Pressure.FromKilopoundsForcePerSquareInch(Convert.ToDouble(value)); + /// + public static Pressure KilopoundsForcePerSquareInch(this T value) => + Pressure.FromKilopoundsForcePerSquareInch(Convert.ToDouble(value)); - /// - public static Pressure Megabars(this T value) => - Pressure.FromMegabars(Convert.ToDouble(value)); + /// + public static Pressure Megabars(this T value) => + Pressure.FromMegabars(Convert.ToDouble(value)); - /// - public static Pressure MeganewtonsPerSquareMeter(this T value) => - Pressure.FromMeganewtonsPerSquareMeter(Convert.ToDouble(value)); + /// + public static Pressure MeganewtonsPerSquareMeter(this T value) => + Pressure.FromMeganewtonsPerSquareMeter(Convert.ToDouble(value)); - /// - public static Pressure Megapascals(this T value) => - Pressure.FromMegapascals(Convert.ToDouble(value)); + /// + public static Pressure Megapascals(this T value) => + Pressure.FromMegapascals(Convert.ToDouble(value)); - /// - public static Pressure MetersOfHead(this T value) => - Pressure.FromMetersOfHead(Convert.ToDouble(value)); + /// + public static Pressure MetersOfHead(this T value) => + Pressure.FromMetersOfHead(Convert.ToDouble(value)); - /// - public static Pressure Microbars(this T value) => - Pressure.FromMicrobars(Convert.ToDouble(value)); + /// + public static Pressure Microbars(this T value) => + Pressure.FromMicrobars(Convert.ToDouble(value)); - /// - public static Pressure Micropascals(this T value) => - Pressure.FromMicropascals(Convert.ToDouble(value)); + /// + public static Pressure Micropascals(this T value) => + Pressure.FromMicropascals(Convert.ToDouble(value)); - /// - public static Pressure Millibars(this T value) => - Pressure.FromMillibars(Convert.ToDouble(value)); + /// + public static Pressure Millibars(this T value) => + Pressure.FromMillibars(Convert.ToDouble(value)); - /// - public static Pressure MillimetersOfMercury(this T value) => - Pressure.FromMillimetersOfMercury(Convert.ToDouble(value)); + /// + public static Pressure MillimetersOfMercury(this T value) => + Pressure.FromMillimetersOfMercury(Convert.ToDouble(value)); - /// - public static Pressure Millipascals(this T value) => - Pressure.FromMillipascals(Convert.ToDouble(value)); + /// + public static Pressure Millipascals(this T value) => + Pressure.FromMillipascals(Convert.ToDouble(value)); - /// - public static Pressure NewtonsPerSquareCentimeter(this T value) => - Pressure.FromNewtonsPerSquareCentimeter(Convert.ToDouble(value)); + /// + public static Pressure NewtonsPerSquareCentimeter(this T value) => + Pressure.FromNewtonsPerSquareCentimeter(Convert.ToDouble(value)); - /// - public static Pressure NewtonsPerSquareMeter(this T value) => - Pressure.FromNewtonsPerSquareMeter(Convert.ToDouble(value)); + /// + public static Pressure NewtonsPerSquareMeter(this T value) => + Pressure.FromNewtonsPerSquareMeter(Convert.ToDouble(value)); - /// - public static Pressure NewtonsPerSquareMillimeter(this T value) => - Pressure.FromNewtonsPerSquareMillimeter(Convert.ToDouble(value)); + /// + public static Pressure NewtonsPerSquareMillimeter(this T value) => + Pressure.FromNewtonsPerSquareMillimeter(Convert.ToDouble(value)); - /// - public static Pressure Pascals(this T value) => - Pressure.FromPascals(Convert.ToDouble(value)); + /// + public static Pressure Pascals(this T value) => + Pressure.FromPascals(Convert.ToDouble(value)); - /// - public static Pressure PoundsForcePerSquareFoot(this T value) => - Pressure.FromPoundsForcePerSquareFoot(Convert.ToDouble(value)); + /// + public static Pressure PoundsForcePerSquareFoot(this T value) => + Pressure.FromPoundsForcePerSquareFoot(Convert.ToDouble(value)); - /// - public static Pressure PoundsForcePerSquareInch(this T value) => - Pressure.FromPoundsForcePerSquareInch(Convert.ToDouble(value)); + /// + public static Pressure PoundsForcePerSquareInch(this T value) => + Pressure.FromPoundsForcePerSquareInch(Convert.ToDouble(value)); - /// - public static Pressure PoundsPerInchSecondSquared(this T value) => - Pressure.FromPoundsPerInchSecondSquared(Convert.ToDouble(value)); + /// + public static Pressure PoundsPerInchSecondSquared(this T value) => + Pressure.FromPoundsPerInchSecondSquared(Convert.ToDouble(value)); - /// - public static Pressure TechnicalAtmospheres(this T value) => - Pressure.FromTechnicalAtmospheres(Convert.ToDouble(value)); + /// + public static Pressure TechnicalAtmospheres(this T value) => + Pressure.FromTechnicalAtmospheres(Convert.ToDouble(value)); - /// - public static Pressure TonnesForcePerSquareCentimeter(this T value) => - Pressure.FromTonnesForcePerSquareCentimeter(Convert.ToDouble(value)); + /// + public static Pressure TonnesForcePerSquareCentimeter(this T value) => + Pressure.FromTonnesForcePerSquareCentimeter(Convert.ToDouble(value)); - /// - public static Pressure TonnesForcePerSquareMeter(this T value) => - Pressure.FromTonnesForcePerSquareMeter(Convert.ToDouble(value)); + /// + public static Pressure TonnesForcePerSquareMeter(this T value) => + Pressure.FromTonnesForcePerSquareMeter(Convert.ToDouble(value)); - /// - public static Pressure TonnesForcePerSquareMillimeter(this T value) => - Pressure.FromTonnesForcePerSquareMillimeter(Convert.ToDouble(value)); + /// + public static Pressure TonnesForcePerSquareMillimeter(this T value) => + Pressure.FromTonnesForcePerSquareMillimeter(Convert.ToDouble(value)); - /// - public static Pressure Torrs(this T value) => - Pressure.FromTorrs(Convert.ToDouble(value)); + /// + public static Pressure Torrs(this T value) => + Pressure.FromTorrs(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToRatioChangeRateExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToRatioChangeRateExtensions.g.cs index fe9e5315e2..b790f96627 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToRatioChangeRateExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToRatioChangeRateExtensions.g.cs @@ -28,13 +28,13 @@ namespace UnitsNet.NumberExtensions.NumberToRatioChangeRate /// public static class NumberToRatioChangeRateExtensions { - /// - public static RatioChangeRate DecimalFractionsPerSecond(this T value) => - RatioChangeRate.FromDecimalFractionsPerSecond(Convert.ToDouble(value)); + /// + public static RatioChangeRate DecimalFractionsPerSecond(this T value) => + RatioChangeRate.FromDecimalFractionsPerSecond(Convert.ToDouble(value)); - /// - public static RatioChangeRate PercentsPerSecond(this T value) => - RatioChangeRate.FromPercentsPerSecond(Convert.ToDouble(value)); + /// + public static RatioChangeRate PercentsPerSecond(this T value) => + RatioChangeRate.FromPercentsPerSecond(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToRatioExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToRatioExtensions.g.cs index c1467d6d2d..daf8303773 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToRatioExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToRatioExtensions.g.cs @@ -28,29 +28,29 @@ namespace UnitsNet.NumberExtensions.NumberToRatio /// public static class NumberToRatioExtensions { - /// - public static Ratio DecimalFractions(this T value) => - Ratio.FromDecimalFractions(Convert.ToDouble(value)); + /// + public static Ratio DecimalFractions(this T value) => + Ratio.FromDecimalFractions(Convert.ToDouble(value)); - /// - public static Ratio PartsPerBillion(this T value) => - Ratio.FromPartsPerBillion(Convert.ToDouble(value)); + /// + public static Ratio PartsPerBillion(this T value) => + Ratio.FromPartsPerBillion(Convert.ToDouble(value)); - /// - public static Ratio PartsPerMillion(this T value) => - Ratio.FromPartsPerMillion(Convert.ToDouble(value)); + /// + public static Ratio PartsPerMillion(this T value) => + Ratio.FromPartsPerMillion(Convert.ToDouble(value)); - /// - public static Ratio PartsPerThousand(this T value) => - Ratio.FromPartsPerThousand(Convert.ToDouble(value)); + /// + public static Ratio PartsPerThousand(this T value) => + Ratio.FromPartsPerThousand(Convert.ToDouble(value)); - /// - public static Ratio PartsPerTrillion(this T value) => - Ratio.FromPartsPerTrillion(Convert.ToDouble(value)); + /// + public static Ratio PartsPerTrillion(this T value) => + Ratio.FromPartsPerTrillion(Convert.ToDouble(value)); - /// - public static Ratio Percent(this T value) => - Ratio.FromPercent(Convert.ToDouble(value)); + /// + public static Ratio Percent(this T value) => + Ratio.FromPercent(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToReactiveEnergyExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToReactiveEnergyExtensions.g.cs index 39c0be6980..d2f4e59699 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToReactiveEnergyExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToReactiveEnergyExtensions.g.cs @@ -28,17 +28,17 @@ namespace UnitsNet.NumberExtensions.NumberToReactiveEnergy /// public static class NumberToReactiveEnergyExtensions { - /// - public static ReactiveEnergy KilovoltampereReactiveHours(this T value) => - ReactiveEnergy.FromKilovoltampereReactiveHours(Convert.ToDouble(value)); + /// + public static ReactiveEnergy KilovoltampereReactiveHours(this T value) => + ReactiveEnergy.FromKilovoltampereReactiveHours(Convert.ToDouble(value)); - /// - public static ReactiveEnergy MegavoltampereReactiveHours(this T value) => - ReactiveEnergy.FromMegavoltampereReactiveHours(Convert.ToDouble(value)); + /// + public static ReactiveEnergy MegavoltampereReactiveHours(this T value) => + ReactiveEnergy.FromMegavoltampereReactiveHours(Convert.ToDouble(value)); - /// - public static ReactiveEnergy VoltampereReactiveHours(this T value) => - ReactiveEnergy.FromVoltampereReactiveHours(Convert.ToDouble(value)); + /// + public static ReactiveEnergy VoltampereReactiveHours(this T value) => + ReactiveEnergy.FromVoltampereReactiveHours(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToReactivePowerExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToReactivePowerExtensions.g.cs index 75118e1eda..93756ac9a4 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToReactivePowerExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToReactivePowerExtensions.g.cs @@ -28,21 +28,21 @@ namespace UnitsNet.NumberExtensions.NumberToReactivePower /// public static class NumberToReactivePowerExtensions { - /// - public static ReactivePower GigavoltamperesReactive(this T value) => - ReactivePower.FromGigavoltamperesReactive(Convert.ToDouble(value)); + /// + public static ReactivePower GigavoltamperesReactive(this T value) => + ReactivePower.FromGigavoltamperesReactive(Convert.ToDouble(value)); - /// - public static ReactivePower KilovoltamperesReactive(this T value) => - ReactivePower.FromKilovoltamperesReactive(Convert.ToDouble(value)); + /// + public static ReactivePower KilovoltamperesReactive(this T value) => + ReactivePower.FromKilovoltamperesReactive(Convert.ToDouble(value)); - /// - public static ReactivePower MegavoltamperesReactive(this T value) => - ReactivePower.FromMegavoltamperesReactive(Convert.ToDouble(value)); + /// + public static ReactivePower MegavoltamperesReactive(this T value) => + ReactivePower.FromMegavoltamperesReactive(Convert.ToDouble(value)); - /// - public static ReactivePower VoltamperesReactive(this T value) => - ReactivePower.FromVoltamperesReactive(Convert.ToDouble(value)); + /// + public static ReactivePower VoltamperesReactive(this T value) => + ReactivePower.FromVoltamperesReactive(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToRelativeHumidityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToRelativeHumidityExtensions.g.cs index 91a0b33ba1..01625de10f 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToRelativeHumidityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToRelativeHumidityExtensions.g.cs @@ -28,9 +28,9 @@ namespace UnitsNet.NumberExtensions.NumberToRelativeHumidity /// public static class NumberToRelativeHumidityExtensions { - /// - public static RelativeHumidity Percent(this T value) => - RelativeHumidity.FromPercent(Convert.ToDouble(value)); + /// + public static RelativeHumidity Percent(this T value) => + RelativeHumidity.FromPercent(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToRotationalAccelerationExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToRotationalAccelerationExtensions.g.cs index 156eb25e82..9096c039e3 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToRotationalAccelerationExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToRotationalAccelerationExtensions.g.cs @@ -28,21 +28,21 @@ namespace UnitsNet.NumberExtensions.NumberToRotationalAcceleration /// public static class NumberToRotationalAccelerationExtensions { - /// - public static RotationalAcceleration DegreesPerSecondSquared(this T value) => - RotationalAcceleration.FromDegreesPerSecondSquared(Convert.ToDouble(value)); + /// + public static RotationalAcceleration DegreesPerSecondSquared(this T value) => + RotationalAcceleration.FromDegreesPerSecondSquared(Convert.ToDouble(value)); - /// - public static RotationalAcceleration RadiansPerSecondSquared(this T value) => - RotationalAcceleration.FromRadiansPerSecondSquared(Convert.ToDouble(value)); + /// + public static RotationalAcceleration RadiansPerSecondSquared(this T value) => + RotationalAcceleration.FromRadiansPerSecondSquared(Convert.ToDouble(value)); - /// - public static RotationalAcceleration RevolutionsPerMinutePerSecond(this T value) => - RotationalAcceleration.FromRevolutionsPerMinutePerSecond(Convert.ToDouble(value)); + /// + public static RotationalAcceleration RevolutionsPerMinutePerSecond(this T value) => + RotationalAcceleration.FromRevolutionsPerMinutePerSecond(Convert.ToDouble(value)); - /// - public static RotationalAcceleration RevolutionsPerSecondSquared(this T value) => - RotationalAcceleration.FromRevolutionsPerSecondSquared(Convert.ToDouble(value)); + /// + public static RotationalAcceleration RevolutionsPerSecondSquared(this T value) => + RotationalAcceleration.FromRevolutionsPerSecondSquared(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToRotationalSpeedExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToRotationalSpeedExtensions.g.cs index eae1fce0fa..42db43067d 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToRotationalSpeedExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToRotationalSpeedExtensions.g.cs @@ -28,57 +28,57 @@ namespace UnitsNet.NumberExtensions.NumberToRotationalSpeed /// public static class NumberToRotationalSpeedExtensions { - /// - public static RotationalSpeed CentiradiansPerSecond(this T value) => - RotationalSpeed.FromCentiradiansPerSecond(Convert.ToDouble(value)); + /// + public static RotationalSpeed CentiradiansPerSecond(this T value) => + RotationalSpeed.FromCentiradiansPerSecond(Convert.ToDouble(value)); - /// - public static RotationalSpeed DeciradiansPerSecond(this T value) => - RotationalSpeed.FromDeciradiansPerSecond(Convert.ToDouble(value)); + /// + public static RotationalSpeed DeciradiansPerSecond(this T value) => + RotationalSpeed.FromDeciradiansPerSecond(Convert.ToDouble(value)); - /// - public static RotationalSpeed DegreesPerMinute(this T value) => - RotationalSpeed.FromDegreesPerMinute(Convert.ToDouble(value)); + /// + public static RotationalSpeed DegreesPerMinute(this T value) => + RotationalSpeed.FromDegreesPerMinute(Convert.ToDouble(value)); - /// - public static RotationalSpeed DegreesPerSecond(this T value) => - RotationalSpeed.FromDegreesPerSecond(Convert.ToDouble(value)); + /// + public static RotationalSpeed DegreesPerSecond(this T value) => + RotationalSpeed.FromDegreesPerSecond(Convert.ToDouble(value)); - /// - public static RotationalSpeed MicrodegreesPerSecond(this T value) => - RotationalSpeed.FromMicrodegreesPerSecond(Convert.ToDouble(value)); + /// + public static RotationalSpeed MicrodegreesPerSecond(this T value) => + RotationalSpeed.FromMicrodegreesPerSecond(Convert.ToDouble(value)); - /// - public static RotationalSpeed MicroradiansPerSecond(this T value) => - RotationalSpeed.FromMicroradiansPerSecond(Convert.ToDouble(value)); + /// + public static RotationalSpeed MicroradiansPerSecond(this T value) => + RotationalSpeed.FromMicroradiansPerSecond(Convert.ToDouble(value)); - /// - public static RotationalSpeed MillidegreesPerSecond(this T value) => - RotationalSpeed.FromMillidegreesPerSecond(Convert.ToDouble(value)); + /// + public static RotationalSpeed MillidegreesPerSecond(this T value) => + RotationalSpeed.FromMillidegreesPerSecond(Convert.ToDouble(value)); - /// - public static RotationalSpeed MilliradiansPerSecond(this T value) => - RotationalSpeed.FromMilliradiansPerSecond(Convert.ToDouble(value)); + /// + public static RotationalSpeed MilliradiansPerSecond(this T value) => + RotationalSpeed.FromMilliradiansPerSecond(Convert.ToDouble(value)); - /// - public static RotationalSpeed NanodegreesPerSecond(this T value) => - RotationalSpeed.FromNanodegreesPerSecond(Convert.ToDouble(value)); + /// + public static RotationalSpeed NanodegreesPerSecond(this T value) => + RotationalSpeed.FromNanodegreesPerSecond(Convert.ToDouble(value)); - /// - public static RotationalSpeed NanoradiansPerSecond(this T value) => - RotationalSpeed.FromNanoradiansPerSecond(Convert.ToDouble(value)); + /// + public static RotationalSpeed NanoradiansPerSecond(this T value) => + RotationalSpeed.FromNanoradiansPerSecond(Convert.ToDouble(value)); - /// - public static RotationalSpeed RadiansPerSecond(this T value) => - RotationalSpeed.FromRadiansPerSecond(Convert.ToDouble(value)); + /// + public static RotationalSpeed RadiansPerSecond(this T value) => + RotationalSpeed.FromRadiansPerSecond(Convert.ToDouble(value)); - /// - public static RotationalSpeed RevolutionsPerMinute(this T value) => - RotationalSpeed.FromRevolutionsPerMinute(Convert.ToDouble(value)); + /// + public static RotationalSpeed RevolutionsPerMinute(this T value) => + RotationalSpeed.FromRevolutionsPerMinute(Convert.ToDouble(value)); - /// - public static RotationalSpeed RevolutionsPerSecond(this T value) => - RotationalSpeed.FromRevolutionsPerSecond(Convert.ToDouble(value)); + /// + public static RotationalSpeed RevolutionsPerSecond(this T value) => + RotationalSpeed.FromRevolutionsPerSecond(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToRotationalStiffnessExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToRotationalStiffnessExtensions.g.cs index 8784ebce04..3819dc4f2b 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToRotationalStiffnessExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToRotationalStiffnessExtensions.g.cs @@ -28,137 +28,137 @@ namespace UnitsNet.NumberExtensions.NumberToRotationalStiffness /// public static class NumberToRotationalStiffnessExtensions { - /// - public static RotationalStiffness CentinewtonMetersPerDegree(this T value) => - RotationalStiffness.FromCentinewtonMetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness CentinewtonMetersPerDegree(this T value) => + RotationalStiffness.FromCentinewtonMetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness CentinewtonMillimetersPerDegree(this T value) => - RotationalStiffness.FromCentinewtonMillimetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness CentinewtonMillimetersPerDegree(this T value) => + RotationalStiffness.FromCentinewtonMillimetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness CentinewtonMillimetersPerRadian(this T value) => - RotationalStiffness.FromCentinewtonMillimetersPerRadian(Convert.ToDouble(value)); + /// + public static RotationalStiffness CentinewtonMillimetersPerRadian(this T value) => + RotationalStiffness.FromCentinewtonMillimetersPerRadian(Convert.ToDouble(value)); - /// - public static RotationalStiffness DecanewtonMetersPerDegree(this T value) => - RotationalStiffness.FromDecanewtonMetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness DecanewtonMetersPerDegree(this T value) => + RotationalStiffness.FromDecanewtonMetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness DecanewtonMillimetersPerDegree(this T value) => - RotationalStiffness.FromDecanewtonMillimetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness DecanewtonMillimetersPerDegree(this T value) => + RotationalStiffness.FromDecanewtonMillimetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness DecanewtonMillimetersPerRadian(this T value) => - RotationalStiffness.FromDecanewtonMillimetersPerRadian(Convert.ToDouble(value)); + /// + public static RotationalStiffness DecanewtonMillimetersPerRadian(this T value) => + RotationalStiffness.FromDecanewtonMillimetersPerRadian(Convert.ToDouble(value)); - /// - public static RotationalStiffness DecinewtonMetersPerDegree(this T value) => - RotationalStiffness.FromDecinewtonMetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness DecinewtonMetersPerDegree(this T value) => + RotationalStiffness.FromDecinewtonMetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness DecinewtonMillimetersPerDegree(this T value) => - RotationalStiffness.FromDecinewtonMillimetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness DecinewtonMillimetersPerDegree(this T value) => + RotationalStiffness.FromDecinewtonMillimetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness DecinewtonMillimetersPerRadian(this T value) => - RotationalStiffness.FromDecinewtonMillimetersPerRadian(Convert.ToDouble(value)); + /// + public static RotationalStiffness DecinewtonMillimetersPerRadian(this T value) => + RotationalStiffness.FromDecinewtonMillimetersPerRadian(Convert.ToDouble(value)); - /// - public static RotationalStiffness KilonewtonMetersPerDegree(this T value) => - RotationalStiffness.FromKilonewtonMetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness KilonewtonMetersPerDegree(this T value) => + RotationalStiffness.FromKilonewtonMetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness KilonewtonMetersPerRadian(this T value) => - RotationalStiffness.FromKilonewtonMetersPerRadian(Convert.ToDouble(value)); + /// + public static RotationalStiffness KilonewtonMetersPerRadian(this T value) => + RotationalStiffness.FromKilonewtonMetersPerRadian(Convert.ToDouble(value)); - /// - public static RotationalStiffness KilonewtonMillimetersPerDegree(this T value) => - RotationalStiffness.FromKilonewtonMillimetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness KilonewtonMillimetersPerDegree(this T value) => + RotationalStiffness.FromKilonewtonMillimetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness KilonewtonMillimetersPerRadian(this T value) => - RotationalStiffness.FromKilonewtonMillimetersPerRadian(Convert.ToDouble(value)); + /// + public static RotationalStiffness KilonewtonMillimetersPerRadian(this T value) => + RotationalStiffness.FromKilonewtonMillimetersPerRadian(Convert.ToDouble(value)); - /// - public static RotationalStiffness KilopoundForceFeetPerDegrees(this T value) => - RotationalStiffness.FromKilopoundForceFeetPerDegrees(Convert.ToDouble(value)); + /// + public static RotationalStiffness KilopoundForceFeetPerDegrees(this T value) => + RotationalStiffness.FromKilopoundForceFeetPerDegrees(Convert.ToDouble(value)); - /// - public static RotationalStiffness MeganewtonMetersPerDegree(this T value) => - RotationalStiffness.FromMeganewtonMetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness MeganewtonMetersPerDegree(this T value) => + RotationalStiffness.FromMeganewtonMetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness MeganewtonMetersPerRadian(this T value) => - RotationalStiffness.FromMeganewtonMetersPerRadian(Convert.ToDouble(value)); + /// + public static RotationalStiffness MeganewtonMetersPerRadian(this T value) => + RotationalStiffness.FromMeganewtonMetersPerRadian(Convert.ToDouble(value)); - /// - public static RotationalStiffness MeganewtonMillimetersPerDegree(this T value) => - RotationalStiffness.FromMeganewtonMillimetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness MeganewtonMillimetersPerDegree(this T value) => + RotationalStiffness.FromMeganewtonMillimetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness MeganewtonMillimetersPerRadian(this T value) => - RotationalStiffness.FromMeganewtonMillimetersPerRadian(Convert.ToDouble(value)); + /// + public static RotationalStiffness MeganewtonMillimetersPerRadian(this T value) => + RotationalStiffness.FromMeganewtonMillimetersPerRadian(Convert.ToDouble(value)); - /// - public static RotationalStiffness MicronewtonMetersPerDegree(this T value) => - RotationalStiffness.FromMicronewtonMetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness MicronewtonMetersPerDegree(this T value) => + RotationalStiffness.FromMicronewtonMetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness MicronewtonMillimetersPerDegree(this T value) => - RotationalStiffness.FromMicronewtonMillimetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness MicronewtonMillimetersPerDegree(this T value) => + RotationalStiffness.FromMicronewtonMillimetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness MicronewtonMillimetersPerRadian(this T value) => - RotationalStiffness.FromMicronewtonMillimetersPerRadian(Convert.ToDouble(value)); + /// + public static RotationalStiffness MicronewtonMillimetersPerRadian(this T value) => + RotationalStiffness.FromMicronewtonMillimetersPerRadian(Convert.ToDouble(value)); - /// - public static RotationalStiffness MillinewtonMetersPerDegree(this T value) => - RotationalStiffness.FromMillinewtonMetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness MillinewtonMetersPerDegree(this T value) => + RotationalStiffness.FromMillinewtonMetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness MillinewtonMillimetersPerDegree(this T value) => - RotationalStiffness.FromMillinewtonMillimetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness MillinewtonMillimetersPerDegree(this T value) => + RotationalStiffness.FromMillinewtonMillimetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness MillinewtonMillimetersPerRadian(this T value) => - RotationalStiffness.FromMillinewtonMillimetersPerRadian(Convert.ToDouble(value)); + /// + public static RotationalStiffness MillinewtonMillimetersPerRadian(this T value) => + RotationalStiffness.FromMillinewtonMillimetersPerRadian(Convert.ToDouble(value)); - /// - public static RotationalStiffness NanonewtonMetersPerDegree(this T value) => - RotationalStiffness.FromNanonewtonMetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness NanonewtonMetersPerDegree(this T value) => + RotationalStiffness.FromNanonewtonMetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness NanonewtonMillimetersPerDegree(this T value) => - RotationalStiffness.FromNanonewtonMillimetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness NanonewtonMillimetersPerDegree(this T value) => + RotationalStiffness.FromNanonewtonMillimetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness NanonewtonMillimetersPerRadian(this T value) => - RotationalStiffness.FromNanonewtonMillimetersPerRadian(Convert.ToDouble(value)); + /// + public static RotationalStiffness NanonewtonMillimetersPerRadian(this T value) => + RotationalStiffness.FromNanonewtonMillimetersPerRadian(Convert.ToDouble(value)); - /// - public static RotationalStiffness NewtonMetersPerDegree(this T value) => - RotationalStiffness.FromNewtonMetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness NewtonMetersPerDegree(this T value) => + RotationalStiffness.FromNewtonMetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness NewtonMetersPerRadian(this T value) => - RotationalStiffness.FromNewtonMetersPerRadian(Convert.ToDouble(value)); + /// + public static RotationalStiffness NewtonMetersPerRadian(this T value) => + RotationalStiffness.FromNewtonMetersPerRadian(Convert.ToDouble(value)); - /// - public static RotationalStiffness NewtonMillimetersPerDegree(this T value) => - RotationalStiffness.FromNewtonMillimetersPerDegree(Convert.ToDouble(value)); + /// + public static RotationalStiffness NewtonMillimetersPerDegree(this T value) => + RotationalStiffness.FromNewtonMillimetersPerDegree(Convert.ToDouble(value)); - /// - public static RotationalStiffness NewtonMillimetersPerRadian(this T value) => - RotationalStiffness.FromNewtonMillimetersPerRadian(Convert.ToDouble(value)); + /// + public static RotationalStiffness NewtonMillimetersPerRadian(this T value) => + RotationalStiffness.FromNewtonMillimetersPerRadian(Convert.ToDouble(value)); - /// - public static RotationalStiffness PoundForceFeetPerRadian(this T value) => - RotationalStiffness.FromPoundForceFeetPerRadian(Convert.ToDouble(value)); + /// + public static RotationalStiffness PoundForceFeetPerRadian(this T value) => + RotationalStiffness.FromPoundForceFeetPerRadian(Convert.ToDouble(value)); - /// - public static RotationalStiffness PoundForceFeetPerDegrees(this T value) => - RotationalStiffness.FromPoundForceFeetPerDegrees(Convert.ToDouble(value)); + /// + public static RotationalStiffness PoundForceFeetPerDegrees(this T value) => + RotationalStiffness.FromPoundForceFeetPerDegrees(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToRotationalStiffnessPerLengthExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToRotationalStiffnessPerLengthExtensions.g.cs index d6cd6bb377..1364ef6ece 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToRotationalStiffnessPerLengthExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToRotationalStiffnessPerLengthExtensions.g.cs @@ -28,25 +28,25 @@ namespace UnitsNet.NumberExtensions.NumberToRotationalStiffnessPerLength /// public static class NumberToRotationalStiffnessPerLengthExtensions { - /// - public static RotationalStiffnessPerLength KilonewtonMetersPerRadianPerMeter(this T value) => - RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(Convert.ToDouble(value)); + /// + public static RotationalStiffnessPerLength KilonewtonMetersPerRadianPerMeter(this T value) => + RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(Convert.ToDouble(value)); - /// - public static RotationalStiffnessPerLength KilopoundForceFeetPerDegreesPerFeet(this T value) => - RotationalStiffnessPerLength.FromKilopoundForceFeetPerDegreesPerFeet(Convert.ToDouble(value)); + /// + public static RotationalStiffnessPerLength KilopoundForceFeetPerDegreesPerFeet(this T value) => + RotationalStiffnessPerLength.FromKilopoundForceFeetPerDegreesPerFeet(Convert.ToDouble(value)); - /// - public static RotationalStiffnessPerLength MeganewtonMetersPerRadianPerMeter(this T value) => - RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(Convert.ToDouble(value)); + /// + public static RotationalStiffnessPerLength MeganewtonMetersPerRadianPerMeter(this T value) => + RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(Convert.ToDouble(value)); - /// - public static RotationalStiffnessPerLength NewtonMetersPerRadianPerMeter(this T value) => - RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(Convert.ToDouble(value)); + /// + public static RotationalStiffnessPerLength NewtonMetersPerRadianPerMeter(this T value) => + RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(Convert.ToDouble(value)); - /// - public static RotationalStiffnessPerLength PoundForceFeetPerDegreesPerFeet(this T value) => - RotationalStiffnessPerLength.FromPoundForceFeetPerDegreesPerFeet(Convert.ToDouble(value)); + /// + public static RotationalStiffnessPerLength PoundForceFeetPerDegreesPerFeet(this T value) => + RotationalStiffnessPerLength.FromPoundForceFeetPerDegreesPerFeet(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToSolidAngleExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToSolidAngleExtensions.g.cs index fdbcfd2703..fe90173629 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToSolidAngleExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToSolidAngleExtensions.g.cs @@ -28,9 +28,9 @@ namespace UnitsNet.NumberExtensions.NumberToSolidAngle /// public static class NumberToSolidAngleExtensions { - /// - public static SolidAngle Steradians(this T value) => - SolidAngle.FromSteradians(Convert.ToDouble(value)); + /// + public static SolidAngle Steradians(this T value) => + SolidAngle.FromSteradians(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpecificEnergyExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpecificEnergyExtensions.g.cs index 5d02c7975f..d82c009ce4 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpecificEnergyExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpecificEnergyExtensions.g.cs @@ -28,105 +28,105 @@ namespace UnitsNet.NumberExtensions.NumberToSpecificEnergy /// public static class NumberToSpecificEnergyExtensions { - /// - public static SpecificEnergy BtuPerPound(this T value) => - SpecificEnergy.FromBtuPerPound(Convert.ToDouble(value)); + /// + public static SpecificEnergy BtuPerPound(this T value) => + SpecificEnergy.FromBtuPerPound(Convert.ToDouble(value)); - /// - public static SpecificEnergy CaloriesPerGram(this T value) => - SpecificEnergy.FromCaloriesPerGram(Convert.ToDouble(value)); + /// + public static SpecificEnergy CaloriesPerGram(this T value) => + SpecificEnergy.FromCaloriesPerGram(Convert.ToDouble(value)); - /// - public static SpecificEnergy GigawattDaysPerKilogram(this T value) => - SpecificEnergy.FromGigawattDaysPerKilogram(Convert.ToDouble(value)); + /// + public static SpecificEnergy GigawattDaysPerKilogram(this T value) => + SpecificEnergy.FromGigawattDaysPerKilogram(Convert.ToDouble(value)); - /// - public static SpecificEnergy GigawattDaysPerShortTon(this T value) => - SpecificEnergy.FromGigawattDaysPerShortTon(Convert.ToDouble(value)); + /// + public static SpecificEnergy GigawattDaysPerShortTon(this T value) => + SpecificEnergy.FromGigawattDaysPerShortTon(Convert.ToDouble(value)); - /// - public static SpecificEnergy GigawattDaysPerTonne(this T value) => - SpecificEnergy.FromGigawattDaysPerTonne(Convert.ToDouble(value)); + /// + public static SpecificEnergy GigawattDaysPerTonne(this T value) => + SpecificEnergy.FromGigawattDaysPerTonne(Convert.ToDouble(value)); - /// - public static SpecificEnergy GigawattHoursPerKilogram(this T value) => - SpecificEnergy.FromGigawattHoursPerKilogram(Convert.ToDouble(value)); + /// + public static SpecificEnergy GigawattHoursPerKilogram(this T value) => + SpecificEnergy.FromGigawattHoursPerKilogram(Convert.ToDouble(value)); - /// - public static SpecificEnergy JoulesPerKilogram(this T value) => - SpecificEnergy.FromJoulesPerKilogram(Convert.ToDouble(value)); + /// + public static SpecificEnergy JoulesPerKilogram(this T value) => + SpecificEnergy.FromJoulesPerKilogram(Convert.ToDouble(value)); - /// - public static SpecificEnergy KilocaloriesPerGram(this T value) => - SpecificEnergy.FromKilocaloriesPerGram(Convert.ToDouble(value)); + /// + public static SpecificEnergy KilocaloriesPerGram(this T value) => + SpecificEnergy.FromKilocaloriesPerGram(Convert.ToDouble(value)); - /// - public static SpecificEnergy KilojoulesPerKilogram(this T value) => - SpecificEnergy.FromKilojoulesPerKilogram(Convert.ToDouble(value)); + /// + public static SpecificEnergy KilojoulesPerKilogram(this T value) => + SpecificEnergy.FromKilojoulesPerKilogram(Convert.ToDouble(value)); - /// - public static SpecificEnergy KilowattDaysPerKilogram(this T value) => - SpecificEnergy.FromKilowattDaysPerKilogram(Convert.ToDouble(value)); + /// + public static SpecificEnergy KilowattDaysPerKilogram(this T value) => + SpecificEnergy.FromKilowattDaysPerKilogram(Convert.ToDouble(value)); - /// - public static SpecificEnergy KilowattDaysPerShortTon(this T value) => - SpecificEnergy.FromKilowattDaysPerShortTon(Convert.ToDouble(value)); + /// + public static SpecificEnergy KilowattDaysPerShortTon(this T value) => + SpecificEnergy.FromKilowattDaysPerShortTon(Convert.ToDouble(value)); - /// - public static SpecificEnergy KilowattDaysPerTonne(this T value) => - SpecificEnergy.FromKilowattDaysPerTonne(Convert.ToDouble(value)); + /// + public static SpecificEnergy KilowattDaysPerTonne(this T value) => + SpecificEnergy.FromKilowattDaysPerTonne(Convert.ToDouble(value)); - /// - public static SpecificEnergy KilowattHoursPerKilogram(this T value) => - SpecificEnergy.FromKilowattHoursPerKilogram(Convert.ToDouble(value)); + /// + public static SpecificEnergy KilowattHoursPerKilogram(this T value) => + SpecificEnergy.FromKilowattHoursPerKilogram(Convert.ToDouble(value)); - /// - public static SpecificEnergy MegajoulesPerKilogram(this T value) => - SpecificEnergy.FromMegajoulesPerKilogram(Convert.ToDouble(value)); + /// + public static SpecificEnergy MegajoulesPerKilogram(this T value) => + SpecificEnergy.FromMegajoulesPerKilogram(Convert.ToDouble(value)); - /// - public static SpecificEnergy MegawattDaysPerKilogram(this T value) => - SpecificEnergy.FromMegawattDaysPerKilogram(Convert.ToDouble(value)); + /// + public static SpecificEnergy MegawattDaysPerKilogram(this T value) => + SpecificEnergy.FromMegawattDaysPerKilogram(Convert.ToDouble(value)); - /// - public static SpecificEnergy MegawattDaysPerShortTon(this T value) => - SpecificEnergy.FromMegawattDaysPerShortTon(Convert.ToDouble(value)); + /// + public static SpecificEnergy MegawattDaysPerShortTon(this T value) => + SpecificEnergy.FromMegawattDaysPerShortTon(Convert.ToDouble(value)); - /// - public static SpecificEnergy MegawattDaysPerTonne(this T value) => - SpecificEnergy.FromMegawattDaysPerTonne(Convert.ToDouble(value)); + /// + public static SpecificEnergy MegawattDaysPerTonne(this T value) => + SpecificEnergy.FromMegawattDaysPerTonne(Convert.ToDouble(value)); - /// - public static SpecificEnergy MegawattHoursPerKilogram(this T value) => - SpecificEnergy.FromMegawattHoursPerKilogram(Convert.ToDouble(value)); + /// + public static SpecificEnergy MegawattHoursPerKilogram(this T value) => + SpecificEnergy.FromMegawattHoursPerKilogram(Convert.ToDouble(value)); - /// - public static SpecificEnergy TerawattDaysPerKilogram(this T value) => - SpecificEnergy.FromTerawattDaysPerKilogram(Convert.ToDouble(value)); + /// + public static SpecificEnergy TerawattDaysPerKilogram(this T value) => + SpecificEnergy.FromTerawattDaysPerKilogram(Convert.ToDouble(value)); - /// - public static SpecificEnergy TerawattDaysPerShortTon(this T value) => - SpecificEnergy.FromTerawattDaysPerShortTon(Convert.ToDouble(value)); + /// + public static SpecificEnergy TerawattDaysPerShortTon(this T value) => + SpecificEnergy.FromTerawattDaysPerShortTon(Convert.ToDouble(value)); - /// - public static SpecificEnergy TerawattDaysPerTonne(this T value) => - SpecificEnergy.FromTerawattDaysPerTonne(Convert.ToDouble(value)); + /// + public static SpecificEnergy TerawattDaysPerTonne(this T value) => + SpecificEnergy.FromTerawattDaysPerTonne(Convert.ToDouble(value)); - /// - public static SpecificEnergy WattDaysPerKilogram(this T value) => - SpecificEnergy.FromWattDaysPerKilogram(Convert.ToDouble(value)); + /// + public static SpecificEnergy WattDaysPerKilogram(this T value) => + SpecificEnergy.FromWattDaysPerKilogram(Convert.ToDouble(value)); - /// - public static SpecificEnergy WattDaysPerShortTon(this T value) => - SpecificEnergy.FromWattDaysPerShortTon(Convert.ToDouble(value)); + /// + public static SpecificEnergy WattDaysPerShortTon(this T value) => + SpecificEnergy.FromWattDaysPerShortTon(Convert.ToDouble(value)); - /// - public static SpecificEnergy WattDaysPerTonne(this T value) => - SpecificEnergy.FromWattDaysPerTonne(Convert.ToDouble(value)); + /// + public static SpecificEnergy WattDaysPerTonne(this T value) => + SpecificEnergy.FromWattDaysPerTonne(Convert.ToDouble(value)); - /// - public static SpecificEnergy WattHoursPerKilogram(this T value) => - SpecificEnergy.FromWattHoursPerKilogram(Convert.ToDouble(value)); + /// + public static SpecificEnergy WattHoursPerKilogram(this T value) => + SpecificEnergy.FromWattHoursPerKilogram(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpecificEntropyExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpecificEntropyExtensions.g.cs index 2cf3ea386c..04ba0a1451 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpecificEntropyExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpecificEntropyExtensions.g.cs @@ -28,41 +28,41 @@ namespace UnitsNet.NumberExtensions.NumberToSpecificEntropy /// public static class NumberToSpecificEntropyExtensions { - /// - public static SpecificEntropy BtusPerPoundFahrenheit(this T value) => - SpecificEntropy.FromBtusPerPoundFahrenheit(Convert.ToDouble(value)); + /// + public static SpecificEntropy BtusPerPoundFahrenheit(this T value) => + SpecificEntropy.FromBtusPerPoundFahrenheit(Convert.ToDouble(value)); - /// - public static SpecificEntropy CaloriesPerGramKelvin(this T value) => - SpecificEntropy.FromCaloriesPerGramKelvin(Convert.ToDouble(value)); + /// + public static SpecificEntropy CaloriesPerGramKelvin(this T value) => + SpecificEntropy.FromCaloriesPerGramKelvin(Convert.ToDouble(value)); - /// - public static SpecificEntropy JoulesPerKilogramDegreeCelsius(this T value) => - SpecificEntropy.FromJoulesPerKilogramDegreeCelsius(Convert.ToDouble(value)); + /// + public static SpecificEntropy JoulesPerKilogramDegreeCelsius(this T value) => + SpecificEntropy.FromJoulesPerKilogramDegreeCelsius(Convert.ToDouble(value)); - /// - public static SpecificEntropy JoulesPerKilogramKelvin(this T value) => - SpecificEntropy.FromJoulesPerKilogramKelvin(Convert.ToDouble(value)); + /// + public static SpecificEntropy JoulesPerKilogramKelvin(this T value) => + SpecificEntropy.FromJoulesPerKilogramKelvin(Convert.ToDouble(value)); - /// - public static SpecificEntropy KilocaloriesPerGramKelvin(this T value) => - SpecificEntropy.FromKilocaloriesPerGramKelvin(Convert.ToDouble(value)); + /// + public static SpecificEntropy KilocaloriesPerGramKelvin(this T value) => + SpecificEntropy.FromKilocaloriesPerGramKelvin(Convert.ToDouble(value)); - /// - public static SpecificEntropy KilojoulesPerKilogramDegreeCelsius(this T value) => - SpecificEntropy.FromKilojoulesPerKilogramDegreeCelsius(Convert.ToDouble(value)); + /// + public static SpecificEntropy KilojoulesPerKilogramDegreeCelsius(this T value) => + SpecificEntropy.FromKilojoulesPerKilogramDegreeCelsius(Convert.ToDouble(value)); - /// - public static SpecificEntropy KilojoulesPerKilogramKelvin(this T value) => - SpecificEntropy.FromKilojoulesPerKilogramKelvin(Convert.ToDouble(value)); + /// + public static SpecificEntropy KilojoulesPerKilogramKelvin(this T value) => + SpecificEntropy.FromKilojoulesPerKilogramKelvin(Convert.ToDouble(value)); - /// - public static SpecificEntropy MegajoulesPerKilogramDegreeCelsius(this T value) => - SpecificEntropy.FromMegajoulesPerKilogramDegreeCelsius(Convert.ToDouble(value)); + /// + public static SpecificEntropy MegajoulesPerKilogramDegreeCelsius(this T value) => + SpecificEntropy.FromMegajoulesPerKilogramDegreeCelsius(Convert.ToDouble(value)); - /// - public static SpecificEntropy MegajoulesPerKilogramKelvin(this T value) => - SpecificEntropy.FromMegajoulesPerKilogramKelvin(Convert.ToDouble(value)); + /// + public static SpecificEntropy MegajoulesPerKilogramKelvin(this T value) => + SpecificEntropy.FromMegajoulesPerKilogramKelvin(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpecificVolumeExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpecificVolumeExtensions.g.cs index ee2d77d537..1cd2a71486 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpecificVolumeExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpecificVolumeExtensions.g.cs @@ -28,17 +28,17 @@ namespace UnitsNet.NumberExtensions.NumberToSpecificVolume /// public static class NumberToSpecificVolumeExtensions { - /// - public static SpecificVolume CubicFeetPerPound(this T value) => - SpecificVolume.FromCubicFeetPerPound(Convert.ToDouble(value)); + /// + public static SpecificVolume CubicFeetPerPound(this T value) => + SpecificVolume.FromCubicFeetPerPound(Convert.ToDouble(value)); - /// - public static SpecificVolume CubicMetersPerKilogram(this T value) => - SpecificVolume.FromCubicMetersPerKilogram(Convert.ToDouble(value)); + /// + public static SpecificVolume CubicMetersPerKilogram(this T value) => + SpecificVolume.FromCubicMetersPerKilogram(Convert.ToDouble(value)); - /// - public static SpecificVolume MillicubicMetersPerKilogram(this T value) => - SpecificVolume.FromMillicubicMetersPerKilogram(Convert.ToDouble(value)); + /// + public static SpecificVolume MillicubicMetersPerKilogram(this T value) => + SpecificVolume.FromMillicubicMetersPerKilogram(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpecificWeightExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpecificWeightExtensions.g.cs index c21e5d0d51..621679d58b 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpecificWeightExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpecificWeightExtensions.g.cs @@ -28,73 +28,73 @@ namespace UnitsNet.NumberExtensions.NumberToSpecificWeight /// public static class NumberToSpecificWeightExtensions { - /// - public static SpecificWeight KilogramsForcePerCubicCentimeter(this T value) => - SpecificWeight.FromKilogramsForcePerCubicCentimeter(Convert.ToDouble(value)); + /// + public static SpecificWeight KilogramsForcePerCubicCentimeter(this T value) => + SpecificWeight.FromKilogramsForcePerCubicCentimeter(Convert.ToDouble(value)); - /// - public static SpecificWeight KilogramsForcePerCubicMeter(this T value) => - SpecificWeight.FromKilogramsForcePerCubicMeter(Convert.ToDouble(value)); + /// + public static SpecificWeight KilogramsForcePerCubicMeter(this T value) => + SpecificWeight.FromKilogramsForcePerCubicMeter(Convert.ToDouble(value)); - /// - public static SpecificWeight KilogramsForcePerCubicMillimeter(this T value) => - SpecificWeight.FromKilogramsForcePerCubicMillimeter(Convert.ToDouble(value)); + /// + public static SpecificWeight KilogramsForcePerCubicMillimeter(this T value) => + SpecificWeight.FromKilogramsForcePerCubicMillimeter(Convert.ToDouble(value)); - /// - public static SpecificWeight KilonewtonsPerCubicCentimeter(this T value) => - SpecificWeight.FromKilonewtonsPerCubicCentimeter(Convert.ToDouble(value)); + /// + public static SpecificWeight KilonewtonsPerCubicCentimeter(this T value) => + SpecificWeight.FromKilonewtonsPerCubicCentimeter(Convert.ToDouble(value)); - /// - public static SpecificWeight KilonewtonsPerCubicMeter(this T value) => - SpecificWeight.FromKilonewtonsPerCubicMeter(Convert.ToDouble(value)); + /// + public static SpecificWeight KilonewtonsPerCubicMeter(this T value) => + SpecificWeight.FromKilonewtonsPerCubicMeter(Convert.ToDouble(value)); - /// - public static SpecificWeight KilonewtonsPerCubicMillimeter(this T value) => - SpecificWeight.FromKilonewtonsPerCubicMillimeter(Convert.ToDouble(value)); + /// + public static SpecificWeight KilonewtonsPerCubicMillimeter(this T value) => + SpecificWeight.FromKilonewtonsPerCubicMillimeter(Convert.ToDouble(value)); - /// - public static SpecificWeight KilopoundsForcePerCubicFoot(this T value) => - SpecificWeight.FromKilopoundsForcePerCubicFoot(Convert.ToDouble(value)); + /// + public static SpecificWeight KilopoundsForcePerCubicFoot(this T value) => + SpecificWeight.FromKilopoundsForcePerCubicFoot(Convert.ToDouble(value)); - /// - public static SpecificWeight KilopoundsForcePerCubicInch(this T value) => - SpecificWeight.FromKilopoundsForcePerCubicInch(Convert.ToDouble(value)); + /// + public static SpecificWeight KilopoundsForcePerCubicInch(this T value) => + SpecificWeight.FromKilopoundsForcePerCubicInch(Convert.ToDouble(value)); - /// - public static SpecificWeight MeganewtonsPerCubicMeter(this T value) => - SpecificWeight.FromMeganewtonsPerCubicMeter(Convert.ToDouble(value)); + /// + public static SpecificWeight MeganewtonsPerCubicMeter(this T value) => + SpecificWeight.FromMeganewtonsPerCubicMeter(Convert.ToDouble(value)); - /// - public static SpecificWeight NewtonsPerCubicCentimeter(this T value) => - SpecificWeight.FromNewtonsPerCubicCentimeter(Convert.ToDouble(value)); + /// + public static SpecificWeight NewtonsPerCubicCentimeter(this T value) => + SpecificWeight.FromNewtonsPerCubicCentimeter(Convert.ToDouble(value)); - /// - public static SpecificWeight NewtonsPerCubicMeter(this T value) => - SpecificWeight.FromNewtonsPerCubicMeter(Convert.ToDouble(value)); + /// + public static SpecificWeight NewtonsPerCubicMeter(this T value) => + SpecificWeight.FromNewtonsPerCubicMeter(Convert.ToDouble(value)); - /// - public static SpecificWeight NewtonsPerCubicMillimeter(this T value) => - SpecificWeight.FromNewtonsPerCubicMillimeter(Convert.ToDouble(value)); + /// + public static SpecificWeight NewtonsPerCubicMillimeter(this T value) => + SpecificWeight.FromNewtonsPerCubicMillimeter(Convert.ToDouble(value)); - /// - public static SpecificWeight PoundsForcePerCubicFoot(this T value) => - SpecificWeight.FromPoundsForcePerCubicFoot(Convert.ToDouble(value)); + /// + public static SpecificWeight PoundsForcePerCubicFoot(this T value) => + SpecificWeight.FromPoundsForcePerCubicFoot(Convert.ToDouble(value)); - /// - public static SpecificWeight PoundsForcePerCubicInch(this T value) => - SpecificWeight.FromPoundsForcePerCubicInch(Convert.ToDouble(value)); + /// + public static SpecificWeight PoundsForcePerCubicInch(this T value) => + SpecificWeight.FromPoundsForcePerCubicInch(Convert.ToDouble(value)); - /// - public static SpecificWeight TonnesForcePerCubicCentimeter(this T value) => - SpecificWeight.FromTonnesForcePerCubicCentimeter(Convert.ToDouble(value)); + /// + public static SpecificWeight TonnesForcePerCubicCentimeter(this T value) => + SpecificWeight.FromTonnesForcePerCubicCentimeter(Convert.ToDouble(value)); - /// - public static SpecificWeight TonnesForcePerCubicMeter(this T value) => - SpecificWeight.FromTonnesForcePerCubicMeter(Convert.ToDouble(value)); + /// + public static SpecificWeight TonnesForcePerCubicMeter(this T value) => + SpecificWeight.FromTonnesForcePerCubicMeter(Convert.ToDouble(value)); - /// - public static SpecificWeight TonnesForcePerCubicMillimeter(this T value) => - SpecificWeight.FromTonnesForcePerCubicMillimeter(Convert.ToDouble(value)); + /// + public static SpecificWeight TonnesForcePerCubicMillimeter(this T value) => + SpecificWeight.FromTonnesForcePerCubicMillimeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpeedExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpeedExtensions.g.cs index 687b90db47..5ce164060f 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpeedExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpeedExtensions.g.cs @@ -28,133 +28,133 @@ namespace UnitsNet.NumberExtensions.NumberToSpeed /// public static class NumberToSpeedExtensions { - /// - public static Speed CentimetersPerHour(this T value) => - Speed.FromCentimetersPerHour(Convert.ToDouble(value)); + /// + public static Speed CentimetersPerHour(this T value) => + Speed.FromCentimetersPerHour(Convert.ToDouble(value)); - /// - public static Speed CentimetersPerMinutes(this T value) => - Speed.FromCentimetersPerMinutes(Convert.ToDouble(value)); + /// + public static Speed CentimetersPerMinutes(this T value) => + Speed.FromCentimetersPerMinutes(Convert.ToDouble(value)); - /// - public static Speed CentimetersPerSecond(this T value) => - Speed.FromCentimetersPerSecond(Convert.ToDouble(value)); + /// + public static Speed CentimetersPerSecond(this T value) => + Speed.FromCentimetersPerSecond(Convert.ToDouble(value)); - /// - public static Speed DecimetersPerMinutes(this T value) => - Speed.FromDecimetersPerMinutes(Convert.ToDouble(value)); + /// + public static Speed DecimetersPerMinutes(this T value) => + Speed.FromDecimetersPerMinutes(Convert.ToDouble(value)); - /// - public static Speed DecimetersPerSecond(this T value) => - Speed.FromDecimetersPerSecond(Convert.ToDouble(value)); + /// + public static Speed DecimetersPerSecond(this T value) => + Speed.FromDecimetersPerSecond(Convert.ToDouble(value)); - /// - public static Speed FeetPerHour(this T value) => - Speed.FromFeetPerHour(Convert.ToDouble(value)); + /// + public static Speed FeetPerHour(this T value) => + Speed.FromFeetPerHour(Convert.ToDouble(value)); - /// - public static Speed FeetPerMinute(this T value) => - Speed.FromFeetPerMinute(Convert.ToDouble(value)); + /// + public static Speed FeetPerMinute(this T value) => + Speed.FromFeetPerMinute(Convert.ToDouble(value)); - /// - public static Speed FeetPerSecond(this T value) => - Speed.FromFeetPerSecond(Convert.ToDouble(value)); + /// + public static Speed FeetPerSecond(this T value) => + Speed.FromFeetPerSecond(Convert.ToDouble(value)); - /// - public static Speed InchesPerHour(this T value) => - Speed.FromInchesPerHour(Convert.ToDouble(value)); + /// + public static Speed InchesPerHour(this T value) => + Speed.FromInchesPerHour(Convert.ToDouble(value)); - /// - public static Speed InchesPerMinute(this T value) => - Speed.FromInchesPerMinute(Convert.ToDouble(value)); + /// + public static Speed InchesPerMinute(this T value) => + Speed.FromInchesPerMinute(Convert.ToDouble(value)); - /// - public static Speed InchesPerSecond(this T value) => - Speed.FromInchesPerSecond(Convert.ToDouble(value)); + /// + public static Speed InchesPerSecond(this T value) => + Speed.FromInchesPerSecond(Convert.ToDouble(value)); - /// - public static Speed KilometersPerHour(this T value) => - Speed.FromKilometersPerHour(Convert.ToDouble(value)); + /// + public static Speed KilometersPerHour(this T value) => + Speed.FromKilometersPerHour(Convert.ToDouble(value)); - /// - public static Speed KilometersPerMinutes(this T value) => - Speed.FromKilometersPerMinutes(Convert.ToDouble(value)); + /// + public static Speed KilometersPerMinutes(this T value) => + Speed.FromKilometersPerMinutes(Convert.ToDouble(value)); - /// - public static Speed KilometersPerSecond(this T value) => - Speed.FromKilometersPerSecond(Convert.ToDouble(value)); + /// + public static Speed KilometersPerSecond(this T value) => + Speed.FromKilometersPerSecond(Convert.ToDouble(value)); - /// - public static Speed Knots(this T value) => - Speed.FromKnots(Convert.ToDouble(value)); + /// + public static Speed Knots(this T value) => + Speed.FromKnots(Convert.ToDouble(value)); - /// - public static Speed MetersPerHour(this T value) => - Speed.FromMetersPerHour(Convert.ToDouble(value)); + /// + public static Speed MetersPerHour(this T value) => + Speed.FromMetersPerHour(Convert.ToDouble(value)); - /// - public static Speed MetersPerMinutes(this T value) => - Speed.FromMetersPerMinutes(Convert.ToDouble(value)); + /// + public static Speed MetersPerMinutes(this T value) => + Speed.FromMetersPerMinutes(Convert.ToDouble(value)); - /// - public static Speed MetersPerSecond(this T value) => - Speed.FromMetersPerSecond(Convert.ToDouble(value)); + /// + public static Speed MetersPerSecond(this T value) => + Speed.FromMetersPerSecond(Convert.ToDouble(value)); - /// - public static Speed MicrometersPerMinutes(this T value) => - Speed.FromMicrometersPerMinutes(Convert.ToDouble(value)); + /// + public static Speed MicrometersPerMinutes(this T value) => + Speed.FromMicrometersPerMinutes(Convert.ToDouble(value)); - /// - public static Speed MicrometersPerSecond(this T value) => - Speed.FromMicrometersPerSecond(Convert.ToDouble(value)); + /// + public static Speed MicrometersPerSecond(this T value) => + Speed.FromMicrometersPerSecond(Convert.ToDouble(value)); - /// - public static Speed MilesPerHour(this T value) => - Speed.FromMilesPerHour(Convert.ToDouble(value)); + /// + public static Speed MilesPerHour(this T value) => + Speed.FromMilesPerHour(Convert.ToDouble(value)); - /// - public static Speed MillimetersPerHour(this T value) => - Speed.FromMillimetersPerHour(Convert.ToDouble(value)); + /// + public static Speed MillimetersPerHour(this T value) => + Speed.FromMillimetersPerHour(Convert.ToDouble(value)); - /// - public static Speed MillimetersPerMinutes(this T value) => - Speed.FromMillimetersPerMinutes(Convert.ToDouble(value)); + /// + public static Speed MillimetersPerMinutes(this T value) => + Speed.FromMillimetersPerMinutes(Convert.ToDouble(value)); - /// - public static Speed MillimetersPerSecond(this T value) => - Speed.FromMillimetersPerSecond(Convert.ToDouble(value)); + /// + public static Speed MillimetersPerSecond(this T value) => + Speed.FromMillimetersPerSecond(Convert.ToDouble(value)); - /// - public static Speed NanometersPerMinutes(this T value) => - Speed.FromNanometersPerMinutes(Convert.ToDouble(value)); + /// + public static Speed NanometersPerMinutes(this T value) => + Speed.FromNanometersPerMinutes(Convert.ToDouble(value)); - /// - public static Speed NanometersPerSecond(this T value) => - Speed.FromNanometersPerSecond(Convert.ToDouble(value)); + /// + public static Speed NanometersPerSecond(this T value) => + Speed.FromNanometersPerSecond(Convert.ToDouble(value)); - /// - public static Speed UsSurveyFeetPerHour(this T value) => - Speed.FromUsSurveyFeetPerHour(Convert.ToDouble(value)); + /// + public static Speed UsSurveyFeetPerHour(this T value) => + Speed.FromUsSurveyFeetPerHour(Convert.ToDouble(value)); - /// - public static Speed UsSurveyFeetPerMinute(this T value) => - Speed.FromUsSurveyFeetPerMinute(Convert.ToDouble(value)); + /// + public static Speed UsSurveyFeetPerMinute(this T value) => + Speed.FromUsSurveyFeetPerMinute(Convert.ToDouble(value)); - /// - public static Speed UsSurveyFeetPerSecond(this T value) => - Speed.FromUsSurveyFeetPerSecond(Convert.ToDouble(value)); + /// + public static Speed UsSurveyFeetPerSecond(this T value) => + Speed.FromUsSurveyFeetPerSecond(Convert.ToDouble(value)); - /// - public static Speed YardsPerHour(this T value) => - Speed.FromYardsPerHour(Convert.ToDouble(value)); + /// + public static Speed YardsPerHour(this T value) => + Speed.FromYardsPerHour(Convert.ToDouble(value)); - /// - public static Speed YardsPerMinute(this T value) => - Speed.FromYardsPerMinute(Convert.ToDouble(value)); + /// + public static Speed YardsPerMinute(this T value) => + Speed.FromYardsPerMinute(Convert.ToDouble(value)); - /// - public static Speed YardsPerSecond(this T value) => - Speed.FromYardsPerSecond(Convert.ToDouble(value)); + /// + public static Speed YardsPerSecond(this T value) => + Speed.FromYardsPerSecond(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureChangeRateExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureChangeRateExtensions.g.cs index e4def9ea99..2168ad589c 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureChangeRateExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureChangeRateExtensions.g.cs @@ -28,45 +28,45 @@ namespace UnitsNet.NumberExtensions.NumberToTemperatureChangeRate /// public static class NumberToTemperatureChangeRateExtensions { - /// - public static TemperatureChangeRate CentidegreesCelsiusPerSecond(this T value) => - TemperatureChangeRate.FromCentidegreesCelsiusPerSecond(Convert.ToDouble(value)); + /// + public static TemperatureChangeRate CentidegreesCelsiusPerSecond(this T value) => + TemperatureChangeRate.FromCentidegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - public static TemperatureChangeRate DecadegreesCelsiusPerSecond(this T value) => - TemperatureChangeRate.FromDecadegreesCelsiusPerSecond(Convert.ToDouble(value)); + /// + public static TemperatureChangeRate DecadegreesCelsiusPerSecond(this T value) => + TemperatureChangeRate.FromDecadegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - public static TemperatureChangeRate DecidegreesCelsiusPerSecond(this T value) => - TemperatureChangeRate.FromDecidegreesCelsiusPerSecond(Convert.ToDouble(value)); + /// + public static TemperatureChangeRate DecidegreesCelsiusPerSecond(this T value) => + TemperatureChangeRate.FromDecidegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - public static TemperatureChangeRate DegreesCelsiusPerMinute(this T value) => - TemperatureChangeRate.FromDegreesCelsiusPerMinute(Convert.ToDouble(value)); + /// + public static TemperatureChangeRate DegreesCelsiusPerMinute(this T value) => + TemperatureChangeRate.FromDegreesCelsiusPerMinute(Convert.ToDouble(value)); - /// - public static TemperatureChangeRate DegreesCelsiusPerSecond(this T value) => - TemperatureChangeRate.FromDegreesCelsiusPerSecond(Convert.ToDouble(value)); + /// + public static TemperatureChangeRate DegreesCelsiusPerSecond(this T value) => + TemperatureChangeRate.FromDegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - public static TemperatureChangeRate HectodegreesCelsiusPerSecond(this T value) => - TemperatureChangeRate.FromHectodegreesCelsiusPerSecond(Convert.ToDouble(value)); + /// + public static TemperatureChangeRate HectodegreesCelsiusPerSecond(this T value) => + TemperatureChangeRate.FromHectodegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - public static TemperatureChangeRate KilodegreesCelsiusPerSecond(this T value) => - TemperatureChangeRate.FromKilodegreesCelsiusPerSecond(Convert.ToDouble(value)); + /// + public static TemperatureChangeRate KilodegreesCelsiusPerSecond(this T value) => + TemperatureChangeRate.FromKilodegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - public static TemperatureChangeRate MicrodegreesCelsiusPerSecond(this T value) => - TemperatureChangeRate.FromMicrodegreesCelsiusPerSecond(Convert.ToDouble(value)); + /// + public static TemperatureChangeRate MicrodegreesCelsiusPerSecond(this T value) => + TemperatureChangeRate.FromMicrodegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - public static TemperatureChangeRate MillidegreesCelsiusPerSecond(this T value) => - TemperatureChangeRate.FromMillidegreesCelsiusPerSecond(Convert.ToDouble(value)); + /// + public static TemperatureChangeRate MillidegreesCelsiusPerSecond(this T value) => + TemperatureChangeRate.FromMillidegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - public static TemperatureChangeRate NanodegreesCelsiusPerSecond(this T value) => - TemperatureChangeRate.FromNanodegreesCelsiusPerSecond(Convert.ToDouble(value)); + /// + public static TemperatureChangeRate NanodegreesCelsiusPerSecond(this T value) => + TemperatureChangeRate.FromNanodegreesCelsiusPerSecond(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureDeltaExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureDeltaExtensions.g.cs index 408c8afa08..041e53c555 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureDeltaExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureDeltaExtensions.g.cs @@ -28,41 +28,41 @@ namespace UnitsNet.NumberExtensions.NumberToTemperatureDelta /// public static class NumberToTemperatureDeltaExtensions { - /// - public static TemperatureDelta DegreesCelsius(this T value) => - TemperatureDelta.FromDegreesCelsius(Convert.ToDouble(value)); + /// + public static TemperatureDelta DegreesCelsius(this T value) => + TemperatureDelta.FromDegreesCelsius(Convert.ToDouble(value)); - /// - public static TemperatureDelta DegreesDelisle(this T value) => - TemperatureDelta.FromDegreesDelisle(Convert.ToDouble(value)); + /// + public static TemperatureDelta DegreesDelisle(this T value) => + TemperatureDelta.FromDegreesDelisle(Convert.ToDouble(value)); - /// - public static TemperatureDelta DegreesFahrenheit(this T value) => - TemperatureDelta.FromDegreesFahrenheit(Convert.ToDouble(value)); + /// + public static TemperatureDelta DegreesFahrenheit(this T value) => + TemperatureDelta.FromDegreesFahrenheit(Convert.ToDouble(value)); - /// - public static TemperatureDelta DegreesNewton(this T value) => - TemperatureDelta.FromDegreesNewton(Convert.ToDouble(value)); + /// + public static TemperatureDelta DegreesNewton(this T value) => + TemperatureDelta.FromDegreesNewton(Convert.ToDouble(value)); - /// - public static TemperatureDelta DegreesRankine(this T value) => - TemperatureDelta.FromDegreesRankine(Convert.ToDouble(value)); + /// + public static TemperatureDelta DegreesRankine(this T value) => + TemperatureDelta.FromDegreesRankine(Convert.ToDouble(value)); - /// - public static TemperatureDelta DegreesReaumur(this T value) => - TemperatureDelta.FromDegreesReaumur(Convert.ToDouble(value)); + /// + public static TemperatureDelta DegreesReaumur(this T value) => + TemperatureDelta.FromDegreesReaumur(Convert.ToDouble(value)); - /// - public static TemperatureDelta DegreesRoemer(this T value) => - TemperatureDelta.FromDegreesRoemer(Convert.ToDouble(value)); + /// + public static TemperatureDelta DegreesRoemer(this T value) => + TemperatureDelta.FromDegreesRoemer(Convert.ToDouble(value)); - /// - public static TemperatureDelta Kelvins(this T value) => - TemperatureDelta.FromKelvins(Convert.ToDouble(value)); + /// + public static TemperatureDelta Kelvins(this T value) => + TemperatureDelta.FromKelvins(Convert.ToDouble(value)); - /// - public static TemperatureDelta MillidegreesCelsius(this T value) => - TemperatureDelta.FromMillidegreesCelsius(Convert.ToDouble(value)); + /// + public static TemperatureDelta MillidegreesCelsius(this T value) => + TemperatureDelta.FromMillidegreesCelsius(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureExtensions.g.cs index 2fed0ca505..6e4e36de2e 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureExtensions.g.cs @@ -28,45 +28,45 @@ namespace UnitsNet.NumberExtensions.NumberToTemperature /// public static class NumberToTemperatureExtensions { - /// - public static Temperature DegreesCelsius(this T value) => - Temperature.FromDegreesCelsius(Convert.ToDouble(value)); + /// + public static Temperature DegreesCelsius(this T value) => + Temperature.FromDegreesCelsius(Convert.ToDouble(value)); - /// - public static Temperature DegreesDelisle(this T value) => - Temperature.FromDegreesDelisle(Convert.ToDouble(value)); + /// + public static Temperature DegreesDelisle(this T value) => + Temperature.FromDegreesDelisle(Convert.ToDouble(value)); - /// - public static Temperature DegreesFahrenheit(this T value) => - Temperature.FromDegreesFahrenheit(Convert.ToDouble(value)); + /// + public static Temperature DegreesFahrenheit(this T value) => + Temperature.FromDegreesFahrenheit(Convert.ToDouble(value)); - /// - public static Temperature DegreesNewton(this T value) => - Temperature.FromDegreesNewton(Convert.ToDouble(value)); + /// + public static Temperature DegreesNewton(this T value) => + Temperature.FromDegreesNewton(Convert.ToDouble(value)); - /// - public static Temperature DegreesRankine(this T value) => - Temperature.FromDegreesRankine(Convert.ToDouble(value)); + /// + public static Temperature DegreesRankine(this T value) => + Temperature.FromDegreesRankine(Convert.ToDouble(value)); - /// - public static Temperature DegreesReaumur(this T value) => - Temperature.FromDegreesReaumur(Convert.ToDouble(value)); + /// + public static Temperature DegreesReaumur(this T value) => + Temperature.FromDegreesReaumur(Convert.ToDouble(value)); - /// - public static Temperature DegreesRoemer(this T value) => - Temperature.FromDegreesRoemer(Convert.ToDouble(value)); + /// + public static Temperature DegreesRoemer(this T value) => + Temperature.FromDegreesRoemer(Convert.ToDouble(value)); - /// - public static Temperature Kelvins(this T value) => - Temperature.FromKelvins(Convert.ToDouble(value)); + /// + public static Temperature Kelvins(this T value) => + Temperature.FromKelvins(Convert.ToDouble(value)); - /// - public static Temperature MillidegreesCelsius(this T value) => - Temperature.FromMillidegreesCelsius(Convert.ToDouble(value)); + /// + public static Temperature MillidegreesCelsius(this T value) => + Temperature.FromMillidegreesCelsius(Convert.ToDouble(value)); - /// - public static Temperature SolarTemperatures(this T value) => - Temperature.FromSolarTemperatures(Convert.ToDouble(value)); + /// + public static Temperature SolarTemperatures(this T value) => + Temperature.FromSolarTemperatures(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToThermalConductivityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToThermalConductivityExtensions.g.cs index be0b76365f..acef4d76f8 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToThermalConductivityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToThermalConductivityExtensions.g.cs @@ -28,13 +28,13 @@ namespace UnitsNet.NumberExtensions.NumberToThermalConductivity /// public static class NumberToThermalConductivityExtensions { - /// - public static ThermalConductivity BtusPerHourFootFahrenheit(this T value) => - ThermalConductivity.FromBtusPerHourFootFahrenheit(Convert.ToDouble(value)); + /// + public static ThermalConductivity BtusPerHourFootFahrenheit(this T value) => + ThermalConductivity.FromBtusPerHourFootFahrenheit(Convert.ToDouble(value)); - /// - public static ThermalConductivity WattsPerMeterKelvin(this T value) => - ThermalConductivity.FromWattsPerMeterKelvin(Convert.ToDouble(value)); + /// + public static ThermalConductivity WattsPerMeterKelvin(this T value) => + ThermalConductivity.FromWattsPerMeterKelvin(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToThermalResistanceExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToThermalResistanceExtensions.g.cs index f3400c139d..b25d5153bd 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToThermalResistanceExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToThermalResistanceExtensions.g.cs @@ -28,25 +28,25 @@ namespace UnitsNet.NumberExtensions.NumberToThermalResistance /// public static class NumberToThermalResistanceExtensions { - /// - public static ThermalResistance HourSquareFeetDegreesFahrenheitPerBtu(this T value) => - ThermalResistance.FromHourSquareFeetDegreesFahrenheitPerBtu(Convert.ToDouble(value)); + /// + public static ThermalResistance HourSquareFeetDegreesFahrenheitPerBtu(this T value) => + ThermalResistance.FromHourSquareFeetDegreesFahrenheitPerBtu(Convert.ToDouble(value)); - /// - public static ThermalResistance SquareCentimeterHourDegreesCelsiusPerKilocalorie(this T value) => - ThermalResistance.FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(Convert.ToDouble(value)); + /// + public static ThermalResistance SquareCentimeterHourDegreesCelsiusPerKilocalorie(this T value) => + ThermalResistance.FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(Convert.ToDouble(value)); - /// - public static ThermalResistance SquareCentimeterKelvinsPerWatt(this T value) => - ThermalResistance.FromSquareCentimeterKelvinsPerWatt(Convert.ToDouble(value)); + /// + public static ThermalResistance SquareCentimeterKelvinsPerWatt(this T value) => + ThermalResistance.FromSquareCentimeterKelvinsPerWatt(Convert.ToDouble(value)); - /// - public static ThermalResistance SquareMeterDegreesCelsiusPerWatt(this T value) => - ThermalResistance.FromSquareMeterDegreesCelsiusPerWatt(Convert.ToDouble(value)); + /// + public static ThermalResistance SquareMeterDegreesCelsiusPerWatt(this T value) => + ThermalResistance.FromSquareMeterDegreesCelsiusPerWatt(Convert.ToDouble(value)); - /// - public static ThermalResistance SquareMeterKelvinsPerKilowatt(this T value) => - ThermalResistance.FromSquareMeterKelvinsPerKilowatt(Convert.ToDouble(value)); + /// + public static ThermalResistance SquareMeterKelvinsPerKilowatt(this T value) => + ThermalResistance.FromSquareMeterKelvinsPerKilowatt(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToTorqueExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToTorqueExtensions.g.cs index 70ae1052d2..f04375db8d 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToTorqueExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToTorqueExtensions.g.cs @@ -28,93 +28,93 @@ namespace UnitsNet.NumberExtensions.NumberToTorque /// public static class NumberToTorqueExtensions { - /// - public static Torque KilogramForceCentimeters(this T value) => - Torque.FromKilogramForceCentimeters(Convert.ToDouble(value)); + /// + public static Torque KilogramForceCentimeters(this T value) => + Torque.FromKilogramForceCentimeters(Convert.ToDouble(value)); - /// - public static Torque KilogramForceMeters(this T value) => - Torque.FromKilogramForceMeters(Convert.ToDouble(value)); + /// + public static Torque KilogramForceMeters(this T value) => + Torque.FromKilogramForceMeters(Convert.ToDouble(value)); - /// - public static Torque KilogramForceMillimeters(this T value) => - Torque.FromKilogramForceMillimeters(Convert.ToDouble(value)); + /// + public static Torque KilogramForceMillimeters(this T value) => + Torque.FromKilogramForceMillimeters(Convert.ToDouble(value)); - /// - public static Torque KilonewtonCentimeters(this T value) => - Torque.FromKilonewtonCentimeters(Convert.ToDouble(value)); + /// + public static Torque KilonewtonCentimeters(this T value) => + Torque.FromKilonewtonCentimeters(Convert.ToDouble(value)); - /// - public static Torque KilonewtonMeters(this T value) => - Torque.FromKilonewtonMeters(Convert.ToDouble(value)); + /// + public static Torque KilonewtonMeters(this T value) => + Torque.FromKilonewtonMeters(Convert.ToDouble(value)); - /// - public static Torque KilonewtonMillimeters(this T value) => - Torque.FromKilonewtonMillimeters(Convert.ToDouble(value)); + /// + public static Torque KilonewtonMillimeters(this T value) => + Torque.FromKilonewtonMillimeters(Convert.ToDouble(value)); - /// - public static Torque KilopoundForceFeet(this T value) => - Torque.FromKilopoundForceFeet(Convert.ToDouble(value)); + /// + public static Torque KilopoundForceFeet(this T value) => + Torque.FromKilopoundForceFeet(Convert.ToDouble(value)); - /// - public static Torque KilopoundForceInches(this T value) => - Torque.FromKilopoundForceInches(Convert.ToDouble(value)); + /// + public static Torque KilopoundForceInches(this T value) => + Torque.FromKilopoundForceInches(Convert.ToDouble(value)); - /// - public static Torque MeganewtonCentimeters(this T value) => - Torque.FromMeganewtonCentimeters(Convert.ToDouble(value)); + /// + public static Torque MeganewtonCentimeters(this T value) => + Torque.FromMeganewtonCentimeters(Convert.ToDouble(value)); - /// - public static Torque MeganewtonMeters(this T value) => - Torque.FromMeganewtonMeters(Convert.ToDouble(value)); + /// + public static Torque MeganewtonMeters(this T value) => + Torque.FromMeganewtonMeters(Convert.ToDouble(value)); - /// - public static Torque MeganewtonMillimeters(this T value) => - Torque.FromMeganewtonMillimeters(Convert.ToDouble(value)); + /// + public static Torque MeganewtonMillimeters(this T value) => + Torque.FromMeganewtonMillimeters(Convert.ToDouble(value)); - /// - public static Torque MegapoundForceFeet(this T value) => - Torque.FromMegapoundForceFeet(Convert.ToDouble(value)); + /// + public static Torque MegapoundForceFeet(this T value) => + Torque.FromMegapoundForceFeet(Convert.ToDouble(value)); - /// - public static Torque MegapoundForceInches(this T value) => - Torque.FromMegapoundForceInches(Convert.ToDouble(value)); + /// + public static Torque MegapoundForceInches(this T value) => + Torque.FromMegapoundForceInches(Convert.ToDouble(value)); - /// - public static Torque NewtonCentimeters(this T value) => - Torque.FromNewtonCentimeters(Convert.ToDouble(value)); + /// + public static Torque NewtonCentimeters(this T value) => + Torque.FromNewtonCentimeters(Convert.ToDouble(value)); - /// - public static Torque NewtonMeters(this T value) => - Torque.FromNewtonMeters(Convert.ToDouble(value)); + /// + public static Torque NewtonMeters(this T value) => + Torque.FromNewtonMeters(Convert.ToDouble(value)); - /// - public static Torque NewtonMillimeters(this T value) => - Torque.FromNewtonMillimeters(Convert.ToDouble(value)); + /// + public static Torque NewtonMillimeters(this T value) => + Torque.FromNewtonMillimeters(Convert.ToDouble(value)); - /// - public static Torque PoundalFeet(this T value) => - Torque.FromPoundalFeet(Convert.ToDouble(value)); + /// + public static Torque PoundalFeet(this T value) => + Torque.FromPoundalFeet(Convert.ToDouble(value)); - /// - public static Torque PoundForceFeet(this T value) => - Torque.FromPoundForceFeet(Convert.ToDouble(value)); + /// + public static Torque PoundForceFeet(this T value) => + Torque.FromPoundForceFeet(Convert.ToDouble(value)); - /// - public static Torque PoundForceInches(this T value) => - Torque.FromPoundForceInches(Convert.ToDouble(value)); + /// + public static Torque PoundForceInches(this T value) => + Torque.FromPoundForceInches(Convert.ToDouble(value)); - /// - public static Torque TonneForceCentimeters(this T value) => - Torque.FromTonneForceCentimeters(Convert.ToDouble(value)); + /// + public static Torque TonneForceCentimeters(this T value) => + Torque.FromTonneForceCentimeters(Convert.ToDouble(value)); - /// - public static Torque TonneForceMeters(this T value) => - Torque.FromTonneForceMeters(Convert.ToDouble(value)); + /// + public static Torque TonneForceMeters(this T value) => + Torque.FromTonneForceMeters(Convert.ToDouble(value)); - /// - public static Torque TonneForceMillimeters(this T value) => - Torque.FromTonneForceMillimeters(Convert.ToDouble(value)); + /// + public static Torque TonneForceMillimeters(this T value) => + Torque.FromTonneForceMillimeters(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToTorquePerLengthExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToTorquePerLengthExtensions.g.cs index a6d4151882..d381209adf 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToTorquePerLengthExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToTorquePerLengthExtensions.g.cs @@ -28,89 +28,89 @@ namespace UnitsNet.NumberExtensions.NumberToTorquePerLength /// public static class NumberToTorquePerLengthExtensions { - /// - public static TorquePerLength KilogramForceCentimetersPerMeter(this T value) => - TorquePerLength.FromKilogramForceCentimetersPerMeter(Convert.ToDouble(value)); + /// + public static TorquePerLength KilogramForceCentimetersPerMeter(this T value) => + TorquePerLength.FromKilogramForceCentimetersPerMeter(Convert.ToDouble(value)); - /// - public static TorquePerLength KilogramForceMetersPerMeter(this T value) => - TorquePerLength.FromKilogramForceMetersPerMeter(Convert.ToDouble(value)); + /// + public static TorquePerLength KilogramForceMetersPerMeter(this T value) => + TorquePerLength.FromKilogramForceMetersPerMeter(Convert.ToDouble(value)); - /// - public static TorquePerLength KilogramForceMillimetersPerMeter(this T value) => - TorquePerLength.FromKilogramForceMillimetersPerMeter(Convert.ToDouble(value)); + /// + public static TorquePerLength KilogramForceMillimetersPerMeter(this T value) => + TorquePerLength.FromKilogramForceMillimetersPerMeter(Convert.ToDouble(value)); - /// - public static TorquePerLength KilonewtonCentimetersPerMeter(this T value) => - TorquePerLength.FromKilonewtonCentimetersPerMeter(Convert.ToDouble(value)); + /// + public static TorquePerLength KilonewtonCentimetersPerMeter(this T value) => + TorquePerLength.FromKilonewtonCentimetersPerMeter(Convert.ToDouble(value)); - /// - public static TorquePerLength KilonewtonMetersPerMeter(this T value) => - TorquePerLength.FromKilonewtonMetersPerMeter(Convert.ToDouble(value)); + /// + public static TorquePerLength KilonewtonMetersPerMeter(this T value) => + TorquePerLength.FromKilonewtonMetersPerMeter(Convert.ToDouble(value)); - /// - public static TorquePerLength KilonewtonMillimetersPerMeter(this T value) => - TorquePerLength.FromKilonewtonMillimetersPerMeter(Convert.ToDouble(value)); + /// + public static TorquePerLength KilonewtonMillimetersPerMeter(this T value) => + TorquePerLength.FromKilonewtonMillimetersPerMeter(Convert.ToDouble(value)); - /// - public static TorquePerLength KilopoundForceFeetPerFoot(this T value) => - TorquePerLength.FromKilopoundForceFeetPerFoot(Convert.ToDouble(value)); + /// + public static TorquePerLength KilopoundForceFeetPerFoot(this T value) => + TorquePerLength.FromKilopoundForceFeetPerFoot(Convert.ToDouble(value)); - /// - public static TorquePerLength KilopoundForceInchesPerFoot(this T value) => - TorquePerLength.FromKilopoundForceInchesPerFoot(Convert.ToDouble(value)); + /// + public static TorquePerLength KilopoundForceInchesPerFoot(this T value) => + TorquePerLength.FromKilopoundForceInchesPerFoot(Convert.ToDouble(value)); - /// - public static TorquePerLength MeganewtonCentimetersPerMeter(this T value) => - TorquePerLength.FromMeganewtonCentimetersPerMeter(Convert.ToDouble(value)); + /// + public static TorquePerLength MeganewtonCentimetersPerMeter(this T value) => + TorquePerLength.FromMeganewtonCentimetersPerMeter(Convert.ToDouble(value)); - /// - public static TorquePerLength MeganewtonMetersPerMeter(this T value) => - TorquePerLength.FromMeganewtonMetersPerMeter(Convert.ToDouble(value)); + /// + public static TorquePerLength MeganewtonMetersPerMeter(this T value) => + TorquePerLength.FromMeganewtonMetersPerMeter(Convert.ToDouble(value)); - /// - public static TorquePerLength MeganewtonMillimetersPerMeter(this T value) => - TorquePerLength.FromMeganewtonMillimetersPerMeter(Convert.ToDouble(value)); + /// + public static TorquePerLength MeganewtonMillimetersPerMeter(this T value) => + TorquePerLength.FromMeganewtonMillimetersPerMeter(Convert.ToDouble(value)); - /// - public static TorquePerLength MegapoundForceFeetPerFoot(this T value) => - TorquePerLength.FromMegapoundForceFeetPerFoot(Convert.ToDouble(value)); + /// + public static TorquePerLength MegapoundForceFeetPerFoot(this T value) => + TorquePerLength.FromMegapoundForceFeetPerFoot(Convert.ToDouble(value)); - /// - public static TorquePerLength MegapoundForceInchesPerFoot(this T value) => - TorquePerLength.FromMegapoundForceInchesPerFoot(Convert.ToDouble(value)); + /// + public static TorquePerLength MegapoundForceInchesPerFoot(this T value) => + TorquePerLength.FromMegapoundForceInchesPerFoot(Convert.ToDouble(value)); - /// - public static TorquePerLength NewtonCentimetersPerMeter(this T value) => - TorquePerLength.FromNewtonCentimetersPerMeter(Convert.ToDouble(value)); + /// + public static TorquePerLength NewtonCentimetersPerMeter(this T value) => + TorquePerLength.FromNewtonCentimetersPerMeter(Convert.ToDouble(value)); - /// - public static TorquePerLength NewtonMetersPerMeter(this T value) => - TorquePerLength.FromNewtonMetersPerMeter(Convert.ToDouble(value)); + /// + public static TorquePerLength NewtonMetersPerMeter(this T value) => + TorquePerLength.FromNewtonMetersPerMeter(Convert.ToDouble(value)); - /// - public static TorquePerLength NewtonMillimetersPerMeter(this T value) => - TorquePerLength.FromNewtonMillimetersPerMeter(Convert.ToDouble(value)); + /// + public static TorquePerLength NewtonMillimetersPerMeter(this T value) => + TorquePerLength.FromNewtonMillimetersPerMeter(Convert.ToDouble(value)); - /// - public static TorquePerLength PoundForceFeetPerFoot(this T value) => - TorquePerLength.FromPoundForceFeetPerFoot(Convert.ToDouble(value)); + /// + public static TorquePerLength PoundForceFeetPerFoot(this T value) => + TorquePerLength.FromPoundForceFeetPerFoot(Convert.ToDouble(value)); - /// - public static TorquePerLength PoundForceInchesPerFoot(this T value) => - TorquePerLength.FromPoundForceInchesPerFoot(Convert.ToDouble(value)); + /// + public static TorquePerLength PoundForceInchesPerFoot(this T value) => + TorquePerLength.FromPoundForceInchesPerFoot(Convert.ToDouble(value)); - /// - public static TorquePerLength TonneForceCentimetersPerMeter(this T value) => - TorquePerLength.FromTonneForceCentimetersPerMeter(Convert.ToDouble(value)); + /// + public static TorquePerLength TonneForceCentimetersPerMeter(this T value) => + TorquePerLength.FromTonneForceCentimetersPerMeter(Convert.ToDouble(value)); - /// - public static TorquePerLength TonneForceMetersPerMeter(this T value) => - TorquePerLength.FromTonneForceMetersPerMeter(Convert.ToDouble(value)); + /// + public static TorquePerLength TonneForceMetersPerMeter(this T value) => + TorquePerLength.FromTonneForceMetersPerMeter(Convert.ToDouble(value)); - /// - public static TorquePerLength TonneForceMillimetersPerMeter(this T value) => - TorquePerLength.FromTonneForceMillimetersPerMeter(Convert.ToDouble(value)); + /// + public static TorquePerLength TonneForceMillimetersPerMeter(this T value) => + TorquePerLength.FromTonneForceMillimetersPerMeter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToTurbidityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToTurbidityExtensions.g.cs index 0bd9694799..6f94086a1f 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToTurbidityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToTurbidityExtensions.g.cs @@ -28,9 +28,9 @@ namespace UnitsNet.NumberExtensions.NumberToTurbidity /// public static class NumberToTurbidityExtensions { - /// - public static Turbidity NTU(this T value) => - Turbidity.FromNTU(Convert.ToDouble(value)); + /// + public static Turbidity NTU(this T value) => + Turbidity.FromNTU(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVitaminAExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVitaminAExtensions.g.cs index 8c4683785d..095ebbfe03 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVitaminAExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVitaminAExtensions.g.cs @@ -28,9 +28,9 @@ namespace UnitsNet.NumberExtensions.NumberToVitaminA /// public static class NumberToVitaminAExtensions { - /// - public static VitaminA InternationalUnits(this T value) => - VitaminA.FromInternationalUnits(Convert.ToDouble(value)); + /// + public static VitaminA InternationalUnits(this T value) => + VitaminA.FromInternationalUnits(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeConcentrationExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeConcentrationExtensions.g.cs index 456736fb1e..2355d9a8cd 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeConcentrationExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeConcentrationExtensions.g.cs @@ -28,85 +28,85 @@ namespace UnitsNet.NumberExtensions.NumberToVolumeConcentration /// public static class NumberToVolumeConcentrationExtensions { - /// - public static VolumeConcentration CentilitersPerLiter(this T value) => - VolumeConcentration.FromCentilitersPerLiter(Convert.ToDouble(value)); + /// + public static VolumeConcentration CentilitersPerLiter(this T value) => + VolumeConcentration.FromCentilitersPerLiter(Convert.ToDouble(value)); - /// - public static VolumeConcentration CentilitersPerMililiter(this T value) => - VolumeConcentration.FromCentilitersPerMililiter(Convert.ToDouble(value)); + /// + public static VolumeConcentration CentilitersPerMililiter(this T value) => + VolumeConcentration.FromCentilitersPerMililiter(Convert.ToDouble(value)); - /// - public static VolumeConcentration DecilitersPerLiter(this T value) => - VolumeConcentration.FromDecilitersPerLiter(Convert.ToDouble(value)); + /// + public static VolumeConcentration DecilitersPerLiter(this T value) => + VolumeConcentration.FromDecilitersPerLiter(Convert.ToDouble(value)); - /// - public static VolumeConcentration DecilitersPerMililiter(this T value) => - VolumeConcentration.FromDecilitersPerMililiter(Convert.ToDouble(value)); + /// + public static VolumeConcentration DecilitersPerMililiter(this T value) => + VolumeConcentration.FromDecilitersPerMililiter(Convert.ToDouble(value)); - /// - public static VolumeConcentration DecimalFractions(this T value) => - VolumeConcentration.FromDecimalFractions(Convert.ToDouble(value)); + /// + public static VolumeConcentration DecimalFractions(this T value) => + VolumeConcentration.FromDecimalFractions(Convert.ToDouble(value)); - /// - public static VolumeConcentration LitersPerLiter(this T value) => - VolumeConcentration.FromLitersPerLiter(Convert.ToDouble(value)); + /// + public static VolumeConcentration LitersPerLiter(this T value) => + VolumeConcentration.FromLitersPerLiter(Convert.ToDouble(value)); - /// - public static VolumeConcentration LitersPerMililiter(this T value) => - VolumeConcentration.FromLitersPerMililiter(Convert.ToDouble(value)); + /// + public static VolumeConcentration LitersPerMililiter(this T value) => + VolumeConcentration.FromLitersPerMililiter(Convert.ToDouble(value)); - /// - public static VolumeConcentration MicrolitersPerLiter(this T value) => - VolumeConcentration.FromMicrolitersPerLiter(Convert.ToDouble(value)); + /// + public static VolumeConcentration MicrolitersPerLiter(this T value) => + VolumeConcentration.FromMicrolitersPerLiter(Convert.ToDouble(value)); - /// - public static VolumeConcentration MicrolitersPerMililiter(this T value) => - VolumeConcentration.FromMicrolitersPerMililiter(Convert.ToDouble(value)); + /// + public static VolumeConcentration MicrolitersPerMililiter(this T value) => + VolumeConcentration.FromMicrolitersPerMililiter(Convert.ToDouble(value)); - /// - public static VolumeConcentration MillilitersPerLiter(this T value) => - VolumeConcentration.FromMillilitersPerLiter(Convert.ToDouble(value)); + /// + public static VolumeConcentration MillilitersPerLiter(this T value) => + VolumeConcentration.FromMillilitersPerLiter(Convert.ToDouble(value)); - /// - public static VolumeConcentration MillilitersPerMililiter(this T value) => - VolumeConcentration.FromMillilitersPerMililiter(Convert.ToDouble(value)); + /// + public static VolumeConcentration MillilitersPerMililiter(this T value) => + VolumeConcentration.FromMillilitersPerMililiter(Convert.ToDouble(value)); - /// - public static VolumeConcentration NanolitersPerLiter(this T value) => - VolumeConcentration.FromNanolitersPerLiter(Convert.ToDouble(value)); + /// + public static VolumeConcentration NanolitersPerLiter(this T value) => + VolumeConcentration.FromNanolitersPerLiter(Convert.ToDouble(value)); - /// - public static VolumeConcentration NanolitersPerMililiter(this T value) => - VolumeConcentration.FromNanolitersPerMililiter(Convert.ToDouble(value)); + /// + public static VolumeConcentration NanolitersPerMililiter(this T value) => + VolumeConcentration.FromNanolitersPerMililiter(Convert.ToDouble(value)); - /// - public static VolumeConcentration PartsPerBillion(this T value) => - VolumeConcentration.FromPartsPerBillion(Convert.ToDouble(value)); + /// + public static VolumeConcentration PartsPerBillion(this T value) => + VolumeConcentration.FromPartsPerBillion(Convert.ToDouble(value)); - /// - public static VolumeConcentration PartsPerMillion(this T value) => - VolumeConcentration.FromPartsPerMillion(Convert.ToDouble(value)); + /// + public static VolumeConcentration PartsPerMillion(this T value) => + VolumeConcentration.FromPartsPerMillion(Convert.ToDouble(value)); - /// - public static VolumeConcentration PartsPerThousand(this T value) => - VolumeConcentration.FromPartsPerThousand(Convert.ToDouble(value)); + /// + public static VolumeConcentration PartsPerThousand(this T value) => + VolumeConcentration.FromPartsPerThousand(Convert.ToDouble(value)); - /// - public static VolumeConcentration PartsPerTrillion(this T value) => - VolumeConcentration.FromPartsPerTrillion(Convert.ToDouble(value)); + /// + public static VolumeConcentration PartsPerTrillion(this T value) => + VolumeConcentration.FromPartsPerTrillion(Convert.ToDouble(value)); - /// - public static VolumeConcentration Percent(this T value) => - VolumeConcentration.FromPercent(Convert.ToDouble(value)); + /// + public static VolumeConcentration Percent(this T value) => + VolumeConcentration.FromPercent(Convert.ToDouble(value)); - /// - public static VolumeConcentration PicolitersPerLiter(this T value) => - VolumeConcentration.FromPicolitersPerLiter(Convert.ToDouble(value)); + /// + public static VolumeConcentration PicolitersPerLiter(this T value) => + VolumeConcentration.FromPicolitersPerLiter(Convert.ToDouble(value)); - /// - public static VolumeConcentration PicolitersPerMililiter(this T value) => - VolumeConcentration.FromPicolitersPerMililiter(Convert.ToDouble(value)); + /// + public static VolumeConcentration PicolitersPerMililiter(this T value) => + VolumeConcentration.FromPicolitersPerMililiter(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeExtensions.g.cs index a9c12ad65f..eca99271aa 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeExtensions.g.cs @@ -28,209 +28,209 @@ namespace UnitsNet.NumberExtensions.NumberToVolume /// public static class NumberToVolumeExtensions { - /// - public static Volume AcreFeet(this T value) => - Volume.FromAcreFeet(Convert.ToDouble(value)); + /// + public static Volume AcreFeet(this T value) => + Volume.FromAcreFeet(Convert.ToDouble(value)); - /// - public static Volume AuTablespoons(this T value) => - Volume.FromAuTablespoons(Convert.ToDouble(value)); + /// + public static Volume AuTablespoons(this T value) => + Volume.FromAuTablespoons(Convert.ToDouble(value)); - /// - public static Volume BoardFeet(this T value) => - Volume.FromBoardFeet(Convert.ToDouble(value)); + /// + public static Volume BoardFeet(this T value) => + Volume.FromBoardFeet(Convert.ToDouble(value)); - /// - public static Volume Centiliters(this T value) => - Volume.FromCentiliters(Convert.ToDouble(value)); + /// + public static Volume Centiliters(this T value) => + Volume.FromCentiliters(Convert.ToDouble(value)); - /// - public static Volume CubicCentimeters(this T value) => - Volume.FromCubicCentimeters(Convert.ToDouble(value)); + /// + public static Volume CubicCentimeters(this T value) => + Volume.FromCubicCentimeters(Convert.ToDouble(value)); - /// - public static Volume CubicDecimeters(this T value) => - Volume.FromCubicDecimeters(Convert.ToDouble(value)); + /// + public static Volume CubicDecimeters(this T value) => + Volume.FromCubicDecimeters(Convert.ToDouble(value)); - /// - public static Volume CubicFeet(this T value) => - Volume.FromCubicFeet(Convert.ToDouble(value)); + /// + public static Volume CubicFeet(this T value) => + Volume.FromCubicFeet(Convert.ToDouble(value)); - /// - public static Volume CubicHectometers(this T value) => - Volume.FromCubicHectometers(Convert.ToDouble(value)); + /// + public static Volume CubicHectometers(this T value) => + Volume.FromCubicHectometers(Convert.ToDouble(value)); - /// - public static Volume CubicInches(this T value) => - Volume.FromCubicInches(Convert.ToDouble(value)); + /// + public static Volume CubicInches(this T value) => + Volume.FromCubicInches(Convert.ToDouble(value)); - /// - public static Volume CubicKilometers(this T value) => - Volume.FromCubicKilometers(Convert.ToDouble(value)); + /// + public static Volume CubicKilometers(this T value) => + Volume.FromCubicKilometers(Convert.ToDouble(value)); - /// - public static Volume CubicMeters(this T value) => - Volume.FromCubicMeters(Convert.ToDouble(value)); + /// + public static Volume CubicMeters(this T value) => + Volume.FromCubicMeters(Convert.ToDouble(value)); - /// - public static Volume CubicMicrometers(this T value) => - Volume.FromCubicMicrometers(Convert.ToDouble(value)); + /// + public static Volume CubicMicrometers(this T value) => + Volume.FromCubicMicrometers(Convert.ToDouble(value)); - /// - public static Volume CubicMiles(this T value) => - Volume.FromCubicMiles(Convert.ToDouble(value)); + /// + public static Volume CubicMiles(this T value) => + Volume.FromCubicMiles(Convert.ToDouble(value)); - /// - public static Volume CubicMillimeters(this T value) => - Volume.FromCubicMillimeters(Convert.ToDouble(value)); + /// + public static Volume CubicMillimeters(this T value) => + Volume.FromCubicMillimeters(Convert.ToDouble(value)); - /// - public static Volume CubicYards(this T value) => - Volume.FromCubicYards(Convert.ToDouble(value)); + /// + public static Volume CubicYards(this T value) => + Volume.FromCubicYards(Convert.ToDouble(value)); - /// - public static Volume DecausGallons(this T value) => - Volume.FromDecausGallons(Convert.ToDouble(value)); + /// + public static Volume DecausGallons(this T value) => + Volume.FromDecausGallons(Convert.ToDouble(value)); - /// - public static Volume Deciliters(this T value) => - Volume.FromDeciliters(Convert.ToDouble(value)); + /// + public static Volume Deciliters(this T value) => + Volume.FromDeciliters(Convert.ToDouble(value)); - /// - public static Volume DeciusGallons(this T value) => - Volume.FromDeciusGallons(Convert.ToDouble(value)); + /// + public static Volume DeciusGallons(this T value) => + Volume.FromDeciusGallons(Convert.ToDouble(value)); - /// - public static Volume HectocubicFeet(this T value) => - Volume.FromHectocubicFeet(Convert.ToDouble(value)); + /// + public static Volume HectocubicFeet(this T value) => + Volume.FromHectocubicFeet(Convert.ToDouble(value)); - /// - public static Volume HectocubicMeters(this T value) => - Volume.FromHectocubicMeters(Convert.ToDouble(value)); + /// + public static Volume HectocubicMeters(this T value) => + Volume.FromHectocubicMeters(Convert.ToDouble(value)); - /// - public static Volume Hectoliters(this T value) => - Volume.FromHectoliters(Convert.ToDouble(value)); + /// + public static Volume Hectoliters(this T value) => + Volume.FromHectoliters(Convert.ToDouble(value)); - /// - public static Volume HectousGallons(this T value) => - Volume.FromHectousGallons(Convert.ToDouble(value)); + /// + public static Volume HectousGallons(this T value) => + Volume.FromHectousGallons(Convert.ToDouble(value)); - /// - public static Volume ImperialBeerBarrels(this T value) => - Volume.FromImperialBeerBarrels(Convert.ToDouble(value)); + /// + public static Volume ImperialBeerBarrels(this T value) => + Volume.FromImperialBeerBarrels(Convert.ToDouble(value)); - /// - public static Volume ImperialGallons(this T value) => - Volume.FromImperialGallons(Convert.ToDouble(value)); + /// + public static Volume ImperialGallons(this T value) => + Volume.FromImperialGallons(Convert.ToDouble(value)); - /// - public static Volume ImperialOunces(this T value) => - Volume.FromImperialOunces(Convert.ToDouble(value)); + /// + public static Volume ImperialOunces(this T value) => + Volume.FromImperialOunces(Convert.ToDouble(value)); - /// - public static Volume ImperialPints(this T value) => - Volume.FromImperialPints(Convert.ToDouble(value)); + /// + public static Volume ImperialPints(this T value) => + Volume.FromImperialPints(Convert.ToDouble(value)); - /// - public static Volume KilocubicFeet(this T value) => - Volume.FromKilocubicFeet(Convert.ToDouble(value)); + /// + public static Volume KilocubicFeet(this T value) => + Volume.FromKilocubicFeet(Convert.ToDouble(value)); - /// - public static Volume KilocubicMeters(this T value) => - Volume.FromKilocubicMeters(Convert.ToDouble(value)); + /// + public static Volume KilocubicMeters(this T value) => + Volume.FromKilocubicMeters(Convert.ToDouble(value)); - /// - public static Volume KiloimperialGallons(this T value) => - Volume.FromKiloimperialGallons(Convert.ToDouble(value)); + /// + public static Volume KiloimperialGallons(this T value) => + Volume.FromKiloimperialGallons(Convert.ToDouble(value)); - /// - public static Volume Kiloliters(this T value) => - Volume.FromKiloliters(Convert.ToDouble(value)); + /// + public static Volume Kiloliters(this T value) => + Volume.FromKiloliters(Convert.ToDouble(value)); - /// - public static Volume KilousGallons(this T value) => - Volume.FromKilousGallons(Convert.ToDouble(value)); + /// + public static Volume KilousGallons(this T value) => + Volume.FromKilousGallons(Convert.ToDouble(value)); - /// - public static Volume Liters(this T value) => - Volume.FromLiters(Convert.ToDouble(value)); + /// + public static Volume Liters(this T value) => + Volume.FromLiters(Convert.ToDouble(value)); - /// - public static Volume MegacubicFeet(this T value) => - Volume.FromMegacubicFeet(Convert.ToDouble(value)); + /// + public static Volume MegacubicFeet(this T value) => + Volume.FromMegacubicFeet(Convert.ToDouble(value)); - /// - public static Volume MegaimperialGallons(this T value) => - Volume.FromMegaimperialGallons(Convert.ToDouble(value)); + /// + public static Volume MegaimperialGallons(this T value) => + Volume.FromMegaimperialGallons(Convert.ToDouble(value)); - /// - public static Volume Megaliters(this T value) => - Volume.FromMegaliters(Convert.ToDouble(value)); + /// + public static Volume Megaliters(this T value) => + Volume.FromMegaliters(Convert.ToDouble(value)); - /// - public static Volume MegausGallons(this T value) => - Volume.FromMegausGallons(Convert.ToDouble(value)); + /// + public static Volume MegausGallons(this T value) => + Volume.FromMegausGallons(Convert.ToDouble(value)); - /// - public static Volume MetricCups(this T value) => - Volume.FromMetricCups(Convert.ToDouble(value)); + /// + public static Volume MetricCups(this T value) => + Volume.FromMetricCups(Convert.ToDouble(value)); - /// - public static Volume MetricTeaspoons(this T value) => - Volume.FromMetricTeaspoons(Convert.ToDouble(value)); + /// + public static Volume MetricTeaspoons(this T value) => + Volume.FromMetricTeaspoons(Convert.ToDouble(value)); - /// - public static Volume Microliters(this T value) => - Volume.FromMicroliters(Convert.ToDouble(value)); + /// + public static Volume Microliters(this T value) => + Volume.FromMicroliters(Convert.ToDouble(value)); - /// - public static Volume Milliliters(this T value) => - Volume.FromMilliliters(Convert.ToDouble(value)); + /// + public static Volume Milliliters(this T value) => + Volume.FromMilliliters(Convert.ToDouble(value)); - /// - public static Volume OilBarrels(this T value) => - Volume.FromOilBarrels(Convert.ToDouble(value)); + /// + public static Volume OilBarrels(this T value) => + Volume.FromOilBarrels(Convert.ToDouble(value)); - /// - public static Volume UkTablespoons(this T value) => - Volume.FromUkTablespoons(Convert.ToDouble(value)); + /// + public static Volume UkTablespoons(this T value) => + Volume.FromUkTablespoons(Convert.ToDouble(value)); - /// - public static Volume UsBeerBarrels(this T value) => - Volume.FromUsBeerBarrels(Convert.ToDouble(value)); + /// + public static Volume UsBeerBarrels(this T value) => + Volume.FromUsBeerBarrels(Convert.ToDouble(value)); - /// - public static Volume UsCustomaryCups(this T value) => - Volume.FromUsCustomaryCups(Convert.ToDouble(value)); + /// + public static Volume UsCustomaryCups(this T value) => + Volume.FromUsCustomaryCups(Convert.ToDouble(value)); - /// - public static Volume UsGallons(this T value) => - Volume.FromUsGallons(Convert.ToDouble(value)); + /// + public static Volume UsGallons(this T value) => + Volume.FromUsGallons(Convert.ToDouble(value)); - /// - public static Volume UsLegalCups(this T value) => - Volume.FromUsLegalCups(Convert.ToDouble(value)); + /// + public static Volume UsLegalCups(this T value) => + Volume.FromUsLegalCups(Convert.ToDouble(value)); - /// - public static Volume UsOunces(this T value) => - Volume.FromUsOunces(Convert.ToDouble(value)); + /// + public static Volume UsOunces(this T value) => + Volume.FromUsOunces(Convert.ToDouble(value)); - /// - public static Volume UsPints(this T value) => - Volume.FromUsPints(Convert.ToDouble(value)); + /// + public static Volume UsPints(this T value) => + Volume.FromUsPints(Convert.ToDouble(value)); - /// - public static Volume UsQuarts(this T value) => - Volume.FromUsQuarts(Convert.ToDouble(value)); + /// + public static Volume UsQuarts(this T value) => + Volume.FromUsQuarts(Convert.ToDouble(value)); - /// - public static Volume UsTablespoons(this T value) => - Volume.FromUsTablespoons(Convert.ToDouble(value)); + /// + public static Volume UsTablespoons(this T value) => + Volume.FromUsTablespoons(Convert.ToDouble(value)); - /// - public static Volume UsTeaspoons(this T value) => - Volume.FromUsTeaspoons(Convert.ToDouble(value)); + /// + public static Volume UsTeaspoons(this T value) => + Volume.FromUsTeaspoons(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeFlowExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeFlowExtensions.g.cs index a0eb2e39f7..3500c082e8 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeFlowExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeFlowExtensions.g.cs @@ -28,229 +28,229 @@ namespace UnitsNet.NumberExtensions.NumberToVolumeFlow /// public static class NumberToVolumeFlowExtensions { - /// - public static VolumeFlow AcreFeetPerDay(this T value) => - VolumeFlow.FromAcreFeetPerDay(Convert.ToDouble(value)); + /// + public static VolumeFlow AcreFeetPerDay(this T value) => + VolumeFlow.FromAcreFeetPerDay(Convert.ToDouble(value)); - /// - public static VolumeFlow AcreFeetPerHour(this T value) => - VolumeFlow.FromAcreFeetPerHour(Convert.ToDouble(value)); + /// + public static VolumeFlow AcreFeetPerHour(this T value) => + VolumeFlow.FromAcreFeetPerHour(Convert.ToDouble(value)); - /// - public static VolumeFlow AcreFeetPerMinute(this T value) => - VolumeFlow.FromAcreFeetPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow AcreFeetPerMinute(this T value) => + VolumeFlow.FromAcreFeetPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow AcreFeetPerSecond(this T value) => - VolumeFlow.FromAcreFeetPerSecond(Convert.ToDouble(value)); + /// + public static VolumeFlow AcreFeetPerSecond(this T value) => + VolumeFlow.FromAcreFeetPerSecond(Convert.ToDouble(value)); - /// - public static VolumeFlow CentilitersPerDay(this T value) => - VolumeFlow.FromCentilitersPerDay(Convert.ToDouble(value)); + /// + public static VolumeFlow CentilitersPerDay(this T value) => + VolumeFlow.FromCentilitersPerDay(Convert.ToDouble(value)); - /// - public static VolumeFlow CentilitersPerMinute(this T value) => - VolumeFlow.FromCentilitersPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow CentilitersPerMinute(this T value) => + VolumeFlow.FromCentilitersPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow CentilitersPerSecond(this T value) => - VolumeFlow.FromCentilitersPerSecond(Convert.ToDouble(value)); + /// + public static VolumeFlow CentilitersPerSecond(this T value) => + VolumeFlow.FromCentilitersPerSecond(Convert.ToDouble(value)); - /// - public static VolumeFlow CubicCentimetersPerMinute(this T value) => - VolumeFlow.FromCubicCentimetersPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow CubicCentimetersPerMinute(this T value) => + VolumeFlow.FromCubicCentimetersPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow CubicDecimetersPerMinute(this T value) => - VolumeFlow.FromCubicDecimetersPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow CubicDecimetersPerMinute(this T value) => + VolumeFlow.FromCubicDecimetersPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow CubicFeetPerHour(this T value) => - VolumeFlow.FromCubicFeetPerHour(Convert.ToDouble(value)); + /// + public static VolumeFlow CubicFeetPerHour(this T value) => + VolumeFlow.FromCubicFeetPerHour(Convert.ToDouble(value)); - /// - public static VolumeFlow CubicFeetPerMinute(this T value) => - VolumeFlow.FromCubicFeetPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow CubicFeetPerMinute(this T value) => + VolumeFlow.FromCubicFeetPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow CubicFeetPerSecond(this T value) => - VolumeFlow.FromCubicFeetPerSecond(Convert.ToDouble(value)); + /// + public static VolumeFlow CubicFeetPerSecond(this T value) => + VolumeFlow.FromCubicFeetPerSecond(Convert.ToDouble(value)); - /// - public static VolumeFlow CubicMetersPerDay(this T value) => - VolumeFlow.FromCubicMetersPerDay(Convert.ToDouble(value)); + /// + public static VolumeFlow CubicMetersPerDay(this T value) => + VolumeFlow.FromCubicMetersPerDay(Convert.ToDouble(value)); - /// - public static VolumeFlow CubicMetersPerHour(this T value) => - VolumeFlow.FromCubicMetersPerHour(Convert.ToDouble(value)); + /// + public static VolumeFlow CubicMetersPerHour(this T value) => + VolumeFlow.FromCubicMetersPerHour(Convert.ToDouble(value)); - /// - public static VolumeFlow CubicMetersPerMinute(this T value) => - VolumeFlow.FromCubicMetersPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow CubicMetersPerMinute(this T value) => + VolumeFlow.FromCubicMetersPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow CubicMetersPerSecond(this T value) => - VolumeFlow.FromCubicMetersPerSecond(Convert.ToDouble(value)); + /// + public static VolumeFlow CubicMetersPerSecond(this T value) => + VolumeFlow.FromCubicMetersPerSecond(Convert.ToDouble(value)); - /// - public static VolumeFlow CubicMillimetersPerSecond(this T value) => - VolumeFlow.FromCubicMillimetersPerSecond(Convert.ToDouble(value)); + /// + public static VolumeFlow CubicMillimetersPerSecond(this T value) => + VolumeFlow.FromCubicMillimetersPerSecond(Convert.ToDouble(value)); - /// - public static VolumeFlow CubicYardsPerDay(this T value) => - VolumeFlow.FromCubicYardsPerDay(Convert.ToDouble(value)); + /// + public static VolumeFlow CubicYardsPerDay(this T value) => + VolumeFlow.FromCubicYardsPerDay(Convert.ToDouble(value)); - /// - public static VolumeFlow CubicYardsPerHour(this T value) => - VolumeFlow.FromCubicYardsPerHour(Convert.ToDouble(value)); + /// + public static VolumeFlow CubicYardsPerHour(this T value) => + VolumeFlow.FromCubicYardsPerHour(Convert.ToDouble(value)); - /// - public static VolumeFlow CubicYardsPerMinute(this T value) => - VolumeFlow.FromCubicYardsPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow CubicYardsPerMinute(this T value) => + VolumeFlow.FromCubicYardsPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow CubicYardsPerSecond(this T value) => - VolumeFlow.FromCubicYardsPerSecond(Convert.ToDouble(value)); + /// + public static VolumeFlow CubicYardsPerSecond(this T value) => + VolumeFlow.FromCubicYardsPerSecond(Convert.ToDouble(value)); - /// - public static VolumeFlow DecilitersPerDay(this T value) => - VolumeFlow.FromDecilitersPerDay(Convert.ToDouble(value)); + /// + public static VolumeFlow DecilitersPerDay(this T value) => + VolumeFlow.FromDecilitersPerDay(Convert.ToDouble(value)); - /// - public static VolumeFlow DecilitersPerMinute(this T value) => - VolumeFlow.FromDecilitersPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow DecilitersPerMinute(this T value) => + VolumeFlow.FromDecilitersPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow DecilitersPerSecond(this T value) => - VolumeFlow.FromDecilitersPerSecond(Convert.ToDouble(value)); + /// + public static VolumeFlow DecilitersPerSecond(this T value) => + VolumeFlow.FromDecilitersPerSecond(Convert.ToDouble(value)); - /// - public static VolumeFlow KilolitersPerDay(this T value) => - VolumeFlow.FromKilolitersPerDay(Convert.ToDouble(value)); + /// + public static VolumeFlow KilolitersPerDay(this T value) => + VolumeFlow.FromKilolitersPerDay(Convert.ToDouble(value)); - /// - public static VolumeFlow KilolitersPerMinute(this T value) => - VolumeFlow.FromKilolitersPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow KilolitersPerMinute(this T value) => + VolumeFlow.FromKilolitersPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow KilolitersPerSecond(this T value) => - VolumeFlow.FromKilolitersPerSecond(Convert.ToDouble(value)); + /// + public static VolumeFlow KilolitersPerSecond(this T value) => + VolumeFlow.FromKilolitersPerSecond(Convert.ToDouble(value)); - /// - public static VolumeFlow KilousGallonsPerMinute(this T value) => - VolumeFlow.FromKilousGallonsPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow KilousGallonsPerMinute(this T value) => + VolumeFlow.FromKilousGallonsPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow LitersPerDay(this T value) => - VolumeFlow.FromLitersPerDay(Convert.ToDouble(value)); + /// + public static VolumeFlow LitersPerDay(this T value) => + VolumeFlow.FromLitersPerDay(Convert.ToDouble(value)); - /// - public static VolumeFlow LitersPerHour(this T value) => - VolumeFlow.FromLitersPerHour(Convert.ToDouble(value)); + /// + public static VolumeFlow LitersPerHour(this T value) => + VolumeFlow.FromLitersPerHour(Convert.ToDouble(value)); - /// - public static VolumeFlow LitersPerMinute(this T value) => - VolumeFlow.FromLitersPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow LitersPerMinute(this T value) => + VolumeFlow.FromLitersPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow LitersPerSecond(this T value) => - VolumeFlow.FromLitersPerSecond(Convert.ToDouble(value)); + /// + public static VolumeFlow LitersPerSecond(this T value) => + VolumeFlow.FromLitersPerSecond(Convert.ToDouble(value)); - /// - public static VolumeFlow MegalitersPerDay(this T value) => - VolumeFlow.FromMegalitersPerDay(Convert.ToDouble(value)); + /// + public static VolumeFlow MegalitersPerDay(this T value) => + VolumeFlow.FromMegalitersPerDay(Convert.ToDouble(value)); - /// - public static VolumeFlow MegaukGallonsPerSecond(this T value) => - VolumeFlow.FromMegaukGallonsPerSecond(Convert.ToDouble(value)); + /// + public static VolumeFlow MegaukGallonsPerSecond(this T value) => + VolumeFlow.FromMegaukGallonsPerSecond(Convert.ToDouble(value)); - /// - public static VolumeFlow MicrolitersPerDay(this T value) => - VolumeFlow.FromMicrolitersPerDay(Convert.ToDouble(value)); + /// + public static VolumeFlow MicrolitersPerDay(this T value) => + VolumeFlow.FromMicrolitersPerDay(Convert.ToDouble(value)); - /// - public static VolumeFlow MicrolitersPerMinute(this T value) => - VolumeFlow.FromMicrolitersPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow MicrolitersPerMinute(this T value) => + VolumeFlow.FromMicrolitersPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow MicrolitersPerSecond(this T value) => - VolumeFlow.FromMicrolitersPerSecond(Convert.ToDouble(value)); + /// + public static VolumeFlow MicrolitersPerSecond(this T value) => + VolumeFlow.FromMicrolitersPerSecond(Convert.ToDouble(value)); - /// - public static VolumeFlow MillilitersPerDay(this T value) => - VolumeFlow.FromMillilitersPerDay(Convert.ToDouble(value)); + /// + public static VolumeFlow MillilitersPerDay(this T value) => + VolumeFlow.FromMillilitersPerDay(Convert.ToDouble(value)); - /// - public static VolumeFlow MillilitersPerMinute(this T value) => - VolumeFlow.FromMillilitersPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow MillilitersPerMinute(this T value) => + VolumeFlow.FromMillilitersPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow MillilitersPerSecond(this T value) => - VolumeFlow.FromMillilitersPerSecond(Convert.ToDouble(value)); + /// + public static VolumeFlow MillilitersPerSecond(this T value) => + VolumeFlow.FromMillilitersPerSecond(Convert.ToDouble(value)); - /// - public static VolumeFlow MillionUsGallonsPerDay(this T value) => - VolumeFlow.FromMillionUsGallonsPerDay(Convert.ToDouble(value)); + /// + public static VolumeFlow MillionUsGallonsPerDay(this T value) => + VolumeFlow.FromMillionUsGallonsPerDay(Convert.ToDouble(value)); - /// - public static VolumeFlow NanolitersPerDay(this T value) => - VolumeFlow.FromNanolitersPerDay(Convert.ToDouble(value)); + /// + public static VolumeFlow NanolitersPerDay(this T value) => + VolumeFlow.FromNanolitersPerDay(Convert.ToDouble(value)); - /// - public static VolumeFlow NanolitersPerMinute(this T value) => - VolumeFlow.FromNanolitersPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow NanolitersPerMinute(this T value) => + VolumeFlow.FromNanolitersPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow NanolitersPerSecond(this T value) => - VolumeFlow.FromNanolitersPerSecond(Convert.ToDouble(value)); + /// + public static VolumeFlow NanolitersPerSecond(this T value) => + VolumeFlow.FromNanolitersPerSecond(Convert.ToDouble(value)); - /// - public static VolumeFlow OilBarrelsPerDay(this T value) => - VolumeFlow.FromOilBarrelsPerDay(Convert.ToDouble(value)); + /// + public static VolumeFlow OilBarrelsPerDay(this T value) => + VolumeFlow.FromOilBarrelsPerDay(Convert.ToDouble(value)); - /// - public static VolumeFlow OilBarrelsPerHour(this T value) => - VolumeFlow.FromOilBarrelsPerHour(Convert.ToDouble(value)); + /// + public static VolumeFlow OilBarrelsPerHour(this T value) => + VolumeFlow.FromOilBarrelsPerHour(Convert.ToDouble(value)); - /// - public static VolumeFlow OilBarrelsPerMinute(this T value) => - VolumeFlow.FromOilBarrelsPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow OilBarrelsPerMinute(this T value) => + VolumeFlow.FromOilBarrelsPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow OilBarrelsPerSecond(this T value) => - VolumeFlow.FromOilBarrelsPerSecond(Convert.ToDouble(value)); + /// + public static VolumeFlow OilBarrelsPerSecond(this T value) => + VolumeFlow.FromOilBarrelsPerSecond(Convert.ToDouble(value)); - /// - public static VolumeFlow UkGallonsPerDay(this T value) => - VolumeFlow.FromUkGallonsPerDay(Convert.ToDouble(value)); + /// + public static VolumeFlow UkGallonsPerDay(this T value) => + VolumeFlow.FromUkGallonsPerDay(Convert.ToDouble(value)); - /// - public static VolumeFlow UkGallonsPerHour(this T value) => - VolumeFlow.FromUkGallonsPerHour(Convert.ToDouble(value)); + /// + public static VolumeFlow UkGallonsPerHour(this T value) => + VolumeFlow.FromUkGallonsPerHour(Convert.ToDouble(value)); - /// - public static VolumeFlow UkGallonsPerMinute(this T value) => - VolumeFlow.FromUkGallonsPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow UkGallonsPerMinute(this T value) => + VolumeFlow.FromUkGallonsPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow UkGallonsPerSecond(this T value) => - VolumeFlow.FromUkGallonsPerSecond(Convert.ToDouble(value)); + /// + public static VolumeFlow UkGallonsPerSecond(this T value) => + VolumeFlow.FromUkGallonsPerSecond(Convert.ToDouble(value)); - /// - public static VolumeFlow UsGallonsPerDay(this T value) => - VolumeFlow.FromUsGallonsPerDay(Convert.ToDouble(value)); + /// + public static VolumeFlow UsGallonsPerDay(this T value) => + VolumeFlow.FromUsGallonsPerDay(Convert.ToDouble(value)); - /// - public static VolumeFlow UsGallonsPerHour(this T value) => - VolumeFlow.FromUsGallonsPerHour(Convert.ToDouble(value)); + /// + public static VolumeFlow UsGallonsPerHour(this T value) => + VolumeFlow.FromUsGallonsPerHour(Convert.ToDouble(value)); - /// - public static VolumeFlow UsGallonsPerMinute(this T value) => - VolumeFlow.FromUsGallonsPerMinute(Convert.ToDouble(value)); + /// + public static VolumeFlow UsGallonsPerMinute(this T value) => + VolumeFlow.FromUsGallonsPerMinute(Convert.ToDouble(value)); - /// - public static VolumeFlow UsGallonsPerSecond(this T value) => - VolumeFlow.FromUsGallonsPerSecond(Convert.ToDouble(value)); + /// + public static VolumeFlow UsGallonsPerSecond(this T value) => + VolumeFlow.FromUsGallonsPerSecond(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumePerLengthExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumePerLengthExtensions.g.cs index c9eef0a0d3..b467d4b1a4 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumePerLengthExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumePerLengthExtensions.g.cs @@ -28,33 +28,33 @@ namespace UnitsNet.NumberExtensions.NumberToVolumePerLength /// public static class NumberToVolumePerLengthExtensions { - /// - public static VolumePerLength CubicMetersPerMeter(this T value) => - VolumePerLength.FromCubicMetersPerMeter(Convert.ToDouble(value)); + /// + public static VolumePerLength CubicMetersPerMeter(this T value) => + VolumePerLength.FromCubicMetersPerMeter(Convert.ToDouble(value)); - /// - public static VolumePerLength CubicYardsPerFoot(this T value) => - VolumePerLength.FromCubicYardsPerFoot(Convert.ToDouble(value)); + /// + public static VolumePerLength CubicYardsPerFoot(this T value) => + VolumePerLength.FromCubicYardsPerFoot(Convert.ToDouble(value)); - /// - public static VolumePerLength CubicYardsPerUsSurveyFoot(this T value) => - VolumePerLength.FromCubicYardsPerUsSurveyFoot(Convert.ToDouble(value)); + /// + public static VolumePerLength CubicYardsPerUsSurveyFoot(this T value) => + VolumePerLength.FromCubicYardsPerUsSurveyFoot(Convert.ToDouble(value)); - /// - public static VolumePerLength LitersPerKilometer(this T value) => - VolumePerLength.FromLitersPerKilometer(Convert.ToDouble(value)); + /// + public static VolumePerLength LitersPerKilometer(this T value) => + VolumePerLength.FromLitersPerKilometer(Convert.ToDouble(value)); - /// - public static VolumePerLength LitersPerMeter(this T value) => - VolumePerLength.FromLitersPerMeter(Convert.ToDouble(value)); + /// + public static VolumePerLength LitersPerMeter(this T value) => + VolumePerLength.FromLitersPerMeter(Convert.ToDouble(value)); - /// - public static VolumePerLength LitersPerMillimeter(this T value) => - VolumePerLength.FromLitersPerMillimeter(Convert.ToDouble(value)); + /// + public static VolumePerLength LitersPerMillimeter(this T value) => + VolumePerLength.FromLitersPerMillimeter(Convert.ToDouble(value)); - /// - public static VolumePerLength OilBarrelsPerFoot(this T value) => - VolumePerLength.FromOilBarrelsPerFoot(Convert.ToDouble(value)); + /// + public static VolumePerLength OilBarrelsPerFoot(this T value) => + VolumePerLength.FromOilBarrelsPerFoot(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToWarpingMomentOfInertiaExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToWarpingMomentOfInertiaExtensions.g.cs index 9619780002..7f9109039f 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToWarpingMomentOfInertiaExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToWarpingMomentOfInertiaExtensions.g.cs @@ -28,29 +28,29 @@ namespace UnitsNet.NumberExtensions.NumberToWarpingMomentOfInertia /// public static class NumberToWarpingMomentOfInertiaExtensions { - /// - public static WarpingMomentOfInertia CentimetersToTheSixth(this T value) => - WarpingMomentOfInertia.FromCentimetersToTheSixth(Convert.ToDouble(value)); + /// + public static WarpingMomentOfInertia CentimetersToTheSixth(this T value) => + WarpingMomentOfInertia.FromCentimetersToTheSixth(Convert.ToDouble(value)); - /// - public static WarpingMomentOfInertia DecimetersToTheSixth(this T value) => - WarpingMomentOfInertia.FromDecimetersToTheSixth(Convert.ToDouble(value)); + /// + public static WarpingMomentOfInertia DecimetersToTheSixth(this T value) => + WarpingMomentOfInertia.FromDecimetersToTheSixth(Convert.ToDouble(value)); - /// - public static WarpingMomentOfInertia FeetToTheSixth(this T value) => - WarpingMomentOfInertia.FromFeetToTheSixth(Convert.ToDouble(value)); + /// + public static WarpingMomentOfInertia FeetToTheSixth(this T value) => + WarpingMomentOfInertia.FromFeetToTheSixth(Convert.ToDouble(value)); - /// - public static WarpingMomentOfInertia InchesToTheSixth(this T value) => - WarpingMomentOfInertia.FromInchesToTheSixth(Convert.ToDouble(value)); + /// + public static WarpingMomentOfInertia InchesToTheSixth(this T value) => + WarpingMomentOfInertia.FromInchesToTheSixth(Convert.ToDouble(value)); - /// - public static WarpingMomentOfInertia MetersToTheSixth(this T value) => - WarpingMomentOfInertia.FromMetersToTheSixth(Convert.ToDouble(value)); + /// + public static WarpingMomentOfInertia MetersToTheSixth(this T value) => + WarpingMomentOfInertia.FromMetersToTheSixth(Convert.ToDouble(value)); - /// - public static WarpingMomentOfInertia MillimetersToTheSixth(this T value) => - WarpingMomentOfInertia.FromMillimetersToTheSixth(Convert.ToDouble(value)); + /// + public static WarpingMomentOfInertia MillimetersToTheSixth(this T value) => + WarpingMomentOfInertia.FromMillimetersToTheSixth(Convert.ToDouble(value)); } } From c1677132e59e701caf4ecd99dc4ea55f9df148d2 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Wed, 30 Dec 2020 01:35:13 +0100 Subject: [PATCH 12/13] Progress on fixing compile errors for Min/MaxValue, Parse, Equals - Add `struct` generic constraint to T - Add GenericNumberHelper for MinValue, MaxValue - Add T to Parse - Add T to Equals The biggest blocker is the conversion functions, how to take dynamic code from JSON and make it work with generics. UnitsNet.Angle.GetValueAs UnitsNet.Angle.GetValueInBaseUnit --- .../UnitsNetGen/QuantityGenerator.cs | 42 ++++++++---------- UnitsNet/Comparison.cs | 29 +++++++------ UnitsNet/CompiledLambdas.cs | 30 +++++++++++++ UnitsNet/CustomCode/QuantityParser.cs | 19 +++++--- .../Quantities/Acceleration.g.cs | 40 +++++++++++++---- .../Quantities/AmountOfSubstance.g.cs | 40 +++++++++++++---- .../Quantities/AmplitudeRatio.g.cs | 40 +++++++++++++---- UnitsNet/GeneratedCode/Quantities/Angle.g.cs | 40 +++++++++++++---- .../Quantities/ApparentEnergy.g.cs | 40 +++++++++++++---- .../Quantities/ApparentPower.g.cs | 40 +++++++++++++---- UnitsNet/GeneratedCode/Quantities/Area.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/AreaDensity.g.cs | 40 +++++++++++++---- .../Quantities/AreaMomentOfInertia.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/BitRate.g.cs | 25 +++++------ .../BrakeSpecificFuelConsumption.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/Capacitance.g.cs | 40 +++++++++++++---- .../CoefficientOfThermalExpansion.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/Density.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/Duration.g.cs | 40 +++++++++++++---- .../Quantities/DynamicViscosity.g.cs | 40 +++++++++++++---- .../Quantities/ElectricAdmittance.g.cs | 40 +++++++++++++---- .../Quantities/ElectricCharge.g.cs | 40 +++++++++++++---- .../Quantities/ElectricChargeDensity.g.cs | 40 +++++++++++++---- .../Quantities/ElectricConductance.g.cs | 40 +++++++++++++---- .../Quantities/ElectricConductivity.g.cs | 40 +++++++++++++---- .../Quantities/ElectricCurrent.g.cs | 40 +++++++++++++---- .../Quantities/ElectricCurrentDensity.g.cs | 40 +++++++++++++---- .../Quantities/ElectricCurrentGradient.g.cs | 40 +++++++++++++---- .../Quantities/ElectricField.g.cs | 40 +++++++++++++---- .../Quantities/ElectricInductance.g.cs | 40 +++++++++++++---- .../Quantities/ElectricPotential.g.cs | 40 +++++++++++++---- .../Quantities/ElectricPotentialAc.g.cs | 40 +++++++++++++---- .../ElectricPotentialChangeRate.g.cs | 40 +++++++++++++---- .../Quantities/ElectricPotentialDc.g.cs | 40 +++++++++++++---- .../Quantities/ElectricResistance.g.cs | 40 +++++++++++++---- .../Quantities/ElectricResistivity.g.cs | 40 +++++++++++++---- .../ElectricSurfaceChargeDensity.g.cs | 40 +++++++++++++---- UnitsNet/GeneratedCode/Quantities/Energy.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/Entropy.g.cs | 40 +++++++++++++---- UnitsNet/GeneratedCode/Quantities/Force.g.cs | 40 +++++++++++++---- .../Quantities/ForceChangeRate.g.cs | 40 +++++++++++++---- .../Quantities/ForcePerLength.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/Frequency.g.cs | 40 +++++++++++++---- .../Quantities/FuelEfficiency.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/HeatFlux.g.cs | 40 +++++++++++++---- .../Quantities/HeatTransferCoefficient.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/Illuminance.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/Information.g.cs | 25 +++++------ .../GeneratedCode/Quantities/Irradiance.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/Irradiation.g.cs | 40 +++++++++++++---- .../Quantities/KinematicViscosity.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/LapseRate.g.cs | 40 +++++++++++++---- UnitsNet/GeneratedCode/Quantities/Length.g.cs | 40 +++++++++++++---- UnitsNet/GeneratedCode/Quantities/Level.g.cs | 40 +++++++++++++---- .../Quantities/LinearDensity.g.cs | 40 +++++++++++++---- .../Quantities/LinearPowerDensity.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/Luminosity.g.cs | 40 +++++++++++++---- .../Quantities/LuminousFlux.g.cs | 40 +++++++++++++---- .../Quantities/LuminousIntensity.g.cs | 40 +++++++++++++---- .../Quantities/MagneticField.g.cs | 40 +++++++++++++---- .../Quantities/MagneticFlux.g.cs | 40 +++++++++++++---- .../Quantities/Magnetization.g.cs | 40 +++++++++++++---- UnitsNet/GeneratedCode/Quantities/Mass.g.cs | 40 +++++++++++++---- .../Quantities/MassConcentration.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/MassFlow.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/MassFlux.g.cs | 40 +++++++++++++---- .../Quantities/MassFraction.g.cs | 40 +++++++++++++---- .../Quantities/MassMomentOfInertia.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/MolarEnergy.g.cs | 40 +++++++++++++---- .../Quantities/MolarEntropy.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/MolarMass.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/Molarity.g.cs | 40 +++++++++++++---- .../Quantities/Permeability.g.cs | 40 +++++++++++++---- .../Quantities/Permittivity.g.cs | 40 +++++++++++++---- UnitsNet/GeneratedCode/Quantities/Power.g.cs | 25 +++++------ .../Quantities/PowerDensity.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/PowerRatio.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/Pressure.g.cs | 40 +++++++++++++---- .../Quantities/PressureChangeRate.g.cs | 40 +++++++++++++---- UnitsNet/GeneratedCode/Quantities/Ratio.g.cs | 40 +++++++++++++---- .../Quantities/RatioChangeRate.g.cs | 40 +++++++++++++---- .../Quantities/ReactiveEnergy.g.cs | 40 +++++++++++++---- .../Quantities/ReactivePower.g.cs | 40 +++++++++++++---- .../Quantities/RelativeHumidity.g.cs | 40 +++++++++++++---- .../Quantities/RotationalAcceleration.g.cs | 40 +++++++++++++---- .../Quantities/RotationalSpeed.g.cs | 40 +++++++++++++---- .../Quantities/RotationalStiffness.g.cs | 40 +++++++++++++---- .../RotationalStiffnessPerLength.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/SolidAngle.g.cs | 40 +++++++++++++---- .../Quantities/SpecificEnergy.g.cs | 40 +++++++++++++---- .../Quantities/SpecificEntropy.g.cs | 40 +++++++++++++---- .../Quantities/SpecificVolume.g.cs | 40 +++++++++++++---- .../Quantities/SpecificWeight.g.cs | 40 +++++++++++++---- UnitsNet/GeneratedCode/Quantities/Speed.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/Temperature.g.cs | 40 +++++++++++++---- .../Quantities/TemperatureChangeRate.g.cs | 40 +++++++++++++---- .../Quantities/TemperatureDelta.g.cs | 40 +++++++++++++---- .../Quantities/ThermalConductivity.g.cs | 40 +++++++++++++---- .../Quantities/ThermalResistance.g.cs | 40 +++++++++++++---- UnitsNet/GeneratedCode/Quantities/Torque.g.cs | 40 +++++++++++++---- .../Quantities/TorquePerLength.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/Turbidity.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/VitaminA.g.cs | 40 +++++++++++++---- UnitsNet/GeneratedCode/Quantities/Volume.g.cs | 40 +++++++++++++---- .../Quantities/VolumeConcentration.g.cs | 40 +++++++++++++---- .../GeneratedCode/Quantities/VolumeFlow.g.cs | 40 +++++++++++++---- .../Quantities/VolumePerLength.g.cs | 40 +++++++++++++---- .../Quantities/WarpingMomentOfInertia.g.cs | 40 +++++++++++++---- .../InternalHelpers/GenericNumberHelper.cs | 43 +++++++++++++++++++ 109 files changed, 3393 insertions(+), 885 deletions(-) create mode 100644 UnitsNet/InternalHelpers/GenericNumberHelper.cs diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs index ced2edb863..2610643f2e 100644 --- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs @@ -42,6 +42,7 @@ public QuantityGenerator(Quantity quantity) public override string Generate() { + var decimalQuantityDeclaration = _quantity.BaseType == "decimal" ? "IDecimalQuantity, " : ""; Writer.WL(GeneratedFileHeader); Writer.WL(@" using System; @@ -69,15 +70,9 @@ namespace UnitsNet /// {_quantity.XmlDocRemarks} /// "); - Writer.W(@$" - public partial struct {_quantity.Name} : IQuantityT<{_unitEnumName}, T>, "); - if (_quantity.BaseType == "decimal") - { - Writer.W("IDecimalQuantity, "); - } - - Writer.WL($"IEquatable<{_quantity.Name}>, IComparable, IComparable<{_quantity.Name}>, IConvertible, IFormattable"); - Writer.WL($@" + Writer.WL(@$" + public partial struct {_quantity.Name} : IQuantityT<{_unitEnumName}, T>, {decimalQuantityDeclaration}IEquatable<{_quantity.Name}>, IComparable, IComparable<{_quantity.Name}>, IConvertible, IFormattable + where T : struct {{ /// /// The unit this quantity was constructed with. @@ -216,12 +211,12 @@ private void GenerateStaticProperties() /// /// Represents the largest possible value of /// - public static {_quantity.Name} MaxValue {{ get; }} = new {_quantity.Name}({_valueType}.MaxValue, BaseUnit); + public static {_quantity.Name} MaxValue {{ get; }} = new {_quantity.Name}(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static {_quantity.Name} MinValue {{ get; }} = new {_quantity.Name}({_valueType}.MinValue, BaseUnit); + public static {_quantity.Name} MinValue {{ get; }} = new {_quantity.Name}(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -237,7 +232,7 @@ private void GenerateStaticProperties() /// /// Gets an instance of this quantity with a value of 0 in the base unit {_quantity.BaseUnit}. /// - public static {_quantity.Name} Zero {{ get; }} = new {_quantity.Name}((T)0, BaseUnit); + public static {_quantity.Name} Zero {{ get; }} = new {_quantity.Name}(default(T), BaseUnit); #endregion "); @@ -259,7 +254,8 @@ private void GenerateProperties() Writer.WL(@" /// decimal IDecimalQuantity.Value => _value; - +"); + Writer.WL($@" Enum IQuantity.Unit => Unit; /// @@ -282,7 +278,7 @@ private void GenerateProperties() public BaseDimensions Dimensions => {_quantity.Name}.BaseDimensions; #endregion -" ); +"); } private void GenerateConversionProperties() @@ -374,7 +370,7 @@ private void GenerateStaticFactoryMethods() }} #endregion -" ); +"); } private void GenerateStaticParseMethods() @@ -434,7 +430,7 @@ private void GenerateStaticParseMethods() /// Format to use when parsing number and unit. Defaults to if null. public static {_quantity.Name} Parse(string str, IFormatProvider? provider) {{ - return QuantityParser.Default.Parse<{_quantity.Name}, {_unitEnumName}>( + return QuantityParser.Default.Parse, {_unitEnumName}>( str, provider, From); @@ -465,7 +461,7 @@ public static bool TryParse(string? str, out {_quantity.Name} result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out {_quantity.Name} result) {{ - return QuantityParser.Default.TryParse<{_quantity.Name}, {_unitEnumName}>( + return QuantityParser.Default.TryParse, {_unitEnumName}>( str, provider, From, @@ -769,10 +765,10 @@ public bool Equals({_quantity.Name} other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals({_quantity.Name} other, double tolerance, ComparisonType comparisonType) + public bool Equals({_quantity.Name} other, T tolerance, ComparisonType comparisonType) {{ - if(tolerance < 0) - throw new ArgumentOutOfRangeException(""tolerance"", ""Tolerance must be greater than or equal to 0.""); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), ""Tolerance must be greater than or equal to 0""); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); @@ -895,7 +891,7 @@ IQuantity IQuantity.ToUnit(Enum unit) private T GetValueInBaseUnit() {{ switch(Unit) - {{" ); + {{"); foreach (var unit in _quantity.Units) { var func = unit.FromUnitToBaseFunc.Replace("x", "Value"); @@ -1028,7 +1024,7 @@ public string ToString(string format, IFormatProvider? provider) }} #endregion -" ); +"); } private void GenerateIConvertibleMethods() @@ -1132,7 +1128,7 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(Value); }} - #endregion" ); + #endregion"); } /// diff --git a/UnitsNet/Comparison.cs b/UnitsNet/Comparison.cs index 575707e6b5..6056b2f36b 100644 --- a/UnitsNet/Comparison.cs +++ b/UnitsNet/Comparison.cs @@ -49,10 +49,11 @@ public static class Comparison /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// Whether the tolerance is absolute or relative. /// - public static bool Equals(double referenceValue, double otherValue, double tolerance, ComparisonType comparisonType) + public static bool Equals(T referenceValue, T otherValue, T tolerance, ComparisonType comparisonType) + where T : struct { - if (tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0"); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); switch (comparisonType) { @@ -86,13 +87,15 @@ public static bool Equals(double referenceValue, double otherValue, double toler /// The value to compare to. /// The relative tolerance. Must be greater than or equal to 0. /// True if the two values are equal within the given relative tolerance, otherwise false. - public static bool EqualsRelative(double referenceValue, double otherValue, double tolerance) + public static bool EqualsRelative(T referenceValue, T otherValue, T tolerance) + where T : struct { - if (tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0"); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); - var maxVariation = Math.Abs(referenceValue * tolerance); - return Math.Abs(referenceValue - otherValue) <= maxVariation; + var maxError = CompiledLambdas.AbsoluteValue(CompiledLambdas.Multiply(referenceValue, tolerance)); + var absoluteError = CompiledLambdas.AbsoluteValue(CompiledLambdas.Subtract(referenceValue, otherValue)); + return CompiledLambdas.LessThanOrEqual(absoluteError, maxError); } /// @@ -114,12 +117,14 @@ public static bool EqualsRelative(double referenceValue, double otherValue, doub /// The second value. /// The absolute tolerance. Must be greater than or equal to 0. /// True if the two values are equal within the given absolute tolerance, otherwise false. - public static bool EqualsAbsolute(double value1, double value2, double tolerance) + public static bool EqualsAbsolute(T value1, T value2, T tolerance) + where T : struct { - if (tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0"); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); - return Math.Abs(value1 - value2) <= tolerance; + var absoluteError = CompiledLambdas.AbsoluteValue(CompiledLambdas.Subtract(value1, value2)); + return CompiledLambdas.LessThanOrEqual(absoluteError, tolerance); } } } diff --git a/UnitsNet/CompiledLambdas.cs b/UnitsNet/CompiledLambdas.cs index a5dc9049f3..bb05128830 100644 --- a/UnitsNet/CompiledLambdas.cs +++ b/UnitsNet/CompiledLambdas.cs @@ -9,6 +9,14 @@ namespace UnitsNet /// internal static class CompiledLambdas { + /// + /// Returns the absolute value. + /// + /// The type of the value to negate. + /// The value to get absolute of. + /// The absolute value. + internal static T AbsoluteValue(T value) where T : struct => AbsoluteValueImplementation.Invoke(value); + /// /// Multiplies the given values. /// @@ -208,6 +216,28 @@ internal static bool GreaterThanOrEqual(TLeft left, TRight right) #region Implementation Classes + private static class AbsoluteValueImplementation + where T : struct + { + private static readonly Func Function; + + static AbsoluteValueImplementation() + { + ParameterExpression A = Expression.Parameter(typeof(T)); + LabelTarget RETURN = Expression.Label(typeof(T)); + Expression BODY = Expression.Block( + Expression.IfThenElse( + Expression.LessThan(A, Expression.Constant(default(T))), + Expression.Return(RETURN, Expression.Negate(A)), + Expression.Return(RETURN, A)), + Expression.Label(RETURN, Expression.Constant(default(T), typeof(T)))); + + Function = Expression.Lambda>(BODY, A).Compile(); + } + + internal static T Invoke(T value) => Function(value); + } + private static class MultiplyImplementation { private readonly static Func Function = diff --git a/UnitsNet/CustomCode/QuantityParser.cs b/UnitsNet/CustomCode/QuantityParser.cs index a0054f5779..3e42a097ee 100644 --- a/UnitsNet/CustomCode/QuantityParser.cs +++ b/UnitsNet/CustomCode/QuantityParser.cs @@ -13,6 +13,10 @@ namespace UnitsNet { + internal delegate TQuantity QuantityFromDelegate(TValue value, TUnitType fromUnit) + where TValue : struct + where TQuantity : IQuantity + where TUnitType : Enum; internal delegate TQuantity QuantityFromDelegate(QuantityValue value, TUnitType fromUnit) where TQuantity : IQuantity where TUnitType : Enum; @@ -41,9 +45,10 @@ static QuantityParser() } [SuppressMessage("ReSharper", "UseStringInterpolation")] - internal TQuantity Parse([NotNull] string str, + internal TQuantity Parse([NotNull] string str, IFormatProvider? formatProvider, - [NotNull] QuantityFromDelegate fromDelegate) + [NotNull] QuantityFromDelegate fromDelegate) + where TValue : struct where TQuantity : IQuantity where TUnitType : Enum { @@ -70,10 +75,11 @@ internal TQuantity Parse([NotNull] string str, } [SuppressMessage("ReSharper", "UseStringInterpolation")] - internal bool TryParse(string? str, + internal bool TryParse(string? str, IFormatProvider? formatProvider, - [NotNull] QuantityFromDelegate fromDelegate, + [NotNull] QuantityFromDelegate fromDelegate, out TQuantity result) + where TValue : struct where TQuantity : struct, IQuantity where TUnitType : struct, Enum { @@ -101,10 +107,11 @@ internal bool TryParse(string? str, /// Workaround for C# not allowing to pass on 'out' param from type Length to IQuantity, even though the are compatible. /// [SuppressMessage("ReSharper", "UseStringInterpolation")] - internal bool TryParse([NotNull] string str, + internal bool TryParse([NotNull] string str, IFormatProvider? formatProvider, - [NotNull] QuantityFromDelegate fromDelegate, + [NotNull] QuantityFromDelegate fromDelegate, out IQuantity? result) + where TValue : struct where TQuantity : struct, IQuantity where TUnitType : struct, Enum { diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs index a9af5092f2..d261ed5fb6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Acceleration, in physics, is the rate at which the velocity of an object changes over time. An object's acceleration is the net result of any and all forces acting on the object, as described by Newton's Second Law. The SI unit for acceleration is the Meter per second squared (m/s²). Accelerations are vector quantities (they have magnitude and direction) and add according to the parallelogram law. As a vector, the calculated net force is equal to the product of the object's mass (a scalar quantity) and the acceleration. /// public partial struct Acceleration : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -117,12 +118,12 @@ public Acceleration(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Acceleration MaxValue { get; } = new Acceleration(double.MaxValue, BaseUnit); + public static Acceleration MaxValue { get; } = new Acceleration(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Acceleration MinValue { get; } = new Acceleration(double.MinValue, BaseUnit); + public static Acceleration MinValue { get; } = new Acceleration(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -138,7 +139,7 @@ public Acceleration(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit MeterPerSecondSquared. /// - public static Acceleration Zero { get; } = new Acceleration((T)0, BaseUnit); + public static Acceleration Zero { get; } = new Acceleration(default(T), BaseUnit); #endregion @@ -151,6 +152,29 @@ public Acceleration(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public AccelerationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Acceleration.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Acceleration.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -432,7 +456,7 @@ public static Acceleration Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Acceleration Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, AccelerationUnit>( + return QuantityParser.Default.Parse, AccelerationUnit>( str, provider, From); @@ -463,7 +487,7 @@ public static bool TryParse(string? str, out Acceleration result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Acceleration result) { - return QuantityParser.Default.TryParse, AccelerationUnit>( + return QuantityParser.Default.TryParse, AccelerationUnit>( str, provider, From, @@ -685,10 +709,10 @@ public bool Equals(Acceleration other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Acceleration other, double tolerance, ComparisonType comparisonType) + public bool Equals(Acceleration other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs index d8321b8f84..8854fbe15b 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Mole is the amount of substance containing Avagadro's Number (6.02 x 10 ^ 23) of real particles such as molecules,atoms, ions or radicals. /// public partial struct AmountOfSubstance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -118,12 +119,12 @@ public AmountOfSubstance(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static AmountOfSubstance MaxValue { get; } = new AmountOfSubstance(double.MaxValue, BaseUnit); + public static AmountOfSubstance MaxValue { get; } = new AmountOfSubstance(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static AmountOfSubstance MinValue { get; } = new AmountOfSubstance(double.MinValue, BaseUnit); + public static AmountOfSubstance MinValue { get; } = new AmountOfSubstance(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -139,7 +140,7 @@ public AmountOfSubstance(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Mole. /// - public static AmountOfSubstance Zero { get; } = new AmountOfSubstance((T)0, BaseUnit); + public static AmountOfSubstance Zero { get; } = new AmountOfSubstance(default(T), BaseUnit); #endregion @@ -152,6 +153,29 @@ public AmountOfSubstance(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public AmountOfSubstanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => AmountOfSubstance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => AmountOfSubstance.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -446,7 +470,7 @@ public static AmountOfSubstance Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static AmountOfSubstance Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, AmountOfSubstanceUnit>( + return QuantityParser.Default.Parse, AmountOfSubstanceUnit>( str, provider, From); @@ -477,7 +501,7 @@ public static bool TryParse(string? str, out AmountOfSubstance result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out AmountOfSubstance result) { - return QuantityParser.Default.TryParse, AmountOfSubstanceUnit>( + return QuantityParser.Default.TryParse, AmountOfSubstanceUnit>( str, provider, From, @@ -699,10 +723,10 @@ public bool Equals(AmountOfSubstance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(AmountOfSubstance other, double tolerance, ComparisonType comparisonType) + public bool Equals(AmountOfSubstance other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs index 65145f96b8..9f73706069 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// The strength of a signal expressed in decibels (dB) relative to one volt RMS. /// public partial struct AmplitudeRatio : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -107,12 +108,12 @@ public AmplitudeRatio(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static AmplitudeRatio MaxValue { get; } = new AmplitudeRatio(double.MaxValue, BaseUnit); + public static AmplitudeRatio MaxValue { get; } = new AmplitudeRatio(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static AmplitudeRatio MinValue { get; } = new AmplitudeRatio(double.MinValue, BaseUnit); + public static AmplitudeRatio MinValue { get; } = new AmplitudeRatio(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,7 +129,7 @@ public AmplitudeRatio(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit DecibelVolt. /// - public static AmplitudeRatio Zero { get; } = new AmplitudeRatio((T)0, BaseUnit); + public static AmplitudeRatio Zero { get; } = new AmplitudeRatio(default(T), BaseUnit); #endregion @@ -141,6 +142,29 @@ public AmplitudeRatio(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public AmplitudeRatioUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => AmplitudeRatio.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => AmplitudeRatio.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -292,7 +316,7 @@ public static AmplitudeRatio Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static AmplitudeRatio Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, AmplitudeRatioUnit>( + return QuantityParser.Default.Parse, AmplitudeRatioUnit>( str, provider, From); @@ -323,7 +347,7 @@ public static bool TryParse(string? str, out AmplitudeRatio result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out AmplitudeRatio result) { - return QuantityParser.Default.TryParse, AmplitudeRatioUnit>( + return QuantityParser.Default.TryParse, AmplitudeRatioUnit>( str, provider, From, @@ -548,10 +572,10 @@ public bool Equals(AmplitudeRatio other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(AmplitudeRatio other, double tolerance, ComparisonType comparisonType) + public bool Equals(AmplitudeRatio other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs index d8052d6e64..98d9db6694 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// In geometry, an angle is the figure formed by two rays, called the sides of the angle, sharing a common endpoint, called the vertex of the angle. /// public partial struct Angle : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -117,12 +118,12 @@ public Angle(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Angle MaxValue { get; } = new Angle(double.MaxValue, BaseUnit); + public static Angle MaxValue { get; } = new Angle(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Angle MinValue { get; } = new Angle(double.MinValue, BaseUnit); + public static Angle MinValue { get; } = new Angle(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -138,7 +139,7 @@ public Angle(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Degree. /// - public static Angle Zero { get; } = new Angle((T)0, BaseUnit); + public static Angle Zero { get; } = new Angle(default(T), BaseUnit); #endregion @@ -151,6 +152,29 @@ public Angle(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public AngleUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Angle.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Angle.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -432,7 +456,7 @@ public static Angle Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Angle Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, AngleUnit>( + return QuantityParser.Default.Parse, AngleUnit>( str, provider, From); @@ -463,7 +487,7 @@ public static bool TryParse(string? str, out Angle result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Angle result) { - return QuantityParser.Default.TryParse, AngleUnit>( + return QuantityParser.Default.TryParse, AngleUnit>( str, provider, From, @@ -685,10 +709,10 @@ public bool Equals(Angle other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Angle other, double tolerance, ComparisonType comparisonType) + public bool Equals(Angle other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs index 278e2450e4..b4567ea2df 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// A unit for expressing the integral of apparent power over time, equal to the product of 1 volt-ampere and 1 hour, or to 3600 joules. /// public partial struct ApparentEnergy : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -106,12 +107,12 @@ public ApparentEnergy(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ApparentEnergy MaxValue { get; } = new ApparentEnergy(double.MaxValue, BaseUnit); + public static ApparentEnergy MaxValue { get; } = new ApparentEnergy(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ApparentEnergy MinValue { get; } = new ApparentEnergy(double.MinValue, BaseUnit); + public static ApparentEnergy MinValue { get; } = new ApparentEnergy(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -127,7 +128,7 @@ public ApparentEnergy(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereHour. /// - public static ApparentEnergy Zero { get; } = new ApparentEnergy((T)0, BaseUnit); + public static ApparentEnergy Zero { get; } = new ApparentEnergy(default(T), BaseUnit); #endregion @@ -140,6 +141,29 @@ public ApparentEnergy(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ApparentEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ApparentEnergy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ApparentEnergy.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -278,7 +302,7 @@ public static ApparentEnergy Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ApparentEnergy Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ApparentEnergyUnit>( + return QuantityParser.Default.Parse, ApparentEnergyUnit>( str, provider, From); @@ -309,7 +333,7 @@ public static bool TryParse(string? str, out ApparentEnergy result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ApparentEnergy result) { - return QuantityParser.Default.TryParse, ApparentEnergyUnit>( + return QuantityParser.Default.TryParse, ApparentEnergyUnit>( str, provider, From, @@ -531,10 +555,10 @@ public bool Equals(ApparentEnergy other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ApparentEnergy other, double tolerance, ComparisonType comparisonType) + public bool Equals(ApparentEnergy other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs index a5f063d663..27320b92ef 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Power engineers measure apparent power as the magnitude of the vector sum of active and reactive power. Apparent power is the product of the root-mean-square of voltage and current. /// public partial struct ApparentPower : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -107,12 +108,12 @@ public ApparentPower(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ApparentPower MaxValue { get; } = new ApparentPower(double.MaxValue, BaseUnit); + public static ApparentPower MaxValue { get; } = new ApparentPower(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ApparentPower MinValue { get; } = new ApparentPower(double.MinValue, BaseUnit); + public static ApparentPower MinValue { get; } = new ApparentPower(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,7 +129,7 @@ public ApparentPower(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Voltampere. /// - public static ApparentPower Zero { get; } = new ApparentPower((T)0, BaseUnit); + public static ApparentPower Zero { get; } = new ApparentPower(default(T), BaseUnit); #endregion @@ -141,6 +142,29 @@ public ApparentPower(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ApparentPowerUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ApparentPower.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ApparentPower.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -292,7 +316,7 @@ public static ApparentPower Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ApparentPower Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ApparentPowerUnit>( + return QuantityParser.Default.Parse, ApparentPowerUnit>( str, provider, From); @@ -323,7 +347,7 @@ public static bool TryParse(string? str, out ApparentPower result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ApparentPower result) { - return QuantityParser.Default.TryParse, ApparentPowerUnit>( + return QuantityParser.Default.TryParse, ApparentPowerUnit>( str, provider, From, @@ -545,10 +569,10 @@ public bool Equals(ApparentPower other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ApparentPower other, double tolerance, ComparisonType comparisonType) + public bool Equals(ApparentPower other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs index edcd6f3045..498c86a5f1 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Area is a quantity that expresses the extent of a two-dimensional surface or shape, or planar lamina, in the plane. Area can be understood as the amount of material with a given thickness that would be necessary to fashion a model of the shape, or the amount of paint necessary to cover the surface with a single coat.[1] It is the two-dimensional analog of the length of a curve (a one-dimensional concept) or the volume of a solid (a three-dimensional concept). /// public partial struct Area : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -117,12 +118,12 @@ public Area(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Area MaxValue { get; } = new Area(double.MaxValue, BaseUnit); + public static Area MaxValue { get; } = new Area(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Area MinValue { get; } = new Area(double.MinValue, BaseUnit); + public static Area MinValue { get; } = new Area(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -138,7 +139,7 @@ public Area(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeter. /// - public static Area Zero { get; } = new Area((T)0, BaseUnit); + public static Area Zero { get; } = new Area(default(T), BaseUnit); #endregion @@ -151,6 +152,29 @@ public Area(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public AreaUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Area.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Area.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -432,7 +456,7 @@ public static Area Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Area Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, AreaUnit>( + return QuantityParser.Default.Parse, AreaUnit>( str, provider, From); @@ -463,7 +487,7 @@ public static bool TryParse(string? str, out Area result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Area result) { - return QuantityParser.Default.TryParse, AreaUnit>( + return QuantityParser.Default.TryParse, AreaUnit>( str, provider, From, @@ -685,10 +709,10 @@ public bool Equals(Area other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Area other, double tolerance, ComparisonType comparisonType) + public bool Equals(Area other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs index 020e707e06..b4b5c0855e 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// The area density of a two-dimensional object is calculated as the mass per unit area. /// public partial struct AreaDensity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -104,12 +105,12 @@ public AreaDensity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static AreaDensity MaxValue { get; } = new AreaDensity(double.MaxValue, BaseUnit); + public static AreaDensity MaxValue { get; } = new AreaDensity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static AreaDensity MinValue { get; } = new AreaDensity(double.MinValue, BaseUnit); + public static AreaDensity MinValue { get; } = new AreaDensity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -125,7 +126,7 @@ public AreaDensity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerSquareMeter. /// - public static AreaDensity Zero { get; } = new AreaDensity((T)0, BaseUnit); + public static AreaDensity Zero { get; } = new AreaDensity(default(T), BaseUnit); #endregion @@ -138,6 +139,29 @@ public AreaDensity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public AreaDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => AreaDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => AreaDensity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -250,7 +274,7 @@ public static AreaDensity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static AreaDensity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, AreaDensityUnit>( + return QuantityParser.Default.Parse, AreaDensityUnit>( str, provider, From); @@ -281,7 +305,7 @@ public static bool TryParse(string? str, out AreaDensity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out AreaDensity result) { - return QuantityParser.Default.TryParse, AreaDensityUnit>( + return QuantityParser.Default.TryParse, AreaDensityUnit>( str, provider, From, @@ -503,10 +527,10 @@ public bool Equals(AreaDensity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(AreaDensity other, double tolerance, ComparisonType comparisonType) + public bool Equals(AreaDensity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs index 94c971dde1..60d4a40d33 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// A geometric property of an area that reflects how its points are distributed with regard to an axis. /// public partial struct AreaMomentOfInertia : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -109,12 +110,12 @@ public AreaMomentOfInertia(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static AreaMomentOfInertia MaxValue { get; } = new AreaMomentOfInertia(double.MaxValue, BaseUnit); + public static AreaMomentOfInertia MaxValue { get; } = new AreaMomentOfInertia(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static AreaMomentOfInertia MinValue { get; } = new AreaMomentOfInertia(double.MinValue, BaseUnit); + public static AreaMomentOfInertia MinValue { get; } = new AreaMomentOfInertia(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -130,7 +131,7 @@ public AreaMomentOfInertia(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit MeterToTheFourth. /// - public static AreaMomentOfInertia Zero { get; } = new AreaMomentOfInertia((T)0, BaseUnit); + public static AreaMomentOfInertia Zero { get; } = new AreaMomentOfInertia(default(T), BaseUnit); #endregion @@ -143,6 +144,29 @@ public AreaMomentOfInertia(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public AreaMomentOfInertiaUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => AreaMomentOfInertia.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => AreaMomentOfInertia.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -320,7 +344,7 @@ public static AreaMomentOfInertia Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static AreaMomentOfInertia Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, AreaMomentOfInertiaUnit>( + return QuantityParser.Default.Parse, AreaMomentOfInertiaUnit>( str, provider, From); @@ -351,7 +375,7 @@ public static bool TryParse(string? str, out AreaMomentOfInertia result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out AreaMomentOfInertia result) { - return QuantityParser.Default.TryParse, AreaMomentOfInertiaUnit>( + return QuantityParser.Default.TryParse, AreaMomentOfInertiaUnit>( str, provider, From, @@ -573,10 +597,10 @@ public bool Equals(AreaMomentOfInertia other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(AreaMomentOfInertia other, double tolerance, ComparisonType comparisonType) + public bool Equals(AreaMomentOfInertia other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs index 560c7ea156..0e936d553a 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Bit_rate /// public partial struct BitRate : IQuantityT, IDecimalQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -132,12 +133,12 @@ public BitRate(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static BitRate MaxValue { get; } = new BitRate(decimal.MaxValue, BaseUnit); + public static BitRate MaxValue { get; } = new BitRate(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static BitRate MinValue { get; } = new BitRate(decimal.MinValue, BaseUnit); + public static BitRate MinValue { get; } = new BitRate(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -153,7 +154,7 @@ public BitRate(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit BitPerSecond. /// - public static BitRate Zero { get; } = new BitRate((T)0, BaseUnit); + public static BitRate Zero { get; } = new BitRate(default(T), BaseUnit); #endregion @@ -172,10 +173,10 @@ public BitRate(T value, UnitSystem unitSystem) Enum IQuantity.Unit => Unit; /// - public {_unitEnumName} Unit => _unit.GetValueOrDefault(BaseUnit); + public BitRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// - public QuantityInfo<{_unitEnumName}> QuantityInfo => Info; + public QuantityInfo QuantityInfo => Info; /// QuantityInfo IQuantity.QuantityInfo => Info; @@ -183,12 +184,12 @@ public BitRate(T value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => {_quantity.Name}.QuantityType; + public QuantityType Type => BitRate.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => {_quantity.Name}.BaseDimensions; + public BaseDimensions Dimensions => BitRate.BaseDimensions; #endregion @@ -629,7 +630,7 @@ public static BitRate Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static BitRate Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, BitRateUnit>( + return QuantityParser.Default.Parse, BitRateUnit>( str, provider, From); @@ -660,7 +661,7 @@ public static bool TryParse(string? str, out BitRate result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out BitRate result) { - return QuantityParser.Default.TryParse, BitRateUnit>( + return QuantityParser.Default.TryParse, BitRateUnit>( str, provider, From, @@ -882,10 +883,10 @@ public bool Equals(BitRate other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(BitRate other, double tolerance, ComparisonType comparisonType) + public bool Equals(BitRate other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs index 9c88f52cf5..55a29a88a0 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Brake specific fuel consumption (BSFC) is a measure of the fuel efficiency of any prime mover that burns fuel and produces rotational, or shaft, power. It is typically used for comparing the efficiency of internal combustion engines with a shaft output. /// public partial struct BrakeSpecificFuelConsumption : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -106,12 +107,12 @@ public BrakeSpecificFuelConsumption(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static BrakeSpecificFuelConsumption MaxValue { get; } = new BrakeSpecificFuelConsumption(double.MaxValue, BaseUnit); + public static BrakeSpecificFuelConsumption MaxValue { get; } = new BrakeSpecificFuelConsumption(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static BrakeSpecificFuelConsumption MinValue { get; } = new BrakeSpecificFuelConsumption(double.MinValue, BaseUnit); + public static BrakeSpecificFuelConsumption MinValue { get; } = new BrakeSpecificFuelConsumption(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -127,7 +128,7 @@ public BrakeSpecificFuelConsumption(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerJoule. /// - public static BrakeSpecificFuelConsumption Zero { get; } = new BrakeSpecificFuelConsumption((T)0, BaseUnit); + public static BrakeSpecificFuelConsumption Zero { get; } = new BrakeSpecificFuelConsumption(default(T), BaseUnit); #endregion @@ -140,6 +141,29 @@ public BrakeSpecificFuelConsumption(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public BrakeSpecificFuelConsumptionUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => BrakeSpecificFuelConsumption.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => BrakeSpecificFuelConsumption.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -278,7 +302,7 @@ public static BrakeSpecificFuelConsumption Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static BrakeSpecificFuelConsumption Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, BrakeSpecificFuelConsumptionUnit>( + return QuantityParser.Default.Parse, BrakeSpecificFuelConsumptionUnit>( str, provider, From); @@ -309,7 +333,7 @@ public static bool TryParse(string? str, out BrakeSpecificFuelConsumption res /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out BrakeSpecificFuelConsumption result) { - return QuantityParser.Default.TryParse, BrakeSpecificFuelConsumptionUnit>( + return QuantityParser.Default.TryParse, BrakeSpecificFuelConsumptionUnit>( str, provider, From, @@ -531,10 +555,10 @@ public bool Equals(BrakeSpecificFuelConsumption other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(BrakeSpecificFuelConsumption other, double tolerance, ComparisonType comparisonType) + public bool Equals(BrakeSpecificFuelConsumption other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs index adc94f4740..52b214b78f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Capacitance /// public partial struct Capacitance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -113,12 +114,12 @@ public Capacitance(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Capacitance MaxValue { get; } = new Capacitance(double.MaxValue, BaseUnit); + public static Capacitance MaxValue { get; } = new Capacitance(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Capacitance MinValue { get; } = new Capacitance(double.MinValue, BaseUnit); + public static Capacitance MinValue { get; } = new Capacitance(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -134,7 +135,7 @@ public Capacitance(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Farad. /// - public static Capacitance Zero { get; } = new Capacitance((T)0, BaseUnit); + public static Capacitance Zero { get; } = new Capacitance(default(T), BaseUnit); #endregion @@ -147,6 +148,29 @@ public Capacitance(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public CapacitanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Capacitance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Capacitance.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -337,7 +361,7 @@ public static Capacitance Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Capacitance Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, CapacitanceUnit>( + return QuantityParser.Default.Parse, CapacitanceUnit>( str, provider, From); @@ -368,7 +392,7 @@ public static bool TryParse(string? str, out Capacitance result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Capacitance result) { - return QuantityParser.Default.TryParse, CapacitanceUnit>( + return QuantityParser.Default.TryParse, CapacitanceUnit>( str, provider, From, @@ -590,10 +614,10 @@ public bool Equals(Capacitance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Capacitance other, double tolerance, ComparisonType comparisonType) + public bool Equals(Capacitance other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs index b8eff6e15e..016474759f 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// A unit that represents a fractional change in size in response to a change in temperature. /// public partial struct CoefficientOfThermalExpansion : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -106,12 +107,12 @@ public CoefficientOfThermalExpansion(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static CoefficientOfThermalExpansion MaxValue { get; } = new CoefficientOfThermalExpansion(double.MaxValue, BaseUnit); + public static CoefficientOfThermalExpansion MaxValue { get; } = new CoefficientOfThermalExpansion(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static CoefficientOfThermalExpansion MinValue { get; } = new CoefficientOfThermalExpansion(double.MinValue, BaseUnit); + public static CoefficientOfThermalExpansion MinValue { get; } = new CoefficientOfThermalExpansion(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -127,7 +128,7 @@ public CoefficientOfThermalExpansion(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit InverseKelvin. /// - public static CoefficientOfThermalExpansion Zero { get; } = new CoefficientOfThermalExpansion((T)0, BaseUnit); + public static CoefficientOfThermalExpansion Zero { get; } = new CoefficientOfThermalExpansion(default(T), BaseUnit); #endregion @@ -140,6 +141,29 @@ public CoefficientOfThermalExpansion(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public CoefficientOfThermalExpansionUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => CoefficientOfThermalExpansion.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => CoefficientOfThermalExpansion.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -278,7 +302,7 @@ public static CoefficientOfThermalExpansion Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static CoefficientOfThermalExpansion Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, CoefficientOfThermalExpansionUnit>( + return QuantityParser.Default.Parse, CoefficientOfThermalExpansionUnit>( str, provider, From); @@ -309,7 +333,7 @@ public static bool TryParse(string? str, out CoefficientOfThermalExpansion re /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out CoefficientOfThermalExpansion result) { - return QuantityParser.Default.TryParse, CoefficientOfThermalExpansionUnit>( + return QuantityParser.Default.TryParse, CoefficientOfThermalExpansionUnit>( str, provider, From, @@ -531,10 +555,10 @@ public bool Equals(CoefficientOfThermalExpansion other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(CoefficientOfThermalExpansion other, double tolerance, ComparisonType comparisonType) + public bool Equals(CoefficientOfThermalExpansion other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs index 34aec2d73e..ef723beb13 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// http://en.wikipedia.org/wiki/Density /// public partial struct Density : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -146,12 +147,12 @@ public Density(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Density MaxValue { get; } = new Density(double.MaxValue, BaseUnit); + public static Density MaxValue { get; } = new Density(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Density MinValue { get; } = new Density(double.MinValue, BaseUnit); + public static Density MinValue { get; } = new Density(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -167,7 +168,7 @@ public Density(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerCubicMeter. /// - public static Density Zero { get; } = new Density((T)0, BaseUnit); + public static Density Zero { get; } = new Density(default(T), BaseUnit); #endregion @@ -180,6 +181,29 @@ public Density(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public DensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Density.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Density.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -799,7 +823,7 @@ public static Density Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Density Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, DensityUnit>( + return QuantityParser.Default.Parse, DensityUnit>( str, provider, From); @@ -830,7 +854,7 @@ public static bool TryParse(string? str, out Density result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Density result) { - return QuantityParser.Default.TryParse, DensityUnit>( + return QuantityParser.Default.TryParse, DensityUnit>( str, provider, From, @@ -1052,10 +1076,10 @@ public bool Equals(Density other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Density other, double tolerance, ComparisonType comparisonType) + public bool Equals(Density other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs index d56ad39e95..30752f8f82 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Time is a dimension in which events can be ordered from the past through the present into the future, and also the measure of durations of events and the intervals between them. /// public partial struct Duration : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -113,12 +114,12 @@ public Duration(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Duration MaxValue { get; } = new Duration(double.MaxValue, BaseUnit); + public static Duration MaxValue { get; } = new Duration(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Duration MinValue { get; } = new Duration(double.MinValue, BaseUnit); + public static Duration MinValue { get; } = new Duration(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -134,7 +135,7 @@ public Duration(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Second. /// - public static Duration Zero { get; } = new Duration((T)0, BaseUnit); + public static Duration Zero { get; } = new Duration(default(T), BaseUnit); #endregion @@ -147,6 +148,29 @@ public Duration(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public DurationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Duration.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Duration.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -376,7 +400,7 @@ public static Duration Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Duration Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, DurationUnit>( + return QuantityParser.Default.Parse, DurationUnit>( str, provider, From); @@ -407,7 +431,7 @@ public static bool TryParse(string? str, out Duration result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Duration result) { - return QuantityParser.Default.TryParse, DurationUnit>( + return QuantityParser.Default.TryParse, DurationUnit>( str, provider, From, @@ -629,10 +653,10 @@ public bool Equals(Duration other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Duration other, double tolerance, ComparisonType comparisonType) + public bool Equals(Duration other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs index 74b4b773c5..a63fd49579 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Viscosity#Dynamic_.28shear.29_viscosity /// public partial struct DynamicViscosity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -116,12 +117,12 @@ public DynamicViscosity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static DynamicViscosity MaxValue { get; } = new DynamicViscosity(double.MaxValue, BaseUnit); + public static DynamicViscosity MaxValue { get; } = new DynamicViscosity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static DynamicViscosity MinValue { get; } = new DynamicViscosity(double.MinValue, BaseUnit); + public static DynamicViscosity MinValue { get; } = new DynamicViscosity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -137,7 +138,7 @@ public DynamicViscosity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonSecondPerMeterSquared. /// - public static DynamicViscosity Zero { get; } = new DynamicViscosity((T)0, BaseUnit); + public static DynamicViscosity Zero { get; } = new DynamicViscosity(default(T), BaseUnit); #endregion @@ -150,6 +151,29 @@ public DynamicViscosity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public DynamicViscosityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => DynamicViscosity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => DynamicViscosity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -379,7 +403,7 @@ public static DynamicViscosity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static DynamicViscosity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, DynamicViscosityUnit>( + return QuantityParser.Default.Parse, DynamicViscosityUnit>( str, provider, From); @@ -410,7 +434,7 @@ public static bool TryParse(string? str, out DynamicViscosity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out DynamicViscosity result) { - return QuantityParser.Default.TryParse, DynamicViscosityUnit>( + return QuantityParser.Default.TryParse, DynamicViscosityUnit>( str, provider, From, @@ -632,10 +656,10 @@ public bool Equals(DynamicViscosity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(DynamicViscosity other, double tolerance, ComparisonType comparisonType) + public bool Equals(DynamicViscosity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs index f6833dac0b..0f18799f8f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Electric admittance is a measure of how easily a circuit or device will allow a current to flow. It is defined as the inverse of impedance. The SI unit of admittance is the siemens (symbol S). /// public partial struct ElectricAdmittance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -107,12 +108,12 @@ public ElectricAdmittance(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricAdmittance MaxValue { get; } = new ElectricAdmittance(double.MaxValue, BaseUnit); + public static ElectricAdmittance MaxValue { get; } = new ElectricAdmittance(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricAdmittance MinValue { get; } = new ElectricAdmittance(double.MinValue, BaseUnit); + public static ElectricAdmittance MinValue { get; } = new ElectricAdmittance(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,7 +129,7 @@ public ElectricAdmittance(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Siemens. /// - public static ElectricAdmittance Zero { get; } = new ElectricAdmittance((T)0, BaseUnit); + public static ElectricAdmittance Zero { get; } = new ElectricAdmittance(default(T), BaseUnit); #endregion @@ -141,6 +142,29 @@ public ElectricAdmittance(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricAdmittanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricAdmittance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricAdmittance.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -292,7 +316,7 @@ public static ElectricAdmittance Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricAdmittance Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricAdmittanceUnit>( + return QuantityParser.Default.Parse, ElectricAdmittanceUnit>( str, provider, From); @@ -323,7 +347,7 @@ public static bool TryParse(string? str, out ElectricAdmittance result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricAdmittance result) { - return QuantityParser.Default.TryParse, ElectricAdmittanceUnit>( + return QuantityParser.Default.TryParse, ElectricAdmittanceUnit>( str, provider, From, @@ -545,10 +569,10 @@ public bool Equals(ElectricAdmittance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricAdmittance other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricAdmittance other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs index 86a54bd572..e98e593185 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Electric_charge /// public partial struct ElectricCharge : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -111,12 +112,12 @@ public ElectricCharge(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricCharge MaxValue { get; } = new ElectricCharge(double.MaxValue, BaseUnit); + public static ElectricCharge MaxValue { get; } = new ElectricCharge(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricCharge MinValue { get; } = new ElectricCharge(double.MinValue, BaseUnit); + public static ElectricCharge MinValue { get; } = new ElectricCharge(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -132,7 +133,7 @@ public ElectricCharge(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Coulomb. /// - public static ElectricCharge Zero { get; } = new ElectricCharge((T)0, BaseUnit); + public static ElectricCharge Zero { get; } = new ElectricCharge(default(T), BaseUnit); #endregion @@ -145,6 +146,29 @@ public ElectricCharge(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricChargeUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricCharge.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricCharge.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -309,7 +333,7 @@ public static ElectricCharge Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricCharge Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricChargeUnit>( + return QuantityParser.Default.Parse, ElectricChargeUnit>( str, provider, From); @@ -340,7 +364,7 @@ public static bool TryParse(string? str, out ElectricCharge result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricCharge result) { - return QuantityParser.Default.TryParse, ElectricChargeUnit>( + return QuantityParser.Default.TryParse, ElectricChargeUnit>( str, provider, From, @@ -562,10 +586,10 @@ public bool Equals(ElectricCharge other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricCharge other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricCharge other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs index b95477b3d1..2156cf3536 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Charge_density /// public partial struct ElectricChargeDensity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -107,12 +108,12 @@ public ElectricChargeDensity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricChargeDensity MaxValue { get; } = new ElectricChargeDensity(double.MaxValue, BaseUnit); + public static ElectricChargeDensity MaxValue { get; } = new ElectricChargeDensity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricChargeDensity MinValue { get; } = new ElectricChargeDensity(double.MinValue, BaseUnit); + public static ElectricChargeDensity MinValue { get; } = new ElectricChargeDensity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,7 +129,7 @@ public ElectricChargeDensity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit CoulombPerCubicMeter. /// - public static ElectricChargeDensity Zero { get; } = new ElectricChargeDensity((T)0, BaseUnit); + public static ElectricChargeDensity Zero { get; } = new ElectricChargeDensity(default(T), BaseUnit); #endregion @@ -141,6 +142,29 @@ public ElectricChargeDensity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricChargeDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricChargeDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricChargeDensity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -253,7 +277,7 @@ public static ElectricChargeDensity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricChargeDensity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricChargeDensityUnit>( + return QuantityParser.Default.Parse, ElectricChargeDensityUnit>( str, provider, From); @@ -284,7 +308,7 @@ public static bool TryParse(string? str, out ElectricChargeDensity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricChargeDensity result) { - return QuantityParser.Default.TryParse, ElectricChargeDensityUnit>( + return QuantityParser.Default.TryParse, ElectricChargeDensityUnit>( str, provider, From, @@ -506,10 +530,10 @@ public bool Equals(ElectricChargeDensity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricChargeDensity other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricChargeDensity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs index 293e56dd37..0fff3b78c7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Electrical_resistance_and_conductance /// public partial struct ElectricConductance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -109,12 +110,12 @@ public ElectricConductance(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricConductance MaxValue { get; } = new ElectricConductance(double.MaxValue, BaseUnit); + public static ElectricConductance MaxValue { get; } = new ElectricConductance(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricConductance MinValue { get; } = new ElectricConductance(double.MinValue, BaseUnit); + public static ElectricConductance MinValue { get; } = new ElectricConductance(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -130,7 +131,7 @@ public ElectricConductance(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Siemens. /// - public static ElectricConductance Zero { get; } = new ElectricConductance((T)0, BaseUnit); + public static ElectricConductance Zero { get; } = new ElectricConductance(default(T), BaseUnit); #endregion @@ -143,6 +144,29 @@ public ElectricConductance(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricConductanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricConductance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricConductance.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -281,7 +305,7 @@ public static ElectricConductance Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricConductance Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricConductanceUnit>( + return QuantityParser.Default.Parse, ElectricConductanceUnit>( str, provider, From); @@ -312,7 +336,7 @@ public static bool TryParse(string? str, out ElectricConductance result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricConductance result) { - return QuantityParser.Default.TryParse, ElectricConductanceUnit>( + return QuantityParser.Default.TryParse, ElectricConductanceUnit>( str, provider, From, @@ -534,10 +558,10 @@ public bool Equals(ElectricConductance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricConductance other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricConductance other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs index c87448196a..62091d5f0b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity /// public partial struct ElectricConductivity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -109,12 +110,12 @@ public ElectricConductivity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricConductivity MaxValue { get; } = new ElectricConductivity(double.MaxValue, BaseUnit); + public static ElectricConductivity MaxValue { get; } = new ElectricConductivity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricConductivity MinValue { get; } = new ElectricConductivity(double.MinValue, BaseUnit); + public static ElectricConductivity MinValue { get; } = new ElectricConductivity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -130,7 +131,7 @@ public ElectricConductivity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit SiemensPerMeter. /// - public static ElectricConductivity Zero { get; } = new ElectricConductivity((T)0, BaseUnit); + public static ElectricConductivity Zero { get; } = new ElectricConductivity(default(T), BaseUnit); #endregion @@ -143,6 +144,29 @@ public ElectricConductivity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricConductivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricConductivity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricConductivity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -281,7 +305,7 @@ public static ElectricConductivity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricConductivity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricConductivityUnit>( + return QuantityParser.Default.Parse, ElectricConductivityUnit>( str, provider, From); @@ -312,7 +336,7 @@ public static bool TryParse(string? str, out ElectricConductivity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricConductivity result) { - return QuantityParser.Default.TryParse, ElectricConductivityUnit>( + return QuantityParser.Default.TryParse, ElectricConductivityUnit>( str, provider, From, @@ -534,10 +558,10 @@ public bool Equals(ElectricConductivity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricConductivity other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricConductivity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs index cb052ab1b4..05292324f9 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// An electric current is a flow of electric charge. In electric circuits this charge is often carried by moving electrons in a wire. It can also be carried by ions in an electrolyte, or by both ions and electrons such as in a plasma. /// public partial struct ElectricCurrent : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -111,12 +112,12 @@ public ElectricCurrent(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricCurrent MaxValue { get; } = new ElectricCurrent(double.MaxValue, BaseUnit); + public static ElectricCurrent MaxValue { get; } = new ElectricCurrent(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricCurrent MinValue { get; } = new ElectricCurrent(double.MinValue, BaseUnit); + public static ElectricCurrent MinValue { get; } = new ElectricCurrent(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -132,7 +133,7 @@ public ElectricCurrent(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Ampere. /// - public static ElectricCurrent Zero { get; } = new ElectricCurrent((T)0, BaseUnit); + public static ElectricCurrent Zero { get; } = new ElectricCurrent(default(T), BaseUnit); #endregion @@ -145,6 +146,29 @@ public ElectricCurrent(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricCurrentUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricCurrent.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricCurrent.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -348,7 +372,7 @@ public static ElectricCurrent Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricCurrent Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricCurrentUnit>( + return QuantityParser.Default.Parse, ElectricCurrentUnit>( str, provider, From); @@ -379,7 +403,7 @@ public static bool TryParse(string? str, out ElectricCurrent result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricCurrent result) { - return QuantityParser.Default.TryParse, ElectricCurrentUnit>( + return QuantityParser.Default.TryParse, ElectricCurrentUnit>( str, provider, From, @@ -601,10 +625,10 @@ public bool Equals(ElectricCurrent other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricCurrent other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricCurrent other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs index f049ae577f..ab3b6c7f3d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Current_density /// public partial struct ElectricCurrentDensity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -109,12 +110,12 @@ public ElectricCurrentDensity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricCurrentDensity MaxValue { get; } = new ElectricCurrentDensity(double.MaxValue, BaseUnit); + public static ElectricCurrentDensity MaxValue { get; } = new ElectricCurrentDensity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricCurrentDensity MinValue { get; } = new ElectricCurrentDensity(double.MinValue, BaseUnit); + public static ElectricCurrentDensity MinValue { get; } = new ElectricCurrentDensity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -130,7 +131,7 @@ public ElectricCurrentDensity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerSquareMeter. /// - public static ElectricCurrentDensity Zero { get; } = new ElectricCurrentDensity((T)0, BaseUnit); + public static ElectricCurrentDensity Zero { get; } = new ElectricCurrentDensity(default(T), BaseUnit); #endregion @@ -143,6 +144,29 @@ public ElectricCurrentDensity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricCurrentDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricCurrentDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricCurrentDensity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -281,7 +305,7 @@ public static ElectricCurrentDensity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricCurrentDensity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricCurrentDensityUnit>( + return QuantityParser.Default.Parse, ElectricCurrentDensityUnit>( str, provider, From); @@ -312,7 +336,7 @@ public static bool TryParse(string? str, out ElectricCurrentDensity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricCurrentDensity result) { - return QuantityParser.Default.TryParse, ElectricCurrentDensityUnit>( + return QuantityParser.Default.TryParse, ElectricCurrentDensityUnit>( str, provider, From, @@ -534,10 +558,10 @@ public bool Equals(ElectricCurrentDensity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricCurrentDensity other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricCurrentDensity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs index 3928a7557f..5e3ff6a174 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// In electromagnetism, the current gradient describes how the current changes in time. /// public partial struct ElectricCurrentGradient : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -107,12 +108,12 @@ public ElectricCurrentGradient(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricCurrentGradient MaxValue { get; } = new ElectricCurrentGradient(double.MaxValue, BaseUnit); + public static ElectricCurrentGradient MaxValue { get; } = new ElectricCurrentGradient(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricCurrentGradient MinValue { get; } = new ElectricCurrentGradient(double.MinValue, BaseUnit); + public static ElectricCurrentGradient MinValue { get; } = new ElectricCurrentGradient(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,7 +129,7 @@ public ElectricCurrentGradient(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerSecond. /// - public static ElectricCurrentGradient Zero { get; } = new ElectricCurrentGradient((T)0, BaseUnit); + public static ElectricCurrentGradient Zero { get; } = new ElectricCurrentGradient(default(T), BaseUnit); #endregion @@ -141,6 +142,29 @@ public ElectricCurrentGradient(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricCurrentGradientUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricCurrentGradient.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricCurrentGradient.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -292,7 +316,7 @@ public static ElectricCurrentGradient Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricCurrentGradient Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricCurrentGradientUnit>( + return QuantityParser.Default.Parse, ElectricCurrentGradientUnit>( str, provider, From); @@ -323,7 +347,7 @@ public static bool TryParse(string? str, out ElectricCurrentGradient result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricCurrentGradient result) { - return QuantityParser.Default.TryParse, ElectricCurrentGradientUnit>( + return QuantityParser.Default.TryParse, ElectricCurrentGradientUnit>( str, provider, From, @@ -545,10 +569,10 @@ public bool Equals(ElectricCurrentGradient other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricCurrentGradient other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricCurrentGradient other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs index 60c34a869b..378a039b53 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Electric_field /// public partial struct ElectricField : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -107,12 +108,12 @@ public ElectricField(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricField MaxValue { get; } = new ElectricField(double.MaxValue, BaseUnit); + public static ElectricField MaxValue { get; } = new ElectricField(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricField MinValue { get; } = new ElectricField(double.MinValue, BaseUnit); + public static ElectricField MinValue { get; } = new ElectricField(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,7 +129,7 @@ public ElectricField(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltPerMeter. /// - public static ElectricField Zero { get; } = new ElectricField((T)0, BaseUnit); + public static ElectricField Zero { get; } = new ElectricField(default(T), BaseUnit); #endregion @@ -141,6 +142,29 @@ public ElectricField(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricFieldUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricField.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricField.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -253,7 +277,7 @@ public static ElectricField Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricField Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricFieldUnit>( + return QuantityParser.Default.Parse, ElectricFieldUnit>( str, provider, From); @@ -284,7 +308,7 @@ public static bool TryParse(string? str, out ElectricField result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricField result) { - return QuantityParser.Default.TryParse, ElectricFieldUnit>( + return QuantityParser.Default.TryParse, ElectricFieldUnit>( str, provider, From, @@ -506,10 +530,10 @@ public bool Equals(ElectricField other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricField other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricField other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs index 923517d870..e42770088b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Inductance /// public partial struct ElectricInductance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -110,12 +111,12 @@ public ElectricInductance(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricInductance MaxValue { get; } = new ElectricInductance(double.MaxValue, BaseUnit); + public static ElectricInductance MaxValue { get; } = new ElectricInductance(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricInductance MinValue { get; } = new ElectricInductance(double.MinValue, BaseUnit); + public static ElectricInductance MinValue { get; } = new ElectricInductance(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -131,7 +132,7 @@ public ElectricInductance(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Henry. /// - public static ElectricInductance Zero { get; } = new ElectricInductance((T)0, BaseUnit); + public static ElectricInductance Zero { get; } = new ElectricInductance(default(T), BaseUnit); #endregion @@ -144,6 +145,29 @@ public ElectricInductance(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricInductanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricInductance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricInductance.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -295,7 +319,7 @@ public static ElectricInductance Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricInductance Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricInductanceUnit>( + return QuantityParser.Default.Parse, ElectricInductanceUnit>( str, provider, From); @@ -326,7 +350,7 @@ public static bool TryParse(string? str, out ElectricInductance result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricInductance result) { - return QuantityParser.Default.TryParse, ElectricInductanceUnit>( + return QuantityParser.Default.TryParse, ElectricInductanceUnit>( str, provider, From, @@ -548,10 +572,10 @@ public bool Equals(ElectricInductance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricInductance other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricInductance other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs index ba689f9778..06c5b038a4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// In classical electromagnetism, the electric potential (a scalar quantity denoted by Φ, ΦE or V and also called the electric field potential or the electrostatic potential) at a point is the amount of electric potential energy that a unitary point charge would have when located at that point. /// public partial struct ElectricPotential : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -108,12 +109,12 @@ public ElectricPotential(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricPotential MaxValue { get; } = new ElectricPotential(double.MaxValue, BaseUnit); + public static ElectricPotential MaxValue { get; } = new ElectricPotential(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricPotential MinValue { get; } = new ElectricPotential(double.MinValue, BaseUnit); + public static ElectricPotential MinValue { get; } = new ElectricPotential(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -129,7 +130,7 @@ public ElectricPotential(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Volt. /// - public static ElectricPotential Zero { get; } = new ElectricPotential((T)0, BaseUnit); + public static ElectricPotential Zero { get; } = new ElectricPotential(default(T), BaseUnit); #endregion @@ -142,6 +143,29 @@ public ElectricPotential(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricPotentialUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricPotential.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricPotential.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -306,7 +330,7 @@ public static ElectricPotential Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricPotential Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricPotentialUnit>( + return QuantityParser.Default.Parse, ElectricPotentialUnit>( str, provider, From); @@ -337,7 +361,7 @@ public static bool TryParse(string? str, out ElectricPotential result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricPotential result) { - return QuantityParser.Default.TryParse, ElectricPotentialUnit>( + return QuantityParser.Default.TryParse, ElectricPotentialUnit>( str, provider, From, @@ -559,10 +583,10 @@ public bool Equals(ElectricPotential other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricPotential other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricPotential other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs index d4d9e623e9..3414bfe576 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// The Electric Potential of a system known to use Alternating Current. /// public partial struct ElectricPotentialAc : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -108,12 +109,12 @@ public ElectricPotentialAc(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricPotentialAc MaxValue { get; } = new ElectricPotentialAc(double.MaxValue, BaseUnit); + public static ElectricPotentialAc MaxValue { get; } = new ElectricPotentialAc(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricPotentialAc MinValue { get; } = new ElectricPotentialAc(double.MinValue, BaseUnit); + public static ElectricPotentialAc MinValue { get; } = new ElectricPotentialAc(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -129,7 +130,7 @@ public ElectricPotentialAc(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltAc. /// - public static ElectricPotentialAc Zero { get; } = new ElectricPotentialAc((T)0, BaseUnit); + public static ElectricPotentialAc Zero { get; } = new ElectricPotentialAc(default(T), BaseUnit); #endregion @@ -142,6 +143,29 @@ public ElectricPotentialAc(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricPotentialAcUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricPotentialAc.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricPotentialAc.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -306,7 +330,7 @@ public static ElectricPotentialAc Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricPotentialAc Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricPotentialAcUnit>( + return QuantityParser.Default.Parse, ElectricPotentialAcUnit>( str, provider, From); @@ -337,7 +361,7 @@ public static bool TryParse(string? str, out ElectricPotentialAc result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricPotentialAc result) { - return QuantityParser.Default.TryParse, ElectricPotentialAcUnit>( + return QuantityParser.Default.TryParse, ElectricPotentialAcUnit>( str, provider, From, @@ -559,10 +583,10 @@ public bool Equals(ElectricPotentialAc other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricPotentialAc other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricPotentialAc other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs index b0abf990f8..ceb840eee1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// ElectricPotential change rate is the ratio of the electric potential change to the time during which the change occurred (value of electric potential changes per unit time). /// public partial struct ElectricPotentialChangeRate : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -123,12 +124,12 @@ public ElectricPotentialChangeRate(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricPotentialChangeRate MaxValue { get; } = new ElectricPotentialChangeRate(double.MaxValue, BaseUnit); + public static ElectricPotentialChangeRate MaxValue { get; } = new ElectricPotentialChangeRate(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricPotentialChangeRate MinValue { get; } = new ElectricPotentialChangeRate(double.MinValue, BaseUnit); + public static ElectricPotentialChangeRate MinValue { get; } = new ElectricPotentialChangeRate(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -144,7 +145,7 @@ public ElectricPotentialChangeRate(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltPerSecond. /// - public static ElectricPotentialChangeRate Zero { get; } = new ElectricPotentialChangeRate((T)0, BaseUnit); + public static ElectricPotentialChangeRate Zero { get; } = new ElectricPotentialChangeRate(default(T), BaseUnit); #endregion @@ -157,6 +158,29 @@ public ElectricPotentialChangeRate(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricPotentialChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricPotentialChangeRate.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricPotentialChangeRate.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -516,7 +540,7 @@ public static ElectricPotentialChangeRate Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricPotentialChangeRate Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricPotentialChangeRateUnit>( + return QuantityParser.Default.Parse, ElectricPotentialChangeRateUnit>( str, provider, From); @@ -547,7 +571,7 @@ public static bool TryParse(string? str, out ElectricPotentialChangeRate resu /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricPotentialChangeRate result) { - return QuantityParser.Default.TryParse, ElectricPotentialChangeRateUnit>( + return QuantityParser.Default.TryParse, ElectricPotentialChangeRateUnit>( str, provider, From, @@ -769,10 +793,10 @@ public bool Equals(ElectricPotentialChangeRate other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricPotentialChangeRate other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricPotentialChangeRate other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs index e33977b3d2..7abfde2e27 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// The Electric Potential of a system known to use Direct Current. /// public partial struct ElectricPotentialDc : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -108,12 +109,12 @@ public ElectricPotentialDc(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricPotentialDc MaxValue { get; } = new ElectricPotentialDc(double.MaxValue, BaseUnit); + public static ElectricPotentialDc MaxValue { get; } = new ElectricPotentialDc(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricPotentialDc MinValue { get; } = new ElectricPotentialDc(double.MinValue, BaseUnit); + public static ElectricPotentialDc MinValue { get; } = new ElectricPotentialDc(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -129,7 +130,7 @@ public ElectricPotentialDc(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltDc. /// - public static ElectricPotentialDc Zero { get; } = new ElectricPotentialDc((T)0, BaseUnit); + public static ElectricPotentialDc Zero { get; } = new ElectricPotentialDc(default(T), BaseUnit); #endregion @@ -142,6 +143,29 @@ public ElectricPotentialDc(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricPotentialDcUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricPotentialDc.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricPotentialDc.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -306,7 +330,7 @@ public static ElectricPotentialDc Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricPotentialDc Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricPotentialDcUnit>( + return QuantityParser.Default.Parse, ElectricPotentialDcUnit>( str, provider, From); @@ -337,7 +361,7 @@ public static bool TryParse(string? str, out ElectricPotentialDc result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricPotentialDc result) { - return QuantityParser.Default.TryParse, ElectricPotentialDcUnit>( + return QuantityParser.Default.TryParse, ElectricPotentialDcUnit>( str, provider, From, @@ -559,10 +583,10 @@ public bool Equals(ElectricPotentialDc other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricPotentialDc other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricPotentialDc other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs index 5b97a95503..f253a88446 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// The electrical resistance of an electrical conductor is the opposition to the passage of an electric current through that conductor. /// public partial struct ElectricResistance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -109,12 +110,12 @@ public ElectricResistance(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricResistance MaxValue { get; } = new ElectricResistance(double.MaxValue, BaseUnit); + public static ElectricResistance MaxValue { get; } = new ElectricResistance(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricResistance MinValue { get; } = new ElectricResistance(double.MinValue, BaseUnit); + public static ElectricResistance MinValue { get; } = new ElectricResistance(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -130,7 +131,7 @@ public ElectricResistance(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Ohm. /// - public static ElectricResistance Zero { get; } = new ElectricResistance((T)0, BaseUnit); + public static ElectricResistance Zero { get; } = new ElectricResistance(default(T), BaseUnit); #endregion @@ -143,6 +144,29 @@ public ElectricResistance(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricResistanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricResistance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricResistance.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -320,7 +344,7 @@ public static ElectricResistance Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricResistance Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricResistanceUnit>( + return QuantityParser.Default.Parse, ElectricResistanceUnit>( str, provider, From); @@ -351,7 +375,7 @@ public static bool TryParse(string? str, out ElectricResistance result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricResistance result) { - return QuantityParser.Default.TryParse, ElectricResistanceUnit>( + return QuantityParser.Default.TryParse, ElectricResistanceUnit>( str, provider, From, @@ -573,10 +597,10 @@ public bool Equals(ElectricResistance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricResistance other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricResistance other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs index b79d558816..eec0c3e5b7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity /// public partial struct ElectricResistivity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -120,12 +121,12 @@ public ElectricResistivity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricResistivity MaxValue { get; } = new ElectricResistivity(double.MaxValue, BaseUnit); + public static ElectricResistivity MaxValue { get; } = new ElectricResistivity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricResistivity MinValue { get; } = new ElectricResistivity(double.MinValue, BaseUnit); + public static ElectricResistivity MinValue { get; } = new ElectricResistivity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -141,7 +142,7 @@ public ElectricResistivity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit OhmMeter. /// - public static ElectricResistivity Zero { get; } = new ElectricResistivity((T)0, BaseUnit); + public static ElectricResistivity Zero { get; } = new ElectricResistivity(default(T), BaseUnit); #endregion @@ -154,6 +155,29 @@ public ElectricResistivity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricResistivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricResistivity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricResistivity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -435,7 +459,7 @@ public static ElectricResistivity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricResistivity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricResistivityUnit>( + return QuantityParser.Default.Parse, ElectricResistivityUnit>( str, provider, From); @@ -466,7 +490,7 @@ public static bool TryParse(string? str, out ElectricResistivity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricResistivity result) { - return QuantityParser.Default.TryParse, ElectricResistivityUnit>( + return QuantityParser.Default.TryParse, ElectricResistivityUnit>( str, provider, From, @@ -688,10 +712,10 @@ public bool Equals(ElectricResistivity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricResistivity other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricResistivity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs index b2180a972a..c3b62a2ad1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Charge_density /// public partial struct ElectricSurfaceChargeDensity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -109,12 +110,12 @@ public ElectricSurfaceChargeDensity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ElectricSurfaceChargeDensity MaxValue { get; } = new ElectricSurfaceChargeDensity(double.MaxValue, BaseUnit); + public static ElectricSurfaceChargeDensity MaxValue { get; } = new ElectricSurfaceChargeDensity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ElectricSurfaceChargeDensity MinValue { get; } = new ElectricSurfaceChargeDensity(double.MinValue, BaseUnit); + public static ElectricSurfaceChargeDensity MinValue { get; } = new ElectricSurfaceChargeDensity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -130,7 +131,7 @@ public ElectricSurfaceChargeDensity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit CoulombPerSquareMeter. /// - public static ElectricSurfaceChargeDensity Zero { get; } = new ElectricSurfaceChargeDensity((T)0, BaseUnit); + public static ElectricSurfaceChargeDensity Zero { get; } = new ElectricSurfaceChargeDensity(default(T), BaseUnit); #endregion @@ -143,6 +144,29 @@ public ElectricSurfaceChargeDensity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ElectricSurfaceChargeDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricSurfaceChargeDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricSurfaceChargeDensity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -281,7 +305,7 @@ public static ElectricSurfaceChargeDensity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ElectricSurfaceChargeDensity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ElectricSurfaceChargeDensityUnit>( + return QuantityParser.Default.Parse, ElectricSurfaceChargeDensityUnit>( str, provider, From); @@ -312,7 +336,7 @@ public static bool TryParse(string? str, out ElectricSurfaceChargeDensity res /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ElectricSurfaceChargeDensity result) { - return QuantityParser.Default.TryParse, ElectricSurfaceChargeDensityUnit>( + return QuantityParser.Default.TryParse, ElectricSurfaceChargeDensityUnit>( str, provider, From, @@ -534,10 +558,10 @@ public bool Equals(ElectricSurfaceChargeDensity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricSurfaceChargeDensity other, double tolerance, ComparisonType comparisonType) + public bool Equals(ElectricSurfaceChargeDensity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs index 73369297d2..fed655573c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// The joule, symbol J, is a derived unit of energy, work, or amount of heat in the International System of Units. It is equal to the energy transferred (or work done) when applying a force of one newton through a distance of one metre (1 newton metre or N·m), or in passing an electric current of one ampere through a resistance of one ohm for one second. Many other units of energy are included. Please do not confuse this definition of the calorie with the one colloquially used by the food industry, the large calorie, which is equivalent to 1 kcal. Thermochemical definition of the calorie is used. For BTU, the IT definition is used. /// public partial struct Energy : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -139,12 +140,12 @@ public Energy(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Energy MaxValue { get; } = new Energy(double.MaxValue, BaseUnit); + public static Energy MaxValue { get; } = new Energy(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Energy MinValue { get; } = new Energy(double.MinValue, BaseUnit); + public static Energy MinValue { get; } = new Energy(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -160,7 +161,7 @@ public Energy(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Joule. /// - public static Energy Zero { get; } = new Energy((T)0, BaseUnit); + public static Energy Zero { get; } = new Energy(default(T), BaseUnit); #endregion @@ -173,6 +174,29 @@ public Energy(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public EnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Energy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Energy.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -740,7 +764,7 @@ public static Energy Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Energy Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, EnergyUnit>( + return QuantityParser.Default.Parse, EnergyUnit>( str, provider, From); @@ -771,7 +795,7 @@ public static bool TryParse(string? str, out Energy result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Energy result) { - return QuantityParser.Default.TryParse, EnergyUnit>( + return QuantityParser.Default.TryParse, EnergyUnit>( str, provider, From, @@ -993,10 +1017,10 @@ public bool Equals(Energy other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Energy other, double tolerance, ComparisonType comparisonType) + public bool Equals(Energy other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs index c2ffcecff9..1a341fbd5e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Entropy is an important concept in the branch of science known as thermodynamics. The idea of "irreversibility" is central to the understanding of entropy. It is often said that entropy is an expression of the disorder, or randomness of a system, or of our lack of information about it. Entropy is an extensive property. It has the dimension of energy divided by temperature, which has a unit of joules per kelvin (J/K) in the International System of Units /// public partial struct Entropy : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -110,12 +111,12 @@ public Entropy(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Entropy MaxValue { get; } = new Entropy(double.MaxValue, BaseUnit); + public static Entropy MaxValue { get; } = new Entropy(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Entropy MinValue { get; } = new Entropy(double.MinValue, BaseUnit); + public static Entropy MinValue { get; } = new Entropy(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -131,7 +132,7 @@ public Entropy(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKelvin. /// - public static Entropy Zero { get; } = new Entropy((T)0, BaseUnit); + public static Entropy Zero { get; } = new Entropy(default(T), BaseUnit); #endregion @@ -144,6 +145,29 @@ public Entropy(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public EntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Entropy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Entropy.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -334,7 +358,7 @@ public static Entropy Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Entropy Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, EntropyUnit>( + return QuantityParser.Default.Parse, EntropyUnit>( str, provider, From); @@ -365,7 +389,7 @@ public static bool TryParse(string? str, out Entropy result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Entropy result) { - return QuantityParser.Default.TryParse, EntropyUnit>( + return QuantityParser.Default.TryParse, EntropyUnit>( str, provider, From, @@ -587,10 +611,10 @@ public bool Equals(Entropy other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Entropy other, double tolerance, ComparisonType comparisonType) + public bool Equals(Entropy other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Force.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.g.cs index 8f1756b00b..f454ef7a18 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// In physics, a force is any influence that causes an object to undergo a certain change, either concerning its movement, direction, or geometrical construction. In other words, a force can cause an object with mass to change its velocity (which includes to begin moving from a state of rest), i.e., to accelerate, or a flexible object to deform, or both. Force can also be described by intuitive concepts such as a push or a pull. A force has both magnitude and direction, making it a vector quantity. It is measured in the SI unit of newtons and represented by the symbol F. /// public partial struct Force : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -118,12 +119,12 @@ public Force(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Force MaxValue { get; } = new Force(double.MaxValue, BaseUnit); + public static Force MaxValue { get; } = new Force(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Force MinValue { get; } = new Force(double.MinValue, BaseUnit); + public static Force MinValue { get; } = new Force(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -139,7 +140,7 @@ public Force(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Newton. /// - public static Force Zero { get; } = new Force((T)0, BaseUnit); + public static Force Zero { get; } = new Force(default(T), BaseUnit); #endregion @@ -152,6 +153,29 @@ public Force(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ForceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Force.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Force.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -446,7 +470,7 @@ public static Force Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Force Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ForceUnit>( + return QuantityParser.Default.Parse, ForceUnit>( str, provider, From); @@ -477,7 +501,7 @@ public static bool TryParse(string? str, out Force result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Force result) { - return QuantityParser.Default.TryParse, ForceUnit>( + return QuantityParser.Default.TryParse, ForceUnit>( str, provider, From, @@ -699,10 +723,10 @@ public bool Equals(Force other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Force other, double tolerance, ComparisonType comparisonType) + public bool Equals(Force other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs index 9f74555d95..51a2648800 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Force change rate is the ratio of the force change to the time during which the change occurred (value of force changes per unit time). /// public partial struct ForceChangeRate : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -114,12 +115,12 @@ public ForceChangeRate(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ForceChangeRate MaxValue { get; } = new ForceChangeRate(double.MaxValue, BaseUnit); + public static ForceChangeRate MaxValue { get; } = new ForceChangeRate(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ForceChangeRate MinValue { get; } = new ForceChangeRate(double.MinValue, BaseUnit); + public static ForceChangeRate MinValue { get; } = new ForceChangeRate(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -135,7 +136,7 @@ public ForceChangeRate(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerSecond. /// - public static ForceChangeRate Zero { get; } = new ForceChangeRate((T)0, BaseUnit); + public static ForceChangeRate Zero { get; } = new ForceChangeRate(default(T), BaseUnit); #endregion @@ -148,6 +149,29 @@ public ForceChangeRate(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ForceChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ForceChangeRate.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ForceChangeRate.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -390,7 +414,7 @@ public static ForceChangeRate Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ForceChangeRate Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ForceChangeRateUnit>( + return QuantityParser.Default.Parse, ForceChangeRateUnit>( str, provider, From); @@ -421,7 +445,7 @@ public static bool TryParse(string? str, out ForceChangeRate result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ForceChangeRate result) { - return QuantityParser.Default.TryParse, ForceChangeRateUnit>( + return QuantityParser.Default.TryParse, ForceChangeRateUnit>( str, provider, From, @@ -643,10 +667,10 @@ public bool Equals(ForceChangeRate other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ForceChangeRate other, double tolerance, ComparisonType comparisonType) + public bool Equals(ForceChangeRate other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs index 4da61b8436..e33033d5cd 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// The magnitude of force per unit length. /// public partial struct ForcePerLength : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -141,12 +142,12 @@ public ForcePerLength(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ForcePerLength MaxValue { get; } = new ForcePerLength(double.MaxValue, BaseUnit); + public static ForcePerLength MaxValue { get; } = new ForcePerLength(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ForcePerLength MinValue { get; } = new ForcePerLength(double.MinValue, BaseUnit); + public static ForcePerLength MinValue { get; } = new ForcePerLength(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -162,7 +163,7 @@ public ForcePerLength(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerMeter. /// - public static ForcePerLength Zero { get; } = new ForcePerLength((T)0, BaseUnit); + public static ForcePerLength Zero { get; } = new ForcePerLength(default(T), BaseUnit); #endregion @@ -175,6 +176,29 @@ public ForcePerLength(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ForcePerLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ForcePerLength.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ForcePerLength.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -768,7 +792,7 @@ public static ForcePerLength Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ForcePerLength Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ForcePerLengthUnit>( + return QuantityParser.Default.Parse, ForcePerLengthUnit>( str, provider, From); @@ -799,7 +823,7 @@ public static bool TryParse(string? str, out ForcePerLength result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ForcePerLength result) { - return QuantityParser.Default.TryParse, ForcePerLengthUnit>( + return QuantityParser.Default.TryParse, ForcePerLengthUnit>( str, provider, From, @@ -1021,10 +1045,10 @@ public bool Equals(ForcePerLength other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ForcePerLength other, double tolerance, ComparisonType comparisonType) + public bool Equals(ForcePerLength other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs index 2c67e21847..89f35f7caf 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// The number of occurrences of a repeating event per unit time. /// public partial struct Frequency : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -113,12 +114,12 @@ public Frequency(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Frequency MaxValue { get; } = new Frequency(double.MaxValue, BaseUnit); + public static Frequency MaxValue { get; } = new Frequency(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Frequency MinValue { get; } = new Frequency(double.MinValue, BaseUnit); + public static Frequency MinValue { get; } = new Frequency(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -134,7 +135,7 @@ public Frequency(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Hertz. /// - public static Frequency Zero { get; } = new Frequency((T)0, BaseUnit); + public static Frequency Zero { get; } = new Frequency(default(T), BaseUnit); #endregion @@ -147,6 +148,29 @@ public Frequency(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public FrequencyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Frequency.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Frequency.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -376,7 +400,7 @@ public static Frequency Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Frequency Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, FrequencyUnit>( + return QuantityParser.Default.Parse, FrequencyUnit>( str, provider, From); @@ -407,7 +431,7 @@ public static bool TryParse(string? str, out Frequency result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Frequency result) { - return QuantityParser.Default.TryParse, FrequencyUnit>( + return QuantityParser.Default.TryParse, FrequencyUnit>( str, provider, From, @@ -629,10 +653,10 @@ public bool Equals(Frequency other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Frequency other, double tolerance, ComparisonType comparisonType) + public bool Equals(Frequency other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs index 542dae00bc..400abd8649 100644 --- a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Fuel_efficiency /// public partial struct FuelEfficiency : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -110,12 +111,12 @@ public FuelEfficiency(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static FuelEfficiency MaxValue { get; } = new FuelEfficiency(double.MaxValue, BaseUnit); + public static FuelEfficiency MaxValue { get; } = new FuelEfficiency(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static FuelEfficiency MinValue { get; } = new FuelEfficiency(double.MinValue, BaseUnit); + public static FuelEfficiency MinValue { get; } = new FuelEfficiency(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -131,7 +132,7 @@ public FuelEfficiency(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit LiterPer100Kilometers. /// - public static FuelEfficiency Zero { get; } = new FuelEfficiency((T)0, BaseUnit); + public static FuelEfficiency Zero { get; } = new FuelEfficiency(default(T), BaseUnit); #endregion @@ -144,6 +145,29 @@ public FuelEfficiency(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public FuelEfficiencyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => FuelEfficiency.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => FuelEfficiency.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -295,7 +319,7 @@ public static FuelEfficiency Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static FuelEfficiency Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, FuelEfficiencyUnit>( + return QuantityParser.Default.Parse, FuelEfficiencyUnit>( str, provider, From); @@ -326,7 +350,7 @@ public static bool TryParse(string? str, out FuelEfficiency result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out FuelEfficiency result) { - return QuantityParser.Default.TryParse, FuelEfficiencyUnit>( + return QuantityParser.Default.TryParse, FuelEfficiencyUnit>( str, provider, From, @@ -548,10 +572,10 @@ public bool Equals(FuelEfficiency other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(FuelEfficiency other, double tolerance, ComparisonType comparisonType) + public bool Equals(FuelEfficiency other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs index 2665f9cb4b..aa1c0d7d34 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Heat flux is the flow of energy per unit of area per unit of time /// public partial struct HeatFlux : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -121,12 +122,12 @@ public HeatFlux(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static HeatFlux MaxValue { get; } = new HeatFlux(double.MaxValue, BaseUnit); + public static HeatFlux MaxValue { get; } = new HeatFlux(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static HeatFlux MinValue { get; } = new HeatFlux(double.MinValue, BaseUnit); + public static HeatFlux MinValue { get; } = new HeatFlux(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -142,7 +143,7 @@ public HeatFlux(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeter. /// - public static HeatFlux Zero { get; } = new HeatFlux((T)0, BaseUnit); + public static HeatFlux Zero { get; } = new HeatFlux(default(T), BaseUnit); #endregion @@ -155,6 +156,29 @@ public HeatFlux(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public HeatFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => HeatFlux.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => HeatFlux.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -488,7 +512,7 @@ public static HeatFlux Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static HeatFlux Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, HeatFluxUnit>( + return QuantityParser.Default.Parse, HeatFluxUnit>( str, provider, From); @@ -519,7 +543,7 @@ public static bool TryParse(string? str, out HeatFlux result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out HeatFlux result) { - return QuantityParser.Default.TryParse, HeatFluxUnit>( + return QuantityParser.Default.TryParse, HeatFluxUnit>( str, provider, From, @@ -741,10 +765,10 @@ public bool Equals(HeatFlux other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(HeatFlux other, double tolerance, ComparisonType comparisonType) + public bool Equals(HeatFlux other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs index 9e5ea2701b..82b2a9167c 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// The heat transfer coefficient or film coefficient, or film effectiveness, in thermodynamics and in mechanics is the proportionality constant between the heat flux and the thermodynamic driving force for the flow of heat (i.e., the temperature difference, ΔT) /// public partial struct HeatTransferCoefficient : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -106,12 +107,12 @@ public HeatTransferCoefficient(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static HeatTransferCoefficient MaxValue { get; } = new HeatTransferCoefficient(double.MaxValue, BaseUnit); + public static HeatTransferCoefficient MaxValue { get; } = new HeatTransferCoefficient(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static HeatTransferCoefficient MinValue { get; } = new HeatTransferCoefficient(double.MinValue, BaseUnit); + public static HeatTransferCoefficient MinValue { get; } = new HeatTransferCoefficient(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -127,7 +128,7 @@ public HeatTransferCoefficient(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeterKelvin. /// - public static HeatTransferCoefficient Zero { get; } = new HeatTransferCoefficient((T)0, BaseUnit); + public static HeatTransferCoefficient Zero { get; } = new HeatTransferCoefficient(default(T), BaseUnit); #endregion @@ -140,6 +141,29 @@ public HeatTransferCoefficient(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public HeatTransferCoefficientUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => HeatTransferCoefficient.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => HeatTransferCoefficient.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -278,7 +302,7 @@ public static HeatTransferCoefficient Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static HeatTransferCoefficient Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, HeatTransferCoefficientUnit>( + return QuantityParser.Default.Parse, HeatTransferCoefficientUnit>( str, provider, From); @@ -309,7 +333,7 @@ public static bool TryParse(string? str, out HeatTransferCoefficient result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out HeatTransferCoefficient result) { - return QuantityParser.Default.TryParse, HeatTransferCoefficientUnit>( + return QuantityParser.Default.TryParse, HeatTransferCoefficientUnit>( str, provider, From, @@ -531,10 +555,10 @@ public bool Equals(HeatTransferCoefficient other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(HeatTransferCoefficient other, double tolerance, ComparisonType comparisonType) + public bool Equals(HeatTransferCoefficient other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs index c3996b8387..173ce2d00e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Illuminance /// public partial struct Illuminance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -110,12 +111,12 @@ public Illuminance(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Illuminance MaxValue { get; } = new Illuminance(double.MaxValue, BaseUnit); + public static Illuminance MaxValue { get; } = new Illuminance(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Illuminance MinValue { get; } = new Illuminance(double.MinValue, BaseUnit); + public static Illuminance MinValue { get; } = new Illuminance(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -131,7 +132,7 @@ public Illuminance(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Lux. /// - public static Illuminance Zero { get; } = new Illuminance((T)0, BaseUnit); + public static Illuminance Zero { get; } = new Illuminance(default(T), BaseUnit); #endregion @@ -144,6 +145,29 @@ public Illuminance(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public IlluminanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Illuminance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Illuminance.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -295,7 +319,7 @@ public static Illuminance Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Illuminance Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, IlluminanceUnit>( + return QuantityParser.Default.Parse, IlluminanceUnit>( str, provider, From); @@ -326,7 +350,7 @@ public static bool TryParse(string? str, out Illuminance result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Illuminance result) { - return QuantityParser.Default.TryParse, IlluminanceUnit>( + return QuantityParser.Default.TryParse, IlluminanceUnit>( str, provider, From, @@ -548,10 +572,10 @@ public bool Equals(Illuminance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Illuminance other, double tolerance, ComparisonType comparisonType) + public bool Equals(Illuminance other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Information.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.g.cs index 8703e968b9..ed36442f96 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// In computing and telecommunications, a unit of information is the capacity of some standard data storage system or communication channel, used to measure the capacities of other systems and channels. In information theory, units of information are also used to measure the information contents or entropy of random variables. /// public partial struct Information : IQuantityT, IDecimalQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -129,12 +130,12 @@ public Information(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Information MaxValue { get; } = new Information(decimal.MaxValue, BaseUnit); + public static Information MaxValue { get; } = new Information(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Information MinValue { get; } = new Information(decimal.MinValue, BaseUnit); + public static Information MinValue { get; } = new Information(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -150,7 +151,7 @@ public Information(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Bit. /// - public static Information Zero { get; } = new Information((T)0, BaseUnit); + public static Information Zero { get; } = new Information(default(T), BaseUnit); #endregion @@ -169,10 +170,10 @@ public Information(T value, UnitSystem unitSystem) Enum IQuantity.Unit => Unit; /// - public {_unitEnumName} Unit => _unit.GetValueOrDefault(BaseUnit); + public InformationUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// - public QuantityInfo<{_unitEnumName}> QuantityInfo => Info; + public QuantityInfo QuantityInfo => Info; /// QuantityInfo IQuantity.QuantityInfo => Info; @@ -180,12 +181,12 @@ public Information(T value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => {_quantity.Name}.QuantityType; + public QuantityType Type => Information.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => {_quantity.Name}.BaseDimensions; + public BaseDimensions Dimensions => Information.BaseDimensions; #endregion @@ -626,7 +627,7 @@ public static Information Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Information Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, InformationUnit>( + return QuantityParser.Default.Parse, InformationUnit>( str, provider, From); @@ -657,7 +658,7 @@ public static bool TryParse(string? str, out Information result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Information result) { - return QuantityParser.Default.TryParse, InformationUnit>( + return QuantityParser.Default.TryParse, InformationUnit>( str, provider, From, @@ -879,10 +880,10 @@ public bool Equals(Information other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Information other, double tolerance, ComparisonType comparisonType) + public bool Equals(Information other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs index 231f8b676d..6a2af8311d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Irradiance is the intensity of ultraviolet (UV) or visible light incident on a surface. /// public partial struct Irradiance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -117,12 +118,12 @@ public Irradiance(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Irradiance MaxValue { get; } = new Irradiance(double.MaxValue, BaseUnit); + public static Irradiance MaxValue { get; } = new Irradiance(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Irradiance MinValue { get; } = new Irradiance(double.MinValue, BaseUnit); + public static Irradiance MinValue { get; } = new Irradiance(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -138,7 +139,7 @@ public Irradiance(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeter. /// - public static Irradiance Zero { get; } = new Irradiance((T)0, BaseUnit); + public static Irradiance Zero { get; } = new Irradiance(default(T), BaseUnit); #endregion @@ -151,6 +152,29 @@ public Irradiance(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public IrradianceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Irradiance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Irradiance.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -432,7 +456,7 @@ public static Irradiance Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Irradiance Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, IrradianceUnit>( + return QuantityParser.Default.Parse, IrradianceUnit>( str, provider, From); @@ -463,7 +487,7 @@ public static bool TryParse(string? str, out Irradiance result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Irradiance result) { - return QuantityParser.Default.TryParse, IrradianceUnit>( + return QuantityParser.Default.TryParse, IrradianceUnit>( str, provider, From, @@ -685,10 +709,10 @@ public bool Equals(Irradiance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Irradiance other, double tolerance, ComparisonType comparisonType) + public bool Equals(Irradiance other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs index bb1a899b61..fd28f61827 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Irradiation /// public partial struct Irradiation : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -113,12 +114,12 @@ public Irradiation(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Irradiation MaxValue { get; } = new Irradiation(double.MaxValue, BaseUnit); + public static Irradiation MaxValue { get; } = new Irradiation(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Irradiation MinValue { get; } = new Irradiation(double.MinValue, BaseUnit); + public static Irradiation MinValue { get; } = new Irradiation(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -134,7 +135,7 @@ public Irradiation(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerSquareMeter. /// - public static Irradiation Zero { get; } = new Irradiation((T)0, BaseUnit); + public static Irradiation Zero { get; } = new Irradiation(default(T), BaseUnit); #endregion @@ -147,6 +148,29 @@ public Irradiation(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public IrradiationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Irradiation.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Irradiation.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -337,7 +361,7 @@ public static Irradiation Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Irradiation Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, IrradiationUnit>( + return QuantityParser.Default.Parse, IrradiationUnit>( str, provider, From); @@ -368,7 +392,7 @@ public static bool TryParse(string? str, out Irradiation result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Irradiation result) { - return QuantityParser.Default.TryParse, IrradiationUnit>( + return QuantityParser.Default.TryParse, IrradiationUnit>( str, provider, From, @@ -590,10 +614,10 @@ public bool Equals(Irradiation other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Irradiation other, double tolerance, ComparisonType comparisonType) + public bool Equals(Irradiation other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs index 625c0391cc..1dc9580e8f 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// http://en.wikipedia.org/wiki/Viscosity /// public partial struct KinematicViscosity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -114,12 +115,12 @@ public KinematicViscosity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static KinematicViscosity MaxValue { get; } = new KinematicViscosity(double.MaxValue, BaseUnit); + public static KinematicViscosity MaxValue { get; } = new KinematicViscosity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static KinematicViscosity MinValue { get; } = new KinematicViscosity(double.MinValue, BaseUnit); + public static KinematicViscosity MinValue { get; } = new KinematicViscosity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -135,7 +136,7 @@ public KinematicViscosity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeterPerSecond. /// - public static KinematicViscosity Zero { get; } = new KinematicViscosity((T)0, BaseUnit); + public static KinematicViscosity Zero { get; } = new KinematicViscosity(default(T), BaseUnit); #endregion @@ -148,6 +149,29 @@ public KinematicViscosity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public KinematicViscosityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => KinematicViscosity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => KinematicViscosity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -351,7 +375,7 @@ public static KinematicViscosity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static KinematicViscosity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, KinematicViscosityUnit>( + return QuantityParser.Default.Parse, KinematicViscosityUnit>( str, provider, From); @@ -382,7 +406,7 @@ public static bool TryParse(string? str, out KinematicViscosity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out KinematicViscosity result) { - return QuantityParser.Default.TryParse, KinematicViscosityUnit>( + return QuantityParser.Default.TryParse, KinematicViscosityUnit>( str, provider, From, @@ -604,10 +628,10 @@ public bool Equals(KinematicViscosity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(KinematicViscosity other, double tolerance, ComparisonType comparisonType) + public bool Equals(KinematicViscosity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs index af7c4d5fb5..d515870961 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Lapse rate is the rate at which Earth's atmospheric temperature decreases with an increase in altitude, or increases with the decrease in altitude. /// public partial struct LapseRate : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -104,12 +105,12 @@ public LapseRate(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static LapseRate MaxValue { get; } = new LapseRate(double.MaxValue, BaseUnit); + public static LapseRate MaxValue { get; } = new LapseRate(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static LapseRate MinValue { get; } = new LapseRate(double.MinValue, BaseUnit); + public static LapseRate MinValue { get; } = new LapseRate(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -125,7 +126,7 @@ public LapseRate(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit DegreeCelsiusPerKilometer. /// - public static LapseRate Zero { get; } = new LapseRate((T)0, BaseUnit); + public static LapseRate Zero { get; } = new LapseRate(default(T), BaseUnit); #endregion @@ -138,6 +139,29 @@ public LapseRate(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public LapseRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => LapseRate.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => LapseRate.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -250,7 +274,7 @@ public static LapseRate Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static LapseRate Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, LapseRateUnit>( + return QuantityParser.Default.Parse, LapseRateUnit>( str, provider, From); @@ -281,7 +305,7 @@ public static bool TryParse(string? str, out LapseRate result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out LapseRate result) { - return QuantityParser.Default.TryParse, LapseRateUnit>( + return QuantityParser.Default.TryParse, LapseRateUnit>( str, provider, From, @@ -503,10 +527,10 @@ public bool Equals(LapseRate other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(LapseRate other, double tolerance, ComparisonType comparisonType) + public bool Equals(LapseRate other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs index 588eb24ced..8b2935484c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Many different units of length have been used around the world. The main units in modern use are U.S. customary units in the United States and the Metric system elsewhere. British Imperial units are still used for some purposes in the United Kingdom and some other countries. The metric system is sub-divided into SI and non-SI units. /// public partial struct Length : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -136,12 +137,12 @@ public Length(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Length MaxValue { get; } = new Length(double.MaxValue, BaseUnit); + public static Length MaxValue { get; } = new Length(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Length MinValue { get; } = new Length(double.MinValue, BaseUnit); + public static Length MinValue { get; } = new Length(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -157,7 +158,7 @@ public Length(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Meter. /// - public static Length Zero { get; } = new Length((T)0, BaseUnit); + public static Length Zero { get; } = new Length(default(T), BaseUnit); #endregion @@ -170,6 +171,29 @@ public Length(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public LengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Length.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Length.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -698,7 +722,7 @@ public static Length Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Length Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, LengthUnit>( + return QuantityParser.Default.Parse, LengthUnit>( str, provider, From); @@ -729,7 +753,7 @@ public static bool TryParse(string? str, out Length result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Length result) { - return QuantityParser.Default.TryParse, LengthUnit>( + return QuantityParser.Default.TryParse, LengthUnit>( str, provider, From, @@ -951,10 +975,10 @@ public bool Equals(Length other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Length other, double tolerance, ComparisonType comparisonType) + public bool Equals(Length other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Level.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.g.cs index 9ab4ab7eef..ab07afb04e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Level is the logarithm of the ratio of a quantity Q to a reference value of that quantity, Q₀, expressed in dimensionless units. /// public partial struct Level : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -105,12 +106,12 @@ public Level(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Level MaxValue { get; } = new Level(double.MaxValue, BaseUnit); + public static Level MaxValue { get; } = new Level(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Level MinValue { get; } = new Level(double.MinValue, BaseUnit); + public static Level MinValue { get; } = new Level(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -126,7 +127,7 @@ public Level(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Decibel. /// - public static Level Zero { get; } = new Level((T)0, BaseUnit); + public static Level Zero { get; } = new Level(default(T), BaseUnit); #endregion @@ -139,6 +140,29 @@ public Level(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public LevelUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Level.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Level.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -264,7 +288,7 @@ public static Level Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Level Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, LevelUnit>( + return QuantityParser.Default.Parse, LevelUnit>( str, provider, From); @@ -295,7 +319,7 @@ public static bool TryParse(string? str, out Level result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Level result) { - return QuantityParser.Default.TryParse, LevelUnit>( + return QuantityParser.Default.TryParse, LevelUnit>( str, provider, From, @@ -520,10 +544,10 @@ public bool Equals(Level other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Level other, double tolerance, ComparisonType comparisonType) + public bool Equals(Level other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs index bc4196f81f..54e336300c 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// http://en.wikipedia.org/wiki/Linear_density /// public partial struct LinearDensity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -120,12 +121,12 @@ public LinearDensity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static LinearDensity MaxValue { get; } = new LinearDensity(double.MaxValue, BaseUnit); + public static LinearDensity MaxValue { get; } = new LinearDensity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static LinearDensity MinValue { get; } = new LinearDensity(double.MinValue, BaseUnit); + public static LinearDensity MinValue { get; } = new LinearDensity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -141,7 +142,7 @@ public LinearDensity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerMeter. /// - public static LinearDensity Zero { get; } = new LinearDensity((T)0, BaseUnit); + public static LinearDensity Zero { get; } = new LinearDensity(default(T), BaseUnit); #endregion @@ -154,6 +155,29 @@ public LinearDensity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public LinearDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => LinearDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => LinearDensity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -435,7 +459,7 @@ public static LinearDensity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static LinearDensity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, LinearDensityUnit>( + return QuantityParser.Default.Parse, LinearDensityUnit>( str, provider, From); @@ -466,7 +490,7 @@ public static bool TryParse(string? str, out LinearDensity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out LinearDensity result) { - return QuantityParser.Default.TryParse, LinearDensityUnit>( + return QuantityParser.Default.TryParse, LinearDensityUnit>( str, provider, From, @@ -688,10 +712,10 @@ public bool Equals(LinearDensity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(LinearDensity other, double tolerance, ComparisonType comparisonType) + public bool Equals(LinearDensity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs index de8c95574c..bf32b2e9f0 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// http://en.wikipedia.org/wiki/Linear_density /// public partial struct LinearPowerDensity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -131,12 +132,12 @@ public LinearPowerDensity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static LinearPowerDensity MaxValue { get; } = new LinearPowerDensity(double.MaxValue, BaseUnit); + public static LinearPowerDensity MaxValue { get; } = new LinearPowerDensity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static LinearPowerDensity MinValue { get; } = new LinearPowerDensity(double.MinValue, BaseUnit); + public static LinearPowerDensity MinValue { get; } = new LinearPowerDensity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -152,7 +153,7 @@ public LinearPowerDensity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit WattPerMeter. /// - public static LinearPowerDensity Zero { get; } = new LinearPowerDensity((T)0, BaseUnit); + public static LinearPowerDensity Zero { get; } = new LinearPowerDensity(default(T), BaseUnit); #endregion @@ -165,6 +166,29 @@ public LinearPowerDensity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public LinearPowerDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => LinearPowerDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => LinearPowerDensity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -589,7 +613,7 @@ public static LinearPowerDensity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static LinearPowerDensity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, LinearPowerDensityUnit>( + return QuantityParser.Default.Parse, LinearPowerDensityUnit>( str, provider, From); @@ -620,7 +644,7 @@ public static bool TryParse(string? str, out LinearPowerDensity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out LinearPowerDensity result) { - return QuantityParser.Default.TryParse, LinearPowerDensityUnit>( + return QuantityParser.Default.TryParse, LinearPowerDensityUnit>( str, provider, From, @@ -842,10 +866,10 @@ public bool Equals(LinearPowerDensity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(LinearPowerDensity other, double tolerance, ComparisonType comparisonType) + public bool Equals(LinearPowerDensity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs index 71bef91913..425e2bdb86 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Luminosity /// public partial struct Luminosity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -120,12 +121,12 @@ public Luminosity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Luminosity MaxValue { get; } = new Luminosity(double.MaxValue, BaseUnit); + public static Luminosity MaxValue { get; } = new Luminosity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Luminosity MinValue { get; } = new Luminosity(double.MinValue, BaseUnit); + public static Luminosity MinValue { get; } = new Luminosity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -141,7 +142,7 @@ public Luminosity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Watt. /// - public static Luminosity Zero { get; } = new Luminosity((T)0, BaseUnit); + public static Luminosity Zero { get; } = new Luminosity(default(T), BaseUnit); #endregion @@ -154,6 +155,29 @@ public Luminosity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public LuminosityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Luminosity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Luminosity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -435,7 +459,7 @@ public static Luminosity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Luminosity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, LuminosityUnit>( + return QuantityParser.Default.Parse, LuminosityUnit>( str, provider, From); @@ -466,7 +490,7 @@ public static bool TryParse(string? str, out Luminosity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Luminosity result) { - return QuantityParser.Default.TryParse, LuminosityUnit>( + return QuantityParser.Default.TryParse, LuminosityUnit>( str, provider, From, @@ -688,10 +712,10 @@ public bool Equals(Luminosity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Luminosity other, double tolerance, ComparisonType comparisonType) + public bool Equals(Luminosity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs index 934b36bef4..616789000d 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Luminous_flux /// public partial struct LuminousFlux : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -107,12 +108,12 @@ public LuminousFlux(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static LuminousFlux MaxValue { get; } = new LuminousFlux(double.MaxValue, BaseUnit); + public static LuminousFlux MaxValue { get; } = new LuminousFlux(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static LuminousFlux MinValue { get; } = new LuminousFlux(double.MinValue, BaseUnit); + public static LuminousFlux MinValue { get; } = new LuminousFlux(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,7 +129,7 @@ public LuminousFlux(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Lumen. /// - public static LuminousFlux Zero { get; } = new LuminousFlux((T)0, BaseUnit); + public static LuminousFlux Zero { get; } = new LuminousFlux(default(T), BaseUnit); #endregion @@ -141,6 +142,29 @@ public LuminousFlux(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public LuminousFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => LuminousFlux.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => LuminousFlux.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -253,7 +277,7 @@ public static LuminousFlux Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static LuminousFlux Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, LuminousFluxUnit>( + return QuantityParser.Default.Parse, LuminousFluxUnit>( str, provider, From); @@ -284,7 +308,7 @@ public static bool TryParse(string? str, out LuminousFlux result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out LuminousFlux result) { - return QuantityParser.Default.TryParse, LuminousFluxUnit>( + return QuantityParser.Default.TryParse, LuminousFluxUnit>( str, provider, From, @@ -506,10 +530,10 @@ public bool Equals(LuminousFlux other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(LuminousFlux other, double tolerance, ComparisonType comparisonType) + public bool Equals(LuminousFlux other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs index c092a85537..0fb31ea991 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Luminous_intensity /// public partial struct LuminousIntensity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -107,12 +108,12 @@ public LuminousIntensity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static LuminousIntensity MaxValue { get; } = new LuminousIntensity(double.MaxValue, BaseUnit); + public static LuminousIntensity MaxValue { get; } = new LuminousIntensity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static LuminousIntensity MinValue { get; } = new LuminousIntensity(double.MinValue, BaseUnit); + public static LuminousIntensity MinValue { get; } = new LuminousIntensity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,7 +129,7 @@ public LuminousIntensity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Candela. /// - public static LuminousIntensity Zero { get; } = new LuminousIntensity((T)0, BaseUnit); + public static LuminousIntensity Zero { get; } = new LuminousIntensity(default(T), BaseUnit); #endregion @@ -141,6 +142,29 @@ public LuminousIntensity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public LuminousIntensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => LuminousIntensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => LuminousIntensity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -253,7 +277,7 @@ public static LuminousIntensity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static LuminousIntensity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, LuminousIntensityUnit>( + return QuantityParser.Default.Parse, LuminousIntensityUnit>( str, provider, From); @@ -284,7 +308,7 @@ public static bool TryParse(string? str, out LuminousIntensity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out LuminousIntensity result) { - return QuantityParser.Default.TryParse, LuminousIntensityUnit>( + return QuantityParser.Default.TryParse, LuminousIntensityUnit>( str, provider, From, @@ -506,10 +530,10 @@ public bool Equals(LuminousIntensity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(LuminousIntensity other, double tolerance, ComparisonType comparisonType) + public bool Equals(LuminousIntensity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs index b71daf034c..31b1a0f28f 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Magnetic_field /// public partial struct MagneticField : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -111,12 +112,12 @@ public MagneticField(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static MagneticField MaxValue { get; } = new MagneticField(double.MaxValue, BaseUnit); + public static MagneticField MaxValue { get; } = new MagneticField(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static MagneticField MinValue { get; } = new MagneticField(double.MinValue, BaseUnit); + public static MagneticField MinValue { get; } = new MagneticField(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -132,7 +133,7 @@ public MagneticField(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Tesla. /// - public static MagneticField Zero { get; } = new MagneticField((T)0, BaseUnit); + public static MagneticField Zero { get; } = new MagneticField(default(T), BaseUnit); #endregion @@ -145,6 +146,29 @@ public MagneticField(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public MagneticFieldUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => MagneticField.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MagneticField.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -309,7 +333,7 @@ public static MagneticField Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static MagneticField Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, MagneticFieldUnit>( + return QuantityParser.Default.Parse, MagneticFieldUnit>( str, provider, From); @@ -340,7 +364,7 @@ public static bool TryParse(string? str, out MagneticField result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out MagneticField result) { - return QuantityParser.Default.TryParse, MagneticFieldUnit>( + return QuantityParser.Default.TryParse, MagneticFieldUnit>( str, provider, From, @@ -562,10 +586,10 @@ public bool Equals(MagneticField other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MagneticField other, double tolerance, ComparisonType comparisonType) + public bool Equals(MagneticField other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs index 98f4b09633..018672c2cd 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Magnetic_flux /// public partial struct MagneticFlux : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -107,12 +108,12 @@ public MagneticFlux(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static MagneticFlux MaxValue { get; } = new MagneticFlux(double.MaxValue, BaseUnit); + public static MagneticFlux MaxValue { get; } = new MagneticFlux(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static MagneticFlux MinValue { get; } = new MagneticFlux(double.MinValue, BaseUnit); + public static MagneticFlux MinValue { get; } = new MagneticFlux(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,7 +129,7 @@ public MagneticFlux(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Weber. /// - public static MagneticFlux Zero { get; } = new MagneticFlux((T)0, BaseUnit); + public static MagneticFlux Zero { get; } = new MagneticFlux(default(T), BaseUnit); #endregion @@ -141,6 +142,29 @@ public MagneticFlux(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public MagneticFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => MagneticFlux.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MagneticFlux.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -253,7 +277,7 @@ public static MagneticFlux Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static MagneticFlux Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, MagneticFluxUnit>( + return QuantityParser.Default.Parse, MagneticFluxUnit>( str, provider, From); @@ -284,7 +308,7 @@ public static bool TryParse(string? str, out MagneticFlux result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out MagneticFlux result) { - return QuantityParser.Default.TryParse, MagneticFluxUnit>( + return QuantityParser.Default.TryParse, MagneticFluxUnit>( str, provider, From, @@ -506,10 +530,10 @@ public bool Equals(MagneticFlux other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MagneticFlux other, double tolerance, ComparisonType comparisonType) + public bool Equals(MagneticFlux other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs index d7af3e1a22..8a124dc347 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Magnetization /// public partial struct Magnetization : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -107,12 +108,12 @@ public Magnetization(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Magnetization MaxValue { get; } = new Magnetization(double.MaxValue, BaseUnit); + public static Magnetization MaxValue { get; } = new Magnetization(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Magnetization MinValue { get; } = new Magnetization(double.MinValue, BaseUnit); + public static Magnetization MinValue { get; } = new Magnetization(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,7 +129,7 @@ public Magnetization(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerMeter. /// - public static Magnetization Zero { get; } = new Magnetization((T)0, BaseUnit); + public static Magnetization Zero { get; } = new Magnetization(default(T), BaseUnit); #endregion @@ -141,6 +142,29 @@ public Magnetization(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public MagnetizationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Magnetization.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Magnetization.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -253,7 +277,7 @@ public static Magnetization Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Magnetization Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, MagnetizationUnit>( + return QuantityParser.Default.Parse, MagnetizationUnit>( str, provider, From); @@ -284,7 +308,7 @@ public static bool TryParse(string? str, out Magnetization result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Magnetization result) { - return QuantityParser.Default.TryParse, MagnetizationUnit>( + return QuantityParser.Default.TryParse, MagnetizationUnit>( str, provider, From, @@ -506,10 +530,10 @@ public bool Equals(Magnetization other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Magnetization other, double tolerance, ComparisonType comparisonType) + public bool Equals(Magnetization other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs index 6962b3e496..d0a48a4737 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// In physics, mass (from Greek μᾶζα "barley cake, lump [of dough]") is a property of a physical system or body, giving rise to the phenomena of the body's resistance to being accelerated by a force and the strength of its mutual gravitational attraction with other bodies. Instruments such as mass balances or scales use those phenomena to measure mass. The SI unit of mass is the kilogram (kg). /// public partial struct Mass : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -128,12 +129,12 @@ public Mass(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Mass MaxValue { get; } = new Mass(double.MaxValue, BaseUnit); + public static Mass MaxValue { get; } = new Mass(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Mass MinValue { get; } = new Mass(double.MinValue, BaseUnit); + public static Mass MinValue { get; } = new Mass(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -149,7 +150,7 @@ public Mass(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Kilogram. /// - public static Mass Zero { get; } = new Mass((T)0, BaseUnit); + public static Mass Zero { get; } = new Mass(default(T), BaseUnit); #endregion @@ -162,6 +163,29 @@ public Mass(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public MassUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Mass.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Mass.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -586,7 +610,7 @@ public static Mass Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Mass Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, MassUnit>( + return QuantityParser.Default.Parse, MassUnit>( str, provider, From); @@ -617,7 +641,7 @@ public static bool TryParse(string? str, out Mass result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Mass result) { - return QuantityParser.Default.TryParse, MassUnit>( + return QuantityParser.Default.TryParse, MassUnit>( str, provider, From, @@ -839,10 +863,10 @@ public bool Equals(Mass other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Mass other, double tolerance, ComparisonType comparisonType) + public bool Equals(Mass other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs index a07c90dd82..9a1a8a53ef 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Mass_concentration_(chemistry) /// public partial struct MassConcentration : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -153,12 +154,12 @@ public MassConcentration(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static MassConcentration MaxValue { get; } = new MassConcentration(double.MaxValue, BaseUnit); + public static MassConcentration MaxValue { get; } = new MassConcentration(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static MassConcentration MinValue { get; } = new MassConcentration(double.MinValue, BaseUnit); + public static MassConcentration MinValue { get; } = new MassConcentration(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -174,7 +175,7 @@ public MassConcentration(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerCubicMeter. /// - public static MassConcentration Zero { get; } = new MassConcentration((T)0, BaseUnit); + public static MassConcentration Zero { get; } = new MassConcentration(default(T), BaseUnit); #endregion @@ -187,6 +188,29 @@ public MassConcentration(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public MassConcentrationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => MassConcentration.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MassConcentration.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -897,7 +921,7 @@ public static MassConcentration Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static MassConcentration Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, MassConcentrationUnit>( + return QuantityParser.Default.Parse, MassConcentrationUnit>( str, provider, From); @@ -928,7 +952,7 @@ public static bool TryParse(string? str, out MassConcentration result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out MassConcentration result) { - return QuantityParser.Default.TryParse, MassConcentrationUnit>( + return QuantityParser.Default.TryParse, MassConcentrationUnit>( str, provider, From, @@ -1150,10 +1174,10 @@ public bool Equals(MassConcentration other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MassConcentration other, double tolerance, ComparisonType comparisonType) + public bool Equals(MassConcentration other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs index 15dbe616f4..9205b8bfae 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Mass flow is the ratio of the mass change to the time during which the change occurred (value of mass changes per unit time). /// public partial struct MassFlow : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -136,12 +137,12 @@ public MassFlow(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static MassFlow MaxValue { get; } = new MassFlow(double.MaxValue, BaseUnit); + public static MassFlow MaxValue { get; } = new MassFlow(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static MassFlow MinValue { get; } = new MassFlow(double.MinValue, BaseUnit); + public static MassFlow MinValue { get; } = new MassFlow(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -157,7 +158,7 @@ public MassFlow(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit GramPerSecond. /// - public static MassFlow Zero { get; } = new MassFlow((T)0, BaseUnit); + public static MassFlow Zero { get; } = new MassFlow(default(T), BaseUnit); #endregion @@ -170,6 +171,29 @@ public MassFlow(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public MassFlowUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => MassFlow.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MassFlow.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -698,7 +722,7 @@ public static MassFlow Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static MassFlow Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, MassFlowUnit>( + return QuantityParser.Default.Parse, MassFlowUnit>( str, provider, From); @@ -729,7 +753,7 @@ public static bool TryParse(string? str, out MassFlow result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out MassFlow result) { - return QuantityParser.Default.TryParse, MassFlowUnit>( + return QuantityParser.Default.TryParse, MassFlowUnit>( str, provider, From, @@ -951,10 +975,10 @@ public bool Equals(MassFlow other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MassFlow other, double tolerance, ComparisonType comparisonType) + public bool Equals(MassFlow other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs index 1d1026b330..6da10643b6 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Mass flux is the mass flow rate per unit area. /// public partial struct MassFlux : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -115,12 +116,12 @@ public MassFlux(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static MassFlux MaxValue { get; } = new MassFlux(double.MaxValue, BaseUnit); + public static MassFlux MaxValue { get; } = new MassFlux(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static MassFlux MinValue { get; } = new MassFlux(double.MinValue, BaseUnit); + public static MassFlux MinValue { get; } = new MassFlux(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -136,7 +137,7 @@ public MassFlux(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerSecondPerSquareMeter. /// - public static MassFlux Zero { get; } = new MassFlux((T)0, BaseUnit); + public static MassFlux Zero { get; } = new MassFlux(default(T), BaseUnit); #endregion @@ -149,6 +150,29 @@ public MassFlux(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public MassFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => MassFlux.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MassFlux.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -404,7 +428,7 @@ public static MassFlux Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static MassFlux Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, MassFluxUnit>( + return QuantityParser.Default.Parse, MassFluxUnit>( str, provider, From); @@ -435,7 +459,7 @@ public static bool TryParse(string? str, out MassFlux result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out MassFlux result) { - return QuantityParser.Default.TryParse, MassFluxUnit>( + return QuantityParser.Default.TryParse, MassFluxUnit>( str, provider, From, @@ -657,10 +681,10 @@ public bool Equals(MassFlux other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MassFlux other, double tolerance, ComparisonType comparisonType) + public bool Equals(MassFlux other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs index 0cad63800f..6043a2ce57 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Mass_fraction_(chemistry) /// public partial struct MassFraction : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -130,12 +131,12 @@ public MassFraction(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static MassFraction MaxValue { get; } = new MassFraction(double.MaxValue, BaseUnit); + public static MassFraction MaxValue { get; } = new MassFraction(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static MassFraction MinValue { get; } = new MassFraction(double.MinValue, BaseUnit); + public static MassFraction MinValue { get; } = new MassFraction(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -151,7 +152,7 @@ public MassFraction(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit DecimalFraction. /// - public static MassFraction Zero { get; } = new MassFraction((T)0, BaseUnit); + public static MassFraction Zero { get; } = new MassFraction(default(T), BaseUnit); #endregion @@ -164,6 +165,29 @@ public MassFraction(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public MassFractionUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => MassFraction.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MassFraction.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -575,7 +599,7 @@ public static MassFraction Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static MassFraction Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, MassFractionUnit>( + return QuantityParser.Default.Parse, MassFractionUnit>( str, provider, From); @@ -606,7 +630,7 @@ public static bool TryParse(string? str, out MassFraction result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out MassFraction result) { - return QuantityParser.Default.TryParse, MassFractionUnit>( + return QuantityParser.Default.TryParse, MassFractionUnit>( str, provider, From, @@ -828,10 +852,10 @@ public bool Equals(MassFraction other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MassFraction other, double tolerance, ComparisonType comparisonType) + public bool Equals(MassFraction other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs index 845a57ccc4..d9dfe22358 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// A property of body reflects how its mass is distributed with regard to an axis. /// public partial struct MassMomentOfInertia : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -131,12 +132,12 @@ public MassMomentOfInertia(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static MassMomentOfInertia MaxValue { get; } = new MassMomentOfInertia(double.MaxValue, BaseUnit); + public static MassMomentOfInertia MaxValue { get; } = new MassMomentOfInertia(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static MassMomentOfInertia MinValue { get; } = new MassMomentOfInertia(double.MinValue, BaseUnit); + public static MassMomentOfInertia MinValue { get; } = new MassMomentOfInertia(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -152,7 +153,7 @@ public MassMomentOfInertia(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramSquareMeter. /// - public static MassMomentOfInertia Zero { get; } = new MassMomentOfInertia((T)0, BaseUnit); + public static MassMomentOfInertia Zero { get; } = new MassMomentOfInertia(default(T), BaseUnit); #endregion @@ -165,6 +166,29 @@ public MassMomentOfInertia(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public MassMomentOfInertiaUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => MassMomentOfInertia.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MassMomentOfInertia.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -628,7 +652,7 @@ public static MassMomentOfInertia Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static MassMomentOfInertia Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, MassMomentOfInertiaUnit>( + return QuantityParser.Default.Parse, MassMomentOfInertiaUnit>( str, provider, From); @@ -659,7 +683,7 @@ public static bool TryParse(string? str, out MassMomentOfInertia result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out MassMomentOfInertia result) { - return QuantityParser.Default.TryParse, MassMomentOfInertiaUnit>( + return QuantityParser.Default.TryParse, MassMomentOfInertiaUnit>( str, provider, From, @@ -881,10 +905,10 @@ public bool Equals(MassMomentOfInertia other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MassMomentOfInertia other, double tolerance, ComparisonType comparisonType) + public bool Equals(MassMomentOfInertia other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs index 863bf5088e..12a4382fc3 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Molar energy is the amount of energy stored in 1 mole of a substance. /// public partial struct MolarEnergy : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -106,12 +107,12 @@ public MolarEnergy(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static MolarEnergy MaxValue { get; } = new MolarEnergy(double.MaxValue, BaseUnit); + public static MolarEnergy MaxValue { get; } = new MolarEnergy(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static MolarEnergy MinValue { get; } = new MolarEnergy(double.MinValue, BaseUnit); + public static MolarEnergy MinValue { get; } = new MolarEnergy(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -127,7 +128,7 @@ public MolarEnergy(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerMole. /// - public static MolarEnergy Zero { get; } = new MolarEnergy((T)0, BaseUnit); + public static MolarEnergy Zero { get; } = new MolarEnergy(default(T), BaseUnit); #endregion @@ -140,6 +141,29 @@ public MolarEnergy(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public MolarEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => MolarEnergy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MolarEnergy.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -278,7 +302,7 @@ public static MolarEnergy Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static MolarEnergy Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, MolarEnergyUnit>( + return QuantityParser.Default.Parse, MolarEnergyUnit>( str, provider, From); @@ -309,7 +333,7 @@ public static bool TryParse(string? str, out MolarEnergy result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out MolarEnergy result) { - return QuantityParser.Default.TryParse, MolarEnergyUnit>( + return QuantityParser.Default.TryParse, MolarEnergyUnit>( str, provider, From, @@ -531,10 +555,10 @@ public bool Equals(MolarEnergy other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MolarEnergy other, double tolerance, ComparisonType comparisonType) + public bool Equals(MolarEnergy other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs index 1279cffd22..80ed27c9b2 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Molar entropy is amount of energy required to increase temperature of 1 mole substance by 1 Kelvin. /// public partial struct MolarEntropy : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -106,12 +107,12 @@ public MolarEntropy(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static MolarEntropy MaxValue { get; } = new MolarEntropy(double.MaxValue, BaseUnit); + public static MolarEntropy MaxValue { get; } = new MolarEntropy(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static MolarEntropy MinValue { get; } = new MolarEntropy(double.MinValue, BaseUnit); + public static MolarEntropy MinValue { get; } = new MolarEntropy(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -127,7 +128,7 @@ public MolarEntropy(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerMoleKelvin. /// - public static MolarEntropy Zero { get; } = new MolarEntropy((T)0, BaseUnit); + public static MolarEntropy Zero { get; } = new MolarEntropy(default(T), BaseUnit); #endregion @@ -140,6 +141,29 @@ public MolarEntropy(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public MolarEntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => MolarEntropy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MolarEntropy.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -278,7 +302,7 @@ public static MolarEntropy Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static MolarEntropy Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, MolarEntropyUnit>( + return QuantityParser.Default.Parse, MolarEntropyUnit>( str, provider, From); @@ -309,7 +333,7 @@ public static bool TryParse(string? str, out MolarEntropy result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out MolarEntropy result) { - return QuantityParser.Default.TryParse, MolarEntropyUnit>( + return QuantityParser.Default.TryParse, MolarEntropyUnit>( str, provider, From, @@ -531,10 +555,10 @@ public bool Equals(MolarEntropy other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MolarEntropy other, double tolerance, ComparisonType comparisonType) + public bool Equals(MolarEntropy other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs index e8181ffb56..d07ce333df 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// In chemistry, the molar mass M is a physical property defined as the mass of a given substance (chemical element or chemical compound) divided by the amount of substance. /// public partial struct MolarMass : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -115,12 +116,12 @@ public MolarMass(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static MolarMass MaxValue { get; } = new MolarMass(double.MaxValue, BaseUnit); + public static MolarMass MaxValue { get; } = new MolarMass(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static MolarMass MinValue { get; } = new MolarMass(double.MinValue, BaseUnit); + public static MolarMass MinValue { get; } = new MolarMass(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -136,7 +137,7 @@ public MolarMass(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerMole. /// - public static MolarMass Zero { get; } = new MolarMass((T)0, BaseUnit); + public static MolarMass Zero { get; } = new MolarMass(default(T), BaseUnit); #endregion @@ -149,6 +150,29 @@ public MolarMass(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public MolarMassUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => MolarMass.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MolarMass.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -404,7 +428,7 @@ public static MolarMass Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static MolarMass Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, MolarMassUnit>( + return QuantityParser.Default.Parse, MolarMassUnit>( str, provider, From); @@ -435,7 +459,7 @@ public static bool TryParse(string? str, out MolarMass result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out MolarMass result) { - return QuantityParser.Default.TryParse, MolarMassUnit>( + return QuantityParser.Default.TryParse, MolarMassUnit>( str, provider, From, @@ -657,10 +681,10 @@ public bool Equals(MolarMass other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MolarMass other, double tolerance, ComparisonType comparisonType) + public bool Equals(MolarMass other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs index 3ff7cf2e24..5549be8f04 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Molar_concentration /// public partial struct Molarity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -114,12 +115,12 @@ public Molarity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Molarity MaxValue { get; } = new Molarity(double.MaxValue, BaseUnit); + public static Molarity MaxValue { get; } = new Molarity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Molarity MinValue { get; } = new Molarity(double.MinValue, BaseUnit); + public static Molarity MinValue { get; } = new Molarity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -135,7 +136,7 @@ public Molarity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit MolesPerCubicMeter. /// - public static Molarity Zero { get; } = new Molarity((T)0, BaseUnit); + public static Molarity Zero { get; } = new Molarity(default(T), BaseUnit); #endregion @@ -148,6 +149,29 @@ public Molarity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public MolarityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Molarity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Molarity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -351,7 +375,7 @@ public static Molarity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Molarity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, MolarityUnit>( + return QuantityParser.Default.Parse, MolarityUnit>( str, provider, From); @@ -382,7 +406,7 @@ public static bool TryParse(string? str, out Molarity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Molarity result) { - return QuantityParser.Default.TryParse, MolarityUnit>( + return QuantityParser.Default.TryParse, MolarityUnit>( str, provider, From, @@ -604,10 +628,10 @@ public bool Equals(Molarity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Molarity other, double tolerance, ComparisonType comparisonType) + public bool Equals(Molarity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs index 798b3b7d78..1d04e35bf4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Permeability_(electromagnetism) /// public partial struct Permeability : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -107,12 +108,12 @@ public Permeability(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Permeability MaxValue { get; } = new Permeability(double.MaxValue, BaseUnit); + public static Permeability MaxValue { get; } = new Permeability(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Permeability MinValue { get; } = new Permeability(double.MinValue, BaseUnit); + public static Permeability MinValue { get; } = new Permeability(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,7 +129,7 @@ public Permeability(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit HenryPerMeter. /// - public static Permeability Zero { get; } = new Permeability((T)0, BaseUnit); + public static Permeability Zero { get; } = new Permeability(default(T), BaseUnit); #endregion @@ -141,6 +142,29 @@ public Permeability(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public PermeabilityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Permeability.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Permeability.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -253,7 +277,7 @@ public static Permeability Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Permeability Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, PermeabilityUnit>( + return QuantityParser.Default.Parse, PermeabilityUnit>( str, provider, From); @@ -284,7 +308,7 @@ public static bool TryParse(string? str, out Permeability result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Permeability result) { - return QuantityParser.Default.TryParse, PermeabilityUnit>( + return QuantityParser.Default.TryParse, PermeabilityUnit>( str, provider, From, @@ -506,10 +530,10 @@ public bool Equals(Permeability other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Permeability other, double tolerance, ComparisonType comparisonType) + public bool Equals(Permeability other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs index f5836bc151..37d6f161db 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Permittivity /// public partial struct Permittivity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -107,12 +108,12 @@ public Permittivity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Permittivity MaxValue { get; } = new Permittivity(double.MaxValue, BaseUnit); + public static Permittivity MaxValue { get; } = new Permittivity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Permittivity MinValue { get; } = new Permittivity(double.MinValue, BaseUnit); + public static Permittivity MinValue { get; } = new Permittivity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,7 +129,7 @@ public Permittivity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit FaradPerMeter. /// - public static Permittivity Zero { get; } = new Permittivity((T)0, BaseUnit); + public static Permittivity Zero { get; } = new Permittivity(default(T), BaseUnit); #endregion @@ -141,6 +142,29 @@ public Permittivity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public PermittivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Permittivity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Permittivity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -253,7 +277,7 @@ public static Permittivity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Permittivity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, PermittivityUnit>( + return QuantityParser.Default.Parse, PermittivityUnit>( str, provider, From); @@ -284,7 +308,7 @@ public static bool TryParse(string? str, out Permittivity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Permittivity result) { - return QuantityParser.Default.TryParse, PermittivityUnit>( + return QuantityParser.Default.TryParse, PermittivityUnit>( str, provider, From, @@ -506,10 +530,10 @@ public bool Equals(Permittivity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Permittivity other, double tolerance, ComparisonType comparisonType) + public bool Equals(Permittivity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Power.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.g.cs index b6af135ca9..004d299f2a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// In physics, power is the rate of doing work. It is equivalent to an amount of energy consumed per unit time. /// public partial struct Power : IQuantityT, IDecimalQuantity, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -128,12 +129,12 @@ public Power(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Power MaxValue { get; } = new Power(decimal.MaxValue, BaseUnit); + public static Power MaxValue { get; } = new Power(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Power MinValue { get; } = new Power(decimal.MinValue, BaseUnit); + public static Power MinValue { get; } = new Power(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -149,7 +150,7 @@ public Power(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Watt. /// - public static Power Zero { get; } = new Power((T)0, BaseUnit); + public static Power Zero { get; } = new Power(default(T), BaseUnit); #endregion @@ -168,10 +169,10 @@ public Power(T value, UnitSystem unitSystem) Enum IQuantity.Unit => Unit; /// - public {_unitEnumName} Unit => _unit.GetValueOrDefault(BaseUnit); + public PowerUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// - public QuantityInfo<{_unitEnumName}> QuantityInfo => Info; + public QuantityInfo QuantityInfo => Info; /// QuantityInfo IQuantity.QuantityInfo => Info; @@ -179,12 +180,12 @@ public Power(T value, UnitSystem unitSystem) /// /// The of this quantity. /// - public QuantityType Type => {_quantity.Name}.QuantityType; + public QuantityType Type => Power.QuantityType; /// /// The of this quantity. /// - public BaseDimensions Dimensions => {_quantity.Name}.BaseDimensions; + public BaseDimensions Dimensions => Power.BaseDimensions; #endregion @@ -612,7 +613,7 @@ public static Power Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Power Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, PowerUnit>( + return QuantityParser.Default.Parse, PowerUnit>( str, provider, From); @@ -643,7 +644,7 @@ public static bool TryParse(string? str, out Power result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Power result) { - return QuantityParser.Default.TryParse, PowerUnit>( + return QuantityParser.Default.TryParse, PowerUnit>( str, provider, From, @@ -865,10 +866,10 @@ public bool Equals(Power other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Power other, double tolerance, ComparisonType comparisonType) + public bool Equals(Power other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs index 958ba6bf35..162fef2295 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// The amount of power in a volume. /// public partial struct PowerDensity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -147,12 +148,12 @@ public PowerDensity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static PowerDensity MaxValue { get; } = new PowerDensity(double.MaxValue, BaseUnit); + public static PowerDensity MaxValue { get; } = new PowerDensity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static PowerDensity MinValue { get; } = new PowerDensity(double.MinValue, BaseUnit); + public static PowerDensity MinValue { get; } = new PowerDensity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -168,7 +169,7 @@ public PowerDensity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit WattPerCubicMeter. /// - public static PowerDensity Zero { get; } = new PowerDensity((T)0, BaseUnit); + public static PowerDensity Zero { get; } = new PowerDensity(default(T), BaseUnit); #endregion @@ -181,6 +182,29 @@ public PowerDensity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public PowerDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => PowerDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => PowerDensity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -852,7 +876,7 @@ public static PowerDensity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static PowerDensity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, PowerDensityUnit>( + return QuantityParser.Default.Parse, PowerDensityUnit>( str, provider, From); @@ -883,7 +907,7 @@ public static bool TryParse(string? str, out PowerDensity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out PowerDensity result) { - return QuantityParser.Default.TryParse, PowerDensityUnit>( + return QuantityParser.Default.TryParse, PowerDensityUnit>( str, provider, From, @@ -1105,10 +1129,10 @@ public bool Equals(PowerDensity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(PowerDensity other, double tolerance, ComparisonType comparisonType) + public bool Equals(PowerDensity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs index 509e1502fb..c4e7126379 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// The strength of a signal expressed in decibels (dB) relative to one watt. /// public partial struct PowerRatio : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -105,12 +106,12 @@ public PowerRatio(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static PowerRatio MaxValue { get; } = new PowerRatio(double.MaxValue, BaseUnit); + public static PowerRatio MaxValue { get; } = new PowerRatio(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static PowerRatio MinValue { get; } = new PowerRatio(double.MinValue, BaseUnit); + public static PowerRatio MinValue { get; } = new PowerRatio(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -126,7 +127,7 @@ public PowerRatio(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit DecibelWatt. /// - public static PowerRatio Zero { get; } = new PowerRatio((T)0, BaseUnit); + public static PowerRatio Zero { get; } = new PowerRatio(default(T), BaseUnit); #endregion @@ -139,6 +140,29 @@ public PowerRatio(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public PowerRatioUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => PowerRatio.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => PowerRatio.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -264,7 +288,7 @@ public static PowerRatio Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static PowerRatio Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, PowerRatioUnit>( + return QuantityParser.Default.Parse, PowerRatioUnit>( str, provider, From); @@ -295,7 +319,7 @@ public static bool TryParse(string? str, out PowerRatio result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out PowerRatio result) { - return QuantityParser.Default.TryParse, PowerRatioUnit>( + return QuantityParser.Default.TryParse, PowerRatioUnit>( str, provider, From, @@ -520,10 +544,10 @@ public bool Equals(PowerRatio other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(PowerRatio other, double tolerance, ComparisonType comparisonType) + public bool Equals(PowerRatio other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs index 87c15d14de..e05ca97e5d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Pressure (symbol: P or p) is the ratio of force to the area over which that force is distributed. Pressure is force per unit area applied in a direction perpendicular to the surface of an object. Gauge pressure (also spelled gage pressure)[a] is the pressure relative to the local atmospheric or ambient pressure. Pressure is measured in any unit of force divided by any unit of area. The SI unit of pressure is the newton per square metre, which is called the pascal (Pa) after the seventeenth-century philosopher and scientist Blaise Pascal. A pressure of 1 Pa is small; it approximately equals the pressure exerted by a dollar bill resting flat on a table. Everyday pressures are often stated in kilopascals (1 kPa = 1000 Pa). /// public partial struct Pressure : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -145,12 +146,12 @@ public Pressure(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Pressure MaxValue { get; } = new Pressure(double.MaxValue, BaseUnit); + public static Pressure MaxValue { get; } = new Pressure(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Pressure MinValue { get; } = new Pressure(double.MinValue, BaseUnit); + public static Pressure MinValue { get; } = new Pressure(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -166,7 +167,7 @@ public Pressure(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Pascal. /// - public static Pressure Zero { get; } = new Pressure((T)0, BaseUnit); + public static Pressure Zero { get; } = new Pressure(default(T), BaseUnit); #endregion @@ -179,6 +180,29 @@ public Pressure(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public PressureUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Pressure.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Pressure.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -824,7 +848,7 @@ public static Pressure Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Pressure Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, PressureUnit>( + return QuantityParser.Default.Parse, PressureUnit>( str, provider, From); @@ -855,7 +879,7 @@ public static bool TryParse(string? str, out Pressure result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Pressure result) { - return QuantityParser.Default.TryParse, PressureUnit>( + return QuantityParser.Default.TryParse, PressureUnit>( str, provider, From, @@ -1077,10 +1101,10 @@ public bool Equals(Pressure other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Pressure other, double tolerance, ComparisonType comparisonType) + public bool Equals(Pressure other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs index 696e72faae..ded01f65eb 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Pressure change rate is the ratio of the pressure change to the time during which the change occurred (value of pressure changes per unit time). /// public partial struct PressureChangeRate : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -110,12 +111,12 @@ public PressureChangeRate(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static PressureChangeRate MaxValue { get; } = new PressureChangeRate(double.MaxValue, BaseUnit); + public static PressureChangeRate MaxValue { get; } = new PressureChangeRate(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static PressureChangeRate MinValue { get; } = new PressureChangeRate(double.MinValue, BaseUnit); + public static PressureChangeRate MinValue { get; } = new PressureChangeRate(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -131,7 +132,7 @@ public PressureChangeRate(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit PascalPerSecond. /// - public static PressureChangeRate Zero { get; } = new PressureChangeRate((T)0, BaseUnit); + public static PressureChangeRate Zero { get; } = new PressureChangeRate(default(T), BaseUnit); #endregion @@ -144,6 +145,29 @@ public PressureChangeRate(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public PressureChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => PressureChangeRate.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => PressureChangeRate.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -334,7 +358,7 @@ public static PressureChangeRate Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static PressureChangeRate Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, PressureChangeRateUnit>( + return QuantityParser.Default.Parse, PressureChangeRateUnit>( str, provider, From); @@ -365,7 +389,7 @@ public static bool TryParse(string? str, out PressureChangeRate result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out PressureChangeRate result) { - return QuantityParser.Default.TryParse, PressureChangeRateUnit>( + return QuantityParser.Default.TryParse, PressureChangeRateUnit>( str, provider, From, @@ -587,10 +611,10 @@ public bool Equals(PressureChangeRate other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(PressureChangeRate other, double tolerance, ComparisonType comparisonType) + public bool Equals(PressureChangeRate other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs index 7e8afd1d54..c43b15921f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// In mathematics, a ratio is a relationship between two numbers of the same kind (e.g., objects, persons, students, spoonfuls, units of whatever identical dimension), usually expressed as "a to b" or a:b, sometimes expressed arithmetically as a dimensionless quotient of the two that explicitly indicates how many times the first number contains the second (not necessarily an integer). /// public partial struct Ratio : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -109,12 +110,12 @@ public Ratio(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Ratio MaxValue { get; } = new Ratio(double.MaxValue, BaseUnit); + public static Ratio MaxValue { get; } = new Ratio(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Ratio MinValue { get; } = new Ratio(double.MinValue, BaseUnit); + public static Ratio MinValue { get; } = new Ratio(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -130,7 +131,7 @@ public Ratio(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit DecimalFraction. /// - public static Ratio Zero { get; } = new Ratio((T)0, BaseUnit); + public static Ratio Zero { get; } = new Ratio(default(T), BaseUnit); #endregion @@ -143,6 +144,29 @@ public Ratio(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public RatioUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Ratio.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Ratio.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -320,7 +344,7 @@ public static Ratio Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Ratio Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, RatioUnit>( + return QuantityParser.Default.Parse, RatioUnit>( str, provider, From); @@ -351,7 +375,7 @@ public static bool TryParse(string? str, out Ratio result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Ratio result) { - return QuantityParser.Default.TryParse, RatioUnit>( + return QuantityParser.Default.TryParse, RatioUnit>( str, provider, From, @@ -573,10 +597,10 @@ public bool Equals(Ratio other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Ratio other, double tolerance, ComparisonType comparisonType) + public bool Equals(Ratio other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs index ca9442a3ee..bcc5a685c0 100644 --- a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// The change in ratio per unit of time. /// public partial struct RatioChangeRate : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -105,12 +106,12 @@ public RatioChangeRate(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static RatioChangeRate MaxValue { get; } = new RatioChangeRate(double.MaxValue, BaseUnit); + public static RatioChangeRate MaxValue { get; } = new RatioChangeRate(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static RatioChangeRate MinValue { get; } = new RatioChangeRate(double.MinValue, BaseUnit); + public static RatioChangeRate MinValue { get; } = new RatioChangeRate(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -126,7 +127,7 @@ public RatioChangeRate(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit DecimalFractionPerSecond. /// - public static RatioChangeRate Zero { get; } = new RatioChangeRate((T)0, BaseUnit); + public static RatioChangeRate Zero { get; } = new RatioChangeRate(default(T), BaseUnit); #endregion @@ -139,6 +140,29 @@ public RatioChangeRate(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public RatioChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => RatioChangeRate.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => RatioChangeRate.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -264,7 +288,7 @@ public static RatioChangeRate Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static RatioChangeRate Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, RatioChangeRateUnit>( + return QuantityParser.Default.Parse, RatioChangeRateUnit>( str, provider, From); @@ -295,7 +319,7 @@ public static bool TryParse(string? str, out RatioChangeRate result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out RatioChangeRate result) { - return QuantityParser.Default.TryParse, RatioChangeRateUnit>( + return QuantityParser.Default.TryParse, RatioChangeRateUnit>( str, provider, From, @@ -517,10 +541,10 @@ public bool Equals(RatioChangeRate other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(RatioChangeRate other, double tolerance, ComparisonType comparisonType) + public bool Equals(RatioChangeRate other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs index a1651e3268..952d38474c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// The Volt-ampere reactive hour (expressed as varh) is the reactive power of one Volt-ampere reactive produced in one hour. /// public partial struct ReactiveEnergy : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -106,12 +107,12 @@ public ReactiveEnergy(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ReactiveEnergy MaxValue { get; } = new ReactiveEnergy(double.MaxValue, BaseUnit); + public static ReactiveEnergy MaxValue { get; } = new ReactiveEnergy(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ReactiveEnergy MinValue { get; } = new ReactiveEnergy(double.MinValue, BaseUnit); + public static ReactiveEnergy MinValue { get; } = new ReactiveEnergy(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -127,7 +128,7 @@ public ReactiveEnergy(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereReactiveHour. /// - public static ReactiveEnergy Zero { get; } = new ReactiveEnergy((T)0, BaseUnit); + public static ReactiveEnergy Zero { get; } = new ReactiveEnergy(default(T), BaseUnit); #endregion @@ -140,6 +141,29 @@ public ReactiveEnergy(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ReactiveEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ReactiveEnergy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ReactiveEnergy.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -278,7 +302,7 @@ public static ReactiveEnergy Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ReactiveEnergy Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ReactiveEnergyUnit>( + return QuantityParser.Default.Parse, ReactiveEnergyUnit>( str, provider, From); @@ -309,7 +333,7 @@ public static bool TryParse(string? str, out ReactiveEnergy result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ReactiveEnergy result) { - return QuantityParser.Default.TryParse, ReactiveEnergyUnit>( + return QuantityParser.Default.TryParse, ReactiveEnergyUnit>( str, provider, From, @@ -531,10 +555,10 @@ public bool Equals(ReactiveEnergy other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ReactiveEnergy other, double tolerance, ComparisonType comparisonType) + public bool Equals(ReactiveEnergy other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs index 4c0eb1e70a..5573327e0d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Volt-ampere reactive (var) is a unit by which reactive power is expressed in an AC electric power system. Reactive power exists in an AC circuit when the current and voltage are not in phase. /// public partial struct ReactivePower : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -107,12 +108,12 @@ public ReactivePower(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ReactivePower MaxValue { get; } = new ReactivePower(double.MaxValue, BaseUnit); + public static ReactivePower MaxValue { get; } = new ReactivePower(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ReactivePower MinValue { get; } = new ReactivePower(double.MinValue, BaseUnit); + public static ReactivePower MinValue { get; } = new ReactivePower(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,7 +129,7 @@ public ReactivePower(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereReactive. /// - public static ReactivePower Zero { get; } = new ReactivePower((T)0, BaseUnit); + public static ReactivePower Zero { get; } = new ReactivePower(default(T), BaseUnit); #endregion @@ -141,6 +142,29 @@ public ReactivePower(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ReactivePowerUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ReactivePower.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ReactivePower.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -292,7 +316,7 @@ public static ReactivePower Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ReactivePower Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ReactivePowerUnit>( + return QuantityParser.Default.Parse, ReactivePowerUnit>( str, provider, From); @@ -323,7 +347,7 @@ public static bool TryParse(string? str, out ReactivePower result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ReactivePower result) { - return QuantityParser.Default.TryParse, ReactivePowerUnit>( + return QuantityParser.Default.TryParse, ReactivePowerUnit>( str, provider, From, @@ -545,10 +569,10 @@ public bool Equals(ReactivePower other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ReactivePower other, double tolerance, ComparisonType comparisonType) + public bool Equals(ReactivePower other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs index a331594224..cc1c117418 100644 --- a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Relative humidity is a ratio of the actual water vapor present in the air to the maximum water vapor in the air at the given temperature. /// public partial struct RelativeHumidity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -104,12 +105,12 @@ public RelativeHumidity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static RelativeHumidity MaxValue { get; } = new RelativeHumidity(double.MaxValue, BaseUnit); + public static RelativeHumidity MaxValue { get; } = new RelativeHumidity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static RelativeHumidity MinValue { get; } = new RelativeHumidity(double.MinValue, BaseUnit); + public static RelativeHumidity MinValue { get; } = new RelativeHumidity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -125,7 +126,7 @@ public RelativeHumidity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Percent. /// - public static RelativeHumidity Zero { get; } = new RelativeHumidity((T)0, BaseUnit); + public static RelativeHumidity Zero { get; } = new RelativeHumidity(default(T), BaseUnit); #endregion @@ -138,6 +139,29 @@ public RelativeHumidity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public RelativeHumidityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => RelativeHumidity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => RelativeHumidity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -250,7 +274,7 @@ public static RelativeHumidity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static RelativeHumidity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, RelativeHumidityUnit>( + return QuantityParser.Default.Parse, RelativeHumidityUnit>( str, provider, From); @@ -281,7 +305,7 @@ public static bool TryParse(string? str, out RelativeHumidity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out RelativeHumidity result) { - return QuantityParser.Default.TryParse, RelativeHumidityUnit>( + return QuantityParser.Default.TryParse, RelativeHumidityUnit>( str, provider, From, @@ -503,10 +527,10 @@ public bool Equals(RelativeHumidity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(RelativeHumidity other, double tolerance, ComparisonType comparisonType) + public bool Equals(RelativeHumidity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs index 39da74ff53..0e0ea855af 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Angular acceleration is the rate of change of rotational speed. /// public partial struct RotationalAcceleration : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -107,12 +108,12 @@ public RotationalAcceleration(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static RotationalAcceleration MaxValue { get; } = new RotationalAcceleration(double.MaxValue, BaseUnit); + public static RotationalAcceleration MaxValue { get; } = new RotationalAcceleration(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static RotationalAcceleration MinValue { get; } = new RotationalAcceleration(double.MinValue, BaseUnit); + public static RotationalAcceleration MinValue { get; } = new RotationalAcceleration(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,7 +129,7 @@ public RotationalAcceleration(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit RadianPerSecondSquared. /// - public static RotationalAcceleration Zero { get; } = new RotationalAcceleration((T)0, BaseUnit); + public static RotationalAcceleration Zero { get; } = new RotationalAcceleration(default(T), BaseUnit); #endregion @@ -141,6 +142,29 @@ public RotationalAcceleration(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public RotationalAccelerationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => RotationalAcceleration.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => RotationalAcceleration.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -292,7 +316,7 @@ public static RotationalAcceleration Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static RotationalAcceleration Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, RotationalAccelerationUnit>( + return QuantityParser.Default.Parse, RotationalAccelerationUnit>( str, provider, From); @@ -323,7 +347,7 @@ public static bool TryParse(string? str, out RotationalAcceleration result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out RotationalAcceleration result) { - return QuantityParser.Default.TryParse, RotationalAccelerationUnit>( + return QuantityParser.Default.TryParse, RotationalAccelerationUnit>( str, provider, From, @@ -545,10 +569,10 @@ public bool Equals(RotationalAcceleration other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(RotationalAcceleration other, double tolerance, ComparisonType comparisonType) + public bool Equals(RotationalAcceleration other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs index ed2175d8f9..86649765de 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Rotational speed (sometimes called speed of revolution) is the number of complete rotations, revolutions, cycles, or turns per time unit. Rotational speed is a cyclic frequency, measured in radians per second or in hertz in the SI System by scientists, or in revolutions per minute (rpm or min-1) or revolutions per second in everyday life. The symbol for rotational speed is ω (the Greek lowercase letter "omega"). /// public partial struct RotationalSpeed : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -116,12 +117,12 @@ public RotationalSpeed(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static RotationalSpeed MaxValue { get; } = new RotationalSpeed(double.MaxValue, BaseUnit); + public static RotationalSpeed MaxValue { get; } = new RotationalSpeed(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static RotationalSpeed MinValue { get; } = new RotationalSpeed(double.MinValue, BaseUnit); + public static RotationalSpeed MinValue { get; } = new RotationalSpeed(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -137,7 +138,7 @@ public RotationalSpeed(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit RadianPerSecond. /// - public static RotationalSpeed Zero { get; } = new RotationalSpeed((T)0, BaseUnit); + public static RotationalSpeed Zero { get; } = new RotationalSpeed(default(T), BaseUnit); #endregion @@ -150,6 +151,29 @@ public RotationalSpeed(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public RotationalSpeedUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => RotationalSpeed.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => RotationalSpeed.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -418,7 +442,7 @@ public static RotationalSpeed Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static RotationalSpeed Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, RotationalSpeedUnit>( + return QuantityParser.Default.Parse, RotationalSpeedUnit>( str, provider, From); @@ -449,7 +473,7 @@ public static bool TryParse(string? str, out RotationalSpeed result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out RotationalSpeed result) { - return QuantityParser.Default.TryParse, RotationalSpeedUnit>( + return QuantityParser.Default.TryParse, RotationalSpeedUnit>( str, provider, From, @@ -671,10 +695,10 @@ public bool Equals(RotationalSpeed other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(RotationalSpeed other, double tolerance, ComparisonType comparisonType) + public bool Equals(RotationalSpeed other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs index 5573c09ab6..6e7f8fd5f7 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness /// public partial struct RotationalStiffness : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -136,12 +137,12 @@ public RotationalStiffness(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static RotationalStiffness MaxValue { get; } = new RotationalStiffness(double.MaxValue, BaseUnit); + public static RotationalStiffness MaxValue { get; } = new RotationalStiffness(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static RotationalStiffness MinValue { get; } = new RotationalStiffness(double.MinValue, BaseUnit); + public static RotationalStiffness MinValue { get; } = new RotationalStiffness(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -157,7 +158,7 @@ public RotationalStiffness(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeterPerRadian. /// - public static RotationalStiffness Zero { get; } = new RotationalStiffness((T)0, BaseUnit); + public static RotationalStiffness Zero { get; } = new RotationalStiffness(default(T), BaseUnit); #endregion @@ -170,6 +171,29 @@ public RotationalStiffness(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public RotationalStiffnessUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => RotationalStiffness.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => RotationalStiffness.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -698,7 +722,7 @@ public static RotationalStiffness Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static RotationalStiffness Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, RotationalStiffnessUnit>( + return QuantityParser.Default.Parse, RotationalStiffnessUnit>( str, provider, From); @@ -729,7 +753,7 @@ public static bool TryParse(string? str, out RotationalStiffness result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out RotationalStiffness result) { - return QuantityParser.Default.TryParse, RotationalStiffnessUnit>( + return QuantityParser.Default.TryParse, RotationalStiffnessUnit>( str, provider, From, @@ -951,10 +975,10 @@ public bool Equals(RotationalStiffness other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(RotationalStiffness other, double tolerance, ComparisonType comparisonType) + public bool Equals(RotationalStiffness other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs index ffdc1be0ab..337b0304c4 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness /// public partial struct RotationalStiffnessPerLength : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -108,12 +109,12 @@ public RotationalStiffnessPerLength(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static RotationalStiffnessPerLength MaxValue { get; } = new RotationalStiffnessPerLength(double.MaxValue, BaseUnit); + public static RotationalStiffnessPerLength MaxValue { get; } = new RotationalStiffnessPerLength(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static RotationalStiffnessPerLength MinValue { get; } = new RotationalStiffnessPerLength(double.MinValue, BaseUnit); + public static RotationalStiffnessPerLength MinValue { get; } = new RotationalStiffnessPerLength(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -129,7 +130,7 @@ public RotationalStiffnessPerLength(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeterPerRadianPerMeter. /// - public static RotationalStiffnessPerLength Zero { get; } = new RotationalStiffnessPerLength((T)0, BaseUnit); + public static RotationalStiffnessPerLength Zero { get; } = new RotationalStiffnessPerLength(default(T), BaseUnit); #endregion @@ -142,6 +143,29 @@ public RotationalStiffnessPerLength(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public RotationalStiffnessPerLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => RotationalStiffnessPerLength.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => RotationalStiffnessPerLength.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -306,7 +330,7 @@ public static RotationalStiffnessPerLength Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static RotationalStiffnessPerLength Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, RotationalStiffnessPerLengthUnit>( + return QuantityParser.Default.Parse, RotationalStiffnessPerLengthUnit>( str, provider, From); @@ -337,7 +361,7 @@ public static bool TryParse(string? str, out RotationalStiffnessPerLength res /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out RotationalStiffnessPerLength result) { - return QuantityParser.Default.TryParse, RotationalStiffnessPerLengthUnit>( + return QuantityParser.Default.TryParse, RotationalStiffnessPerLengthUnit>( str, provider, From, @@ -559,10 +583,10 @@ public bool Equals(RotationalStiffnessPerLength other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(RotationalStiffnessPerLength other, double tolerance, ComparisonType comparisonType) + public bool Equals(RotationalStiffnessPerLength other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs index 013b17bdca..ce84d1bb2a 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Solid_angle /// public partial struct SolidAngle : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -107,12 +108,12 @@ public SolidAngle(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static SolidAngle MaxValue { get; } = new SolidAngle(double.MaxValue, BaseUnit); + public static SolidAngle MaxValue { get; } = new SolidAngle(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static SolidAngle MinValue { get; } = new SolidAngle(double.MinValue, BaseUnit); + public static SolidAngle MinValue { get; } = new SolidAngle(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,7 +129,7 @@ public SolidAngle(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Steradian. /// - public static SolidAngle Zero { get; } = new SolidAngle((T)0, BaseUnit); + public static SolidAngle Zero { get; } = new SolidAngle(default(T), BaseUnit); #endregion @@ -141,6 +142,29 @@ public SolidAngle(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public SolidAngleUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => SolidAngle.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => SolidAngle.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -253,7 +277,7 @@ public static SolidAngle Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static SolidAngle Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, SolidAngleUnit>( + return QuantityParser.Default.Parse, SolidAngleUnit>( str, provider, From); @@ -284,7 +308,7 @@ public static bool TryParse(string? str, out SolidAngle result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out SolidAngle result) { - return QuantityParser.Default.TryParse, SolidAngleUnit>( + return QuantityParser.Default.TryParse, SolidAngleUnit>( str, provider, From, @@ -506,10 +530,10 @@ public bool Equals(SolidAngle other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(SolidAngle other, double tolerance, ComparisonType comparisonType) + public bool Equals(SolidAngle other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs index 111d42a73b..01876baa4a 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Specific_energy /// public partial struct SpecificEnergy : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -131,12 +132,12 @@ public SpecificEnergy(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static SpecificEnergy MaxValue { get; } = new SpecificEnergy(double.MaxValue, BaseUnit); + public static SpecificEnergy MaxValue { get; } = new SpecificEnergy(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static SpecificEnergy MinValue { get; } = new SpecificEnergy(double.MinValue, BaseUnit); + public static SpecificEnergy MinValue { get; } = new SpecificEnergy(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -152,7 +153,7 @@ public SpecificEnergy(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKilogram. /// - public static SpecificEnergy Zero { get; } = new SpecificEnergy((T)0, BaseUnit); + public static SpecificEnergy Zero { get; } = new SpecificEnergy(default(T), BaseUnit); #endregion @@ -165,6 +166,29 @@ public SpecificEnergy(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public SpecificEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => SpecificEnergy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => SpecificEnergy.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -589,7 +613,7 @@ public static SpecificEnergy Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static SpecificEnergy Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, SpecificEnergyUnit>( + return QuantityParser.Default.Parse, SpecificEnergyUnit>( str, provider, From); @@ -620,7 +644,7 @@ public static bool TryParse(string? str, out SpecificEnergy result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out SpecificEnergy result) { - return QuantityParser.Default.TryParse, SpecificEnergyUnit>( + return QuantityParser.Default.TryParse, SpecificEnergyUnit>( str, provider, From, @@ -842,10 +866,10 @@ public bool Equals(SpecificEnergy other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(SpecificEnergy other, double tolerance, ComparisonType comparisonType) + public bool Equals(SpecificEnergy other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs index 33d9d4d92b..21977f9260 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Specific entropy is an amount of energy required to raise temperature of a substance by 1 Kelvin per unit mass. /// public partial struct SpecificEntropy : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -112,12 +113,12 @@ public SpecificEntropy(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static SpecificEntropy MaxValue { get; } = new SpecificEntropy(double.MaxValue, BaseUnit); + public static SpecificEntropy MaxValue { get; } = new SpecificEntropy(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static SpecificEntropy MinValue { get; } = new SpecificEntropy(double.MinValue, BaseUnit); + public static SpecificEntropy MinValue { get; } = new SpecificEntropy(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -133,7 +134,7 @@ public SpecificEntropy(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKilogramKelvin. /// - public static SpecificEntropy Zero { get; } = new SpecificEntropy((T)0, BaseUnit); + public static SpecificEntropy Zero { get; } = new SpecificEntropy(default(T), BaseUnit); #endregion @@ -146,6 +147,29 @@ public SpecificEntropy(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public SpecificEntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => SpecificEntropy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => SpecificEntropy.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -362,7 +386,7 @@ public static SpecificEntropy Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static SpecificEntropy Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, SpecificEntropyUnit>( + return QuantityParser.Default.Parse, SpecificEntropyUnit>( str, provider, From); @@ -393,7 +417,7 @@ public static bool TryParse(string? str, out SpecificEntropy result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out SpecificEntropy result) { - return QuantityParser.Default.TryParse, SpecificEntropyUnit>( + return QuantityParser.Default.TryParse, SpecificEntropyUnit>( str, provider, From, @@ -615,10 +639,10 @@ public bool Equals(SpecificEntropy other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(SpecificEntropy other, double tolerance, ComparisonType comparisonType) + public bool Equals(SpecificEntropy other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs index f6ce9119fa..fecf5f985c 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// In thermodynamics, the specific volume of a substance is the ratio of the substance's volume to its mass. It is the reciprocal of density and an intrinsic property of matter as well. /// public partial struct SpecificVolume : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -106,12 +107,12 @@ public SpecificVolume(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static SpecificVolume MaxValue { get; } = new SpecificVolume(double.MaxValue, BaseUnit); + public static SpecificVolume MaxValue { get; } = new SpecificVolume(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static SpecificVolume MinValue { get; } = new SpecificVolume(double.MinValue, BaseUnit); + public static SpecificVolume MinValue { get; } = new SpecificVolume(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -127,7 +128,7 @@ public SpecificVolume(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerKilogram. /// - public static SpecificVolume Zero { get; } = new SpecificVolume((T)0, BaseUnit); + public static SpecificVolume Zero { get; } = new SpecificVolume(default(T), BaseUnit); #endregion @@ -140,6 +141,29 @@ public SpecificVolume(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public SpecificVolumeUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => SpecificVolume.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => SpecificVolume.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -278,7 +302,7 @@ public static SpecificVolume Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static SpecificVolume Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, SpecificVolumeUnit>( + return QuantityParser.Default.Parse, SpecificVolumeUnit>( str, provider, From); @@ -309,7 +333,7 @@ public static bool TryParse(string? str, out SpecificVolume result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out SpecificVolume result) { - return QuantityParser.Default.TryParse, SpecificVolumeUnit>( + return QuantityParser.Default.TryParse, SpecificVolumeUnit>( str, provider, From, @@ -531,10 +555,10 @@ public bool Equals(SpecificVolume other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(SpecificVolume other, double tolerance, ComparisonType comparisonType) + public bool Equals(SpecificVolume other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs index 8fed82a392..bb9113b297 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// http://en.wikipedia.org/wiki/Specificweight /// public partial struct SpecificWeight : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -123,12 +124,12 @@ public SpecificWeight(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static SpecificWeight MaxValue { get; } = new SpecificWeight(double.MaxValue, BaseUnit); + public static SpecificWeight MaxValue { get; } = new SpecificWeight(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static SpecificWeight MinValue { get; } = new SpecificWeight(double.MinValue, BaseUnit); + public static SpecificWeight MinValue { get; } = new SpecificWeight(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -144,7 +145,7 @@ public SpecificWeight(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerCubicMeter. /// - public static SpecificWeight Zero { get; } = new SpecificWeight((T)0, BaseUnit); + public static SpecificWeight Zero { get; } = new SpecificWeight(default(T), BaseUnit); #endregion @@ -157,6 +158,29 @@ public SpecificWeight(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public SpecificWeightUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => SpecificWeight.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => SpecificWeight.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -477,7 +501,7 @@ public static SpecificWeight Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static SpecificWeight Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, SpecificWeightUnit>( + return QuantityParser.Default.Parse, SpecificWeightUnit>( str, provider, From); @@ -508,7 +532,7 @@ public static bool TryParse(string? str, out SpecificWeight result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out SpecificWeight result) { - return QuantityParser.Default.TryParse, SpecificWeightUnit>( + return QuantityParser.Default.TryParse, SpecificWeightUnit>( str, provider, From, @@ -730,10 +754,10 @@ public bool Equals(SpecificWeight other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(SpecificWeight other, double tolerance, ComparisonType comparisonType) + public bool Equals(SpecificWeight other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs index 822a1fee05..1ed96205a6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// In everyday use and in kinematics, the speed of an object is the magnitude of its velocity (the rate of change of its position); it is thus a scalar quantity.[1] The average speed of an object in an interval of time is the distance travelled by the object divided by the duration of the interval;[2] the instantaneous speed is the limit of the average speed as the duration of the time interval approaches zero. /// public partial struct Speed : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -135,12 +136,12 @@ public Speed(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Speed MaxValue { get; } = new Speed(double.MaxValue, BaseUnit); + public static Speed MaxValue { get; } = new Speed(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Speed MinValue { get; } = new Speed(double.MinValue, BaseUnit); + public static Speed MinValue { get; } = new Speed(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -156,7 +157,7 @@ public Speed(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit MeterPerSecond. /// - public static Speed Zero { get; } = new Speed((T)0, BaseUnit); + public static Speed Zero { get; } = new Speed(default(T), BaseUnit); #endregion @@ -169,6 +170,29 @@ public Speed(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public SpeedUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Speed.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Speed.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -684,7 +708,7 @@ public static Speed Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Speed Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, SpeedUnit>( + return QuantityParser.Default.Parse, SpeedUnit>( str, provider, From); @@ -715,7 +739,7 @@ public static bool TryParse(string? str, out Speed result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Speed result) { - return QuantityParser.Default.TryParse, SpeedUnit>( + return QuantityParser.Default.TryParse, SpeedUnit>( str, provider, From, @@ -937,10 +961,10 @@ public bool Equals(Speed other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Speed other, double tolerance, ComparisonType comparisonType) + public bool Equals(Speed other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs index 89aaf85113..e1527c263c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// A temperature is a numerical measure of hot or cold. Its measurement is by detection of heat radiation or particle velocity or kinetic energy, or by the bulk behavior of a thermometric material. It may be calibrated in any of various temperature scales, Celsius, Fahrenheit, Kelvin, etc. The fundamental physical definition of temperature is provided by thermodynamics. /// public partial struct Temperature : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -113,12 +114,12 @@ public Temperature(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Temperature MaxValue { get; } = new Temperature(double.MaxValue, BaseUnit); + public static Temperature MaxValue { get; } = new Temperature(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Temperature MinValue { get; } = new Temperature(double.MinValue, BaseUnit); + public static Temperature MinValue { get; } = new Temperature(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -134,7 +135,7 @@ public Temperature(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Kelvin. /// - public static Temperature Zero { get; } = new Temperature((T)0, BaseUnit); + public static Temperature Zero { get; } = new Temperature(default(T), BaseUnit); #endregion @@ -147,6 +148,29 @@ public Temperature(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public TemperatureUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Temperature.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Temperature.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -376,7 +400,7 @@ public static Temperature Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Temperature Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, TemperatureUnit>( + return QuantityParser.Default.Parse, TemperatureUnit>( str, provider, From); @@ -407,7 +431,7 @@ public static bool TryParse(string? str, out Temperature result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Temperature result) { - return QuantityParser.Default.TryParse, TemperatureUnit>( + return QuantityParser.Default.TryParse, TemperatureUnit>( str, provider, From, @@ -578,10 +602,10 @@ public bool Equals(Temperature other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Temperature other, double tolerance, ComparisonType comparisonType) + public bool Equals(Temperature other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs index ca0a2b2b12..66d073ac7d 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Temperature change rate is the ratio of the temperature change to the time during which the change occurred (value of temperature changes per unit time). /// public partial struct TemperatureChangeRate : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -113,12 +114,12 @@ public TemperatureChangeRate(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static TemperatureChangeRate MaxValue { get; } = new TemperatureChangeRate(double.MaxValue, BaseUnit); + public static TemperatureChangeRate MaxValue { get; } = new TemperatureChangeRate(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static TemperatureChangeRate MinValue { get; } = new TemperatureChangeRate(double.MinValue, BaseUnit); + public static TemperatureChangeRate MinValue { get; } = new TemperatureChangeRate(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -134,7 +135,7 @@ public TemperatureChangeRate(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit DegreeCelsiusPerSecond. /// - public static TemperatureChangeRate Zero { get; } = new TemperatureChangeRate((T)0, BaseUnit); + public static TemperatureChangeRate Zero { get; } = new TemperatureChangeRate(default(T), BaseUnit); #endregion @@ -147,6 +148,29 @@ public TemperatureChangeRate(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public TemperatureChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => TemperatureChangeRate.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => TemperatureChangeRate.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -376,7 +400,7 @@ public static TemperatureChangeRate Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static TemperatureChangeRate Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, TemperatureChangeRateUnit>( + return QuantityParser.Default.Parse, TemperatureChangeRateUnit>( str, provider, From); @@ -407,7 +431,7 @@ public static bool TryParse(string? str, out TemperatureChangeRate result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out TemperatureChangeRate result) { - return QuantityParser.Default.TryParse, TemperatureChangeRateUnit>( + return QuantityParser.Default.TryParse, TemperatureChangeRateUnit>( str, provider, From, @@ -629,10 +653,10 @@ public bool Equals(TemperatureChangeRate other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(TemperatureChangeRate other, double tolerance, ComparisonType comparisonType) + public bool Equals(TemperatureChangeRate other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs index f3eb6dd79c..1767e3b2db 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Difference between two temperatures. The conversions are different than for Temperature. /// public partial struct TemperatureDelta : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -112,12 +113,12 @@ public TemperatureDelta(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static TemperatureDelta MaxValue { get; } = new TemperatureDelta(double.MaxValue, BaseUnit); + public static TemperatureDelta MaxValue { get; } = new TemperatureDelta(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static TemperatureDelta MinValue { get; } = new TemperatureDelta(double.MinValue, BaseUnit); + public static TemperatureDelta MinValue { get; } = new TemperatureDelta(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -133,7 +134,7 @@ public TemperatureDelta(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit Kelvin. /// - public static TemperatureDelta Zero { get; } = new TemperatureDelta((T)0, BaseUnit); + public static TemperatureDelta Zero { get; } = new TemperatureDelta(default(T), BaseUnit); #endregion @@ -146,6 +147,29 @@ public TemperatureDelta(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public TemperatureDeltaUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => TemperatureDelta.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => TemperatureDelta.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -362,7 +386,7 @@ public static TemperatureDelta Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static TemperatureDelta Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, TemperatureDeltaUnit>( + return QuantityParser.Default.Parse, TemperatureDeltaUnit>( str, provider, From); @@ -393,7 +417,7 @@ public static bool TryParse(string? str, out TemperatureDelta result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out TemperatureDelta result) { - return QuantityParser.Default.TryParse, TemperatureDeltaUnit>( + return QuantityParser.Default.TryParse, TemperatureDeltaUnit>( str, provider, From, @@ -615,10 +639,10 @@ public bool Equals(TemperatureDelta other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(TemperatureDelta other, double tolerance, ComparisonType comparisonType) + public bool Equals(TemperatureDelta other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs index 813d2f336b..01758f0d33 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Thermal_Conductivity /// public partial struct ThermalConductivity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -108,12 +109,12 @@ public ThermalConductivity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ThermalConductivity MaxValue { get; } = new ThermalConductivity(double.MaxValue, BaseUnit); + public static ThermalConductivity MaxValue { get; } = new ThermalConductivity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ThermalConductivity MinValue { get; } = new ThermalConductivity(double.MinValue, BaseUnit); + public static ThermalConductivity MinValue { get; } = new ThermalConductivity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -129,7 +130,7 @@ public ThermalConductivity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit WattPerMeterKelvin. /// - public static ThermalConductivity Zero { get; } = new ThermalConductivity((T)0, BaseUnit); + public static ThermalConductivity Zero { get; } = new ThermalConductivity(default(T), BaseUnit); #endregion @@ -142,6 +143,29 @@ public ThermalConductivity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ThermalConductivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ThermalConductivity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ThermalConductivity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -267,7 +291,7 @@ public static ThermalConductivity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ThermalConductivity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ThermalConductivityUnit>( + return QuantityParser.Default.Parse, ThermalConductivityUnit>( str, provider, From); @@ -298,7 +322,7 @@ public static bool TryParse(string? str, out ThermalConductivity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ThermalConductivity result) { - return QuantityParser.Default.TryParse, ThermalConductivityUnit>( + return QuantityParser.Default.TryParse, ThermalConductivityUnit>( str, provider, From, @@ -520,10 +544,10 @@ public bool Equals(ThermalConductivity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ThermalConductivity other, double tolerance, ComparisonType comparisonType) + public bool Equals(ThermalConductivity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs index f636fe60ae..e44b00d3ae 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Heat Transfer Coefficient or Thermal conductivity - indicates a materials ability to conduct heat. /// public partial struct ThermalResistance : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -108,12 +109,12 @@ public ThermalResistance(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static ThermalResistance MaxValue { get; } = new ThermalResistance(double.MaxValue, BaseUnit); + public static ThermalResistance MaxValue { get; } = new ThermalResistance(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static ThermalResistance MinValue { get; } = new ThermalResistance(double.MinValue, BaseUnit); + public static ThermalResistance MinValue { get; } = new ThermalResistance(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -129,7 +130,7 @@ public ThermalResistance(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeterKelvinPerKilowatt. /// - public static ThermalResistance Zero { get; } = new ThermalResistance((T)0, BaseUnit); + public static ThermalResistance Zero { get; } = new ThermalResistance(default(T), BaseUnit); #endregion @@ -142,6 +143,29 @@ public ThermalResistance(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public ThermalResistanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => ThermalResistance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ThermalResistance.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -306,7 +330,7 @@ public static ThermalResistance Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static ThermalResistance Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, ThermalResistanceUnit>( + return QuantityParser.Default.Parse, ThermalResistanceUnit>( str, provider, From); @@ -337,7 +361,7 @@ public static bool TryParse(string? str, out ThermalResistance result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out ThermalResistance result) { - return QuantityParser.Default.TryParse, ThermalResistanceUnit>( + return QuantityParser.Default.TryParse, ThermalResistanceUnit>( str, provider, From, @@ -559,10 +583,10 @@ public bool Equals(ThermalResistance other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ThermalResistance other, double tolerance, ComparisonType comparisonType) + public bool Equals(ThermalResistance other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs index d9a77d2970..a27105b619 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Torque, moment or moment of force (see the terminology below), is the tendency of a force to rotate an object about an axis,[1] fulcrum, or pivot. Just as a force is a push or a pull, a torque can be thought of as a twist to an object. Mathematically, torque is defined as the cross product of the lever-arm distance and force, which tends to produce rotation. Loosely speaking, torque is a measure of the turning force on an object such as a bolt or a flywheel. For example, pushing or pulling the handle of a wrench connected to a nut or bolt produces a torque (turning force) that loosens or tightens the nut or bolt. /// public partial struct Torque : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -125,12 +126,12 @@ public Torque(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Torque MaxValue { get; } = new Torque(double.MaxValue, BaseUnit); + public static Torque MaxValue { get; } = new Torque(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Torque MinValue { get; } = new Torque(double.MinValue, BaseUnit); + public static Torque MinValue { get; } = new Torque(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -146,7 +147,7 @@ public Torque(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeter. /// - public static Torque Zero { get; } = new Torque((T)0, BaseUnit); + public static Torque Zero { get; } = new Torque(default(T), BaseUnit); #endregion @@ -159,6 +160,29 @@ public Torque(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public TorqueUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Torque.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Torque.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -544,7 +568,7 @@ public static Torque Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Torque Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, TorqueUnit>( + return QuantityParser.Default.Parse, TorqueUnit>( str, provider, From); @@ -575,7 +599,7 @@ public static bool TryParse(string? str, out Torque result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Torque result) { - return QuantityParser.Default.TryParse, TorqueUnit>( + return QuantityParser.Default.TryParse, TorqueUnit>( str, provider, From, @@ -797,10 +821,10 @@ public bool Equals(Torque other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Torque other, double tolerance, ComparisonType comparisonType) + public bool Equals(Torque other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs index 9633f93306..e069ac13e8 100644 --- a/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// The magnitude of torque per unit length. /// public partial struct TorquePerLength : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -124,12 +125,12 @@ public TorquePerLength(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static TorquePerLength MaxValue { get; } = new TorquePerLength(double.MaxValue, BaseUnit); + public static TorquePerLength MaxValue { get; } = new TorquePerLength(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static TorquePerLength MinValue { get; } = new TorquePerLength(double.MinValue, BaseUnit); + public static TorquePerLength MinValue { get; } = new TorquePerLength(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -145,7 +146,7 @@ public TorquePerLength(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeterPerMeter. /// - public static TorquePerLength Zero { get; } = new TorquePerLength((T)0, BaseUnit); + public static TorquePerLength Zero { get; } = new TorquePerLength(default(T), BaseUnit); #endregion @@ -158,6 +159,29 @@ public TorquePerLength(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public TorquePerLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => TorquePerLength.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => TorquePerLength.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -530,7 +554,7 @@ public static TorquePerLength Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static TorquePerLength Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, TorquePerLengthUnit>( + return QuantityParser.Default.Parse, TorquePerLengthUnit>( str, provider, From); @@ -561,7 +585,7 @@ public static bool TryParse(string? str, out TorquePerLength result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out TorquePerLength result) { - return QuantityParser.Default.TryParse, TorquePerLengthUnit>( + return QuantityParser.Default.TryParse, TorquePerLengthUnit>( str, provider, From, @@ -783,10 +807,10 @@ public bool Equals(TorquePerLength other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(TorquePerLength other, double tolerance, ComparisonType comparisonType) + public bool Equals(TorquePerLength other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs index 04a5974023..d86c85db69 100644 --- a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Turbidity /// public partial struct Turbidity : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -107,12 +108,12 @@ public Turbidity(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Turbidity MaxValue { get; } = new Turbidity(double.MaxValue, BaseUnit); + public static Turbidity MaxValue { get; } = new Turbidity(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Turbidity MinValue { get; } = new Turbidity(double.MinValue, BaseUnit); + public static Turbidity MinValue { get; } = new Turbidity(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -128,7 +129,7 @@ public Turbidity(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit NTU. /// - public static Turbidity Zero { get; } = new Turbidity((T)0, BaseUnit); + public static Turbidity Zero { get; } = new Turbidity(default(T), BaseUnit); #endregion @@ -141,6 +142,29 @@ public Turbidity(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public TurbidityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Turbidity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Turbidity.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -253,7 +277,7 @@ public static Turbidity Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Turbidity Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, TurbidityUnit>( + return QuantityParser.Default.Parse, TurbidityUnit>( str, provider, From); @@ -284,7 +308,7 @@ public static bool TryParse(string? str, out Turbidity result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Turbidity result) { - return QuantityParser.Default.TryParse, TurbidityUnit>( + return QuantityParser.Default.TryParse, TurbidityUnit>( str, provider, From, @@ -506,10 +530,10 @@ public bool Equals(Turbidity other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Turbidity other, double tolerance, ComparisonType comparisonType) + public bool Equals(Turbidity other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs index 0ab065a430..9b8e24d595 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Vitamin A: 1 IU is the biological equivalent of 0.3 µg retinol, or of 0.6 µg beta-carotene. /// public partial struct VitaminA : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -104,12 +105,12 @@ public VitaminA(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static VitaminA MaxValue { get; } = new VitaminA(double.MaxValue, BaseUnit); + public static VitaminA MaxValue { get; } = new VitaminA(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static VitaminA MinValue { get; } = new VitaminA(double.MinValue, BaseUnit); + public static VitaminA MinValue { get; } = new VitaminA(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -125,7 +126,7 @@ public VitaminA(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit InternationalUnit. /// - public static VitaminA Zero { get; } = new VitaminA((T)0, BaseUnit); + public static VitaminA Zero { get; } = new VitaminA(default(T), BaseUnit); #endregion @@ -138,6 +139,29 @@ public VitaminA(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public VitaminAUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => VitaminA.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => VitaminA.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -250,7 +274,7 @@ public static VitaminA Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static VitaminA Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, VitaminAUnit>( + return QuantityParser.Default.Parse, VitaminAUnit>( str, provider, From); @@ -281,7 +305,7 @@ public static bool TryParse(string? str, out VitaminA result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out VitaminA result) { - return QuantityParser.Default.TryParse, VitaminAUnit>( + return QuantityParser.Default.TryParse, VitaminAUnit>( str, provider, From, @@ -503,10 +527,10 @@ public bool Equals(VitaminA other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(VitaminA other, double tolerance, ComparisonType comparisonType) + public bool Equals(VitaminA other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs index 53aa5c9969..174e0d4a26 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Volume is the quantity of three-dimensional space enclosed by some closed boundary, for example, the space that a substance (solid, liquid, gas, or plasma) or shape occupies or contains.[1] Volume is often quantified numerically using the SI derived unit, the cubic metre. The volume of a container is generally understood to be the capacity of the container, i. e. the amount of fluid (gas or liquid) that the container could hold, rather than the amount of space the container itself displaces. /// public partial struct Volume : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -154,12 +155,12 @@ public Volume(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static Volume MaxValue { get; } = new Volume(double.MaxValue, BaseUnit); + public static Volume MaxValue { get; } = new Volume(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static Volume MinValue { get; } = new Volume(double.MinValue, BaseUnit); + public static Volume MinValue { get; } = new Volume(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -175,7 +176,7 @@ public Volume(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeter. /// - public static Volume Zero { get; } = new Volume((T)0, BaseUnit); + public static Volume Zero { get; } = new Volume(default(T), BaseUnit); #endregion @@ -188,6 +189,29 @@ public Volume(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public VolumeUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => Volume.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Volume.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -950,7 +974,7 @@ public static Volume Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Volume Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, VolumeUnit>( + return QuantityParser.Default.Parse, VolumeUnit>( str, provider, From); @@ -981,7 +1005,7 @@ public static bool TryParse(string? str, out Volume result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out Volume result) { - return QuantityParser.Default.TryParse, VolumeUnit>( + return QuantityParser.Default.TryParse, VolumeUnit>( str, provider, From, @@ -1203,10 +1227,10 @@ public bool Equals(Volume other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Volume other, double tolerance, ComparisonType comparisonType) + public bool Equals(Volume other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs index 545af8f79b..b51f87f739 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs @@ -38,6 +38,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Concentration#Volume_concentration /// public partial struct VolumeConcentration : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -126,12 +127,12 @@ public VolumeConcentration(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static VolumeConcentration MaxValue { get; } = new VolumeConcentration(double.MaxValue, BaseUnit); + public static VolumeConcentration MaxValue { get; } = new VolumeConcentration(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static VolumeConcentration MinValue { get; } = new VolumeConcentration(double.MinValue, BaseUnit); + public static VolumeConcentration MinValue { get; } = new VolumeConcentration(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -147,7 +148,7 @@ public VolumeConcentration(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit DecimalFraction. /// - public static VolumeConcentration Zero { get; } = new VolumeConcentration((T)0, BaseUnit); + public static VolumeConcentration Zero { get; } = new VolumeConcentration(default(T), BaseUnit); #endregion @@ -160,6 +161,29 @@ public VolumeConcentration(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public VolumeConcentrationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => VolumeConcentration.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => VolumeConcentration.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -519,7 +543,7 @@ public static VolumeConcentration Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static VolumeConcentration Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, VolumeConcentrationUnit>( + return QuantityParser.Default.Parse, VolumeConcentrationUnit>( str, provider, From); @@ -550,7 +574,7 @@ public static bool TryParse(string? str, out VolumeConcentration result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out VolumeConcentration result) { - return QuantityParser.Default.TryParse, VolumeConcentrationUnit>( + return QuantityParser.Default.TryParse, VolumeConcentrationUnit>( str, provider, From, @@ -772,10 +796,10 @@ public bool Equals(VolumeConcentration other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(VolumeConcentration other, double tolerance, ComparisonType comparisonType) + public bool Equals(VolumeConcentration other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs index bc95b4f718..96df812aa1 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q. /// public partial struct VolumeFlow : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -159,12 +160,12 @@ public VolumeFlow(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static VolumeFlow MaxValue { get; } = new VolumeFlow(double.MaxValue, BaseUnit); + public static VolumeFlow MaxValue { get; } = new VolumeFlow(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static VolumeFlow MinValue { get; } = new VolumeFlow(double.MinValue, BaseUnit); + public static VolumeFlow MinValue { get; } = new VolumeFlow(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -180,7 +181,7 @@ public VolumeFlow(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerSecond. /// - public static VolumeFlow Zero { get; } = new VolumeFlow((T)0, BaseUnit); + public static VolumeFlow Zero { get; } = new VolumeFlow(default(T), BaseUnit); #endregion @@ -193,6 +194,29 @@ public VolumeFlow(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public VolumeFlowUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => VolumeFlow.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => VolumeFlow.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -1020,7 +1044,7 @@ public static VolumeFlow Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static VolumeFlow Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, VolumeFlowUnit>( + return QuantityParser.Default.Parse, VolumeFlowUnit>( str, provider, From); @@ -1051,7 +1075,7 @@ public static bool TryParse(string? str, out VolumeFlow result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out VolumeFlow result) { - return QuantityParser.Default.TryParse, VolumeFlowUnit>( + return QuantityParser.Default.TryParse, VolumeFlowUnit>( str, provider, From, @@ -1273,10 +1297,10 @@ public bool Equals(VolumeFlow other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(VolumeFlow other, double tolerance, ComparisonType comparisonType) + public bool Equals(VolumeFlow other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs index cb592d843f..0e3d8d758c 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// Volume, typically of fluid, that a container can hold within a unit of length. /// public partial struct VolumePerLength : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -110,12 +111,12 @@ public VolumePerLength(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static VolumePerLength MaxValue { get; } = new VolumePerLength(double.MaxValue, BaseUnit); + public static VolumePerLength MaxValue { get; } = new VolumePerLength(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static VolumePerLength MinValue { get; } = new VolumePerLength(double.MinValue, BaseUnit); + public static VolumePerLength MinValue { get; } = new VolumePerLength(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -131,7 +132,7 @@ public VolumePerLength(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerMeter. /// - public static VolumePerLength Zero { get; } = new VolumePerLength((T)0, BaseUnit); + public static VolumePerLength Zero { get; } = new VolumePerLength(default(T), BaseUnit); #endregion @@ -144,6 +145,29 @@ public VolumePerLength(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public VolumePerLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => VolumePerLength.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => VolumePerLength.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -334,7 +358,7 @@ public static VolumePerLength Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static VolumePerLength Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, VolumePerLengthUnit>( + return QuantityParser.Default.Parse, VolumePerLengthUnit>( str, provider, From); @@ -365,7 +389,7 @@ public static bool TryParse(string? str, out VolumePerLength result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out VolumePerLength result) { - return QuantityParser.Default.TryParse, VolumePerLengthUnit>( + return QuantityParser.Default.TryParse, VolumePerLengthUnit>( str, provider, From, @@ -587,10 +611,10 @@ public bool Equals(VolumePerLength other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(VolumePerLength other, double tolerance, ComparisonType comparisonType) + public bool Equals(VolumePerLength other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs index d749e2ee1f..f5f06106b7 100644 --- a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs @@ -35,6 +35,7 @@ namespace UnitsNet /// A geometric property of an area that is used to determine the warping stress. /// public partial struct WarpingMomentOfInertia : IQuantityT, IEquatable>, IComparable, IComparable>, IConvertible, IFormattable + where T : struct { /// /// The unit this quantity was constructed with. @@ -109,12 +110,12 @@ public WarpingMomentOfInertia(T value, UnitSystem unitSystem) /// /// Represents the largest possible value of /// - public static WarpingMomentOfInertia MaxValue { get; } = new WarpingMomentOfInertia(double.MaxValue, BaseUnit); + public static WarpingMomentOfInertia MaxValue { get; } = new WarpingMomentOfInertia(GenericNumberHelper.MaxValue, BaseUnit); /// /// Represents the smallest possible value of /// - public static WarpingMomentOfInertia MinValue { get; } = new WarpingMomentOfInertia(double.MinValue, BaseUnit); + public static WarpingMomentOfInertia MinValue { get; } = new WarpingMomentOfInertia(GenericNumberHelper.MinValue, BaseUnit); /// /// The of this quantity. @@ -130,7 +131,7 @@ public WarpingMomentOfInertia(T value, UnitSystem unitSystem) /// /// Gets an instance of this quantity with a value of 0 in the base unit MeterToTheSixth. /// - public static WarpingMomentOfInertia Zero { get; } = new WarpingMomentOfInertia((T)0, BaseUnit); + public static WarpingMomentOfInertia Zero { get; } = new WarpingMomentOfInertia(default(T), BaseUnit); #endregion @@ -143,6 +144,29 @@ public WarpingMomentOfInertia(T value, UnitSystem unitSystem) double IQuantity.Value => Convert.ToDouble(Value); + Enum IQuantity.Unit => Unit; + + /// + public WarpingMomentOfInertiaUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => WarpingMomentOfInertia.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => WarpingMomentOfInertia.BaseDimensions; + + #endregion + #region Conversion Properties /// @@ -320,7 +344,7 @@ public static WarpingMomentOfInertia Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static WarpingMomentOfInertia Parse(string str, IFormatProvider? provider) { - return QuantityParser.Default.Parse, WarpingMomentOfInertiaUnit>( + return QuantityParser.Default.Parse, WarpingMomentOfInertiaUnit>( str, provider, From); @@ -351,7 +375,7 @@ public static bool TryParse(string? str, out WarpingMomentOfInertia result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse(string? str, IFormatProvider? provider, out WarpingMomentOfInertia result) { - return QuantityParser.Default.TryParse, WarpingMomentOfInertiaUnit>( + return QuantityParser.Default.TryParse, WarpingMomentOfInertiaUnit>( str, provider, From, @@ -573,10 +597,10 @@ public bool Equals(WarpingMomentOfInertia other) /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// The comparison type: either relative or absolute. /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(WarpingMomentOfInertia other, double tolerance, ComparisonType comparisonType) + public bool Equals(WarpingMomentOfInertia other, T tolerance, ComparisonType comparisonType) { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + if (CompiledLambdas.LessThan(tolerance, 0)) + throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0"); var otherValueInThisUnits = other.As(this.Unit); return UnitsNet.Comparison.Equals(Value, otherValueInThisUnits, tolerance, comparisonType); diff --git a/UnitsNet/InternalHelpers/GenericNumberHelper.cs b/UnitsNet/InternalHelpers/GenericNumberHelper.cs new file mode 100644 index 0000000000..ad9dce0565 --- /dev/null +++ b/UnitsNet/InternalHelpers/GenericNumberHelper.cs @@ -0,0 +1,43 @@ +// Licensed under MIT No Attribution, see LICENSE file at the root. +// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. + +using System; +using System.Collections.Generic; + +namespace UnitsNet.InternalHelpers +{ + /// + /// Helpers for working with generic numbers. + /// + /// + internal class GenericNumberHelper where T : struct + { + private static readonly Dictionary TypeToInfo; + + static GenericNumberHelper() + { + TypeToInfo = new Dictionary + { + {typeof(int), new GenericNumberInfo(int.MaxValue, int.MinValue)}, + {typeof(long), new GenericNumberInfo(long.MaxValue, long.MinValue)}, + {typeof(double), new GenericNumberInfo(double.MaxValue, double.MinValue)}, + {typeof(decimal), new GenericNumberInfo(decimal.MaxValue, decimal.MinValue)}, + }; + } + + public static T MaxValue => (T) TypeToInfo[typeof(T)].MaxValue; + public static T MinValue => (T) TypeToInfo[typeof(T)].MinValue; + + private class GenericNumberInfo + { + public GenericNumberInfo(object maxValue, object minValue) + { + MaxValue = maxValue; + MinValue = minValue; + } + + public object MaxValue { get; } + public object MinValue { get; } + } + } +} From 391e9521e2a987d20115e6ba531e691a62a91e83 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Wed, 30 Dec 2020 01:35:23 +0100 Subject: [PATCH 13/13] Whitespace fix --- UnitsNet/UnitsNet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitsNet/UnitsNet.csproj b/UnitsNet/UnitsNet.csproj index c16b0cbccb..3597d9de13 100644 --- a/UnitsNet/UnitsNet.csproj +++ b/UnitsNet/UnitsNet.csproj @@ -60,7 +60,7 @@ - +